Tests: under_wine() clobbers the calling thread's GetLastError() #1116
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by mahfuzinam0045-spec on 2026-11-24T12:09:43Z.
The first invocation of \crate::util::under_wine()\ looks up \wine_get_version\ in
tdll.dll\ using \GetProcAddress. On native Windows, \wine_get_version\ does not exist in
tdll.dll, so \GetProcAddress\ fails and Windows \SetLastError\ mutates the thread's last error to \127\ (\ERROR_PROC_NOT_FOUND).
When \under_wine()\ is called before checking \GetLastError()\ (or inside a code path where Win32 errors are queried), the caller's last error is clobbered. This was previously observed in \ runcate_existing_validation_errors\ (commit
d78597d), where a local workaround was introduced in \fs.rs, but \under_wine()\ itself was never updated to preserve \GetLastError().