hooking-rs
Function hooking in rust
A library for hooking and intercepting functions in rust for windows and linux
Example
Each function creates a stub in memory that consists of
| Section | Description |
|---|---|
| Original fn detour stub address | A function pointer the generated detour stub to call the original function |
| Hooking stub | A small stub that adds some metadata (like adding detour stub address to r10 reg) before calling the hook |
| Original fn detour stub | stub that re-creates the original fn call instructions and patches the instructions to work with ling jumps, then calls the hooked function |
A simple hook:
unsafe extern "C"
unsafe
You can see more examples in the example directory of the repository.