# oldboy21/rfldllob architecture

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

- Interactive diagram: https://gitdiagram.com/oldboy21/rfldllob
- Repository: https://github.com/oldboy21/rfldllob

## Overview

1. This repository contains two related Windows-native C++ projects: the original “Bambini” reflective DLL pair and the more advanced “NG” variant. Each variant is split into an injector executable and a reflective DLL payload.

2. The core architectural boundary is between the injector process and the in-memory DLL it loads. The injector is responsible for preparing the payload and initiating execution in a target process; the DLL is responsible for self-loading and runtime behavior once mapped.

3. In the original Bambini tree, the architecture is minimal: `ReflectiveDLLInjector.cpp` and `dllmain.cpp` represent the two ends of the flow. The injector launches the loading path, while the DLL’s entrypoint contains the reflective loading logic that runs after injection.

4. The NG tree adds several support modules around the same core flow. `dllmain.cpp` is still the payload entrypoint, but the surrounding headers and assembly split the runtime into distinct concerns: syscall bridging, memory hiding/swap behavior, sleep behavior, and breakpoint-based handle manipulation.

5. `syscall.asm` and `syscalls.h` form a low-level boundary layer for direct or indirect system-call invocation. This indicates the project intentionally reduces reliance on standard Win32 API calls in sensitive parts of the load/sleep path and routes some operations through handcrafted native-call plumbing.

6. `hwbp.h` suggests a hardware-breakpoint subsystem used to intercept or influence execution at runtime. Architecturally, this is a control point that sits between normal API behavior and the payload’s need to preserve or recover kernel-object state.

7. `swappala.h` represents the “swap” subsystem: the payload can be backed by one memory mapping and then replaced or shadowed by a benign mapping at the same address. This is the main anti-scanning / memory-hiding boundary in the NG design.

8. `sleaping.h` represents the sleep/orchestration subsystem. Rather than a simple passive pause, the payload appears to transition through a managed sleep state using worker/timer-based resumption, allowing the swap logic to occur while the payload is not actively executing.

9. The injector and DLL are tightly coupled in NG: the README explicitly says the reflective DLL only works with the matching NG injector logic. That means the injector, memory layout assumptions, and runtime transitions are part of one coordinated system rather than independent components.

10. From an architecture-diagram perspective, the most important runtime flow is: injector prepares and loads payload bytes -> reflective DLL establishes itself in memory -> low-level syscall layer handles sensitive OS interactions -> swap/sleep subsystems temporarily hide the payload behind a benign mapping during idle periods -> execution resumes under the same orchestrated state.

11. The project is entirely Windows/Visual Studio centered, as shown by the `.sln` and `.vcxproj` files. There are no signs of cross-platform abstractions or external runtime dependencies; the architecture is built around native Windows APIs, NT internals, and inline assembly.

12. The README frames the project as R&D around reflective loading, stealth loading, and in-memory evasion. So the natural diagram should emphasize execution stages and control boundaries, not just file/module names: injector, payload loader, syscall bridge, handle-interception logic, and sleep/swap orchestration.

