# trickster0/tartarusgate architecture

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

- Interactive diagram: https://gitdiagram.com/trickster0/tartarusgate
- Repository: https://github.com/trickster0/tartarusgate

## Overview

#### Purpose
Windows-native C/assembly proof-of-concept for invoking low-level Windows system services while attempting to avoid user-mode API hook interception. The solution is organized as a single Visual C++ project rather than a service, library, or web application.

#### Build and Entry Point
- Visual Studio solution: `HellsGate.sln`
- Native project definition: `HellsGate/HellsGate.vcxproj`
- Process entry and orchestration are expected in `HellsGate/main.c`.
- The project targets the Windows runtime and depends on Windows process, memory, and native system-call interfaces.

#### Native Syscall Dispatch Layer
`HellsGate/hellsgate.asm` is the architecture-defining assembly boundary. It likely contains syscall transition stubs and instruction-level dispatch logic, separating native service invocation from the C control plane. This is the critical platform-specific component and cannot be ported without replacing its Windows/x64 assembly assumptions.

#### C Control Plane
`HellsGate/main.c` coordinates the workflow: resolving required native functions, preparing arguments and buffers, selecting syscall behavior, and invoking assembly-backed routines. It is the primary control-flow entry point between normal Win32 process execution and the lower-level dispatch layer.

#### Shared Native Types and Contracts
`HellsGate/structs.h` defines the C/assembly interoperability contract: native structures, function-pointer forms, constants, and syscall-related metadata used by the control plane and dispatch implementation. Changes here can affect calling conventions, memory layout, and both compilation units simultaneously.

#### Primary Flow and Boundaries
1. Program execution begins in `HellsGate/main.c`.
2. C code identifies or prepares native API/service call metadata.
3. Shared definitions from `HellsGate/structs.h` establish parameter layouts and routine contracts.
4. Calls cross into `HellsGate/hellsgate.asm` for the low-level system-service transition.
5. Results return to C for subsequent memory/process operations or cleanup.

The key boundary is C-to-assembly: it depends on exact ABI behavior, register usage, stack alignment, and Windows native-service conventions.

#### Infrastructure and External Dependencies
- Build environment: Visual Studio/MSBuild via `HellsGate.sln` and `HellsGate/HellsGate.vcxproj`.
- Runtime: Windows, with architecture-sensitive native assembly.
- External dependency surface is primarily the operating system’s native syscall interface; no separate server, database, package manager, or cloud service is represented in the repository tree.

Main entry points: [`HellsGate/main.c`](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/main.c) (C control plane), [`HellsGate/HellsGate.vcxproj`](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/HellsGate.vcxproj) (Native C++ project), [`HellsGate/hellsgate.asm`](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/hellsgate.asm) (Syscall dispatch stubs), [`HellsGate/structs.h`](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/structs.h) (Native contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build"]
  node_solution["Visual Studio solution<br/>[HellsGate.sln]"]
  node_project["Native C++ project<br/>vcxproj<br/>[HellsGate.vcxproj]"]
end

subgraph group_native["Native execution"]
  node_main["C control plane<br/>C entry point<br/>[main.c]"]
  node_contracts["Native contracts<br/>C/ASM header<br/>[structs.h]"]
  node_dispatch{{"Syscall dispatch stubs<br/>x64 assembly<br/>[hellsgate.asm]"}}
end

subgraph group_windows["Windows runtime"]
  node_win32["Windows process runtime<br/>OS runtime"]
  node_native_api{{"Native syscall interface<br/>Windows kernel boundary"}}
  node_kernel_ops["Process and memory operations<br/>Windows services"]
end

node_solution -->|"contains"| node_project
node_project -->|"builds"| node_main
node_project -->|"includes"| node_contracts
node_project -->|"assembles"| node_dispatch
node_main -->|"uses layouts and metadata"| node_contracts
node_dispatch -.->|"follows ABI contract"| node_contracts
node_win32 -->|"starts process"| node_main
node_main -->|"invokes low-level routines"| node_dispatch
node_dispatch -->|"system-service transition"| node_native_api
node_native_api -->|"executes services"| node_kernel_ops
node_kernel_ops -->|"returns status and results"| node_main

click node_solution "https://github.com/trickster0/tartarusgate/blob/master/HellsGate.sln"
click node_project "https://github.com/trickster0/tartarusgate/blob/master/HellsGate/HellsGate.vcxproj"
click node_main "https://github.com/trickster0/tartarusgate/blob/master/HellsGate/main.c"
click node_contracts "https://github.com/trickster0/tartarusgate/blob/master/HellsGate/structs.h"
click node_dispatch "https://github.com/trickster0/tartarusgate/blob/master/HellsGate/hellsgate.asm"

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_solution,node_project toneBlue
class node_main,node_contracts,node_dispatch toneAmber
class node_win32,node_native_api,node_kernel_ops toneMint
```

## Components

### Build

- [Visual Studio solution](https://github.com/trickster0/tartarusgate/blob/master/HellsGate.sln): solution · `HellsGate.sln`
- [Native C++ project](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/HellsGate.vcxproj): vcxproj · `HellsGate/HellsGate.vcxproj`

### Native execution

- [C control plane](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/main.c): C entry point · Coordinates metadata, arguments, and syscall invocation. · `HellsGate/main.c`
- [Native contracts](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/structs.h): C/ASM header · Defines ABI-sensitive types, layouts, and syscall metadata. · `HellsGate/structs.h`
- [Syscall dispatch stubs](https://github.com/trickster0/tartarusgate/blob/master/HellsGate/hellsgate.asm): x64 assembly · Performs the architecture-specific native service transition. · `HellsGate/hellsgate.asm`

### Windows runtime

- **Windows process runtime**: OS runtime
- **Native syscall interface**: Windows kernel boundary · Operating-system native service interface reached by assembly dispatch.
- **Process and memory operations**: Windows services

## Connections

- Visual Studio solution → Native C++ project: contains
- Native C++ project → C control plane: builds
- Native C++ project → Native contracts: includes
- Native C++ project → Syscall dispatch stubs: assembles
- C control plane → Native contracts: uses layouts and metadata
- Syscall dispatch stubs → Native contracts: follows ABI contract
- Windows process runtime → C control plane: starts process
- C control plane → Syscall dispatch stubs: invokes low-level routines
- Syscall dispatch stubs → Native syscall interface: system-service transition
- Native syscall interface → Process and memory operations: executes services
- Process and memory operations → C control plane: returns status and results
