Tests: under_wine() clobbers the calling thread's GetLastError() #1125

Open
opened 2026-11-26 04:44:15 +00:00 by github-bot · 0 comments
Owner

@⁠mahfuzinam0045-spec on GitHub · 2026-11-24 12:09 UTC · original

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().

**@⁠mahfuzinam0045-spec** on GitHub · 2026-11-24 12:09 UTC · [original](https://github.com/xcl-dev/xcl/issues/1125) 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()\.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.