SplitScript reference / Module / scanRelative32Target
Module.scanRelative32Target
Method
Module.scanRelative32Target(signature: Signature, displacementOffset: u64, target: address) -> async address
Scans for a signature whose signed relative 32-bit operand resolves to a particular address.
All candidates in one bounded chunk are checked before the operation yields. This is useful for executable metadata references where a short instruction prefix may have many unrelated matches.
Parameters
signature: The instruction signature.displacementOffset: Byte offset from the match to the relative operand.target: Address to which the operand must resolve.
Effects: reads process memory, requires an attached process, suspends, cancels when the process closes
Runtime behavior: available only in onAttach; suspends; cancels when the process closes
Examples
Find the instruction that references a known string
let module = await process.mainModule()
let metadata: address = 0x1000
let instruction = await module.scanRelative32Target(
sig"48 8D 0D",
3,
metadata,
)