Home

Awesome

UniversalHookX C++ Windows

Universal graphical hook for Windows apps, although it should work on Linux too if you implement it correctly, that will display an ImGui Demo Window as an example.

Usage

Call Utils::SetRenderingBackend(eRenderingBackend) in DllMain as shown here. You must do this or the DLL won't know what to hook or how to hook. What is eRenderingBackend?. To enable or disable a specific backend comment backends in backend.hpp

Purpose

The purpose of this library is to show how to hook different backends to display ImGui, the code should be easy to understand as I tried to make everything seem almost the same, see backends folder.

Supported Backends

How it works

DirectX

We create a 'dummy device' and a 'dummy swapchain' (for DirectX10 and higher) with a handle to the console window. See the CreateDeviceD3DX function in every DirectX backend. See DX12 example 'CreateDeviceD3D12'. The point is to get a pointer to the vTable to get the required functions addresses. We release it right after getting the pointers because we won't use our 'dummy device' and 'dummy swapchain' for drawing. See code used in DX12 backend hook.

OpenGL

We hook wglSwapBuffers which is an exported function in opengl32.dll. See code used in OpenGL backend hook.

Vulkan

We create a 'dummy device' to get the required functions addresses. The point is to hook into vkQueuePresentKHR where we will submit the queue with our data from our command pool and our command buffer. See code used in Vulkan backend hook.

Media

DirectX9 32bit

image image

DirectX10 32bit

image

DirectX11 64bit

image

DirectX12 64bit

image

OpenGL 32bit + 64bit

image image

Vulkan 32bit + 64bit

image image

Other

Feel free to open an issue if something isn't working. Input handling is left for the user because there is no general solution.

Known issues

Tip: Try pressing the "Home" key, that will rehook graphics, and see if anything changed.

Dependencies

MinHook - TsudaKageyu - Used for hooking (trampoline method).
ImGui - ocornut - self-explanatory.
Vulkan SDK - for the Vulkan API.