A C++23 procedure hooking library for Windows that makes runtime function interception as safe as possible.
SafetyHook is a C++23 procedure hooking library for Windows x86 and x86_64 systems that enables safe runtime function interception. It allows developers to redirect function calls at runtime while handling complex low-level details like thread synchronization, instruction relocation, and branch management automatically.
C++ developers working on Windows who need to intercept or modify function behavior at runtime, including those in game modding, security research, debugging tools, or software instrumentation.
Developers choose SafetyHook because it prioritizes safety in hooking operations with thread synchronization and instruction fixing, uses modern C++23 features, and provides a carefully designed API that reduces common hooking pitfalls compared to traditional approaches.
C++23 procedure hooking library.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Stops all other threads during hook creation and deletion to prevent race conditions, ensuring reliable hook operations in multi-threaded environments as highlighted in the README.
Automatically corrects the IP of threads affected by hooks, preventing crashes from misaligned execution points, which is a common pitfall in low-level hooking.
Uses Zydis disassembler to handle the latest CPU instructions, making it future-proof and capable of intercepting complex or newly introduced opcodes.
Carefully designed API that reduces misuse, with clear abstractions for inline hooks, making it harder to introduce bugs compared to raw hooking libraries.
Only supports Windows x86 and x86_64, with no ARM or cross-platform support, limiting its use in modern or diverse development environments.
Requires Zydis as a dependency, and setup can be cumbersome with amalgamated builds or CMake options, adding integration overhead compared to standalone libraries.
Stopping all threads during hook operations introduces latency, which can be problematic for performance-critical applications or those requiring minimal interruption.