@@ -7,7 +7,6 @@ use goblin::pe::{
77 data_directories:: DataDirectory , options:: ParseOptions ,
88 section_table:: SectionTable ,
99} ;
10- use memmap2:: Mmap ;
1110use scroll:: Pread ;
1211use serde:: { Deserialize , Serialize } ;
1312use std:: fmt;
@@ -327,7 +326,7 @@ pub struct CheckSecResults {
327326}
328327impl CheckSecResults {
329328 #[ must_use]
330- pub fn parse ( pe : & PE , buffer : & Mmap ) -> Self {
329+ pub fn parse ( pe : & PE , buffer : & [ u8 ] ) -> Self {
331330 Self {
332331 aslr : pe. has_aslr ( ) ,
333332 authenticode : pe. has_authenticode ( buffer) ,
@@ -446,7 +445,7 @@ pub trait Properties {
446445 /// [`memmap2::Mmap`](https://docs.rs/memmap2/0.5.7/memmap2/struct.Mmap.html)
447446 /// of the original file to read & parse required information from the
448447 /// underlying binary file
449- fn has_authenticode ( & self , mem : & memmap2 :: Mmap ) -> bool ;
448+ fn has_authenticode ( & self , bytes : & [ u8 ] ) -> bool ;
450449 /// check for `IMAGE_DLLCHARACTERISTICS_GUARD_CF` *(0x4000)* in
451450 /// `DllCharacteristics` within the `IMAGE_OPTIONAL_HEADER32/64`
452451 fn has_cfg ( & self ) -> bool ;
@@ -470,7 +469,7 @@ pub trait Properties {
470469 /// [`memmap2::Mmap`](https://docs.rs/memmap2/0.5.7/memmap2/struct.Mmap.html)
471470 /// of the original file to read & parse required information from the
472471 /// underlying binary file
473- fn has_gs ( & self , mem : & memmap2 :: Mmap ) -> bool ;
472+ fn has_gs ( & self , bytes : & [ u8 ] ) -> bool ;
474473 /// check for `IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA` *(`0x0020`)* in
475474 /// `DllCharacteristics` within the `IMAGE_OPTIONAL_HEADER32/64`
476475 fn has_high_entropy_va ( & self ) -> bool ;
@@ -486,15 +485,15 @@ pub trait Properties {
486485 /// [`memmap2::Mmap`](https://docs.rs/memmap2/0.5.7/memmap2/struct.Mmap.html)
487486 /// of the original file to read & parse required information from the
488487 /// underlying binary file
489- fn has_rfg ( & self , mem : & memmap2 :: Mmap ) -> bool ;
488+ fn has_rfg ( & self , bytes : & [ u8 ] ) -> bool ;
490489 /// check `shandler_count` from `LOAD_CONFIG` in `IMAGE_DATA_DIRECTORY`
491490 /// linked from the the `IMAGE_OPTIONAL_HEADER32/64`
492491 ///
493492 /// requires a
494493 /// [`memmap2::Mmap`](https://docs.rs/memmap2/0.5.7/memmap2/struct.Mmap.html)
495494 /// of the original file to read and parse required information from the
496495 /// underlying binary file
497- fn has_safe_seh ( & self , mem : & memmap2 :: Mmap ) -> bool ;
496+ fn has_safe_seh ( & self , bytes : & [ u8 ] ) -> bool ;
498497 /// check `IMAGE_DLLCHARACTERISTICS_NO_SEH` from the
499498 /// `IMAGE_OPTIONAL_HEADER32/64`
500499 fn has_seh ( & self ) -> bool ;
@@ -508,7 +507,7 @@ impl Properties for PE<'_> {
508507 }
509508 ASLR :: None
510509 }
511- fn has_authenticode ( & self , mem : & memmap2 :: Mmap ) -> bool {
510+ fn has_authenticode ( & self , bytes : & [ u8 ] ) -> bool {
512511 // requires running platform to be Windows for verification
513512 // just check for existence right now
514513 if let Some ( optional_header) = self . header . optional_header {
@@ -518,7 +517,7 @@ impl Properties for PE<'_> {
518517 optional_header. data_directories . get_load_config_table ( )
519518 {
520519 if let Ok ( load_config_val) = get_load_config_val (
521- mem ,
520+ bytes ,
522521 * load_config_hdr,
523522 sections,
524523 file_alignment,
@@ -591,15 +590,15 @@ impl Properties for PE<'_> {
591590 }
592591 false
593592 }
594- fn has_gs ( & self , mem : & memmap2 :: Mmap ) -> bool {
593+ fn has_gs ( & self , bytes : & [ u8 ] ) -> bool {
595594 if let Some ( optional_header) = self . header . optional_header {
596595 let file_alignment = optional_header. windows_fields . file_alignment ;
597596 let sections = & self . sections ;
598597 if let Some ( load_config_hdr) =
599598 optional_header. data_directories . get_load_config_table ( )
600599 {
601600 if let Ok ( load_config_val) = get_load_config_val (
602- mem ,
601+ bytes ,
603602 * load_config_hdr,
604603 sections,
605604 file_alignment,
@@ -632,15 +631,15 @@ impl Properties for PE<'_> {
632631 }
633632 false
634633 }
635- fn has_rfg ( & self , mem : & memmap2 :: Mmap ) -> bool {
634+ fn has_rfg ( & self , bytes : & [ u8 ] ) -> bool {
636635 if let Some ( optional_header) = self . header . optional_header {
637636 let file_alignment = optional_header. windows_fields . file_alignment ;
638637 let sections = & self . sections ;
639638 if let Some ( load_config_hdr) =
640639 optional_header. data_directories . get_load_config_table ( )
641640 {
642641 if let Ok ( load_config_val) = get_load_config_val (
643- mem ,
642+ bytes ,
644643 * load_config_hdr,
645644 sections,
646645 file_alignment,
@@ -657,15 +656,15 @@ impl Properties for PE<'_> {
657656 }
658657 false
659658 }
660- fn has_safe_seh ( & self , mem : & memmap2 :: Mmap ) -> bool {
659+ fn has_safe_seh ( & self , bytes : & [ u8 ] ) -> bool {
661660 if let Some ( optional_header) = self . header . optional_header {
662661 let file_alignment = optional_header. windows_fields . file_alignment ;
663662 let sections = & self . sections ;
664663 if let Some ( load_config_hdr) =
665664 optional_header. data_directories . get_load_config_table ( )
666665 {
667666 if let Ok ( load_config_val) = get_load_config_val (
668- mem ,
667+ bytes ,
669668 * load_config_hdr,
670669 sections,
671670 file_alignment,
0 commit comments