Step Into Labs

Step Into Rust · Lesson 15 · Capstone

Capstone: a PE Inspector

Read a Windows executable's headers from disk, safely, with errors, structs and slices.

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.

You will build peinfo: a command-line tool that reads a Windows executable and prints its headers, like a tiny dumpbin /headers. It's the same format you parsed in C and walked in memory in assembly, now from a file, with Rust's error handling and no unsafe code at all.

In this lesson

Missions

  1. Open the file
  2. Follow e_lfanew
  3. The file header
  4. The optional header
  5. The section table