RTTIHook is a set of three simple to use C++17 headers, designed for hooking virtual function/method tables (VFTs/VMTs) by locating them through static runtime type information (RTTI) analysis.
Include "VFTHook.h", create an RTTI scanner instance and scan, apply hooks by creating them with "new" and remove them with "delete". A usage example can be seen in example/dllmain.cpp in the form of an Elden Ring DLL that turns the player character upside down.
Hooking a virtual function that has already been hooked simply adds the hook to a chain, without a length limit.
Any hook placed by RTTIHook will be compatible with any other, even if the underlying assembly is changed. Hooks do not need to be directly managed by one context, any combination of threads, DLLs and applications work.
RTTIHook supports any kind of custom assembly (provided the modified hook assembly is actually functional)
Placing and removing hooks is designed to be resistant to race conditions, even when two or more different threads, DLLs or applications manage the same virtual function table slot.
The scanner matches specific instruction patterns using custom SIMD search functionality, covering all the .text sections of an executable.
Three self-contained (but co-dependent) headers without third party dependencies.
For simplicity and intercommunication, PEParser and RTTIScanner use static variables to store some of the key data gotten from analysis.
While RTTIHook will work with other hooking toolsets, not all of its features are guaranteed to work.
This toolset is designed only with x86-64 in mind, for simplicity (again) and for specialization.