Compare commits

...

21 Commits

Author SHA1 Message Date
Matt Nadareski
45661f3ccd Merge pull request #2 from mnadareski/reorg
Reorganization and Update
2019-09-30 20:39:49 -07:00
Matt Nadareski
c7a9485bf3 Update all 2019-09-30 20:08:12 -07:00
Matt Nadareski
9422ba01e7 Remove backups 2019-09-30 12:17:15 -07:00
Matt Nadareski
b8bbc0b333 Update packages 2019-09-30 12:10:32 -07:00
Matt Nadareski
44922a1f6b Fix encoding issue, add note 2019-09-30 12:09:03 -07:00
Matt Nadareski
cfcb608990 Update all to 4.7.2 2019-09-30 11:46:53 -07:00
Matt Nadareski
392f9dae0c Fix build 2019-09-30 11:29:38 -07:00
Matt Nadareski
4b1cae2ba2 Filename is no longer expected 2019-09-30 11:08:44 -07:00
Matt Nadareski
fd866465b4 Fix test program output 2019-09-29 12:08:31 -07:00
Matt Nadareski
5ffaedc024 Keep path scanning on individual files, for now 2019-09-29 11:57:46 -07:00
Matt Nadareski
ca0d695470 Else-If causes some issues 2019-09-28 01:51:06 -07:00
Matt Nadareski
c109aceb24 Update nuspec 2019-09-28 00:05:44 -07:00
Matt Nadareski
2938033fa6 Remove unused class 2019-09-28 00:01:22 -07:00
Matt Nadareski
5a2755d7c7 Consistent comments 2019-09-27 23:57:32 -07:00
Matt Nadareski
550086791b Separate protections into their own classes 2019-09-27 23:52:24 -07:00
Matt Nadareski
9e4836826d Fix "FileProtection" callback, add InnoSetup
The InnoSetup placeholder here will eventually be a way to call to an external library to extract the contents of the installer, similar to how CAB files are handled right now. The code to o so need sto be converted before that can happen, so in the meantime, this adds Inno Steup itself as a "protection" since other protections could be hidden within.
2018-07-22 23:48:44 -07:00
Matt Nadareski
e0d0722e2b Update csproj 2018-07-22 23:47:08 -07:00
Matt Nadareski
b4c5b220ef Progress => FileProtection
This also implements a sample usage in the Test program
2018-07-22 23:46:49 -07:00
Matt Nadareski
413652f92a Add AppVeyor badge 2018-07-19 14:42:18 -07:00
Matt Nadareski
0cf2b0f6d2 Better cabinet handling, update version 2018-07-19 10:12:38 -07:00
Matt Nadareski
a3094ef471 Add antimod detection (2/3) 2018-07-18 12:06:25 -07:00
92 changed files with 3844 additions and 1290 deletions

View File

@@ -1,12 +1,17 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2026
# Visual Studio Version 16
VisualStudioVersion = 16.0.29306.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BurnOutSharp", "BurnOutSharp\BurnOutSharp.csproj", "{1DA4212E-6071-4951-B45D-BB74A7838246}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{88735BA2-778D-4192-8EB2-FFF6843719E2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{68D10531-99CB-40B1-8912-73FA286C9433}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View File

@@ -1,66 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1DA4212E-6071-4951-B45D-BB74A7838246}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BurnOutSharp</RootNamespace>
<AssemblyName>BurnOutSharp</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworks>net462;net472;netcoreapp3.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="LessIO, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LessIO.0.5.0\lib\net40\LessIO.dll</HintPath>
</Reference>
<Reference Include="libmspackn, Version=0.8.0.0, Culture=neutral, processorArchitecture=x86">
<HintPath>..\packages\libmspack4n.0.8.0\lib\net40\libmspackn.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnshieldSharp, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UnshieldSharp.1.4.2.1\lib\net461\UnshieldSharp.dll</HintPath>
</Reference>
<Reference Include="zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160">
<HintPath>..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CaseInsensitiveDictionary.cs" />
<Compile Include="EVORE.cs" />
<Compile Include="Progress.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtectionFind.cs" />
</ItemGroup>
<ItemGroup>
<None Include="BurnOutSharp.nuspec" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
<ItemGroup>
<PackageReference Include="LessIO">
<Version>0.6.16</Version>
</PackageReference>
<PackageReference Include="libmspack4n">
<Version>0.9.10</Version>
</PackageReference>
<PackageReference Include="UnshieldSharp">
<Version>1.4.2.3</Version>
</PackageReference>
<PackageReference Include="zlib.net">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
</Project>