Main entry points: [`RflDllOb-NG/ReflectiveDLL-NG/dllmain.cpp`](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/dllmain.cpp) (Payload), [`RflDllOb-NG/ReflectiveDLL-NG/syscalls.h`](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/syscalls.h) (Syscalls), [`RflDllOb-NG/ReflectiveDLL-NG/hwbp.h`](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/hwbp.h) (HWBP), [`RflDllOb-NG/ReflectiveDLL-NG/swappala.h`](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/swappala.h) (Swap Layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bambini["Bambini"]
  node_bambini_injector["Injector"]
  node_bambini_payload["Payload<br/>reflective dll<br/>[dllmain.cpp]"]
end

subgraph group_ng["NG"]
  node_ng_injector["Injector"]
  node_ng_payload["Payload<br/>reflective dll<br/>[dllmain.cpp]"]
  node_ng_headers["Runtime Core<br/>support headers<br/>[headers.h]"]
  node_ng_misc["Helpers<br/>[misc.h]"]
  node_ng_syscalls["Syscalls<br/>native bridge<br/>[syscalls.h]"]
  node_ng_syscall_asm{{"Syscall ASM<br/>assembly bridge<br/>[syscall.asm]"}}
  node_ng_hwbp(("HWBP<br/>breakpoint control<br/>[hwbp.h]"))
  node_ng_swap[("Swap Layer<br/>memory hiding<br/>[swappala.h]")]
  node_ng_sleep["Sleep Orchestrator<br/>runtime sleep<br/>[sleaping.h]"]
end

node_bambini_injector -->|"loads"| node_bambini_payload
node_ng_injector -->|"loads"| node_ng_payload
node_ng_payload -->|"uses"| node_ng_headers
node_ng_payload -->|"uses"| node_ng_misc
node_ng_payload -->|"calls"| node_ng_syscalls
node_ng_syscalls -->|"bridged by"| node_ng_syscall_asm
node_ng_payload -->|"intercepts"| node_ng_hwbp
node_ng_hwbp -->|"enables"| node_ng_swap
node_ng_swap -->|"coordinates"| node_ng_sleep
node_ng_sleep -->|"resumes"| node_ng_payload

click node_bambini_injector "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-Bambini/ReflectiveDLLInjector/ReflectiveDLLInjector.cpp"
click node_bambini_payload "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-Bambini/ReflectiveDLL/dllmain.cpp"
click node_ng_injector "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLLInjector-NG/ReflectiveDLLInjector.cpp"
click node_ng_payload "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/dllmain.cpp"
click node_ng_headers "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/headers.h"
click node_ng_misc "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/misc.h"
click node_ng_syscalls "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/syscalls.h"
click node_ng_syscall_asm "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/syscall.asm"
click node_ng_hwbp "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/hwbp.h"
click node_ng_swap "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/swappala.h"
click node_ng_sleep "https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/sleaping.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_bambini_injector,node_bambini_payload toneBlue
class node_ng_injector,node_ng_payload,node_ng_headers,node_ng_misc,node_ng_syscalls,node_ng_syscall_asm,node_ng_hwbp,node_ng_swap,node_ng_sleep toneAmber
```

## Components

### Bambini

Original reflective DLL injector and payload pair.

- [Injector](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-Bambini/ReflectiveDLLInjector/ReflectiveDLLInjector.cpp): exe injector · Prepares and launches the reflective load path. · `RflDllOb-Bambini/ReflectiveDLLInjector/ReflectiveDLLInjector.cpp`
- [Payload](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-Bambini/ReflectiveDLL/dllmain.cpp): reflective dll · DLL entrypoint and reflective loading logic. · `RflDllOb-Bambini/ReflectiveDLL/dllmain.cpp`

### NG

Expanded reflective DLL pair with syscall, breakpoint, swap, and sleep subsystems.

- [Injector](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLLInjector-NG/ReflectiveDLLInjector.cpp): exe injector · NG injector matched to the payload's memory assumptions. · `RflDllOb-NG/ReflectiveDLLInjector-NG/ReflectiveDLLInjector.cpp`
- [Payload](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/dllmain.cpp): reflective dll · NG DLL entrypoint coordinating stealth-oriented runtime behavior. · `RflDllOb-NG/ReflectiveDLL-NG/dllmain.cpp`
- [Runtime Core](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/headers.h): support headers · Shared runtime declarations and control wiring. · `RflDllOb-NG/ReflectiveDLL-NG/headers.h`
- [Helpers](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/misc.h): support helpers · Miscellaneous runtime support used by the payload. · `RflDllOb-NG/ReflectiveDLL-NG/misc.h`
- [Syscalls](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/syscalls.h): native bridge · Low-level syscall declarations for sensitive OS interactions. · `RflDllOb-NG/ReflectiveDLL-NG/syscalls.h`
- [Syscall ASM](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/syscall.asm): assembly bridge · Handwritten syscall invocation plumbing. · `RflDllOb-NG/ReflectiveDLL-NG/syscall.asm`
- [HWBP](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/hwbp.h): breakpoint control · Hardware-breakpoint control for handle and execution interception. · `RflDllOb-NG/ReflectiveDLL-NG/hwbp.h`
- [Swap Layer](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/swappala.h): memory hiding · Backs the payload with one mapping and shadows it with another. · `RflDllOb-NG/ReflectiveDLL-NG/swappala.h`
- [Sleep Orchestrator](https://github.com/oldboy21/rfldllob/blob/main/RflDllOb-NG/ReflectiveDLL-NG/sleaping.h): runtime sleep · Managed sleep and resumption path used to hide active payload state. · `RflDllOb-NG/ReflectiveDLL-NG/sleaping.h`

## Connections

- Injector → Payload: loads · Injector starts the reflective loading flow.
- Injector → Payload: loads · NG injector prepares the matching payload and execution context.
- Payload → Runtime Core: uses · Payload relies on shared runtime declarations.
- Payload → Helpers: uses · Payload pulls in auxiliary runtime helpers.
- Payload → Syscalls: calls · Sensitive OS interactions are routed through the syscall boundary.
- Syscalls → Syscall ASM: bridged by · Declarations are backed by handwritten assembly entry points.
- Payload → HWBP: intercepts · Breakpoint control supports handle or execution manipulation.
- HWBP → Swap Layer: enables · Breakpoint control feeds the memory-hiding swap path.
- Swap Layer → Sleep Orchestrator: coordinates · Swap behavior is orchestrated around managed sleep periods.
- Sleep Orchestrator → Payload: resumes · Execution returns to the payload after the hidden interval.
