Trait process_memory::CopyAddress
source · [−]pub trait CopyAddress {
fn copy_address(&self, addr: usize, buf: &mut [u8]) -> Result<()>;
fn get_pointer_width(&self) -> Architecture;
fn get_offset(&self, offsets: &[usize]) -> Result<usize> { ... }
}
Expand description
A trait that defines that it is possible to copy some memory from something represented by a type into a buffer.
Required Methods
sourcefn copy_address(&self, addr: usize, buf: &mut [u8]) -> Result<()>
fn copy_address(&self, addr: usize, buf: &mut [u8]) -> Result<()>
Copy an address into user-defined buffer.
Errors
std::io::Error
if an error occurs copying the address.
sourcefn get_pointer_width(&self) -> Architecture
fn get_pointer_width(&self) -> Architecture
Get the the pointer width of the underlying process.
This is required for get_offset
to work.
Performance
Any implementation of this function should be marked with
#[inline(always)]
as this function is very commonly called and
should be inlined.
Provided Methods
sourcefn get_offset(&self, offsets: &[usize]) -> Result<usize>
fn get_offset(&self, offsets: &[usize]) -> Result<usize>
Get the actual memory location from a set of offsets.
If copy_address
and get_pointer_width
are already defined, then
we can provide a standard implementation that will work across all
operating systems.
Errors
std::io::Error
if an error occurs copying the address.
Implementors
impl CopyAddress for ProcessHandle
Use ReadProcessMemory
to read memory from another process on Windows.