Skip to content
This repository was archived by the owner on Nov 16, 2025. It is now read-only.

Remove INVALID_HANDLE_VALUE#144

Merged
lighterowl merged 2 commits intodevelopfrom
no-invalid-handle-value
May 18, 2025
Merged

Remove INVALID_HANDLE_VALUE#144
lighterowl merged 2 commits intodevelopfrom
no-invalid-handle-value

Conversation

@lighterowl
Copy link
Owner

@lighterowl lighterowl commented May 18, 2025

INVALID_HANDLE_VALUE is a WinAPIsm that shouldn't have been used in the first place. Building transgui with Lazarus 4.0 fails due to this constant being moved/removed. According to the documentation, the "official" return value from FileOpen on error is THandle(-1) but digging into the implementations themselves reveals that the symbolic constant for this is https://www.freepascal.org/docs-html/rtl/sysutils/feinvalidhandle.html .

Also don't check if the file exists before opening it as that's just classic TOCTTOU.

@lighterowl lighterowl self-assigned this May 18, 2025
@lighterowl lighterowl merged commit 561539e into develop May 18, 2025
5 checks passed
@lighterowl lighterowl deleted the no-invalid-handle-value branch May 18, 2025 19:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant