retour-utils 0.2.1

Utility crate for creating hooks with `retour`
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use retour_utils::hook_module;

#[hook_module("lua52.dll")]
mod lua {
    #[allow(non_camel_case_types)]
    type lua_State = ();
    #[allow(non_camel_case_types)]
    type lua_Alloc = ();

    #[hook(unsafe extern "C" Lua_newstate, symbol = "Lua_newstate")]
    pub fn newstate(f: *mut lua_Alloc, ud: *mut std::ffi::c_void) -> *mut lua_State {
        unsafe { Lua_newstate.call(f, ud) }
    }
}

fn main() {
    unsafe { lua::init_detours().unwrap() };
}