Expand description

tasklist

tasklist is a crate let you easily get tasklist and process information on windows. it based on windows-rs crate.

what information you can get
  1. Process name,pid,parrentID,theradsID.
  2. Process start_time,exit_time,and CPU_time(including kernel time and user time).
  3. Process path and commandline params.
  4. Process SID and Domain/User.
  5. Process IO infomation , including all of IO_COUNTERS member.
  6. Process memory information , including all of PROCESS_MEMORY_COUNTERS member.
  7. Process handles information , use GetProcessHandleCount Api.
  8. Process file infomation , use GetFileVersionInfoExW Api.
  9. Pterate over all processes

remember some infomation need higher privilege in some specific windows versions

example

use tasklist;
fn main(){
    unsafe{
        let tl = tasklist::Tasklist::new();
        for i in tl{
            println!("{} {} {}",i.get_pid(),i.get_pname(),i.get_user());
        }
    }
}

Modules

Structs

the process’s IO counter struct

process’s memory counter struct . can easily get memory infomation of a process.

the process struct .

this struct is Process Iterator.

Functions

enbale the debug privilege for your program , it return a bool to show if it success.

return the first process id by the name you gave , it return the Option<u32> , u32 is the process id.

find the process id by the name you gave , it return a Vec<U32> , if the process is not exist , it will return a empty Vec<u32>

just like the name , this function will return a Option<String> by the id you gave, String is the name of process.

kill a process by process_id . if success , it will return true

get the windows tasklist ,return a HashMap<String,u32> String is the name of process, and u32 is the id of process