#detour #hook #cross-platform #minhook #slimdetours

minhook-detours-rs

Rustic wrapper of minhook-detours-sys bindings

2 unstable releases

Uses new Rust 2024

0.2.0 Aug 4, 2025
0.1.0 Jul 31, 2025

#9 in #detour

50 downloads per month

BSD-2-Clause

17KB
211 lines

minhook-detours-rs

Available on crates.io.

Rustic wrapper of minhook-detours-sys bindings.

Example

let mut guard = DetourGuard::new()?;

// The type of the hooked function, and of the detour.
type FunctionType = unsafe extern "system" fn(i32, i32) -> i64;

unsafe extern "system" fn add_two(lhs: i32, rhs: i32) -> i64 {
    (lhs + rhs) as i64
}

unsafe extern "system" fn add_two_hook(lhs: i32, rhs: i32) -> i64 {
    (lhs - rhs) as i64
}

let original = guard.create_and_enable_hook::<FunctionType>(add_two as _, add_two_hook as _)?;

License

License: BSD-2-Clause

Dependencies

~6–8.5MB
~151K SLoC