track parent PID and thread count in ProcessInfo

This commit is contained in:
Adir Shitrit
2025-11-07 18:07:07 +02:00
parent 08ba83b110
commit 19e79449e0

View File

@@ -3,8 +3,10 @@ use std::fmt;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ProcessInfo { pub struct ProcessInfo {
pub pid: u32, pub pid: u32,
pub ppid: u32,
pub name: String, pub name: String,
pub path: Option<String>, pub path: Option<String>,
pub thread_count: u32,
} }
impl fmt::Display for ProcessInfo { impl fmt::Display for ProcessInfo {
@@ -47,8 +49,10 @@ mod platform {
processes.push(ProcessInfo { processes.push(ProcessInfo {
pid: entry.th32ProcessID, pid: entry.th32ProcessID,
ppid: entry.th32ParentProcessID,
name, name,
path: None, path: None,
thread_count: entry.cntThreads,
}); });
if Process32NextW(snapshot, &mut entry).is_err() { if Process32NextW(snapshot, &mut entry).is_err() {