# cracked5pider/ekko architecture

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

- Interactive diagram: https://gitdiagram.com/cracked5pider/ekko
- Repository: https://github.com/cracked5pider/ekko

## Overview

#### Purpose and Entry Points
Ekko is a Windows proof-of-concept for sleep obfuscation built around the Win32 `CreateTimerQueueTimer` API. The executable entry point is `Src/Main.c`; its public interface and core implementation are exposed through `Include/Ekko.h` and `Src/Ekko.c`.

#### Process and Memory Abstractions
`Include/Common.h` centralizes shared Windows/platform definitions used by the project. `Include/Ekko.h` defines the Ekko-facing API and data structures that separate callers from the timer-driven implementation in `Src/Ekko.c`.

#### Sleep-Obfuscation Orchestration
`Src/Ekko.c` is the architecture’s primary stage coordinator. It implements the sequence that prepares process memory/state for a sleep interval, schedules work through timer-queue callbacks, and restores execution state after the delay. Its defining boundary is asynchronous Win32 callback execution rather than a conventional blocking sleep.

#### Application Control Flow
`Src/Main.c` invokes the Ekko functionality as the proof-of-concept driver. Control passes from the main program into the public Ekko interface (`Include/Ekko.h`), then into the implementation (`Src/Ekko.c`), where timer callbacks execute the staged sleep workflow.

#### Runtime and External Dependencies
The project is native C targeting the Windows runtime and Win32 API surface. Timer scheduling depends materially on `CreateTimerQueueTimer`; the approach therefore relies on Windows timer queues and callback-thread execution. Shared Windows declarations are expected through `Include/Common.h`.

#### Important Boundaries and Constraints
The code is intentionally a proof of concept, not a production-ready library or general application framework. The README explicitly notes known flaws, so correctness and safety of the memory/state transition sequence in `Src/Ekko.c` are the highest-risk area. The narrow public boundary in `Include/Ekko.h` is the appropriate integration point for any caller changes.

Main entry points: [`Include/Common.h`](https://github.com/cracked5pider/ekko/blob/main/Include/Common.h) (Shared Windows definitions), [`Src/Ekko.c`](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c) (Prepare sleep state), [`Include/Ekko.h`](https://github.com/cracked5pider/ekko/blob/main/Include/Ekko.h) (Public Ekko API), [`Src/Main.c`](https://github.com/cracked5pider/ekko/blob/main/Src/Main.c) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Proof-of-concept driver"]
  node_main["Program entry<br/>native C executable<br/>[Main.c]"]
end

subgraph group_ekko["Ekko sleep workflow"]
  node_ekko_api["Public Ekko API<br/>C interface<br/>[Ekko.h]"]
  node_ekko_core["Sleep orchestrator<br/>core implementation<br/>[Ekko.c]"]
  node_prepare["Prepare sleep state<br/>workflow stage<br/>[Ekko.c]"]
  node_timer_schedule["Timer queue scheduling<br/>async scheduling stage<br/>[Ekko.c]"]
  node_callbacks["Timer callbacks<br/>async execution stage<br/>[Ekko.c]"]
  node_restore["Restore execution state<br/>workflow stage<br/>[Ekko.c]"]
  node_process_state[("Process memory and state<br/>protected runtime state<br/>[Ekko.c]")]
end

subgraph group_win32["Windows runtime"]
  node_common["Shared Windows definitions<br/>platform header<br/>[Common.h]"]
  node_timer_api{{"CreateTimerQueueTimer<br/>Win32 API"}}
  node_timer_queue["Windows timer queues<br/>OS scheduling service"]
  node_callback_threads(("Callback-thread execution<br/>Windows runtime behavior"))
end

node_main -->|"calls"| node_ekko_api
node_ekko_api -->|"implemented by"| node_ekko_core
node_common -->|"shared declarations"| node_main
node_common -->|"shared declarations"| node_ekko_api
node_common -->|"platform declarations"| node_ekko_core
node_ekko_core -->|"starts workflow"| node_prepare
node_prepare -->|"transforms"| node_process_state
node_prepare -->|"then schedules"| node_timer_schedule
node_timer_schedule -->|"uses"| node_timer_api
node_timer_api -->|"creates timers in"| node_timer_queue
node_timer_queue -->|"dispatches on"| node_callback_threads
node_callback_threads -->|"runs"| node_callbacks
node_callbacks -->|"executes staged restore"| node_restore
node_restore -->|"restores"| node_process_state

click node_main "https://github.com/cracked5pider/ekko/blob/main/Src/Main.c"
click node_ekko_api "https://github.com/cracked5pider/ekko/blob/main/Include/Ekko.h"
click node_ekko_core "https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c"
click node_prepare "https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c"
click node_timer_schedule "https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c"
click node_callbacks "https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c"
click node_restore "https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c"
click node_process_state "https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c"
click node_common "https://github.com/cracked5pider/ekko/blob/main/Include/Common.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_main toneBlue
class node_ekko_api,node_ekko_core,node_prepare,node_timer_schedule,node_callbacks,node_restore,node_process_state toneAmber
class node_common,node_timer_api,node_timer_queue,node_callback_threads toneMint
```

## Components

### Proof-of-concept driver

- [Program entry](https://github.com/cracked5pider/ekko/blob/main/Src/Main.c): native C executable · Invokes the Ekko proof-of-concept flow. · `Src/Main.c`

### Ekko sleep workflow

- [Public Ekko API](https://github.com/cracked5pider/ekko/blob/main/Include/Ekko.h): C interface · Narrow caller-facing integration boundary. · `Include/Ekko.h`
- [Sleep orchestrator](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c): core implementation · Coordinates staged memory and execution-state transitions. · `Src/Ekko.c`
- [Prepare sleep state](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c): workflow stage · Prepares process memory and state before the delay. · `Src/Ekko.c`
- [Timer queue scheduling](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c): async scheduling stage · Schedules staged work through timer-queue timers. · `Src/Ekko.c`
- [Timer callbacks](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c): async execution stage · Execute the staged workflow on callback threads. · `Src/Ekko.c`
- [Restore execution state](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c): workflow stage · Restores process state after the delay. · `Src/Ekko.c`
- [Process memory and state](https://github.com/cracked5pider/ekko/blob/main/Src/Ekko.c): protected runtime state · The high-risk state transformed across the sleep interval. · `Src/Ekko.c`

### Windows runtime

- [Shared Windows definitions](https://github.com/cracked5pider/ekko/blob/main/Include/Common.h): platform header · `Include/Common.h`
- **CreateTimerQueueTimer**: Win32 API · Creates Windows timer-queue callbacks.
- **Windows timer queues**: OS scheduling service
- **Callback-thread execution**: Windows runtime behavior · Timer work runs asynchronously rather than on a blocking sleep path.

## Connections

- Program entry → Public Ekko API: calls
- Public Ekko API → Sleep orchestrator: implemented by
- Shared Windows definitions → Program entry: shared declarations
- Shared Windows definitions → Public Ekko API: shared declarations
- Shared Windows definitions → Sleep orchestrator: platform declarations
- Sleep orchestrator → Prepare sleep state: starts workflow
- Prepare sleep state → Process memory and state: transforms
- Prepare sleep state → Timer queue scheduling: then schedules
- Timer queue scheduling → CreateTimerQueueTimer: uses
- CreateTimerQueueTimer → Windows timer queues: creates timers in
- Windows timer queues → Callback-thread execution: dispatches on
- Callback-thread execution → Timer callbacks: runs
- Timer callbacks → Restore execution state: executes staged restore
- Restore execution state → Process memory and state: restores
