funchook
funchook wrapper
Summary
| Latest Version | Unknown |
|---|---|
| License | GPLv2 |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-24 13:03 |
Tags
Installation
nimble install funchook
choosenim install funchook
git clone https://github.com/ba0f3/funchook.nim
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| funchook | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/ba0f3/funchook.nim |
|---|---|
| Homepage | https://github.com/ba0f3/funchook.nim |
| Registry Source | nimble_official |
README
funchook.nim
This wrapper compiles funchook with diStorm3 disassembler.
Suports both x64 and x86-64 on:
- [x] Linux
- [x] Windows
- [ ] MacOS (not tested yet)
Installation
nimble install funchook
Usage
import funchook
proc my_add(a, b: int): int =
## original proc to be hooked
a + b
var add_func = my_add
proc hook_add(a, b: int): int =
## proc to replace my_add
echo add_func(a, b) # call original proc with trampoline
a * b
var h = initHook()
if h == nil:
quit("Error: create funchook failed")
if h.prepare(addr add_func, hook_add) != SUCCESS:
quit("Error: " & h.errorMessage())
assert my_add(4, 5) == 9, "pre-hook"
if h.install(0) != SUCCESS:
quit("Error: " & h.errorMessage())
assert my_add(4, 5) == 20, "post-hook"