Files

43 lines
2.0 KiB
C#
Raw Permalink Normal View History

2025-09-26 13:06:18 -04:00
namespace SabreTools.Data.Models.PortableExecutable.Export
2025-09-26 12:09:34 -04:00
{
/// <summary>
/// The export ordinal table is an array of 16-bit unbiased indexes into the export address table.
/// Ordinals are biased by the Ordinal Base field of the export directory table. In other words,
/// the ordinal base must be subtracted from the ordinals to obtain true indexes into the export
/// address table.
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// The export name pointer table and the export ordinal table form two parallel arrays that are
/// separated to allow natural field alignment. These two tables, in effect, operate as one table,
/// in which the Export Name Pointer column points to a public (exported) name and the Export
/// Ordinal column gives the corresponding ordinal for that public name. A member of the export
/// name pointer table and a member of the export ordinal table are associated by having the same
/// position (index) in their respective arrays.
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// Thus, when the export name pointer table is searched and a matching string is found at position
/// i, the algorithm for finding the symbol's RVA and biased ordinal is:
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// i = Search_ExportNamePointerTable(name);
/// ordinal = ExportOrdinalTable[i];
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// rva = ExportAddressTable[ordinal];
/// biased_ordinal = ordinal + OrdinalBase;
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// When searching for a symbol by(biased) ordinal, the algorithm for finding the symbol's RVA
/// and name is:
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// ordinal = biased_ordinal - OrdinalBase;
/// i = Search_ExportOrdinalTable(ordinal);
2025-10-30 23:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// rva = ExportAddressTable[ordinal];
/// name = ExportNameTable[i];
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public sealed class OrdinalTable
{
/// <summary>
/// An array of 16-bit unbiased indexes into the export address table
/// </summary>
public ushort[] Indexes { get; set; } = [];
2025-09-26 12:09:34 -04:00
}
}