diff --git a/BurnOutSharp/BurnOutSharp.csproj b/BurnOutSharp/BurnOutSharp.csproj
index 18a29bc6..bce3162c 100644
--- a/BurnOutSharp/BurnOutSharp.csproj
+++ b/BurnOutSharp/BurnOutSharp.csproj
@@ -38,6 +38,7 @@
+
@@ -57,6 +58,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BurnOutSharp/ProtectionFind.cs b/BurnOutSharp/ProtectionFind.cs
index 15daa9be..5e40dfc3 100644
--- a/BurnOutSharp/ProtectionFind.cs
+++ b/BurnOutSharp/ProtectionFind.cs
@@ -18,10 +18,11 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
+using System.Threading;
+using BurnOutSharp.ProtectionType;
using LibMSPackN;
using UnshieldSharp;
@@ -35,23 +36,6 @@ namespace BurnOutSharp
/// Path to scan for protection(s)
/// Optional progress indicator that will return a float in the range from 0 to 1
/// Dictionary of filename to protection mappings, if possible
- ///
- /// TODO: Sector scanning?
- /// The following protections are known, but not detected:
- /// - Alcatraz (http://www.kdg-mt.com/1/product_d_6.html)
- /// - AlphaAudio (http://settec.net/eng/pro_cd.html)
- /// - CopyLok / CodeLok (http://web.archive.org/web/20041215075727/http://www.panlok.com/codelok2.htm)
- /// - CrypKey (http://www.crypkey.com/products/cdlock/cdmain.html)
- /// - DBB (http://web.archive.org/web/20040604233815/www.wkit.com/sites/wkit/setup/eng/index.asp)
- /// - FADE (http://www.codemasters.com/news/displayarticles.php?showarticle=500)
- /// - LockBlocks (https://www.cdmediaworld.com/hardware/cdrom/cd_protections_lockblocks.shtml)
- /// - MusicGuard (http://web.archive.org/web/20020606000647/http://www.musicguard.com)
- /// - Phenoprotect (https://www.cdmediaworld.com/hardware/cdrom/cd_protections_phenoprotect.shtml)
- /// - Roxxe (http://web.archive.org/web/20050309084802/http://www.roxxe.cz)
- /// - SAFEAUDIO (https://www.cdmediaworld.com/hardware/cdrom/cd_protections_safeaudio.shtml)
- /// - The Bongle (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
- /// - The Copy-Protected CD (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
- ///
public static Dictionary Scan(string path, IProgress progress = null)
{
var protections = new Dictionary();
@@ -59,80 +43,56 @@ namespace BurnOutSharp
// Checkpoint
progress?.Report(new FileProtection(null, 0, null));
- // Create mappings for checking against
- var mappings = CreateFilenameProtectionMapping();
-
// If we have a file
if (File.Exists(path))
{
- // If the file is in the list of known files, add that to the protections found
- if (mappings.ContainsKey(Path.GetFileName(path)))
- protections[path] = mappings[Path.GetFileName(path)];
-
- // If the extension matches one of the known extension, add that to the protections found
- if (mappings.ContainsKey(Path.GetExtension(path)))
- protections[path] = mappings[Path.GetExtension(path)];
+ // Try using just the path first to get protection info
+ string pathProtection = ScanPath(path, false);
+ if (!string.IsNullOrWhiteSpace(pathProtection))
+ protections[path] = pathProtection;
// Now check to see if the file contains any additional information
- string protectionname = ScanInFile(path)?.Replace("" + (char)0x00, "");
- if (!String.IsNullOrEmpty(protectionname))
- protections[path] = protectionname;
+ string contentProtection = ScanInFile(path)?.Replace("" + (char)0x00, "");
+ if (!string.IsNullOrWhiteSpace(contentProtection))
+ {
+ if (protections.ContainsKey(path))
+ protections[path] += $", {contentProtection}";
+ else
+ protections[path] = contentProtection;
+ }
// Checkpoint
- progress?.Report(new FileProtection(path, 1, protectionname));
+ progress?.Report(new FileProtection(path, 1, contentProtection));
}
// If we have a directory
else if (Directory.Exists(path))
{
// Get the lists of files to be used
- string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
+ var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
- // DVD-Movie-PROTECT
- if (DVDMoviePROTECT(path, files))
- protections[path] = "DVD-Movie-PROTECT";
+ // Try using just the path first to get protection info
+ string pathProtection = ScanPath(path, true);
+ if (!string.IsNullOrWhiteSpace(pathProtection))
+ protections[path] = pathProtection;
- // LaserLock
- if (Directory.Exists(Path.Combine(path, "LASERLOK")))
- protections[path] = "LaserLock";
-
- // Protect DVD-Video
- if (ProtectDVDVideo(path, files))
- protections[path] = "Protect DVD-Video";
-
- // PSX Anti-modchip
- if (PSXAntiModchip(path, files))
- protections[path] = "PlayStation Anti-modchip";
-
- // Zzxzz
- if (Directory.Exists(Path.Combine(path, "Zzxzz")))
- protections[path] = "Zzxzz";
-
- // Loop through all files and scan them
- for (int i = 0; i < files.Length; i++)
+ // Loop through all files and scan their contents
+ for (int i = 0; i < files.Count(); i++)
{
// Get the current file
- string file = files[i];
-
- // If the file is in the list of known files, add that to the protections found
- if (mappings.ContainsKey(Path.GetFileName(file)))
- protections[file] = mappings[Path.GetFileName(file)];
-
- // If the extension matches one of the known extension, add that to the protections found
- if (mappings.ContainsKey(Path.GetExtension(file)))
- protections[file] = mappings[Path.GetExtension(file)];
+ string file = files.ElementAt(i);
// Now check to see if the file contains any additional information
- string protectionname = ScanInFile(file)?.Replace("" + (char)0x00, "");
- if (!String.IsNullOrEmpty(protectionname))
- protections[file] = protectionname;
+ string contentProtection = ScanInFile(file)?.Replace("" + (char)0x00, "");
+ if (!string.IsNullOrWhiteSpace(contentProtection))
+ protections[file] = contentProtection;
// Checkpoint
- progress?.Report(new FileProtection(file, i / files.Length, protectionname));
+ progress?.Report(new FileProtection(file, i / files.Count(), contentProtection));
}
}
// If we have an empty list, we need to take care of that
- if (protections.Count(p => !String.IsNullOrWhiteSpace(p.Value)) == 0)
+ if (protections.Count(p => !string.IsNullOrWhiteSpace(p.Value)) == 0)
{
protections = new Dictionary();
}
@@ -140,6 +100,241 @@ namespace BurnOutSharp
return protections;
}
+ ///
+ /// Scan a path for indications of copy protection
+ ///
+ ///
+ ///
+ ///
+ private static string ScanPath(string path, bool isDirectory)
+ {
+ List protections = new List();
+ string protection;
+
+ // If we have a directory, get the files in the directory for searching
+ IEnumerable files = null;
+ if (isDirectory)
+ files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
+
+ // AACS
+ protection = AACS.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Alpha-DVD
+ protection = AlphaDVD.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Bitpool
+ protection = Bitpool.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // ByteShield
+ protection = ByteShield.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Cactus Data Shield
+ protection = CactusDataShield.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CD-Cops
+ protection = CDCops.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CD-Lock
+ protection = CDLock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CD-Protector
+ protection = CDProtector.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CD-X
+ protection = CDX.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ /*
+ // CopyKiller
+ protection = CopyKiller.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+ */
+
+ // DiscGuard
+ protection = DiscGuard.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // DVD Crypt
+ protection = DVDCrypt.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // DVD-Movie-PROTECT
+ protection = DVDMoviePROTECT.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // FreeLock
+ protection = FreeLock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Games for Windows - Live
+ protection = GFWL.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Hexalock AutoLock
+ protection = HexalockAutoLock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Impulse Reactor
+ protection = ImpulseReactor.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // IndyVCD
+ protection = IndyVCD.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Key2Audio XS
+ protection = Key2AudioXS.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // LaserLock
+ protection = LaserLock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // MediaCloQ
+ protection = MediaCloQ.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // MediaMax CD3
+ protection = MediaMaxCD3.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Origin
+ protection = Origin.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Protect DVD-Video
+ protection = ProtectDVDVideo.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // PSX Anti-modchip
+ protection = PSXAntiModchip.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SafeCast
+ protection = SafeCast.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SafeDisc Lite
+ protection = SafeDiscLite.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SafeLock
+ protection = SafeLock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SecuROM
+ protection = SecuROM.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SmartE
+ protection = SmartE.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SoftLock
+ protection = SoftLock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SolidShield
+ protection = SolidShield.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // StarForce
+ protection = StarForce.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Steam
+ protection = Steam.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // TAGES
+ protection = Tages.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // TZCopyProtector
+ protection = TZCopyProtector.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Uplay
+ protection = Uplay.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // VOB ProtectCD/DVD
+ protection = VOBProtectCDDVD.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Winlock
+ protection = Winlock.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // WTM CD Protect
+ protection = WTMCDProtect.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // XCP
+ protection = XCP.CheckPath(path, files, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Zzxzz
+ protection = Zzxzz.CheckPath(path, isDirectory);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Now combine any found protections, or null if empty
+ if (protections.Count() == 0)
+ return null;
+ else
+ return string.Join(", ", protections);
+ }
+
///
/// Scan an individual file for copy protection
///
@@ -154,7 +349,7 @@ namespace BurnOutSharp
{
using (BinaryReader br = new BinaryReader(File.OpenRead(file)))
{
- magic = new String(br.ReadChars(8));
+ magic = new string(br.ReadChars(8));
}
}
catch
@@ -163,6 +358,9 @@ namespace BurnOutSharp
return null;
}
+ // Files can be protected in multiple ways
+ List protections = new List();
+
#region Executable Content Checks
// Windows Executable and DLL
@@ -172,258 +370,194 @@ namespace BurnOutSharp
{
// Load the current file and check for specialty strings first
StreamReader sr = new StreamReader(file, Encoding.Default);
- int position = -1;
- string FileContent = sr.ReadToEnd();
+ string protection;
+ string fileContent = sr.ReadToEnd();
sr.Close();
+ // 3PLock
+ protection = ThreePLock.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // ActiveMARK
+ protection = ActiveMARK.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Alpha-ROM
+ protection = AlphaROM.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Armadillo
+ protection = Armadillo.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
// CD-Cops
- if ((position = FileContent.IndexOf("CD-Cops, ver. ")) > -1)
- return "CD-Cops " + GetCDDVDCopsVersion(file, position);
+ protection = CDCops.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CD-Lock
+ protection = CDLock.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CDSHiELD SE
+ protection = CDSHiELDSE.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CD Check
+ protection = CDCheck.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Cenega ProtectDVD
+ protection = CengaProtectDVD.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Code Lock
+ protection = CodeLock.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // CopyKiller
+ protection = CopyKiller.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Cucko (EA Custom)
+ protection = Cucko.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // dotFuscator
+ protection = dotFuscator.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// DVD-Cops
- if ((position = FileContent.IndexOf("DVD-Cops, ver. ")) > -1)
- return "DVD-Cops " + GetCDDVDCopsVersion(file, position);
+ protection = DVDCops.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // EA CdKey Registration Module
+ protection = EACdKey.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // EXE Stealth
+ protection = EXEStealth.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Games for Windows - Live
+ protection = GFWL.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// Impulse Reactor
- if (FileContent.Contains("CVPInitializeClient")
- && FileContent.Contains("A" + (char)0x00 + "T" + (char)0x00 + "T" + (char)0x00 + "L" + (char)0x00 + "I"
- + (char)0x00 + "S" + (char)0x00 + "T" + (char)0x00 + (char)0x00 + (char)0x00 + "E" + (char)0x00 + "L"
- + (char)0x00 + "E" + (char)0x00 + "M" + (char)0x00 + "E" + (char)0x00 + "N" + (char)0x00 + "T" + (char)0x00
- + (char)0x00 + (char)0x00 + "N" + (char)0x00 + "O" + (char)0x00 + "T" + (char)0x00 + "A" + (char)0x00 + "T"
- + (char)0x00 + "I" + (char)0x00 + "O" + (char)0x00 + "N"))
- return "Impulse Reactor " + GetFileVersion(file);
+ protection = ImpulseReactor.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// Inno Setup
- if ((position = FileContent.IndexOf("Inno")) == 0x30)
- {
- // TOOO: Add Inno Setup extraction
- return "Inno Setup " + GetInnoSetupVersion(file);
- }
+ protection = InnoSetup.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// JoWooD X-Prot
- if (FileContent.Contains(".ext ")
- && (position = FileContent.IndexOf("kernel32.dll" + (char)0x00 + (char)0x00 + (char)0x00 + "VirtualProtect")) > -1)
- return "JoWooD X-Prot " + GetJoWooDXProt1Version(file, --position);
+ protection = JoWooDXProt.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // Key-Lock (Dongle)
+ protection = KeyLock.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// LaserLock
- if (FileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE")
- && (position = FileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
- + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00
- + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF")) > -1)
- return "LaserLock " + GetLaserLockVersion(FileContent, position) + " " + GetLaserLockBuild(FileContent, true);
+ protection = LaserLock.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
- if (FileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE"))
- return "LaserLock Marathon " + GetLaserLockBuild(FileContent, false);
-
- if ((position = FileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
- + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00
- + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF")) > -1)
- return "LaserLock " + GetLaserLockVersion(FileContent, --position) + " " + GetLaserLockBuild(FileContent, false);
+ // PE Compact
+ protection = PECompact.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// ProtectDisc
- if ((position = FileContent.IndexOf("HúMETINF")) > -1)
- {
- string version = EVORE.SearchProtectDiscVersion(file);
- if (version.Length > 0)
- {
- string[] astrVersionArray = version.Split('.');
- if (astrVersionArray[0] == "9")
- {
- if (GetProtectDiscVersionBuild76till10(file, position, out int ibuild).Length > 0)
- return "ProtectDisc " + astrVersionArray[0] + "." + astrVersionArray[1] + astrVersionArray[2] + "." + astrVersionArray[3] + " (Build " + ibuild + ")";
- }
- else
- return "ProtectDisc " + astrVersionArray[0] + "." + astrVersionArray[1] + "." + astrVersionArray[2] + " (Build " + astrVersionArray[3] + ")";
- }
- }
+ protection = ProtectDisc.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
- if ((position = FileContent.IndexOf("ACE-PCD")) > -1)
- {
- string version = EVORE.SearchProtectDiscVersion(file);
- if (version.Length > 0)
- {
- string[] astrVersionArray = version.Split('.');
- return "ProtectDisc " + astrVersionArray[0] + "." + astrVersionArray[1] + "." + astrVersionArray[2] + " (Build " + astrVersionArray[3] + ")";
- }
-
- return "ProtectDisc " + GetProtectDiscVersionBuild6till8(file, position);
- }
+ // Ring PROTECH
+ protection = RingPROTECH.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// SafeDisc / SafeCast
- if ((position = FileContent.IndexOf("BoG_ *90.0&!! Yy>")) > -1)
- {
- if (FileContent.IndexOf("product activation library") > 0)
- return "SafeCast " + GetSafeDiscVersion(file, position);
- else
- return "SafeDisc " + GetSafeDiscVersion(file, position);
- }
+ protection = SafeDisc.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
- if (FileContent.Contains((char)0x00 + (char)0x00 + "BoG_")
- || FileContent.Contains("stxt774")
- || FileContent.Contains("stxt371"))
- {
- string version = EVORE.SearchSafeDiscVersion(file);
- if (version.Length > 0)
- return "SafeDisc " + version;
-
- return "SafeDisc 3.20-4.xx (version removed)";
- }
+ // SafeLock
+ protection = SafeLock.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// SecuROM
- if ((position = FileContent.IndexOf("AddD" + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00)) > -1)
- return "SecuROM " + GetSecuROM4Version(file, position);
+ protection = SecuROM.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
- if ((position = FileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1)
- return "SecuROM " + GetSecuROM4and5Version(file, position);
-
- if (FileContent.Contains(".securom")
- || FileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0))
- return "SecuROM " + GetSecuROM7Version(file);
-
- if (FileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
- return "SecuROM Product Activation " + GetFileVersion(file);
+ // SmartE
+ protection = SmartE.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// SolidShield
- if (FileContent.Contains("D" + (char)0x00 + "V" + (char)0x00 + "M" + (char)0x00 + " " + (char)0x00 + "L" + (char)0x00
- + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y"))
- return "SolidShield " + GetFileVersion(file);
-
- if (FileContent.Contains("S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00
- + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00
- + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00
- + "r" + (char)0x00 + "y")
- || FileContent.Contains("S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00
- + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00
- + " " + (char)0x00 + "A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00
- + "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00
- + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y"))
- {
- string companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
- if (companyName.Contains("solidshield") || companyName.Contains("tages"))
- return "SolidShield Core.dll " + GetFileVersion(file);
- }
-
- if ((position = FileContent.IndexOf("" + (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE)) > -1)
- {
- var id1 = FileContent.Substring(position + 5, 3);
- var id2 = FileContent.Substring(position + 16, 4);
-
- if (id1 == "" + (char)0x00 + (char)0x00 + (char)0x00 && id2 == "" + (char)0x00 + (char)0x10 + (char)0x00 + (char)0x00)
- return "SolidShield 1 (SolidShield EXE Wrapper)";
- else if (id1 == ".o&" && id2 == "ÛÅ›¹")
- return "SolidShield 2 (SolidShield v2 EXE Wrapper)"; // TODO: Verify against other SolidShield 2 discs
- }
-
- if (FileContent.Contains("A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00
- + "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00
- + "M" + (char)0x00 + "a" + (char)0x00 + "n" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "r"))
- {
- string companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
- if (companyName.Contains("solidshield") || companyName.Contains("tages"))
- return "SolidShield Activation Manager Module " + GetFileVersion(file);
- }
-
- if ((position = FileContent.IndexOf("" + (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA)) > -1)
- {
- if ((FileContent[position + 3] == (char)0x04 || FileContent[position + 3] == (char)0x05)
- && FileContent.Substring(position + 4, 3) == "" + (char)0x00 + (char)0x00 + (char)0x00
- && FileContent.Substring(position + 15, 4) == "" + (char)0x00 + (char)0x10 + (char)0x00 + (char)0x00)
- {
- return "SolidShield 2 (SolidShield v2 EXE Wrapper)";
- }
- else if (FileContent.Substring(position + 4, 3) == "" + (char)0x00 + (char)0x00 + (char)0x00
- && FileContent.Substring(position + 15, 4) == "" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00)
- {
- position = FileContent.IndexOf("T" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "s"
- + (char)0x00 + "S" + (char)0x00 + "e" + (char)0x00 + "t" + (char)0x00 + "u" + (char)0x00 + "p"
- + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "0" + (char)0x00 + (char)0x8
- + (char)0x00 + (char)0x1 + (char)0x0 + "F" + (char)0x00 + "i" + (char)0x00 + "l" + (char)0x00 + "e"
- + (char)0x00 + "V" + (char)0x00 + "e" + (char)0x00 + "r" + (char)0x00 + "s" + (char)0x00 + "i" + (char)0x00
- + "o" + (char)0x00 + "n" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00);
- if (position > -1)
- {
- position--; // TODO: Verify this subtract
- return "SolidShield 2 + Tagès " + FileContent.Substring(position + 0x38, 1) + "." + FileContent.Substring(position + 0x38 + 4, 1) + "." + FileContent.Substring(position + 0x38 + 8, 1) + "." + FileContent.Substring(position + 0x38 + 12, 1);
- }
- else
- {
- return "SolidShield 2 (SolidShield v2 EXE Wrapper)";
- }
- }
- }
-
- if ((position = FileContent.IndexOf("Solidshield")) > 0)
- return "SolidShield " + GetSolidShieldVersion(file, position);
+ protection = SolidShield.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// StarForce
- if (FileContent.Contains("(" + (char)0x00 + "c" + (char)0x00 + ")" + (char)0x00 + " " + (char)0x00 + "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)
- || FileContent.Contains("Protection Technology, Ltd."))
- {
- //if (FileContent.Contains("PSA_GetDiscLabel")
- //if (FileContent.Contains("(c) Protection Technology")
- position = FileContent.IndexOf("TradeName") - 1;
- if (position != -1 && position != -2)
- return "StarForce " + GetFileVersion(file) + " (" + FileContent.Substring(position + 22, 30).Split((char)0x00)[0] + ")";
- else
- return "StarForce " + GetFileVersion(file);
- }
+ protection = StarForce.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
+
+ // SVK Protector
+ protection = SVKProtector.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// Sysiphus / Sysiphus DVD
- if ((position = FileContent.IndexOf("V SUHPISYSDVD")) > -1)
- return "Sysiphus DVD " + GetSysiphusVersion(file, position);
-
- if ((position = FileContent.IndexOf("V SUHPISYS")) > -1)
- return "Sysiphus " + GetSysiphusVersion(file, position);
+ protection = Sysiphus.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// TAGES
- if (FileContent.Contains("protected-tages-runtime.exe") ||
- FileContent.Contains("tagesprotection.com"))
- return "TAGES " + GetFileVersion(file);
-
- if ((position = FileContent.IndexOf("" + (char)0xE8 + "u" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0xE8)) > -1
- && FileContent.Substring(--position + 8, 3) == "" + (char)0xFF + (char)0xFF + "h") // TODO: Verify this subtract
- return "TAGES " + GetTagesVersion(file, position);
+ protection = Tages.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
// VOB ProtectCD/DVD
- if ((position = FileContent.IndexOf("VOB ProtectCD")) > -1)
- return "VOB ProtectCD/DVD " + GetProtectCDoldVersion(file, --position); // TODO: Verify this subtract
+ protection = VOBProtectCDDVD.CheckContents(file, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
- if ((position = FileContent.IndexOf("DCP-BOV" + (char)0x00 + (char)0x00)) > -1)
- {
- string version = GetVOBProtectCDDVDVersion(file, --position); // TODO: Verify this subtract
- if (version.Length > 0)
- {
- return "VOB ProtectCD/DVD " + version;
- }
+ // WTM CD Protect
+ protection = WTMCDProtect.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
- version = EVORE.SearchProtectDiscVersion(file);
- if (version.Length > 0)
- {
- if (version.StartsWith("2"))
- {
- version = "6" + version.Substring(1);
- }
- return "VOB ProtectCD/DVD " + version;
- }
-
- return "VOB ProtectCD/DVD 5.9-6.0" + GetVOBProtectCDDVDBuild(file, position);
- }
-
- // Create mappings for checking against
- var mappings = CreateInternalProtectionMapping();
-
- // Loop through all of the string-only possible matches
- foreach (string key in mappings.Keys)
- {
- if (FileContent.Contains(key))
- {
- return mappings[key];
- }
- }
+ // Xtreme-Protector
+ protection = XtremeProtector.CheckContents(fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ protections.Add(protection);
}
catch { }
}
@@ -445,7 +579,9 @@ namespace BurnOutSharp
// CD-Key
if (FileContent.Contains("a valid serial number is required")
|| FileContent.Contains("serial number is located"))
- return "CD-Key / Serial";
+ {
+ protections.Add("CD-Key / Serial");
+ }
}
catch
{
@@ -469,7 +605,6 @@ namespace BurnOutSharp
{
try
{
- List protections = new List();
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(tempPath);
@@ -486,7 +621,7 @@ namespace BurnOutSharp
}
catch { }
- if (!String.IsNullOrEmpty(protection))
+ if (!string.IsNullOrEmpty(protection))
protections.Add(protection);
}
}
@@ -496,8 +631,6 @@ namespace BurnOutSharp
Directory.Delete(tempPath, true);
}
catch { }
-
- return string.Join(", ", protections);
}
catch { }
}
@@ -507,29 +640,28 @@ namespace BurnOutSharp
{
try
{
- List protections = new List();
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(tempPath);
- MSCabinet cabfile = new MSCabinet(file);
- foreach (var sub in cabfile.GetFiles())
+ using (MSCabinet cabfile = new MSCabinet(file))
{
- string tempfile = Path.Combine(tempPath, sub.Filename);
- sub.ExtractTo(tempfile);
- string protection = ScanInFile(tempfile);
- File.Delete(tempfile);
+ foreach (var sub in cabfile.GetFiles())
+ {
+ string tempfile = Path.Combine(tempPath, sub.Filename);
+ sub.ExtractTo(tempfile);
+ string protection = ScanInFile(tempfile);
+ File.Delete(tempfile);
- if (!String.IsNullOrEmpty(protection))
- protections.Add(protection);
+ if (!string.IsNullOrEmpty(protection))
+ protections.Add(protection);
+ }
+
+ try
+ {
+ Directory.Delete(tempPath, true);
+ }
+ catch { }
}
-
- try
- {
- Directory.Delete(tempPath, true);
- }
- catch { }
-
- return string.Join(", ", protections);
}
catch { }
}
@@ -550,920 +682,70 @@ namespace BurnOutSharp
#endregion
- #region Name Checks
-
- FileInfo fi = new FileInfo(file);
-
- // Cactus Data Shield
- if (Path.GetFileName(file) == "CDSPlayer.app")
- using (StreamReader cactusReader = new StreamReader(file))
- return "Cactus Data Shield " + cactusReader.ReadLine().Substring(3) + "(" + cactusReader.ReadLine() + ")";
-
- // Impulse Reactor
- if (Path.GetFileName(file) == "ImpulseReactor.dll")
- return "Impulse Reactor " + GetFileVersion(file);
-
- // LaserLock
- if (Path.GetFileName(file) == "NOMOUSE.SP")
- return "LaserLock " + GetLaserLockVersion16Bit(file);
-
- // SafeDisc
- if (Path.GetFileName(file) == "DPLAYERX.DLL")
- {
- if (fi.Length == 81408)
- return "SafeDisc 1.0x";
- else if (fi.Length == 155648)
- return "SafeDisc 1.1x";
- else if (fi.Length == 156160)
- return "SafeDisc 1.1x-1.2x";
- else if (fi.Length == 163328)
- return "SafeDisc 1.3x";
- else if (fi.Length == 165888)
- return "SafeDisc 1.35";
- else if (fi.Length == 172544)
- return "SafeDisc 1.40";
- else if (fi.Length == 173568)
- return "SafeDisc 1.4x";
- else if (fi.Length == 136704)
- return "SafeDisc 1.4x";
- else if (fi.Length == 138752)
- return "SafeDisc 1.5x";
- else
- return "SafeDisc 1";
- }
- else if (Path.GetFileName(file).ToLower() == "drvmgt.dll")
- {
- if (fi.Length == 34816)
- return "SafeDisc 1.0x";
- else if (fi.Length == 32256)
- return "SafeDisc 1.1x-1.3x";
- else if (fi.Length == 31744)
- return "SafeDisc 1.4x";
- else if (fi.Length == 34304)
- return "SafeDisc 1.5x-2.40";
- else if (fi.Length == 35840)
- return "SafeDisc 2.51-2.60";
- else if (fi.Length == 40960)
- return "SafeDisc 2.70";
- else if (fi.Length == 23552)
- return "SafeDisc 2.80";
- else if (fi.Length == 41472)
- return "SafeDisc 2.90-3.10";
- else if (fi.Length == 24064)
- return "SafeDisc 3.15-3.20";
- else
- return "SafeDisc v2 or greater";
- }
- else if (Path.GetFileName(file).ToLower() == "secdrv.sys")
- {
- if (fi.Length == 20128)
- return "SafeDisc 2.10";
- else if (fi.Length == 27440)
- return "SafeDisc 2.30";
- else if (fi.Length == 28624)
- return "SafeDisc 2.40";
- else if (fi.Length == 18768)
- return "SafeDisc 2.50";
- else if (fi.Length == 28400)
- return "SafeDisc 2.51";
- else if (fi.Length == 29392)
- return "SafeDisc 2.60";
- else if (fi.Length == 11376)
- return "SafeDisc 2.70";
- else if (fi.Length == 12464)
- return "SafeDisc 2.80";
- else if (fi.Length == 12400)
- return "SafeDisc 2.90";
- else if (fi.Length == 12528)
- return "SafeDisc 3.10";
- else if (fi.Length == 12528)
- return "SafeDisc 3.15";
- else if (fi.Length == 11973)
- return "SafeDisc 3.20";
- else
- return "SafeDisc v2 or greater";
- }
-
- // SolidShield
- if (Path.GetFileName(file) == "dvm.dll")
- return "SolidShield " + ScanInFile(file);
- else if (Path.GetFileName(file) == "hc.dll")
- return "SolidShield " + ScanInFile(file);
- else if (Path.GetFileName(file) == "solidshield-cd.dll")
- return "SolidShield " + ScanInFile(file);
- else if (Path.GetFileName(file) == "c11prot.dll")
- return "SolidShield " + ScanInFile(file);
-
- // TAGES
- if (Path.GetFileName(file) == "TagesClient.exe")
- return "TAGES Activation Client " + GetFileVersion(file);
- else if (Path.GetFileName(file) == "TagesSetup.exe")
- return "TAGES Setup " + GetFileVersion(file);
- else if (Path.GetFileName(file) == "TagesSetup_x64.exe")
- return "TAGES Setup " + GetFileVersion(file);
-
- // WTM Copy Protection
- if (Path.GetFileName(file) == "Viewer.exe")
- return "WTM Copy Protection " + GetFileVersion(file);
-
- #endregion
-
- return "";
- }
-
- #region Path-Based Protections
-
- private static bool DVDMoviePROTECT(string path, string[] files)
- {
- 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++)
- {
- FileInfo bupfile = new FileInfo(bupfiles[i]);
- FileInfo ifofile = new FileInfo(bupfile.DirectoryName + "\\" + bupfile.Name.Substring(0, bupfile.Name.Length - bupfile.Extension.Length) + ".ifo");
- if (bupfile.Length != ifofile.Length)
- return true;
- }
- }
-
- return false;
- }
-
- private static bool ProtectDVDVideo(string path, string[] files)
- {
- 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++)
- {
- FileInfo ifofile = new FileInfo(ifofiles[i]);
- if (ifofile.Length == 0)
- return true;
- }
- }
-
- return false;
- }
-
- private static bool PSXAntiModchip(string path, string[] files)
- {
- if (files.Where(s => s.ToLower().EndsWith(".cnf")).Count() > 0)
- {
- foreach (string file in files)
- {
- try
- {
- // Load the current file and check for specialty strings first
- StreamReader sr = new StreamReader(file, Encoding.Default);
- string FileContent = sr.ReadToEnd();
- sr.Close();
-
- if (FileContent.Contains(" SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690")
- || FileContent.Contains("強制終了しました。\n本体が改造されている\nおそれがあります。"))
- return true;
-
- }
- catch { }
- }
- }
-
- return false;
- }
-
- #endregion
-
- #region Version detections
-
- private static string GetCDDVDCopsVersion(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 15, SeekOrigin.Begin); // Begin reading after "CD-Cops, ver."
- char[] version = br.ReadChars(4);
- if (version[0] == 0x00)
- return "";
- return new string(version);
- }
-
- private static string GetInnoSetupVersion(string file)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(0x30, SeekOrigin.Begin);
- string signature = new String(br.ReadChars(12));
-
- if (signature == "rDlPtS02" + (char)0x87 + "eVx")
- return "1.2.10";
- else if (signature == "rDlPtS04" + (char)0x87 + "eVx")
- return "4.0.0";
- else if (signature == "rDlPtS05" + (char)0x87 + "eVx")
- return "4.0.3";
- else if (signature == "rDlPtS06" + (char)0x87 + "eVx")
- return "4.0.10";
- else if (signature == "rDlPtS07" + (char)0x87 + "eVx")
- return "4.1.6";
- else if (signature == "rDlPtS" + (char)0xcd + (char)0xe6 + (char)0xd7 + "{" + (char)0x0b + "*")
- return "5.1.5";
- else if (signature == "nS5W7dT" + (char)0x83 + (char)0xaa + (char)0x1b + (char)0x0f + "j")
- return "5.1.5";
-
- return string.Empty;
- }
-
- private static string GetJoWooDXProt1Version(string file, int position)
- {
- char[] version = new char[5];
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 67, SeekOrigin.Begin);
- version[0] = br.ReadChar();
- br.ReadByte();
- version[1] = br.ReadChar();
- br.ReadByte();
- version[2] = br.ReadChar();
- br.ReadByte();
- version[3] = br.ReadChar();
- version[4] = br.ReadChar();
- br.Close();
-
- return version[0] + "." + version[1] + "." + version[2] + "." + version[3] + version[4];
- }
-
- private static string GetLaserLockBuild(string FileContent, bool Version2)
- {
- int position = FileContent.IndexOf("Unkown" + (char)0 + "Unkown");
- string Year;
- string Month;
- string Day;
- if (Version2)
- {
- Day = FileContent.Substring(position + 14, 2);
- Month = FileContent.Substring(position + 14 + 3, 2);
- Year = "20" + FileContent.Substring(position + 14 + 6, 2);
- }
+ // Return blank if nothing found, or comma-separated list of protections
+ if (protections.Count() == 0)
+ return string.Empty;
else
- {
- Day = FileContent.Substring(position + 13, 2);
- Month = FileContent.Substring(position + 13 + 3, 2);
- Year = "20" + FileContent.Substring(position + 13 + 6, 2);
- }
-
- return "(Build " + Year + "-" + Month + "-" + Day + ")";
- }
-
- private static string GetLaserLockVersion(string FileContent, int position)
- {
- return FileContent.Substring(position + 76, 4);
- }
-
- private static string GetLaserLockVersion16Bit(string file)
- {
- char[] version = new char[3];
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(71, SeekOrigin.Begin);
- version[0] = br.ReadChar();
- br.ReadByte();
- version[1] = br.ReadChar();
- version[2] = br.ReadChar();
- br.Close();
-
- if (Char.IsNumber(version[0]) && Char.IsNumber(version[1]) && Char.IsNumber(version[2]))
- return version[0] + "." + version[1] + version[2];
- return "";
- }
-
- private static string GetProtectCDoldVersion(string file, int position)
- {
- char[] version = new char[3];
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 16, SeekOrigin.Begin); // Begin reading after "VOB ProtectCD"
- version[0] = br.ReadChar();
- br.ReadByte();
- version[1] = br.ReadChar();
- version[2] = br.ReadChar();
- br.Close();
- if (Char.IsNumber(version[0]) && Char.IsNumber(version[1]) && Char.IsNumber(version[2]))
- return version[0] + "." + version[1] + version[2];
- return "old";
- }
-
- private static string GetProtectDiscVersionBuild6till8(string file, int position)
- {
- string version;
- string strBuild;
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
-
- br.BaseStream.Seek(position - 12, SeekOrigin.Begin);
- if (br.ReadByte() == 0xA && br.ReadByte() == 0xD && br.ReadByte() == 0xA && br.ReadByte() == 0xD) // ProtectDisc 6-7 with Build Number in plain text
- {
- br.BaseStream.Seek(position - 12 - 6, SeekOrigin.Begin);
- if (new string(br.ReadChars(6)) == "Henrik") // ProtectDisc 7
- {
- version = "7.1-7.5";
- br.BaseStream.Seek(position - 12 - 6 - 6, SeekOrigin.Begin);
- }
- else // ProtectDisc 6
- {
- version = "6";
- br.BaseStream.Seek(position - 12 - 10, SeekOrigin.Begin);
- while (true) //search for e.g. "Build 050913 - September 2005"
- {
- if (Char.IsNumber(br.ReadChar()))
- break;
- br.BaseStream.Seek(-2, SeekOrigin.Current); //search upwards
- }
-
- br.BaseStream.Seek(-5, SeekOrigin.Current);
- }
- }
- else
- {
- br.BaseStream.Seek(position + 28, SeekOrigin.Begin);
- if (br.ReadByte() == 0xFB)
- {
- br.Close();
- return "7.6-7.x";
- }
- else
- {
- br.Close();
- return "8.0";
- }
- }
- strBuild = "" + br.ReadChar() + br.ReadChar() + br.ReadChar() + br.ReadChar() + br.ReadChar();
- br.Close();
- return version + " (Build " + strBuild + ")";
- }
-
- private static string GetProtectDiscVersionBuild76till10(string file, int position, out int irefBuild)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 37, SeekOrigin.Begin);
- byte subversion = br.ReadByte();
- br.ReadByte();
- byte version = br.ReadByte();
- br.BaseStream.Seek(position + 49, SeekOrigin.Begin);
- irefBuild = br.ReadInt32();
- br.BaseStream.Seek(position + 53, SeekOrigin.Begin);
- byte versionindicatorPD9 = br.ReadByte();
- br.BaseStream.Seek(position + 0x40, SeekOrigin.Begin);
- byte subsubversionPD9x = br.ReadByte();
- byte subversionPD9x2 = br.ReadByte();
- byte subversionPD9x1 = br.ReadByte();
- br.Close();
-
- // version 7
- if (version == 0xAC)
- return "7." + (subversion ^ 0x43) + " (Build " + irefBuild + ")";
- // version 8
- else if (version == 0xA2)
- {
- if (subversion == 0x46)
- {
- if ((irefBuild & 0x3A00) == 0x3A00)
- return "8.2" + " (Build " + irefBuild + ")";
- else
- return "8.1" + " (Build " + irefBuild + ")";
- }
- return "8." + (subversion ^ 0x47) + " (Build " + irefBuild + ")";
- }
- // version 9
- else if (version == 0xA3)
- {
- // version removed or not given
- if ((subversionPD9x2 == 0x5F && subversionPD9x1 == 0x61) || (subversionPD9x1 == 0 && subversionPD9x2 == 0))
- {
- if (versionindicatorPD9 == 0xB)
- return "9.0-9.4" + " (Build " + irefBuild + ")";
- else if (versionindicatorPD9 == 0xC)
- {
- if (subversionPD9x2 == 0x5F && subversionPD9x1 == 0x61)
- return "9.5-9.11" + " (Build " + irefBuild + ")";
- else if (subversionPD9x1 == 0 && subversionPD9x2 == 0)
- return "9.11-9.20" + " (Build " + irefBuild + ")";
- }
- else
- return "9." + subversionPD9x1 + subversionPD9x2 + "." + subsubversionPD9x + " (Build " + irefBuild + ")";
- }
- }
- else if (version == 0xA0)
- {
- // version removed
- if (subversionPD9x1 != 0 || subversionPD9x2 != 0)
- return "10." + subversionPD9x1 + "." + subsubversionPD9x + " (Build " + irefBuild + ")";
- else
- return "10.x (Build " + irefBuild + ")";
- }
- else
- return "7.6-10.x (Build " + irefBuild + ")";
-
- return "";
- }
-
- private static string GetSafeDiscVersion(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 20, SeekOrigin.Begin); // Begin reading after "BoG_ *90.0&!! Yy>" for old SafeDisc
- int version = br.ReadInt32();
- int subVersion = br.ReadInt32();
- int subsubVersion = br.ReadInt32();
- if (version != 0)
- return version + "." + subVersion.ToString("00") + "." + subsubVersion.ToString("000");
- br.BaseStream.Seek(position + 18 + 14, SeekOrigin.Begin); // Begin reading after "BoG_ *90.0&!! Yy>" for newer SafeDisc
- version = br.ReadInt32();
- subVersion = br.ReadInt32();
- subsubVersion = br.ReadInt32();
- br.Close();
- if (version == 0)
- return "";
- return version + "." + subVersion.ToString("00") + "." + subsubVersion.ToString("000");
- }
-
- private static string GetSecuROM4Version(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream, Encoding.Default);
- br.BaseStream.Seek(position + 8, SeekOrigin.Begin); // Begin reading after "AddD"
- char version = br.ReadChar();
- br.ReadByte();
- char subVersion1 = br.ReadChar();
- char subVersion2 = br.ReadChar();
- br.ReadByte();
- char subsubVersion1 = br.ReadChar();
- char subsubVersion2 = br.ReadChar();
- br.ReadByte();
- char subsubsubVersion1 = br.ReadChar();
- char subsubsubVersion2 = br.ReadChar();
- char subsubsubVersion3 = br.ReadChar();
- char subsubsubVersion4 = br.ReadChar();
- br.Close();
- return version + "." + subVersion1 + subVersion2 + "." + subsubVersion1 + subsubVersion2 + "." + subsubsubVersion1 + subsubsubVersion2 + subsubsubVersion3 + subsubsubVersion4;
- }
-
- private static string GetSecuROM4and5Version(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 8, SeekOrigin.Begin); // Begin reading after "ÊÝݬ"
- byte version = (byte)(br.ReadByte() & 0xF);
- br.ReadByte();
- byte subVersion1 = (byte)(br.ReadByte() ^ 36);
- byte subVersion2 = (byte)(br.ReadByte() ^ 28);
- br.ReadByte();
- byte subsubVersion1 = (byte)(br.ReadByte() ^ 42);
- byte subsubVersion2 = (byte)(br.ReadByte() ^ 8);
- br.ReadByte();
- byte subsubsubVersion1 = (byte)(br.ReadByte() ^ 16);
- byte subsubsubVersion2 = (byte)(br.ReadByte() ^ 116);
- byte subsubsubVersion3 = (byte)(br.ReadByte() ^ 34);
- byte subsubsubVersion4 = (byte)(br.ReadByte() ^ 22);
- br.Close();
- if (version == 0 || version > 9)
- return "";
- return version + "." + subVersion1 + subVersion2 + "." + subsubVersion1 + subsubVersion2 + "." + subsubsubVersion1 + subsubsubVersion2 + subsubsubVersion3 + subsubsubVersion4;
- }
-
- private static string GetSecuROM7Version(string file)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(236, SeekOrigin.Begin);
- byte[] bytes = br.ReadBytes(4);
- // if (bytes[0] == 0xED && bytes[3] == 0x5C {
- if (bytes[3] == 0x5C)
- {
- //SecuROM 7 new and 8
- br.Close();
- return (bytes[0] ^ 0xEA).ToString() + "." + (bytes[1] ^ 0x2C).ToString("00") + "." + (bytes[2] ^ 0x8).ToString("0000");
- }
- else // SecuROM 7 old
- {
- br.BaseStream.Seek(122, SeekOrigin.Begin);
- bytes = br.ReadBytes(2);
- br.Close();
- return "7." + (bytes[0] ^ 0x10).ToString("00") + "." + (bytes[1] ^ 0x10).ToString("0000");
- //return "7.01-7.10"
- }
- }
-
- private static string GetSolidShieldVersion(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream, Encoding.Default);
- br.BaseStream.Seek(position + 12, SeekOrigin.Begin); // Begin reading after "Solidshield"
- char version = br.ReadChar();
- br.ReadByte();
- char subVersion = br.ReadChar();
- br.ReadByte();
- char subsubVersion = br.ReadChar();
- br.ReadByte();
- char subsubsubVersion = br.ReadChar();
- br.Close();
- return version + "." + subVersion + "." + subsubVersion + "." + subsubsubVersion;
- }
-
- private static string GetSysiphusVersion(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream, Encoding.Default);
- br.BaseStream.Seek(position - 3, SeekOrigin.Begin);
- char subVersion = br.ReadChar();
- br.ReadChar();
- char version = br.ReadChar();
- br.Close();
- if (Char.IsNumber(version) && Char.IsNumber(subVersion))
- return version + "." + subVersion;
- else
- return "";
- }
-
- private static string GetTagesVersion(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position + 7, SeekOrigin.Begin);
- byte bVersion = br.ReadByte();
- br.Close();
- switch (bVersion)
- {
- case 0x1B:
- return "5.3-5.4";
- case 0x14:
- return "5.5.0";
- case 0x4:
- return "5.5.2";
- }
- return "";
- }
-
- private static string GetVOBProtectCDDVDBuild(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream);
- br.BaseStream.Seek(position - 13, SeekOrigin.Begin);
- if (!Char.IsNumber(br.ReadChar()))
- return ""; //Build info removed
- br.BaseStream.Seek(position - 4, SeekOrigin.Begin);
- int build = br.ReadInt16();
- br.Close();
- return " (Build " + build + ")";
- }
-
- private static string GetVOBProtectCDDVDVersion(string file, int position)
- {
- BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream, Encoding.Default);
- br.BaseStream.Seek(position - 2, SeekOrigin.Begin);
- byte version = br.ReadByte();
- if (version == 5)
- {
- br.BaseStream.Seek(position - 4, SeekOrigin.Begin);
- byte subsubVersion = (byte)((br.ReadByte() & 0xF0) >> 4);
- byte subVersion = (byte)((br.ReadByte() & 0xF0) >> 4);
- br.Close();
- return version + "." + subVersion + "." + subsubVersion;
- }
- else
- return "";
- }
-
- #endregion
-
- #region Helper methods
-
- ///
- /// Create a list of filenames and extensions mapped to protections for when only file existence matters
- ///
- private static CaseInsensitiveDictionary CreateFilenameProtectionMapping()
- {
- var mapping = new CaseInsensitiveDictionary();
-
- // AACS
- mapping.Add("VTKF000.AACS", "AACS"); // Path.Combine("aacs", "VTKF000.AACS")
- mapping.Add("CPSUnit00001.cci", "AACS"); // Path.Combine("AACS", "CPSUnit00001.cci")
-
- // Alpha-DVD
- mapping.Add("PlayDVD.exe", "Alpha-DVD");
-
- // Bitpool
- mapping.Add("bitpool.rsc", "Bitpool");
-
- // ByteShield
- mapping.Add("Byteshield.dll", "ByteShield");
- mapping.Add(".bbz", "ByteShield");
-
- // Cactus Data Shield
- mapping.Add("yucca.cds", "Cactus Data Shield 200");
- mapping.Add("wmmp.exe", "Cactus Data Shield 200");
- mapping.Add("PJSTREAM.DLL", "Cactus Data Shield 200");
- mapping.Add("CACTUSPJ.exe", "Cactus Data Shield 200");
- mapping.Add("CDSPlayer.app", "Cactus Data Shield 200");
-
- // CD-Cops
- mapping.Add("CDCOPS.DLL", "CD-Cops");
- mapping.Add(".GZ_", "CD-Cops");
- mapping.Add(".W_X", "CD-Cops");
- mapping.Add(".Qz", "CD-Cops");
- mapping.Add(".QZ_", "CD-Cops");
-
- // CD-Lock
- mapping.Add(".AFP", "CD-Lock");
-
- // CD-Protector
- mapping.Add("_cdp16.dat", "CD-Protector");
- mapping.Add("_cdp16.dll", "CD-Protector");
- mapping.Add("_cdp32.dat", "CD-Protector");
- mapping.Add("_cdp32.dll", "CD-Protector");
-
- // CD-X
- mapping.Add("CHKCDX16.DLL", "CD-X");
- mapping.Add("CHKCDX32.DLL", "CD-X");
- mapping.Add("CHKCDXNT.DLL", "CD-X");
-
- // CopyKiller
- // mapping.Add("Autorun.dat", "CopyKiller");
-
- // DiscGuard
- mapping.Add("IOSLINK.VXD", "DiscGuard");
- mapping.Add("IOSLINK.DLL", "DiscGuard");
- mapping.Add("IOSLINK.SYS", "DiscGuard");
-
- // DVD Crypt
- mapping.Add("DvdCrypt.pdb", "DVD Crypt");
-
- // FreeLock
- mapping.Add("FREELOCK.IMG", "FreeLock");
-
- // Games for Windows - Live
- mapping.Add("XLiveRedist.msi", "Games for Windows - Live");
-
- // Hexalock AutoLock
- mapping.Add("Start_Here.exe", "Hexalock AutoLock");
- mapping.Add("HCPSMng.exe", "Hexalock AutoLock");
- mapping.Add("MFINT.DLL", "Hexalock AutoLock");
- mapping.Add("MFIMP.DLL", "Hexalock AutoLock");
-
- // Impulse Reactor
- mapping.Add("ImpulseReactor.dll", "Impulse Reactor");
-
- // IndyVCD
- mapping.Add("INDYVCD.AX", "IndyVCD");
- mapping.Add("INDYMP3.idt", "IndyVCD");
-
- // Key2Audio XS
- mapping.Add("SDKHM.EXE", "Key2Audio XS");
- mapping.Add("SDKHM.DLL", "Key2Audio XS");
-
- // LaserLock
- mapping.Add("NOMOUSE.SP", "LaserLock");
- mapping.Add("NOMOUSE.COM", "LaserLock");
- mapping.Add("l16dll.dll", "LaserLock");
- mapping.Add("laserlok.in", "LaserLock");
- mapping.Add("laserlok.o10", "LaserLock");
- mapping.Add("laserlok.011", "LaserLock");
-
- // MediaCloQ
- mapping.Add("sunncomm.ico", "MediaCloQ");
-
- // MediaMax CD3
- mapping.Add("LaunchCd.exe", "MediaMax CD3");
-
- // Origin
- mapping.Add("OriginSetup.exe", "Origin");
-
- // SafeCast
- mapping.Add("cdac11ba.exe", "SafeCast");
-
- // SafeDisc
- mapping.Add("00000001.TMP", "SafeDisc v1 or greater");
- mapping.Add("CLCD16.DLL", "SafeDisc");
- mapping.Add("CLCD32.DLL", "SafeDisc");
- mapping.Add("CLOKSPL.EXE", "SafeDisc");
- mapping.Add("DPLAYERX.DLL", "SafeDisc");
- mapping.Add("drvmgt.dll", "SafeDisc v1 or greater");
- mapping.Add(".icd", "SafeDisc 1");
- mapping.Add(".016", "SafeDisc 1");
- mapping.Add(".256", "SafeDisc 1");
-
- // SafeDisc v2 or greater
- mapping.Add("00000002.TMP", "SafeDisc v2 or greater");
- mapping.Add("secdrv.sys", "SafeDisc v2 or greater");
-
- // SafeDisc Lite
- mapping.Add("00000001.LT1", "SafeDisc Lite");
-
- // SafeLock
- mapping.Add("SafeLock.dat", "SafeLock");
- mapping.Add("SafeLock.001", "SafeLock");
- mapping.Add("SafeLock.128", "SafeLock");
-
- // SecuROM
- mapping.Add("CMS16.DLL", "SecuROM");
- mapping.Add("CMS_95.DLL", "SecuROM");
- mapping.Add("CMS_NT.DLL", "SecuROM");
- mapping.Add("CMS32_95.DLL", "SecuROM");
- mapping.Add("CMS32_NT.DLL", "SecuROM");
-
- // SecuROM New
- mapping.Add("SINTF32.DLL", "SecuROM New");
- mapping.Add("SINTF16.DLL", "SecuROM New");
- mapping.Add("SINTFNT.DLL", "SecuROM New");
-
- // SmartE
- mapping.Add("00001.TMP", "SmartE");
- mapping.Add("00002.TMP", "SmartE");
-
- // SolidShield
- mapping.Add("dvm.dll", "SolidShield");
- mapping.Add("hc.dll", "SolidShield");
- mapping.Add("solidshield-cd.dll", "SolidShield");
- mapping.Add("c11prot.dll", "SolidShield");
-
- // SoftLock
- mapping.Add("SOFTLOCKI.dat", "SoftLock");
- mapping.Add("SOFTLOCKC.dat", "SoftLock");
-
- // StarForce
- mapping.Add("protect.dll", "StarForce");
- mapping.Add("protect.exe", "StarForce");
-
- // Steam
- mapping.Add("SteamInstall.exe", "Steam");
- mapping.Add("SteamInstall.ini", "Steam");
- mapping.Add("SteamInstall.msi", "Steam");
- mapping.Add("SteamRetailInstaller.dmg", "Steam");
- mapping.Add("SteamSetup.exe", "Steam");
-
- // TAGES
- mapping.Add("Tages.dll", "TAGES");
- mapping.Add("tagesclient.exe", "TAGES");
- mapping.Add("TagesSetup.exe", "TAGES");
- mapping.Add("TagesSetup_x64.exe", "TAGES");
- mapping.Add("Wave.aif", "TAGES");
-
- // TZCopyProtector
- mapping.Add("_742893.016", "TZCopyProtector");
-
- // Uplay
- mapping.Add("UplayInstaller.exe", "Uplay");
-
- // VOB ProtectCD/DVD
- mapping.Add("VOB-PCD.KEY", "VOB ProtectCD/DVD");
-
- // Winlock
- mapping.Add("WinLock.PSX", "Winlock");
-
- // WTM CD Protect
- mapping.Add(".IMP", "WTM CD Protect");
-
- // WTM Copy Protection
- mapping.Add("imp.dat", "WTM Copy Protection");
- mapping.Add("wtmfiles.dat", "WTM Copy Protection");
- mapping.Add("Viewer.exe", "WTM Copy Protection");
-
- // XCP
- mapping.Add("XCP.DAT", "XCP");
- mapping.Add("ECDPlayerControl.ocx", "XCP");
- mapping.Add("go.exe", "XCP"); // Path.Combine("contents", "go.exe")
-
- // Zzxzz
- mapping.Add("Zzz.aze", "Zzxzz"); // Path.Combine("Zzxxzz", "Zzz.aze")
-
- return mapping;
+ return string.Join(", ", protections);
}
///
- /// Create a list of strings mapped to protections for when secondary strings and position doesn't matter
+ /// Scan a disc sector by sector for protection
///
- private static Dictionary CreateInternalProtectionMapping()
+ ///
+ /// https://stackoverflow.com/questions/8819188/c-sharp-classes-to-undelete-files/8820157#8820157
+ /// TODO: Finish implementation
+ ///
+ private static string ScanSectors(char driveLetter, int sectorsize)
{
- var mapping = new Dictionary();
+ string fsName = Utilities.GetFileSystemName(driveLetter);
- // 3PLock
- mapping[".ldr"] = "3PLock";
- mapping[".ldt"] = "3PLock";
- // mapping["Y" + (char)0xC3 + "U" + (char)0x8B + (char)0xEC + (char)0x83 + (char)0xEC + "0SVW"] = "3PLock"; // YÃU‹ìƒì0SVW
+ // Gets a handle to the physical disk
+ IntPtr hDisk = Utilities.CreateFile($"\\\\.\\{driveLetter}:",
+ FileAccess.Read,
+ FileShare.ReadWrite,
+ IntPtr.Zero,
+ FileMode.Open,
+ 0,
+ IntPtr.Zero);
- // ActiveMARK
- mapping["TMSAMVOF"] = "ActiveMARK";
+ // If we have a good pointer
+ if (hDisk.ToInt32() != -1)
+ {
+ // Setup vars
+ byte[] buffer = new byte[sectorsize];
+ IntPtr pt = IntPtr.Zero;
+ NativeOverlapped no = new NativeOverlapped();
- // ActiveMARK 5
- mapping[" " + (char)0xC2 + (char)0x16 + (char)0x00 + (char)0xA8 + (char)0xC1 + (char)0x16
- + (char)0x00 + (char)0xB8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x86 + (char)0xC8 + (char)0x16 + (char)0x0
- + (char)0x9A + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x10 + (char)0xC2 + (char)0x16 + (char)0x00] = "ActiveMARK 5";
+ // Set initial offset
+ Utilities.SetFilePointerEx(
+ hDisk,
+ 0,
+ ref pt,
+ Utilities.FileBegin);
- // Alpha-ROM
- mapping["SETTEC"] = "Alpha-ROM";
+ // Read a whole sector
+ while (true)
+ {
+ buffer = new byte[sectorsize];
+ Utilities.ReadFileEx(
+ hDisk,
+ buffer,
+ (uint)sectorsize,
+ ref no,
+ null);
- // Armadillo
- mapping[".nicode" + (char)0x00] = "Armadillo";
- mapping["ARMDEBUG"] = "Armadillo";
+ Utilities.SetFilePointerEx(
+ hDisk,
+ sectorsize,
+ ref pt,
+ Utilities.FileCurrent);
+ }
+ }
- // CD-Cops
- mapping[".grand" + (char)0x00] = "CD-Cops";
+ Utilities.CloseHandle(hDisk);
- // CD-Lock
- mapping["2" + (char)0xF2 + (char)0x02 + (char)0x82 + (char)0xC3 + (char)0xBC + (char)0x0B
- + "$" + (char)0x99 + (char)0xAD + "'C" + (char)0xE4 + (char)0x9D + "st"
- + (char)0x99 + (char)0xFA + "2$" + (char)0x9D + ")4" + (char)0xFF + "t"] = "CD-Lock";
-
- // CDSHiELD SE
- mapping["~0017.tmp"] = "CDSHiELD SE";
-
- // CD Check
- //mapping["GetDriveType"] = "CD Check";
- //mapping["GetVolumeInformation"] = "CD Check";
-
- // Cenega ProtectDVD
- mapping[".cenega"] = "Cenega ProtectDVD";
-
- // Code Lock
- mapping["icd1" + (char)0x00] = "Code Lock";
- mapping["icd2" + (char)0x00] = "Code Lock";
- mapping["CODE-LOCK.OCX"] = "Code Lock";
-
- // CopyKiller
- mapping["Tom Commander"] = "CopyKiller";
-
- // Cucko (EA Custom) - TODO: Verify this doesn't over-match
- mapping["EASTL"] = "Cucko (EA Custom)";
-
- // dotFuscator - Not a protection
- //mapping["DotfuscatorAttribute"] = "dotFuscator";
-
- // EA CdKey Registration Module
- mapping["ereg.ea-europe.com"] = "EA CdKey Registration Module";
-
- // EXE Stealth
- mapping["??[[__[[_" + (char)0x00 + "{{" + (char)0x0
- + (char)0x00 + "{{" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0
- + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "?;??;??"] = "EXE Stealth";
-
- // Games for Windows - Live
- mapping["xlive.dll"] = "Games for Windows - Live";
-
- // Impulse Reactor
- mapping["CVPInitializeClient"] = "Impulse Reactor";
-
- // JoWooD X-Prot
- mapping[".ext "] = "JoWooD X-Prot v1";
- mapping["@HC09 "] = "JoWooD X-Prot v2";
-
- // Key-Lock (Dongle)
- mapping["KEY-LOCK COMMAND"] = "Key-Lock (Dongle)";
-
- // LaserLock
- mapping[":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP"] = "LaserLock 3";
- mapping["LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK"
- + (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3"] = "LaserLock 5";
-
- // PE Compact 2 - Not a protection
- //mapping["PEC2"] = "PE Compact 2";
-
- // Ring PROTECH
- mapping[(char)0x00 + "Allocator" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00] = "Ring PROTECH";
-
- // SafeLock
- mapping["SafeLock"] = "SafeLock";
-
- // SecuROM
- mapping[".cms_t" + (char)0x00] = "SecuROM 1-3";
- mapping[".cms_d" + (char)0x00] = "SecuROM 1-3";
-
- // SmartE
- mapping["BITARTS"] = "SmartE";
-
- // SolidShield
- mapping["B" + (char)0x00 + "I" + (char)0x00 + "N" + (char)0x00 + (char)0x7 + (char)0x00 +
- "I" + (char)0x00 + "D" + (char)0x00 + "R" + (char)0x00 + "_" + (char)0x00 +
- "S" + (char)0x00 + "G" + (char)0x00 + "T" + (char)0x0] = "SolidShield";
-
- // StarForce
- mapping[".sforce"] = "StarForce 3-5";
- mapping[".brick"] = "StarForce 3-5";
- mapping["P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00
- + "c" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "M" + (char)0x00
- + "o" + (char)0x00 + "d" + (char)0x00 + "u" + (char)0x00 + "l" + (char)0x00 + "e"] = "StarForce 5";
-
- // SVK Protector
- mapping["?SVKP" + (char)0x00 + (char)0x00] = "SVK Protector";
-
- // VOB ProtectCD/DVD
- mapping[".vob.pcd"] = "VOB ProtectCD";
-
- // WTM CD Protect
- mapping["WTM76545"] = "WTM CD Protect";
-
- // Xtreme-Protector
- mapping["XPROT "] = "Xtreme-Protector";
-
- return mapping;
+ return null;
}
-
- ///
- /// Get the file version as reported by the filesystem
- ///
- private static string GetFileVersion(string file)
- {
- FileVersionInfo fvinfo = FileVersionInfo.GetVersionInfo(file);
- if (fvinfo.FileVersion == null)
- return "";
- if (fvinfo.FileVersion != "")
- return fvinfo.FileVersion.Replace(", ", ".");
- else
- return fvinfo.ProductVersion.Replace(", ", ".");
- }
-
- #endregion
}
}
diff --git a/BurnOutSharp/ProtectionType/AACS.cs b/BurnOutSharp/ProtectionType/AACS.cs
new file mode 100644
index 00000000..f1ebe072
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/AACS.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class AACS
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => f.Contains(Path.Combine("aacs", "VTKF000.AACS"))) > 0
+ && files.Count(f => f.Contains(Path.Combine("AACS", "CPSUnit00001.cci"))) > 0)
+ {
+ return "AACS";
+ }
+ }
+ else
+ {
+ string filename = Path.GetFileName(path);
+ if (filename.Equals("VTKF000.AACS", StringComparison.OrdinalIgnoreCase)
+ || filename.Equals("CPSUnit00001.cci", StringComparison.OrdinalIgnoreCase))
+ {
+ return "AACS";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs
new file mode 100644
index 00000000..a66063e8
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs
@@ -0,0 +1,22 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class ActiveMARK
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("TMSAMVOF"))
+ {
+ return "ActiveMARK";
+ }
+
+ else if (fileContent.Contains(" " + (char)0xC2 + (char)0x16 + (char)0x00 + (char)0xA8 + (char)0xC1 + (char)0x16
+ + (char)0x00 + (char)0xB8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x86 + (char)0xC8 + (char)0x16 + (char)0x0
+ + (char)0x9A + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x10 + (char)0xC2 + (char)0x16 + (char)0x00))
+ {
+ return "ActiveMARK 5";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Alcatraz.cs b/BurnOutSharp/ProtectionType/Alcatraz.cs
new file mode 100644
index 00000000..8ceac6ac
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Alcatraz.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class Alcatraz
+ {
+ // TODO: Implement - http://www.kdg-mt.com/1/product_d_6.html
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/AlphaAudio.cs b/BurnOutSharp/ProtectionType/AlphaAudio.cs
new file mode 100644
index 00000000..727d4d77
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/AlphaAudio.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class AlphaAudio
+ {
+ // TODO: Implement - http://settec.net/eng/pro_cd.html
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/AlphaDVD.cs b/BurnOutSharp/ProtectionType/AlphaDVD.cs
new file mode 100644
index 00000000..393086ad
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/AlphaDVD.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class AlphaDVD
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("PlayDVD.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Alpha-DVD";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("PlayDVD.exe", StringComparison.OrdinalIgnoreCase))
+ return "Alpha-DVD";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs
new file mode 100644
index 00000000..b6d6292d
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/AlphaROM.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class AlphaROM
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("SETTEC"))
+ return "Alpha-ROM";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Armadillo.cs b/BurnOutSharp/ProtectionType/Armadillo.cs
new file mode 100644
index 00000000..39aaa58a
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Armadillo.cs
@@ -0,0 +1,14 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class Armadillo
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains(".nicode" + (char)0x00)
+ || fileContent.Contains("ARMDEBUG"))
+ return "Armadillo";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Bitpool.cs b/BurnOutSharp/ProtectionType/Bitpool.cs
new file mode 100644
index 00000000..d590bf2e
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Bitpool.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Bitpool
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("bitpool.rsc", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Bitpool";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("bitpool.rsc", StringComparison.OrdinalIgnoreCase))
+ return "Bitpool";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/ByteShield.cs b/BurnOutSharp/ProtectionType/ByteShield.cs
new file mode 100644
index 00000000..811ec527
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/ByteShield.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class ByteShield
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("Byteshield.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetExtension(f).Trim('.').Equals("bbz", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "ByteShield";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("Byteshield.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("bbz", StringComparison.OrdinalIgnoreCase))
+ {
+ return "ByteShield";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs
new file mode 100644
index 00000000..4a18b340
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CDCheck.cs
@@ -0,0 +1,14 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class CDCheck
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("GetDriveType")
+ || fileContent.Contains("GetVolumeInformation"))
+ return "CD Check";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs
new file mode 100644
index 00000000..3ff45089
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CDCops.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class CDCops
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("CD-Cops, ver. ")) > -1)
+ return "CD-Cops " + GetVersion(file, position);
+
+ else if (fileContent.Contains(".grand" + (char)0x00))
+ return "CD-Cops";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("CDCOPS.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ && (files.Count(f => Path.GetExtension(f).Trim('.').Equals("GZ_", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetExtension(f).Trim('.').Equals("W_X", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetExtension(f).Trim('.').Equals("Qz", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetExtension(f).Trim('.').Equals("QZ_", StringComparison.OrdinalIgnoreCase)) > 0))
+ {
+ return "CD-Cops";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("CDCOPS.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("GZ_", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("W_X", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("Qz", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("QZ_", StringComparison.OrdinalIgnoreCase))
+ {
+ return "CD-Cops";
+ }
+ }
+
+ return null;
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 15, SeekOrigin.Begin); // Begin reading after "CD-Cops, ver."
+ char[] version = br.ReadChars(4);
+ if (version[0] == 0x00)
+ return "";
+
+ return new string(version);
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs
new file mode 100644
index 00000000..ae89b29b
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CDLock.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class CDLock
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("2" + (char)0xF2 + (char)0x02 + (char)0x82 + (char)0xC3 + (char)0xBC + (char)0x0B
+ + "$" + (char)0x99 + (char)0xAD + "'C" + (char)0xE4 + (char)0x9D + "st"
+ + (char)0x99 + (char)0xFA + "2$" + (char)0x9D + ")4" + (char)0xFF + "t"))
+ {
+ return "CD-Lock";
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetExtension(f).Trim('.').Equals("AFP", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "CD-Lock";
+ }
+ else
+ {
+ if (Path.GetExtension(path).Trim('.').Equals("AFP", StringComparison.OrdinalIgnoreCase))
+ return "CD-Lock";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CDProtector.cs b/BurnOutSharp/ProtectionType/CDProtector.cs
new file mode 100644
index 00000000..b2a0df8b
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CDProtector.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class CDProtector
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Confirm if OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("_cdp16.dat", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("_cdp16.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("_cdp32.dat", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("_cdp32.dll", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "CD-Protector";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("_cdp16.dat", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("_cdp16.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("_cdp32.dat", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("_cdp32.dll", StringComparison.OrdinalIgnoreCase))
+ {
+ return "CD-Protector";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
new file mode 100644
index 00000000..31d27ca7
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class CDSHiELDSE
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("~0017.tmp"))
+ return "CDSHiELD SE";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CDX.cs b/BurnOutSharp/ProtectionType/CDX.cs
new file mode 100644
index 00000000..2f183652
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CDX.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class CDX
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Confirm if OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("CHKCDX16.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CHKCDX32.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CHKCDXNT.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "CD-X";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("CHKCDX16.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CHKCDX32.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CHKCDXNT.DLL", StringComparison.OrdinalIgnoreCase))
+ {
+ return "CD-X";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs
new file mode 100644
index 00000000..7e4830a8
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class CactusDataShield
+ {
+ public static string CheckContents(string file)
+ {
+ if (Path.GetFileName(file) == "CDSPlayer.app")
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var sr = new StreamReader(fs))
+ {
+ return "Cactus Data Shield " + sr.ReadLine().Substring(3) + "(" + sr.ReadLine() + ")";
+ }
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("CDSPlayer.app", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ string file = files.First(f => Path.GetFileName(f).Equals("CDSPlayer.app", StringComparison.OrdinalIgnoreCase));
+ string protection = CheckContents(file);
+ if (!string.IsNullOrWhiteSpace(protection))
+ return protection;
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("yucca.cds", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("wmmp.exe", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("PJSTREAM.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CACTUSPJ.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "Cactus Data Shield 200";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("CDSPlayer.app", StringComparison.OrdinalIgnoreCase))
+ {
+ string protection = CheckContents(path);
+ if (!string.IsNullOrWhiteSpace(protection))
+ return protection;
+ }
+ else if (Path.GetFileName(path).Equals("yucca.cds", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("wmmp.exe", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("PJSTREAM.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CACTUSPJ.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "Cactus Data Shield 200";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
new file mode 100644
index 00000000..a4161587
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class CengaProtectDVD
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains(".cenega"))
+ return "Cenega ProtectDVD";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs
new file mode 100644
index 00000000..1e2fce3f
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CodeLock.cs
@@ -0,0 +1,18 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class CodeLock
+ {
+ public static string CheckContents(string fileContent)
+ {
+ // TODO: Check if OR or AND
+ if (fileContent.Contains("icd1" + (char)0x00)
+ || fileContent.Contains("icd2" + (char)0x00)
+ || fileContent.Contains("CODE-LOCK.OCX"))
+ {
+ return "Code Lock";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs
new file mode 100644
index 00000000..9cf55571
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CopyKiller.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class CopyKiller
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("Tom Commander"))
+ return "CopyKiller";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("Autorun.dat", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "CopyKiller";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("Autorun.dat", StringComparison.OrdinalIgnoreCase))
+ return "CopyKiller";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CopyLok.cs b/BurnOutSharp/ProtectionType/CopyLok.cs
new file mode 100644
index 00000000..245d6fee
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CopyLok.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class CopyLok
+ {
+ // TODO: Implement - http://web.archive.org/web/20041215075727/http://www.panlok.com/codelok2.htm
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/CrypKey.cs b/BurnOutSharp/ProtectionType/CrypKey.cs
new file mode 100644
index 00000000..9306575d
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/CrypKey.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class CrypKey
+ {
+ // TODO: Implement - http://www.crypkey.com/products/cdlock/cdmain.html
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Cucko.cs b/BurnOutSharp/ProtectionType/Cucko.cs
new file mode 100644
index 00000000..56d5588c
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Cucko.cs
@@ -0,0 +1,14 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class Cucko
+ {
+ public static string CheckContents(string fileContent)
+ {
+ // TODO: Verify this doesn't over-match
+ if (fileContent.Contains("EASTL"))
+ return "Cucko (EA Custom)";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/DBB.cs b/BurnOutSharp/ProtectionType/DBB.cs
new file mode 100644
index 00000000..18af56c9
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/DBB.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class DBB
+ {
+ // TODO: Implement - http://web.archive.org/web/20040604233815/www.wkit.com/sites/wkit/setup/eng/index.asp
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs
new file mode 100644
index 00000000..ac028ed1
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/DVDCops.cs
@@ -0,0 +1,30 @@
+using System.IO;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class DVDCops
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("DVD-Cops, ver. ")) > -1)
+ return "DVD-Cops " + GetVersion(file, position);
+
+ return null;
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 15, SeekOrigin.Begin); // Begin reading after "CD-Cops, ver."
+ char[] version = br.ReadChars(4);
+ if (version[0] == 0x00)
+ return "";
+
+ return new string(version);
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/DVDCrypt.cs b/BurnOutSharp/ProtectionType/DVDCrypt.cs
new file mode 100644
index 00000000..eaa16a3b
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/DVDCrypt.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class DVDCrypt
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("DvdCrypt.pdb", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "DVD Crypt";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("DvdCrypt.pdb", StringComparison.OrdinalIgnoreCase))
+ return "DVD Crypt";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/DVDMoviePROTECT.cs b/BurnOutSharp/ProtectionType/DVDMoviePROTECT.cs
new file mode 100644
index 00000000..9e453a9a
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/DVDMoviePROTECT.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class DVDMoviePROTECT
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (!isDirectory)
+ return null;
+
+ 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++)
+ {
+ FileInfo bupfile = new FileInfo(bupfiles[i]);
+ FileInfo ifofile = new FileInfo(bupfile.DirectoryName + "\\" + bupfile.Name.Substring(0, bupfile.Name.Length - bupfile.Extension.Length) + ".ifo");
+ if (bupfile.Length != ifofile.Length)
+ return "DVD-Movie-PROTECT"; ;
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/DiscGuard.cs b/BurnOutSharp/ProtectionType/DiscGuard.cs
new file mode 100644
index 00000000..22ffd913
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/DiscGuard.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class DiscGuard
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("IOSLINK.VXD", StringComparison.OrdinalIgnoreCase)) > 0
+ && files.Count(f => Path.GetFileName(f).Equals("IOSLINK.SYS", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "DiscGuard";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("IOSLINK.VXD", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("IOSLINK.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("IOSLINK.SYS", StringComparison.OrdinalIgnoreCase))
+ {
+ return "DiscGuard";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/EACdKey.cs b/BurnOutSharp/ProtectionType/EACdKey.cs
new file mode 100644
index 00000000..fd196f2f
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/EACdKey.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class EACdKey
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("ereg.ea-europe.com"))
+ return "EA CdKey Registration Module";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/EXEStealth.cs b/BurnOutSharp/ProtectionType/EXEStealth.cs
new file mode 100644
index 00000000..fe03597c
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/EXEStealth.cs
@@ -0,0 +1,17 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class EXEStealth
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("??[[__[[_" + (char)0x00 + "{{" + (char)0x0
+ + (char)0x00 + "{{" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0
+ + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "?;??;??"))
+ {
+ return "EXE Stealth";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/FADE.cs b/BurnOutSharp/ProtectionType/FADE.cs
new file mode 100644
index 00000000..6c8276a9
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/FADE.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class FADE
+ {
+ // TODO: Implement - http://www.codemasters.com/news/displayarticles.php?showarticle=500
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/FreeLock.cs b/BurnOutSharp/ProtectionType/FreeLock.cs
new file mode 100644
index 00000000..b5f1459d
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/FreeLock.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class FreeLock
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("FREELOCK.IMG", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "FreeLock";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("FREELOCK.IMG", StringComparison.OrdinalIgnoreCase))
+ return "FreeLock";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs
new file mode 100644
index 00000000..59fc939e
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/GFWL.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class GFWL
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("xlive.dll"))
+ return "Games for Windows - Live";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("XLiveRedist.msi", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Games for Windows - Live";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("XLiveRedist.msi", StringComparison.OrdinalIgnoreCase))
+ return "Games for Windows - Live";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/HexalockAutoLock.cs b/BurnOutSharp/ProtectionType/HexalockAutoLock.cs
new file mode 100644
index 00000000..ac662eba
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/HexalockAutoLock.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class HexalockAutoLock
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("Start_Here.exe", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("HCPSMng.exe", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("MFINT.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("MFIMP.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "Hexalock AutoLock";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("Start_Here.exe", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("HCPSMng.exe", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("MFINT.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("MFIMP.DLL", StringComparison.OrdinalIgnoreCase))
+ {
+ return "Hexalock AutoLock";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs
new file mode 100644
index 00000000..5da16b39
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class ImpulseReactor
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ if (fileContent.Contains("CVPInitializeClient"))
+ {
+ if (fileContent.Contains("A" + (char)0x00 + "T" + (char)0x00 + "T" + (char)0x00 + "L" + (char)0x00 + "I"
+ + (char)0x00 + "S" + (char)0x00 + "T" + (char)0x00 + (char)0x00 + (char)0x00 + "E" + (char)0x00 + "L"
+ + (char)0x00 + "E" + (char)0x00 + "M" + (char)0x00 + "E" + (char)0x00 + "N" + (char)0x00 + "T" + (char)0x00
+ + (char)0x00 + (char)0x00 + "N" + (char)0x00 + "O" + (char)0x00 + "T" + (char)0x00 + "A" + (char)0x00 + "T"
+ + (char)0x00 + "I" + (char)0x00 + "O" + (char)0x00 + "N"))
+ {
+ return "Impulse Reactor " + Utilities.GetFileVersion(file);
+ }
+ else
+ {
+ return "Impulse Reactor";
+ }
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("ImpulseReactor.dll", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Impulse Reactor " + Utilities.GetFileVersion(files.First(f => Path.GetFileName(f).Equals("ImpulseReactor.dll", StringComparison.OrdinalIgnoreCase)));
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("ImpulseReactor.dll", StringComparison.OrdinalIgnoreCase))
+ return "Impulse Reactor " + Utilities.GetFileVersion(path);
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/IndyVCD.cs b/BurnOutSharp/ProtectionType/IndyVCD.cs
new file mode 100644
index 00000000..53d42bea
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/IndyVCD.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class IndyVCD
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("INDYVCD.AX", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("INDYMP3.idt", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "IndyVCD";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("INDYVCD.AX", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("INDYMP3.idt", StringComparison.OrdinalIgnoreCase))
+ {
+ return "IndyVCD";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/InnoSetup.cs b/BurnOutSharp/ProtectionType/InnoSetup.cs
new file mode 100644
index 00000000..07d1e96c
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/InnoSetup.cs
@@ -0,0 +1,45 @@
+using System.IO;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class InnoSetup
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ if (fileContent.IndexOf("Inno") == 0x30)
+ {
+ // TOOO: Add Inno Setup extraction
+ return "Inno Setup " + GetVersion(file);
+ }
+
+ return null;
+ }
+
+ private static string GetVersion(string file)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(0x30, SeekOrigin.Begin);
+ string signature = new string(br.ReadChars(12));
+
+ if (signature == "rDlPtS02" + (char)0x87 + "eVx")
+ return "1.2.10";
+ else if (signature == "rDlPtS04" + (char)0x87 + "eVx")
+ return "4.0.0";
+ else if (signature == "rDlPtS05" + (char)0x87 + "eVx")
+ return "4.0.3";
+ else if (signature == "rDlPtS06" + (char)0x87 + "eVx")
+ return "4.0.10";
+ else if (signature == "rDlPtS07" + (char)0x87 + "eVx")
+ return "4.1.6";
+ else if (signature == "rDlPtS" + (char)0xcd + (char)0xe6 + (char)0xd7 + "{" + (char)0x0b + "*")
+ return "5.1.5";
+ else if (signature == "nS5W7dT" + (char)0x83 + (char)0xaa + (char)0x1b + (char)0x0f + "j")
+ return "5.1.5";
+
+ return string.Empty;
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs
new file mode 100644
index 00000000..80dfa1d5
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs
@@ -0,0 +1,49 @@
+using System.IO;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class JoWooDXProt
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if (fileContent.Contains(".ext "))
+ {
+ if ((position = fileContent.IndexOf("kernel32.dll" + (char)0x00 + (char)0x00 + (char)0x00 + "VirtualProtect")) > -1)
+ {
+ return "JoWooD X-Prot " + GetVersion(file, --position);
+ }
+ else
+ {
+ return "JoWooD X-Prot v1";
+ }
+ }
+ else if (fileContent.Contains("@HC09 "))
+ {
+ return "JoWooD X-Prot v2";
+ }
+
+ return null;
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ char[] version = new char[5];
+ br.BaseStream.Seek(position + 67, SeekOrigin.Begin);
+ version[0] = br.ReadChar();
+ br.ReadByte();
+ version[1] = br.ReadChar();
+ br.ReadByte();
+ version[2] = br.ReadChar();
+ br.ReadByte();
+ version[3] = br.ReadChar();
+ version[4] = br.ReadChar();
+
+ return version[0] + "." + version[1] + "." + version[2] + "." + version[3] + version[4];
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Key2AudioXS.cs b/BurnOutSharp/ProtectionType/Key2AudioXS.cs
new file mode 100644
index 00000000..8888ffcb
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Key2AudioXS.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Key2AudioXS
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("SDKHM.EXE", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SDKHM.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "Key2Audio XS";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("SDKHM.EXE", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SDKHM.DLL", StringComparison.OrdinalIgnoreCase))
+ {
+ return "Key2Audio XS";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs
new file mode 100644
index 00000000..802db143
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/KeyLock.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class KeyLock
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("KEY-LOCK COMMAND"))
+ return "Key-Lock (Dongle)";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs
new file mode 100644
index 00000000..68d264a0
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/LaserLock.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class LaserLock
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if (fileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE")
+ && (position = fileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
+ + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00
+ + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF")) > -1)
+ {
+ return "LaserLock " + GetVersion(fileContent, position) + " " + GetBuild(fileContent, true);
+ }
+
+ else if (fileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE"))
+ {
+ return "LaserLock Marathon " + GetBuild(fileContent, false);
+ }
+
+ else if ((position = fileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
+ + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00
+ + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF")) > -1)
+ {
+ return "LaserLock " + GetVersion(fileContent, --position) + " " + GetBuild(fileContent, false);
+ }
+
+ else if (Path.GetFileName(file) == "NOMOUSE.SP")
+ {
+ return "LaserLock " + GetVersion16Bit(file);
+ }
+
+ else if (fileContent.Contains(":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP"))
+ {
+ return "LaserLock 3";
+ }
+
+ else if (fileContent.Contains("LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK"
+ + (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3"))
+ {
+ return "LaserLock 5";
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (Directory.Exists(Path.Combine(path, "LASERLOK")))
+ {
+ return "LaserLock";
+ }
+
+ // TODO: Verify if these are OR or AND
+ else if (files.Count(f => Path.GetFileName(f).Equals("NOMOUSE.SP", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("NOMOUSE.COM", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("l16dll.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("laserlok.in", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("laserlok.o10", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("laserlok.011", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "LaserLock";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("NOMOUSE.SP", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("NOMOUSE.COM", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("l16dll.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("laserlok.in", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("laserlok.o10", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("laserlok.011", StringComparison.OrdinalIgnoreCase))
+ {
+ return "LaserLock";
+ }
+ }
+
+ return null;
+ }
+
+ private static string GetBuild(string fileContent, bool versionTwo)
+ {
+ // TODO: Is this supposed to be "Unknown"?
+ int position = fileContent.IndexOf("Unkown" + (char)0 + "Unkown");
+ string year, month, day;
+ if (versionTwo)
+ {
+ day = fileContent.Substring(position + 14, 2);
+ month = fileContent.Substring(position + 14 + 3, 2);
+ year = "20" + fileContent.Substring(position + 14 + 6, 2);
+ }
+ else
+ {
+ day = fileContent.Substring(position + 13, 2);
+ month = fileContent.Substring(position + 13 + 3, 2);
+ year = "20" + fileContent.Substring(position + 13 + 6, 2);
+ }
+
+ return "(Build " + year + "-" + month + "-" + day + ")";
+ }
+
+ private static string GetVersion(string FileContent, int position)
+ {
+ return FileContent.Substring(position + 76, 4);
+ }
+
+ private static string GetVersion16Bit(string file)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ char[] version = new char[3];
+ br.BaseStream.Seek(71, SeekOrigin.Begin);
+ version[0] = br.ReadChar();
+ br.ReadByte();
+ version[1] = br.ReadChar();
+ version[2] = br.ReadChar();
+
+ if (char.IsNumber(version[0]) && char.IsNumber(version[1]) && char.IsNumber(version[2]))
+ return version[0] + "." + version[1] + version[2];
+
+ return "";
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/LockBlocks.cs b/BurnOutSharp/ProtectionType/LockBlocks.cs
new file mode 100644
index 00000000..600f0728
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/LockBlocks.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class LockBlocks
+ {
+ // TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_lockblocks.shtml
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/MediaCloQ.cs b/BurnOutSharp/ProtectionType/MediaCloQ.cs
new file mode 100644
index 00000000..1b49d058
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/MediaCloQ.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class MediaCloQ
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("sunncomm.ico", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "MediaCloQ";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("sunncomm.ico", StringComparison.OrdinalIgnoreCase))
+ return "MediaCloQ";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs
new file mode 100644
index 00000000..40c17d5e
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class MediaMaxCD3
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("LaunchCd.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "MediaMax CD3";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("LaunchCd.exe", StringComparison.OrdinalIgnoreCase))
+ return "MediaMax CD3";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/MusicGuard.cs b/BurnOutSharp/ProtectionType/MusicGuard.cs
new file mode 100644
index 00000000..2f0397e9
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/MusicGuard.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class MusicGuard
+ {
+ // TODO: Implement - http://web.archive.org/web/20020606000647/http://www.musicguard.com
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs
new file mode 100644
index 00000000..7653820c
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Origin.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Origin
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("OriginSetup.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Origin";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("OriginSetup.exe", StringComparison.OrdinalIgnoreCase))
+ return "Origin";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/PECompact.cs b/BurnOutSharp/ProtectionType/PECompact.cs
new file mode 100644
index 00000000..a38d2af5
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/PECompact.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class PECompact
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("PEC2"))
+ return "PE Compact 2";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
new file mode 100644
index 00000000..1ce4c55e
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
@@ -0,0 +1,53 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class PSXAntiModchip
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ if (fileContent.Contains(" SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690"))
+ return "PlayStation Anti-modchip (English)";
+ else if (fileContent.Contains("強制終了しました。\n本体が改造されている\nおそれがあります。"))
+ return "PlayStation Anti-modchip (Japanese)";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Where(s => s.ToLowerInvariant().EndsWith(".cnf")).Count() > 0)
+ {
+ foreach (string file in files)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var sr = new StreamReader(fs))
+ {
+ string fileContent = sr.ReadToEnd();
+ string protection = CheckContents(path, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ return protection;
+ }
+ }
+ }
+ }
+ else
+ {
+ using (var fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var sr = new StreamReader(fs))
+ {
+ string fileContent = sr.ReadToEnd();
+ string protection = CheckContents(path, fileContent);
+ if (!string.IsNullOrWhiteSpace(protection))
+ return protection;
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Phenoprotect.cs b/BurnOutSharp/ProtectionType/Phenoprotect.cs
new file mode 100644
index 00000000..1de32b27
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Phenoprotect.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class Phenoprotect
+ {
+ // TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_phenoprotect.shtml
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs b/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
new file mode 100644
index 00000000..451cc0ee
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class ProtectDVDVideo
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (!isDirectory)
+ return null;
+
+ 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++)
+ {
+ FileInfo ifofile = new FileInfo(ifofiles[i]);
+ if (ifofile.Length == 0)
+ return "Protect DVD-Video";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs
new file mode 100644
index 00000000..f2633ee3
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs
@@ -0,0 +1,157 @@
+using System;
+using System.IO;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class ProtectDisc
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("HúMETINF")) > -1)
+ {
+ string version = EVORE.SearchProtectDiscVersion(file);
+ if (version.Length > 0)
+ {
+ string[] astrVersionArray = version.Split('.');
+ if (astrVersionArray[0] == "9")
+ {
+ if (GetVersionBuild76till10(file, position, out int ibuild).Length > 0)
+ return "ProtectDisc " + astrVersionArray[0] + "." + astrVersionArray[1] + astrVersionArray[2] + "." + astrVersionArray[3] + " (Build " + ibuild + ")";
+ }
+ else
+ return "ProtectDisc " + astrVersionArray[0] + "." + astrVersionArray[1] + "." + astrVersionArray[2] + " (Build " + astrVersionArray[3] + ")";
+ }
+ }
+
+ if ((position = fileContent.IndexOf("ACE-PCD")) > -1)
+ {
+ string version = EVORE.SearchProtectDiscVersion(file);
+ if (version.Length > 0)
+ {
+ string[] astrVersionArray = version.Split('.');
+ return "ProtectDisc " + astrVersionArray[0] + "." + astrVersionArray[1] + "." + astrVersionArray[2] + " (Build " + astrVersionArray[3] + ")";
+ }
+
+ return "ProtectDisc " + GetVersionBuild6till8(file, position);
+ }
+
+ return null;
+ }
+
+ private static string GetVersionBuild6till8(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ string version;
+ string strBuild;
+
+ br.BaseStream.Seek(position - 12, SeekOrigin.Begin);
+ if (br.ReadByte() == 0xA && br.ReadByte() == 0xD && br.ReadByte() == 0xA && br.ReadByte() == 0xD) // ProtectDisc 6-7 with Build Number in plain text
+ {
+ br.BaseStream.Seek(position - 12 - 6, SeekOrigin.Begin);
+ if (new string(br.ReadChars(6)) == "Henrik") // ProtectDisc 7
+ {
+ version = "7.1-7.5";
+ br.BaseStream.Seek(position - 12 - 6 - 6, SeekOrigin.Begin);
+ }
+ else // ProtectDisc 6
+ {
+ version = "6";
+ br.BaseStream.Seek(position - 12 - 10, SeekOrigin.Begin);
+ while (true) //search for e.g. "Build 050913 - September 2005"
+ {
+ if (Char.IsNumber(br.ReadChar()))
+ break;
+ br.BaseStream.Seek(-2, SeekOrigin.Current); //search upwards
+ }
+
+ br.BaseStream.Seek(-5, SeekOrigin.Current);
+ }
+ }
+ else
+ {
+ br.BaseStream.Seek(position + 28, SeekOrigin.Begin);
+ if (br.ReadByte() == 0xFB)
+ {
+ return "7.6-7.x";
+ }
+ else
+ {
+ return "8.0";
+ }
+ }
+ strBuild = "" + br.ReadChar() + br.ReadChar() + br.ReadChar() + br.ReadChar() + br.ReadChar();
+ return version + " (Build " + strBuild + ")";
+ }
+ }
+
+ private static string GetVersionBuild76till10(string file, int position, out int irefBuild)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 37, SeekOrigin.Begin);
+ byte subversion = br.ReadByte();
+ br.ReadByte();
+ byte version = br.ReadByte();
+ br.BaseStream.Seek(position + 49, SeekOrigin.Begin);
+ irefBuild = br.ReadInt32();
+ br.BaseStream.Seek(position + 53, SeekOrigin.Begin);
+ byte versionindicatorPD9 = br.ReadByte();
+ br.BaseStream.Seek(position + 0x40, SeekOrigin.Begin);
+ byte subsubversionPD9x = br.ReadByte();
+ byte subversionPD9x2 = br.ReadByte();
+ byte subversionPD9x1 = br.ReadByte();
+
+ // version 7
+ if (version == 0xAC)
+ return "7." + (subversion ^ 0x43) + " (Build " + irefBuild + ")";
+ // version 8
+ else if (version == 0xA2)
+ {
+ if (subversion == 0x46)
+ {
+ if ((irefBuild & 0x3A00) == 0x3A00)
+ return "8.2" + " (Build " + irefBuild + ")";
+ else
+ return "8.1" + " (Build " + irefBuild + ")";
+ }
+ return "8." + (subversion ^ 0x47) + " (Build " + irefBuild + ")";
+ }
+ // version 9
+ else if (version == 0xA3)
+ {
+ // version removed or not given
+ if ((subversionPD9x2 == 0x5F && subversionPD9x1 == 0x61) || (subversionPD9x1 == 0 && subversionPD9x2 == 0))
+ {
+ if (versionindicatorPD9 == 0xB)
+ return "9.0-9.4" + " (Build " + irefBuild + ")";
+ else if (versionindicatorPD9 == 0xC)
+ {
+ if (subversionPD9x2 == 0x5F && subversionPD9x1 == 0x61)
+ return "9.5-9.11" + " (Build " + irefBuild + ")";
+ else if (subversionPD9x1 == 0 && subversionPD9x2 == 0)
+ return "9.11-9.20" + " (Build " + irefBuild + ")";
+ }
+ else
+ return "9." + subversionPD9x1 + subversionPD9x2 + "." + subsubversionPD9x + " (Build " + irefBuild + ")";
+ }
+ }
+ else if (version == 0xA0)
+ {
+ // version removed
+ if (subversionPD9x1 != 0 || subversionPD9x2 != 0)
+ return "10." + subversionPD9x1 + "." + subsubversionPD9x + " (Build " + irefBuild + ")";
+ else
+ return "10.x (Build " + irefBuild + ")";
+ }
+ else
+ return "7.6-10.x (Build " + irefBuild + ")";
+
+ return "";
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs
new file mode 100644
index 00000000..ffa50b12
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class RingPROTECH
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains((char)0x00 + "Allocator" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00))
+ return "Ring PROTECH";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Roxxe.cs b/BurnOutSharp/ProtectionType/Roxxe.cs
new file mode 100644
index 00000000..ac88614c
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Roxxe.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class Roxxe
+ {
+ // TODO: Implement - http://web.archive.org/web/20050309084802/http://www.roxxe.cz
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SAFEAUDIO.cs b/BurnOutSharp/ProtectionType/SAFEAUDIO.cs
new file mode 100644
index 00000000..717226c2
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SAFEAUDIO.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class SAFEAUDIO
+ {
+ // TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_safeaudio.shtml
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs
new file mode 100644
index 00000000..0dbb00c8
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SVKProtector.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class SVKProtector
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("?SVKP" + (char)0x00 + (char)0x00))
+ return "SVK Protector";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SafeCast.cs b/BurnOutSharp/ProtectionType/SafeCast.cs
new file mode 100644
index 00000000..065cb5ac
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SafeCast.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SafeCast
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("cdac11ba.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "SafeCast";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("cdac11ba.exe", StringComparison.OrdinalIgnoreCase))
+ return "SafeCast";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs
new file mode 100644
index 00000000..8c4d0c25
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SafeDisc.cs
@@ -0,0 +1,204 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SafeDisc
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: These are all cop-outs that don't check the existence of the other files
+ if (files.Count(f => Path.GetFileName(f).Equals("DPLAYERX.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return GetDPlayerXVersion(path);
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("drvmgt.dll", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return GetDrvmgtVersion(path);
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("secdrv.sys", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return GetSecdrvVersion(path);
+ }
+ }
+ else
+ {
+ // V1
+ if (Path.GetFileName(path).Equals("CLCD16.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CLCD32.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CLOKSPL.EXE", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("icd", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("016", StringComparison.OrdinalIgnoreCase)
+ || Path.GetExtension(path).Trim('.').Equals("256", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SafeDisc 1";
+ }
+
+ // V1 or greater
+ else if (Path.GetFileName(path).Equals("00000001.TMP", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CLCD32.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CLOKSPL.EXE", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SafeDisc 1 or greater";
+ }
+
+ // V2 or greater
+ else if (Path.GetFileName(path).Equals("00000002.TMP", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SafeDisc 2 or greater";
+ }
+
+ // Specific Versions
+ else if (Path.GetFileName(path).Equals("DPLAYERX.DLL", StringComparison.OrdinalIgnoreCase))
+ {
+ return GetDPlayerXVersion(path);
+ }
+ else if (Path.GetFileName(path).Equals("drvmgt.dll", StringComparison.OrdinalIgnoreCase))
+ {
+ return GetDrvmgtVersion(path);
+ }
+ else if (Path.GetFileName(path).Equals("secdrv.sys", StringComparison.OrdinalIgnoreCase))
+ {
+ return GetSecdrvVersion(path);
+ }
+ }
+
+ return null;
+ }
+
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("BoG_ *90.0&!! Yy>")) > -1)
+ {
+ if (fileContent.IndexOf("product activation library") > 0)
+ return "SafeCast " + GetVersion(file, position);
+ else
+ return "SafeDisc " + GetVersion(file, position);
+ }
+
+ if (fileContent.Contains((char)0x00 + (char)0x00 + "BoG_")
+ || fileContent.Contains("stxt774")
+ || fileContent.Contains("stxt371"))
+ {
+ string version = EVORE.SearchSafeDiscVersion(file);
+ if (version.Length > 0)
+ return "SafeDisc " + version;
+
+ return "SafeDisc 3.20-4.xx (version removed)";
+ }
+
+ return null;
+ }
+
+ private static string GetDPlayerXVersion(string file)
+ {
+ FileInfo fi = new FileInfo(file);
+ if (fi.Length == 81408)
+ return "SafeDisc 1.0x";
+ else if (fi.Length == 155648)
+ return "SafeDisc 1.1x";
+ else if (fi.Length == 156160)
+ return "SafeDisc 1.1x-1.2x";
+ else if (fi.Length == 163328)
+ return "SafeDisc 1.3x";
+ else if (fi.Length == 165888)
+ return "SafeDisc 1.35";
+ else if (fi.Length == 172544)
+ return "SafeDisc 1.40";
+ else if (fi.Length == 173568)
+ return "SafeDisc 1.4x";
+ else if (fi.Length == 136704)
+ return "SafeDisc 1.4x";
+ else if (fi.Length == 138752)
+ return "SafeDisc 1.5x";
+ else
+ return "SafeDisc 1";
+ }
+
+ private static string GetDrvmgtVersion(string file)
+ {
+ FileInfo fi = new FileInfo(file);
+ if (fi.Length == 34816)
+ return "SafeDisc 1.0x";
+ else if (fi.Length == 32256)
+ return "SafeDisc 1.1x-1.3x";
+ else if (fi.Length == 31744)
+ return "SafeDisc 1.4x";
+ else if (fi.Length == 34304)
+ return "SafeDisc 1.5x-2.40";
+ else if (fi.Length == 35840)
+ return "SafeDisc 2.51-2.60";
+ else if (fi.Length == 40960)
+ return "SafeDisc 2.70";
+ else if (fi.Length == 23552)
+ return "SafeDisc 2.80";
+ else if (fi.Length == 41472)
+ return "SafeDisc 2.90-3.10";
+ else if (fi.Length == 24064)
+ return "SafeDisc 3.15-3.20";
+ else
+ return "SafeDisc 1 or greater";
+ }
+
+ private static string GetSecdrvVersion(string file)
+ {
+ FileInfo fi = new FileInfo(file);
+ if (fi.Length == 20128)
+ return "SafeDisc 2.10";
+ else if (fi.Length == 27440)
+ return "SafeDisc 2.30";
+ else if (fi.Length == 28624)
+ return "SafeDisc 2.40";
+ else if (fi.Length == 18768)
+ return "SafeDisc 2.50";
+ else if (fi.Length == 28400)
+ return "SafeDisc 2.51";
+ else if (fi.Length == 29392)
+ return "SafeDisc 2.60";
+ else if (fi.Length == 11376)
+ return "SafeDisc 2.70";
+ else if (fi.Length == 12464)
+ return "SafeDisc 2.80";
+ else if (fi.Length == 12400)
+ return "SafeDisc 2.90";
+ else if (fi.Length == 12528)
+ return "SafeDisc 3.10";
+ else if (fi.Length == 12528)
+ return "SafeDisc 3.15";
+ else if (fi.Length == 11973)
+ return "SafeDisc 3.20";
+ else
+ return "SafeDisc 2 or greater";
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 20, SeekOrigin.Begin); // Begin reading after "BoG_ *90.0&!! Yy>" for old SafeDisc
+ int version = br.ReadInt32();
+ int subVersion = br.ReadInt32();
+ int subsubVersion = br.ReadInt32();
+
+ if (version != 0)
+ return version + "." + subVersion.ToString("00") + "." + subsubVersion.ToString("000");
+
+ br.BaseStream.Seek(position + 18 + 14, SeekOrigin.Begin); // Begin reading after "BoG_ *90.0&!! Yy>" for newer SafeDisc
+ version = br.ReadInt32();
+ subVersion = br.ReadInt32();
+ subsubVersion = br.ReadInt32();
+
+ if (version == 0)
+ return "";
+
+ return version + "." + subVersion.ToString("00") + "." + subsubVersion.ToString("000");
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SafeDiscLite.cs b/BurnOutSharp/ProtectionType/SafeDiscLite.cs
new file mode 100644
index 00000000..ffe05eec
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SafeDiscLite.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SafeDiscLite
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("00000001.LT1", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "SafeDisc Lite";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("00000001.LT1", StringComparison.OrdinalIgnoreCase))
+ return "SafeDisc Lite";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs
new file mode 100644
index 00000000..af1c6085
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SafeLock.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SafeLock
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("SafeLock"))
+ return "SafeLock";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("SafeLock.dat", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SafeLock.001", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SafeLock.128", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "SafeLock";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("SafeLock.dat", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SafeLock.001", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SafeLock.128", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SafeLock";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs
new file mode 100644
index 00000000..44440401
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SecuROM.cs
@@ -0,0 +1,161 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SecuROM
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("AddD" + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00)) > -1)
+ {
+ return "SecuROM " + GetV4Version(file, position);
+ }
+
+ else if ((position = fileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1)
+ {
+ return "SecuROM " + GetV5Version(file, position);
+ }
+
+ else if (fileContent.Contains(".securom")
+ || fileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0))
+ {
+ return "SecuROM " + GetV7Version(file);
+ }
+
+ else if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
+ {
+ return "SecuROM Product Activation " + Utilities.GetFileVersion(file);
+ }
+
+ else if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
+ {
+ return "SecuROM Product Activation " + Utilities.GetFileVersion(file);
+ }
+
+ else if (fileContent.Contains(".cms_t" + (char)0x00)
+ || fileContent.Contains(".cms_d" + (char)0x00))
+ {
+ return "SecuROM 1-3";
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("CMS16.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CMS_95.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CMS_NT.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CMS32_95.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("CMS32_NT.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "SecuROM";
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("SINTF32.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SINTF16.DLL", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SINTFNT.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "SecuROM New";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("CMS16.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CMS_95.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CMS_NT.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CMS32_95.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("CMS32_NT.DLL", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SecuROM";
+ }
+ else if (Path.GetFileName(path).Equals("SINTF32.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SINTF16.DLL", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SINTFNT.DLL", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SecuROM New";
+ }
+ }
+
+ return null;
+ }
+
+ private static string GetV4Version(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 8, SeekOrigin.Begin); // Begin reading after "AddD"
+ char version = br.ReadChar();
+ br.ReadByte();
+ char subVersion1 = br.ReadChar();
+ char subVersion2 = br.ReadChar();
+ br.ReadByte();
+ char subsubVersion1 = br.ReadChar();
+ char subsubVersion2 = br.ReadChar();
+ br.ReadByte();
+ char subsubsubVersion1 = br.ReadChar();
+ char subsubsubVersion2 = br.ReadChar();
+ char subsubsubVersion3 = br.ReadChar();
+ char subsubsubVersion4 = br.ReadChar();
+
+ return version + "." + subVersion1 + subVersion2 + "." + subsubVersion1 + subsubVersion2 + "." + subsubsubVersion1 + subsubsubVersion2 + subsubsubVersion3 + subsubsubVersion4;
+ }
+ }
+
+ private static string GetV5Version(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 8, SeekOrigin.Begin); // Begin reading after "ÊÝݬ"
+ byte version = (byte)(br.ReadByte() & 0xF);
+ br.ReadByte();
+ byte subVersion1 = (byte)(br.ReadByte() ^ 36);
+ byte subVersion2 = (byte)(br.ReadByte() ^ 28);
+ br.ReadByte();
+ byte subsubVersion1 = (byte)(br.ReadByte() ^ 42);
+ byte subsubVersion2 = (byte)(br.ReadByte() ^ 8);
+ br.ReadByte();
+ byte subsubsubVersion1 = (byte)(br.ReadByte() ^ 16);
+ byte subsubsubVersion2 = (byte)(br.ReadByte() ^ 116);
+ byte subsubsubVersion3 = (byte)(br.ReadByte() ^ 34);
+ byte subsubsubVersion4 = (byte)(br.ReadByte() ^ 22);
+
+ if (version == 0 || version > 9)
+ return "";
+
+ return version + "." + subVersion1 + subVersion2 + "." + subsubVersion1 + subsubVersion2 + "." + subsubsubVersion1 + subsubsubVersion2 + subsubsubVersion3 + subsubsubVersion4;
+ }
+ }
+
+ private static string GetV7Version(string file)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(236, SeekOrigin.Begin);
+ byte[] bytes = br.ReadBytes(4);
+ // if (bytes[0] == 0xED && bytes[3] == 0x5C {
+ if (bytes[3] == 0x5C)
+ {
+ //SecuROM 7 new and 8
+ return (bytes[0] ^ 0xEA).ToString() + "." + (bytes[1] ^ 0x2C).ToString("00") + "." + (bytes[2] ^ 0x8).ToString("0000");
+ }
+ else // SecuROM 7 old
+ {
+ br.BaseStream.Seek(122, SeekOrigin.Begin);
+ bytes = br.ReadBytes(2);
+ return "7." + (bytes[0] ^ 0x10).ToString("00") + "." + (bytes[1] ^ 0x10).ToString("0000");
+ //return "7.01-7.10"
+ }
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs
new file mode 100644
index 00000000..a26bc552
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SmartE.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SmartE
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("BITARTS"))
+ return "SmartE";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("00001.TMP", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("00002.TMP", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "SmartE";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("00001.TMP", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("00002.TMP", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SmartE";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SoftLock.cs b/BurnOutSharp/ProtectionType/SoftLock.cs
new file mode 100644
index 00000000..ba3f594d
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SoftLock.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SoftLock
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("SOFTLOCKI.dat", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SOFTLOCKC.dat", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "SoftLock";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("SOFTLOCKI.dat", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SOFTLOCKC.dat", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SoftLock";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs
new file mode 100644
index 00000000..7b81c0cf
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/SolidShield.cs
@@ -0,0 +1,143 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class SolidShield
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if (fileContent.Contains("D" + (char)0x00 + "V" + (char)0x00 + "M" + (char)0x00 + " " + (char)0x00 + "L" + (char)0x00
+ + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y"))
+ {
+ return "SolidShield " + Utilities.GetFileVersion(file);
+ }
+
+ else if (fileContent.Contains("S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00
+ + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00
+ + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00
+ + "r" + (char)0x00 + "y")
+ || fileContent.Contains("S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00
+ + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00
+ + " " + (char)0x00 + "A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00
+ + "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00
+ + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y"))
+ {
+ string companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
+ if (companyName.Contains("solidshield") || companyName.Contains("tages"))
+ return "SolidShield Core.dll " + Utilities.GetFileVersion(file);
+ }
+
+ else if ((position = fileContent.IndexOf("" + (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE)) > -1)
+ {
+ var id1 = fileContent.Substring(position + 5, 3);
+ var id2 = fileContent.Substring(position + 16, 4);
+
+ if (id1 == "" + (char)0x00 + (char)0x00 + (char)0x00 && id2 == "" + (char)0x00 + (char)0x10 + (char)0x00 + (char)0x00)
+ return "SolidShield 1 (SolidShield EXE Wrapper)";
+ else if (id1 == ".o&" && id2 == "ÛÅ›¹")
+ return "SolidShield 2 (SolidShield v2 EXE Wrapper)"; // TODO: Verify against other SolidShield 2 discs
+ }
+
+ else if (fileContent.Contains("A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00
+ + "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00
+ + "M" + (char)0x00 + "a" + (char)0x00 + "n" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "r"))
+ {
+ string companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
+ if (companyName.Contains("solidshield") || companyName.Contains("tages"))
+ return "SolidShield Activation Manager Module " + Utilities.GetFileVersion(file);
+ }
+
+ else if ((position = fileContent.IndexOf("" + (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA)) > -1)
+ {
+ if ((fileContent[position + 3] == (char)0x04 || fileContent[position + 3] == (char)0x05)
+ && fileContent.Substring(position + 4, 3) == "" + (char)0x00 + (char)0x00 + (char)0x00
+ && fileContent.Substring(position + 15, 4) == "" + (char)0x00 + (char)0x10 + (char)0x00 + (char)0x00)
+ {
+ return "SolidShield 2 (SolidShield v2 EXE Wrapper)";
+ }
+ else if (fileContent.Substring(position + 4, 3) == "" + (char)0x00 + (char)0x00 + (char)0x00
+ && fileContent.Substring(position + 15, 4) == "" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00)
+ {
+ position = fileContent.IndexOf("T" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "s"
+ + (char)0x00 + "S" + (char)0x00 + "e" + (char)0x00 + "t" + (char)0x00 + "u" + (char)0x00 + "p"
+ + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "0" + (char)0x00 + (char)0x8
+ + (char)0x00 + (char)0x1 + (char)0x0 + "F" + (char)0x00 + "i" + (char)0x00 + "l" + (char)0x00 + "e"
+ + (char)0x00 + "V" + (char)0x00 + "e" + (char)0x00 + "r" + (char)0x00 + "s" + (char)0x00 + "i" + (char)0x00
+ + "o" + (char)0x00 + "n" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00);
+ if (position > -1)
+ {
+ position--; // TODO: Verify this subtract
+ return "SolidShield 2 + Tagès " + fileContent.Substring(position + 0x38, 1) + "." + fileContent.Substring(position + 0x38 + 4, 1) + "." + fileContent.Substring(position + 0x38 + 8, 1) + "." + fileContent.Substring(position + 0x38 + 12, 1);
+ }
+ else
+ {
+ return "SolidShield 2 (SolidShield v2 EXE Wrapper)";
+ }
+ }
+ }
+
+ else if ((position = fileContent.IndexOf("Solidshield")) > 0)
+ {
+ return "SolidShield " + GetVersion(file, position);
+ }
+
+ else if (fileContent.Contains("B" + (char)0x00 + "I" + (char)0x00 + "N" + (char)0x00 + (char)0x7 + (char)0x00 +
+ "I" + (char)0x00 + "D" + (char)0x00 + "R" + (char)0x00 + "_" + (char)0x00 +
+ "S" + (char)0x00 + "G" + (char)0x00 + "T" + (char)0x0))
+ {
+ return "SolidShield";
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("dvm.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("hc.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("solidshield-cd.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("c11prot.dll", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "SolidShield";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("dvm.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("hc.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("solidshield-cd.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("c11prot.dll", StringComparison.OrdinalIgnoreCase))
+ {
+ return "SolidShield";
+ }
+ }
+
+ return null;
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 12, SeekOrigin.Begin); // Begin reading after "Solidshield"
+ char version = br.ReadChar();
+ br.ReadByte();
+ char subVersion = br.ReadChar();
+ br.ReadByte();
+ char subsubVersion = br.ReadChar();
+ br.ReadByte();
+ char subsubsubVersion = br.ReadChar();
+ return version + "." + subVersion + "." + subsubVersion + "." + subsubsubVersion;
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs
new file mode 100644
index 00000000..07f89e45
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/StarForce.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class StarForce
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if (fileContent.Contains("(" + (char)0x00 + "c" + (char)0x00 + ")" + (char)0x00 + " " + (char)0x00 + "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)
+ || fileContent.Contains("Protection Technology, Ltd."))
+ {
+ //if (FileContent.Contains("PSA_GetDiscLabel")
+ //if (FileContent.Contains("(c) Protection Technology")
+ position = fileContent.IndexOf("TradeName") - 1;
+ if (position != -1 && position != -2)
+ return "StarForce " + Utilities.GetFileVersion(file) + " (" + fileContent.Substring(position + 22, 30).Split((char)0x00)[0] + ")";
+ else
+ return "StarForce " + Utilities.GetFileVersion(file);
+ }
+
+ else if (fileContent.Contains(".sforce")
+ || fileContent.Contains(".brick"))
+ {
+ return "StarForce 3-5";
+ }
+
+ else if (fileContent.Contains("P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00
+ + "c" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "M" + (char)0x00
+ + "o" + (char)0x00 + "d" + (char)0x00 + "u" + (char)0x00 + "l" + (char)0x00 + "e"))
+ {
+ return "StarForce 5";
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("protect.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("protect.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "StarForce";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("protect.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("protect.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "StarForce";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Steam.cs b/BurnOutSharp/ProtectionType/Steam.cs
new file mode 100644
index 00000000..0e0834ce
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Steam.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Steam
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("SteamInstall.exe", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SteamInstall.ini", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SteamInstall.msi", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SteamRetailInstaller.dmg", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("SteamSetup.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "Steam";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("SteamInstall.exe", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SteamInstall.ini", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SteamInstall.msi", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SteamRetailInstaller.dmg", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("SteamSetup.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "Steam";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs
new file mode 100644
index 00000000..2fc5ad54
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Sysiphus.cs
@@ -0,0 +1,36 @@
+using System.IO;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Sysiphus
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("V SUHPISYSDVD")) > -1)
+ return "Sysiphus DVD " + GetVersion(file, position);
+
+ if ((position = fileContent.IndexOf("V SUHPISYS")) > -1)
+ return "Sysiphus " + GetVersion(file, position);
+
+ return null;
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position - 3, SeekOrigin.Begin);
+ char subVersion = br.ReadChar();
+ br.ReadChar();
+ char version = br.ReadChar();
+
+ if (char.IsNumber(version) && char.IsNumber(subVersion))
+ return version + "." + subVersion;
+ else
+ return "";
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/TZCopyProtector.cs b/BurnOutSharp/ProtectionType/TZCopyProtector.cs
new file mode 100644
index 00000000..043513e4
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/TZCopyProtector.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class TZCopyProtector
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("_742893.016", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "TZCopyProtector";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("_742893.016", StringComparison.OrdinalIgnoreCase))
+ return "TZCopyProtector";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs
new file mode 100644
index 00000000..62c658bd
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Tages.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Tages
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if (fileContent.Contains("protected-tages-runtime.exe") ||
+ fileContent.Contains("tagesprotection.com"))
+ return "TAGES " + Utilities.GetFileVersion(file);
+
+ if ((position = fileContent.IndexOf("" + (char)0xE8 + "u" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0xE8)) > -1
+ && fileContent.Substring(--position + 8, 3) == "" + (char)0xFF + (char)0xFF + "h") // TODO: Verify this subtract
+ return "TAGES " + GetVersion(file, position);
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("Tages.dll", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("Wave.aif", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "TAGES";
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("tagesclient.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ string file = files.First(f => Path.GetFileName(f).Equals("tagesclient.exe", StringComparison.OrdinalIgnoreCase));
+ return "TAGES Activation Client " + Utilities.GetFileVersion(file);
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("TagesSetup.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ string file = files.First(f => Path.GetFileName(f).Equals("TagesSetup.exe", StringComparison.OrdinalIgnoreCase));
+ return "TAGES Setup " + Utilities.GetFileVersion(file);
+ }
+ else if (files.Count(f => Path.GetFileName(f).Equals("TagesSetup_x64.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ string file = files.First(f => Path.GetFileName(f).Equals("TagesSetup_x64.exe", StringComparison.OrdinalIgnoreCase));
+ return "TAGES Setup " + Utilities.GetFileVersion(file);
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("Tages.dll", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("Wave.aif", StringComparison.OrdinalIgnoreCase))
+ {
+ return "TAGES";
+ }
+ else if (Path.GetFileName(path).Equals("tagesclient.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "TAGES Activation Client " + Utilities.GetFileVersion(path);
+ }
+ else if (Path.GetFileName(path).Equals("TagesSetup.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "TAGES Setup " + Utilities.GetFileVersion(path);
+ }
+ else if (Path.GetFileName(path).Equals("TagesSetup_x64.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "TAGES Setup " + Utilities.GetFileVersion(path);
+ }
+ }
+
+ return null;
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position + 7, SeekOrigin.Begin);
+ byte bVersion = br.ReadByte();
+ switch (bVersion)
+ {
+ case 0x1B:
+ return "5.3-5.4";
+ case 0x14:
+ return "5.5.0";
+ case 0x4:
+ return "5.5.2";
+ }
+ return "";
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/TheBongle.cs b/BurnOutSharp/ProtectionType/TheBongle.cs
new file mode 100644
index 00000000..f31511d1
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/TheBongle.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class TheBongle
+ {
+ // TODO: Implement - http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/TheCopyProtectedCD.cs b/BurnOutSharp/ProtectionType/TheCopyProtectedCD.cs
new file mode 100644
index 00000000..70cdf83d
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/TheCopyProtectedCD.cs
@@ -0,0 +1,7 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class TheCopyProtectedCD
+ {
+ // TODO: Implement - http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs
new file mode 100644
index 00000000..dd22e49a
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/ThreePLock.cs
@@ -0,0 +1,17 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class ThreePLock
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains(".ldr")
+ || fileContent.Contains(".ldt"))
+ // || fileContent.Contains("Y" + (char)0xC3 + "U" + (char)0x8B + (char)0xEC + (char)0x83 + (char)0xEC + "0SVW")
+ {
+ return "3PLock";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Uplay.cs b/BurnOutSharp/ProtectionType/Uplay.cs
new file mode 100644
index 00000000..a85ea8cf
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Uplay.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Uplay
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("UplayInstaller.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Uplay";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("UplayInstaller.exe", StringComparison.OrdinalIgnoreCase))
+ return "Uplay";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
new file mode 100644
index 00000000..5513f9f1
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class VOBProtectCDDVD
+ {
+ public static string CheckContents(string file, string fileContent)
+ {
+ int position;
+ if ((position = fileContent.IndexOf("VOB ProtectCD")) > -1)
+ {
+ return "VOB ProtectCD/DVD " + GetOldVersion(file, --position); // TODO: Verify this subtract
+ }
+
+ else if ((position = fileContent.IndexOf("DCP-BOV" + (char)0x00 + (char)0x00)) > -1)
+ {
+ string version = GetVersion(file, --position); // TODO: Verify this subtract
+ if (version.Length > 0)
+ {
+ return "VOB ProtectCD/DVD " + version;
+ }
+
+ version = EVORE.SearchProtectDiscVersion(file);
+ if (version.Length > 0)
+ {
+ if (version.StartsWith("2"))
+ {
+ version = "6" + version.Substring(1);
+ }
+ return "VOB ProtectCD/DVD " + version;
+ }
+
+ return "VOB ProtectCD/DVD 5.9-6.0" + GetBuild(file, position);
+ }
+
+ else if (fileContent.Contains(".vob.pcd"))
+ {
+ return "VOB ProtectCD";
+ }
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("VOB-PCD.KEY", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "VOB ProtectCD/DVD";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("VOB-PCD.KEY", StringComparison.OrdinalIgnoreCase))
+ return "VOB ProtectCD/DVD";
+ }
+
+ return null;
+ }
+
+ private static string GetBuild(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position - 13, SeekOrigin.Begin);
+ if (!char.IsNumber(br.ReadChar()))
+ return ""; //Build info removed
+
+ br.BaseStream.Seek(position - 4, SeekOrigin.Begin);
+ int build = br.ReadInt16();
+ return " (Build " + build + ")";
+ }
+ }
+
+ private static string GetOldVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ char[] version = new char[3];
+ br.BaseStream.Seek(position + 16, SeekOrigin.Begin); // Begin reading after "VOB ProtectCD"
+ version[0] = br.ReadChar();
+ br.ReadByte();
+ version[1] = br.ReadChar();
+ version[2] = br.ReadChar();
+
+ if (char.IsNumber(version[0]) && char.IsNumber(version[1]) && char.IsNumber(version[2]))
+ return version[0] + "." + version[1] + version[2];
+
+ return "old";
+ }
+ }
+
+ private static string GetVersion(string file, int position)
+ {
+ using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (var br = new BinaryReader(fs))
+ {
+ br.BaseStream.Seek(position - 2, SeekOrigin.Begin);
+ byte version = br.ReadByte();
+ if (version == 5)
+ {
+ br.BaseStream.Seek(position - 4, SeekOrigin.Begin);
+ byte subsubVersion = (byte)((br.ReadByte() & 0xF0) >> 4);
+ byte subVersion = (byte)((br.ReadByte() & 0xF0) >> 4);
+ return version + "." + subVersion + "." + subsubVersion;
+ }
+ else
+ {
+ return "";
+ }
+ }
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
new file mode 100644
index 00000000..aa586c94
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class WTMCDProtect
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("WTM76545"))
+ return "WTM CD Protect";
+
+ return null;
+ }
+
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetExtension(f).Trim('.').Equals("IMP", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("imp.dat", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("wtmfiles.dat", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("Viewer.exe", StringComparison.OrdinalIgnoreCase)) > 0)
+ {
+ return "WTM CD Protect";
+ }
+ }
+ else
+ {
+ if (Path.GetExtension(path).Trim('.').Equals("IMP", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("imp.dat", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("wtmfiles.dat", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("Viewer.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "WTM CD Protect";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Winlock.cs b/BurnOutSharp/ProtectionType/Winlock.cs
new file mode 100644
index 00000000..63a1c960
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Winlock.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Winlock
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (files.Count(f => Path.GetFileName(f).Equals("WinLock.PSX", StringComparison.OrdinalIgnoreCase)) > 0)
+ return "Winlock";
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("WinLock.PSX", StringComparison.OrdinalIgnoreCase))
+ return "Winlock";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs
new file mode 100644
index 00000000..f89932b6
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/XCP.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class XCP
+ {
+ public static string CheckPath(string path, IEnumerable files, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ // TODO: Verify if these are OR or AND
+ if (files.Count(f => Path.GetFileName(f).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)) > 0
+ || files.Count(f => Path.GetFileName(f).Equals("go.exe", StringComparison.OrdinalIgnoreCase)) > 0) // Path.Combine("contents", "go.exe")
+ {
+ return "XCP";
+ }
+ }
+ else
+ {
+ if (Path.GetFileName(path).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)
+ || Path.GetFileName(path).Equals("go.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ return "XCP";
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs
new file mode 100644
index 00000000..03893d1b
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class XtremeProtector
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("XPROT "))
+ return "Xtreme-Protector";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/Zzxzz.cs b/BurnOutSharp/ProtectionType/Zzxzz.cs
new file mode 100644
index 00000000..feb06dde
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/Zzxzz.cs
@@ -0,0 +1,28 @@
+using System;
+using System.IO;
+
+namespace BurnOutSharp.ProtectionType
+{
+ public class Zzxzz
+ {
+ public static string CheckPath(string path, bool isDirectory)
+ {
+ if (isDirectory)
+ {
+ if (File.Exists(Path.Combine(path, "Zzxzz", "Zzz.aze")))
+ return "Zzxzz";
+
+ else if (Directory.Exists(Path.Combine(path, "Zzxzz")))
+ return "Zzxzz";
+ }
+ else
+ {
+ string filename = Path.GetFileName(path);
+ if (filename.Equals("Zzz.aze", StringComparison.OrdinalIgnoreCase))
+ return "Zzxzz";
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/ProtectionType/dotFuscator.cs b/BurnOutSharp/ProtectionType/dotFuscator.cs
new file mode 100644
index 00000000..c8ac53cd
--- /dev/null
+++ b/BurnOutSharp/ProtectionType/dotFuscator.cs
@@ -0,0 +1,13 @@
+namespace BurnOutSharp.ProtectionType
+{
+ public class dotFuscator
+ {
+ public static string CheckContents(string fileContent)
+ {
+ if (fileContent.Contains("DotfuscatorAttribute"))
+ return "dotFuscator";
+
+ return null;
+ }
+ }
+}
diff --git a/BurnOutSharp/Utilities.cs b/BurnOutSharp/Utilities.cs
new file mode 100644
index 00000000..5756171a
--- /dev/null
+++ b/BurnOutSharp/Utilities.cs
@@ -0,0 +1,288 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+
+namespace BurnOutSharp
+{
+ public static class Utilities
+ {
+ ///
+ /// Get the file version as reported by the filesystem
+ ///
+ public static string GetFileVersion(string file)
+ {
+ FileVersionInfo fvinfo = FileVersionInfo.GetVersionInfo(file);
+ if (fvinfo.FileVersion == null)
+ return "";
+ if (fvinfo.FileVersion != "")
+ return fvinfo.FileVersion.Replace(", ", ".");
+ else
+ return fvinfo.ProductVersion.Replace(", ", ".");
+ }
+
+ ///
+ /// Get the filesystem name for the given drive letter
+ ///
+ ///
+ /// http://pinvoke.net/default.aspx/kernel32/GetVolumeInformation.html
+ ///
+ public static string GetFileSystemName(char driveLetter)
+ {
+ string fsName = null;
+
+ StringBuilder volname = new StringBuilder(261);
+ StringBuilder fsname = new StringBuilder(261);
+
+ if (GetVolumeInformation($"{driveLetter}:\\", volname, volname.Capacity, out uint sernum, out uint maxlen, out FileSystemFeature flags, fsname, fsname.Capacity))
+ {
+ // Now you know the file system of your drive
+ // NTFS or FAT16 or UDF for instance
+ fsName = fsname.ToString();
+ }
+
+ return fsName;
+ }
+
+ #region P/Invoke
+
+ // https://stackoverflow.com/questions/8819188/c-sharp-classes-to-undelete-files/8820157#8820157
+
+ // Move Method
+ public const uint FileBegin = 0;
+ public const uint FileCurrent = 1;
+ public const uint FileEnd = 2;
+
+ // Handle Constants
+ public const uint INVALID_HANDLE_VALUE = 0;
+ public const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080;
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ public static extern bool CloseHandle(IntPtr handle);
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ public static extern IntPtr CreateFile(
+ [MarshalAs(UnmanagedType.LPTStr)] string filename,
+ [MarshalAs(UnmanagedType.U4)] FileAccess access,
+ [MarshalAs(UnmanagedType.U4)] FileShare share,
+ IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
+ [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
+ [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes,
+ IntPtr templateFile);
+
+ [DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public extern static bool GetVolumeInformation(
+ string rootPathName,
+ StringBuilder volumeNameBuffer,
+ int volumeNameSize,
+ out uint volumeSerialNumber,
+ out uint maximumComponentLength,
+ out FileSystemFeature fileSystemFlags,
+ StringBuilder fileSystemNameBuffer,
+ int nFileSystemNameSize);
+
+ [DllImport("Kernel32.dll", SetLastError = true)]
+ public extern static bool DeviceIoControl(
+ IntPtr hDevice,
+ uint IoControlCode,
+ IntPtr InMediaRemoval,
+ uint InBufferSize,
+ IntPtr OutBuffer,
+ int OutBufferSize,
+ out int BytesReturned,
+ IntPtr Overlapped);
+
+ // Used to read in a file
+ [DllImport("kernel32.dll")]
+ public static extern bool ReadFile(
+ IntPtr hFile,
+ byte[] lpBuffer,
+ uint nNumberOfBytesToRead,
+ ref uint lpNumberOfBytesRead,
+ IntPtr lpOverlapped);
+
+ [DllImport("kernel32.dll")]
+ public static extern bool ReadFileEx(
+ IntPtr hFile,
+ [Out] byte[] lpBuffer,
+ uint nNumberOfBytesToRead,
+ [In] ref NativeOverlapped lpOverlapped,
+ IOCompletionCallback lpCompletionRoutine);
+
+ // Used to set the offset in file to start reading
+ [DllImport("kernel32.dll")]
+ public static extern bool SetFilePointerEx(
+ IntPtr hFile,
+ long liDistanceToMove,
+ ref IntPtr lpNewFilePointer,
+ uint dwMoveMethod);
+
+ [StructLayout(LayoutKind.Sequential)]
+ struct STORAGE_DEVICE_NUMBER
+ {
+ public int DeviceType;
+ public int DeviceNumber;
+ public int PartitionNumber;
+ }
+
+ public enum MEDIA_TYPE : uint
+ {
+ Unknown,
+ F5_1Pt2_512,
+ F3_1Pt44_512,
+ F3_2Pt88_512,
+ F3_20Pt8_512,
+ F3_720_512,
+ F5_360_512,
+ F5_320_512,
+ F5_320_1024,
+ F5_180_512,
+ F5_160_512,
+ RemovableMedia,
+ FixedMedia,
+ F3_120M_512,
+ F3_640_512,
+ F5_640_512,
+ F5_720_512,
+ F3_1Pt2_512,
+ F3_1Pt23_1024,
+ F5_1Pt23_1024,
+ F3_128Mb_512,
+ F3_230Mb_512,
+ F8_256_128,
+ F3_200Mb_512,
+ F3_240M_512,
+ F3_32M_512
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct DISK_GEOMETRY
+ {
+ public long Cylinders;
+ public MEDIA_TYPE MediaType;
+ public int TracksPerCylinder;
+ public int SectorsPerTrack;
+ public int BytesPerSector;
+
+ public long DiskSize
+ {
+ get
+ {
+ return Cylinders * (long)TracksPerCylinder * (long)SectorsPerTrack * (long)BytesPerSector;
+ }
+ }
+ }
+
+ [Flags]
+ public enum FileSystemFeature : uint
+ {
+ ///
+ /// The file system preserves the case of file names when it places a name on disk.
+ ///
+ CasePreservedNames = 2,
+
+ ///
+ /// The file system supports case-sensitive file names.
+ ///
+ CaseSensitiveSearch = 1,
+
+ ///
+ /// The specified volume is a direct access (DAX) volume. This flag was introduced in Windows 10, version 1607.
+ ///
+ DaxVolume = 0x20000000,
+
+ ///
+ /// The file system supports file-based compression.
+ ///
+ FileCompression = 0x10,
+
+ ///
+ /// The file system supports named streams.
+ ///
+ NamedStreams = 0x40000,
+
+ ///
+ /// The file system preserves and enforces access control lists (ACL).
+ ///
+ PersistentACLS = 8,
+
+ ///
+ /// The specified volume is read-only.
+ ///
+ ReadOnlyVolume = 0x80000,
+
+ ///
+ /// The volume supports a single sequential write.
+ ///
+ SequentialWriteOnce = 0x100000,
+
+ ///
+ /// The file system supports the Encrypted File System (EFS).
+ ///
+ SupportsEncryption = 0x20000,
+
+ ///
+ /// The specified volume supports extended attributes. An extended attribute is a piece of
+ /// application-specific metadata that an application can associate with a file and is not part
+ /// of the file's data.
+ ///
+ SupportsExtendedAttributes = 0x00800000,
+
+ ///
+ /// The specified volume supports hard links. For more information, see Hard Links and Junctions.
+ ///
+ SupportsHardLinks = 0x00400000,
+
+ ///
+ /// The file system supports object identifiers.
+ ///
+ SupportsObjectIDs = 0x10000,
+
+ ///
+ /// The file system supports open by FileID. For more information, see FILE_ID_BOTH_DIR_INFO.
+ ///
+ SupportsOpenByFileId = 0x01000000,
+
+ ///
+ /// The file system supports re-parse points.
+ ///
+ SupportsReparsePoints = 0x80,
+
+ ///
+ /// The file system supports sparse files.
+ ///
+ SupportsSparseFiles = 0x40,
+
+ ///
+ /// The volume supports transactions.
+ ///
+ SupportsTransactions = 0x200000,
+
+ ///
+ /// The specified volume supports update sequence number (USN) journals. For more information,
+ /// see Change Journal Records.
+ ///
+ SupportsUsnJournal = 0x02000000,
+
+ ///
+ /// The file system supports Unicode in file names as they appear on disk.
+ ///
+ UnicodeOnDisk = 4,
+
+ ///
+ /// The specified volume is a compressed volume, for example, a DoubleSpace volume.
+ ///
+ VolumeIsCompressed = 0x8000,
+
+ ///
+ /// The file system supports disk quotas.
+ ///
+ VolumeQuotas = 0x20
+ }
+
+ #endregion
+ }
+}
diff --git a/Test/Program.cs b/Test/Program.cs
index 1c2fade1..96f44b40 100644
--- a/Test/Program.cs
+++ b/Test/Program.cs
@@ -16,6 +16,8 @@ namespace Test
}
Console.ReadLine();
+
+ //ProtectionFind.ScanSectors('D', 2048);
}
private static void Changed(object source, FileProtection value)