Skip to content

Commit 6cb8651

Browse files
committed
Organize StarForce, get rid of all Model calls
1 parent d6a3a37 commit 6cb8651

27 files changed

+533
-519
lines changed

BinaryObjectScanner/Packer/Crunch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class Crunch : IExecutableCheck<PortableExecutable>
1212
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1313
{
1414
// Get the last section strings, if they exist
15-
var sections = exe.Model.SectionTable ?? [];
15+
var sections = exe.SectionTable ?? [];
1616
var strs = exe.GetSectionStrings(sections.Length - 1);
1717
if (strs != null)
1818
{

BinaryObjectScanner/Packer/HyperTechCrackProof.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class HyperTechCrackProof : IExecutableCheck<PortableExecutable>
1616
{
1717
// This check may be overly limiting, as it excludes the sample provided to DiE (https://github.com/horsicq/Detect-It-Easy/issues/102).
1818
// TODO: Find further samples and invesitgate if the "peC" section is only present on specific versions.
19-
bool importTableMatch = Array.Exists(exe.Model.ImportTable?.ImportDirectoryTable ?? [],
19+
bool importTableMatch = Array.Exists(exe.ImportTable?.ImportDirectoryTable ?? [],
2020
idte => idte?.Name == "KeRnEl32.dLl");
2121

2222
if (exe.ContainsSection("peC", exact: true) && importTableMatch)

BinaryObjectScanner/Packer/InnoSetup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class InnoSetup : IExecutableCheck<NewExecutable>, IExecutableCheck<Porta
1414
public string? CheckExecutable(string file, NewExecutable exe, bool includeDebug)
1515
{
1616
// Check for "Inno" in the reserved words
17-
var reserved2 = exe.Model.Stub?.Header?.Reserved2;
17+
var reserved2 = exe.Stub?.Header?.Reserved2;
1818
if (reserved2 != null && reserved2.Length > 5)
1919
{
2020
if (reserved2[4] == 0x6E49 && reserved2[5] == 0x6F6E)

BinaryObjectScanner/Packer/PECompact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class PECompact : IExecutableCheck<PortableExecutable>
1111
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1212
{
1313
// 0x4F434550 is "PECO"
14-
if (exe.Model.COFFFileHeader?.PointerToSymbolTable == 0x4F434550)
14+
if (exe.COFFFileHeader?.PointerToSymbolTable == 0x4F434550)
1515
return "PE Compact v1.x";
1616

1717
// TODO: Get more granular version detection. PiD is somehow able to detect version ranges based

BinaryObjectScanner/Packer/WinZipSFX.cs

Lines changed: 456 additions & 456 deletions
Large diffs are not rendered by default.

BinaryObjectScanner/Protection/ByteShield.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class ByteShield : IExecutableCheck<PortableExecutable>, IPathCheck
6363
return $"ByteShield Activation Client {exe.GetInternalVersion()}";
6464

6565
// Found in "ByteShield.dll" in Redump entry 6236
66-
name = exe.Model.ExportTable?.ExportDirectoryTable?.Name;
66+
name = exe.ExportTable?.ExportDirectoryTable?.Name;
6767
if (name.OptionalEquals("ByteShield Client"))
6868
return "ByteShield Component Module";
6969

BinaryObjectScanner/Protection/CDDVDCops.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ public class CDDVDCops : IExecutableCheck<NewExecutable>, IExecutableCheck<Porta
120120
return match;
121121

122122
// Get the resident and non-resident name table strings
123-
var nrntStrs = Array.ConvertAll(exe.Model.NonResidentNameTable ?? [],
123+
var nrntStrs = Array.ConvertAll(exe.NonResidentNameTable ?? [],
124124
nrnte => nrnte?.NameString == null ? string.Empty : Encoding.ASCII.GetString(nrnte.NameString));
125125

126126
// Check the imported-name table
127127
// Found in "h3blade.exe" in Redump entry 85077.
128-
if (exe.Model.ImportedNameTable != null)
128+
if (exe.ImportedNameTable != null)
129129
{
130-
foreach (var inte in exe.Model.ImportedNameTable.Values)
130+
foreach (var inte in exe.ImportedNameTable.Values)
131131
{
132132
if (inte.NameString.IsNullOrEmpty())
133133
continue;

BinaryObjectScanner/Protection/CDGuard.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ public class CDGuard : IExecutableCheck<PortableExecutable>, IPathCheck
2828
// TODO: Investigate the numerous ".guard" sections present in "Randevu.exe" in Redump entry 97142.
2929

3030
// Get the export directory table
31-
if (exe.Model.ExportTable?.ExportDirectoryTable != null)
31+
if (exe.ExportTable?.ExportDirectoryTable != null)
3232
{
3333
// Found in "cdguard.dll" in Redump entry 97142 and IA item "pahgeby-he3hakomkou".
34-
bool match = exe.Model.ExportTable.ExportDirectoryTable.Name.OptionalEquals("cdguard.dll", StringComparison.OrdinalIgnoreCase);
34+
bool match = exe.ExportTable.ExportDirectoryTable.Name.OptionalEquals("cdguard.dll", StringComparison.OrdinalIgnoreCase);
3535
if (match)
3636
return "CD-Guard Copy Protection System";
3737
}
3838

3939
// Get the import directory table
40-
if (exe.Model.ImportTable?.ImportDirectoryTable != null)
40+
if (exe.ImportTable?.ImportDirectoryTable != null)
4141
{
4242
// Found in "Randevu.exe" in Redump entry 97142.
43-
bool match = Array.Exists(exe.Model.ImportTable.ImportDirectoryTable, idte => idte?.Name != null && idte.Name.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase));
43+
bool match = Array.Exists(exe.ImportTable.ImportDirectoryTable, idte => idte?.Name != null && idte.Name.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase));
4444
if (match)
4545
return "CD-Guard Copy Protection System";
4646
}

BinaryObjectScanner/Protection/CDSHiELDSE.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public class CDSHiELDSE : IExecutableCheck<PortableExecutable>
1010
{
1111
// TODO: Indicates Hypertech Crack Proof as well?
1212
//// Get the import directory table
13-
//if (exe.Model.ImportTable?.ImportDirectoryTable != null)
13+
//if (exe.ImportTable?.ImportDirectoryTable != null)
1414
//{
15-
// bool match = exe.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "KeRnEl32.dLl");
15+
// bool match = exe.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "KeRnEl32.dLl");
1616
// if (match)
1717
// return "CDSHiELD SE";
1818
//}

BinaryObjectScanner/Protection/CenegaProtectDVD.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public class CenegaProtectDVD : IExecutableCheck<PortableExecutable>, IPathCheck
1818
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1919
{
2020
// Get the export directory table
21-
if (exe.Model.ExportTable?.ExportDirectoryTable != null)
21+
if (exe.ExportTable?.ExportDirectoryTable != null)
2222
{
2323
// Found in "cenega.dll" in IA item "speed-pack".
24-
bool match = exe.Model.ExportTable.ExportDirectoryTable.Name.OptionalEquals("ProtectDVD.dll", StringComparison.OrdinalIgnoreCase);
24+
bool match = exe.ExportTable.ExportDirectoryTable.Name.OptionalEquals("ProtectDVD.dll", StringComparison.OrdinalIgnoreCase);
2525
if (match)
2626
return "Cenega ProtectDVD";
2727
}

0 commit comments

Comments
 (0)