Fixed bug in executables with no imports/exports
I now check for the existance of imports/exports in the data directory.
This commit is contained in:
parent
65ebaea880
commit
f8a3a70291
|
|
@ -666,6 +666,11 @@ $code = @"
|
|||
function Get-Exports()
|
||||
{
|
||||
|
||||
if ($NTHeader.OptionalHeader.DataDirectory[0].VirtualAddress -eq 0) {
|
||||
Write-Verbose 'Module does not contain any exports'
|
||||
return
|
||||
}
|
||||
|
||||
# List all function Rvas in the export table
|
||||
$ExportPointer = [IntPtr] ($PEBaseAddr.ToInt64() + $NtHeader.OptionalHeader.DataDirectory[0].VirtualAddress)
|
||||
# This range will be used to test for the existence of forwarded functions
|
||||
|
|
@ -759,6 +764,11 @@ $code = @"
|
|||
|
||||
function Get-Imports()
|
||||
{
|
||||
if ($NTHeader.OptionalHeader.DataDirectory[1].VirtualAddress -eq 0) {
|
||||
Write-Verbose 'Module does not contain any imports'
|
||||
return
|
||||
}
|
||||
|
||||
$FirstImageImportDescriptorPtr = [IntPtr] ($PEBaseAddr.ToInt64() + $NtHeader.OptionalHeader.DataDirectory[1].VirtualAddress)
|
||||
if ($OnDisk) { $FirstImageImportDescriptorPtr = Convert-RVAToFileOffset $FirstImageImportDescriptorPtr }
|
||||
$ImportDescriptorPtr = $FirstImageImportDescriptorPtr
|
||||
|
|
|
|||
Loading…
Reference in New Issue