Expand description
§win32-min
Minimal, hand-rolled Win32 FFI for Windows security, administration, and audit tooling, packaged as one small crate with zero runtime dependencies.
§Design
- Pure
extern "system"declarations +#[repr(C)]structs. No proc macros, no build script, no code generation. - Feature-gated by Win32 subsystem. Default = only the
foundationtypes (HANDLE, LUID, NTSTATUS, PCWSTR, …). Enable only what you need. - Every declaration
unsafebecause Win32 FFI isunsafe; callers wrap. - Sub-second cold compile. Constant-fold in linker. No transitive deps.
§Features
| Feature | Subsystem | Downstream consumer |
|---|---|---|
process | Process discovery and inspection | security inventory tools |
thread | Thread discovery and control | diagnostics tools |
module | DLL loading and symbol lookup | dynamic integrations |
file | File identity and metadata | DFIR tools |
security | ACL/security-descriptor inspection | ACL auditors |
security-token | Token / privilege / impersonation | windows-token |
services | Service Control Manager (local) | windows-scm |
lsa-auth | LSA authentication package | windows-lsa |
eventlog | EventLog v6 (Evt* API) | windows-eventlog-native |
registry | Registry open/query/enumeration | — |
process-thread | Compatibility alias for process + thread | — |
security-descriptor | Compatibility alias for security | windows-sddl ecosystem |
full | every subsystem | — |
§Why not windows-rs or winapi
windows-rs— official Microsoft, correct + comprehensive, but 100+ MB artifacts, feature-flag puzzle, and version churn (0.48 → 0.51 → 0.58 → 0.61) creates dep-graph duplication in binaries that pull multiplewindows-rs- based crates. Use it for COM (which this crate does not attempt to cover).winapi— deprecated de-facto since 2021. Last release 0.3.9.
win32-min covers only what a hand-audited surface actually needs — no COM,
no WinRT, no DirectX, no auto-generated bindings. If you need those, use
windows-rs. If you need one of the four subsystems above and don’t want to
pay the windows-rs cost, use this.
§Non-goals
- Not a Win32 SDK replacement. Missing ~99% of the Win32 API surface.
- Not a COM host. COM interfaces require vtable layouts +
IUnknownsupport thatwindows-rshandles cleanly; hand-rolling that is not worth the LOC. - Not portable — Windows-only, no fallback stubs.
Modules§
- foundation
- Foundation types + a handful of always-linked functions.
- handles
- Small subsystem-specific owned-handle wrappers.
Structs§
- Win32
Error - A raw Win32 error code with zero-allocation message formatting.