View File

@@ -2,7 +2,7 @@
<package >
<metadata>
<id>BurnOutSharp</id>
<version>1.03.7</version>
<version>1.03.8.0</version>
<title>BurnOutSharp</title>
<authors>Matt Nadareski, Gernot Knippen</authors>
<owners>Matt Nadareski, Gernot Knippen</owners>
@@ -10,16 +10,20 @@
<projectUrl>https://github.com/mnadareski/BurnOutSharp</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Port of BurnOut to C#, with additions</description>
<copyright>Copyright (c)2005-2010 Gernot Knippen, Copyright (c)2018 Matt Nadareski</copyright>
<copyright>Copyright (c)2005-2010 Gernot Knippen, Copyright (c)2018-2019 Matt Nadareski</copyright>
<tags>protection scan burnout</tags>
<dependencies>
<dependency id="LessIO" version="0.5.0" />
<dependency id="libmspack4n" version="0.8.0" />
<dependency id="UnshieldSharp" version="1.4.2.1" />
<dependency id="UnshieldSharp" version="1.4.2.3" />
</dependencies>
</metadata>
<files>
<file src="bin\Debug\BurnOutSharp.dll" target="lib\net461\BurnOutSharp.dll" />
<file src="bin\Debug\BurnOutSharp.pdb" target="lib\net461\BurnOutSharp.pdb" />
<file src="bin\Debug\net462\BurnOutSharp.dll" target="lib\net462\BurnOutSharp.dll" />
<file src="bin\Debug\net462\BurnOutSharp.pdb" target="lib\net462\BurnOutSharp.pdb" />
<file src="bin\Debug\net472\BurnOutSharp.dll" target="lib\net472\BurnOutSharp.dll" />
<file src="bin\Debug\net472\BurnOutSharp.pdb" target="lib\net472\BurnOutSharp.pdb" />
<file src="bin\Debug\netcoreapp3.0\BurnOutSharp.dll" target="lib\netcoreapp3.0\BurnOutSharp.dll" />
<file src="bin\Debug\netcoreapp3.0\BurnOutSharp.pdb" target="lib\netcoreapp3.0\BurnOutSharp.pdb" />
</files>
</package>

View File

@@ -1,95 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace BurnOutSharp
{
internal class CaseInsensitiveDictionary<TValue> : IDictionary<string, TValue>
{
private Dictionary<string, TValue> _dict = new Dictionary<string, TValue>();
public TValue this[string key]
{
get
{
key = key.ToLower();
if (_dict.ContainsKey(key))
return _dict[key];
throw new ArgumentException("Key could not be found in the dictionary");
}
set
{
key = key.ToLower();
_dict[key] = value;
}
}
public ICollection<string> Keys => _dict.Keys;
public ICollection<TValue> Values => _dict.Values;
public int Count => _dict.Count;
public bool IsReadOnly => false;
public void Add(string key, TValue value)
{
key = key.ToLower();
_dict[key] = value;
}
public void Add(KeyValuePair<string, TValue> item)
{
string key = item.Key.ToLower();
_dict[key] = item.Value; ;
}
public void Clear()
{
_dict.Clear();
}
public bool Contains(KeyValuePair<string, TValue> item)
{
KeyValuePair<string, TValue> temp = new KeyValuePair<string, TValue>(item.Key.ToLower(), item.Value);
return _dict.Contains(temp);
}
public bool ContainsKey(string key)
{
return _dict.ContainsKey(key.ToLower());
}
public void CopyTo(KeyValuePair<string, TValue>[] array, int arrayIndex)
{
throw new NotImplementedException();
}
public IEnumerator<KeyValuePair<string, TValue>> GetEnumerator()
{
return _dict.GetEnumerator();
}
public bool Remove(string key)
{
return _dict.Remove(key.ToLower());
}
public bool Remove(KeyValuePair<string, TValue> item)
{
throw new NotImplementedException();
}
public bool TryGetValue(string key, out TValue value)
{
key = key.ToLower();
return _dict.TryGetValue(key, out value);
}
IEnumerator IEnumerable.GetEnumerator()
{
return _dict.GetEnumerator();
}
}
}

View File

