Else-If causes some issues

This commit is contained in:
Matt Nadareski
2019-09-28 01:51:06 -07:00
parent c109aceb24
commit ca0d695470
12 changed files with 71 additions and 78 deletions

View File

@@ -248,6 +248,11 @@ namespace BurnOutSharp
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SafeDisc
protection = SafeDisc.CheckPath(path, files, isDirectory);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SafeDisc Lite
protection = SafeDiscLite.CheckPath(path, files, isDirectory);
if (!string.IsNullOrWhiteSpace(protection))

View File

@@ -5,11 +5,9 @@
public static string CheckContents(string fileContent)
{
if (fileContent.Contains("TMSAMVOF"))
{
return "ActiveMARK";
}
else if (fileContent.Contains(" " + (char)0xC2 + (char)0x16 + (char)0x00 + (char)0xA8 + (char)0xC1 + (char)0x16
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))
{

View File

@@ -13,7 +13,7 @@ namespace BurnOutSharp.ProtectionType
if ((position = fileContent.IndexOf("CD-Cops, ver. ")) > -1)
return "CD-Cops " + GetVersion(file, position);
else if (fileContent.Contains(".grand" + (char)0x00))
if (fileContent.Contains(".grand" + (char)0x00))
return "CD-Cops";
return null;

View File

@@ -18,10 +18,9 @@ namespace BurnOutSharp.ProtectionType
return "JoWooD X-Prot v1";
}
}
else if (fileContent.Contains("@HC09 "))
{
if (fileContent.Contains("@HC09 "))
return "JoWooD X-Prot v2";
}
return null;
}

View File

