spud - multi-architecture cross-platform hooking library.
- x86-64 and arm64 support
- Windows, Mac and Linux support
Clone repository to subfolder and link spud
to your project:
add_subdirectory(path/to/spud)
target_link_libraries(your-project-name PRIVATE spud)
- Simple example
void hook(auto original, int n) {
if (n == 0) {
// Run some custom code here
return;
}
// Forward to the original code
return original(n);
}
void test_function(int n) {
if (n == 0) {
printf("N was 0\n");
}
printf("%d\n", n);
}
SPUD_STATIC_DETOUR(test_function, hook);
spud
can be easily added to any cmake-based project. Just add a few lines in CMakeLists.txt
.
FetchContent_Declare(
spud
GIT_REPOSITORY "https://github.com/tashcan/spud.git"
GIT_TAG origin/main
)
FetchContent_MakeAvailable(spud)
Feel free to browse through tests and benchmark if you just want to get a quick glance and some example code.
Otherwise head over to https://spud.tashcan.com/ for a more in-depth documentation
- Easy way to patch VTables
- Memory Manipulation facilities
- Import Table Patching
- catch2 for unit-testing
- asmjit for code-gen on x86 and arm
- zydis for disassembling x86 code
- x86 and x86-64 opcode and instruction reference
- MIT