@@ -5,6 +5,7 @@ use std::cell::RefCell;
55use std:: collections:: BTreeMap ;
66use std:: error:: Error ;
77use std:: ops:: Deref ;
8+ use minidump:: format:: MemoryProtection ;
89
910use crate :: maps:: mem64:: { Mem64 , Permission } ;
1011use crate :: maps:: tlb:: TLB ;
@@ -15,6 +16,7 @@ use crate::serialization::maps::SerializableMaps;
1516use crate :: serialization:: pe32:: SerializablePE32 ;
1617use crate :: serialization:: pe64:: SerializablePE64 ;
1718
19+
1820pub struct MinidumpConverter ;
1921
2022impl MinidumpConverter {
@@ -91,13 +93,13 @@ impl MinidumpConverter {
9193 for info in memory_info. iter ( ) {
9294 let base_addr = info. raw . base_address ;
9395 let size = info. raw . region_size ;
94- let permission = match info. protection {
95- PAGE_NOACCESS => Permission :: NONE ,
96- PAGE_READWRITE = > Permission :: READ_WRITE ,
97- PAGE_READONLY = > Permission :: READ ,
98- PAGE_EXECUTE => Permission :: EXECUTE ,
99- PAGE_EXECUTE_READ => Permission :: READ_EXECUTE ,
100- PAGE_EXECUTE_READWRITE => Permission :: READ_WRITE_EXECUTE ,
96+ let permission = match info. protection . bits ( ) & MemoryProtection :: ACCESS_MASK . bits ( ) {
97+ x if x == MemoryProtection :: PAGE_NOACCESS . bits ( ) => Permission :: NONE ,
98+ x if x == MemoryProtection :: PAGE_READONLY . bits ( ) = > Permission :: READ ,
99+ x if x == MemoryProtection :: PAGE_READWRITE . bits ( ) = > Permission :: READ_WRITE ,
100+ x if x == MemoryProtection :: PAGE_EXECUTE . bits ( ) => Permission :: EXECUTE ,
101+ x if x == MemoryProtection :: PAGE_EXECUTE_READ . bits ( ) => Permission :: READ_EXECUTE ,
102+ x if x == MemoryProtection :: PAGE_EXECUTE_READWRITE . bits ( ) => Permission :: READ_WRITE_EXECUTE ,
101103 _ => Permission :: READ_WRITE_EXECUTE ,
102104 } ;
103105
0 commit comments