# iss4cf0ng/ironpe architecture

> Architecture diagram of the GitHub repository iss4cf0ng/ironpe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iss4cf0ng/ironpe
- Repository: https://github.com/iss4cf0ng/ironpe

## Overview

IronPE is a Windows command-line manual PE loader for x86 and x64 binaries. Its primary workflow reads a PE file, validates and parses its architecture-specific headers, maps headers and sections into memory, applies relocations, resolves imports, and starts execution at the original entry point. The README documents these loader capabilities; excerpts show the CLI dispatch, parsing and parts of both loading paths. Some loader implementation is omitted, so undocumented internal calls are not expanded.

Main entry points: [`src/main.rs`](https://github.com/iss4cf0ng/ironpe/blob/main/src/main.rs) (Command dispatch), [`src/loader.rs`](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs) (x86 mapping), [`src/logger.rs`](https://github.com/iss4cf0ng/ironpe/blob/main/src/logger.rs) (Console logger), [`src/pe_structures.rs`](https://github.com/iss4cf0ng/ironpe/blob/main/src/pe_structures.rs) (PE structures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and input"]
  node_cli["Command dispatch<br/>[main.rs]"]
  node_file_read["File reader<br/>[main.rs]"]
  node_logger["Console logger<br/>[logger.rs]"]
end

subgraph group_format["PE format"]
  node_pe_structs["PE structures<br/>[pe_structures.rs]"]
  node_x86_parse["x86 parser<br/>[loader.rs]"]
  node_x64_parse["x64 parser<br/>[loader.rs]"]
end

subgraph group_loading["Manual loading"]
  node_x86_load["x86 mapping<br/>[loader.rs]"]
  node_x64_load["x64 mapping<br/>[loader.rs]"]
  node_sections["Section mapping<br/>[loader.rs]"]
  node_relocations["Base relocations<br/>[loader.rs]"]
  node_imports["Import resolution<br/>[loader.rs]"]
  node_entry["Entry point transfer<br/>[loader.rs]"]
end

subgraph group_platform["Windows runtime"]
  node_windows_memory["Windows memory API"]
  node_windows_loader["Windows library API"]
  node_windows_thread["Windows thread API"]
end

node_user(("CLI user"))
node_pe_file["PE file"]

node_user -->|"selects mode"| node_cli
node_cli -->|"reads path"| node_file_read
node_file_read -->|"loads bytes"| node_pe_file
node_cli -->|"parses x86"| node_x86_parse
node_cli -->|"parses x64"| node_x64_parse
node_x86_parse -->|"reads structures"| node_pe_structs
node_x64_parse -->|"reads structures"| node_pe_structs
node_cli -->|"loads image"| node_x86_load
node_cli -->|"loads image"| node_x64_load
node_x86_load -->|"maps sections"| node_sections
node_x64_load -->|"maps sections"| node_sections
node_x86_load -->|"applies relocations"| node_relocations
node_x64_load -->|"applies relocations"| node_relocations
node_x86_load -->|"resolves imports"| node_imports
node_x64_load -->|"resolves imports"| node_imports
node_x86_load -->|"allocates memory"| node_windows_memory
node_x64_load -->|"allocates memory"| node_windows_memory
node_imports -->|"loads libraries"| node_windows_loader
node_imports -->|"looks up symbols"| node_windows_loader
node_x86_load -->|"transfers execution"| node_entry
node_x64_load -->|"transfers execution"| node_entry
node_entry -->|"starts thread"| node_windows_thread
node_cli -->|"reports status"| node_logger
node_x86_load -->|"logs progress"| node_logger
node_x64_load -->|"logs progress"| node_logger

click node_cli "https://github.com/iss4cf0ng/ironpe/blob/main/src/main.rs"
click node_file_read "https://github.com/iss4cf0ng/ironpe/blob/main/src/main.rs"
click node_logger "https://github.com/iss4cf0ng/ironpe/blob/main/src/logger.rs"
click node_pe_structs "https://github.com/iss4cf0ng/ironpe/blob/main/src/pe_structures.rs"
click node_x86_parse "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_x64_parse "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_x86_load "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_x64_load "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_sections "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_relocations "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_imports "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"
click node_entry "https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_file_read,node_logger,node_user toneBlue
class node_pe_structs,node_x86_parse,node_x64_parse toneAmber
class node_x86_load,node_x64_load,node_sections,node_relocations,node_imports,node_entry toneMint
class node_windows_memory,node_windows_loader,node_windows_thread toneRose
class node_pe_file toneIndigo
```

## Components

### CLI and input

- [Command dispatch](https://github.com/iss4cf0ng/ironpe/blob/main/src/main.rs): `src/main.rs`
- [File reader](https://github.com/iss4cf0ng/ironpe/blob/main/src/main.rs): `src/main.rs`
- [Console logger](https://github.com/iss4cf0ng/ironpe/blob/main/src/logger.rs): `src/logger.rs`

### PE format

- [PE structures](https://github.com/iss4cf0ng/ironpe/blob/main/src/pe_structures.rs): `src/pe_structures.rs`
- [x86 parser](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`
- [x64 parser](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`

### Manual loading

- [x86 mapping](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`
- [x64 mapping](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`
- [Section mapping](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`
- [Base relocations](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`
- [Import resolution](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`
- [Entry point transfer](https://github.com/iss4cf0ng/ironpe/blob/main/src/loader.rs): `src/loader.rs`

### Windows runtime

- **Windows memory API**
- **Windows library API**
- **Windows thread API**

### Other components

- **CLI user**
- **PE file**

## Connections

- CLI user → Command dispatch: selects mode (evidence: `src/main.rs`)
- Command dispatch → File reader: reads path (evidence: `src/main.rs`)
- File reader → PE file: loads bytes (evidence: `src/main.rs`)
- Command dispatch → x86 parser: parses x86 (evidence: `src/main.rs`)
- Command dispatch → x64 parser: parses x64 (evidence: `src/main.rs`)
- x86 parser → PE structures: reads structures (evidence: `src/loader.rs`)
- x64 parser → PE structures: reads structures (evidence: `src/loader.rs`)
- Command dispatch → x86 mapping: loads image (evidence: `src/main.rs`)
- Command dispatch → x64 mapping: loads image (evidence: `src/main.rs`)
- x86 mapping → Section mapping: maps sections (evidence: `README.md`)
- x64 mapping → Section mapping: maps sections (evidence: `README.md`)
- x86 mapping → Base relocations: applies relocations (evidence: `src/loader.rs`)
- x64 mapping → Base relocations: applies relocations (evidence: `src/loader.rs`)
- x86 mapping → Import resolution: resolves imports (evidence: `src/loader.rs`)
- x64 mapping → Import resolution: resolves imports (evidence: `src/loader.rs`)
- x86 mapping → Windows memory API: allocates memory (evidence: `src/loader.rs`)
- x64 mapping → Windows memory API: allocates memory (evidence: `src/loader.rs`)
- Import resolution → Windows library API: loads libraries (evidence: `src/loader.rs`)
- Import resolution → Windows library API: looks up symbols (evidence: `src/loader.rs`)
- x86 mapping → Entry point transfer: transfers execution (evidence: `README.md`)
- x64 mapping → Entry point transfer: transfers execution (evidence: `README.md`)
- Entry point transfer → Windows thread API: starts thread (evidence: `src/loader.rs`)
- Command dispatch → Console logger: reports status (evidence: `src/main.rs`)
- x86 mapping → Console logger: logs progress (evidence: `src/loader.rs`)
- x64 mapping → Console logger: logs progress (evidence: `src/loader.rs`)
