Step Into Rust · Lesson 15 · Capstone
Capstone: a PE Inspector
Read a Windows executable's headers from disk, safely, with errors, structs and slices.
- ~60 minreading and coding
- 5missions
- membersaccess
- Rustlanguage
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
- A small, real tool
- The layout you will read
- Never trust the input
- Exit codes this tool uses
Missions
- Open the file
- Follow e_lfanew
- The file header
- The optional header
- The section table