Minimal render-hooking framework for Windows that injects a small ImGui overlay into apps using DirectX 9/11/12 or OpenGL. Built with MinHook. Educational use.
- Installs function hooks on the app’s render path.
- Boots ImGui (Win32 + backend) and draws per-frame UI.
- Unhooks cleanly and restores original state.
Not for protected/anti‑cheat environments.
- DX9 –
Present,Reset - DX11 –
IDXGISwapChain::Present,ResizeBuffers(vtable via dummy device) - DX12 – swap chain present path, RTV heap, per‑frame contexts
- OpenGL –
wglSwapBuffers
Requirements
- Windows 10/11, Visual Studio 2022 (C++17+), Windows SDK
- Deps: MinHook, Dear ImGui (
imgui_impl_win32,imgui_impl_dx9/dx11/dx12,imgui_impl_opengl3)
Build
- Open the project in VS.
- Select x86/x64 to match the target process.
- Build the DLL in Release.
Inject
- Inject the DLL into a process using the desired API.
- Choose a backend in
dllmain.cpp:
RenderHook::SetRenderingBackend(DIRECTX11);Controls
- HOME – toggle overlay
- END – unhook + unload
DllMainspawns a worker thread + console logs.RenderHook::SetRenderingBackend(...)installs API‑specific hooks.- Vtable/function resolution per backend.
- ImGui init: Win32 + renderer backend.
- Hooked
Present/SwapBuffers→ new frame → draw → call original.
/dllmain.cpp
/renderhook.h|.cpp
/dx9hook.cpp
/dx11hook.cpp
/dx12hook.cpp
/openglhook.cpp
enum RenderBackend { DIRECTX9, DIRECTX11, DIRECTX12, OPENGL };
namespace RenderHook {
void SetRenderingBackend(RenderBackend backend);
void Unhook();
}- Automatic API detection.
- Shared helpers across backends.
- Vulkan backend.
- TsudaKageyu/minhook – function hooking
- ocornut/imgui – UI
Pick a permissive license (MIT/BSD/Apache‑2.0).

