fix: handle system process PIDs in memory enumeration
This commit is contained in:
@@ -80,6 +80,11 @@ mod platform {
|
|||||||
pub fn enumerate_memory_regions(pid: u32) -> Result<Vec<MemoryRegion>> {
|
pub fn enumerate_memory_regions(pid: u32) -> Result<Vec<MemoryRegion>> {
|
||||||
let mut regions = Vec::new();
|
let mut regions = Vec::new();
|
||||||
|
|
||||||
|
// Skip system process
|
||||||
|
if pid == 0 || pid == 4 {
|
||||||
|
return Ok(regions);
|
||||||
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid)
|
let handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid)
|
||||||
.context("Failed to open process")?;
|
.context("Failed to open process")?;
|
||||||
|
|||||||
Reference in New Issue
Block a user