Types v0.1.0
Handle
pub type Handle = *var opaque
An opaque kernel object reference.
Pointer-sized and owned by the kernel. A handle is valid until CloseHandle takes it, after which the number may
be reused by the next object opened — so a stale handle does not fail, it addresses something else.
ModuleHandle
pub type ModuleHandle = *var opaque
A module reference, as LoadLibraryW returns one.
Bool
pub type Bool = int32
Win32's BOOL: a 32-bit integer where zero is false and anything else is true.
Not a one-byte boolean, and not bool. A call returning one reports failure as zero and success as anything
else, which is why comparing against 1 is wrong.
Dword
pub type Dword = uint32
Win32's DWORD: a 32-bit unsigned integer.
WideChar
pub type WideChar = char16
A UTF-16 code unit, which is what every *W entry point takes.
Not a character: a scalar outside the basic plane occupies two of these.
NtStatus
pub type NtStatus = int32
An NTSTATUS: the status code the native and cryptographic interfaces report with.
Zero and above is success; below zero is failure. This is a different scheme from GetLastError, and a value of
one must never be read as the other.
InvalidHandleValue
pub const InvalidHandleValue: uint64 = 0xFFFFFFFFFFFFFFFF;
The value a handle-returning call reports failure with.
-1 cast to a pointer, which is not null. CreateFileW and FindFirstFileW report failure this way; a
memory-returning call such as VirtualAlloc reports null instead.