Fix PE delay-load directory

This commit is contained in:
Matt Nadareski
2022-11-09 22:02:38 -08:00
parent 95b5f12226
commit 0c6bf406c1
4 changed files with 35 additions and 58 deletions

View File

@@ -790,25 +790,20 @@ namespace ExecutableTest
Console.WriteLine(" -------------------------");
if (executable.OptionalHeader?.DelayImportDescriptor == null
|| executable.OptionalHeader.DelayImportDescriptor.VirtualAddress == 0
|| executable.DelayLoadDirectoryTable.Length == 0)
|| executable.DelayLoadDirectoryTable == null)
{
Console.WriteLine(" No delay-load directory table items");
}
else
{
for (int i = 0; i < executable.DelayLoadDirectoryTable.Length; i++)
{
var entry = executable.DelayLoadDirectoryTable[i];
Console.WriteLine($" Delay-Load Directory Table Entry {i}");
Console.WriteLine($" Attributes = {entry.Attributes}");
Console.WriteLine($" Name RVA = {entry.Name}");
Console.WriteLine($" Module handle = {entry.ModuleHandle}");
Console.WriteLine($" Delay import address table RVA = {entry.DelayImportAddressTable}");
Console.WriteLine($" Delay import name table RVA = {entry.DelayImportNameTable}");
Console.WriteLine($" Bound delay import table RVA = {entry.BoundDelayImportTable}");
Console.WriteLine($" Unload delay import table RVA = {entry.UnloadDelayImportTable}");
Console.WriteLine($" Timestamp = {entry.TimeStamp}");
}
Console.WriteLine($" Attributes = {executable.DelayLoadDirectoryTable.Attributes}");
Console.WriteLine($" Name RVA = {executable.DelayLoadDirectoryTable.Name}");
Console.WriteLine($" Module handle = {executable.DelayLoadDirectoryTable.ModuleHandle}");
Console.WriteLine($" Delay import address table RVA = {executable.DelayLoadDirectoryTable.DelayImportAddressTable}");
Console.WriteLine($" Delay import name table RVA = {executable.DelayLoadDirectoryTable.DelayImportNameTable}");
Console.WriteLine($" Bound delay import table RVA = {executable.DelayLoadDirectoryTable.BoundDelayImportTable}");
Console.WriteLine($" Unload delay import table RVA = {executable.DelayLoadDirectoryTable.UnloadDelayImportTable}");
Console.WriteLine($" Timestamp = {executable.DelayLoadDirectoryTable.TimeStamp}");
}
Console.WriteLine();