microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.34k stars 116 forks source link

`RAIIFree` implies `InvalidHandleValue` #1891

Closed kennykerr closed 5 months ago

kennykerr commented 6 months ago

Taking another stab at supporting RAIIFree in Rust, but the following structs have the RAIIFree attribute but lack at least one InvalidHandleValue attribute. Is that intentional? Are we meant to assume that zero is thus the invalid value?

kennykerr commented 6 months ago

Conversely, there are many structs that have at least one InvalidHandleValue attribute but lack a corresponding RAIIFree attribute. Is that intentional?

riverar commented 6 months ago
  • HIORING

Disassembling kernelbase![...]::VerifyValidIoRingHandle reveals it returns INVALID_HANDLE_VALUE when provided -1 and 0, so will add that.

  • PTP_CLEANUP_GROUP

Documented as an opaque struct pointer. We can minimally add 0 to the invalid handle value list here.

  • PTP_POOL

Same as above.

  • SOCKET

Will add -1 per INVALID_SOCKET.

riverar commented 6 months ago

Regarding the longer list of types that have InvalidHandleValue markings but not RAIIFree, this is just an artifact of the RAII effort not being complete. Will try to get those all covered.

Live checklist: