Pre-read 3 most commonly-used section data

This also adds comprehensive notes around the sections used in various protections, how they're used, and what we can do with them. It also adds a couple of various notes based on the findings from the protection audit
This commit is contained in:
Matt Nadareski
2021-09-11 16:47:25 -07:00
parent bd9f583659
commit 214e8d41c7
28 changed files with 626 additions and 712 deletions

View File

@@ -1,7 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BurnOutSharp.ExecutableType.Microsoft;
using BurnOutSharp.Matching;
using BurnOutSharp.Tools;
@@ -22,48 +20,38 @@ namespace BurnOutSharp.ProtectionType
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)
// Get the .data section, if it exists
if (pex.DataSectionRaw != null)
{
int sectionAddr = (int)rdataSection.PointerToRawData;
int sectionEnd = sectionAddr + (int)rdataSection.VirtualSize;
var matchers = new List<ContentMatchSet>
{
// DllInstallSbcp
new ContentMatchSet(
new ContentMatch(new byte?[]
{
0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61,
0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70
}, start: sectionAddr, end: sectionEnd),
"MediaMax CD-3"),
// CD3 Launch Error
new ContentMatchSet(new byte?[]
{
0x43, 0x44, 0x33, 0x20, 0x4C, 0x61, 0x75, 0x6E,
0x63, 0x68, 0x20, 0x45, 0x72, 0x72, 0x6F, 0x72
}, "MediaMax CD-3"),
};
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
string match = MatchUtil.GetFirstMatch(file, pex.DataSectionRaw, 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)
// Get the .rdata section, if it exists
if (pex.ResourceDataSectionRaw != null)
{
int sectionAddr = (int)dataSection.PointerToRawData;
int sectionEnd = sectionAddr + (int)dataSection.VirtualSize;
var matchers = new List<ContentMatchSet>
{
// CD3 Launch Error
new ContentMatchSet(
new ContentMatch(new byte?[]
{
0x43, 0x44, 0x33, 0x20, 0x4C, 0x61, 0x75, 0x6E,
0x63, 0x68, 0x20, 0x45, 0x72, 0x72, 0x6F, 0x72
}, start: sectionAddr, end: sectionEnd),
"MediaMax CD-3"),
// DllInstallSbcp
new ContentMatchSet(new byte?[]
{
0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61,
0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70
}, "MediaMax CD-3"),
};
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
string match = MatchUtil.GetFirstMatch(file, pex.ResourceDataSectionRaw, matchers, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;
}