[][src]Struct windows_win::Process

pub struct Process { /* fields omitted */ }

Windows process representation

Methods

impl Process[src]

pub fn open(pid: u32, access_rights: u32) -> Result<Process>[src]

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.

pub fn from_raw(handle: HANDLE) -> Self[src]

Creates instance from existing handle

pub fn inner(&self) -> HANDLE[src]

Retrieves underlying handle.

pub fn into_inner(self) -> HANDLE[src]

Retrieves underlying handle and consumes self.

Basically you're responsible to close handle now.

pub fn exe_path(&self) -> Result<String>[src]

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.

pub fn window(&self) -> Result<Option<HWND>>[src]

Retrieves handle to process's window

Note

It can return None if process hasn't created window.

pub fn read_memory(&self, base_addr: usize, storage: &mut [u8]) -> Result<()>[src]

Reads memory from process.

Parameters:

  • base_addr - Address from where to start reading.
  • storage - Storage to hold memory. Its len determines amount of bytes to read.

pub fn write_memory(&self, base_addr: usize, data: &[u8]) -> Result<()>[src]

Writes into process memory.

Parameters:

  • base_addr - Address from where to start writing.
  • data - Slice with write data.

Return:

  • Ok - Success.
  • Err - Error reason.

pub fn close(&mut self)[src]

Closes process

Note:

There is no need to explicitly close the process.

It shall be closed automatically when being dropped.

pub fn terminate(self, exit_code: c_uint) -> Result<()>[src]

Forces termination of process and consumes itself.

For details see raw::process::terminate().

Trait Implementations

impl Drop for Process[src]

Auto Trait Implementations

impl !Send for Process

impl !Sync for Process

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]