Clean up most of the StarForce rsrc checks

This commit is contained in:
Matt Nadareski
2022-12-08 14:01:12 -08:00
parent 714cee586d
commit 3c750dac86
2 changed files with 12 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using BurnOutSharp.Interfaces;
using BurnOutSharp.Tools;
using BurnOutSharp.Wrappers;
@@ -18,7 +19,9 @@ namespace BurnOutSharp.ProtectionType
return null;
string name = pex.LegalCopyright;
if (name?.Contains("Protection Technology") == true) // Protection Technology (StarForce)?
if (name?.StartsWith("(c) Protection Technology") == true) // (c) Protection Technology (StarForce)?
return $"StarForce {Utilities.GetInternalVersion(pex)}";
else if (name?.Contains("Protection Technology") == true) // Protection Technology (StarForce)?
return $"StarForce {Utilities.GetInternalVersion(pex)}";
name = pex.InternalName;
@@ -27,6 +30,14 @@ namespace BurnOutSharp.ProtectionType
else if (name?.Equals("protect.exe", StringComparison.Ordinal) == true)
return $"StarForce {Utilities.GetInternalVersion(pex)}";
// Check the export name table
if (pex.ExportNameTable != null)
{
// TODO: Should we just check for "PSA_*" instead of a single entry?
if (pex.ExportNameTable.Any(s => s == "PSA_GetDiscLabel"))
return $"StarForce {Utilities.GetInternalVersion(pex)}";
}
// TODO: Find what fvinfo field actually maps to this
name = pex.FileDescription;
if (name?.Contains("Protected Module") == true)

View File

@@ -36,39 +36,6 @@ namespace BurnOutSharp.ProtectionType
0x64, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x65, 0x00
},
"StarForce 5 [**Protected Module**] (Unconfirmed - Please report to us on Github)"),
new ContentMatchSet(new List<ContentMatch>
{
// P + (char)0x00 + r + (char)0x00 + o + (char)0x00 + t + (char)0x00 + e + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + T + (char)0x00 + e + (char)0x00 + c + (char)0x00 + h + (char)0x00 + n + (char)0x00 + o + (char)0x00 + l + (char)0x00 + o + (char)0x00 + g + (char)0x00 + y + (char)0x00
new ContentMatch(new byte?[]
{
0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x74, 0x00,
0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00,
0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x54, 0x00,
0x65, 0x00, 0x63, 0x00, 0x68, 0x00, 0x6E, 0x00,
0x6F, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x67, 0x00,
0x79, 0x00
}),
// // PSA_GetDiscLabel
new ContentMatch(new byte?[]
{
0x50, 0x53, 0x41, 0x5F, 0x47, 0x65, 0x74, 0x44,
0x69, 0x73, 0x63, 0x4C, 0x61, 0x62, 0x65, 0x6C
}),
// (c) Protection Technology
new ContentMatch(new byte?[]
{
0x28, 0x63, 0x29, 0x20, 0x50, 0x72, 0x6F, 0x74,
0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54,
0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67,
0x79
}),
// TradeName
new ContentMatch(new byte?[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 }),
}, GetVersion, "StarForce [**Large Combined Check**] (Unconfirmed - Please report to us on Github)"),
};
string match = string.Join(", ", MatchUtil.GetAllMatches(file, rsrcSectionData, matchers, includeDebug));