# joelfm4/kernel-driver architecture

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

- Interactive diagram: https://gitdiagram.com/joelfm4/kernel-driver
- Repository: https://github.com/joelfm4/kernel-driver

## Overview

This repository pairs a Windows user-mode application with a kernel driver for inspecting and reading or writing a selected process. The documented workflow is to load the driver, start a target application, then run the client: its MemoryManager opens the driver, finds and attaches to the target, and looks up a module base. The driver dispatches buffered I/O requests and uses MmCopyVirtualMemory for transfers. The graph reflects the excerpts and README; it does not assume behavior beyond the sampled code, and the documented main loop has no shown implementation.

Main entry points: [`Application/Source/Memory/Memory.h`](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h) (MemoryManager), [`Driver/Source/Driver.cpp`](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp) (Control dispatch), [`Application/Source/Main.cpp`](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Main.cpp) (Application entry), [`Driver/Source/Driver.h`](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.h) (IOCTL request protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User-mode client"]
  node_client_main["Application entry<br/>[Main.cpp]"]
  node_memory_manager["MemoryManager<br/>[Memory.h]"]
  node_process_discovery["Process discovery<br/>[Memory.h]"]
  node_module_lookup["Module lookup<br/>[Memory.h]"]
  node_memory_transfer["Memory transfer API<br/>[Memory.h]"]
  node_logger["Console logging<br/>[Logger.h]"]
end

subgraph group_driver["Kernel driver"]
  node_driver_device["Driver device<br/>[Driver.cpp]"]
  node_driver_entry["Driver entry<br/>[Driver.cpp]"]
  node_driver_setup["Device setup<br/>[Driver.cpp]"]
  node_irp_handlers["IRP handlers<br/>[Driver.cpp]"]
  node_device_control["Control dispatch<br/>[Driver.cpp]"]
  node_process_attach["Process attachment<br/>[Driver.cpp]"]
  node_virtual_memory["Virtual memory copy<br/>[Driver.cpp]"]
end

subgraph group_protocol["Driver protocol"]
  node_request_protocol["IOCTL request protocol<br/>[Driver.h]"]
end

node_operator(("Operator"))
node_target(("Target process"))

node_operator -->|"starts"| node_client_main
node_operator -->|"starts"| node_target
node_client_main -->|"constructs"| node_memory_manager
node_client_main -->|"queries base"| node_module_lookup
node_client_main -->|"logs status"| node_logger
node_memory_manager -->|"finds process"| node_process_discovery
node_memory_manager -->|"opens device"| node_driver_device
node_memory_manager -->|"requests attach"| node_process_attach
node_memory_manager -->|"uses requests"| node_request_protocol
node_process_discovery -->|"matches name"| node_target
node_module_lookup -->|"enumerates modules"| node_target
node_memory_transfer -->|"sends IOCTL"| node_device_control
node_memory_manager -->|"provides"| node_memory_transfer
node_driver_entry -->|"calls"| node_driver_setup
node_driver_setup -->|"creates and links"| node_driver_device
node_driver_setup -->|"registers"| node_irp_handlers
node_irp_handlers -->|"dispatches control"| node_device_control
node_device_control -->|"decodes requests"| node_request_protocol
node_device_control -->|"handles attach"| node_process_attach
node_device_control -->|"copies memory"| node_virtual_memory
node_process_attach -->|"looks up PID"| node_target
node_virtual_memory -->|"reads or writes"| node_target

click node_client_main "https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Main.cpp"
click node_memory_manager "https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h"
click node_process_discovery "https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h"
click node_module_lookup "https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h"
click node_memory_transfer "https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h"
click node_logger "https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Logger/Logger.h"
click node_driver_device "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_driver_entry "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_driver_setup "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_irp_handlers "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_device_control "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_process_attach "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_virtual_memory "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp"
click node_request_protocol "https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.h"

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_client_main,node_memory_manager,node_process_discovery,node_module_lookup,node_memory_transfer,node_logger toneBlue
class node_driver_device,node_driver_entry,node_driver_setup,node_irp_handlers,node_device_control,node_process_attach,node_virtual_memory toneAmber
class node_request_protocol toneMint
class node_operator,node_target toneIndigo
```

## Components

### User-mode client

- [Application entry](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Main.cpp): `Application/Source/Main.cpp`
- [MemoryManager](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h): `Application/Source/Memory/Memory.h`
- [Process discovery](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h): `Application/Source/Memory/Memory.h`
- [Module lookup](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h): `Application/Source/Memory/Memory.h`
- [Memory transfer API](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Memory/Memory.h): `Application/Source/Memory/Memory.h`
- [Console logging](https://github.com/joelfm4/kernel-driver/blob/main/Application/Source/Logger/Logger.h): `Application/Source/Logger/Logger.h`

### Kernel driver

- [Driver device](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`
- [Driver entry](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`
- [Device setup](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`
- [IRP handlers](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`
- [Control dispatch](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`
- [Process attachment](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`
- [Virtual memory copy](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.cpp): `Driver/Source/Driver.cpp`

### Driver protocol

- [IOCTL request protocol](https://github.com/joelfm4/kernel-driver/blob/main/Driver/Source/Driver.h): `Driver/Source/Driver.h`

### Other components

- **Operator**
- **Target process**

## Connections

- Operator → Application entry: starts (evidence: `README.md`)
- Operator → Target process: starts (evidence: `README.md`)
- Application entry → MemoryManager: constructs (evidence: `Application/Source/Main.cpp`)
- Application entry → Module lookup: queries base (evidence: `Application/Source/Main.cpp`)
- Application entry → Console logging: logs status (evidence: `Application/Source/Main.cpp`)
- MemoryManager → Process discovery: finds process (evidence: `Application/Source/Memory/Memory.h`)
- MemoryManager → Driver device: opens device (evidence: `Application/Source/Memory/Memory.h`)
- MemoryManager → Process attachment: requests attach (evidence: `Application/Source/Memory/Memory.h`)
- MemoryManager → IOCTL request protocol: uses requests (evidence: `Application/Source/Memory/Memory.h`)
- Process discovery → Target process: matches name (evidence: `Application/Source/Memory/Memory.h`)
- Module lookup → Target process: enumerates modules (evidence: `Application/Source/Memory/Memory.h`)
- Memory transfer API → Control dispatch: sends IOCTL (evidence: `README.md`)
- MemoryManager → Memory transfer API: provides (evidence: `Application/Source/Memory/Memory.h`)
- Driver entry → Device setup: calls (evidence: `Driver/Source/Driver.cpp`)
- Device setup → Driver device: creates and links (evidence: `Driver/Source/Driver.cpp`)
- Device setup → IRP handlers: registers (evidence: `Driver/Source/Driver.cpp`)
- IRP handlers → Control dispatch: dispatches control (evidence: `Driver/Source/Driver.cpp`)
- Control dispatch → IOCTL request protocol: decodes requests (evidence: `Driver/Source/Driver.cpp`)
- Control dispatch → Process attachment: handles attach (evidence: `Driver/Source/Driver.cpp`)
- Control dispatch → Virtual memory copy: copies memory (evidence: `Driver/Source/Driver.cpp`)
- Process attachment → Target process: looks up PID (evidence: `Driver/Source/Driver.cpp`)
- Virtual memory copy → Target process: reads or writes (evidence: `Driver/Source/Driver.cpp`)
