Expand description
plthook is a pure-Rust import-table rebinding engine.
It enumerates imports in loaded Windows PE, Linux ELF, macOS Mach-O, and iOS/iPadOS Mach-O modules. Installing a replacement resolves every target first, changes page protection only as needed, swaps slots atomically, and restores a slot only when the guard still owns it.
The binary-format parsers are bounds-checked and host-independent; the live backends provide module discovery, page protection, and original-symbol lookup.
Structs§
- Hook
Guard - RAII owner of a set of installed hooks. Dropping it restores the original
slot values (best-effort, compare-exchange);
HookGuard::uninstalldoes the same but surfaces any conflict. - Import
Slot - A single writable import slot discovered in a module.
- Installed
Hook - One installed hook: enough to restore it and to hand the caller the original.
- Module
- A validated, currently-loaded ELF object.
- Replacement
- A requested slot replacement.
Enums§
- Error
- Errors produced by the engine while acquiring, parsing, or patching a module.
- Import
Kind - How an import reaches its slot: a normal load-time binding or a delay-load
- Symbol
- An imported symbol, identified either by name or by ordinal.
Functions§
- install
- Install a set of
Replacements intomodule’s import table, transactionally.
Type Aliases§
- Result
- Crate-local result alias.