microsoft / wdkmetadata

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

Incorrect DRIVER_OBJECT member types #59

Closed vlabo closed 5 months ago

vlabo commented 10 months ago

In The DRIVER_OBJECT struct

pub struct DRIVER_OBJECT {
    pub Type: i16,
    pub Size: i16,
    pub DeviceObject: *mut DEVICE_OBJECT,
    pub Flags: u32,
    pub DriverStart: *mut ::core::ffi::c_void,
    pub DriverSize: u32,
    pub DriverSection: *mut ::core::ffi::c_void,
    pub DriverExtension: *mut DRIVER_EXTENSION,
    pub DriverName: super::super::Win32::Foundation::UNICODE_STRING,
    pub HardwareDatabase: *mut super::super::Win32::Foundation::UNICODE_STRING,
    pub FastIoDispatch: *mut FAST_IO_DISPATCH,
    pub DriverInit: *mut DRIVER_INITIALIZE,
    pub DriverStartIo: *mut DRIVER_STARTIO,
    pub DriverUnload: *mut DRIVER_UNLOAD,
    pub MajorFunction: [*mut DRIVER_DISPATCH; 28],
}

DriverUnload -> *mut DRIVER_UNLOAD aka: mut Option<unsafe extern "system" fn(driverobject: const DRIVER_OBJECT)> Should be just Option<...>

The same for DriverInit, DriverStartIo and MajorFunction

The correct version

pub struct DRIVER_OBJECT {
    ...
    pub DriverInit: DRIVER_INITIALIZE,
    pub DriverStartIo: DRIVER_STARTIO,
    pub DriverUnload: DRIVER_UNLOAD,
    pub MajorFunction: [DRIVER_DISPATCH; 28],
}

In previous version this issue was not present, but the function prototype where missing arguments. https://github.com/microsoft/wdkmetadata/issues/47

mikebattista commented 5 months ago

Should be fixed with https://github.com/microsoft/wdkmetadata/issues/67.