Expand description
Finding code by a byte pattern.
A pattern is hex bytes separated by spaces, with ? or ?? for any byte:
"48 89 5C 24 ?? 57". It’s searched for in a loaded module’s executable
sections and must match exactly once, so a pattern that no longer fits the
program fails instead of landing somewhere else. find and find_in
are the short way, Pattern can also step from the match to an address
near it, and Hook::scan and Injection::scan patch what a pattern
finds.
§Examples
use imping_hook::scan::{self, Pattern};
let address = scan::find("48 89 5C 24 ?? 57 48 83 EC 20")?;
let address = scan::find_in("engine.dll", "48 89 5C 24 ?? 57")?;
// The function a matched call goes to.
let address = Pattern::new("E8 ?? ?? ?? ?? 48 8B D8").follow_call().find()?;Structs§
- Pattern
- A byte pattern to find, where to look for it, and how to get from the match to the address wanted.