Crate min_hook_rs

Source
Expand description

§MinHook-rs

A Rust implementation of MinHook library for Windows x64 function hooking.

§Documentation

For complete documentation, examples, and technical details, see the README.md.

§Quick Example

use min_hook_rs::*;
use std::ffi::c_void;

unsafe extern "system" fn my_hook() -> i32 { 42 }

fn main() -> Result<()> {
    initialize()?;
    let trampoline = create_hook(0x12345678 as *mut c_void, my_hook as *mut c_void)?;
    enable_hook(0x12345678 as *mut c_void)?;
    // Function is now hooked
    Ok(())
}

Re-exports§

pub use error::HookError;
pub use error::Result;
pub use hook::ALL_HOOKS;
pub use hook::apply_queued;
pub use hook::create_hook;
pub use hook::create_hook_api;
pub use hook::create_hook_api_ex;
pub use hook::disable_hook;
pub use hook::enable_hook;
pub use hook::initialize;
pub use hook::queue_disable_hook;
pub use hook::queue_enable_hook;
pub use hook::remove_hook;
pub use hook::status_to_string;
pub use hook::uninitialize;
pub use buffer::MEMORY_SLOT_SIZE;
pub use buffer::allocate_buffer;
pub use buffer::free_buffer;
pub use buffer::is_executable_address;
pub use disasm::HookInstruction;
pub use disasm::decode_instruction;
pub use instruction::CallAbs;
pub use instruction::JccAbs;
pub use instruction::JccRel;
pub use instruction::JmpAbs;
pub use instruction::JmpRel;
pub use instruction::JmpRelShort;
pub use instruction::Trampoline;

Modules§

buffer
Memory buffer management for MinHook-rs
disasm
Precise x86_64 instruction decoder - direct port of HDE64 with goto elimination Based on hde64.c, maintaining exact compatibility while removing goto statements
error
Error handling for MinHook-rs
hook
Hook management for MinHook-rs
instruction
x64 instruction structures for MinHook-rs
trampoline
Trampoline function creation for MinHook-rs

Constants§

LIBRARY_NAME
Library name
VERSION
Library version

Functions§

get_library_name
Get library name
get_version
Get library version string
is_supported
Check if the current platform is supported