Expand description
Assembly instruction encoding and decoding utilities
This module provides low-level instruction encoding primitives used by the hooking framework for generating hook stubs and trampolines.
§iced-x86 Integration
When the inline-hook feature is enabled, this module uses iced-x86
for comprehensive instruction decoding and relocation. This provides:
- Full x86/x64 instruction set support
- Proper handling of all relative addressing modes
- RIP-relative memory operand relocation
- Short-to-long jump expansion
- Conditional branch handling
§Example
ⓘ
use wraith::manipulation::inline_hook::asm::{
iced_decoder::{InstructionDecoder, decode_one},
iced_relocator::{InstructionRelocator, relocate_one},
};
// decode an instruction
let decoded = decode_one(0x1000, &[0xE9, 0x00, 0x01, 0x00, 0x00]).unwrap();
println!("Length: {}, Relative: {}", decoded.length, decoded.is_relative);
// relocate an instruction
let result = relocate_one(&[0xE9, 0x00, 0x01, 0x00, 0x00], 0x1000, 0x2000);
assert!(result.success);Re-exports§
pub use decoder::decode_instruction;pub use decoder::InstructionInfo;pub use encoder::Encoder;pub use iced_decoder::DecodedInstruction;pub use iced_decoder::InstructionDecoder;pub use iced_decoder::decode_one;pub use iced_decoder::find_instruction_boundary;pub use iced_decoder::uses_relative_addressing;pub use iced_relocator::RelocationResult;pub use iced_relocator::InstructionRelocator;pub use iced_relocator::relocate_one;pub use iced_relocator::relocate_block;pub use iced_relocator::instruction_needs_relocation;
Modules§
- decoder
- Instruction length decoder
- encoder
- Instruction encoding utilities
- iced_
decoder - Instruction decoding using iced-x86
- iced_
relocator - Instruction relocation using iced-x86