pub trait MemoryRead {
// Required method
fn try_read_bytes_into(&self, address: u64, buffer: &mut [u8]) -> Option<()>;
// Provided methods
fn try_read_bytes(&self, address: u64, len: usize) -> Option<Vec<u8>> { ... }
fn dump_memory(&self, range: MemoryRange) -> Option<Vec<u8>> { ... }
fn valid_address(&self, address: u64) -> bool { ... }
fn try_read_string(
&self,
address: u64,
) -> Option<Result<String, FromUtf8Error>> { ... }
fn try_read_string_wide(
&self,
address: u64,
) -> Option<Result<String, FromUtf16Error>> { ... }
}Expand description
Represents any type with a buffer that can be read from
Required Methods§
Provided Methods§
Sourcefn try_read_bytes(&self, address: u64, len: usize) -> Option<Vec<u8>>
fn try_read_bytes(&self, address: u64, len: usize) -> Option<Vec<u8>>
Reads bytes from the process at the specified address and returns the bytes as a Vector. Returns none if the address is not valid
Sourcefn dump_memory(&self, range: MemoryRange) -> Option<Vec<u8>>
fn dump_memory(&self, range: MemoryRange) -> Option<Vec<u8>>
Dumps a memory range into a Vector. If any part of the memory range is not valid, it will return None
Sourcefn valid_address(&self, address: u64) -> bool
fn valid_address(&self, address: u64) -> bool
Returns true if the specified address is valid. By default reads one byte at that location and returns the success value
Sourcefn try_read_string(&self, address: u64) -> Option<Result<String, FromUtf8Error>>
fn try_read_string(&self, address: u64) -> Option<Result<String, FromUtf8Error>>
Reads a string at the specified location with char length of 1. If the address is valid or there is no null terminator in MAX_STRING_SIZE characters, it will return None
Sourcefn try_read_string_wide(
&self,
address: u64,
) -> Option<Result<String, FromUtf16Error>>
fn try_read_string_wide( &self, address: u64, ) -> Option<Result<String, FromUtf16Error>>
Reads a wide string at the specified location with char length of 1. If the address is valid or there is no null terminator in MAX_STRING_SIZE characters, it will return None
Trait Implementations§
Source§impl MemoryReadExt for dyn MemoryRead
impl MemoryReadExt for dyn MemoryRead
Source§fn try_read<T: Pod>(&self, address: u64) -> Option<T>
fn try_read<T: Pod>(&self, address: u64) -> Option<T>
Reads bytes from the process at the specified address into a value of type T.
Returns None if the address is not valid
Source§unsafe fn try_read_unchecked<T>(&self, address: u64) -> Option<T>
unsafe fn try_read_unchecked<T>(&self, address: u64) -> Option<T>
Reads any type T from the process without the restriction of Pod
Source§fn read<T: Pod>(&self, address: u64) -> T
fn read<T: Pod>(&self, address: u64) -> T
Reads bytes from the process at the specified address into a value of type T.
Panics if the address is not valid
Source§fn try_read_bytes_const<const LEN: usize>(
&self,
address: u64,
) -> Option<[u8; LEN]>
fn try_read_bytes_const<const LEN: usize>( &self, address: u64, ) -> Option<[u8; LEN]>
Reads a const number of bytes from the process returning a stack allocated array.