Skip to content

🐛 fix(win32): capture process probe errors#645

Merged
gaborbernat merged 1 commit into
mainfrom
fix/630-windows-last-error
Jul 14, 2026
Merged

🐛 fix(win32): capture process probe errors#645
gaborbernat merged 1 commit into
mainfrom
fix/630-windows-last-error

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Windows SoftFileLock process probes read GetLastError() through a plain ctypes loader. Another ctypes call could overwrite the thread error after OpenProcess failed, causing filelock to classify a dead PID as live. This closes issue #630.

Filelock now binds kernel32 with use_last_error=True, declares each function signature, and reads ctypes.get_last_error() after a failed probe. Access-denied and unverifiable probes continue to treat the recorded holder as live.

Plain ctypes calls can lose the error set by OpenProcess, causing a stale
marker probe to treat a dead PID as live. Bind kernel32 with last-error capture
and explicit signatures so liveness decisions use the failing call's error.
@gaborbernat gaborbernat force-pushed the fix/630-windows-last-error branch from 1527fbb to 0739ba5 Compare July 14, 2026 01:50
@gaborbernat gaborbernat marked this pull request as ready for review July 14, 2026 01:58
@gaborbernat gaborbernat merged commit a9b3067 into main Jul 14, 2026
64 of 65 checks passed
@gaborbernat gaborbernat deleted the fix/630-windows-last-error branch July 14, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capture Windows process-probe errors through ctypes

1 participant