@@ -18,29 +18,23 @@ namespace BurnOutSharp.ProtectionType
return "LaserLock " + GetVersion(fileContent, position) + " " + GetBuild(fileContent, true);
}
else if (fileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE"))
{
if (fileContent.Contains("Packed by SPEEnc V2 Asterios Parlamentas.PE"))
return "LaserLock Marathon " + GetBuild(fileContent, false);
}
else if ((position = fileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
if ((position = fileContent.IndexOf("GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
+ "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00
+ "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF")) > -1)
{
return "LaserLock " + GetVersion(fileContent, --position) + " " + GetBuild(fileContent, false);
}
else if (Path.GetFileName(file) == "NOMOUSE.SP")
{
if (Path.GetFileName(file) == "NOMOUSE.SP")
return "LaserLock " + GetVersion16Bit(file);
}
else if (fileContent.Contains(":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP"))
{
if (fileContent.Contains(":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP"))
return "LaserLock 3";
}
else if (fileContent.Contains("LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK"
if (fileContent.Contains("LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK"
+ (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3"))
{
return "LaserLock 5";

View File

@@ -8,9 +8,11 @@ namespace BurnOutSharp.ProtectionType
{
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)";
else if (fileContent.Contains("強制終了しました。\n本体が改造されている\nおそれがあります。"))
if (fileContent.Contains("強制終了しました。\n本体が改造されている\nおそれがあります。"))
return "PlayStation Anti-modchip (Japanese)";
return null;

View File

@@ -7,6 +7,31 @@ 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)
@@ -70,31 +95,6 @@ namespace BurnOutSharp.ProtectionType
return null;
}
public static string CheckContents(string file, string fileContent)
{
int position;
if ((position = fileContent.IndexOf("BoG_ *90.0&!! Yy>")) > -1)
{
if (fileContent.IndexOf("product activation library") > 0)
return "SafeCast " + GetVersion(file, position);
else
return "SafeDisc " + GetVersion(file, position);
}
if (fileContent.Contains((char)0x00 + (char)0x00 + "BoG_")
|| fileContent.Contains("stxt774")
|| fileContent.Contains("stxt371"))
{
string version = EVORE.SearchSafeDiscVersion(file);
if (version.Length > 0)
return "SafeDisc " + version;
return "SafeDisc 3.20-4.xx (version removed)";
}
return null;
}
private static string GetDPlayerXVersion(string file)
{
FileInfo fi = new FileInfo(file);

View File

@@ -11,32 +11,24 @@ namespace BurnOutSharp.ProtectionType
{
int position;
if ((position = fileContent.IndexOf("AddD" + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00)) > -1)
{
return "SecuROM " + GetV4Version(file, position);
}
else if ((position = fileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1)
{
if ((position = fileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1)
return "SecuROM " + GetV5Version(file, position);
}
else if (fileContent.Contains(".securom")
if (fileContent.Contains(".securom")
|| fileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0))
{
return "SecuROM " + GetV7Version(file);
}
else if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
{
if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
return "SecuROM Product Activation " + Utilities.GetFileVersion(file);
}
else if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
{
if (fileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
return "SecuROM Product Activation " + Utilities.GetFileVersion(file);
}
else if (fileContent.Contains(".cms_t" + (char)0x00)
if (fileContent.Contains(".cms_t" + (char)0x00)
|| fileContent.Contains(".cms_d" + (char)0x00))
{
return "SecuROM 1-3";

View File

@@ -17,7 +17,7 @@ namespace BurnOutSharp.ProtectionType
return "SolidShield " + Utilities.GetFileVersion(file);
}
else if (fileContent.Contains("S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00
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")
@@ -32,7 +32,7 @@ namespace BurnOutSharp.ProtectionType
return "SolidShield Core.dll " + Utilities.GetFileVersion(file);
}
else if ((position = fileContent.IndexOf("" + (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE)) > -1)
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);
@@ -43,7 +43,7 @@ namespace BurnOutSharp.ProtectionType
return "SolidShield 2 (SolidShield v2 EXE Wrapper)"; // TODO: Verify against other SolidShield 2 discs
}
else if (fileContent.Contains("A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00
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"))
{
@@ -52,7 +52,7 @@ namespace BurnOutSharp.ProtectionType
return "SolidShield Activation Manager Module " + Utilities.GetFileVersion(file);
}
else if ((position = fileContent.IndexOf("" + (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA)) > -1)
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
@@ -81,12 +81,12 @@ namespace BurnOutSharp.ProtectionType
}
}
else if ((position = fileContent.IndexOf("Solidshield")) > 0)
if ((position = fileContent.IndexOf("Solidshield")) > 0)
{
return "SolidShield " + GetVersion(file, position);
}
else if (fileContent.Contains("B" + (char)0x00 + "I" + (char)0x00 + "N" + (char)0x00 + (char)0x7 + (char)0x00 +
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))
{

View File

@@ -26,13 +26,13 @@ namespace BurnOutSharp.ProtectionType
return "StarForce " + Utilities.GetFileVersion(file);
}
else if (fileContent.Contains(".sforce")
if (fileContent.Contains(".sforce")
|| fileContent.Contains(".brick"))
{
return "StarForce 3-5";
}
else if (fileContent.Contains("P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00
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"))
{

View File

@@ -25,27 +25,34 @@ namespace BurnOutSharp.ProtectionType
{
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)
{
return "TAGES";
protections.Add("TAGES");
}
else if (files.Count(f => Path.GetFileName(f).Equals("tagesclient.exe", StringComparison.OrdinalIgnoreCase)) > 0)
if (files.Count(f => Path.GetFileName(f).Equals("tagesclient.exe", StringComparison.OrdinalIgnoreCase)) > 0)
{
string file = files.First(f => Path.GetFileName(f).Equals("tagesclient.exe", StringComparison.OrdinalIgnoreCase));
return "TAGES Activation Client " + Utilities.GetFileVersion(file);
protections.Add("TAGES Activation Client " + Utilities.GetFileVersion(file));
}
else if (files.Count(f => Path.GetFileName(f).Equals("TagesSetup.exe", StringComparison.OrdinalIgnoreCase)) > 0)
if (files.Count(f => Path.GetFileName(f).Equals("TagesSetup.exe", StringComparison.OrdinalIgnoreCase)) > 0)
{
string file = files.First(f => Path.GetFileName(f).Equals("TagesSetup.exe", StringComparison.OrdinalIgnoreCase));
return "TAGES Setup " + Utilities.GetFileVersion(file);
protections.Add("TAGES Setup " + Utilities.GetFileVersion(file));
}
else if (files.Count(f => Path.GetFileName(f).Equals("TagesSetup_x64.exe", StringComparison.OrdinalIgnoreCase)) > 0)
if (files.Count(f => Path.GetFileName(f).Equals("TagesSetup_x64.exe", StringComparison.OrdinalIgnoreCase)) > 0)
{
string file = files.First(f => Path.GetFileName(f).Equals("TagesSetup_x64.exe", StringComparison.OrdinalIgnoreCase));
return "TAGES Setup " + Utilities.GetFileVersion(file);
protections.Add("TAGES Setup " + Utilities.GetFileVersion(file));
}
if (protections.Count() == 0)
return null;
else
return string.Join(", ", protections);
}
else
{

View File

@@ -11,11 +11,9 @@ namespace BurnOutSharp.ProtectionType
{
int position;
if ((position = fileContent.IndexOf("VOB ProtectCD")) > -1)
{
return "VOB ProtectCD/DVD " + GetOldVersion(file, --position); // TODO: Verify this subtract
}
else if ((position = fileContent.IndexOf("DCP-BOV" + (char)0x00 + (char)0x00)) > -1)
if ((position = fileContent.IndexOf("DCP-BOV" + (char)0x00 + (char)0x00)) > -1)
{
string version = GetVersion(file, --position); // TODO: Verify this subtract
if (version.Length > 0)
@@ -36,10 +34,8 @@ namespace BurnOutSharp.ProtectionType
return "VOB ProtectCD/DVD 5.9-6.0" + GetBuild(file, position);
}
else if (fileContent.Contains(".vob.pcd"))
{
if (fileContent.Contains(".vob.pcd"))
return "VOB ProtectCD";
}
return null;
}