mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-08 18:06:34 +00:00
Partially revert and clarify
This commit is contained in:
@@ -23,16 +23,14 @@ namespace BinaryObjectScanner.Packer
|
||||
if (exe.ContainsSection("pec1", exact: true))
|
||||
return "PE Compact v1.x";
|
||||
|
||||
// TODO: The last 4 bytes of the PEC2 section name appear to be the version
|
||||
// For v2.20 - v3.02 this value is 0
|
||||
// For internal version v20240 this is [10 4F 00 00] (20240)
|
||||
// Get the .text section, if it exists
|
||||
var textSection = exe.GetFirstSection(".text", exact: true);
|
||||
|
||||
// Get the PEC2 section, if it exists
|
||||
var pec2Section = exe.GetFirstSection("PEC2", exact: false);
|
||||
if (pec2Section?.PointerToRelocations == 0x32434550)
|
||||
// Check for "PEC2" in the pointer to relocations
|
||||
if (textSection?.PointerToRelocations == 0x32434550)
|
||||
{
|
||||
if (pec2Section.PointerToLinenumbers != 0)
|
||||
return $"PE Compact v{pec2Section.PointerToLinenumbers} (internal version)";
|
||||
if (textSection.PointerToLinenumbers != 0)
|
||||
return $"PE Compact v{textSection.PointerToLinenumbers} (internal version)";
|
||||
|
||||
return "PE Compact v2.x (or newer)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user