-
Notifications
You must be signed in to change notification settings - Fork 113
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
OBJECT_ATTRIBUTES
should have read-only fields
#1565
Comments
There's no metadata to scrape for this so anything would have to be manually added. What did you have in mind here? |
Well the distinction only really matters for pointer types so I was imagining something like adding the public struct OBJECT_ATTRIBUTES
{
public uint Length;
public HANDLE RootDirectory;
[Const]
public unsafe UNICODE_STRING* ObjectName;
public uint Attributes;
[Const]
public unsafe void* SecurityDescriptor;
[Const]
public unsafe void* SecurityQualityOfService;
} This mimics the way it's done for function parameters. |
Sounds good, I think there are some other structs that already have such |
The doc page says "To set the members of this structure, use the InitializeObjectAttributes macro." but function-like macros are not part of the metadata, are they? So applications creating instances of OBJECT_ATTRIBUTES have to the the members directly anyway. The doc page also says "If you must specify a non-NULL value, set the SecurityQualityOfService member after initialization." even though SecurityQualityOfService is a pointer. So, I do not believe adding |
Yes, you have to be able to construct the #[repr(C)]
pub struct OBJECT_ATTRIBUTES {
pub Length: u32,
pub RootDirectory: HANDLE,
pub ObjectName: *const UNICODE_STRING,
pub Attributes: u32,
pub SecurityDescriptor: *const c_void,
pub SecurityQualityOfService: *const c_void,
} Note the pointers are |
Adding the |
And to save folks 30 seconds looking it up, here's the initialize macro. Nothing special here. #define InitializeObjectAttributes( p, n, a, r, s ) { \
(p)->Length = sizeof( OBJECT_ATTRIBUTES ); \
(p)->RootDirectory = r; \
(p)->Attributes = a; \
(p)->ObjectName = n; \
(p)->SecurityDescriptor = s; \
(p)->SecurityQualityOfService = NULL; \
} Be aware this structure is used in user-mode (e.g., |
Ah, I had somehow got the impression that |
Me too. Aren't they? 🤔 |
They're moved. |
Ah right microsoft/wdkmetadata#37, thanks for reminder. |
According to the docs the pointers in the
OBJECT_ATTRIBUTES
struct should be read-only, but I'm not sure if that can be expressed in the metadata yet?Also this struct should probably be moved to wdk
The text was updated successfully, but these errors were encountered: