Skip to main content

PreHookFn

Type Alias PreHookFn 

pub type PreHookFn = Arc<dyn Fn(&HookContext<'_>, &mut EmulationThread) -> PreHookResult + Send + Sync>;
Expand description

Type alias for pre-hook functions.

Pre-hooks receive the hook context and mutable thread access. They return a PreHookResult indicating whether to continue with the original method or bypass it.

§Thread Safety

Pre-hook functions must be Send + Sync to allow registration from any thread.

§Examples

use dotscope::emulation::{PreHookFn, PreHookResult};
use std::sync::Arc;

let my_hook: PreHookFn = Arc::new(|ctx, thread| {
    println!("Called: {}", ctx.method_name);
    PreHookResult::Continue
});

Aliased Type§

pub struct PreHookFn { /* private fields */ }