# yahel150/winhook-lab architecture

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

- Interactive diagram: https://gitdiagram.com/yahel150/winhook-lab
- Repository: https://github.com/yahel150/winhook-lab

## Overview

WinHook-Lab is a collection of independent Windows C++ experiments that alter classic desktop games and utilities through injected hooks or an on-disk executable patch. The principal workflow is to launch a target, load a hook where applicable, and change behavior as the target processes messages, draws, or updates game state. The README documents the major examples; sampled source confirms several hook implementations and the Solitaire injector, but not every example’s injector or patch implementation, so those links are limited to documented behavior.

Main entry points: [`ChangeColorCalc/ColorDll/dllmain.cpp`](https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/ColorDll/dllmain.cpp) (Color Hook), [`winmine/winmineHook.cpp`](https://github.com/yahel150/winhook-lab/blob/main/winmine/winmineHook.cpp) (Auto-Flag Hook), [`SolitaireHook/SolitaireHook.cpp`](https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/SolitaireHook.cpp) (Solitaire Hooks), [`ChangeColorCalc/injector.cpp`](https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/injector.cpp) (Color Injector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_calc["Calculator Experiments"]
  node_calc_target["Calculator<br/>[calc.exe]"]
  node_keypad_hook["Keypad Hook"]
  node_color_target["Calculator<br/>[calc.exe]"]
  node_color_hook["Color Hook<br/>[dllmain.cpp]"]
  node_color_injector["Color Injector<br/>[injector.cpp]"]
  node_reverse_target["Calculator<br/>[calc.exe]"]
  node_reverse_hook["Reverse Text Hook<br/>[reverseText.cpp]"]
end

subgraph group_notepad["Notepad Experiment"]
  node_notepad_target["Notepad<br/>[notepad.exe]"]
  node_notepad_hook["Peter Pan Hook<br/>[dllmain.cpp]"]
  node_book["Peter Pan Text<br/>[PeterPan.txt]"]
end

subgraph group_mine["Minesweeper Experiments"]
  node_mine_target["Minesweeper<br/>[winmine.exe]"]
  node_mine_hook["Auto-Flag Hook<br/>[winmineHook.cpp]"]
  node_mine_injector["Minesweeper Injector<br/>[injector.cpp]"]
  node_no_lose_target["Patched Minesweeper"]
  node_no_lose_original["Original Minesweeper<br/>[winmine.exe]"]
end

subgraph group_solitaire["Solitaire Experiment"]
  node_sol_target["Solitaire<br/>[sol.exe]"]
  node_sol_hook["Solitaire Hooks<br/>[SolitaireHook.cpp]"]
  node_sol_injector["Solitaire Injector<br/>[injector.cpp]"]
end

node_user(("User"))
node_windows["Windows APIs"]

node_user -->|"starts"| node_color_injector
node_color_injector -->|"launches suspended"| node_color_target
node_color_injector -->|"loads remotely"| node_color_hook
node_color_hook -->|"installs hook"| node_color_target
node_color_target -->|"dispatches color calls"| node_color_hook
node_color_hook -->|"patches SetTextColor"| node_windows
node_user -->|"uses"| node_calc_target
node_calc_target -->|"dispatches text calls"| node_keypad_hook
node_keypad_hook -->|"forwards modified text"| node_windows
node_user -->|"uses"| node_reverse_target
node_reverse_target -->|"dispatches text calls"| node_reverse_hook
node_reverse_hook -->|"forwards reversed text"| node_windows
node_user -->|"types into"| node_notepad_target
node_notepad_target -->|"dispatches messages"| node_notepad_hook
node_notepad_hook -->|"calls original message API"| node_windows
node_notepad_hook -->|"reads characters"| node_book
node_user -->|"starts"| node_mine_injector
node_mine_injector -->|"launches suspended"| node_mine_target
node_mine_injector -->|"loads remotely"| node_mine_hook
node_mine_hook -->|"installs hook"| node_mine_target
node_mine_target -->|"dispatches updates"| node_mine_hook
node_mine_hook -->|"calls UpdateWindow"| node_windows
node_user -->|"launches directly"| node_no_lose_target
node_no_lose_original -->|"patched on disk"| node_no_lose_target
node_user -->|"starts"| node_sol_injector
node_sol_injector -->|"launches suspended"| node_sol_target
node_sol_injector -->|"loads remotely"| node_sol_hook
node_sol_hook -->|"installs hooks"| node_sol_target
node_sol_target -->|"dispatches API calls"| node_sol_hook
node_sol_hook -->|"hooks drawing and input"| node_windows

click node_calc_target "https://github.com/yahel150/winhook-lab/blob/main/CalculatorKeypad/calc.exe"
click node_keypad_hook "https://github.com/yahel150/winhook-lab/blob/main/CalculatorKeypad/CalculatorKeypadHook.cpp"
click node_color_target "https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/calc.exe"
click node_color_hook "https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/ColorDll/dllmain.cpp"
click node_color_injector "https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/injector.cpp"
click node_reverse_target "https://github.com/yahel150/winhook-lab/blob/main/ReverseTextCalc/calc.exe"
click node_reverse_hook "https://github.com/yahel150/winhook-lab/blob/main/ReverseTextCalc/reverseText.cpp"
click node_notepad_target "https://github.com/yahel150/winhook-lab/blob/main/PeterPan/notepad.exe"
click node_notepad_hook "https://github.com/yahel150/winhook-lab/blob/main/PeterPan/PeterPanDll/dllmain.cpp"
click node_book "https://github.com/yahel150/winhook-lab/blob/main/PeterPan/PeterPan.txt"
click node_mine_target "https://github.com/yahel150/winhook-lab/blob/main/winmine/winmine.exe"
click node_mine_hook "https://github.com/yahel150/winhook-lab/blob/main/winmine/winmineHook.cpp"
click node_mine_injector "https://github.com/yahel150/winhook-lab/blob/main/winmine/injector.cpp"
click node_no_lose_target "https://github.com/yahel150/winhook-lab/blob/main/Winmine-NoLoseMod/winmineModified.exe"
click node_no_lose_original "https://github.com/yahel150/winhook-lab/blob/main/Winmine-NoLoseMod/winmine.exe"
click node_sol_target "https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/sol.exe"
click node_sol_hook "https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/SolitaireHook.cpp"
click node_sol_injector "https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/injector.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_calc_target,node_keypad_hook,node_color_target,node_color_hook,node_color_injector,node_reverse_target,node_reverse_hook,node_user toneBlue
class node_notepad_target,node_notepad_hook,node_book toneAmber
class node_mine_target,node_mine_hook,node_mine_injector,node_no_lose_target,node_no_lose_original,node_windows toneMint
class node_sol_target,node_sol_hook,node_sol_injector toneRose
```

## Components

### Calculator Experiments

- [Calculator](https://github.com/yahel150/winhook-lab/blob/main/CalculatorKeypad/calc.exe): `CalculatorKeypad/calc.exe`
- [Keypad Hook](https://github.com/yahel150/winhook-lab/blob/main/CalculatorKeypad/CalculatorKeypadHook.cpp): `CalculatorKeypad/CalculatorKeypadHook.cpp`
- [Calculator](https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/calc.exe): `ChangeColorCalc/calc.exe`
- [Color Hook](https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/ColorDll/dllmain.cpp): `ChangeColorCalc/ColorDll/dllmain.cpp`
- [Color Injector](https://github.com/yahel150/winhook-lab/blob/main/ChangeColorCalc/injector.cpp): `ChangeColorCalc/injector.cpp`
- [Calculator](https://github.com/yahel150/winhook-lab/blob/main/ReverseTextCalc/calc.exe): `ReverseTextCalc/calc.exe`
- [Reverse Text Hook](https://github.com/yahel150/winhook-lab/blob/main/ReverseTextCalc/reverseText.cpp): `ReverseTextCalc/reverseText.cpp`

### Notepad Experiment

- [Notepad](https://github.com/yahel150/winhook-lab/blob/main/PeterPan/notepad.exe): `PeterPan/notepad.exe`
- [Peter Pan Hook](https://github.com/yahel150/winhook-lab/blob/main/PeterPan/PeterPanDll/dllmain.cpp): `PeterPan/PeterPanDll/dllmain.cpp`
- [Peter Pan Text](https://github.com/yahel150/winhook-lab/blob/main/PeterPan/PeterPan.txt): `PeterPan/PeterPan.txt`

### Minesweeper Experiments

- [Minesweeper](https://github.com/yahel150/winhook-lab/blob/main/winmine/winmine.exe): `winmine/winmine.exe`
- [Auto-Flag Hook](https://github.com/yahel150/winhook-lab/blob/main/winmine/winmineHook.cpp): `winmine/winmineHook.cpp`
- [Minesweeper Injector](https://github.com/yahel150/winhook-lab/blob/main/winmine/injector.cpp): `winmine/injector.cpp`
- [Patched Minesweeper](https://github.com/yahel150/winhook-lab/blob/main/Winmine-NoLoseMod/winmineModified.exe): `Winmine-NoLoseMod/winmineModified.exe`
- [Original Minesweeper](https://github.com/yahel150/winhook-lab/blob/main/Winmine-NoLoseMod/winmine.exe): `Winmine-NoLoseMod/winmine.exe`

### Solitaire Experiment

- [Solitaire](https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/sol.exe): `SolitaireHook/sol.exe`
- [Solitaire Hooks](https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/SolitaireHook.cpp): `SolitaireHook/SolitaireHook.cpp`
- [Solitaire Injector](https://github.com/yahel150/winhook-lab/blob/main/SolitaireHook/injector.cpp): `SolitaireHook/injector.cpp`

### Other components

- **User**
- **Windows APIs**

## Connections

- User → Color Injector: starts
- Color Injector → Calculator: launches suspended
- Color Injector → Color Hook: loads remotely
- Color Hook → Calculator: installs hook
- Calculator → Color Hook: dispatches color calls
- Color Hook → Windows APIs: patches SetTextColor
- User → Calculator: uses
- Calculator → Keypad Hook: dispatches text calls
- Keypad Hook → Windows APIs: forwards modified text
- User → Calculator: uses
- Calculator → Reverse Text Hook: dispatches text calls
- Reverse Text Hook → Windows APIs: forwards reversed text
- User → Notepad: types into
- Notepad → Peter Pan Hook: dispatches messages
- Peter Pan Hook → Windows APIs: calls original message API
- Peter Pan Hook → Peter Pan Text: reads characters
- User → Minesweeper Injector: starts
- Minesweeper Injector → Minesweeper: launches suspended
- Minesweeper Injector → Auto-Flag Hook: loads remotely
- Auto-Flag Hook → Minesweeper: installs hook
- Minesweeper → Auto-Flag Hook: dispatches updates
- Auto-Flag Hook → Windows APIs: calls UpdateWindow
- User → Patched Minesweeper: launches directly
- Original Minesweeper → Patched Minesweeper: patched on disk
- User → Solitaire Injector: starts
- Solitaire Injector → Solitaire: launches suspended
- Solitaire Injector → Solitaire Hooks: loads remotely
- Solitaire Hooks → Solitaire: installs hooks
- Solitaire → Solitaire Hooks: dispatches API calls
- Solitaire Hooks → Windows APIs: hooks drawing and input
