Skip to content

j0cb/RenderHook

Repository files navigation

RenderHook

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.

What it does

  • 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.

Backends

  • DX9Present, Reset
  • DX11IDXGISwapChain::Present, ResizeBuffers (vtable via dummy device)
  • DX12 – swap chain present path, RTV heap, per‑frame contexts
  • OpenGLwglSwapBuffers

Quick start

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

  1. Open the project in VS.
  2. Select x86/x64 to match the target process.
  3. 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

How it’s wired (short)

  1. DllMain spawns a worker thread + console logs.
  2. RenderHook::SetRenderingBackend(...) installs API‑specific hooks.
  3. Vtable/function resolution per backend.
  4. ImGui init: Win32 + renderer backend.
  5. Hooked Present/SwapBuffers → new frame → draw → call original.

Files

/dllmain.cpp
/renderhook.h|.cpp
/dx9hook.cpp
/dx11hook.cpp
/dx12hook.cpp
/openglhook.cpp

API

enum RenderBackend { DIRECTX9, DIRECTX11, DIRECTX12, OPENGL };

namespace RenderHook {
  void SetRenderingBackend(RenderBackend backend);
  void Unhook();
}

Roadmap

  • Automatic API detection.
  • Shared helpers across backends.
  • Vulkan backend.

Images

image image2

Credits

License

Pick a permissive license (MIT/BSD/Apache‑2.0).

Contributors