3 releases

0.2.15 Jul 18, 2024
0.2.14 Jul 16, 2024
0.2.13 Oct 12, 2023
0.2.12 Jul 18, 2022
0.1.9 Jun 30, 2022

#177 in Unix APIs

Download history 247/week @ 2024-07-14 63/week @ 2024-07-21 95/week @ 2024-07-28 19/week @ 2024-08-04 8/week @ 2024-08-11 15/week @ 2024-08-18 16/week @ 2024-08-25 30/week @ 2024-09-01 45/week @ 2024-09-08 98/week @ 2024-09-15 67/week @ 2024-09-22 57/week @ 2024-09-29 5/week @ 2024-10-06 4/week @ 2024-10-13 23/week @ 2024-10-20 18/week @ 2024-10-27

53 downloads per month

MIT license

320KB
1K SLoC

tasklist-rs

tasklist-rs

a small crate let you can easily get tasklist and process information on windows

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. Check whether the process is running in the WOW64 environment.
  10. Iterate over all processes

remember some infomation need higher privilege in some specific windows versions

example

Get all process pid , process name and user .

use tasklist;

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


}

tasklist-rs

Get all process name , pid , company name , file description.

use tasklist;

fn main(){
    tasklist::enable_debug_priv();
    for i in unsafe{tasklist::Tasklist::new()}{
        let cpn = match i.get_file_info().get("CompanyName"){
            Some(h)=>h.to_string(),
            None=>"".to_string(),
        };
        let des = match i.get_file_info().get("FileDescription"){
            Some(h)=>h.to_string(),
            None=>"".to_string(),
        };
        println!("\t{} \t{} \t{} \t{}",i.get_pname(),i.get_pid(),cpn,des)
       }
}

tasklist-rs

Usage

Add this to your Cargo.toml:

[dependencies]
tasklist = "0.2.15"

Dependencies

~0–35MB
~525K SLoC