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

wintypes

A rust library that exports windows functions as types

3 releases

new 0.1.2 Jan 18, 2025
0.1.1 Jan 18, 2025
0.1.0 Jan 17, 2025

#536 in Rust patterns

Download history

56 downloads per month

MIT license

635KB
6K 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