mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-23 07:14:57 +00:00
Read table data directly
This commit is contained in:
@@ -138,6 +138,9 @@ namespace SabreTools.Serialization.Deserializers
|
||||
// Seek to the export table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the export table
|
||||
pex.ExportTable = ParseExportTable(data, initialOffset, pex.SectionTable);
|
||||
}
|
||||
@@ -162,6 +165,9 @@ namespace SabreTools.Serialization.Deserializers
|
||||
// Seek to the import table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the import table
|
||||
pex.ImportTable = ParseImportTable(data, initialOffset, optionalHeader.Magic, pex.SectionTable);
|
||||
}
|
||||
@@ -186,6 +192,9 @@ namespace SabreTools.Serialization.Deserializers
|
||||
// Seek to the resource directory table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the resource directory table
|
||||
long tableStart = data.Position;
|
||||
pex.ResourceDirectoryTable = ParseResourceDirectoryTable(data, initialOffset, tableStart, pex.SectionTable);
|
||||
@@ -242,7 +251,10 @@ namespace SabreTools.Serialization.Deserializers
|
||||
|
||||
// Seek to the attribute certificate table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
long endOffset = offset + optionalHeader.CertificateTable.Size;
|
||||
long endOffset = offset + tableSize;
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the attribute certificate table
|
||||
pex.AttributeCertificateTable = ParseAttributeCertificateTable(data, endOffset);
|
||||
@@ -267,7 +279,10 @@ namespace SabreTools.Serialization.Deserializers
|
||||
|
||||
// Seek to the base relocation table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
long endOffset = offset + optionalHeader.BaseRelocationTable.Size;
|
||||
long endOffset = offset + tableSize;
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the base relocation table
|
||||
pex.BaseRelocationTable = ParseBaseRelocationTable(data, endOffset);
|
||||
@@ -292,7 +307,10 @@ namespace SabreTools.Serialization.Deserializers
|
||||
|
||||
// Seek to the debug table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
long endOffset = offset + optionalHeader.Debug.Size;
|
||||
long endOffset = offset + tableSize;
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the debug table
|
||||
pex.DebugTable = ParseDebugTable(data, endOffset);
|
||||
@@ -324,6 +342,9 @@ namespace SabreTools.Serialization.Deserializers
|
||||
// Seek to the delay-load directory table
|
||||
data.Seek(offset, SeekOrigin.Begin);
|
||||
|
||||
// Read the table data for parsing
|
||||
byte[] tableData = data.ReadBytes(tableSize);
|
||||
|
||||
// Set the delay-load directory table
|
||||
pex.DelayLoadDirectoryTable = ParseDelayLoadDirectoryTable(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user