File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -665,6 +665,11 @@ $code = @"
665665
666666 function Get-Exports ()
667667 {
668+
669+ if ($NTHeader.OptionalHeader.DataDirectory [0 ].VirtualAddress -eq 0 ) {
670+ Write-Verbose ' Module does not contain any exports'
671+ return
672+ }
668673
669674 # List all function Rvas in the export table
670675 $ExportPointer = [IntPtr ] ($PEBaseAddr.ToInt64 () + $NtHeader.OptionalHeader.DataDirectory [0 ].VirtualAddress)
@@ -759,6 +764,11 @@ $code = @"
759764
760765 function Get-Imports ()
761766 {
767+ if ($NTHeader.OptionalHeader.DataDirectory [1 ].VirtualAddress -eq 0 ) {
768+ Write-Verbose ' Module does not contain any imports'
769+ return
770+ }
771+
762772 $FirstImageImportDescriptorPtr = [IntPtr ] ($PEBaseAddr.ToInt64 () + $NtHeader.OptionalHeader.DataDirectory [1 ].VirtualAddress)
763773 if ($OnDisk ) { $FirstImageImportDescriptorPtr = Convert-RVAToFileOffset $FirstImageImportDescriptorPtr }
764774 $ImportDescriptorPtr = $FirstImageImportDescriptorPtr
You can’t perform that action at this time.
0 commit comments