Early Injection
Inject DLLs into processes before any user code executes — triggered by kernel callbacks at process creation time.
APC Method Only
Only the APC Callback method is supported. The Trampoline method was removed due to stability issues (PEB.Ldr not initialized at process creation time).
How It Works
- User arms injection with target process name (e.g., "notepad.exe") and DLL path
- Kernel's
PsSetLoadImageNotifyRoutinecallback monitors DLL loads - When
kernel32.dllloads in a matching target process:- • Allocate memory, write DLL path
- • Resolve
LoadLibraryWvia PEB walking - • Queue kernel APC targeting the main thread
- APC fires during process initialization, calling
LoadLibraryW(dll_path) - One-shot mode: auto-disarm after first successful injection
Why APC Method
The APC method triggers when kernel32.dll loads — at this point:
- • ✓ PEB.Ldr is fully initialized
- • ✓
LoadLibraryWis available and callable - • ✓ Process initialization is far enough along for DLL loading
- • ✓ Still before any application code runs
Usage
- Ensure the kernel driver is loaded
- Click Early Injection button in Process tab toolbar
- In the modal:
- • Enter target process name (e.g., "notepad.exe")
- • Browse for DLL to inject
- • Toggle one-shot mode if desired
- Click Arm to enable injection
- Launch the target process — DLL will be injected automatically
- Click Disarm to disable injection
Status Information
The modal displays live status:
- • Armed State — Whether injection is active
- • Target Process — Name being monitored
- • DLL Path — Path to inject
- • Injection Count — Number of successful injections
- • Last Injected PID — Most recent target PID
- • Last Status — Success or error message
Use Cases
- • Inject monitoring DLLs — Before application code runs
- • Bypass DLL load order restrictions — Load before dependencies
- • Security research — Analyze early-stage process behavior
- • Anti-cheat research — Inject before protection initializes
Implementation
| Item | Location |
|---|---|
| Rust bindings | crates/callback/src/early_injection.rs |
| Kernel code | kernelmode/.../Injection/EarlyInjection.cpp |
| UI component | early_injection_window.rs |
| IOCTL (Arm) | 0x140 |
| IOCTL (Disarm) | 0x144 |
| IOCTL (Status) | 0x148 |