Skip to main content

dobby_rs_framework/hook_utils/
macros.rs

1#[macro_export]
2macro_rules! dobby_hook {
3    ($target:path, $detour:path) => {{
4        unsafe {
5            $crate::hook_utils::HookBuilder::new(
6                $target as *const () as *mut core::ffi::c_void,
7                $detour as *const () as *mut core::ffi::c_void,
8            )
9            .install()
10        }
11    }};
12}
13
14#[macro_export]
15macro_rules! dobby_original {
16    ($detour:path, $ty:ty) => {{
17        unsafe {
18            $crate::hook_utils::original::<$ty>($detour as *const () as *mut core::ffi::c_void)
19                .expect("original function not found")
20        }
21    }};
22}