Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/ElectronicArts.cs

64 lines
2.7 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
2022-05-01 17:41:50 -07:00
using BurnOutSharp.Interfaces;
using BurnOutSharp.Wrappers;
2021-03-21 22:19:38 -07:00
namespace BurnOutSharp.ProtectionType
{
2022-05-01 17:17:15 -07:00
public class ElectronicArts : IPortableExecutableCheck
{
/// <inheritdoc/>
2022-05-01 17:17:15 -07:00
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
{
// Get the sections from the executable, if possible
var sections = pex?.SectionTable;
if (sections == null)
return null;
2022-04-02 16:12:23 -07:00
string name = pex.FileDescription;
if (name?.Contains("EReg MFC Application") == true)
2022-12-15 00:13:24 -08:00
return $"EA CdKey Registration Module {Tools.Utilities.GetInternalVersion(pex)}";
else if (name?.Contains("Registration code installer program") == true)
2022-12-15 00:13:24 -08:00
return $"EA CdKey Registration Module {Tools.Utilities.GetInternalVersion(pex)}";
else if (name?.Equals("EA DRM Helper", StringComparison.OrdinalIgnoreCase) == true)
2022-12-15 00:13:24 -08:00
return $"EA DRM Protection {Tools.Utilities.GetInternalVersion(pex)}";
2022-04-02 16:12:23 -07:00
name = pex.InternalName;
if (name?.Equals("CDCode", StringComparison.Ordinal) == true)
2022-12-15 00:13:24 -08:00
return $"EA CdKey Registration Module {Tools.Utilities.GetInternalVersion(pex)}";
if (pex.FindDialogByTitle("About CDKey").Any())
2022-12-15 00:13:24 -08:00
return $"EA CdKey Registration Module {Tools.Utilities.GetInternalVersion(pex)}";
2022-12-03 23:17:29 -08:00
else if (pex.FindGenericResource("About CDKey").Any())
2022-12-15 00:13:24 -08:00
return $"EA CdKey Registration Module {Tools.Utilities.GetInternalVersion(pex)}";
2021-09-10 21:52:31 -07:00
2022-12-09 14:21:18 -08:00
// Get the .data/DATA section strings, if they exist
List<string> strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA");
if (strs != null)
{
2022-12-09 14:21:18 -08:00
if (strs.Any(s => s.Contains("EReg Config Form")))
return "EA CdKey Registration Module";
}
2022-12-09 14:21:18 -08:00
// Get the .rdata section strings, if they exist
strs = pex.GetFirstSectionStrings(".rdata");
if (strs != null)
{
2022-12-09 14:21:18 -08:00
if (strs.Any(s => s.Contains("GenericEA")) && strs.Any(s => s.Contains("Activation")))
return "EA DRM Protection";
}
2022-12-09 14:21:18 -08:00
// Get the .rdata section strings, if they exist
strs = pex.GetFirstSectionStrings(".text");
if (strs != null)
{
2022-12-09 14:21:18 -08:00
if (strs.Any(s => s.Contains("GenericEA")) && strs.Any(s => s.Contains("Activation")))
return "EA DRM Protection";
}
return null;
}
}
}