[][src]Struct winproc::Process

pub struct Process { /* fields omitted */ }

A handle to a running process.

Methods

impl Process[src]

pub fn from_id(id: u32) -> WinResult<Process>[src]

Creates a process handle from a PID. Requests all access permissions.

pub fn from_id_with_access(id: u32, access: Access) -> WinResult<Process>[src]

Creates a process handle from a PID. Requests the specified access permissions.

pub fn from_name(name: &str) -> WinResult<Process>[src]

Creates a process handle from a name. Requests all access.

pub fn from_name_with_access(name: &str, access: Access) -> WinResult<Process>[src]

Creates a process handle from a name.

pub fn from_handle(handle: Handle) -> Process[src]

Creates a process handle from a handle.

pub fn current() -> Process[src]

Returns a handle to the current process.

pub fn handle(&self) -> &Handle[src]

Returns a reference to the inner handle.

pub fn all() -> WinResult<impl Iterator<Item = Process>>[src]

Enumerates all running processes. Requests all access.

pub fn all_with_access(
    access: Access
) -> WinResult<impl Iterator<Item = Process>>
[src]

Enumerates all running processes.

pub fn id(&self) -> u32[src]

Returns the process's id.

pub fn is_running(&self) -> bool[src]

Returns true if the process is running.

pub fn path(&self) -> WinResult<PathBuf>[src]

Returns the path of the executable of the process.

pub fn name(&self) -> WinResult<String>[src]

Returns the unqualified name of the executable of the process.

pub fn priority(&self) -> WinResult<PriorityClass>[src]

Returns the priority class of the process.

The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right.

pub fn set_priority(&mut self, priority: PriorityClass) -> WinResult[src]

Sets the priority class of the process.

The handle must have the PROCESS_SET_INFORMATION access right.

pub fn start_background_mode(&mut self) -> WinResult[src]

Begins background processing mode.

This can be initiated only if the handle refers to the current process.

The system lowers the resource scheduling priorities of the process (and its threads) so that it can perform background work without significantly affecting activity in the foreground.

The function fails if the process is already in background processing mode.

The handle must have the PROCESS_SET_INFORMATION access right.

pub fn end_background_mode(&mut self) -> WinResult[src]

Ends background processing mode.

This can be initiated only if the handle refers to the current process.

The system restores the resource scheduling priorities of the process (and its threads) as they were before the process entered background processing mode.

The function fails if the process is not in background processing mode.

The handle must have the PROCESS_SET_INFORMATION access right.

pub fn terminate(&mut self, exit_code: u32) -> WinResult[src]

Terminates the process.

The handle must have the PROCESS_TERMINATE access right.

pub fn affinity_mask(&self) -> WinResult<usize>[src]

Returns the affinity mask of the process.

pub fn set_affinity_mask(&mut self, mask: u32) -> WinResult[src]

Sets the affinity mask of the process.

A process affinity mask is a bit vector in which each bit represents a logical processor that a process is allowed to run on.

Setting an affinity mask for a process or thread can result in threads receiving less processor time, as the system is restricted from running the threads on certain processors. In most cases, it is better to let the system select an available processor.

If the new process affinity mask does not specify the processor that is currently running the process, the process is rescheduled on one of the allowable processors.

pub fn threads<'a>(&'a self) -> WinResult<impl Iterator<Item = Thread> + 'a>[src]

Returns an iterator over the threads of the process.

pub fn thread_ids<'a>(&'a self) -> WinResult<impl Iterator<Item = u32> + 'a>[src]

Returns an iterator over the ids of threads of the process.

pub fn module<N: AsRef<OsStr>>(&self, name: N) -> WinResult<Module>[src]

Returns the loaded module with the specified name/path.

pub fn module_list(&self) -> WinResult<Vec<Module>>[src]

Returns a list of the modules of the process.

pub fn module_entries<'a>(
    &'a self
) -> WinResult<impl Iterator<Item = ModuleEntry> + 'a>
[src]

Returns an iterator over the modules of the process.

Trait Implementations

impl Deref for Process[src]

type Target = HANDLE

The resulting type after dereferencing.

impl Debug for Process[src]

impl AsRawHandle for Process[src]

impl IntoRawHandle for Process[src]

impl FromRawHandle for Process[src]

Auto Trait Implementations

impl !Sync for Process

impl !Send for Process

impl Unpin for Process

impl RefUnwindSafe for Process

impl UnwindSafe for Process

Blanket Implementations

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

impl<T> From<T> for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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