Compare commits

...

5 Commits
3.4.0 ... 3.4.1

Author SHA1 Message Date
Matt Nadareski
50b4eb99e3 Bump version 2025-09-24 12:38:01 -04:00
Matt Nadareski
08a90d52a8 Update packages 2025-09-24 12:14:31 -04:00
Matt Nadareski
d41cd63ad7 Use "proper" namespace since it's public 2025-09-22 21:05:39 -04:00
Matt Nadareski
c12d3fbe15 Progress doesn't need to be hindered 2025-09-22 21:04:17 -04:00
Matt Nadareski
4db1c57830 Internalize Func for .NET Framework 2.0 2025-09-22 21:01:23 -04:00
102 changed files with 301 additions and 371 deletions

View File

@@ -17,7 +17,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.5" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.6" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -6,11 +6,14 @@ namespace BinaryObjectScanner.Test.FileType
{
public class LDSCRYPTTests
{
private static readonly SabreTools.Serialization.Wrappers.LDSCRYPT wrapper
= new(new SabreTools.Models.LDSCRYPT.EncryptedFile(), new MemoryStream(new byte[1024]));
[Fact]
public void DetectFile_EmptyString_Null()
{
string file = string.Empty;
var detectable = new LDSCRYPT();
var detectable = new LDSCRYPT(wrapper);
string? actual = detectable.Detect(file, includeDebug: false);
Assert.Null(actual);
@@ -21,10 +24,10 @@ namespace BinaryObjectScanner.Test.FileType
{
Stream? stream = new MemoryStream();
string file = string.Empty;
var detectable = new LDSCRYPT();
var detectable = new LDSCRYPT(wrapper);
string? actual = detectable.Detect(stream, file, includeDebug: false);
Assert.Null(actual);
Assert.Equal("LDSCRYPT", actual);
}
}
}

View File

@@ -6,11 +6,14 @@ namespace BinaryObjectScanner.Test.FileType
{
public class RealArcadeInstallerTests
{
private static readonly SabreTools.Serialization.Wrappers.RealArcadeInstaller wrapper
= new(new SabreTools.Models.RealArcade.RgsFile(), new MemoryStream(new byte[1024]));
[Fact]
public void DetectFile_EmptyString_Null()
{
string file = string.Empty;
var detectable = new RealArcadeInstaller();
var detectable = new RealArcadeInstaller(wrapper);
string? actual = detectable.Detect(file, includeDebug: false);
Assert.Null(actual);
@@ -21,10 +24,10 @@ namespace BinaryObjectScanner.Test.FileType
{
Stream? stream = new MemoryStream();
string file = string.Empty;
var detectable = new RealArcadeInstaller();
var detectable = new RealArcadeInstaller(wrapper);
string? actual = detectable.Detect(stream, file, includeDebug: false);
Assert.Null(actual);
Assert.Equal("RealArcade Installer", actual);
}
}
}

View File

@@ -6,11 +6,14 @@ namespace BinaryObjectScanner.Test.FileType
{
public class RealArcadeMezzanineTests
{
private static readonly SabreTools.Serialization.Wrappers.RealArcadeMezzanine wrapper
= new(new SabreTools.Models.RealArcade.Mezzanine(), new MemoryStream(new byte[1024]));
[Fact]
public void DetectFile_EmptyString_Null()
{
string file = string.Empty;
var detectable = new RealArcadeMezzanine();
var detectable = new RealArcadeMezzanine(wrapper);
string? actual = detectable.Detect(file, includeDebug: false);
Assert.Null(actual);
@@ -21,10 +24,10 @@ namespace BinaryObjectScanner.Test.FileType
{
Stream? stream = new MemoryStream();
string file = string.Empty;
var detectable = new RealArcadeMezzanine();
var detectable = new RealArcadeMezzanine(wrapper);
string? actual = detectable.Detect(stream, file, includeDebug: false);
Assert.Null(actual);
Assert.Equal("RealArcade Mezzanine", actual);
}
}
}

View File

@@ -6,11 +6,14 @@ namespace BinaryObjectScanner.Test.FileType
{
public class SFFSTests
{
private static readonly SabreTools.Serialization.Wrappers.SFFS wrapper
= new(new SabreTools.Models.StarForce.FileSystem(), new MemoryStream(new byte[1024]));
[Fact]
public void DetectFile_EmptyString_Null()
{
string file = string.Empty;
var detectable = new SFFS();
var detectable = new SFFS(wrapper);
string? actual = detectable.Detect(file, includeDebug: false);
Assert.Null(actual);
@@ -21,10 +24,10 @@ namespace BinaryObjectScanner.Test.FileType
{
Stream? stream = new MemoryStream();
string file = string.Empty;
var detectable = new SFFS();
var detectable = new SFFS(wrapper);
string? actual = detectable.Detect(stream, file, includeDebug: false);
Assert.Null(actual);
Assert.Equal("StarForce Filesystem Container", actual);
}
}
}

View File

@@ -13,7 +13,7 @@
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>3.4.0</Version>
<Version>3.4.1</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
@@ -54,10 +54,9 @@
<ItemGroup>
<PackageReference Include="SabreTools.Hashing" Version="1.5.0" />
<PackageReference Include="SabreTools.IO" Version="1.7.3" />
<PackageReference Include="SabreTools.Matching" Version="1.6.0" />
<PackageReference Include="SabreTools.Models" Version="1.7.1" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.5" />
<PackageReference Include="SabreTools.IO" Version="1.7.5" />
<PackageReference Include="SabreTools.Models" Version="1.7.2" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.6" />
<PackageReference Include="SharpCompress" Version="0.40.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.9" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
</ItemGroup>

View File

@@ -1,32 +1,17 @@
using System;
using System.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using System.IO;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Link Data Security encrypted file
/// </summary>
public class LDSCRYPT : DetectableBase
public class LDSCRYPT : DetectableBase<SabreTools.Serialization.Wrappers.LDSCRYPT>
{
/// <inheritdoc/>
public LDSCRYPT(SabreTools.Serialization.Wrappers.LDSCRYPT wrapper) : base(wrapper) { }
/// <inheritdoc/>
public override string? Detect(Stream stream, string file, bool includeDebug)
{
try
{
int bytesToRead = (int)Math.Min(16, stream.Length);
byte[] magic = stream.ReadBytes(bytesToRead);
if (magic.StartsWith(new byte?[] { 0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54 }))
return "Link Data Security encrypted file";
}
catch (Exception ex)
{
if (includeDebug) Console.Error.WriteLine(ex);
}
return null;
}
=> "LDSCRYPT";
}
}

View File

@@ -1,7 +1,4 @@
using System;
using System.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using System.IO;
namespace BinaryObjectScanner.FileType
{
@@ -10,27 +7,13 @@ namespace BinaryObjectScanner.FileType
///
/// TODO: Add further parsing, game ID and name should be possible to parse.
/// </summary>
public class RealArcadeInstaller : DetectableBase
public class RealArcadeInstaller : DetectableBase<SabreTools.Serialization.Wrappers.RealArcadeInstaller>
{
/// <inheritdoc/>
public RealArcadeInstaller(SabreTools.Serialization.Wrappers.RealArcadeInstaller wrapper) : base(wrapper) { }
/// <inheritdoc/>
public override string? Detect(Stream stream, string file, bool includeDebug)
{
try
{
int bytesToRead = (int)Math.Min(16, stream.Length);
byte[] magic = stream.ReadBytes(bytesToRead);
// RASGI2.0
// Found in the ".rgs" files in IA item "Nova_RealArcadeCD_USA".
if (magic.StartsWith(new byte?[] { 0x52, 0x41, 0x53, 0x47, 0x49, 0x32, 0x2E, 0x30 }))
return "RealArcade Installer";
}
catch (Exception ex)
{
if (includeDebug) Console.Error.WriteLine(ex);
}
return null;
}
=> "RealArcade Installer";
}
}

View File

@@ -1,7 +1,4 @@
using System;
using System.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using System.IO;
namespace BinaryObjectScanner.FileType
{
@@ -10,27 +7,13 @@ namespace BinaryObjectScanner.FileType
///
/// TODO: Add further parsing, game ID should be possible to parse.
/// </summary>
public class RealArcadeMezzanine : DetectableBase
public class RealArcadeMezzanine : DetectableBase<SabreTools.Serialization.Wrappers.RealArcadeMezzanine>
{
/// <inheritdoc/>
public RealArcadeMezzanine(SabreTools.Serialization.Wrappers.RealArcadeMezzanine wrapper) : base(wrapper) { }
/// <inheritdoc/>
public override string? Detect(Stream stream, string file, bool includeDebug)
{
try
{
int bytesToRead = (int)Math.Min(16, stream.Length);
byte[] magic = stream.ReadBytes(bytesToRead);
// XZip2.0
// Found in the ".mez" files in IA item "Nova_RealArcadeCD_USA".
if (magic.StartsWith(new byte?[] { 0x58, 0x5A, 0x69, 0x70, 0x32, 0x2E, 0x30 }))
return "RealArcade Mezzanine";
}
catch (Exception ex)
{
if (includeDebug) Console.Error.WriteLine(ex);
}
return null;
}
=> "RealArcade Mezzanine";
}
}

View File

@@ -1,7 +1,4 @@
using System;
using System.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using System.IO;
namespace BinaryObjectScanner.FileType
{
@@ -10,25 +7,13 @@ namespace BinaryObjectScanner.FileType
/// </summary>
/// <see href="https://forum.xentax.com/viewtopic.php?f=21&t=2084"/>
/// TODO: Implement extraction
public class SFFS : DetectableBase
public class SFFS : DetectableBase<SabreTools.Serialization.Wrappers.SFFS>
{
/// <inheritdoc/>
public SFFS(SabreTools.Serialization.Wrappers.SFFS wrapper) : base(wrapper) { }
/// <inheritdoc/>
public override string? Detect(Stream stream, string file, bool includeDebug)
{
try
{
int bytesToRead = (int)Math.Min(16, stream.Length);
byte[] magic = stream.ReadBytes(bytesToRead);
if (magic.StartsWith(new byte?[] { 0x53, 0x46, 0x46, 0x53 }))
return "StarForce Filesystem Container";
}
catch (Exception ex)
{
if (includeDebug) Console.Error.WriteLine(ex);
}
return null;
}
=> "StarForce Filesystem Container";
}
}

View File

@@ -5,39 +5,39 @@
namespace BinaryObjectScanner
{
public delegate TResult Func<out TResult>();
internal delegate TResult Func<out TResult>();
public delegate TResult Func<in T, out TResult>(T arg);
internal delegate TResult Func<in T, out TResult>(T arg);
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
internal delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
internal delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
internal delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
internal delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
}
#endif

View File

@@ -3,7 +3,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace BinaryObjectScanner
namespace System
{
/// <summary>Defines a provider for progress updates.</summary>
/// <typeparam name="T">The type of progress update value.</typeparam>

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -1,5 +1,5 @@
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.IO.Extensions;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -16,7 +16,7 @@ namespace BinaryObjectScanner.Packer
{
// This check may be overly limiting, as it excludes the sample provided to DiE (https://github.com/horsicq/Detect-It-Easy/issues/102).
// TODO: Find further samples and invesitgate if the "peC" section is only present on specific versions.
bool importTableMatch = Array.Exists(exe.ImportTable?.ImportDirectoryTable ?? [],
bool importTableMatch = Array.Exists(exe.ImportDirectoryTable ?? [],
idte => idte.Name == "KeRnEl32.dLl");
if (exe.ContainsSection("peC", exact: true) && importTableMatch)

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer

View File

@@ -40,7 +40,7 @@ namespace BinaryObjectScanner.Packer
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
// Check the export directory table, if it exists
if (exe.ExportTable?.ExportDirectoryTable != null)
if (exe.ExportDirectoryTable != null)
{
var version = GetPEExportDirectoryVersion(exe);
if (!string.IsNullOrEmpty(version))
@@ -621,8 +621,8 @@ namespace BinaryObjectScanner.Packer
/// TODO: Research to see if the versions are embedded elsewhere in these files
private static string? GetPEExportDirectoryVersion(PortableExecutable exe)
{
string sfxFileName = exe.ExportTable?.ExportDirectoryTable?.Name ?? string.Empty;
uint sfxTimeDateStamp = exe.ExportTable?.ExportDirectoryTable?.TimeDateStamp ?? uint.MaxValue;
string sfxFileName = exe.ExportDirectoryTable?.Name ?? string.Empty;
uint sfxTimeDateStamp = exe.ExportDirectoryTable?.TimeDateStamp ?? uint.MaxValue;
string assemblyVersion = exe.AssemblyVersion ?? "Unknown Version";
// Standard

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic;
using System.Text;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -67,7 +67,7 @@ namespace BinaryObjectScanner.Protection
if (name.OptionalEquals("ByteShield Client"))
return $"ByteShield Activation Client {exe.GetInternalVersion()}";
name = exe.ExportTable?.ExportDirectoryTable?.Name;
name = exe.ExportDirectoryTable?.Name;
// Found in "ByteShield.dll" in Redump entry 6236
if (name.OptionalEquals("ByteShield Client"))

View File

@@ -3,10 +3,9 @@ using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -29,19 +29,19 @@ namespace BinaryObjectScanner.Protection
// TODO: Investigate the numerous ".guard" sections present in "Randevu.exe" in Redump entry 97142.
// Get the export directory table
if (exe.ExportTable?.ExportDirectoryTable != null)
if (exe.ExportDirectoryTable != null)
{
// Found in "cdguard.dll" in Redump entry 97142 and IA item "pahgeby-he3hakomkou".
bool match = exe.ExportTable.ExportDirectoryTable.Name.OptionalEquals("cdguard.dll", StringComparison.OrdinalIgnoreCase);
bool match = exe.ExportDirectoryTable.Name.OptionalEquals("cdguard.dll", StringComparison.OrdinalIgnoreCase);
if (match)
return "CD-Guard Copy Protection System";
}
// Get the import directory table
if (exe.ImportTable?.ImportDirectoryTable != null)
if (exe.ImportDirectoryTable != null)
{
// Found in "Randevu.exe" in Redump entry 97142.
bool match = Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name != null && idte.Name.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase));
bool match = Array.Exists(exe.ImportDirectoryTable, idte => idte?.Name != null && idte.Name.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase));
if (match)
return "CD-Guard Copy Protection System";
}

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -10,9 +10,9 @@ namespace BinaryObjectScanner.Protection
{
// TODO: Indicates Hypertech Crack Proof as well?
//// Get the import directory table
//if (exe.ImportTable?.ImportDirectoryTable != null)
//if (exe.ImportDirectoryTable != null)
//{
// bool match = exe.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "KeRnEl32.dLl");
// bool match = exe.ImportDirectoryTable.Any(idte => idte.Name == "KeRnEl32.dLl");
// if (match)
// return "CDSHiELD SE";
//}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -19,10 +19,10 @@ namespace BinaryObjectScanner.Protection
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
// Get the export directory table
if (exe.ExportTable?.ExportDirectoryTable != null)
if (exe.ExportDirectoryTable != null)
{
// Found in "cenega.dll" in IA item "speed-pack".
bool match = exe.ExportTable.ExportDirectoryTable.Name.OptionalEquals("ProtectDVD.dll", StringComparison.OrdinalIgnoreCase);
bool match = exe.ExportDirectoryTable.Name.OptionalEquals("ProtectDVD.dll", StringComparison.OrdinalIgnoreCase);
if (match)
return "Cenega ProtectDVD";
}

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -2,10 +2,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
using OHMN = SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber;
using OHMN = SabreTools.Models.COFF.OptionalHeaderMagicNumber;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -20,11 +20,11 @@ namespace BinaryObjectScanner.Protection
// Most every tested sample of "engine32.dll" has a product name of "engine32", and the file description typically follows the naming pattern of "[Game Name] DLL-helper".
// Detects Engine32 within the game executables that contain it.
if (exe.ImportTable?.ImportDirectoryTable != null && exe.ImportTable?.HintNameTable != null)
if (exe.ImportDirectoryTable != null && exe.ImportHintNameTable != null)
{
bool importDirectoryTableMatch = Array.Exists(exe.ImportTable.ImportDirectoryTable,
bool importDirectoryTableMatch = Array.Exists(exe.ImportDirectoryTable,
idte => idte?.Name != null && idte.Name.Equals("ENGINE32.DLL", StringComparison.OrdinalIgnoreCase));
bool hintNameTableMatch = Array.Exists(exe.ImportTable.HintNameTable,
bool hintNameTableMatch = Array.Exists(exe.ImportHintNameTable,
ihne => ihne?.Name == "InitEngine");
// The Hint/Name Table Entry "DeinitEngine" is present in every tested sample, aside from TOCA Race Driver 2 (Redump entries 104593-104596).
@@ -33,10 +33,10 @@ namespace BinaryObjectScanner.Protection
}
// Detects Engine32 within the file "engine32.dll".
if (exe.ExportTable?.ExportNameTable?.Strings != null)
if (exe.ExportNameTable?.Strings != null)
{
bool exportNameTableMatch1 = Array.Exists(exe.ExportTable.ExportNameTable.Strings, s => s == "engine32.dll");
bool exportNameTableMatch2 = Array.Exists(exe.ExportTable.ExportNameTable.Strings, s => s == "DeinitEngine");
bool exportNameTableMatch1 = Array.Exists(exe.ExportNameTable.Strings, s => s == "engine32.dll");
bool exportNameTableMatch2 = Array.Exists(exe.ExportNameTable.Strings, s => s == "DeinitEngine");
if (exportNameTableMatch1 && exportNameTableMatch2)
return "Engine32";

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -22,9 +22,9 @@ namespace BinaryObjectScanner.Protection
return $"Games for Windows LIVE {exe.GetInternalVersion()}";
// Get the import directory table
if (exe.ImportTable?.ImportDirectoryTable != null)
if (exe.ImportDirectoryTable != null)
{
if (Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name == "xlive.dll"))
if (Array.Exists(exe.ImportDirectoryTable, idte => idte?.Name == "xlive.dll"))
return "Games for Windows LIVE";
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -20,17 +20,13 @@ namespace BinaryObjectScanner.Protection
/// <inheritdoc/>
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
var exportTable = exe.ExportTable;
if (exportTable != null)
{
// Found in Bomberman Vol 2 (Japan)
if (exportTable.ExportDirectoryTable?.Name == "HVCDISSR.DLL")
return "Hudson huPPPX";
// Found in Bomberman Vol 2 (Japan)
if (exe.ExportDirectoryTable?.Name == "HVCDISSR.DLL")
return "Hudson huPPPX";
// Found in Bomberman Vol 2 (Japan)
if (Array.Exists(exportTable.ExportNameTable?.Strings ?? [], s => s.StartsWith("HVRCD_IS_")))
return "Hudson huPPPX";
}
// Found in Bomberman Vol 2 (Japan)
if (Array.Exists(exe.ExportNameTable?.Strings ?? [], s => s.StartsWith("HVRCD_IS_")))
return "Hudson huPPPX";
return null;
}

View File

@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -33,8 +33,8 @@ namespace BinaryObjectScanner.Protection
// TODO: Check for CVP* instead?
bool containsCheck = false;
if (exe.ExportTable?.ExportNameTable?.Strings != null)
containsCheck = Array.Exists(exe.ExportTable.ExportNameTable.Strings, s => s.OptionalStartsWith("CVPInitializeClient"));
if (exe.ExportNameTable?.Strings != null)
containsCheck = Array.Exists(exe.ExportNameTable.Strings, s => s.OptionalStartsWith("CVPInitializeClient"));
// Get the .rdata section strings, if they exist
bool containsCheck2 = false;

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Text;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -19,8 +19,8 @@ namespace BinaryObjectScanner.Protection
// Get the .ext section, if it exists
if (exe.ContainsSection(".ext ", exact: true))
{
bool importTableMatches = Array.Exists(exe.ImportTable?.ImportDirectoryTable ?? [], idte => idte?.Name == "kernel32.dll")
&& Array.Exists(exe.ImportTable?.HintNameTable ?? [], s => s?.Name == "VirtualProtect");
bool importTableMatches = Array.Exists(exe.ImportDirectoryTable ?? [], idte => idte?.Name == "kernel32.dll")
&& Array.Exists(exe.ImportHintNameTable ?? [], s => s?.Name == "VirtualProtect");
// Get the .dcrtext section, if it exists
if (exe.ContainsSection(".dcrtext") && importTableMatches)

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -2,9 +2,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -65,10 +65,10 @@ namespace BinaryObjectScanner.Protection
// Check the executable tables
position = exe.StubExecutableData?.FirstPosition(check) ?? -1;
bool containsCheck = position > -1;
bool containsCheck2 = Array.Exists(exe.ImportTable?.HintNameTable ?? [], hnte => hnte?.Name == "GetModuleHandleA")
&& Array.Exists(exe.ImportTable?.HintNameTable ?? [], hnte => hnte?.Name == "GetProcAddress")
&& Array.Exists(exe.ImportTable?.HintNameTable ?? [], hnte => hnte?.Name == "LoadLibraryA")
&& Array.Exists(exe.ImportTable?.ImportDirectoryTable ?? [], idte => idte?.Name == "KERNEL32.dll");
bool containsCheck2 = Array.Exists(exe.ImportHintNameTable ?? [], hnte => hnte?.Name == "GetModuleHandleA")
&& Array.Exists(exe.ImportHintNameTable ?? [], hnte => hnte?.Name == "GetProcAddress")
&& Array.Exists(exe.ImportHintNameTable ?? [], hnte => hnte?.Name == "LoadLibraryA")
&& Array.Exists(exe.ImportDirectoryTable ?? [], idte => idte?.Name == "KERNEL32.dll");
int position2 = -1;

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using SabreTools.Hashing;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -75,9 +74,9 @@ namespace BinaryObjectScanner.Protection
// TODO: Invesitgate if the "AdobeLM.dll" file (along with mentions of "AdobeLM" in executables) uniquely identifies SafeCast, or if it can be used with different DRM. (Found in IA item ccd0605)
// Get the import directory table, if it exists
if (exe.ImportTable?.ImportDirectoryTable != null)
if (exe.ImportDirectoryTable != null)
{
if (Array.Exists(exe.ImportTable.ImportDirectoryTable,
if (Array.Exists(exe.ImportDirectoryTable,
idte => idte?.Name != null && idte.Name.Equals("CdaC14BA.dll", StringComparison.OrdinalIgnoreCase)))
{
return "SafeCast";

View File

@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using SabreTools.Hashing;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -52,16 +52,16 @@ namespace BinaryObjectScanner.Protection
internal static string? SafeDiscCheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
// Found in Redump entry 57986.
if (exe.ImportTable?.HintNameTable != null)
if (exe.ImportHintNameTable != null)
{
if (Array.Exists(exe.ImportTable.HintNameTable, ihne => ihne?.Name == "LTDLL_Authenticate"))
if (Array.Exists(exe.ImportHintNameTable, ihne => ihne?.Name == "LTDLL_Authenticate"))
return "SafeDisc Lite";
}
// Found in Redump entry 57986.
if (exe.ImportTable?.ImportDirectoryTable != null)
if (exe.ImportDirectoryTable != null)
{
if (Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name == "ltdll.dll"))
if (Array.Exists(exe.ImportDirectoryTable, idte => idte?.Name == "ltdll.dll"))
return "SafeDisc Lite";
}

View File

@@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -48,9 +48,9 @@ namespace BinaryObjectScanner.Protection
}
// Get the export name table
if (exe.ExportTable?.ExportNameTable?.Strings != null)
if (exe.ExportNameTable?.Strings != null)
{
if (Array.Exists(exe.ExportTable.ExportNameTable.Strings, s => s == "DllInstallSbcp"))
if (Array.Exists(exe.ExportNameTable.Strings, s => s == "DllInstallSbcp"))
return "MediaMax CD-3";
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -2,9 +2,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -2,9 +2,8 @@
using System.Collections.Generic;
using System.Text;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.Text;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -2,10 +2,9 @@ using System;
using System.Collections.Generic;
using System.Text;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -441,11 +440,11 @@ namespace BinaryObjectScanner.Protection
// If not known, check if encrypted executable is likely an alt signing of a known executable
// Filetime could be checked here, but if it was signed at a different time, the time will vary anyways
var readPathBytes = entry.Path;
if (readPathBytes == null || readPathBytes.Length == 0)
var readPath = entry.Path;
if (readPath == null || readPath.Length == 0)
return $"SecuROM Release Control - Unknown executable {md5String},{entry.Size} - Please report to us on GitHub!";
var readPathName = Encoding.ASCII.GetString(readPathBytes).TrimEnd('\0');
var readPathName = readPath.TrimEnd('\0');
if (MatroschkaSizeFilenameDictionary.TryGetValue(entry.Size, out var pathName) && pathName == readPathName)
return $"SecuROM Release Control - Unknown possible alt executable of size {entry.Size} - Please report to us on GitHub";
@@ -493,7 +492,7 @@ namespace BinaryObjectScanner.Protection
// catch other modified PA variants (this would have also caught EA GAM, for example) and to match PiD's
// detection abilities.
name = exe.ExportTable?.ExportNameTable?.Strings?[0];
name = exe.ExportNameTable?.Strings?[0];
if (name.OptionalEquals("drm_pagui_doit"))
{
// Not all of them are guaranteed to have an internal version

View File

@@ -1,9 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -93,15 +92,15 @@ namespace BinaryObjectScanner.Protection
}
// Get the import directory table, if it exists
if (exe.ImportTable?.ImportDirectoryTable != null)
if (exe.ImportDirectoryTable != null)
{
if (Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name == "dvm.dll"))
if (Array.Exists(exe.ImportDirectoryTable, idte => idte?.Name == "dvm.dll"))
return "SolidShield EXE Wrapper v1";
if (Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name == "activation.x86.dll"))
if (Array.Exists(exe.ImportDirectoryTable, idte => idte?.Name == "activation.x86.dll"))
return "SolidShield EXE Wrapper v2";
if (Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name == "activation.x64.dll"))
if (Array.Exists(exe.ImportDirectoryTable, idte => idte?.Name == "activation.x64.dll"))
return "SolidShield EXE Wrapper v2";
}

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection
@@ -90,10 +90,10 @@ namespace BinaryObjectScanner.Protection
// return $"StarForce {Tools.Utilities.GetInternalVersion(exe)}";
// Check the export name table
if (exe.ExportTable?.ExportNameTable?.Strings != null)
if (exe.ExportNameTable?.Strings != null)
{
// TODO: Should we just check for "PSA_*" instead of a single entry?
if (Array.Exists(exe.ExportTable.ExportNameTable.Strings, s => s == "PSA_GetDiscLabel"))
if (Array.Exists(exe.ExportNameTable.Strings, s => s == "PSA_GetDiscLabel"))
return $"StarForce {exe.GetInternalVersion()}";
}

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Content;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO;
using SabreTools.IO.Extensions;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO.Matching;
using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Protection

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.Matching;
using SabreTools.Matching.Paths;
using SabreTools.IO;
using SabreTools.IO.Matching;
namespace BinaryObjectScanner.Protection
{

View File

@@ -4,6 +4,7 @@ using System.IO;
using BinaryObjectScanner.Data;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO.Extensions;
using SabreTools.Serialization;
using SabreTools.Serialization.Interfaces;
using SabreTools.Serialization.Wrappers;
@@ -477,20 +478,20 @@ namespace BinaryObjectScanner
{
case AACSMediaKeyBlock obj: return new FileType.AACSMediaKeyBlock(obj);
case BDPlusSVM obj: return new FileType.BDPlusSVM(obj);
case LDSCRYPT obj: return new FileType.LDSCRYPT(obj);
case LinearExecutable obj: return new FileType.LinearExecutable(obj);
case MSDOS obj: return new FileType.MSDOS(obj);
case NewExecutable obj: return new FileType.NewExecutable(obj);
case PlayJAudioFile obj: return new FileType.PLJ(obj);
case PortableExecutable obj: return new FileType.PortableExecutable(obj);
case RealArcadeInstaller obj: return new FileType.RealArcadeInstaller(obj);
case RealArcadeMezzanine obj: return new FileType.RealArcadeMezzanine(obj);
case SFFS obj: return new FileType.SFFS(obj);
}
// Fall back on the file type for types not implemented in Serialization
return fileType switch
{
WrapperType.LDSCRYPT => new FileType.LDSCRYPT(),
WrapperType.RealArcadeInstaller => new FileType.RealArcadeInstaller(),
WrapperType.RealArcadeMezzanine => new FileType.RealArcadeMezzanine(),
WrapperType.SFFS => new FileType.SFFS(),
WrapperType.Textfile => new FileType.Textfile(),
_ => null,
};

Some files were not shown because too many files have changed in this diff Show More