Trait winsafe::prelude::kernel_Hprocesslist

source ·
pub trait kernel_Hprocesslist: Handle {
Show 13 methods // Provided methods fn iter_heaps( &mut self ) -> impl Iterator<Item = SysResult<&HEAPLIST32>> + '_ { ... } fn iter_modules( &mut self ) -> impl Iterator<Item = SysResult<&MODULEENTRY32>> + '_ { ... } fn iter_processes( &mut self ) -> impl Iterator<Item = SysResult<&PROCESSENTRY32>> + '_ { ... } fn iter_threads( &mut self ) -> impl Iterator<Item = SysResult<&THREADENTRY32>> + '_ { ... } fn CreateToolhelp32Snapshot( flags: TH32CS, th32_process_id: Option<u32> ) -> SysResult<CloseHandleGuard<HPROCESSLIST>> { ... } fn Heap32ListFirst(&mut self, hl: &mut HEAPLIST32) -> SysResult<bool> { ... } fn Heap32ListNext(&mut self, hl: &mut HEAPLIST32) -> SysResult<bool> { ... } fn Module32First(&mut self, me: &mut MODULEENTRY32) -> SysResult<bool> { ... } fn Module32Next(&mut self, me: &mut MODULEENTRY32) -> SysResult<bool> { ... } fn Process32First(&mut self, pe: &mut PROCESSENTRY32) -> SysResult<bool> { ... } fn Process32Next(&mut self, pe: &mut PROCESSENTRY32) -> SysResult<bool> { ... } fn Thread32First(&mut self, te: &mut THREADENTRY32) -> SysResult<bool> { ... } fn Thread32Next(&mut self, te: &mut THREADENTRY32) -> SysResult<bool> { ... }
}
Available on crate feature kernel only.
Expand description

This trait is enabled with the kernel feature, and provides methods for HPROCESSLIST.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

fn iter_heaps(&mut self) -> impl Iterator<Item = SysResult<&HEAPLIST32>> + '_

Returns an iterator over the heaps of a process, with HEAPLIST32 structs. Calls HPROCESSLIST::Heap32ListFirst and then HPROCESSLIST::Heap32ListNext consecutively.

§Examples
use winsafe::{self as w, prelude::*, co};

let mut hpl = w::HPROCESSLIST::
    CreateToolhelp32Snapshot(co::TH32CS::SNAPHEAPLIST, None)?;

for heap_entry in hpl.iter_heaps() {
    let heap_entry = heap_entry?;
    let is_default_heap = heap_entry.dwFlags == co::HF32::DEFAULT;
    println!("{} {}",
        heap_entry.th32HeapID, heap_entry.th32ProcessID);
}
source

fn iter_modules( &mut self ) -> impl Iterator<Item = SysResult<&MODULEENTRY32>> + '_

Returns an iterator over the modules of a process, with MODULEENTRY32 structs. Calls HPROCESSLIST::Module32First and then HPROCESSLIST::Module32Next consecutively.

§Examples
use winsafe::{self as w, prelude::*, co};

let mut hpl = w::HPROCESSLIST::
    CreateToolhelp32Snapshot(co::TH32CS::SNAPMODULE, None)?;

for mod_entry in hpl.iter_modules() {
    let mod_entry = mod_entry?;
    println!("{} {}",
        mod_entry.szModule(), mod_entry.th32ProcessID);
}
source

fn iter_processes( &mut self ) -> impl Iterator<Item = SysResult<&PROCESSENTRY32>> + '_

Returns an iterator over the processes of a process, with PROCESSENTRY32 structs. Calls HPROCESSLIST::Process32First and then HPROCESSLIST::Process32Next consecutively.

§Examples
use winsafe::{self as w, prelude::*, co};

let mut hpl = w::HPROCESSLIST::
    CreateToolhelp32Snapshot(co::TH32CS::SNAPPROCESS, None)?;

for proc_entry in hpl.iter_processes() {
    let proc_entry = proc_entry?;
    println!("{} {} {}",
        proc_entry.szExeFile(), proc_entry.th32ProcessID, proc_entry.cntThreads);
}
source

fn iter_threads( &mut self ) -> impl Iterator<Item = SysResult<&THREADENTRY32>> + '_

Returns an iterator over the threads of a process, with THREADENTRY32 structs. Calls HPROCESSLIST::Thread32First and then HPROCESSLIST::Thread32Next consecutively.

§Examples
use winsafe::{self as w, prelude::*, co};

let mut hpl = w::HPROCESSLIST::CreateToolhelp32Snapshot(
    co::TH32CS::SNAPTHREAD,
    Some(w::GetCurrentProcessId()),
)?;

for thread_entry in hpl.iter_threads() {
    let thread_entry = thread_entry?;
    println!("{} {}",
        thread_entry.th32ThreadID, thread_entry.th32OwnerProcessID);
}
source

fn CreateToolhelp32Snapshot( flags: TH32CS, th32_process_id: Option<u32> ) -> SysResult<CloseHandleGuard<HPROCESSLIST>>

source

fn Heap32ListFirst(&mut self, hl: &mut HEAPLIST32) -> SysResult<bool>

HeapList32First function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_heaps, which is simpler.

source

fn Heap32ListNext(&mut self, hl: &mut HEAPLIST32) -> SysResult<bool>

HeapList32Next function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_heaps, which is simpler.

source

fn Module32First(&mut self, me: &mut MODULEENTRY32) -> SysResult<bool>

Module32First function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_modules, which is simpler.

source

fn Module32Next(&mut self, me: &mut MODULEENTRY32) -> SysResult<bool>

Module32Next function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_modules, which is simpler.

source

fn Process32First(&mut self, pe: &mut PROCESSENTRY32) -> SysResult<bool>

Process32First function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_processes, which is simpler.

source

fn Process32Next(&mut self, pe: &mut PROCESSENTRY32) -> SysResult<bool>

Process32Next function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_processes, which is simpler.

source

fn Thread32First(&mut self, te: &mut THREADENTRY32) -> SysResult<bool>

Thread32First function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_threads, which is simpler.

source

fn Thread32Next(&mut self, te: &mut THREADENTRY32) -> SysResult<bool>

Thread32First function.

After the listing ends, the handle will be invalidated and further operations will fail with ERROR::INVALID_HANDLE error code.

Prefer using HPROCESSLIST::iter_threads, which is simpler.

Object Safety§

This trait is not object safe.

Implementors§