Frameworks: Detours and MinHook
Doing the byte surgery by hand is error-prone. Libraries handle it:
- Microsoft Detours — classic library; transactional attach / detach, builds the trampoline for you, handles instruction lengths.
- MinHook — small, permissive-licensed, x86/x64 inline hooking; popular in game mods and research tooling.
What they abstract away
Length disassembly, trampoline construction, RIP-relative fixups,
memory protection changes, and atomic install / uninstall.