diff --git a/SabreTools.Serialization/Deserializers/PortableExecutable.cs b/SabreTools.Serialization/Deserializers/PortableExecutable.cs
index 873756f2..44b24ced 100644
--- a/SabreTools.Serialization/Deserializers/PortableExecutable.cs
+++ b/SabreTools.Serialization/Deserializers/PortableExecutable.cs
@@ -142,7 +142,7 @@ namespace SabreTools.Serialization.Deserializers
byte[] tableData = data.ReadBytes(tableSize);
// Set the export table
- pex.ExportTable = ParseExportTable(data, initialOffset, pex.SectionTable);
+ pex.ExportTable = ParseExportTable(tableData, data, initialOffset, pex.SectionTable);
}
}
@@ -169,7 +169,7 @@ namespace SabreTools.Serialization.Deserializers
byte[] tableData = data.ReadBytes(tableSize);
// Set the import table
- pex.ImportTable = ParseImportTable(data, initialOffset, optionalHeader.Magic, pex.SectionTable);
+ pex.ImportTable = ParseImportTable(tableData, data, initialOffset, optionalHeader.Magic, pex.SectionTable);
}
}
@@ -197,7 +197,7 @@ namespace SabreTools.Serialization.Deserializers
// Set the resource directory table
long tableStart = data.Position;
- pex.ResourceDirectoryTable = ParseResourceDirectoryTable(data, initialOffset, tableStart, pex.SectionTable);
+ pex.ResourceDirectoryTable = ParseResourceDirectoryTable(tableData, data, initialOffset, tableStart, pex.SectionTable);
#region Hidden Resources
@@ -257,7 +257,7 @@ namespace SabreTools.Serialization.Deserializers
byte[] tableData = data.ReadBytes(tableSize);
// Set the attribute certificate table
- pex.AttributeCertificateTable = ParseAttributeCertificateTable(data, endOffset);
+ pex.AttributeCertificateTable = ParseAttributeCertificateTable(tableData, data, endOffset);
}
}
@@ -285,7 +285,7 @@ namespace SabreTools.Serialization.Deserializers
byte[] tableData = data.ReadBytes(tableSize);
// Set the base relocation table
- pex.BaseRelocationTable = ParseBaseRelocationTable(data, endOffset);
+ pex.BaseRelocationTable = ParseBaseRelocationTable(tableData, data, endOffset);
}
}
@@ -313,7 +313,7 @@ namespace SabreTools.Serialization.Deserializers
byte[] tableData = data.ReadBytes(tableSize);
// Set the debug table
- pex.DebugTable = ParseDebugTable(data, endOffset);
+ pex.DebugTable = ParseDebugTable(tableData, data, endOffset);
}
}
@@ -346,7 +346,7 @@ namespace SabreTools.Serialization.Deserializers
byte[] tableData = data.ReadBytes(tableSize);
// Set the delay-load directory table
- pex.DelayLoadDirectoryTable = ParseDelayLoadDirectoryTable(data);
+ pex.DelayLoadDirectoryTable = ParseDelayLoadDirectoryTable(tableData, data);
}
}
@@ -367,10 +367,11 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into an attribute certificate table
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// First address not part of the attribute certificate table
/// Filled attribute certificate on success, null on error
- public static AttributeCertificateTableEntry[] ParseAttributeCertificateTable(Stream data, long endOffset)
+ public static AttributeCertificateTableEntry[] ParseAttributeCertificateTable(byte[] tableData, Stream data, long endOffset)
{
var obj = new List();
@@ -443,10 +444,11 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into a base relocation table
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// First address not part of the base relocation table
/// Filled base relocation table on success, null on error
- public static BaseRelocationBlock[] ParseBaseRelocationTable(Stream data, long endOffset)
+ public static BaseRelocationBlock[] ParseBaseRelocationTable(byte[] tableData, Stream data, long endOffset)
{
var obj = new List();
@@ -698,10 +700,11 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into a DebugTable
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// First address not part of the debug table
/// Filled DebugTable on success, null on error
- public static DebugTable ParseDebugTable(Stream data, long endOffset)
+ public static DebugTable ParseDebugTable(byte[] tableData, Stream data, long endOffset)
{
var obj = new DebugTable();
@@ -727,9 +730,10 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into a DelayLoadDirectoryTable
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// Filled DelayLoadDirectoryTable on success, null on error
- public static DelayLoadDirectoryTable ParseDelayLoadDirectoryTable(Stream data)
+ public static DelayLoadDirectoryTable ParseDelayLoadDirectoryTable(byte[] tableData, Stream data)
{
var obj = new DelayLoadDirectoryTable();
@@ -799,11 +803,12 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into a ExportTable
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// Initial offset to use in address comparisons
/// Section table to use for virtual address translation
/// Filled ExportTable on success, null on error
- public static ExportTable ParseExportTable(Stream data, long initialOffset, SectionHeader[] sections)
+ public static ExportTable ParseExportTable(byte[] tableData, Stream data, long initialOffset, SectionHeader[] sections)
{
var obj = new ExportTable();
@@ -1346,12 +1351,13 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into a import table
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// Initial offset to use in address comparisons
/// Optional header magic number indicating PE32 or PE32+
/// Section table to use for virtual address translation
/// Filled import table on success, null on error
- public static ImportTable ParseImportTable(Stream data, long initialOffset, OptionalHeaderMagicNumber magic, SectionHeader[] sections)
+ public static ImportTable ParseImportTable(byte[] tableData, Stream data, long initialOffset, OptionalHeaderMagicNumber magic, SectionHeader[] sections)
{
var obj = new ImportTable();
@@ -1588,12 +1594,14 @@ namespace SabreTools.Serialization.Deserializers
///
/// Parse a Stream into a ResourceDirectoryTable
///
- /// Stream to parse
+ /// Byte array representing the table data
+ /// Stream to use for additional parsing
/// Initial offset to use in address comparisons
/// Table start address for relative reads
/// Section table to use for virtual address translation
/// Filled ResourceDirectoryTable on success, null on error
- public static ResourceDirectoryTable? ParseResourceDirectoryTable(Stream data,
+ public static ResourceDirectoryTable? ParseResourceDirectoryTable(byte[] tableData,
+ Stream data,
long initialOffset,
long tableStart,
SectionHeader[] sections)
@@ -1641,7 +1649,7 @@ namespace SabreTools.Serialization.Deserializers
if (offset > tableStart && offset < data.Length)
{
data.Seek(offset, SeekOrigin.Begin);
- entry.Subdirectory = ParseResourceDirectoryTable(data, initialOffset, tableStart, sections);
+ entry.Subdirectory = ParseResourceDirectoryTable(tableData, data, initialOffset, tableStart, sections);
}
}
}