@@ -37,6 +37,9 @@ namespace BurnOutSharp
private static Process StartSafe(string file)
{
if (file == null)
return null;
Process startingprocess = new Process();
startingprocess.StartInfo.FileName = file;
startingprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
@@ -56,6 +59,9 @@ namespace BurnOutSharp
private static string MakeTempFile(string file, string sExtension = ".exe")
{
if (file == null)
return string.Empty;
FileInfo filei = new FileInfo(file);
try
{
@@ -69,6 +75,9 @@ namespace BurnOutSharp
private static bool IsEXE(string file)
{
if (file == null)
return false;
BinaryReader breader = new BinaryReader(File.OpenRead(file));
breader.ReadBytes(60);
int PEHeaderOffset = breader.ReadInt32();
@@ -85,6 +94,9 @@ namespace BurnOutSharp
private static string[] CopyDependentDlls(string exefile)
{
if (exefile == null)
return null;
FileInfo fiExe = new FileInfo(exefile);
Section[] sections = ReadSections(exefile);
BinaryReader breader = new BinaryReader(File.OpenRead(exefile), Encoding.Default);
@@ -141,6 +153,9 @@ namespace BurnOutSharp
private static Section[] ReadSections(string exefile)
{
if (exefile == null)
return null;
BinaryReader breader = new BinaryReader(File.OpenRead(exefile));
breader.ReadBytes(60);
uint PEHeaderOffset = breader.ReadUInt32();
@@ -184,6 +199,9 @@ namespace BurnOutSharp
public static string SearchProtectDiscVersion(string file)
{
if (file == null)
return string.Empty;
Process exe = new Process();
Process[] processes = new Process[0];
string version = "";
@@ -339,6 +357,9 @@ namespace BurnOutSharp
public static string SearchSafeDiscVersion(string file)
{
if (file == null)
return string.Empty;
Process exe = new Process();
string version = "";
DateTime timestart;

View File

@@ -1,12 +1,12 @@
namespace BurnOutSharp
{
public class Progress
public class FileProtection
{
public string Filename { get; private set; }
public float Percentage { get; private set; }
public string Protection { get; private set; }
public Progress(string filename, float percentage, string protection)
public FileProtection(string filename, float percentage, string protection)
{
this.Filename = filename;
this.Percentage = percentage;

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.03.7")]
[assembly: AssemblyFileVersion("1.03.7.0")]
[assembly: AssemblyVersion("1.03.7.1")]
[assembly: AssemblyFileVersion("1.03.7.1")]

File diff suppressed because it is too large Load Diff

View 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;
}
}
}

View File

@@ -0,0 +1,20 @@
namespace BurnOutSharp.ProtectionType
{
public class ActiveMARK
{
public static string CheckContents(string fileContent)
{
if (fileContent.Contains("TMSAMVOF"))
return "ActiveMARK";
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;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class Alcatraz
{
// TODO: Implement - http://www.kdg-mt.com/1/product_d_6.html
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class AlphaAudio
{
// TODO: Implement - http://settec.net/eng/pro_cd.html
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,67 @@
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);
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)
{
if (file == null)
return string.Empty;
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);
}
}
}
}

View 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;
}
}
}

View 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: Verify if these are 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;
}
}
}

View 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;
}
}
}

View 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: Verify if these are 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,18 @@
namespace BurnOutSharp.ProtectionType
{
public class CodeLock
{
public static string CheckContents(string fileContent)
{
// TODO: Verify if these are OR or AND
if (fileContent.Contains("icd1" + (char)0x00)
|| fileContent.Contains("icd2" + (char)0x00)
|| fileContent.Contains("CODE-LOCK.OCX"))
{
return "Code Lock";
}
return null;
}
}
}

View 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;
}
}
}

View 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
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class CrypKey
{
// TODO: Implement - http://www.crypkey.com/products/cdlock/cdmain.html
}
}

View 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;
}
}
}

View 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
}
}

View File

@@ -0,0 +1,33 @@
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)
{
if (file == null)
return string.Empty;
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);
}
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class FADE
{
// TODO: Implement - http://www.codemasters.com/news/displayarticles.php?showarticle=500
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,48 @@
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)
{
if (file == null)
return string.Empty;
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;
}
}
}
}

View File

