Skip to content

Jarijaas/FunctionHooks

Repository files navigation

FunctionHooks

Header-only C++ library for hooking functions on Windows x64. Supports inline and virtual table hooks.

Getting Started

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);
}

Running the tests

Tests are located in FunctionHooksTest. Tests can be run with Visual Studio. See Run unit tests with Test Explorer

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Releases

No releases published

Packages

No packages published