Step Into Rust · Lesson 12 · Systems Rust
The Windows API from Rust
Declaring kernel32 functions, GetLastError, VirtualAlloc, GetProcAddress and your own PE headers.
- ~45 minreading and coding
- 4missions
- membersaccess
- Win32real Windows API
Part of Step Into Rust. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
Real projects use Microsoft's windows or windows-sys crates, which declare every API for you. Doing it by hand once shows you there is no magic: a Windows function is an extern "system" declaration and a library to link against.
In this lesson
- Declaring Windows functions yourself
- Translating the types
- A wide-string helper
- Function pointers from GetProcAddress
- Reading structures at an address
Missions
- Hello, kernel32
- A page of memory
- GetProcAddress
- Read your own headers