windows-drivers-rs icon indicating copy to clipboard operation
windows-drivers-rs copied to clipboard

Usability improvements

Open Unkorunk opened this issue 11 months ago • 0 comments

  1. Define the CTL_CODE macro and the IoGetCurrentIrpStackLocation function.

  2. 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.

  3. Change the types of some constants, like IRP_MJ_* to usize, and IO_NO_INCREMENT to CCHAR. It would also be beneficial to define TRUE and FALSE as pub const TRUE: BOOLEAN = 1; and pub const FALSE: BOOLEAN = 0; respectively, or even better, eliminate all BOOLEAN 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.

  4. 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.

  5. In general, it would be beneficial if constants in constants.rs had types from types.rs.

Unkorunk avatar Mar 03 '24 14:03 Unkorunk