Identify and use .rsrc item for MediaMax

This commit is contained in:
Matt Nadareski
2021-09-10 22:02:57 -07:00
parent d87087dcfb
commit 7cdf6a8c79

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using BurnOutSharp.ExecutableType.Microsoft;
using BurnOutSharp.Matching;
using BurnOutSharp.Tools;
namespace BurnOutSharp.ProtectionType
{
@@ -17,6 +18,10 @@ namespace BurnOutSharp.ProtectionType
if (sections == null)
return null;
var resource = Utilities.FindResourceInSection(pex.ResourceSection, dataContains: "Cd3Ctl");
if (resource != null)
return $"MediaMax CD-3";
// Get the .rdata section, if it exists
var rdataSection = sections.FirstOrDefault(s => Encoding.ASCII.GetString(s.Name).StartsWith(".rdata"));
if (rdataSection != null)
@@ -40,26 +45,6 @@ namespace BurnOutSharp.ProtectionType
return match;
}
// TODO: Find this inside of the .rsrc section using the executable header
// Get the .rsrc section, if it exists
var rsrcSection = sections.FirstOrDefault(s => Encoding.ASCII.GetString(s.Name).StartsWith(".rsrc"));
if (rsrcSection != null)
{
int sectionAddr = (int)rsrcSection.PointerToRawData;
int sectionEnd = sectionAddr + (int)rsrcSection.VirtualSize;
var matchers = new List<ContentMatchSet>
{
// Cd3Ctl
new ContentMatchSet(
new ContentMatch(new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }, start: sectionAddr, end: sectionEnd),
"MediaMax CD-3"),
};
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;
}
// Get the .data section, if it exists
var dataSection = sections.FirstOrDefault(s => Encoding.ASCII.GetString(s.Name).StartsWith(".data"));
if (dataSection != null)