Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/AlphaROM.cs

45 lines
1.5 KiB
C#
Raw Normal View History

2021-03-21 14:30:37 -07:00
using System.Collections.Generic;
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
{
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
{
2021-02-26 01:26:49 -08:00
/// <inheritdoc/>
2022-03-14 22:51:17 -07:00
public string CheckPEContents(string file, PortableExecutable pex, bool includeDebug)
{
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-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
}
}
}