# cra0/anonpresence architecture

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

- Interactive diagram: https://gitdiagram.com/cra0/anonpresence
- Repository: https://github.com/cra0/anonpresence

## Overview

AnonPresence is a Windows Teams proxy DLL that hooks BoringSSL’s SSL_write and changes a matching presence-report JSON flag so the client reports active. Teams loads the replacement VERSION.dll; the hook locates SSL_write, intercepts writes, edits matching payloads, and calls the original function through MinHook’s trampoline. Logging and memory-pattern utilities support the hook setup and runtime. The graph includes MinHook’s hook, trampoline, buffer, and instruction-decoding layers; some internal calls are shown only where the excerpts or SOURCE INDEX establish them.

Main entry points: [`Dependencies/minhook/source/trampoline.c`](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/trampoline.c) (Trampoline builder), [`Dependencies/minhook/source/hook.c`](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/hook.c) (Hook API), [`DLLMain.cpp`](https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp) (Presence detour), [`Dependencies/minhook/source/HDE/hde64.c`](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde64.c) (x64 decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Presence blocker"]
  node_proxy["VERSION proxy<br/>[exports.h]"]
  node_startup["DLL startup<br/>[DLLMain.cpp]"]
  node_target["SSL_write discovery<br/>[DLLMain.cpp]"]
  node_detour["Presence detour<br/>[DLLMain.cpp]"]
end

subgraph group_support["Runtime support"]
  node_utils["Memory utilities<br/>[Utils.cpp]"]
  node_logger["File logging<br/>[Log.cpp]"]
end

subgraph group_minhook["MinHook engine"]
  node_mhapi["Hook API<br/>[hook.c]"]
  node_trampoline["Trampoline builder<br/>[trampoline.c]"]
  node_buffer["Executable buffers<br/>[buffer.c]"]
  node_hde64["x64 decoder<br/>[hde64.c]"]
  node_hde32["x86 decoder<br/>[hde32.c]"]
  node_hdetables["Decoder tables<br/>[table64.h]"]
  node_hdeheaders["Decoder definitions<br/>[hde64.h]"]
  node_hdecommon["Integer types<br/>[pstdint.h]"]
  node_mhheader["MinHook declarations<br/>[MinHook.h]"]
  node_trampheader["Trampoline definitions<br/>[trampoline.h]"]
  node_bufferheader["Buffer declarations<br/>[buffer.h]"]
end

node_teams(("Teams client"))
node_ssl["BoringSSL write"]

node_teams -->|"loads proxy"| node_proxy
node_proxy -.->|"starts DLL"| node_startup
node_startup -->|"opens log"| node_logger
node_startup -->|"starts hook setup"| node_target
node_target -.->|"scans and resolves"| node_utils
node_target -->|"creates hook"| node_mhapi
node_target -->|"registers detour"| node_detour
node_ssl -.->|"dispatches writes"| node_detour
node_detour -->|"matches payload"| node_utils
node_detour -->|"logs activity"| node_logger
node_detour -->|"calls original"| node_ssl
node_mhapi -.->|"implements API"| node_mhheader
node_mhapi -->|"builds trampoline"| node_trampoline
node_mhapi -->|"uses declarations"| node_bufferheader
node_mhapi -->|"uses declarations"| node_trampheader
node_trampoline -->|"allocates buffers"| node_buffer
node_trampoline -->|"decodes x64"| node_hde64
node_trampoline -->|"decodes x86"| node_hde32
node_trampoline -->|"uses definitions"| node_trampheader
node_trampoline -->|"uses declarations"| node_bufferheader
node_hde64 -->|"reads opcode table"| node_hdetables
node_hde32 -.->|"reads opcode table"| node_hdetables
node_hde64 -->|"uses definitions"| node_hdeheaders
node_hde32 -.->|"uses integer types"| node_hdecommon
node_hde64 -.->|"uses integer types"| node_hdecommon
node_buffer -->|"implements declarations"| node_bufferheader

click node_proxy "https://github.com/cra0/anonpresence/blob/master/exports.h"
click node_startup "https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp"
click node_target "https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp"
click node_detour "https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp"
click node_utils "https://github.com/cra0/anonpresence/blob/master/Utils.cpp"
click node_logger "https://github.com/cra0/anonpresence/blob/master/Log.cpp"
click node_mhapi "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/hook.c"
click node_trampoline "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/trampoline.c"
click node_buffer "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/buffer.c"
click node_hde64 "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde64.c"
click node_hde32 "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde32.c"
click node_hdetables "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/table64.h"
click node_hdeheaders "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde64.h"
click node_hdecommon "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/pstdint.h"
click node_mhheader "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/include/MinHook.h"
click node_trampheader "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/trampoline.h"
click node_bufferheader "https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/buffer.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_proxy,node_startup,node_target,node_detour,node_teams toneBlue
class node_utils,node_logger toneAmber
class node_mhapi,node_trampoline,node_buffer,node_hde64,node_hde32,node_hdetables,node_hdeheaders,node_hdecommon,node_mhheader,node_trampheader,node_bufferheader toneMint
class node_ssl toneIndigo
```

## Components

### Presence blocker

- [VERSION proxy](https://github.com/cra0/anonpresence/blob/master/exports.h): `exports.h`
- [DLL startup](https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp): `DLLMain.cpp`
- [SSL_write discovery](https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp): `DLLMain.cpp`
- [Presence detour](https://github.com/cra0/anonpresence/blob/master/DLLMain.cpp): `DLLMain.cpp`

### Runtime support

- [Memory utilities](https://github.com/cra0/anonpresence/blob/master/Utils.cpp): `Utils.cpp`
- [File logging](https://github.com/cra0/anonpresence/blob/master/Log.cpp): `Log.cpp`

### MinHook engine

- [Hook API](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/hook.c): `Dependencies/minhook/source/hook.c`
- [Trampoline builder](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/trampoline.c): `Dependencies/minhook/source/trampoline.c`
- [Executable buffers](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/buffer.c): `Dependencies/minhook/source/buffer.c`
- [x64 decoder](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde64.c): `Dependencies/minhook/source/HDE/hde64.c`
- [x86 decoder](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde32.c): `Dependencies/minhook/source/HDE/hde32.c`
- [Decoder tables](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/table64.h): `Dependencies/minhook/source/HDE/table64.h`
- [Decoder definitions](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/hde64.h): `Dependencies/minhook/source/HDE/hde64.h`
- [Integer types](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/HDE/pstdint.h): `Dependencies/minhook/source/HDE/pstdint.h`
- [MinHook declarations](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/include/MinHook.h): `Dependencies/minhook/include/MinHook.h`
- [Trampoline definitions](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/trampoline.h): `Dependencies/minhook/source/trampoline.h`
- [Buffer declarations](https://github.com/cra0/anonpresence/blob/master/Dependencies/minhook/source/buffer.h): `Dependencies/minhook/source/buffer.h`

### Other components

- **Teams client**
- **BoringSSL write**

## Connections

- Teams client → VERSION proxy: loads proxy (evidence: `README.md`)
- VERSION proxy → DLL startup: starts DLL
- DLL startup → File logging: opens log (evidence: `DLLMain.cpp`)
- DLL startup → SSL_write discovery: starts hook setup (evidence: `DLLMain.cpp`)
- SSL_write discovery → Memory utilities: scans and resolves
- SSL_write discovery → Hook API: creates hook (evidence: `DLLMain.cpp`)
- SSL_write discovery → Presence detour: registers detour (evidence: `DLLMain.cpp`)
- BoringSSL write → Presence detour: dispatches writes
- Presence detour → Memory utilities: matches payload (evidence: `DLLMain.cpp`)
- Presence detour → File logging: logs activity (evidence: `DLLMain.cpp`)
- Presence detour → BoringSSL write: calls original (evidence: `DLLMain.cpp`)
- Hook API → MinHook declarations: implements API (evidence: `Dependencies/minhook/source/hook.c`)
- Hook API → Trampoline builder: builds trampoline (evidence: `Dependencies/minhook/source/hook.c`)
- Hook API → Buffer declarations: uses declarations (evidence: `Dependencies/minhook/source/hook.c`)
- Hook API → Trampoline definitions: uses declarations (evidence: `Dependencies/minhook/source/hook.c`)
- Trampoline builder → Executable buffers: allocates buffers (evidence: `Dependencies/minhook/source/trampoline.c`)
- Trampoline builder → x64 decoder: decodes x64 (evidence: `Dependencies/minhook/source/trampoline.c`)
- Trampoline builder → x86 decoder: decodes x86 (evidence: `Dependencies/minhook/source/trampoline.c`)
- Trampoline builder → Trampoline definitions: uses definitions (evidence: `Dependencies/minhook/source/trampoline.c`)
- Trampoline builder → Buffer declarations: uses declarations (evidence: `Dependencies/minhook/source/trampoline.c`)
- x64 decoder → Decoder tables: reads opcode table (evidence: `Dependencies/minhook/source/HDE/hde64.c`)
- x86 decoder → Decoder tables: reads opcode table
- x64 decoder → Decoder definitions: uses definitions (evidence: `Dependencies/minhook/source/HDE/hde64.c`)
- x86 decoder → Integer types: uses integer types
- x64 decoder → Integer types: uses integer types
- Executable buffers → Buffer declarations: implements declarations (evidence: `Dependencies/minhook/source/buffer.h`)
