#exports #dll #function #type #windows #once #user32

wintypes

A rust library that exports windows functions as types

5 releases

0.1.4 Jan 26, 2025
0.1.3 Jan 20, 2025
0.1.2 Jan 18, 2025
0.1.1 Jan 18, 2025
0.1.0 Jan 17, 2025

#422 in Rust patterns

Download history 254/week @ 2025-01-14 156/week @ 2025-01-21 20/week @ 2025-01-28 11/week @ 2025-02-04

441 downloads per month

MIT license

665KB
14K SLoC

wintypes

A rust library that exports windows functions as types

Usage

Once this library is downloaded you can just use a function as a type by DLL:

use wintypes::user32::FnMessageBoxA;

Build

Get DLLs exported functions

The first step is to get the exported functions of the DLLs:

$ scripts/parse_dll_exports.py ~/SharedFolder/dlls/advapi32.dll ~/SharedFolder/dlls/crypt32.dll ~/SharedFolder/dlls/kernel32.dll ~/SharedFolder/dlls/kernelbase.dll ~/SharedFolder/dlls/winhttp.dll ~/SharedFolder/dlls/ntdll.dll | jq . > exports.json

Generate the types

$ ./scripts/parse_doc_crates.py exports.json

Credits

  • ntapi and winapi for implementing windows functions as functions. This project scrapes prototypes from those crates.

Dependencies

~0.7–1MB
~22K SLoC