API-Hooking and rendering framework for DirectX-based games.
HydraHook consists of a self-contained library (DLL) which exposes a minimalistic API for rendering custom content in foreign processes eliminating the need for in-depth knowledge about Direct3D and API-hooking. The most common use-case might be drawing custom overlays on top of your games. The framework takes care about pesky tasks like detecting the DirectX version the game was built for.
Caution
Use caution when injecting HydraHook into any game protected by anti-cheat software. API hooking and DLL injection are commonly detected by anti-cheat systems and may result in permanent bans from online services. Use only with games you own and in environments where such use is permitted.
Note
The authors of this project do not condone the use of HydraHook in cheating software. The project's motivation has been curiosity and education entirely.
-
Runtime injection and ejection — No launcher required. Inject into any running DirectX process and eject via
FreeLibrarywhen done. Supports mid-process injection (e.g. D3D12 games already running). Graceful shutdown viaExitProcess/PostQuitMessage/FreeLibraryhooks avoids loader-lock and unload races. -
Performance-focused — Lock-free hot path for hook callbacks (atomic counters only; no mutex, no kernel transition). Shutdown uses loader-lock-safe
remove_nothrowto avoid deadlocks during process exit. -
No external dependencies at runtime — Everything needed is statically linked in. Just drop the DLL into the target process; no redistributables or runtime packages required.
- DirectX 9.0
- DirectX 9.0 Extended (Vista+)
- DirectX 10
- DirectX 11
- DirectX 12
- Visual Studio 2022 (Community Edition is free)
- Windows SDK
- Clone the repository and initialize submodules:
git submodule update --init --recursive - Open
HydraHook.slnin Visual Studio and build
Dependencies (spdlog, detours, imgui, directxtk) are declared in vcpkg.json and installed via vcpkg (included as a submodule). Run prepare-deps.bat from a Developer Command Prompt for VS 2022 (or x64 Native Tools Command Prompt) before the first build in Visual Studio; the build will use existing vcpkg_installed if present.
Warning
The downloads contain a DLL Injector utility which might be flagged as unsafe by the browser due to it sharing behavior with malicious code. Use at your own risk!
Pre-built binaries are available from the buildbot. Note: these builds may be outdated; for the latest code, build from source.
Inject the resulting host library (e.g. HydraHook-ImGui.dll) into the target process first using a DLL injection utility of your choice (you can ofc. use mine as well). The following example loads the imgui sample:
.\Injector -n hl2.exe -i HydraHook-ImGui.dllJust make sure your host library doesn't require any external dependencies not present in the process context or you'll get a LoadLibrary failed error.
The core library logs its progress and potential errors to HydraHook.log. It tries to write in this order: (1) the directory of the process executable, (2) the directory of the HydraHook DLL, (3) %TEMP% if both prior locations fail (e.g. no write permissions).
The following demo videos show imgui being rendered in foreign processes using different versions of DirectX. Click a thumbnail to watch the video.
Half-Life 2, 32-Bit
Castlevania: Lords of Shadow, 32-Bit
Bioshock 2, 32-Bit
Road Redemption, 64-Bit
Supported on 64-bit builds. The ImGui sample automatically detects and hooks DX12 games.
BEHEMOTH, 64-Bit
This project uses the following libraries (via vcpkg):
Core library only:
- spdlog – Fast C++ logging library
- Microsoft Detours – API hooking library
Sample projects only:
- Dear ImGui – Immediate mode GUI
- DirectXTK – DirectX Toolkit
- OpenCV – Computer vision library
