Header-only C++ library for hooking functions on Windows x64. Supports inline and virtual table hooks.
Include "function_hooks.h" in your project.
Inlike hook example:
#include <function_hooks.h>
// Function that is called when hooked function is called
void Hook(fn_hooks::Registers regs) {
}
int main() {
// To hook
const size_t byte_count = 13; // How many bytes to copy to end of the hook from start of the function
fn_hooks::InlineHook(function_ptr, Hook, byte_count);
// To unhook
fn_hooks::Unhook(function_ptr);
}
Tests are located in FunctionHooksTest. Tests can be run with Visual Studio. See Run unit tests with Test Explorer
This project is licensed under the MIT License - see the LICENSE.md file for details