@@ -0,0 +1,51 @@
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";
}
}
if (fileContent.Contains("@HC09 "))
return "JoWooD X-Prot v2";
return null;
}
private static string GetVersion(string file, int position)
{
if (file == null)
return string.Empty;
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];
}
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,127 @@
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);
}
if (fileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE"))
return "LaserLock Marathon " + GetBuild(fileContent, false);
if ((position = fileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
+ "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00
+ "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF")) > -1)
{
return "LaserLock " + GetVersion(fileContent, --position) + " " + GetBuild(fileContent, false);
}
if (file != null && Path.GetFileName(file) == "NOMOUSE.SP")
return "LaserLock " + GetVersion16Bit(file);
if (fileContent.Contains(":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP"))
return "LaserLock 3";
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 "";
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class LockBlocks
{
// TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_lockblocks.shtml
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class MusicGuard
{
// TODO: Implement - http://web.archive.org/web/20020606000647/http://www.musicguard.com
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class PSXAntiModchip
{
public static string CheckContents(string file, string fileContent)
{
// TODO: Detect Red Hand protection
if (fileContent.Contains(" SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690"))
return "PlayStation Anti-modchip (English)";
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;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class Phenoprotect
{
// TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_phenoprotect.shtml
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,164 @@
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)
{
if (file == null)
return string.Empty;
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)
{
irefBuild = 0;
if (file == null)
return string.Empty;
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 "";
}
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class Roxxe
{
// TODO: Implement - http://web.archive.org/web/20050309084802/http://www.roxxe.cz
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class SAFEAUDIO
{
// TODO: Implement - https://www.cdmediaworld.com/hardware/cdrom/cd_protections_safeaudio.shtml
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,216 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class SafeDisc
{
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;
}
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;
}
private static string GetDPlayerXVersion(string file)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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");
}
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,162 @@
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);
if ((position = fileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1)
return "SecuROM " + GetV5Version(file, position);
if (fileContent.Contains(".securom")
|| fileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0))
{
return "SecuROM " + GetV7Version(file);
}
if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
return "SecuROM Product Activation " + Utilities.GetFileVersion(file);
if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
return "SecuROM Product Activation " + Utilities.GetFileVersion(file);
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)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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"
}
}
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,152 @@
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);
}
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 = string.Empty;
if (file != null)
companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
if (companyName.Contains("solidshield") || companyName.Contains("tages"))
return "SolidShield Core.dll " + Utilities.GetFileVersion(file);
}
if ((position = fileContent.IndexOf("" + (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE)) > -1)
{
var id1 = fileContent.Substring(position + 5, 3);
var id2 = fileContent.Substring(position + 16, 4);
if (id1 == "" + (char)0x00 + (char)0x00 + (char)0x00 && id2 == "" + (char)0x00 + (char)0x10 + (char)0x00 + (char)0x00)
return "SolidShield 1 (SolidShield EXE Wrapper)";
else if (id1 == ".o&" && id2 == "ÛÅ›¹")
return "SolidShield 2 (SolidShield v2 EXE Wrapper)"; // TODO: Verify against other SolidShield 2 discs
}
if (fileContent.Contains("A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00
+ "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00
+ "M" + (char)0x00 + "a" + (char)0x00 + "n" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "r"))
{
string companyName = string.Empty;
if (file != null)
companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
if (companyName.Contains("solidshield") || companyName.Contains("tages"))
return "SolidShield Activation Manager Module " + Utilities.GetFileVersion(file);
}
if ((position = fileContent.IndexOf("" + (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA)) > -1)
{
if ((fileContent[position + 3] == (char)0x04 || fileContent[position + 3] == (char)0x05)
&& fileContent.Substring(position + 4, 3) == "" + (char)0x00 + (char)0x00 + (char)0x00
&& fileContent.Substring(position + 15, 4) == "" + (char)0x00 + (char)0x10 + (char)0x00 + (char)0x00)
{
return "SolidShield 2 (SolidShield v2 EXE Wrapper)";
}
else if (fileContent.Substring(position + 4, 3) == "" + (char)0x00 + (char)0x00 + (char)0x00
&& fileContent.Substring(position + 15, 4) == "" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00)
{
position = fileContent.IndexOf("T" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "s"
+ (char)0x00 + "S" + (char)0x00 + "e" + (char)0x00 + "t" + (char)0x00 + "u" + (char)0x00 + "p"
+ (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "0" + (char)0x00 + (char)0x8
+ (char)0x00 + (char)0x1 + (char)0x0 + "F" + (char)0x00 + "i" + (char)0x00 + "l" + (char)0x00 + "e"
+ (char)0x00 + "V" + (char)0x00 + "e" + (char)0x00 + "r" + (char)0x00 + "s" + (char)0x00 + "i" + (char)0x00
+ "o" + (char)0x00 + "n" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00);
if (position > -1)
{
position--; // TODO: Verify this subtract
return "SolidShield 2 + Tagès " + fileContent.Substring(position + 0x38, 1) + "." + fileContent.Substring(position + 0x38 + 4, 1) + "." + fileContent.Substring(position + 0x38 + 8, 1) + "." + fileContent.Substring(position + 0x38 + 12, 1);
}
else
{
return "SolidShield 2 (SolidShield v2 EXE Wrapper)";
}
}
}
if ((position = fileContent.IndexOf("Solidshield")) > 0)
{
return "SolidShield " + GetVersion(file, position);
}
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)
{
if (file == null)
return string.Empty;
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;
}
}
}
}

