InProcessMemory

Struct InProcessMemory 

Source
pub struct InProcessMemory { /* private fields */ }
Expand description

进程内内存操作

Implementations§

Source§

impl InProcessMemory

Source

pub fn new(process_handle: HANDLE, size: usize) -> Result<Self>

创建新实例。 pid 进程ID。 size 内存大小(字节数)。

Source

pub fn as_ptr_mut(&self) -> *mut c_void

获取目标进程内存的可变原始指针。

Source

pub fn as_ptr(&self) -> *const c_void

获取目标进程内存的原始指针。

Source

pub fn read<T: Sized>(&self, convert: impl Fn(*const c_void) -> T) -> Option<T>

读取内存。 convert 一个闭包函数,在内存读取之后调用,可以做数据转换。

Source

pub fn write(&self, ptr: *const c_void, size: usize) -> usize

写入内存数据(返回实际写入的大小)。 ptr 要写入的数据的指针。 size 要写入的大小(字节数)。

Trait Implementations§

Source§

impl Drop for InProcessMemory

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.