# hasan-bukhari-dev/wcre architecture

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

- Interactive diagram: https://gitdiagram.com/hasan-bukhari-dev/wcre
- Repository: https://github.com/hasan-bukhari-dev/wcre

## Overview

WCRE is an experimental Windows x64 process checkpoint/restart engine, currently focused on inspecting and capturing process state rather than restoring it. The intended user workflow is to select a controlled process, inspect its memory and thread state, and persist a platform-independent checkpoint; the repository also contains early address-space reconstruction planning and exact-allocation support. The graph preserves those capabilities, but source excerpts do not show CLI dispatch or a restore executor, so those links are omitted or marked unverified.

Main entry points: [`crates/wcre-cli/src/main.rs`](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-cli/src/main.rs) (WCRE CLI), [`crates/wcre-win32/src/snapshot.rs`](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/snapshot.rs) (PSS snapshot capture), [`crates/wcre-win32/src/memory_read.rs`](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/memory_read.rs) (Live memory probe), [`crates/wcre-image/src/encode.rs`](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/encode.rs) (WCR encoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command interface"]
  node_cli["WCRE CLI<br/>[main.rs]"]
end

subgraph group_capture["Windows capture"]
  node_process["Process metadata<br/>[process.rs]"]
  node_memory_map["Memory map<br/>[memory.rs]"]
  node_live_read["Live memory probe<br/>[memory_read.rs]"]
  node_snapshot["PSS snapshot capture<br/>[snapshot.rs]"]
end

subgraph group_checkpoint["Checkpoint data"]
  node_model["Checkpoint model<br/>[lib.rs]"]
  node_encode["WCR encoding<br/>[encode.rs]"]
  node_decode["WCR decoding<br/>[decode.rs]"]
  node_format["WCR format<br/>[format.rs]"]
  node_integrity["SHA-256 integrity<br/>[integrity.rs]"]
end

subgraph group_reconstruction["Reconstruction"]
  node_restore_plan["Address-space plan<br/>[restore_plan.rs]"]
  node_exact_alloc["Exact allocation"]
end

node_operator(("Operator"))

node_operator -.->|"invokes"| node_cli
node_cli -.->|"dispatches to"| node_snapshot
node_cli -.->|"dispatches to"| node_live_read
node_cli -.->|"dispatches to"| node_encode
node_cli -.->|"dispatches to"| node_decode
node_snapshot -->|"queries"| node_process
node_snapshot -->|"queries"| node_memory_map
node_snapshot -->|"builds"| node_model
node_live_read -->|"enumerates with"| node_memory_map
node_memory_map -->|"opens process via"| node_process
node_live_read -->|"opens process via"| node_process
node_encode -->|"uses constants"| node_format
node_decode -->|"uses constants"| node_format
node_encode -->|"hashes with"| node_integrity
node_decode -->|"verifies with"| node_integrity
node_restore_plan -.->|"may guide"| node_exact_alloc

click node_cli "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-cli/src/main.rs"
click node_process "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/process.rs"
click node_memory_map "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/memory.rs"
click node_live_read "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/memory_read.rs"
click node_snapshot "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/snapshot.rs"
click node_model "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/lib.rs"
click node_encode "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/encode.rs"
click node_decode "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/decode.rs"
click node_format "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/format.rs"
click node_integrity "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/integrity.rs"
click node_restore_plan "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/restore_plan.rs"
click node_exact_alloc "https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/exact_allocation.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 toneBlue
class node_process,node_memory_map,node_live_read,node_snapshot toneAmber
class node_model,node_encode,node_decode,node_format,node_integrity toneMint
class node_restore_plan,node_exact_alloc toneRose
class node_operator toneIndigo
```

## Components

### Command interface

- [WCRE CLI](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-cli/src/main.rs): `crates/wcre-cli/src/main.rs`

### Windows capture

- [Process metadata](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/process.rs): `crates/wcre-win32/src/process.rs`
- [Memory map](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/memory.rs): `crates/wcre-win32/src/memory.rs`
- [Live memory probe](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/memory_read.rs): `crates/wcre-win32/src/memory_read.rs`
- [PSS snapshot capture](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/snapshot.rs): `crates/wcre-win32/src/snapshot.rs`

### Checkpoint data

- [Checkpoint model](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/lib.rs): `crates/wcre-image/src/lib.rs`
- [WCR encoding](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/encode.rs): `crates/wcre-image/src/encode.rs`
- [WCR decoding](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/decode.rs): `crates/wcre-image/src/decode.rs`
- [WCR format](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/format.rs): `crates/wcre-image/src/format.rs`
- [SHA-256 integrity](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/integrity.rs): `crates/wcre-image/src/integrity.rs`

### Reconstruction

- [Address-space plan](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-image/src/restore_plan.rs): `crates/wcre-image/src/restore_plan.rs`
- [Exact allocation](https://github.com/hasan-bukhari-dev/wcre/blob/main/crates/wcre-win32/src/exact_allocation.rs): `crates/wcre-win32/src/exact_allocation.rs`

### Other components

- **Operator**

## Connections

- Operator → WCRE CLI: invokes
- WCRE CLI → PSS snapshot capture: dispatches to
- WCRE CLI → Live memory probe: dispatches to
- WCRE CLI → WCR encoding: dispatches to
- WCRE CLI → WCR decoding: dispatches to
- PSS snapshot capture → Process metadata: queries (evidence: `crates/wcre-win32/src/snapshot.rs`)
- PSS snapshot capture → Memory map: queries (evidence: `crates/wcre-win32/src/snapshot.rs`)
- PSS snapshot capture → Checkpoint model: builds (evidence: `crates/wcre-win32/src/snapshot.rs`)
- Live memory probe → Memory map: enumerates with (evidence: `crates/wcre-win32/src/memory_read.rs`)
- Memory map → Process metadata: opens process via (evidence: `crates/wcre-win32/src/memory.rs`)
- Live memory probe → Process metadata: opens process via (evidence: `crates/wcre-win32/src/memory_read.rs`)
- WCR encoding → WCR format: uses constants (evidence: `crates/wcre-image/src/encode.rs`)
- WCR decoding → WCR format: uses constants (evidence: `crates/wcre-image/src/decode.rs`)
- WCR encoding → SHA-256 integrity: hashes with (evidence: `crates/wcre-image/src/encode.rs`)
- WCR decoding → SHA-256 integrity: verifies with (evidence: `crates/wcre-image/src/decode.rs`)
- Address-space plan → Exact allocation: may guide