View 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);
}
if (fileContent.Contains(".sforce")
|| fileContent.Contains(".brick"))
{
return "StarForce 3-5";
}
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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,39 @@
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)
{
if (file == null)
return string.Empty;
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 "";
}
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,104 @@
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)
{
List<string> protections = new List<string>();
// 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)
{
protections.Add("TAGES");
}
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));
protections.Add("TAGES Activation Client " + Utilities.GetFileVersion(file));
}
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));
protections.Add("TAGES Setup " + Utilities.GetFileVersion(file));
}
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));
protections.Add("TAGES Setup " + Utilities.GetFileVersion(file));
}
if (protections.Count() == 0)
return null;
else
return string.Join(", ", protections);
}
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)
{
if (file == null)
return string.Empty;
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 "";
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class TheBongle
{
// TODO: Implement - http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm
}
}

View File

@@ -0,0 +1,7 @@
namespace BurnOutSharp.ProtectionType
{
public class TheCopyProtectedCD
{
// TODO: Implement - http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,123 @@
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
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);
}
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)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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)
{
if (file == null)
return string.Empty;
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 "";
}
}
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

291
BurnOutSharp/Utilities.cs Normal file
View File

@@ -0,0 +1,291 @@
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)
{
if (file == null)
return string.Empty;
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
}
}

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LessIO" version="0.5.0" targetFramework="net461" />
<package id="libmspack4n" version="0.8.0" targetFramework="net461" />
<package id="UnshieldSharp" version="1.4.2.1" targetFramework="net461" />
<package id="zlib.net" version="1.0.4.0" targetFramework="net461" />
</packages>

View File

@@ -1,5 +1,7 @@
# BurnOutSharp
[![Build status](https://ci.appveyor.com/api/projects/status/gmdft5bk1h8a1c31?svg=true)](https://ci.appveyor.com/project/mnadareski/burnoutsharp)
C# port of the protection scanning ability of [BurnOut](http://burnout.sourceforge.net/) plus numerous updates and additions. This currently compiles as a library so it can be used in any C# application. For an example of usage, see [DICUI](https://github.com/reignstumble/DICUI).
In addition to the original BurnOut code, this port adds the ability to scan inside of Microsoft CAB files (courtesy of [libmspack4n](https://github.com/activescott/libmspack4n)) and InstallShield CAB files (courtesy of [UnshieldSharp](https://github.com/mnadareski/UnshieldSharp)).
@@ -45,7 +47,7 @@ Below is a list of the protections that can be detected using this code:
- Origin (partial)
- ProtectDisc
- Protect DVD-Video
- PSX LibCrypt (partial)
- PlayStation Anti-modchip (En/Jp, not "Red Hand")
- Ring PROTECH
- SafeCast
- SafeDisc (all versions)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>
</configuration>

View File

@@ -8,12 +8,21 @@ namespace Test
{
static void Main(string[] args)
{
var p = new Progress<FileProtection>();
p.ProgressChanged += Changed;
foreach (string arg in args)
{
Console.WriteLine(String.Join("\r\n", ProtectionFind.Scan(arg).Select(kvp => kvp.Key + ": " + kvp.Value)));
Console.WriteLine(String.Join("\r\n", ProtectionFind.Scan(arg, p).Select(kvp => kvp.Key + ": " + kvp.Value)));
}
Console.ReadLine();
//ProtectionFind.ScanSectors('D', 2048);
}
private static void Changed(object source, FileProtection value)
{
Console.WriteLine($"{value.Percentage * 100:N2}%: {value.Filename} - {value.Protection}");
}
}
}

View File

@@ -8,9 +8,10 @@
<OutputType>Exe</OutputType>
<RootNamespace>Test</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>