wraith/manipulation/inline_hook/hook/
mod.rs

1//! Hook type implementations
2//!
3//! This module provides different hook types:
4//! - `InlineHook`: Standard prologue replacement hook
5//! - `HotPatchHook`: Windows hot-patching style hook
6//! - `MidFunctionHook`: Hook at arbitrary location within a function
7//! - `HookChain`: Multiple hooks on the same target
8
9pub mod chain;
10pub mod hotpatch;
11pub mod inline;
12pub mod mid;
13
14pub use chain::HookChain;
15pub use hotpatch::HotPatchHook;
16pub use inline::InlineHook;
17pub use mid::MidFunctionHook;
18
19use crate::error::Result;
20
21/// common hook trait
22pub trait Hook: Sized {
23    /// the guard type returned when the hook is installed
24    type Guard;
25
26    /// install the hook
27    fn install(self) -> Result<Self::Guard>;
28
29    /// get the target address
30    fn target(&self) -> usize;
31
32    /// get the detour address
33    fn detour(&self) -> usize;
34}