Struct Process

Source
pub struct Process {
    pub pid: u32,
    pub pname: String,
}
Expand description

the process struct .

use tasklist::Process;
let p = Process::new(123,"yeah.exe".to_string());

Fields§

§pid: u32§pname: String

Implementations§

Source§

impl Process

Source

pub fn new(pid: u32, pname: String) -> Process

new a process struct

use tasklist::Process;
let p = Process::new(123,"yeah.exe".to_string());
Source

pub fn get_pid(&self) -> u32

get the process struct pid . return u32

Source

pub fn get_pname(&self) -> String

get the process struct pname . return String

Source

pub fn get_sid(&self) -> Result<String, String>

get the process SID . return Result<String,String>

Source

pub fn get_user(&self) -> Result<String, String>

get the process User . return Result<String,String>

Source

pub fn get_threads(&self) -> Result<Vec<u32>, String>

get the process threadsID . return Result<Vec<u32>,String>

Source

pub fn get_path(&self) -> Result<String, String>

get the process path . return Result<String, String>

Source

pub fn get_parrent(&self) -> Option<u32>

get the process parrentID , return Option<u32>

Source

pub fn get_start_time(&self) -> Result<String, String>

get the process start time . return Result<String,String>

Source

pub fn get_exit_time(&self) -> Result<String, String>

get process exit time . return Result<String,String>

Source

pub fn get_cpu_time(&self) -> Result<CpuTime, String>

get process cpu time infomation . return Result<CpuTime,String>

Source

pub fn get_cmd_params(&self) -> Result<String, String>

get process commandline params . return Result<String,String>

Source

pub fn get_io_counter(&self) -> IoCounter

get process io counter . return a IoCounter struct

Source

pub fn get_memory_info(&self) -> MemoryCounter

get process memory counter . return a MemoryCounter struct

Source

pub fn get_handles_counter(&self) -> Result<u32, String>

get process handle counter

Source

pub fn kill(&self) -> Result<(), String>

kill this process

Source

pub fn get_file_info(&self) -> Result<HashMap<String, String>, String>

get the file info of the process . use GetFileVersionInfoExW api . it will return a HashMap<String,String> including a lot of infomation. you can get value throught CompanyName FileDescription OriginalFilename ProductName ProductVersion PrivateBuild InternalName LegalCopyright FileVersion keys.

Source

pub fn is_wow64(&self) -> Option<bool>

Check if process is running under WOW64 Returns None if failed to get information

Source

pub fn get_architecture_info( &self, ) -> Option<(bool, &'static str, &'static str)>

Get process architecture information Returns tuple: (is_wow64: bool, process_arch: &str, native_arch: &str) Returns None if failed to get information

Source

pub fn get_file_info_item(&self, key: &str) -> Option<String>

Get specific file info item by key Returns None if key doesn’t exist

Source

pub fn get_company_name(&self) -> Option<String>

Get company name from file info

Source

pub fn get_file_description(&self) -> Option<String>

Get file description from file info

Source

pub fn is_running(&self) -> bool

Check if process is still running

Trait Implementations§

Source§

impl Debug for Process

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Process

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.