windows-drivers-rs
windows-drivers-rs copied to clipboard
Usability improvements
-
Define the
CTL_CODE
macro and theIoGetCurrentIrpStackLocation
function. -
Move constants and macros (such as
FILE_DEVICE_UNKNOWN
,METHOD_BUFFERED
, and others) from this crate and windows-rs to a shared crate. Motivation: This enables the definition of IOCTL codes in a shared crate that can be linked to both the driver and application sides. -
Change the types of some constants, like
IRP_MJ_*
tousize
, andIO_NO_INCREMENT
toCCHAR
. It would also be beneficial to defineTRUE
andFALSE
aspub const TRUE: BOOLEAN = 1;
andpub const FALSE: BOOLEAN = 0;
respectively, or even better, eliminate allBOOLEAN
types from the API and replace them with the plain Rust bool, although I understand that this might be nearly impossible. Motivation: To eliminate unnecessary type casting where it logically should not exist. -
Do something with
__bindgen_anon_*
. Motivation: The statement(*irp).IoStatus.__bindgen_anon_1.Status = status;
looks very awkward, and it's also challenging to locate the needed field in more complex cases like(*irp).Tail.Overlay.__bindgen_anon_2.__bindgen_anon_1.CurrentStackLocation
. -
In general, it would be beneficial if constants in
constants.rs
had types fromtypes.rs
.