Step Into Labs

Step Into Rust · Lesson 12 · Systems Rust

The Windows API from Rust

Declaring kernel32 functions, GetLastError, VirtualAlloc, GetProcAddress and your own PE headers.

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

Missions

  1. Hello, kernel32
  2. A page of memory
  3. GetProcAddress
  4. Read your own headers