Files
SabreTools.Models/PortableExecutable/ImportTable.cs

62 lines
2.1 KiB
C#
Raw Normal View History

2023-09-04 00:11:04 -04:00
using System.Collections.Generic;
2023-09-04 00:12:49 -04:00
namespace SabreTools.Models.PortableExecutable
2023-09-04 00:11:04 -04:00
{
/// <summary>
/// All image files that import symbols, including virtually all executable (EXE) files,
/// have an .idata section. A typical file layout for the import information follows:
///
/// - Directory Table
/// Null Directory Entry
/// - DLL1 Import Lookup Table
/// Null
/// - DLL2 Import Lookup Table
/// Null
/// - DLL3 Import Lookup Table
/// Null
/// - Hint-Name Table
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public sealed class ImportTable
{
/// <summary>
/// The import information begins with the import directory table, which describes the
/// remainder of the import information.
/// </summary>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-10 21:24:10 -04:00
public ImportDirectoryTableEntry[] ImportDirectoryTable { get; set; }
2023-09-04 21:14:41 -04:00
#else
2023-09-10 21:24:10 -04:00
public ImportDirectoryTableEntry?[]? ImportDirectoryTable { get; set; }
2023-09-04 21:14:41 -04:00
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// An import lookup table is an array of 32-bit numbers for PE32 or an array of 64-bit
/// numbers for PE32+.
/// </summary>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-10 21:24:10 -04:00
public Dictionary<int, ImportLookupTableEntry[]> ImportLookupTables { get; set; }
2023-09-04 21:14:41 -04:00
#else
2023-09-10 21:24:10 -04:00
public Dictionary<int, ImportLookupTableEntry?[]?>? ImportLookupTables { get; set; }
2023-09-04 21:14:41 -04:00
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// These addresses are the actual memory addresses of the symbols, although technically
/// they are still called "virtual addresses".
/// </summary>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-10 21:24:10 -04:00
public Dictionary<int, ImportAddressTableEntry[]> ImportAddressTables { get; set; }
2023-09-04 21:14:41 -04:00
#else
2023-09-10 21:24:10 -04:00
public Dictionary<int, ImportAddressTableEntry?[]?>? ImportAddressTables { get; set; }
2023-09-04 21:14:41 -04:00
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// One hint/name table suffices for the entire import section.
/// </summary>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-10 21:24:10 -04:00
public HintNameTableEntry[] HintNameTable { get; set; }
2023-09-04 21:14:41 -04:00
#else
2023-09-10 21:24:10 -04:00
public HintNameTableEntry?[]? HintNameTable { get; set; }
2023-09-04 21:14:41 -04:00
#endif
2023-09-04 00:11:04 -04:00
}
}