# hendi48/magicmida architecture

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

- Interactive diagram: https://gitdiagram.com/hendi48/magicmida
- Repository: https://github.com/hendi48/magicmida

## Overview

Magicmida is a Windows Themida unpacker. The documented workflow is to select a target or invoke `/unpack <filename>`, then save an unpacked executable; optional operations restore data sections, replace an unpacked file’s .text from a running process, and shrink unused sections. The tree names likely implementation areas, but no source excerpts were provided, so their call relationships cannot be verified; the graph therefore shows documented product flow without guessing internal wiring.

Main entry points: [`Magicmida.dpr`](https://github.com/hendi48/magicmida/blob/master/Magicmida.dpr) (Magicmida application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Application interface"]
  node_app["Magicmida application<br/>[Magicmida.dpr]"]
  node_gui["Desktop interface<br/>[Unit2.pas]"]
end

subgraph group_unpacking["Unpacking and analysis"]
  node_unpack32["32-bit Themida<br/>[Themida.pas]"]
  node_unpack64["64-bit Themida<br/>[Themida64.pas]"]
  node_themida_common["Themida common<br/>[ThemidaCommon.pas]"]
  node_pe_info["PE inspection<br/>[PEInfo.pas]"]
  node_debugger["Debugger core<br/>[DebuggerCore.pas]"]
  node_tracer["Execution tracing<br/>[Tracer.pas]"]
  node_bea["Instruction engine"]
  node_scyllahide["ScyllaHide integration<br/>[scylla_hide.ini]"]
end

subgraph group_postprocess["Dump and repair"]
  node_dumper["Process dumper<br/>[Dumper.pas]"]
  node_patcher["Binary patcher<br/>[Patcher.pas]"]
  node_anti_dump["Anti-dump fixes<br/>[AntiDumpFix.pas]"]
end

node_user(("User"))
node_unpacked_file["Unpacked executable"]
node_running_process(("Running process"))

node_user -->|"invokes"| node_app
node_app -->|"saves unpacked"| node_unpacked_file
node_user -->|"provides PID"| node_running_process
node_app -->|"dumps .text"| node_running_process
node_app -->|"restores sections"| node_unpacked_file
node_app -->|"shrinks sections"| node_unpacked_file

click node_app "https://github.com/hendi48/magicmida/blob/master/Magicmida.dpr"
click node_gui "https://github.com/hendi48/magicmida/blob/master/Unit2.pas"
click node_unpack32 "https://github.com/hendi48/magicmida/blob/master/Themida.pas"
click node_unpack64 "https://github.com/hendi48/magicmida/blob/master/Themida64.pas"
click node_themida_common "https://github.com/hendi48/magicmida/blob/master/ThemidaCommon.pas"
click node_pe_info "https://github.com/hendi48/magicmida/blob/master/PEInfo.pas"
click node_debugger "https://github.com/hendi48/magicmida/blob/master/DebuggerCore.pas"
click node_tracer "https://github.com/hendi48/magicmida/blob/master/Tracer.pas"
click node_bea "https://github.com/hendi48/magicmida/blob/master/BeaEngineDelphi.pas"
click node_dumper "https://github.com/hendi48/magicmida/blob/master/Dumper.pas"
click node_patcher "https://github.com/hendi48/magicmida/blob/master/Patcher.pas"
click node_anti_dump "https://github.com/hendi48/magicmida/blob/master/AntiDumpFix.pas"
click node_scyllahide "https://github.com/hendi48/magicmida/blob/master/scylla_hide.ini"

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_app,node_gui,node_user toneBlue
class node_unpack32,node_unpack64,node_themida_common,node_pe_info,node_debugger,node_tracer,node_bea,node_scyllahide toneAmber
class node_dumper,node_patcher,node_anti_dump toneMint
class node_unpacked_file,node_running_process toneIndigo
```

## Components

### Application interface

- [Magicmida application](https://github.com/hendi48/magicmida/blob/master/Magicmida.dpr): `Magicmida.dpr`
- [Desktop interface](https://github.com/hendi48/magicmida/blob/master/Unit2.pas): `Unit2.pas`

### Unpacking and analysis

- [32-bit Themida](https://github.com/hendi48/magicmida/blob/master/Themida.pas): `Themida.pas`
- [64-bit Themida](https://github.com/hendi48/magicmida/blob/master/Themida64.pas): `Themida64.pas`
- [Themida common](https://github.com/hendi48/magicmida/blob/master/ThemidaCommon.pas): `ThemidaCommon.pas`
- [PE inspection](https://github.com/hendi48/magicmida/blob/master/PEInfo.pas): `PEInfo.pas`
- [Debugger core](https://github.com/hendi48/magicmida/blob/master/DebuggerCore.pas): `DebuggerCore.pas`
- [Execution tracing](https://github.com/hendi48/magicmida/blob/master/Tracer.pas): `Tracer.pas`
- [Instruction engine](https://github.com/hendi48/magicmida/blob/master/BeaEngineDelphi.pas): `BeaEngineDelphi.pas`
- [ScyllaHide integration](https://github.com/hendi48/magicmida/blob/master/scylla_hide.ini): `scylla_hide.ini`

### Dump and repair

- [Process dumper](https://github.com/hendi48/magicmida/blob/master/Dumper.pas): `Dumper.pas`
- [Binary patcher](https://github.com/hendi48/magicmida/blob/master/Patcher.pas): `Patcher.pas`
- [Anti-dump fixes](https://github.com/hendi48/magicmida/blob/master/AntiDumpFix.pas): `AntiDumpFix.pas`

### Other components

- **User**
- **Unpacked executable**
- **Running process**

## Connections

- User → Magicmida application: invokes
- Magicmida application → Unpacked executable: saves unpacked
- User → Running process: provides PID
- Magicmida application → Running process: dumps .text
- Magicmida application → Unpacked executable: restores sections
- Magicmida application → Unpacked executable: shrinks sections
