microsoft / wdkmetadata

Tooling to generate metadata for Win32 APIs in the Windows Driver Kit (WDK).
Other
96 stars 10 forks source link

`OBJECT_ATTRIBUTES` has missing field types #82

Closed kennykerr closed 1 week ago

kennykerr commented 1 month ago

The metadata has this:

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;
}

But the header has this definition:

typedef struct _OBJECT_ATTRIBUTES {
    ULONG Length;
    HANDLE RootDirectory;
    PUNICODE_STRING ObjectName;
    ULONG Attributes;
    PVOID SecurityDescriptor;        // Points to type SECURITY_DESCRIPTOR
    PVOID SecurityQualityOfService;  // Points to type SECURITY_QUALITY_OF_SERVICE
} OBJECT_ATTRIBUTES;
typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;

Admittedly the types are only lurking in the comments, but it would be useful if we can actually use the correct types as they do exist in metadata.

kennykerr commented 1 week ago

I think https://github.com/microsoft/wdkmetadata/commit/214d88031318a188fb643d4bbbd1ee20a30af75e is wrong as those fields must still be pointers. They're just not opaque pointers.

mikebattista commented 1 week ago

I think 214d880 is wrong as those fields must still be pointers. They're just not opaque pointers.

Thanks. Fixed.