ms-win32
Installation
SKILL.md
Win32 Discipline
Invoke for ANY code touching Windows APIs: *W/*A functions from kernel32/user32/advapi32/ole32/shell32 and friends, COM interfaces, handles (HANDLE, HWND, HDC), registry, services, or shell — in any language, however trivial the snippet.
Non-negotiables
- Unicode
WAPIs only, neverA. Text is UTF-16 or UTF-8 only; neverCP_ACPor any ANSI/narrow encoding for durable or protocol text. - Bytes are not UTF-16 code units. Honor exact length contracts and terminators; never assume null termination when a length is supplied.
- Check documented failure values.
FAILED/SUCCEEDEDforHRESULT;ERROR_SUCCESSforLSTATUS; captureGetLastError()only where documented — many calls invalidate it. - RAII ownership with matching release for handles, buffers, and COM allocations; never release borrowed or pseudo-handles. Initialize structure size/version fields (
cbSizeetc.) as documented; use pointer-sized types (DWORD_PTR,INT_PTR) without truncation.
When a rule here conflicts with an API's documented contract, the documented contract wins — note the deviation.
Cross-language general (Rust FFI and friends)
These rules apply to ANY language calling Windows APIs; each language skill defers here instead of restating them.