fix: handle system process PIDs in memory enumeration

This commit is contained in:
Adir Shitrit
2024-11-08 02:14:00 +02:00
parent 4740304043
commit 1317e27b5e

View File

@@ -80,6 +80,11 @@ mod platform {
pub fn enumerate_memory_regions(pid: u32) -> Result<Vec<MemoryRegion>> {
let mut regions = Vec::new();
// Skip system process
if pid == 0 || pid == 4 {
return Ok(regions);
}
unsafe {
let handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid)
.context("Failed to open process")?;