Lightweight Windows function hooking by modifying the Import Address Table (IAT) directly in memory.
No external dependencies like Microsoft Detours required.
The IAT stores addresses of functions imported from DLLs.
This library replaces original function addresses with your custom functions by patching the IAT in memory.
- Get the module base address
- Parse the PE headers
- Locate the Import Directory
- Iterate over
IMAGE_IMPORT_DESCRIPTORentries - Identify the target DLL
- Traverse function import entries
- Match the target function name
- Patch the IAT if there is a match
- Single-header implementation – Easy integration
- No runtime dependencies – Works with any Windows C/C++ compiler
- Process-specific hooks – Only affects the current process
- Reversible – Original functions can be restored
- Educational – Demonstrates Windows PE internals
The library uses VirtualProtect() to:
- Temporarily change IAT memory permissions from read-only to writable
- Replace function pointers
- Restore the original protection flags
MIT License — Free for educational, personal, and commercial use.