2021-03-21 14:30:37 -07:00
|
|
|
|
using System.Collections.Generic;
|
2022-03-14 10:40:44 -07:00
|
|
|
|
using BurnOutSharp.ExecutableType.Microsoft.PE;
|
2021-03-21 15:34:19 -07:00
|
|
|
|
using BurnOutSharp.Matching;
|
2021-03-21 14:30:37 -07:00
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.ProtectionType
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-10-20 21:06:43 -07:00
|
|
|
|
// TODO: Alternative string possibilities:
|
|
|
|
|
|
// - \AlphaDiscLog.txt
|
|
|
|
|
|
// - \SETTEC
|
|
|
|
|
|
// - AlphaROM
|
|
|
|
|
|
// - SETTEC0000SETTEC1111
|
|
|
|
|
|
// - SOFTWARE\SETTEC
|
|
|
|
|
|
// TODO: Are there version numbers?
|
2022-03-14 11:20:11 -07:00
|
|
|
|
public class AlphaROM : IPEContentCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-02-26 01:26:49 -08:00
|
|
|
|
/// <inheritdoc/>
|
2022-03-14 11:20:11 -07:00
|
|
|
|
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-10-20 21:06:43 -07:00
|
|
|
|
// Get the sections from the executable, if possible
|
|
|
|
|
|
var sections = pex?.SectionTable;
|
|
|
|
|
|
if (sections == null)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
// Get the .data section, if it exists
|
|
|
|
|
|
if (pex.DataSectionRaw != null)
|
2021-07-17 23:40:16 -07:00
|
|
|
|
{
|
2021-10-20 21:06:43 -07:00
|
|
|
|
var matchers = new List<ContentMatchSet>
|
|
|
|
|
|
{
|
2021-10-29 15:19:50 -07:00
|
|
|
|
// \SETTEC
|
|
|
|
|
|
new ContentMatchSet(new byte?[] { 0x5C, 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }, "Alpha-ROM"),
|
|
|
|
|
|
|
|
|
|
|
|
// SETTEC0000
|
|
|
|
|
|
new ContentMatchSet(new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43, 0x30, 0x30, 0x30, 0x30 }, "Alpha-ROM"),
|
2021-10-20 21:06:43 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
string match = MatchUtil.GetFirstMatch(file, pex.DataSectionRaw, matchers, includeDebug);
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(match))
|
|
|
|
|
|
return match;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
2021-09-10 15:32:37 -07:00
|
|
|
|
}
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|