pub struct MappedMemory {
pub data: Vec<u8>,
pub base_address: u64,
}Expand description
Represents a mapped region of process memory for pointer reads.
Used by _readAddressFromMemory:atAddress: to read pointer-sized values
from a pre-mapped buffer without additional Mach VM calls.
Fields§
§data: Vec<u8>Raw bytes of the mapped memory region.
base_address: u64Virtual address corresponding to data[0].
Implementations§
Source§impl MappedMemory
impl MappedMemory
Sourcepub fn read_bytes(&self, address: u64, len: usize) -> Option<&[u8]>
pub fn read_bytes(&self, address: u64, len: usize) -> Option<&[u8]>
Reads a slice of bytes from this mapped region at the given virtual address. Returns None if the range is out of bounds.
Sourcepub fn contains_address(&self, address: u64) -> bool
pub fn contains_address(&self, address: u64) -> bool
Returns true if this region contains the given address.
Source§impl MappedMemory
impl MappedMemory
Sourcepub fn read_pointer(&self, address: u64, is_64_bit: bool) -> Option<u64>
pub fn read_pointer(&self, address: u64, is_64_bit: bool) -> Option<u64>
Reads a pointer-sized value from the mapped memory at the given virtual address. Reads 8 bytes for 64-bit processes, 4 bytes for 32-bit.
§Examples
use crashrustler::MappedMemory;
let mem = MappedMemory {
data: vec![0x78, 0x56, 0x34, 0x12, 0xEF, 0xBE, 0xAD, 0xDE],
base_address: 0x1000,
};
// 64-bit read: all 8 bytes as little-endian u64
assert_eq!(mem.read_pointer(0x1000, true), Some(0xDEADBEEF_12345678));
// 32-bit read: first 4 bytes as little-endian u32
assert_eq!(mem.read_pointer(0x1000, false), Some(0x12345678));
// Out of range
assert_eq!(mem.read_pointer(0x2000, true), None);Trait Implementations§
Source§impl Clone for MappedMemory
impl Clone for MappedMemory
Source§fn clone(&self) -> MappedMemory
fn clone(&self) -> MappedMemory
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MappedMemory
impl Debug for MappedMemory
Source§impl MemoryReader for MappedMemory
MemoryReader implementation for MappedMemory (for testing).
impl MemoryReader for MappedMemory
MemoryReader implementation for MappedMemory (for testing).
Auto Trait Implementations§
impl Freeze for MappedMemory
impl RefUnwindSafe for MappedMemory
impl Send for MappedMemory
impl Sync for MappedMemory
impl Unpin for MappedMemory
impl UnsafeUnpin for MappedMemory
impl UnwindSafe for MappedMemory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more