2 unstable releases

0.2.0 Aug 21, 2021
0.1.0 Aug 21, 2021

#74 in #libc

35 downloads per month
Used in xhook-rs

MIT license

500KB
1.5K SLoC

C 1.5K SLoC // 0.1% comments Shell 45 SLoC // 0.1% comments Rust 21 SLoC

Contains (static library, 180KB) dep/libxhook.a

xHook-rs

xHook bindings for Rust

example usage


use xhook_rs::*;

#[no_mangle]
pub extern "C" fn my_malloc(size: libc::size_t) -> *mut c_void {
    println!("my malloc, {} bytes!", size);
    unsafe { libc::malloc(size) }
}


fn main() {
    xhook_register(".*\\.so$", "malloc", my_malloc as *const u8);

    xhook_refresh(0);
    unsafe {
        //should call my_malloc here
        let buf = libc::malloc(10);
        println!("malloc: 10");
    }
} 
    

more info

https://github.com/iqiyi/xHook

Dependencies

~0–1.8MB
~35K SLoC