Crates.io | detours-rs |
lib.rs | detours-rs |
version | 0.2.0 |
source | src |
created_at | 2023-06-25 00:00:00.008242 |
updated_at | 2023-06-25 01:45:14.907498 |
description | Microsoft Detours FFI bindings created with bindgen. |
homepage | https://github.com/SecurityAndStuff/detours-rs |
repository | https://github.com/SecurityAndStuff/detours-rs |
max_upload_size | |
id | 899211 |
size | 3,431,361 |
Microsoft Detours Rust library bindings.
This is raw FFI and doesn't provide a nice wrapper, only some windows-rs
imports.
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)Sleep, SleepHook);
DetourTransactionCommit();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
let c_fn_ptr = Sleep as unsafe extern "C" fn(_) -> _ as *mut std::ffi::c_void;
DetourAttach(
c_fn_ptr as *mut *mut c_void,
sleep_hook as fn(_) -> _ as *mut c_void,
);
DetourTransactionCommit();
let start = Instant::now();
Sleep(10_000u32);
let duration = start.elapsed();
assert!(duration.as_secs() < 10_000);