mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-09 02:16:46 +00:00
Add resource finding on creation
This commit is contained in:
@@ -184,6 +184,60 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
|
||||
#endregion
|
||||
|
||||
#region Resources
|
||||
|
||||
/// <summary>
|
||||
/// Company name resource string
|
||||
/// </summary>
|
||||
public string CompanyName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// File description resource string
|
||||
/// </summary>
|
||||
public string FileDescription { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// File version resource string
|
||||
/// </summary>
|
||||
public string FileVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal name resource string
|
||||
/// </summary>
|
||||
public string InternalName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Legal copyright resource string
|
||||
/// </summary>
|
||||
public string LegalCopyright { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description manifest string
|
||||
/// </summary>
|
||||
public string ManifestDescription { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Version manifest string
|
||||
/// </summary>
|
||||
public string ManifestVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original filename resource string
|
||||
/// </summary>
|
||||
public string OriginalFileName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product name resource string
|
||||
/// </summary>
|
||||
public string ProductName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product version resource string
|
||||
/// </summary>
|
||||
public string ProductVersion { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -311,6 +365,9 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
this.TextSectionRaw = this.ReadRawSection(".text", force: true, first: false);
|
||||
|
||||
#endregion
|
||||
|
||||
// Populate resources, if possible
|
||||
PopulateResourceStrings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -418,6 +475,9 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
this.TextSectionRaw = this.ReadRawSection(".text", force: true, first: false);
|
||||
|
||||
#endregion
|
||||
|
||||
// Populate resources, if possible
|
||||
PopulateResourceStrings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -430,7 +490,6 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: This entire section needs to have caching
|
||||
#region Resource Helpers
|
||||
|
||||
/// <summary>
|
||||
@@ -448,127 +507,6 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
return FindResourceInTable(this.ResourceSection.ResourceDirectoryTable, dataStart, dataContains, dataEnd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the company name as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Company name string, null on error</returns>
|
||||
public string GetCompanyName() => GetResourceString("CompanyName");
|
||||
|
||||
/// <summary>
|
||||
/// Get the file description as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Description string, null on error</returns>
|
||||
public string GetFileDescription() => GetResourceString("FileDescription");
|
||||
|
||||
/// <summary>
|
||||
/// Get the file version as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>File version string, null on error</returns>
|
||||
public string GetFileVersion() => GetResourceString("FileVersion")?.Replace(", ", ".");
|
||||
|
||||
/// <summary>
|
||||
/// Get the internal name as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Internal name string, null on error</returns>
|
||||
public string GetInternalName() => GetResourceString("InternalName");
|
||||
|
||||
/// <summary>
|
||||
/// Get the legal copyright as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Legal copyright string, null on error</returns>
|
||||
public string GetLegalCopyright() => GetResourceString("LegalCopyright");
|
||||
|
||||
/// <summary>
|
||||
/// Get the assembly version as determined by an embedded assembly manifest
|
||||
/// </summary>
|
||||
/// <returns>Description string, null on error</returns>
|
||||
public string GetManifestDescription()
|
||||
{
|
||||
// If we don't have a complete PE executable, just return null
|
||||
if (this.ResourceSection == null)
|
||||
return null;
|
||||
|
||||
// Read in the manifest to a string
|
||||
string manifestString = FindAssemblyManifest();
|
||||
if (string.IsNullOrWhiteSpace(manifestString))
|
||||
return null;
|
||||
|
||||
// Try to read the XML in from the string
|
||||
try
|
||||
{
|
||||
// Try to read the assembly
|
||||
var assemblyNode = GetAssemblyNode(manifestString);
|
||||
if (assemblyNode == null)
|
||||
return null;
|
||||
|
||||
// Return the content of the description node, if possible
|
||||
var descriptionNode = assemblyNode["description"];
|
||||
if (descriptionNode == null)
|
||||
return null;
|
||||
|
||||
return descriptionNode.InnerXml;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the assembly version as determined by an embedded assembly manifest
|
||||
/// </summary>
|
||||
/// <returns>Version string, null on error</returns>
|
||||
public string GetManifestVersion()
|
||||
{
|
||||
// If we don't have a complete PE executable, just return null
|
||||
if (this.ResourceSection == null)
|
||||
return null;
|
||||
|
||||
// Read in the manifest to a string
|
||||
string manifestString = FindAssemblyManifest();
|
||||
if (string.IsNullOrWhiteSpace(manifestString))
|
||||
return null;
|
||||
|
||||
// Try to read the XML in from the string
|
||||
try
|
||||
{
|
||||
// Try to read the assembly
|
||||
var assemblyNode = GetAssemblyNode(manifestString);
|
||||
if (assemblyNode == null)
|
||||
return null;
|
||||
|
||||
// Try to read the assemblyIdentity
|
||||
var assemblyIdentityNode = assemblyNode["assemblyIdentity"];
|
||||
if (assemblyIdentityNode == null)
|
||||
return null;
|
||||
|
||||
// Return the version attribute, if possible
|
||||
return assemblyIdentityNode.GetAttribute("version");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the original filename as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Original filename string, null on error</returns>
|
||||
public string GetOriginalFileName() => GetResourceString("OriginalFileName");
|
||||
|
||||
/// <summary>
|
||||
/// Get the product name as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Product name string, null on error</returns>
|
||||
public string GetProductName() => GetResourceString("ProductName");
|
||||
|
||||
/// <summary>
|
||||
/// Get the product name as reported by the resources
|
||||
/// </summary>
|
||||
/// <returns>Product version string, null on error</returns>
|
||||
public string GetProductVersion() => GetResourceString("ProductVersion")?.Replace(", ", ".");
|
||||
|
||||
/// <summary>
|
||||
/// Get the assembly identity node from an embedded manifest
|
||||
/// </summary>
|
||||
@@ -663,6 +601,79 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the assembly version as determined by an embedded assembly manifest
|
||||
/// </summary>
|
||||
/// <returns>Description string, null on error</returns>
|
||||
private string GetManifestDescription()
|
||||
{
|
||||
// If we don't have a complete PE executable, just return null
|
||||
if (this.ResourceSection == null)
|
||||
return null;
|
||||
|
||||
// Read in the manifest to a string
|
||||
string manifestString = FindAssemblyManifest();
|
||||
if (string.IsNullOrWhiteSpace(manifestString))
|
||||
return null;
|
||||
|
||||
// Try to read the XML in from the string
|
||||
try
|
||||
{
|
||||
// Try to read the assembly
|
||||
var assemblyNode = GetAssemblyNode(manifestString);
|
||||
if (assemblyNode == null)
|
||||
return null;
|
||||
|
||||
// Return the content of the description node, if possible
|
||||
var descriptionNode = assemblyNode["description"];
|
||||
if (descriptionNode == null)
|
||||
return null;
|
||||
|
||||
return descriptionNode.InnerXml;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the assembly version as determined by an embedded assembly manifest
|
||||
/// </summary>
|
||||
/// <returns>Version string, null on error</returns>
|
||||
private string GetManifestVersion()
|
||||
{
|
||||
// If we don't have a complete PE executable, just return null
|
||||
if (this.ResourceSection == null)
|
||||
return null;
|
||||
|
||||
// Read in the manifest to a string
|
||||
string manifestString = FindAssemblyManifest();
|
||||
if (string.IsNullOrWhiteSpace(manifestString))
|
||||
return null;
|
||||
|
||||
// Try to read the XML in from the string
|
||||
try
|
||||
{
|
||||
// Try to read the assembly
|
||||
var assemblyNode = GetAssemblyNode(manifestString);
|
||||
if (assemblyNode == null)
|
||||
return null;
|
||||
|
||||
// Try to read the assemblyIdentity
|
||||
var assemblyIdentityNode = assemblyNode["assemblyIdentity"];
|
||||
if (assemblyIdentityNode == null)
|
||||
return null;
|
||||
|
||||
// Return the version attribute, if possible
|
||||
return assemblyIdentityNode.GetAttribute("version");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a resource string from the version info
|
||||
/// </summary>
|
||||
@@ -683,7 +694,6 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
/// <summary>
|
||||
/// Get the version info object related to file contents, if possible
|
||||
/// </summary>
|
||||
/// <param name="pex">PortableExecutable representing the file contents</param>
|
||||
/// <returns>VersionInfo object on success, null on error</returns>
|
||||
private VersionInfo GetVersionInfo()
|
||||
{
|
||||
@@ -708,6 +718,27 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate all resource strings
|
||||
/// </summary>
|
||||
private void PopulateResourceStrings()
|
||||
{
|
||||
// Standalone resource strings
|
||||
this.CompanyName = GetResourceString("CompanyName");
|
||||
this.FileDescription = GetResourceString("FileDescription");
|
||||
this.FileVersion = GetResourceString("FileVersion")?.Replace(", ", ".");
|
||||
this.InternalName = GetResourceString("InternalName");
|
||||
this.LegalCopyright = GetResourceString("LegalCopyright");
|
||||
this.OriginalFileName = GetResourceString("OriginalFileName");
|
||||
this.ProductName = GetResourceString("ProductName");
|
||||
this.ProductVersion = GetResourceString("ProductVersion")?.Replace(", ", ".");
|
||||
|
||||
// TODO: Make these combined calls more efficient
|
||||
// Manifest resource strings
|
||||
this.ManifestDescription = GetManifestDescription();
|
||||
this.ManifestVersion = GetManifestVersion();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Section Helpers
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BurnOutSharp.PackerType
|
||||
return null;
|
||||
|
||||
// Known to detect versions 5.0.0.3 - 8.1.0.0
|
||||
string name = pex.GetProductName();
|
||||
string name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("AutoPlay Media Studio", StringComparison.OrdinalIgnoreCase))
|
||||
return $"AutoPlay Media Studio {GetVersion(pex)}";
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace BurnOutSharp.PackerType
|
||||
private string GetVersion(PortableExecutable pex)
|
||||
{
|
||||
// Check the product version explicitly
|
||||
string version = pex.GetProductVersion();
|
||||
string version = pex.ProductVersion;
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
return version;
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace BurnOutSharp.PackerType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("InstallAnywhere Self Extractor", StringComparison.OrdinalIgnoreCase))
|
||||
return $"InstallAnywhere {GetVersion(pex)}";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("InstallAnywhere", StringComparison.OrdinalIgnoreCase))
|
||||
return $"InstallAnywhere {GetVersion(pex)}";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.PackerType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name)
|
||||
&& (name.Equals("Intel(R) Installation Framework", StringComparison.OrdinalIgnoreCase)
|
||||
|| name.Equals("Intel Installation Framework", StringComparison.OrdinalIgnoreCase)))
|
||||
@@ -23,7 +23,7 @@ namespace BurnOutSharp.PackerType
|
||||
return $"Intel Installation Framework {Utilities.GetInternalVersion(pex)}";
|
||||
}
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name)
|
||||
&& (name.Equals("Intel(R) Installation Framework", StringComparison.OrdinalIgnoreCase)
|
||||
|| name.Equals("Intel Installation Framework", StringComparison.OrdinalIgnoreCase)))
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace BurnOutSharp.PackerType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetInternalName();
|
||||
string name = pex.InternalName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("Wextract", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Microsoft CAB SFX {GetVersion(pex)}";
|
||||
|
||||
name = pex.GetOriginalFileName();
|
||||
name = pex.OriginalFileName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("WEXTRACT.EXE", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Microsoft CAB SFX {GetVersion(pex)}";
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BurnOutSharp.PackerType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string description = pex.GetManifestDescription();
|
||||
string description = pex.ManifestDescription;
|
||||
if (!string.IsNullOrWhiteSpace(description) && description.StartsWith("Nullsoft Install System"))
|
||||
return $"NSIS {description.Substring("Nullsoft Install System".Length).Trim()}";
|
||||
|
||||
|
||||
@@ -20,16 +20,16 @@ namespace BurnOutSharp.PackerType
|
||||
return null;
|
||||
|
||||
// Known to detect versions 7.0.5.1 - 9.1.0.0
|
||||
string name = pex.GetLegalCopyright();
|
||||
string name = pex.LegalCopyright;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Setup Engine", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Setup Factory {GetVersion(pex)}";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Setup Factory", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Setup Factory {GetVersion(pex)}";
|
||||
|
||||
// Known to detect version 5.0.1 - 6.0.1.3
|
||||
name = pex.GetFileDescription();
|
||||
name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Setup Factory", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Setup Factory {GetVersion(pex)}";
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BurnOutSharp.PackerType
|
||||
private string GetVersion(PortableExecutable pex)
|
||||
{
|
||||
// Check the product version explicitly
|
||||
string version = pex.GetProductVersion();
|
||||
string version = pex.ProductVersion;
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
return version;
|
||||
|
||||
|
||||
@@ -187,8 +187,8 @@ namespace BurnOutSharp.PackerType
|
||||
private static string GetAdjustedManifestVersion(PortableExecutable pex)
|
||||
{
|
||||
// Get the manifest information, if possible
|
||||
string description = pex.GetManifestDescription();
|
||||
string version = pex.GetManifestVersion();
|
||||
string description = pex.ManifestDescription;
|
||||
string version = pex.ManifestVersion;
|
||||
|
||||
// Either an incorrect description or empty version mean we can't match
|
||||
if (description != "WinZip Self-Extractor")
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetInternalName();
|
||||
string name = pex.InternalName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("CDKey", StringComparison.OrdinalIgnoreCase))
|
||||
return "CD-Key / Serial";
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("EReg MFC Application"))
|
||||
return $"EA CdKey Registration Module {Utilities.GetInternalVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.Contains("Registration code installer program"))
|
||||
@@ -30,7 +30,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.Equals("EA DRM Helper", StringComparison.OrdinalIgnoreCase))
|
||||
return $"EA DRM Protection {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
name = pex.GetInternalName();
|
||||
name = pex.InternalName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("CDCode", StringComparison.Ordinal))
|
||||
return $"EA CdKey Registration Module {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Games for Windows - LIVE Zero Day Piracy Protection", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Games for Windows LIVE - Zero Day Piracy Protection Module {Utilities.GetInternalVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Games for Windows", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -18,15 +18,15 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("ImpulseReactor Dynamic Link Library"))
|
||||
return $"Impulse Reactor Core Module {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("ImpulseReactor Dynamic Link Library"))
|
||||
return $"Impulse Reactor Core Module {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
name = pex.GetOriginalFileName();
|
||||
name = pex.OriginalFileName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("ReactorActivate.exe"))
|
||||
return $"Stardock Product Activation {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("SDKHM (KEEP)"))
|
||||
return "key2AudioXS";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.Contains("SDKHM (KEPT)"))
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
return null;
|
||||
|
||||
// TODO: Is this too broad in general?
|
||||
string name = pex.GetInternalName();
|
||||
string name = pex.InternalName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("EReg", StringComparison.OrdinalIgnoreCase))
|
||||
return $"Executable-Based Online Registration {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("Origin", StringComparison.OrdinalIgnoreCase))
|
||||
return "Origin";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("Origin", StringComparison.OrdinalIgnoreCase))
|
||||
return "Origin";
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("SafeCast2", StringComparison.OrdinalIgnoreCase))
|
||||
return $"SafeCast";
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("SecuROM PA"))
|
||||
return $"SecuROM PA v{Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("DVM Library", StringComparison.OrdinalIgnoreCase))
|
||||
return $"SolidShield {Utilities.GetInternalVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Solidshield Activation Library", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -28,7 +28,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Activation Manager", StringComparison.OrdinalIgnoreCase))
|
||||
return $"SolidShield Activation Manager Module {GetInternalVersion(pex)}";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Solidshield Activation Library", StringComparison.OrdinalIgnoreCase))
|
||||
return $"SolidShield Core.dll {Utilities.GetInternalVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Solidshield Library", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -190,7 +190,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
|
||||
private static string GetInternalVersion(PortableExecutable pex)
|
||||
{
|
||||
string companyName = pex.GetCompanyName()?.ToLowerInvariant();
|
||||
string companyName = pex.CompanyName?.ToLowerInvariant();
|
||||
if (!string.IsNullOrWhiteSpace(companyName) && (companyName.Contains("solidshield") || companyName.Contains("tages")))
|
||||
return Utilities.GetInternalVersion(pex);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BurnOutSharp.ExecutableType.Microsoft.PE;
|
||||
using BurnOutSharp.Matching;
|
||||
using BurnOutSharp.Tools;
|
||||
@@ -18,18 +17,18 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetLegalCopyright();
|
||||
string name = pex.LegalCopyright;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("Protection Technology")) // Protection Technology (StarForce)?
|
||||
return $"StarForce {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
name = pex.GetInternalName();
|
||||
name = pex.InternalName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Equals("CORE.EXE", StringComparison.Ordinal))
|
||||
return $"StarForce {Utilities.GetInternalVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.Equals("protect.exe", StringComparison.Ordinal))
|
||||
return $"StarForce {Utilities.GetInternalVersion(pex)}";
|
||||
|
||||
// TODO: Find what fvinfo field actually maps to this
|
||||
name = pex.GetFileDescription();
|
||||
name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.Contains("Protected Module"))
|
||||
return $"StarForce 5";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrEmpty(name) && name.Contains("Steam Autorun Setup"))
|
||||
return "Steam";
|
||||
else if (!string.IsNullOrEmpty(name) && name.Contains("Steam Client API"))
|
||||
@@ -26,7 +26,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
else if (!string.IsNullOrEmpty(name) && name.Contains("Steam Client Service"))
|
||||
return "Steam";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrEmpty(name) && name.Contains("Steam Autorun Setup"))
|
||||
return "Steam";
|
||||
else if (!string.IsNullOrEmpty(name) && name.Contains("Steam Client API"))
|
||||
|
||||
@@ -28,13 +28,13 @@ namespace BurnOutSharp.ProtectionType
|
||||
// - TagesClient.exe
|
||||
// - TagesClient.dat (Does not always exist)
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("TagesSetup", StringComparison.OrdinalIgnoreCase))
|
||||
return $"TAGES Driver Setup {GetVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Tagès activation client", StringComparison.OrdinalIgnoreCase))
|
||||
return $"TAGES Activation Client {GetVersion(pex)}";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Application TagesSetup", StringComparison.OrdinalIgnoreCase))
|
||||
return $"TAGES Driver Setup {GetVersion(pex)}";
|
||||
else if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("T@GES", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect Installer"))
|
||||
return "Uplay / Ubisoft Connect";
|
||||
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect Service"))
|
||||
@@ -33,7 +33,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
return "Uplay / Ubisoft Connect";
|
||||
|
||||
// There's also a variant that looks like "Uplay <version> installer"
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect"))
|
||||
return "Uplay / Ubisoft Connect";
|
||||
else if (!string.IsNullOrEmpty(name) && name.Contains("Uplay"))
|
||||
|
||||
@@ -15,11 +15,11 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
string name = pex.GetFileDescription();
|
||||
string name = pex.FileDescription;
|
||||
if (!string.IsNullOrEmpty(name) && name.Contains("Copy Protection Viewer"))
|
||||
return "WTM Protection Viewer";
|
||||
|
||||
name = pex.GetProductName();
|
||||
name = pex.ProductName;
|
||||
if (!string.IsNullOrEmpty(name) && name.Contains("WTM Copy Protection Viewer"))
|
||||
return "WTM Protection Viewer";
|
||||
|
||||
|
||||
@@ -4,11 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using BurnOutSharp.ExecutableType.Microsoft.PE;
|
||||
using BurnOutSharp.ExecutableType.Microsoft.PE.Entries;
|
||||
using BurnOutSharp.ExecutableType.Microsoft.PE.Sections;
|
||||
using BurnOutSharp.ExecutableType.Microsoft.PE.Tables;
|
||||
|
||||
namespace BurnOutSharp.Tools
|
||||
{
|
||||
@@ -202,15 +198,15 @@ namespace BurnOutSharp.Tools
|
||||
/// <returns>Version string, null on error</returns>
|
||||
public static string GetInternalVersion(PortableExecutable pex)
|
||||
{
|
||||
string version = pex.GetFileVersion();
|
||||
string version = pex.FileVersion;
|
||||
if (!string.IsNullOrWhiteSpace(version))
|
||||
return version;
|
||||
|
||||
version = pex.GetProductVersion();
|
||||
version = pex.ProductVersion;
|
||||
if (!string.IsNullOrWhiteSpace(version))
|
||||
return version;
|
||||
|
||||
version = pex.GetManifestVersion();
|
||||
version = pex.ManifestVersion;
|
||||
if (!string.IsNullOrWhiteSpace(version))
|
||||
return version;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user