You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code will fail randomly on x86/x64 because CONTEXT is defined as DECLSPEC_ALIGN(16) in winnt.h, but does not have any alignment annotation in windows-rs.
let hthread = unsafe { OpenThread(THREAD_ALL_ACCESS, FALSE, debug_event.dwThreadId) };
let mut ctx: CONTEXT = unsafe { std::mem::zeroed() };
ctx.ContextFlags = CONTEXT_ALL;
let ret = unsafe { GetThreadContext(hthread, &mut ctx) };
I tried working around the issues in microsoft/windows-rs#2352 but that didn't work out. Transferring to the Win32 metadata repo, as I don't think there's anything I can do until the metadata has been fixed.
Which crate is this about?
windows-sys
Crate version
0.45.0
Summary
The following code will fail randomly on x86/x64 because CONTEXT is defined as DECLSPEC_ALIGN(16) in winnt.h, but does not have any alignment annotation in windows-rs.
Winnt.h:
Toolchain version/configuration
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\timmi.rustup
stable-x86_64-pc-windows-msvc (default)
rustc 1.67.0 (fc594f156 2023-01-24)
Reproducible example
No response
Crate manifest
Expected behavior
Alignment should be 16 bytes
Actual behavior
Structure has no explicit alignment, causing random failures when using it with APIs that expect alignment.
Additional comments
No response
The text was updated successfully, but these errors were encountered: