mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-18 20:22:42 +00:00
Separate protections into their own classes
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -57,6 +58,85 @@
|
||||
<Compile Include="FileProtection.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ProtectionFind.cs" />
|
||||
<Compile Include="ProtectionType\AACS.cs" />
|
||||
<Compile Include="ProtectionType\ActiveMARK.cs" />
|
||||
<Compile Include="ProtectionType\Alcatraz.cs" />
|
||||
<Compile Include="ProtectionType\AlphaAudio.cs" />
|
||||
<Compile Include="ProtectionType\AlphaDVD.cs" />
|
||||
<Compile Include="ProtectionType\AlphaROM.cs" />
|
||||
<Compile Include="ProtectionType\Armadillo.cs" />
|
||||
<Compile Include="ProtectionType\Bitpool.cs" />
|
||||
<Compile Include="ProtectionType\ByteShield.cs" />
|
||||
<Compile Include="ProtectionType\CactusDataShield.cs" />
|
||||
<Compile Include="ProtectionType\CDCheck.cs" />
|
||||
<Compile Include="ProtectionType\CDCops.cs" />
|
||||
<Compile Include="ProtectionType\CDLock.cs" />
|
||||
<Compile Include="ProtectionType\CDProtector.cs" />
|
||||
<Compile Include="ProtectionType\CDSHiELDSE.cs" />
|
||||
<Compile Include="ProtectionType\CDX.cs" />
|
||||
<Compile Include="ProtectionType\CengaProtectDVD.cs" />
|
||||
<Compile Include="ProtectionType\CodeLock.cs" />
|
||||
<Compile Include="ProtectionType\CopyKiller.cs" />
|
||||
<Compile Include="ProtectionType\CopyLok.cs" />
|
||||
<Compile Include="ProtectionType\CrypKey.cs" />
|
||||
<Compile Include="ProtectionType\Cucko.cs" />
|
||||
<Compile Include="ProtectionType\DBB.cs" />
|
||||
<Compile Include="ProtectionType\DiscGuard.cs" />
|
||||
<Compile Include="ProtectionType\dotFuscator.cs" />
|
||||
<Compile Include="ProtectionType\DVDCops.cs" />
|
||||
<Compile Include="ProtectionType\DVDCrypt.cs" />
|
||||
<Compile Include="ProtectionType\DVDMoviePROTECT.cs" />
|
||||
<Compile Include="ProtectionType\EACdKey.cs" />
|
||||
<Compile Include="ProtectionType\EXEStealth.cs" />
|
||||
<Compile Include="ProtectionType\FADE.cs" />
|
||||
<Compile Include="ProtectionType\FreeLock.cs" />
|
||||
<Compile Include="ProtectionType\GFWL.cs" />
|
||||
<Compile Include="ProtectionType\HexalockAutoLock.cs" />
|
||||
<Compile Include="ProtectionType\ImpulseReactor.cs" />
|
||||
<Compile Include="ProtectionType\IndyVCD.cs" />
|
||||
<Compile Include="ProtectionType\InnoSetup.cs" />
|
||||
<Compile Include="ProtectionType\JoWooDXProt.cs" />
|
||||
<Compile Include="ProtectionType\Key2AudioXS.cs" />
|
||||
<Compile Include="ProtectionType\KeyLock.cs" />
|
||||
<Compile Include="ProtectionType\LaserLock.cs" />
|
||||
<Compile Include="ProtectionType\LockBlocks.cs" />
|
||||
<Compile Include="ProtectionType\MediaCloQ.cs" />
|
||||
<Compile Include="ProtectionType\MediaMaxCD3.cs" />
|
||||
<Compile Include="ProtectionType\MusicGuard.cs" />
|
||||
<Compile Include="ProtectionType\Origin.cs" />
|
||||
<Compile Include="ProtectionType\PECompact.cs" />
|
||||
<Compile Include="ProtectionType\Phenoprotect.cs" />
|
||||
<Compile Include="ProtectionType\ProtectDisc.cs" />
|
||||
<Compile Include="ProtectionType\ProtectDVDVideo.cs" />
|
||||
<Compile Include="ProtectionType\PSXAntiModchip.cs" />
|
||||
<Compile Include="ProtectionType\RingPROTECH.cs" />
|
||||
<Compile Include="ProtectionType\Roxxe.cs" />
|
||||
<Compile Include="ProtectionType\SAFEAUDIO.cs" />
|
||||
<Compile Include="ProtectionType\SafeCast.cs" />
|
||||
<Compile Include="ProtectionType\SafeDiscLite.cs" />
|
||||
<Compile Include="ProtectionType\SafeDisc.cs" />
|
||||
<Compile Include="ProtectionType\SafeLock.cs" />
|
||||
<Compile Include="ProtectionType\SecuROM.cs" />
|
||||
<Compile Include="ProtectionType\SmartE.cs" />
|
||||
<Compile Include="ProtectionType\SoftLock.cs" />
|
||||
<Compile Include="ProtectionType\SolidShield.cs" />
|
||||
<Compile Include="ProtectionType\StarForce.cs" />
|
||||
<Compile Include="ProtectionType\Steam.cs" />
|
||||
<Compile Include="ProtectionType\SVKProtector.cs" />
|
||||
<Compile Include="ProtectionType\Sysiphus.cs" />
|
||||
<Compile Include="ProtectionType\Tages.cs" />
|
||||
<Compile Include="ProtectionType\TheBongle.cs" />
|
||||
<Compile Include="ProtectionType\TheCopyProtectedCD.cs" />
|
||||
<Compile Include="ProtectionType\ThreePLock.cs" />
|
||||
<Compile Include="ProtectionType\TZCopyProtector.cs" />
|
||||
<Compile Include="ProtectionType\Uplay.cs" />
|
||||
<Compile Include="ProtectionType\VOBProtectCDDVD.cs" />
|
||||
<Compile Include="ProtectionType\Winlock.cs" />
|
||||
<Compile Include="ProtectionType\WTMCDProtect.cs" />
|
||||
<Compile Include="ProtectionType\XCP.cs" />
|
||||
<Compile Include="ProtectionType\XtremeProtector.cs" />
|
||||
<Compile Include="ProtectionType\Zzxzz.cs" />
|
||||
<Compile Include="Utilities.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="BurnOutSharp.nuspec" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
33
BurnOutSharp/ProtectionType/AACS.cs
Normal file
33
BurnOutSharp/ProtectionType/AACS.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
BurnOutSharp/ProtectionType/ActiveMARK.cs
Normal file
22
BurnOutSharp/ProtectionType/ActiveMARK.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/Alcatraz.cs
Normal file
7
BurnOutSharp/ProtectionType/Alcatraz.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class Alcatraz
|
||||
{
|
||||
// TODO: Implement - http://www.kdg-mt.com/1/product_d_6.html
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/AlphaAudio.cs
Normal file
7
BurnOutSharp/ProtectionType/AlphaAudio.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class AlphaAudio
|
||||
{
|
||||
// TODO: Implement - http://settec.net/eng/pro_cd.html
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/AlphaDVD.cs
Normal file
26
BurnOutSharp/ProtectionType/AlphaDVD.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/AlphaROM.cs
Normal file
13
BurnOutSharp/ProtectionType/AlphaROM.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
BurnOutSharp/ProtectionType/Armadillo.cs
Normal file
14
BurnOutSharp/ProtectionType/Armadillo.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/Bitpool.cs
Normal file
26
BurnOutSharp/ProtectionType/Bitpool.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
BurnOutSharp/ProtectionType/ByteShield.cs
Normal file
32
BurnOutSharp/ProtectionType/ByteShield.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
BurnOutSharp/ProtectionType/CDCheck.cs
Normal file
14
BurnOutSharp/ProtectionType/CDCheck.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
BurnOutSharp/ProtectionType/CDCops.cs
Normal file
64
BurnOutSharp/ProtectionType/CDCops.cs
Normal file
@@ -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<string> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
38
BurnOutSharp/ProtectionType/CDLock.cs
Normal file
38
BurnOutSharp/ProtectionType/CDLock.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
BurnOutSharp/ProtectionType/CDProtector.cs
Normal file
37
BurnOutSharp/ProtectionType/CDProtector.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/CDSHiELDSE.cs
Normal file
13
BurnOutSharp/ProtectionType/CDSHiELDSE.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
BurnOutSharp/ProtectionType/CDX.cs
Normal file
35
BurnOutSharp/ProtectionType/CDX.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
BurnOutSharp/ProtectionType/CactusDataShield.cs
Normal file
64
BurnOutSharp/ProtectionType/CactusDataShield.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/CengaProtectDVD.cs
Normal file
13
BurnOutSharp/ProtectionType/CengaProtectDVD.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
BurnOutSharp/ProtectionType/CodeLock.cs
Normal file
18
BurnOutSharp/ProtectionType/CodeLock.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
BurnOutSharp/ProtectionType/CopyKiller.cs
Normal file
34
BurnOutSharp/ProtectionType/CopyKiller.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/CopyLok.cs
Normal file
7
BurnOutSharp/ProtectionType/CopyLok.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class CopyLok
|
||||
{
|
||||
// TODO: Implement - http://web.archive.org/web/20041215075727/http://www.panlok.com/codelok2.htm
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/CrypKey.cs
Normal file
7
BurnOutSharp/ProtectionType/CrypKey.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class CrypKey
|
||||
{
|
||||
// TODO: Implement - http://www.crypkey.com/products/cdlock/cdmain.html
|
||||
}
|
||||
}
|
||||
14
BurnOutSharp/ProtectionType/Cucko.cs
Normal file
14
BurnOutSharp/ProtectionType/Cucko.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/DBB.cs
Normal file
7
BurnOutSharp/ProtectionType/DBB.cs
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
30
BurnOutSharp/ProtectionType/DVDCops.cs
Normal file
30
BurnOutSharp/ProtectionType/DVDCops.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/DVDCrypt.cs
Normal file
26
BurnOutSharp/ProtectionType/DVDCrypt.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
29
BurnOutSharp/ProtectionType/DVDMoviePROTECT.cs
Normal file
29
BurnOutSharp/ProtectionType/DVDMoviePROTECT.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BurnOutSharp/ProtectionType/DiscGuard.cs
Normal file
33
BurnOutSharp/ProtectionType/DiscGuard.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/EACdKey.cs
Normal file
13
BurnOutSharp/ProtectionType/EACdKey.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
BurnOutSharp/ProtectionType/EXEStealth.cs
Normal file
17
BurnOutSharp/ProtectionType/EXEStealth.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/FADE.cs
Normal file
7
BurnOutSharp/ProtectionType/FADE.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class FADE
|
||||
{
|
||||
// TODO: Implement - http://www.codemasters.com/news/displayarticles.php?showarticle=500
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/FreeLock.cs
Normal file
26
BurnOutSharp/ProtectionType/FreeLock.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
BurnOutSharp/ProtectionType/GFWL.cs
Normal file
34
BurnOutSharp/ProtectionType/GFWL.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
BurnOutSharp/ProtectionType/HexalockAutoLock.cs
Normal file
37
BurnOutSharp/ProtectionType/HexalockAutoLock.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
BurnOutSharp/ProtectionType/ImpulseReactor.cs
Normal file
47
BurnOutSharp/ProtectionType/ImpulseReactor.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BurnOutSharp/ProtectionType/IndyVCD.cs
Normal file
33
BurnOutSharp/ProtectionType/IndyVCD.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
BurnOutSharp/ProtectionType/InnoSetup.cs
Normal file
45
BurnOutSharp/ProtectionType/InnoSetup.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
49
BurnOutSharp/ProtectionType/JoWooDXProt.cs
Normal file
49
BurnOutSharp/ProtectionType/JoWooDXProt.cs
Normal file
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BurnOutSharp/ProtectionType/Key2AudioXS.cs
Normal file
33
BurnOutSharp/ProtectionType/Key2AudioXS.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/KeyLock.cs
Normal file
13
BurnOutSharp/ProtectionType/KeyLock.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
133
BurnOutSharp/ProtectionType/LaserLock.cs
Normal file
133
BurnOutSharp/ProtectionType/LaserLock.cs
Normal file
@@ -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<string> 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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/LockBlocks.cs
Normal file
7
BurnOutSharp/ProtectionType/LockBlocks.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class LockBlocks
|
||||
{
|
||||
// TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_lockblocks.shtml
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/MediaCloQ.cs
Normal file
26
BurnOutSharp/ProtectionType/MediaCloQ.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/MediaMaxCD3.cs
Normal file
26
BurnOutSharp/ProtectionType/MediaMaxCD3.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/MusicGuard.cs
Normal file
7
BurnOutSharp/ProtectionType/MusicGuard.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class MusicGuard
|
||||
{
|
||||
// TODO: Implement - http://web.archive.org/web/20020606000647/http://www.musicguard.com
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/Origin.cs
Normal file
26
BurnOutSharp/ProtectionType/Origin.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/PECompact.cs
Normal file
13
BurnOutSharp/ProtectionType/PECompact.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
BurnOutSharp/ProtectionType/PSXAntiModchip.cs
Normal file
53
BurnOutSharp/ProtectionType/PSXAntiModchip.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/Phenoprotect.cs
Normal file
7
BurnOutSharp/ProtectionType/Phenoprotect.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class Phenoprotect
|
||||
{
|
||||
// TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_phenoprotect.shtml
|
||||
}
|
||||
}
|
||||
28
BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
Normal file
28
BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
157
BurnOutSharp/ProtectionType/ProtectDisc.cs
Normal file
157
BurnOutSharp/ProtectionType/ProtectDisc.cs
Normal file
@@ -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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/RingPROTECH.cs
Normal file
13
BurnOutSharp/ProtectionType/RingPROTECH.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/Roxxe.cs
Normal file
7
BurnOutSharp/ProtectionType/Roxxe.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class Roxxe
|
||||
{
|
||||
// TODO: Implement - http://web.archive.org/web/20050309084802/http://www.roxxe.cz
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/SAFEAUDIO.cs
Normal file
7
BurnOutSharp/ProtectionType/SAFEAUDIO.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class SAFEAUDIO
|
||||
{
|
||||
// TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_safeaudio.shtml
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/SVKProtector.cs
Normal file
13
BurnOutSharp/ProtectionType/SVKProtector.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/SafeCast.cs
Normal file
26
BurnOutSharp/ProtectionType/SafeCast.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
204
BurnOutSharp/ProtectionType/SafeDisc.cs
Normal file
204
BurnOutSharp/ProtectionType/SafeDisc.cs
Normal file
@@ -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<string> 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/SafeDiscLite.cs
Normal file
26
BurnOutSharp/ProtectionType/SafeDiscLite.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
43
BurnOutSharp/ProtectionType/SafeLock.cs
Normal file
43
BurnOutSharp/ProtectionType/SafeLock.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
161
BurnOutSharp/ProtectionType/SecuROM.cs
Normal file
161
BurnOutSharp/ProtectionType/SecuROM.cs
Normal file
@@ -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<string> 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
BurnOutSharp/ProtectionType/SmartE.cs
Normal file
41
BurnOutSharp/ProtectionType/SmartE.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BurnOutSharp/ProtectionType/SoftLock.cs
Normal file
33
BurnOutSharp/ProtectionType/SoftLock.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
143
BurnOutSharp/ProtectionType/SolidShield.cs
Normal file
143
BurnOutSharp/ProtectionType/SolidShield.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
BurnOutSharp/ProtectionType/StarForce.cs
Normal file
68
BurnOutSharp/ProtectionType/StarForce.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
38
BurnOutSharp/ProtectionType/Steam.cs
Normal file
38
BurnOutSharp/ProtectionType/Steam.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
BurnOutSharp/ProtectionType/Sysiphus.cs
Normal file
36
BurnOutSharp/ProtectionType/Sysiphus.cs
Normal file
@@ -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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/TZCopyProtector.cs
Normal file
26
BurnOutSharp/ProtectionType/TZCopyProtector.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
94
BurnOutSharp/ProtectionType/Tages.cs
Normal file
94
BurnOutSharp/ProtectionType/Tages.cs
Normal file
@@ -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<string> 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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/TheBongle.cs
Normal file
7
BurnOutSharp/ProtectionType/TheBongle.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class TheBongle
|
||||
{
|
||||
// TODO: Implement - http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm
|
||||
}
|
||||
}
|
||||
7
BurnOutSharp/ProtectionType/TheCopyProtectedCD.cs
Normal file
7
BurnOutSharp/ProtectionType/TheCopyProtectedCD.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class TheCopyProtectedCD
|
||||
{
|
||||
// TODO: Implement - http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm
|
||||
}
|
||||
}
|
||||
17
BurnOutSharp/ProtectionType/ThreePLock.cs
Normal file
17
BurnOutSharp/ProtectionType/ThreePLock.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/Uplay.cs
Normal file
26
BurnOutSharp/ProtectionType/Uplay.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
118
BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
Normal file
118
BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
Normal file
@@ -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<string> 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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
45
BurnOutSharp/ProtectionType/WTMCDProtect.cs
Normal file
45
BurnOutSharp/ProtectionType/WTMCDProtect.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BurnOutSharp/ProtectionType/Winlock.cs
Normal file
26
BurnOutSharp/ProtectionType/Winlock.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
BurnOutSharp/ProtectionType/XCP.cs
Normal file
35
BurnOutSharp/ProtectionType/XCP.cs
Normal file
@@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/XtremeProtector.cs
Normal file
13
BurnOutSharp/ProtectionType/XtremeProtector.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
BurnOutSharp/ProtectionType/Zzxzz.cs
Normal file
28
BurnOutSharp/ProtectionType/Zzxzz.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BurnOutSharp/ProtectionType/dotFuscator.cs
Normal file
13
BurnOutSharp/ProtectionType/dotFuscator.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class dotFuscator
|
||||
{
|
||||
public static string CheckContents(string fileContent)
|
||||
{
|
||||
if (fileContent.Contains("DotfuscatorAttribute"))
|
||||
return "dotFuscator";
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
288
BurnOutSharp/Utilities.cs
Normal file
288
BurnOutSharp/Utilities.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the file version as reported by the filesystem
|
||||
/// </summary>
|
||||
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(", ", ".");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the filesystem name for the given drive letter
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://pinvoke.net/default.aspx/kernel32/GetVolumeInformation.html
|
||||
/// </remarks>
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// The file system preserves the case of file names when it places a name on disk.
|
||||
/// </summary>
|
||||
CasePreservedNames = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports case-sensitive file names.
|
||||
/// </summary>
|
||||
CaseSensitiveSearch = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The specified volume is a direct access (DAX) volume. This flag was introduced in Windows 10, version 1607.
|
||||
/// </summary>
|
||||
DaxVolume = 0x20000000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports file-based compression.
|
||||
/// </summary>
|
||||
FileCompression = 0x10,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports named streams.
|
||||
/// </summary>
|
||||
NamedStreams = 0x40000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system preserves and enforces access control lists (ACL).
|
||||
/// </summary>
|
||||
PersistentACLS = 8,
|
||||
|
||||
/// <summary>
|
||||
/// The specified volume is read-only.
|
||||
/// </summary>
|
||||
ReadOnlyVolume = 0x80000,
|
||||
|
||||
/// <summary>
|
||||
/// The volume supports a single sequential write.
|
||||
/// </summary>
|
||||
SequentialWriteOnce = 0x100000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports the Encrypted File System (EFS).
|
||||
/// </summary>
|
||||
SupportsEncryption = 0x20000,
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
SupportsExtendedAttributes = 0x00800000,
|
||||
|
||||
/// <summary>
|
||||
/// The specified volume supports hard links. For more information, see Hard Links and Junctions.
|
||||
/// </summary>
|
||||
SupportsHardLinks = 0x00400000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports object identifiers.
|
||||
/// </summary>
|
||||
SupportsObjectIDs = 0x10000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports open by FileID. For more information, see FILE_ID_BOTH_DIR_INFO.
|
||||
/// </summary>
|
||||
SupportsOpenByFileId = 0x01000000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports re-parse points.
|
||||
/// </summary>
|
||||
SupportsReparsePoints = 0x80,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports sparse files.
|
||||
/// </summary>
|
||||
SupportsSparseFiles = 0x40,
|
||||
|
||||
/// <summary>
|
||||
/// The volume supports transactions.
|
||||
/// </summary>
|
||||
SupportsTransactions = 0x200000,
|
||||
|
||||
/// <summary>
|
||||
/// The specified volume supports update sequence number (USN) journals. For more information,
|
||||
/// see Change Journal Records.
|
||||
/// </summary>
|
||||
SupportsUsnJournal = 0x02000000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports Unicode in file names as they appear on disk.
|
||||
/// </summary>
|
||||
UnicodeOnDisk = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The specified volume is a compressed volume, for example, a DoubleSpace volume.
|
||||
/// </summary>
|
||||
VolumeIsCompressed = 0x8000,
|
||||
|
||||
/// <summary>
|
||||
/// The file system supports disk quotas.
|
||||
/// </summary>
|
||||
VolumeQuotas = 0x20
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ namespace Test
|
||||
}
|
||||
|
||||
Console.ReadLine();
|
||||
|
||||
//ProtectionFind.ScanSectors('D', 2048);
|
||||
}
|
||||
|
||||
private static void Changed(object source, FileProtection value)
|
||||
|
||||
Reference in New Issue
Block a user