Code Monkey home page Code Monkey logo

universalhookx's Introduction

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

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

  • DirectX9 + DirectX9Ex
  • DirectX10
  • DirectX11
  • DirectX12
  • OpenGL
  • Vulkan

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. Resizing works because ResizeBuffers is hooked. Input handling is up to you to decide how to make/use it. The WndProc hook is here. It should support both 64bit and 32bit architectures.

Known issues

Try pressing HOME to rehook and see if things get better.
Minecraft (tested on 1.19) - menu textures glitched

Dependencies

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

universalhookx's People

Contributors

bruhmoment21 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.