Struct windows_win::Process
[−]
[src]
pub struct Process { /* fields omitted */ }Windows process representation
Methods
impl Process[src]
fn open(pid: u32, access_rights: u32) -> Result<Process>
Creates handle to a new process by opening it through pid.
Note:
See information about access rights: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684880%28v=vs.85%29.aspx
Parameters:
pid- Pid of the process.access_rights- Bit mask that specifies desired access rights.
Return:
Ok- Process struct.Err- Error reason.
fn from_raw(handle: HANDLE) -> Self
Creates instance from existing handle
fn inner(&self) -> HANDLE
Retrieves underlying handle.
fn into_inner(self) -> HANDLE
Retrieves underlying handle and consumes self.
Basically you're responsible to close handle now.
fn exe_path(&self) -> Result<String>
Gets full path to process's exectuable.
Note
The process MUST be opened with either PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION flag.
Return
Ok- Success.Err- Error reason.
fn window(&self) -> Result<Option<HWND>>
fn read_memory(&self, base_addr: usize, storage: &mut [u8]) -> Result<()>
Reads memory from process.
Parameters:
base_addr- Address from where to start reading.storage- Storage to hold memory. Itslendetermines amount of bytes to read.
fn write_memory(&self, base_addr: usize, data: &[u8]) -> Result<()>
Writes into process memory.
Parameters:
base_addr- Address from where to start writing.data- Slice with write data.
Return:
Ok- Success.Err- Error reason.
fn close(&mut self)
Closes process
Note:
There is no need to explicitly close the process.
It shall be closed automatically when being dropped.
fn terminate(self, exit_code: c_uint) -> Result<()>
Forces termination of process and consumes itself.
For details see raw::process::terminate().