Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONTEXT isn't 16b aligned #2641

Closed
0vercl0k opened this issue Sep 1, 2023 · 3 comments
Closed

CONTEXT isn't 16b aligned #2641

0vercl0k opened this issue Sep 1, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@0vercl0k
Copy link

0vercl0k commented Sep 1, 2023

Summary

The windows::Windows::Win32::System::Diagnostics::Debug::CONTEXT structure isn't annotated with align(16) like in the original C structure:

#[repr(C)]
#[doc = "*Required features: `\"Win32_System_Diagnostics_Debug\"`, `\"Win32_System_Kernel\"`*"]
#[cfg(target_arch = "x86_64")]
#[cfg(feature = "Win32_System_Kernel")]
pub struct CONTEXT {
// ...
}
typedef struct DECLSPEC_ALIGN(16) DECLSPEC_NOINITALL _CONTEXT {
// ...
};

This causes issues when passing a CONTEXT to function like GetThreadContext for example (which expects the structure to be placed at a 16b aligned location).

I've looked through the repository and didn't find any existing conversation - am I missing something?

Cheers

Crate manifest

No response

Crate code

No response

@0vercl0k 0vercl0k added the bug Something isn't working label Sep 1, 2023
@ChrisDenton
Copy link
Collaborator

ChrisDenton commented Sep 1, 2023

windows-rs generates code using the metadata produced by the win32metadata project. For CONTEXT see this issue: microsoft/win32metadata#1044

@0vercl0k
Copy link
Author

0vercl0k commented Sep 1, 2023

Ha this makes more sense - I couldn't believe to be the first to hit this, thank you. Feel free to close this issue if tracking it is better in the other repo.

Cheers

@ChrisDenton
Copy link
Collaborator

No problem. Closing as a duplicate of the upstream issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants