mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-08 18:06:34 +00:00
Lists lead to less Linq
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Compression.zlib;
|
||||
using SabreTools.Matching;
|
||||
@@ -24,7 +23,7 @@ namespace BinaryObjectScanner.Packer
|
||||
return null;
|
||||
|
||||
// If there are exactly 2 resources with type 99
|
||||
if (pex.FindResourceByNamedType("99, ").Count() == 2)
|
||||
if (pex.FindResourceByNamedType("99, ").Count == 2)
|
||||
return "CExe";
|
||||
|
||||
if (pex.StubExecutableData != null)
|
||||
@@ -55,13 +54,18 @@ namespace BinaryObjectScanner.Packer
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get all resources of type 99 with index 2
|
||||
var resources = pex.FindResourceByNamedType("99, 2");
|
||||
if (resources == null || resources.Count == 0)
|
||||
return false;
|
||||
|
||||
// Get the first resource of type 99 with index 2
|
||||
var payload = pex.FindResourceByNamedType("99, 2").FirstOrDefault();
|
||||
var payload = resources[0];
|
||||
if (payload == null || payload.Length == 0)
|
||||
return false;
|
||||
|
||||
// Determine which compression was used
|
||||
bool zlib = pex.FindResourceByNamedType("99, 1").Any();
|
||||
bool zlib = pex.FindResourceByNamedType("99, 1").Count > 0;
|
||||
|
||||
// Create the output data buffer
|
||||
var data = new byte[0];
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace BinaryObjectScanner.Packer
|
||||
return false;
|
||||
|
||||
// Get the resources that have a PKZIP signature
|
||||
var resources = pex.ResourceData
|
||||
.Where(kvp => kvp.Value != null && kvp.Value is byte[])
|
||||
.Select(kvp => kvp.Value as byte[])
|
||||
var resources = pex.ResourceData.Values
|
||||
.Where(v => v != null && v is byte[])
|
||||
.Select(v => v as byte[])
|
||||
.Where(b => b != null && b.StartsWith(SabreTools.Models.PKZIP.Constants.LocalFileHeaderSignatureBytes))
|
||||
.ToList();
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace BinaryObjectScanner.Packer
|
||||
return false;
|
||||
|
||||
// Get the resources that have an executable signature
|
||||
var resources = pex.ResourceData
|
||||
.Where(kvp => kvp.Value != null && kvp.Value is byte[])
|
||||
.Select(kvp => kvp.Value as byte[])
|
||||
var resources = pex.ResourceData.Values
|
||||
.Where(v => v != null && v is byte[])
|
||||
.Select(v => v as byte[])
|
||||
.Where(b => b != null && b.StartsWith(SabreTools.Models.MSDOS.Constants.SignatureBytes))
|
||||
.ToList();
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
@@ -37,7 +36,7 @@ namespace BinaryObjectScanner.Packer
|
||||
return "7-Zip SFX";
|
||||
|
||||
// If any dialog boxes match
|
||||
if (pex.FindDialogByTitle("7-Zip self-extracting archive").Any())
|
||||
if (pex.FindDialogByTitle("7-Zip self-extracting archive").Count > 0)
|
||||
return "7-Zip SFX";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
@@ -18,8 +17,7 @@ namespace BinaryObjectScanner.Packer
|
||||
if (name?.Contains("WinRAR archiver") == true)
|
||||
return "WinRAR SFX";
|
||||
|
||||
var resources = pex.FindDialogByTitle("WinRAR self-extracting archive");
|
||||
if (resources.Any())
|
||||
if (pex.FindDialogByTitle("WinRAR self-extracting archive").Count > 0)
|
||||
return "WinRAR SFX";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Text;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
@@ -14,13 +14,15 @@ namespace BinaryObjectScanner.Packer
|
||||
if (nex.Model.ResidentNameTable == null)
|
||||
return null;
|
||||
|
||||
// Get the resident and non-resident name table strings
|
||||
var rntStrs = Array.ConvertAll(nex.Model.ResidentNameTable,
|
||||
rnte => rnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(rnte.NameString));
|
||||
var nrntStrs = Array.ConvertAll(nex.Model.NonResidentNameTable ?? [],
|
||||
nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString));
|
||||
|
||||
// Check for the WinZip name strings
|
||||
bool winZipNameFound = nex.Model.ResidentNameTable
|
||||
.Select(rnte => rnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(rnte.NameString))
|
||||
.Any(s => s.Contains("WZ-SE-01"));
|
||||
winZipNameFound |= nex.Model.NonResidentNameTable?
|
||||
.Select(nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString))
|
||||
.Any(s => s.Contains("WinZip(R) Self-Extractor")) ?? false;
|
||||
bool winZipNameFound = Array.Exists(rntStrs, s => s.Contains("WZ-SE-01"));
|
||||
winZipNameFound |= Array.Exists(nrntStrs, s => s.Contains("WinZip(R) Self-Extractor"));
|
||||
|
||||
// If we didn't find it
|
||||
if (!winZipNameFound)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -79,11 +78,11 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// Get "REGISTRY, AMINTERNETPROTOCOL" resource items
|
||||
var resources = pex.FindResourceByNamedType("REGISTRY, AMINTERNETPROTOCOL");
|
||||
if (resources.Any())
|
||||
if (resources.Count > 0)
|
||||
{
|
||||
bool match = resources
|
||||
.Select(r => r == null ? string.Empty : Encoding.ASCII.GetString(r))
|
||||
.Any(r => r.Contains("ActiveMARK"));
|
||||
.ConvertAll(r => r == null ? string.Empty : Encoding.ASCII.GetString(r))
|
||||
.FindIndex(r => r.Contains("ActiveMARK")) > -1;
|
||||
if (match)
|
||||
return "ActiveMARK";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Content;
|
||||
@@ -41,7 +40,7 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// Get string table resources
|
||||
var resource = pex.FindStringTableByEntry("AegiSoft License Manager");
|
||||
if (resource.Any())
|
||||
if (resource.Count > 0)
|
||||
return "AegiSoft License Manager";
|
||||
|
||||
// Get the .data/DATA section, if it exists
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
@@ -74,20 +73,17 @@ namespace BinaryObjectScanner.Protection
|
||||
return "ByteShield Component Module";
|
||||
|
||||
// Found in "LineRider2.exe" in Redump entry 6236
|
||||
var stMatch = pex.FindStringTableByEntry("ByteShield");
|
||||
if (stMatch.Any())
|
||||
if (pex.FindStringTableByEntry("ByteShield").Count > 0)
|
||||
return $"ByteShield Activation Client {pex.GetInternalVersion()}";
|
||||
|
||||
// Found in "LineRider2.exe" in Redump entry 6236
|
||||
var dbMatch = pex.FindDialogByTitle("About ByteShield");
|
||||
if (dbMatch.Any())
|
||||
if (pex.FindDialogByTitle("About ByteShield").Count > 0)
|
||||
return "ByteShield";
|
||||
|
||||
// TODO: See if the version number is anywhere else
|
||||
// TODO: Parse the version number out of the dialog box item
|
||||
// Found in "LineRider2.exe" in Redump entry 6236
|
||||
dbMatch = pex.FindDialogBoxByItemTitle("ByteShield Version 1.0");
|
||||
if (dbMatch.Any())
|
||||
if (pex.FindDialogBoxByItemTitle("ByteShield Version 1.0").Count > 0)
|
||||
return "ByteShield";
|
||||
|
||||
// Get the .data/DATA section strings, if they exist
|
||||
|
||||
@@ -122,19 +122,18 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// Check the imported-name table
|
||||
// Found in "h3blade.exe" in Redump entry 85077.
|
||||
bool importedNameTableEntries = nex.Model.ImportedNameTable?
|
||||
.Select(kvp => kvp.Value)
|
||||
bool intMatch = nex.Model.ImportedNameTable?.Values?
|
||||
.Select(inte => inte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(inte.NameString))
|
||||
.Any(s => s.Contains("CDCOPS")) ?? false;
|
||||
if (importedNameTableEntries)
|
||||
if (intMatch)
|
||||
return "CD-Cops";
|
||||
|
||||
// Check the nonresident-name table
|
||||
// Found in "CDCOPS.DLL" in Redump entry 85077.
|
||||
bool nonresidentNameTableEntries = nex.Model.NonResidentNameTable?
|
||||
bool nrntMatch = nex.Model.NonResidentNameTable?
|
||||
.Select(nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString))
|
||||
.Any(s => s.Contains("CDcops assembly-language DLL")) ?? false;
|
||||
if (nonresidentNameTableEntries)
|
||||
if (nrntMatch)
|
||||
return "CD-Cops";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -111,17 +111,17 @@ namespace BinaryObjectScanner.Protection
|
||||
List<string>? lightFiles = null;
|
||||
|
||||
// TODO: Compensate for the check being run a directory or more higher
|
||||
var fileList = files.Where(f => !f.EndsWith(".x64", StringComparison.OrdinalIgnoreCase));
|
||||
var fileList = files.FindAll(f => !f.EndsWith(".x64", StringComparison.OrdinalIgnoreCase));
|
||||
foreach (var dir in dirs)
|
||||
{
|
||||
lightFiles = fileList.Where(f =>
|
||||
lightFiles = fileList.FindAll(f =>
|
||||
{
|
||||
f = f.Remove(0, path.Length);
|
||||
f = f.TrimStart('/', '\\');
|
||||
return f.StartsWith(dir + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase);
|
||||
})
|
||||
.OrderBy(f => f)
|
||||
.ToList();
|
||||
});
|
||||
lightFiles.Sort();
|
||||
|
||||
if (lightFiles.Count > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
|
||||
namespace BinaryObjectScanner.Protection
|
||||
@@ -17,8 +16,8 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
if (Directory.Exists(Path.Combine(path, "VIDEO_TS")))
|
||||
{
|
||||
string[] bupfiles = files.Where(s => s.EndsWith(".bup")).ToArray();
|
||||
for (int i = 0; i < bupfiles.Length; i++)
|
||||
var bupfiles = files.FindAll(s => s.EndsWith(".bup"));
|
||||
for (int i = 0; i < bupfiles.Count; i++)
|
||||
{
|
||||
var bupfile = new FileInfo(bupfiles[i]);
|
||||
if (bupfile.DirectoryName == null)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Content;
|
||||
@@ -66,11 +65,14 @@ namespace BinaryObjectScanner.Protection
|
||||
return "DiscGuard";
|
||||
|
||||
// Found in "Alternate.exe" (Redump entry 31914) and "Alt.exe" (Redump entries 46743, 46961, 79284, and 79374).
|
||||
var resources = pex.FindStringTableByEntry("DiscGuard")
|
||||
.Concat(pex.FindStringTableByEntry("The file Dg.vbn was not found."))
|
||||
.Concat(pex.FindStringTableByEntry("The file IosLink.VxD was not found."))
|
||||
.Concat(pex.FindStringTableByEntry("The file IosLink.sys was not found."));
|
||||
if (resources.Any())
|
||||
List<Dictionary<int, string?>?> resources =
|
||||
[
|
||||
.. pex.FindStringTableByEntry("DiscGuard"),
|
||||
.. pex.FindStringTableByEntry("The file Dg.vbn was not found."),
|
||||
.. pex.FindStringTableByEntry("The file IosLink.VxD was not found."),
|
||||
.. pex.FindStringTableByEntry("The file IosLink.sys was not found."),
|
||||
];
|
||||
if (resources.Count > 0)
|
||||
return "DiscGuard";
|
||||
|
||||
// Get the .vbn section, if it exists
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
@@ -27,9 +26,9 @@ namespace BinaryObjectScanner.Protection
|
||||
if (name?.Equals("CDCode", StringComparison.Ordinal) == true)
|
||||
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
||||
|
||||
if (pex.FindDialogByTitle("About CDKey").Any())
|
||||
if (pex.FindDialogByTitle("About CDKey").Count > 0)
|
||||
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
||||
else if (pex.FindGenericResource("About CDKey").Any())
|
||||
else if (pex.FindGenericResource("About CDKey").Count > 0)
|
||||
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
||||
|
||||
// Get the .data/DATA section strings, if they exist
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
namespace BinaryObjectScanner.Protection
|
||||
@@ -30,8 +29,7 @@ namespace BinaryObjectScanner.Protection
|
||||
if (sections == null)
|
||||
return null;
|
||||
|
||||
var fileNameResource = pex.FindGenericResource("NO NESTED PRMS SUPPORTED");
|
||||
if (fileNameResource.Any())
|
||||
if (pex.FindGenericResource("NO NESTED PRMS SUPPORTED").Count > 0)
|
||||
return "INTENIUM Trial & Buy Protection";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
@@ -22,13 +21,11 @@ namespace BinaryObjectScanner.Protection
|
||||
return $"MGI Registration {pex.GetInternalVersion()}";
|
||||
|
||||
// Found in "Register.dll" from "VideoWaveIII" in IA item "mgi-videowave-iii-version-3.00-mgi-software-2000".
|
||||
var resources = pex.FindStringTableByEntry("MGI Registration");
|
||||
if (resources.Any())
|
||||
if (pex.FindStringTableByEntry("MGI Registration").Count > 0)
|
||||
return "MGI Registration";
|
||||
|
||||
// Found in "Register.dll" in IA item "MGIPhotoSuite4.0AndPhotoVista2.02001".
|
||||
resources = pex.FindStringTableByEntry("Register@register.mgisoft.com");
|
||||
if (resources.Any())
|
||||
if (pex.FindStringTableByEntry("Register@register.mgisoft.com").Count > 0)
|
||||
return "MGI Registration";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
@@ -101,36 +100,21 @@ namespace BinaryObjectScanner.Protection
|
||||
return $"C-Dilla License Management System Version {pex.ProductVersion}";
|
||||
|
||||
// Get string table resources
|
||||
var resource = pex.FindStringTableByEntry("C-Dilla Licence Management System");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("C-Dilla Licence Management System").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("C-DiIla Licence Management System");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("C-DiIla Licence Management System").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("C-DILLA_BITMAP_NAMES_TAG");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("C-DILLA_BITMAP_NAMES_TAG").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("C-DILLA_EDITABLE_STRINGS_TAG");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("C-DILLA_EDITABLE_STRINGS_TAG").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("CdaLMS.exe");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("CdaLMS.exe").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("cdilla51.dll");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("cdilla51.dll").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("cdilla52.dll");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("cdilla52.dll").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
resource = pex.FindStringTableByEntry("http://www.c-dilla.com/support/lms.html");
|
||||
if (resource.Any())
|
||||
if (pex.FindStringTableByEntry("http://www.c-dilla.com/support/lms.html").Count > 0)
|
||||
return $"C-Dilla License Management System";
|
||||
|
||||
// Get the .data/DATA section strings, if they exist
|
||||
|
||||
@@ -44,15 +44,13 @@ namespace BinaryObjectScanner.Protection
|
||||
{
|
||||
if (strs.Exists(s => s.Contains("\\*.CDS")))
|
||||
return "Cactus Data Shield 200";
|
||||
|
||||
if (strs.Exists(s => s.Contains("DATA.CDS")))
|
||||
return "Cactus Data Shield 200";
|
||||
}
|
||||
|
||||
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
|
||||
// Modified version of the PlayJ Music Player specificaly for CDS, as indicated by the About page present when running the executable.
|
||||
var resources = pex.FindGenericResource("CactusPJ");
|
||||
if (resources != null && resources.Any())
|
||||
if (pex.FindGenericResource("CactusPJ").Count > 0)
|
||||
return "PlayJ Music Player (Cactus Data Shield 200)";
|
||||
|
||||
// Found in various files in "Les Paul & Friends" (Barcode 4 98806 834170).
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Content;
|
||||
@@ -91,8 +90,7 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// Get the dialog box resources
|
||||
// Found in "CDAC21BA.DLL" in Redump entry 95524.
|
||||
var resource = pex.FindDialogByTitle("SafeCast API");
|
||||
if (resource.Any())
|
||||
if (pex.FindDialogByTitle("SafeCast API").Count > 0)
|
||||
return "SafeCast";
|
||||
|
||||
// Get the .data/DATA section strings, if they exist
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
@@ -106,7 +105,9 @@ namespace BinaryObjectScanner.Protection
|
||||
// Get the debug data
|
||||
try
|
||||
{
|
||||
if (pex.FindCodeViewDebugTableByPath("SafeDisc").Any() || pex.FindCodeViewDebugTableByPath("Safedisk").Any())
|
||||
if (pex.FindCodeViewDebugTableByPath("SafeDisc").Count > 0)
|
||||
return "SafeDisc";
|
||||
if (pex.FindCodeViewDebugTableByPath("Safedisk").Count > 0)
|
||||
return "SafeDisc";
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
@@ -33,12 +32,10 @@ namespace BinaryObjectScanner.Protection
|
||||
if (name?.StartsWith("LicGen Module", StringComparison.OrdinalIgnoreCase) == true)
|
||||
return $"MediaMax CD-3";
|
||||
|
||||
var cd3CtrlResources = pex.FindGenericResource("Cd3Ctl");
|
||||
if (cd3CtrlResources.Any())
|
||||
if (pex.FindGenericResource("Cd3Ctl").Count > 0)
|
||||
return $"MediaMax CD-3";
|
||||
|
||||
var limitedProductionResources = pex.FindDialogBoxByItemTitle("This limited production advanced CD is not playable on your computer. It is solely intended for playback on standard CD players.");
|
||||
if (limitedProductionResources.Any())
|
||||
if (pex.FindDialogBoxByItemTitle("This limited production advanced CD is not playable on your computer. It is solely intended for playback on standard CD players.").Count > 0)
|
||||
return $"MediaMax CD-3";
|
||||
|
||||
// TODO: Investigate the following dialog item title resource
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
|
||||
namespace BinaryObjectScanner.Protection
|
||||
@@ -17,8 +16,8 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
if (Directory.Exists(Path.Combine(path, "VIDEO_TS")))
|
||||
{
|
||||
string[] ifofiles = files.Where(s => s.EndsWith(".ifo")).ToArray();
|
||||
for (int i = 0; i < ifofiles.Length; i++)
|
||||
var ifofiles = files.FindAll(s => s.EndsWith(".ifo"));
|
||||
for (int i = 0; i < ifofiles.Count; i++)
|
||||
{
|
||||
var ifofile = new FileInfo(ifofiles[i]);
|
||||
if (ifofile.Length == 0)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Content;
|
||||
@@ -174,13 +175,7 @@ namespace BinaryObjectScanner.Protection
|
||||
index = positions[0] - 12 - 6;
|
||||
|
||||
// Version 7
|
||||
#if NET20 || NET35 || NET40
|
||||
temp = new byte[6];
|
||||
Array.Copy(fileContent, index, temp, 0, 6);
|
||||
if (new string(Array.ConvertAll(temp, b => (char)b)) == "Henrik")
|
||||
#else
|
||||
if (new string(new ArraySegment<byte>(fileContent, index, 6).Select(b => (char)b).ToArray()) == "Henrik")
|
||||
#endif
|
||||
if (Encoding.ASCII.GetString(fileContent, index, 6) == "Henrik")
|
||||
{
|
||||
version = "7.1-7.5";
|
||||
index = positions[0] - 12 - 6 - 6;
|
||||
@@ -194,7 +189,7 @@ namespace BinaryObjectScanner.Protection
|
||||
index = positions[0] - 12 - 10;
|
||||
while (true) //search for e.g. "Build 050913 - September 2005"
|
||||
{
|
||||
if (Char.IsNumber((char)fileContent[index]))
|
||||
if (char.IsNumber((char)fileContent[index]))
|
||||
break;
|
||||
|
||||
index--; // Search upwards
|
||||
@@ -203,15 +198,9 @@ namespace BinaryObjectScanner.Protection
|
||||
index -= 5;
|
||||
}
|
||||
|
||||
#if NET20 || NET35 || NET40
|
||||
temp = new byte[6];
|
||||
Array.Copy(fileContent, index, temp, 0, 6);
|
||||
char[] arrBuild = Array.ConvertAll(temp, b => (char)b);
|
||||
#else
|
||||
char[] arrBuild = new ArraySegment<byte>(fileContent, index, 6).Select(b => (char)b).ToArray();
|
||||
#endif
|
||||
if (!Int32.TryParse(new string(arrBuild), out int intBuild))
|
||||
strBuild = $"[Build {new string(arrBuild).Trim()}]";
|
||||
strBuild = Encoding.ASCII.GetString(fileContent, index, 6).Trim();
|
||||
if (!int.TryParse(strBuild, out int intBuild))
|
||||
strBuild = $"[Build {strBuild}]";
|
||||
else
|
||||
strBuild = $"[Build 0x{intBuild:X} / {intBuild}]";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -105,26 +104,21 @@ namespace BinaryObjectScanner.Protection
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
|
||||
// Get the resident and non-resident name table strings
|
||||
var nrntStrs = Array.ConvertAll(nex.Model.NonResidentNameTable ?? [],
|
||||
rnte => rnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(rnte.NameString));
|
||||
|
||||
// Check the nonresident-name table
|
||||
// Found in "SSWIN.dll" in IA item "pcwkcd-1296".
|
||||
bool nonresidentNameTableEntries = nex.Model.NonResidentNameTable?
|
||||
.Select(nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString))
|
||||
.Any(s => s.Contains("SentinelPro Windows Driver DLL")) ?? false;
|
||||
if (nonresidentNameTableEntries)
|
||||
if (Array.Exists(nrntStrs, s => s.Contains("SentinelPro Windows Driver DLL")))
|
||||
return "Rainbow SentinelPro";
|
||||
|
||||
// Found in "INSTALL.EXE" in IA item "czchip199707cd".
|
||||
nonresidentNameTableEntries = nex.Model.NonResidentNameTable?
|
||||
.Select(nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString))
|
||||
.Any(s => s.Contains("Rainbow Technologies Installation Program")) ?? false;
|
||||
if (nonresidentNameTableEntries)
|
||||
if (Array.Exists(nrntStrs, s => s.Contains("Rainbow Technologies Installation Program")))
|
||||
return "Rainbow Sentinel";
|
||||
|
||||
// Found in "WNCEDITD.EXE" and "WNCEDITO.EXE" in IA item "czchip199707cd".
|
||||
nonresidentNameTableEntries = nex.Model.NonResidentNameTable?
|
||||
.Select(nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString))
|
||||
.Any(s => s.Contains("NetSentinel-C Editor for Windows")) ?? false;
|
||||
if (nonresidentNameTableEntries)
|
||||
if (Array.Exists(nrntStrs, s => s.Contains("NetSentinel-C Editor for Windows")))
|
||||
return "NetSentinel-C Editor for Windows";
|
||||
|
||||
// TODO: Investigate "SentinelScribe Windows Driver DLL" found in "NKWIN.DLL" in IA item "czchip199707cd".
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
@@ -51,10 +50,10 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// If any dialog boxes match
|
||||
// Found in "Data6.OWP" in IA item "game4u-22-cd".
|
||||
if (pex.FindDialogBoxByItemTitle("SharpTiny Version 1.0").Any())
|
||||
if (pex.FindDialogBoxByItemTitle("SharpTiny Version 1.0").Count > 0)
|
||||
return "Roxxe";
|
||||
// Found in "Data8.OWP" in IA item "game4u-22-cd".
|
||||
else if (pex.FindDialogBoxByItemTitle("T32xWin Version 1.0").Any())
|
||||
else if (pex.FindDialogBoxByItemTitle("T32xWin Version 1.0").Count > 0)
|
||||
return "Roxxe";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
@@ -33,48 +32,38 @@ namespace BinaryObjectScanner.Protection
|
||||
return "SoftLock";
|
||||
|
||||
// Found in "IALib.DLL" in IA item "TAFSEERVER4SETUP"
|
||||
var stMatch = pex.FindStringTableByEntry("Softlock CD");
|
||||
if (stMatch.Any())
|
||||
if (pex.FindStringTableByEntry("Softlock CD").Count > 0)
|
||||
return "SoftLock";
|
||||
|
||||
// Found in "IALib.DLL" in IA item "TAFSEERVER4SETUP"
|
||||
stMatch = pex.FindStringTableByEntry("Softlock USB Key");
|
||||
if (stMatch.Any())
|
||||
if (pex.FindStringTableByEntry("Softlock USB Key").Count > 0)
|
||||
return "SoftLock";
|
||||
|
||||
// Found in "IALib.DLL" in IA item "TAFSEERVER4SETUP"
|
||||
var dbMatch = pex.FindDialogByTitle("Softlock Protection Kit");
|
||||
if (dbMatch.Any())
|
||||
if (pex.FindDialogByTitle("Softlock Protection Kit").Count > 0)
|
||||
return "SoftLock";
|
||||
|
||||
// Found in "IALib.DLL" in IA item "TAFSEERVER4SETUP"
|
||||
dbMatch = pex.FindDialogByTitle("About Softlock Protected Application");
|
||||
if (dbMatch.Any())
|
||||
if (pex.FindDialogByTitle("About Softlock Protected Application").Count > 0)
|
||||
return "SoftLock";
|
||||
|
||||
// Found in "IALib.DLL" in IA item "TAFSEERVER4SETUP"
|
||||
dbMatch = pex.FindDialogBoxByItemTitle("www.softlock.net");
|
||||
if (dbMatch.Any())
|
||||
if (pex.FindDialogBoxByItemTitle("www.softlock.net").Count > 0)
|
||||
return "SoftLock";
|
||||
|
||||
// TODO: See if the version number is anywhere else
|
||||
// TODO: Parse the version number out of the dialog box item
|
||||
// Found in "IALib.DLL" in IA item "TAFSEERVER4SETUP"
|
||||
dbMatch = pex.FindDialogBoxByItemTitle("Softlock Protected Application Version 1.0");
|
||||
if (dbMatch.Any())
|
||||
if (pex.FindDialogBoxByItemTitle("Softlock Protected Application Version 1.0").Count > 0)
|
||||
return "SoftLock";
|
||||
|
||||
// There are many mentions of USB dongle and CD protection in the various string tables
|
||||
// and dialog boxes. See if any of those are unique to SoftLock.
|
||||
|
||||
// Get strings from .section, if possible
|
||||
var strings = pex.GetFirstSectionStrings(".section");
|
||||
if (strings != null && strings.Count > 0)
|
||||
{
|
||||
// Found in "TafseerVer4.exe" in IA item "TAFSEERVER4SETUP"
|
||||
if (strings.Exists(s => s?.Contains("SOFTLOCKPROTECTION") == true))
|
||||
return "SoftLock";
|
||||
}
|
||||
// Found in "TafseerVer4.exe" in IA item "TAFSEERVER4SETUP"
|
||||
var strings = pex.GetFirstSectionStrings(".section") ?? [];
|
||||
if (strings.Exists(s => s?.Contains("SOFTLOCKPROTECTION") == true))
|
||||
return "SoftLock";
|
||||
|
||||
// Investigate if the ".section" section is an indicator of SoftLock
|
||||
|
||||
|
||||
@@ -73,8 +73,7 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
// Get the wrapper resource, if it exists
|
||||
var wrapperResources = pex.FindResourceByNamedType("BIN, IDR_SGT");
|
||||
if (wrapperResources != null && wrapperResources.Any())
|
||||
if (pex.FindResourceByNamedType("BIN, IDR_SGT").Count > 0)
|
||||
return "SolidShield EXE Wrapper v1";
|
||||
|
||||
// Search the last two available sections
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
namespace BinaryObjectScanner.Protection
|
||||
@@ -15,9 +14,9 @@ namespace BinaryObjectScanner.Protection
|
||||
return null;
|
||||
|
||||
// Check the dialog box resources
|
||||
if (pex.FindDialogByTitle("321Studios Activation").Any())
|
||||
if (pex.FindDialogByTitle("321Studios Activation").Count > 0)
|
||||
return $"321Studios Online Activation";
|
||||
else if (pex.FindDialogByTitle("321Studios Phone Activation").Any())
|
||||
else if (pex.FindDialogByTitle("321Studios Phone Activation").Count > 0)
|
||||
return $"321Studios Online Activation";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Matching.Paths;
|
||||
@@ -30,13 +29,11 @@ namespace BinaryObjectScanner.Protection
|
||||
return "Windows Media Data Session DRM";
|
||||
|
||||
// Found in "autorun.exe" ("Touch" by Amerie).
|
||||
var resource = pex.FindDialogBoxByItemTitle("If you attempt to play this content on a computer without a license, you will first have to acquire a license before it will play.");
|
||||
if (resource.Any())
|
||||
if (pex.FindDialogBoxByItemTitle("If you attempt to play this content on a computer without a license, you will first have to acquire a license before it will play.").Count > 0)
|
||||
return "Windows Media Data Session DRM";
|
||||
|
||||
// Found in "autorun.exe" ("Touch" by Amerie).
|
||||
resource = pex.FindDialogBoxByItemTitle("You cannot generate a licence to play the protected Windows Media files without an original disc.");
|
||||
if (resource.Any())
|
||||
if (pex.FindDialogBoxByItemTitle("You cannot generate a licence to play the protected Windows Media files without an original disc.").Count > 0)
|
||||
return "Windows Media Data Session DRM";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
@@ -47,10 +46,10 @@ namespace BinaryObjectScanner.Protection
|
||||
return protections;
|
||||
|
||||
// TODO: Verify if these are OR or AND
|
||||
if (files.Any(f => Path.GetFileName(f).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase))
|
||||
|| files.Any(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)))
|
||||
if (files.Exists(f => Path.GetFileName(f).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase))
|
||||
|| files.Exists(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var versionDatPath = files.FirstOrDefault(f => Path.GetFileName(f).Equals("VERSION.DAT", StringComparison.OrdinalIgnoreCase));
|
||||
var versionDatPath = files.Find(f => Path.GetFileName(f).Equals("VERSION.DAT", StringComparison.OrdinalIgnoreCase));
|
||||
if (!string.IsNullOrEmpty(versionDatPath))
|
||||
{
|
||||
var xcpVersion = GetDatVersion(versionDatPath);
|
||||
|
||||
Reference in New Issue
Block a user