# spokwn/prefetch-parser architecture

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

- Interactive diagram: https://gitdiagram.com/spokwn/prefetch-parser
- Repository: https://github.com/spokwn/prefetch-parser

## Overview

This is a Windows Prefetch Parser desktop application: it starts a Direct3D/ImGui window and repeatedly renders a UI for Prefetch-file information, including execution times, related files, signature status, and YARA-rule matches. The UI also exposes filters for unsigned, flagged, and in-instance files. The repository bundles YARA and Dear ImGui, but the excerpts do not show the complete Prefetch parsing or rule-scanning call chain; those links are therefore omitted rather than inferred.

Main entry points: [`Main.cpp`](https://github.com/spokwn/prefetch-parser/blob/main/Main.cpp) (Windows entry), [`ui/ui.cc`](https://github.com/spokwn/prefetch-parser/blob/main/ui/ui.cc) (Prefetch UI), [`imgui/imgui.cpp`](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui.cpp) (ImGui core), [`imgui/imgui_impl_dx9.cpp`](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_impl_dx9.cpp) (DX9 backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_entry["Windows entry<br/>[Main.cpp]"]
  node_d3d["D3D device<br/>[Main.h]"]
end

subgraph group_analysis["File analysis"]
  node_shared["App data types<br/>[include.h]"]
  node_utilities["File utilities<br/>[utils.cpp]"]
  node_yara_app["Rule scanning<br/>[yara.cpp]"]
end

subgraph group_ui["User interface"]
  node_ui_view["Prefetch UI<br/>[ui.cc]"]
  node_ui_state["UI state<br/>[ui.h]"]
  node_font["Embedded fonts<br/>[font.h]"]
  node_imgui_core["ImGui core<br/>[imgui.cpp]"]
  node_imgui_draw["Drawing engine<br/>[imgui_draw.cpp]"]
  node_imgui_widgets["Widgets<br/>[imgui_widgets.cpp]"]
  node_imgui_dx9["DX9 backend<br/>[imgui_impl_dx9.cpp]"]
  node_imgui_win32["Win32 backend"]
end

subgraph group_yara["YARA engine"]
  node_yara_scan["YARA scanning<br/>[scan.c]"]
  node_yara_compile["Rule compiler<br/>[compiler.c]"]
  node_yara_parser["Rule parser<br/>[parser.c]"]
  node_yara_modules["Analysis modules"]
end

node_user(("Desktop user"))

node_user -->|"launches"| node_entry
node_entry -->|"creates device"| node_d3d
node_entry -->|"initializes and renders"| node_ui_view
node_entry -->|"starts backend"| node_imgui_dx9
node_entry -->|"starts backend"| node_imgui_win32
node_entry -->|"loads fonts"| node_font
node_ui_view -->|"converts paths"| node_utilities
node_ui_view -->|"uses UI state"| node_ui_state
node_ui_view -->|"builds interface"| node_imgui_core
node_ui_view -->|"uses file records"| node_shared
node_yara_app -.->|"invokes scanning"| node_yara_scan
node_yara_compile -.->|"parses rules"| node_yara_parser
node_imgui_core -.->|"produces draw data"| node_imgui_draw
node_imgui_core -.->|"provides widgets"| node_imgui_widgets
node_imgui_dx9 -.->|"renders through"| node_d3d

click node_entry "https://github.com/spokwn/prefetch-parser/blob/main/Main.cpp"
click node_d3d "https://github.com/spokwn/prefetch-parser/blob/main/Main.h"
click node_ui_view "https://github.com/spokwn/prefetch-parser/blob/main/ui/ui.cc"
click node_ui_state "https://github.com/spokwn/prefetch-parser/blob/main/ui/ui.h"
click node_font "https://github.com/spokwn/prefetch-parser/blob/main/ui/font.h"
click node_shared "https://github.com/spokwn/prefetch-parser/blob/main/include.h"
click node_utilities "https://github.com/spokwn/prefetch-parser/blob/main/utils.cpp"
click node_yara_app "https://github.com/spokwn/prefetch-parser/blob/main/yara.cpp"
click node_yara_scan "https://github.com/spokwn/prefetch-parser/blob/main/ext/include/libyara/scan.c"
click node_yara_compile "https://github.com/spokwn/prefetch-parser/blob/main/ext/include/libyara/compiler.c"
click node_yara_parser "https://github.com/spokwn/prefetch-parser/blob/main/ext/include/libyara/parser.c"
click node_yara_modules "https://github.com/spokwn/prefetch-parser/tree/main/ext/include/libyara/modules"
click node_imgui_core "https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui.cpp"
click node_imgui_draw "https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_draw.cpp"
click node_imgui_widgets "https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_widgets.cpp"
click node_imgui_dx9 "https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_impl_dx9.cpp"
click node_imgui_win32 "https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_impl_win32.cpp"

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_entry,node_d3d,node_user toneBlue
class node_shared,node_utilities,node_yara_app toneAmber
class node_ui_view,node_ui_state,node_font,node_imgui_core,node_imgui_draw,node_imgui_widgets,node_imgui_dx9,node_imgui_win32 toneMint
class node_yara_scan,node_yara_compile,node_yara_parser,node_yara_modules toneRose
```

## Components

### Desktop application

- [Windows entry](https://github.com/spokwn/prefetch-parser/blob/main/Main.cpp): `Main.cpp`
- [D3D device](https://github.com/spokwn/prefetch-parser/blob/main/Main.h): `Main.h`

### File analysis

- [App data types](https://github.com/spokwn/prefetch-parser/blob/main/include.h): `include.h`
- [File utilities](https://github.com/spokwn/prefetch-parser/blob/main/utils.cpp): `utils.cpp`
- [Rule scanning](https://github.com/spokwn/prefetch-parser/blob/main/yara.cpp): `yara.cpp`

### User interface

- [Prefetch UI](https://github.com/spokwn/prefetch-parser/blob/main/ui/ui.cc): `ui/ui.cc`
- [UI state](https://github.com/spokwn/prefetch-parser/blob/main/ui/ui.h): `ui/ui.h`
- [Embedded fonts](https://github.com/spokwn/prefetch-parser/blob/main/ui/font.h): `ui/font.h`
- [ImGui core](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui.cpp): `imgui/imgui.cpp`
- [Drawing engine](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_draw.cpp): `imgui/imgui_draw.cpp`
- [Widgets](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_widgets.cpp): `imgui/imgui_widgets.cpp`
- [DX9 backend](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_impl_dx9.cpp): `imgui/imgui_impl_dx9.cpp`
- [Win32 backend](https://github.com/spokwn/prefetch-parser/blob/main/imgui/imgui_impl_win32.cpp): `imgui/imgui_impl_win32.cpp`

### YARA engine

- [YARA scanning](https://github.com/spokwn/prefetch-parser/blob/main/ext/include/libyara/scan.c): `ext/include/libyara/scan.c`
- [Rule compiler](https://github.com/spokwn/prefetch-parser/blob/main/ext/include/libyara/compiler.c): `ext/include/libyara/compiler.c`
- [Rule parser](https://github.com/spokwn/prefetch-parser/blob/main/ext/include/libyara/parser.c): `ext/include/libyara/parser.c`
- [Analysis modules](https://github.com/spokwn/prefetch-parser/tree/main/ext/include/libyara/modules): `ext/include/libyara/modules`

### Other components

- **Desktop user**

## Connections

- Desktop user → Windows entry: launches (evidence: `Main.cpp`)
- Windows entry → D3D device: creates device (evidence: `Main.cpp`)
- Windows entry → Prefetch UI: initializes and renders (evidence: `Main.cpp`)
- Windows entry → DX9 backend: starts backend (evidence: `Main.cpp`)
- Windows entry → Win32 backend: starts backend (evidence: `Main.cpp`)
- Windows entry → Embedded fonts: loads fonts (evidence: `Main.cpp`)
- Prefetch UI → File utilities: converts paths (evidence: `ui/ui.cc`)
- Prefetch UI → UI state: uses UI state (evidence: `ui/ui.cc`)
- Prefetch UI → ImGui core: builds interface (evidence: `ui/ui.cc`)
- Prefetch UI → App data types: uses file records (evidence: `ui/ui.cc`)
- Rule scanning → YARA scanning: invokes scanning
- Rule compiler → Rule parser: parses rules
- ImGui core → Drawing engine: produces draw data
- ImGui core → Widgets: provides widgets
- DX9 backend → D3D device: renders through
