From b779f2f546d0ca4a5d5fd899d573abb4aabc9002 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 10 Sep 2021 16:10:15 -0700 Subject: [PATCH] Only deserialze a file once per round of checks --- .../Entries/ExportAddressTableEntry.cs | 2 +- .../Microsoft/Entries/FunctionTableEntry.cs | 2 +- .../Microsoft/Entries/HintNameTableEntry.cs | 2 +- .../Entries/ImportAddressTableEntry.cs | 2 +- .../Entries/ImportDirectoryTableEntry.cs | 2 +- .../Microsoft/Entries/NEResourceNameString.cs | 2 +- .../Microsoft/Entries/NEResourceTableEntry.cs | 2 +- .../Microsoft/Entries/NESegmentTableEntry.cs | 2 +- .../Microsoft/Entries/ResourceDataEntry.cs | 2 +- .../Entries/ResourceDirectoryString.cs | 2 +- .../Entries/ResourceDirectoryTableEntry.cs | 2 +- .../Entries/ResourceTypeInformationBlock.cs | 2 +- .../ExecutableType/Microsoft/Enums.cs | 30 +++++++++---------- .../Headers/CommonObjectFileFormatHeader.cs | 2 +- .../Microsoft/Headers/DataDirectoryHeader.cs | 2 +- .../Headers/MSDOSExecutableHeader.cs | 2 +- .../Microsoft/Headers/NewExecutableHeader.cs | 2 +- .../Microsoft/Headers/OptionalHeader.cs | 2 +- .../Microsoft/Headers/SectionHeader.cs | 2 +- .../ExecutableType/Microsoft/NewExecutable.cs | 2 +- .../Microsoft/PortableExecutable.cs | 2 +- .../Microsoft/Resources/FixedFileInfo.cs | 2 +- .../Microsoft/Resources/LanguageCodePage.cs | 2 +- .../Microsoft/Resources/Resource.cs | 2 +- .../Microsoft/Resources/StringFileInfo.cs | 2 +- .../Microsoft/Resources/StringStruct.cs | 2 +- .../Microsoft/Resources/StringTable.cs | 2 +- .../ExecutableType/Microsoft/Resources/Var.cs | 2 +- .../Microsoft/Resources/VarFileInfo.cs | 2 +- .../Microsoft/Resources/VersionInfo.cs | 2 +- .../Sections/ExceptionHandlingSection.cs | 2 +- .../Microsoft/Sections/ExportDataSection.cs | 2 +- .../Microsoft/Sections/ImportDataSection.cs | 2 +- .../Microsoft/Sections/ResourceSection.cs | 2 +- .../Microsoft/Tables/ExportAddressTable.cs | 2 +- .../Microsoft/Tables/ExportDirectoryTable.cs | 2 +- .../Tables/ExportNamePointerTable.cs | 2 +- .../Microsoft/Tables/ExportNameTable.cs | 2 +- .../Microsoft/Tables/ExportOrdinalTable.cs | 2 +- .../Microsoft/Tables/FunctionTable.cs | 2 +- .../Microsoft/Tables/HintNameTable.cs | 2 +- .../Microsoft/Tables/ImportAddressTable.cs | 2 +- .../Microsoft/Tables/ImportDirectoryTable.cs | 2 +- .../Microsoft/Tables/ImportLookupTable.cs | 2 +- .../Microsoft/Tables/NEResourceTable.cs | 2 +- .../Tables/ResourceDirectoryTable.cs | 2 +- BurnOutSharp/FileType/BFPK.cs | 2 +- BurnOutSharp/FileType/BZip2.cs | 2 +- BurnOutSharp/FileType/Executable.cs | 10 ++++--- BurnOutSharp/FileType/GZIP.cs | 2 +- .../FileType/InstallShieldArchiveV3.cs | 2 +- BurnOutSharp/FileType/InstallShieldCAB.cs | 2 +- BurnOutSharp/FileType/MPQ.cs | 2 +- BurnOutSharp/FileType/MSI.cs | 2 +- BurnOutSharp/FileType/MicrosoftCAB.cs | 2 +- BurnOutSharp/FileType/PKZIP.cs | 2 +- BurnOutSharp/FileType/RAR.cs | 2 +- BurnOutSharp/FileType/SevenZip.cs | 2 +- BurnOutSharp/FileType/TapeArchive.cs | 2 +- BurnOutSharp/FileType/Textfile.cs | 2 +- BurnOutSharp/FileType/Valve.cs | 2 +- BurnOutSharp/FileType/XZ.cs | 2 +- BurnOutSharp/IContentCheck.cs | 11 ++++--- BurnOutSharp/Matching/PathMatch.cs | 2 +- BurnOutSharp/Matching/PathMatchSet.cs | 2 +- BurnOutSharp/PackerType/AdvancedInstaller.cs | 3 +- BurnOutSharp/PackerType/Armadillo.cs | 18 +---------- BurnOutSharp/PackerType/CExe.cs | 3 +- BurnOutSharp/PackerType/EXEStealth.cs | 3 +- BurnOutSharp/PackerType/InnoSetup.cs | 3 +- BurnOutSharp/PackerType/InstallerVISE.cs | 3 +- .../PackerType/IntelInstallationFramework.cs | 3 +- BurnOutSharp/PackerType/MicrosoftCABSFX.cs | 3 +- BurnOutSharp/PackerType/NSIS.cs | 3 +- BurnOutSharp/PackerType/PECompact.cs | 3 +- BurnOutSharp/PackerType/SetupFactory.cs | 3 +- BurnOutSharp/PackerType/UPX.cs | 3 +- BurnOutSharp/PackerType/WinRARSFX.cs | 3 +- BurnOutSharp/PackerType/WinZipSFX.cs | 4 +-- BurnOutSharp/PackerType/WiseInstaller.cs | 7 +---- BurnOutSharp/PackerType/dotFuscator.cs | 3 +- BurnOutSharp/ProtectionType/ActiveMARK.cs | 3 +- BurnOutSharp/ProtectionType/AlphaROM.cs | 3 +- BurnOutSharp/ProtectionType/Bitpool.cs | 3 +- BurnOutSharp/ProtectionType/CDCheck.cs | 3 +- BurnOutSharp/ProtectionType/CDCops.cs | 3 +- BurnOutSharp/ProtectionType/CDKey.cs | 3 +- BurnOutSharp/ProtectionType/CDLock.cs | 3 +- BurnOutSharp/ProtectionType/CDSHiELDSE.cs | 3 +- .../ProtectionType/CactusDataShield.cs | 3 +- .../ProtectionType/CenegaProtectDVD.cs | 22 ++------------ BurnOutSharp/ProtectionType/CodeLock.cs | 3 +- BurnOutSharp/ProtectionType/CopyKiller.cs | 3 +- BurnOutSharp/ProtectionType/DVDCops.cs | 3 +- BurnOutSharp/ProtectionType/ElectronicArts.cs | 3 +- BurnOutSharp/ProtectionType/GFWL.cs | 3 +- BurnOutSharp/ProtectionType/ImpulseReactor.cs | 3 +- BurnOutSharp/ProtectionType/Intenium.cs | 3 +- BurnOutSharp/ProtectionType/JoWood.cs | 3 +- BurnOutSharp/ProtectionType/KeyLock.cs | 3 +- BurnOutSharp/ProtectionType/LaserLok.cs | 3 +- BurnOutSharp/ProtectionType/MediaMaxCD3.cs | 3 +- .../ProtectionType/OnlineRegistration.cs | 3 +- BurnOutSharp/ProtectionType/Origin.cs | 3 +- BurnOutSharp/ProtectionType/PSXAntiModchip.cs | 3 +- BurnOutSharp/ProtectionType/ProtectDisc.cs | 3 +- BurnOutSharp/ProtectionType/RingPROTECH.cs | 3 +- BurnOutSharp/ProtectionType/SVKP.cs | 5 ++-- BurnOutSharp/ProtectionType/SafeCast.cs | 3 +- BurnOutSharp/ProtectionType/SafeDisc.cs | 3 +- BurnOutSharp/ProtectionType/SafeLock.cs | 3 +- BurnOutSharp/ProtectionType/SecuROM.cs | 4 +-- BurnOutSharp/ProtectionType/SmartE.cs | 3 +- BurnOutSharp/ProtectionType/SolidShield.cs | 5 ++-- BurnOutSharp/ProtectionType/StarForce.cs | 3 +- BurnOutSharp/ProtectionType/Sysiphus.cs | 3 +- BurnOutSharp/ProtectionType/Tages.cs | 3 +- BurnOutSharp/ProtectionType/ThreePLock.cs | 3 +- .../ProtectionType/ThreeTwoOneStudios.cs | 3 +- BurnOutSharp/ProtectionType/WTMCDProtect.cs | 3 +- BurnOutSharp/ProtectionType/XCP.cs | 3 +- 121 files changed, 162 insertions(+), 225 deletions(-) diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ExportAddressTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ExportAddressTableEntry.cs index 19752858..3f3b0d8a 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ExportAddressTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ExportAddressTableEntry.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// Otherwise, the field is a forwarder RVA, which names a symbol in another DLL. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-address-table - internal class ExportAddressTableEntry + public class ExportAddressTableEntry { /// /// The address of the exported symbol when loaded into memory, relative to the image base. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/FunctionTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/FunctionTableEntry.cs index 9e6e20d8..7888819f 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/FunctionTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/FunctionTableEntry.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// Otherwise, the field is a forwarder RVA, which names a symbol in another DLL. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-pdata-section - internal class FunctionTableEntry + public class FunctionTableEntry { #region 32-bit MIPS diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/HintNameTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/HintNameTableEntry.cs index 375bffc0..294b75f8 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/HintNameTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/HintNameTableEntry.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// Each entry in the hint/name table has the following format /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#hintname-table - internal class HintNameTableEntry + public class HintNameTableEntry { /// /// An index into the export name pointer table. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportAddressTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportAddressTableEntry.cs index 10c6c9a6..b3eaf7fd 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportAddressTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportAddressTableEntry.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// Each import address entry has the following format /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-address-table - internal class ImportAddressTableEntry + public class ImportAddressTableEntry { /// /// The RVA of the import lookup table. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportDirectoryTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportDirectoryTableEntry.cs index 5016afb4..08d3d426 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportDirectoryTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ImportDirectoryTableEntry.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// Each import directory entry has the following format /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-directory-table - internal class ImportDirectoryTableEntry + public class ImportDirectoryTableEntry { /// /// The RVA of the import lookup table. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceNameString.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceNameString.cs index 05543491..4385bd06 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceNameString.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceNameString.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// Resource type and name strings /// - internal class NEResourceNameString + public class NEResourceNameString { /// /// Length of the type or name string that follows. A zero value diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceTableEntry.cs index de19d2aa..879d827d 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/NEResourceTableEntry.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// A table of resources for this type /// - internal class NEResourceTableEntry + public class NEResourceTableEntry { /// /// File offset to the contents of the resource data, diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/NESegmentTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/NESegmentTableEntry.cs index e11f6dae..5813435e 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/NESegmentTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/NESegmentTableEntry.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// EXE header. The first entry in the segment table is segment number 1. /// The following is the structure of a segment table entry. /// - internal class NESegmentTableEntry + public class NESegmentTableEntry { /// /// Logical-sector offset (n byte) to the contents of the segment diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDataEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDataEntry.cs index 5c56fb92..c6bb2da8 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDataEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDataEntry.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// Each Resource Data entry describes an actual unit of raw data in the Resource Data area. /// - internal class ResourceDataEntry + public class ResourceDataEntry { /// /// The address of a unit of resource data in the Resource Data area. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryString.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryString.cs index 566df51a..07198cf7 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryString.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryString.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// These strings are stored together after the last Resource Directory entry and before the first Resource Data entry. /// This minimizes the impact of these variable-length strings on the alignment of the fixed-size directory entries. /// - internal class ResourceDirectoryString + public class ResourceDirectoryString { /// /// The size of the string, not including length field itself. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs index fac05895..1c89cbc9 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs @@ -18,7 +18,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// Offsets are relative to the address in the IMAGE_DIRECTORY_ENTRY_RESOURCE DataDirectory. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#resource-directory-entries - internal class ResourceDirectoryTableEntry + public class ResourceDirectoryTableEntry { /// /// The offset of a string that gives the Type, Name, or Language ID entry, depending on level of table. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceTypeInformationBlock.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceTypeInformationBlock.cs index 1af0ffa1..b23a0f66 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceTypeInformationBlock.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceTypeInformationBlock.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// Resource type information block /// - internal class ResourceTypeInformationBlock + public class ResourceTypeInformationBlock { /// /// Type ID. This is an integer type if the high-order bit is diff --git a/BurnOutSharp/ExecutableType/Microsoft/Enums.cs b/BurnOutSharp/ExecutableType/Microsoft/Enums.cs index d7a4476b..048681db 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Enums.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Enums.cs @@ -2,7 +2,7 @@ using System; namespace BurnOutSharp.ExecutableType.Microsoft { - internal enum ExecutableType + public enum ExecutableType { Unknown, NE, @@ -11,7 +11,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#dll-characteristics [Flags] - internal enum DllCharacteristics : ushort + public enum DllCharacteristics : ushort { /// /// Reserved, must be zero. @@ -91,7 +91,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft } // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-data-directories-image-only - internal enum ImageDirectory : byte + public enum ImageDirectory : byte { /// /// The export table address and size. (.edata) @@ -177,7 +177,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#characteristics [Flags] - internal enum ImageObjectCharacteristics : ushort + public enum ImageObjectCharacteristics : ushort { /// /// Image only, Windows CE, and Microsoft Windows NT and later. @@ -276,7 +276,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft } // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types - internal enum MachineType : ushort + public enum MachineType : ushort { /// /// The content of this field is assumed to be applicable to any machine type @@ -423,7 +423,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// s Solo data /// [Flags] - internal enum NeFlags : ushort + public enum NeFlags : ushort { /// /// Not a process @@ -509,7 +509,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// rr Reference type /// [Flags] - internal enum NrFlags : byte + public enum NrFlags : byte { /// /// Additive fixup @@ -550,7 +550,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft //// /// [Flags] - internal enum NrStype : byte + public enum NrStype : byte { /// /// Source type mask @@ -589,7 +589,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft } // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-image-only - internal enum OptionalHeaderType : ushort + public enum OptionalHeaderType : ushort { /// /// ROM image @@ -609,7 +609,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm [Flags] - internal enum ResourceTableEntryFlags : ushort + public enum ResourceTableEntryFlags : ushort { /// /// Resource is not fixed. @@ -630,7 +630,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// /// Predefined Resource Types /// - internal enum ResourceTypes : ushort + public enum ResourceTypes : ushort { RT_CURSOR = 1, RT_BITMAP = 2, @@ -662,7 +662,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#section-flags [Flags] - internal enum SectionCharacteristics : uint + public enum SectionCharacteristics : uint { /// /// Reserved for future use. @@ -878,7 +878,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm [Flags] - internal enum SegmentTableEntryFlags : ushort + public enum SegmentTableEntryFlags : ushort { /// /// Segment-type field. @@ -962,7 +962,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft } [Flags] - internal enum TargetOperatingSystems : byte + public enum TargetOperatingSystems : byte { /// /// Unknown (any "new-format" OS) @@ -991,7 +991,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft } // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#windows-subsystem - internal enum WindowsSubsystem : ushort + public enum WindowsSubsystem : ushort { /// /// An unknown subsystem diff --git a/BurnOutSharp/ExecutableType/Microsoft/Headers/CommonObjectFileFormatHeader.cs b/BurnOutSharp/ExecutableType/Microsoft/Headers/CommonObjectFileFormatHeader.cs index daffcacf..c3245451 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Headers/CommonObjectFileFormatHeader.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Headers/CommonObjectFileFormatHeader.cs @@ -4,7 +4,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.ExecutableType.Microsoft.Headers { - internal class CommonObjectFileFormatHeader + public class CommonObjectFileFormatHeader { /// /// After the MS-DOS stub, at the file offset specified at offset 0x3c, is a 4-byte signature that identifies the file as a PE format image file. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Headers/DataDirectoryHeader.cs b/BurnOutSharp/ExecutableType/Microsoft/Headers/DataDirectoryHeader.cs index 287bf67d..3a26ee63 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Headers/DataDirectoryHeader.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Headers/DataDirectoryHeader.cs @@ -4,7 +4,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.ExecutableType.Microsoft.Headers { - internal class DataDirectoryHeader + public class DataDirectoryHeader { /// /// The first field, VirtualAddress, is actually the RVA of the table. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Headers/MSDOSExecutableHeader.cs b/BurnOutSharp/ExecutableType/Microsoft/Headers/MSDOSExecutableHeader.cs index 259b22db..ebbc55cd 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Headers/MSDOSExecutableHeader.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Headers/MSDOSExecutableHeader.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Headers /// and PE executables, usually as stubs so that when they are ran under DOS, they display a warning. /// /// https://wiki.osdev.org/MZ - internal class MSDOSExecutableHeader + public class MSDOSExecutableHeader { #region Standard Fields diff --git a/BurnOutSharp/ExecutableType/Microsoft/Headers/NewExecutableHeader.cs b/BurnOutSharp/ExecutableType/Microsoft/Headers/NewExecutableHeader.cs index 53c38f62..7d97a4c4 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Headers/NewExecutableHeader.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Headers/NewExecutableHeader.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Headers /// Because of the age of the format some items are unclear in meaning. /// /// http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm - internal class NewExecutableHeader + public class NewExecutableHeader { /// /// Signature word. [00] diff --git a/BurnOutSharp/ExecutableType/Microsoft/Headers/OptionalHeader.cs b/BurnOutSharp/ExecutableType/Microsoft/Headers/OptionalHeader.cs index 838e7a0d..e44d382a 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Headers/OptionalHeader.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Headers/OptionalHeader.cs @@ -18,7 +18,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Headers /// a particular data directory entry goes beyond the optional header. /// In addition, it is important to validate the optional header magic number for format compatibility. /// - internal class OptionalHeader + public class OptionalHeader { #region Standard Fields diff --git a/BurnOutSharp/ExecutableType/Microsoft/Headers/SectionHeader.cs b/BurnOutSharp/ExecutableType/Microsoft/Headers/SectionHeader.cs index 77d9e887..247f8a39 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Headers/SectionHeader.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Headers/SectionHeader.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Headers /// Instead, the location of the section table is determined by calculating the location of the first byte after the headers. /// Make sure to use the size of the optional header as specified in the file header. /// - internal class SectionHeader + public class SectionHeader { /// /// An 8-byte, null-padded UTF-8 encoded string. diff --git a/BurnOutSharp/ExecutableType/Microsoft/NewExecutable.cs b/BurnOutSharp/ExecutableType/Microsoft/NewExecutable.cs index daf75bbe..33c6d5d2 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/NewExecutable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/NewExecutable.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// The WIN-NE executable format, designed for Windows 3.x, was the "NE", or "New Executable" format. /// Again, a 16bit format, it alleviated the maximum size restrictions that the MZ format had. /// - internal class NewExecutable + public class NewExecutable { #region Headers diff --git a/BurnOutSharp/ExecutableType/Microsoft/PortableExecutable.cs b/BurnOutSharp/ExecutableType/Microsoft/PortableExecutable.cs index 317e763a..96ba2b05 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/PortableExecutable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/PortableExecutable.cs @@ -12,7 +12,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft /// A COFF object file header consists of a COFF file header and an optional header. /// In both cases, the file headers are followed immediately by section headers. /// - internal class PortableExecutable + public class PortableExecutable { #region Headers diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/FixedFileInfo.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/FixedFileInfo.cs index 026cd20d..35003c68 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/FixedFileInfo.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/FixedFileInfo.cs @@ -4,7 +4,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class FixedFileInfo + public class FixedFileInfo { /// /// Contains the value 0xFEEF04BD. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/LanguageCodePage.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/LanguageCodePage.cs index 5919937a..a7c160bf 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/LanguageCodePage.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/LanguageCodePage.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Resources /// Either high-order or low-order word can be zero, indicating that the file is language or code page independent. /// If the Var structure is omitted, the file will be interpreted as both language and code page independent. /// - internal class LanguageCodePage + public class LanguageCodePage { /// /// The low-order word of each DWORD must contain a Microsoft language identifier diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/Resource.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/Resource.cs index fbd65b4e..fbffadf4 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/Resource.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/Resource.cs @@ -6,7 +6,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class Resource + public class Resource { /// /// The length, in bytes, of the resource structure. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs index 74fa3ce5..7c558a15 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs @@ -2,7 +2,7 @@ using System.IO; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class StringFileInfo : Resource + public class StringFileInfo : Resource { /// /// An array of one or more StringTable structures. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringStruct.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringStruct.cs index 80b4e357..f14f7acb 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringStruct.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringStruct.cs @@ -4,7 +4,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class StringStruct : Resource + public class StringStruct : Resource { /// /// Typically contains a list of languages that the application or DLL supports. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringTable.cs index 3ecdc06d..2ad411d9 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringTable.cs @@ -3,7 +3,7 @@ using System.IO; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class StringTable : Resource + public class StringTable : Resource { /// /// An array of one or more String structures. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/Var.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/Var.cs index 32c66195..8f8bf1fa 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/Var.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/Var.cs @@ -2,7 +2,7 @@ using System.IO; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class Var : Resource + public class Var : Resource { /// /// An array of one or more values that are language and code page identifier pairs. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/VarFileInfo.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/VarFileInfo.cs index 4dd3efe1..b44773a0 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/VarFileInfo.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/VarFileInfo.cs @@ -2,7 +2,7 @@ using System.IO; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class VarFileInfo : Resource + public class VarFileInfo : Resource { /// /// Typically contains a list of languages that the application or DLL supports. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs index cc6466a7..a8027aa0 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs @@ -2,7 +2,7 @@ using System.IO; namespace BurnOutSharp.ExecutableType.Microsoft.Resources { - internal class VersionInfo : Resource + public class VersionInfo : Resource { /// /// Arbitrary data associated with this VS_VERSIONINFO structure. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Sections/ExceptionHandlingSection.cs b/BurnOutSharp/ExecutableType/Microsoft/Sections/ExceptionHandlingSection.cs index 8e178bda..48fa009d 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Sections/ExceptionHandlingSection.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Sections/ExceptionHandlingSection.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Sections /// The target platform determines which of the three function table entry format variations described below is used. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-edata-section-image-only - internal class ExceptionHandlingSection + public class ExceptionHandlingSection { /// /// Array of function table entries that are used for exception handling diff --git a/BurnOutSharp/ExecutableType/Microsoft/Sections/ExportDataSection.cs b/BurnOutSharp/ExecutableType/Microsoft/Sections/ExportDataSection.cs index 17b49350..04208db1 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Sections/ExportDataSection.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Sections/ExportDataSection.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Sections /// Exported symbols are generally found in DLLs, but DLLs can also import symbols. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-edata-section-image-only - internal class ExportDataSection + public class ExportDataSection { /// /// A table with just one row (unlike the debug directory). diff --git a/BurnOutSharp/ExecutableType/Microsoft/Sections/ImportDataSection.cs b/BurnOutSharp/ExecutableType/Microsoft/Sections/ImportDataSection.cs index 3564631f..e413c56e 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Sections/ImportDataSection.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Sections/ImportDataSection.cs @@ -18,7 +18,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Sections /// Hint-Name Table /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section - internal class ImportDataSection + public class ImportDataSection { /// /// Import directory table diff --git a/BurnOutSharp/ExecutableType/Microsoft/Sections/ResourceSection.cs b/BurnOutSharp/ExecutableType/Microsoft/Sections/ResourceSection.cs index 1a05deba..3c313691 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Sections/ResourceSection.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Sections/ResourceSection.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Sections // then that table lists directory entries at the next level down /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-rsrc-section - internal class ResourceSection + public class ResourceSection { /// /// A table with just one row (unlike the debug directory). diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportAddressTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportAddressTable.cs index 15822d8e..9b4d5a6a 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportAddressTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportAddressTable.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// An ordinal number is used as an index into the export address table. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-address-table - internal class ExportAddressTable + public class ExportAddressTable { /// Number of entries is defined externally public ExportAddressTableEntry[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportDirectoryTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportDirectoryTable.cs index a0430e47..e9a04805 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportDirectoryTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportDirectoryTable.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// The export directory table contains address information that is used to resolve imports to the entry points within this image. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-directory-table - internal class ExportDirectoryTable + public class ExportDirectoryTable { /// /// Reserved, must be 0. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNamePointerTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNamePointerTable.cs index 47b11a98..fb02bf5a 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNamePointerTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNamePointerTable.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// The pointers are ordered lexically to allow binary searches. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-name-pointer-table - internal class ExportNamePointerTable + public class ExportNamePointerTable { /// Number of entries is defined externally public uint[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNameTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNameTable.cs index 5f1c46f8..6e232d45 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNameTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportNameTable.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// These public export names are not necessarily the same as the private symbol names that the symbols have in their own image file and source code, although they can be. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-ordinal-table - internal class ExportNameTable + public class ExportNameTable { /// Number of entries is defined externally public string[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportOrdinalTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportOrdinalTable.cs index 7ff9ac30..e8789e29 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportOrdinalTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ExportOrdinalTable.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// In other words, the ordinal base must be subtracted from the ordinals to obtain true indexes into the export address table. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-ordinal-table - internal class ExportOrdinalTable + public class ExportOrdinalTable { /// Number of entries is defined externally public ushort[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/FunctionTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/FunctionTable.cs index 1056dfe6..b879bc95 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/FunctionTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/FunctionTable.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// The target platform determines which of the three function table entry format variations described below is used. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-pdata-section - internal class FunctionTable + public class FunctionTable { /// Number of entries is defined externally public FunctionTableEntry[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/HintNameTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/HintNameTable.cs index 6af73d39..517575a2 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/HintNameTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/HintNameTable.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// One hint/name table suffices for the entire import section. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#hintname-table - internal class HintNameTable + public class HintNameTable { /// Number of entries is defined externally public HintNameTableEntry[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportAddressTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportAddressTable.cs index cb3dbe8f..328b86f7 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportAddressTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportAddressTable.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// The loader typically processes the binding. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-address-table - internal class ImportAddressTable + public class ImportAddressTable { /// Number of entries is known after parsing public ImportAddressTableEntry[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportDirectoryTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportDirectoryTable.cs index 39e4844c..6b165954 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportDirectoryTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportDirectoryTable.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// The last directory entry is empty (filled with null values), which indicates the end of the directory table. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-directory-table - internal class ImportDirectoryTable + public class ImportDirectoryTable { /// Number of entries is known after parsing public ImportDirectoryTableEntry[] Entries; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportLookupTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportLookupTable.cs index 9430f900..00acff29 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportLookupTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ImportLookupTable.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// The last entry is set to zero (NULL) to indicate the end of the table. /// /// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-lookup-table - internal class ImportLookupTable + public class ImportLookupTable { /// Number of entries is known after parsing public uint[] EntriesPE32; diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/NEResourceTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/NEResourceTable.cs index 7138cae4..7a9cdaf3 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/NEResourceTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/NEResourceTable.cs @@ -16,7 +16,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// resource. It also defines the location and size of the resource. /// /// http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm - internal class NEResourceTable + public class NEResourceTable { /// /// Alignment shift count for resource data. diff --git a/BurnOutSharp/ExecutableType/Microsoft/Tables/ResourceDirectoryTable.cs b/BurnOutSharp/ExecutableType/Microsoft/Tables/ResourceDirectoryTable.cs index 54a1d0f5..490189ce 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Tables/ResourceDirectoryTable.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Tables/ResourceDirectoryTable.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Tables /// This data structure should be considered the heading of a table /// because the table actually consists of directory entries and this structure /// - internal class ResourceDirectoryTable + public class ResourceDirectoryTable { /// /// Resource flags. diff --git a/BurnOutSharp/FileType/BFPK.cs b/BurnOutSharp/FileType/BFPK.cs index 1c9d8ffa..3f7b29b1 100644 --- a/BurnOutSharp/FileType/BFPK.cs +++ b/BurnOutSharp/FileType/BFPK.cs @@ -8,7 +8,7 @@ using SharpCompress.Compressors.Deflate; namespace BurnOutSharp.FileType { - internal class BFPK : IScannable + public class BFPK : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/BZip2.cs b/BurnOutSharp/FileType/BZip2.cs index 371dca85..459599b8 100644 --- a/BurnOutSharp/FileType/BZip2.cs +++ b/BurnOutSharp/FileType/BZip2.cs @@ -7,7 +7,7 @@ using SharpCompress.Compressors.BZip2; namespace BurnOutSharp.FileType { - internal class BZip2 : IScannable + public class BZip2 : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 0407351c..d77c7607 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -6,11 +6,12 @@ using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Tools; namespace BurnOutSharp.FileType { - internal class Executable : IScannable + public class Executable : IScannable { /// /// Cache for all IContentCheck types @@ -88,8 +89,9 @@ namespace BurnOutSharp.FileType if (stream.CanSeek) stream.Seek(0, SeekOrigin.Begin); - // TODO: Find a way to combine the outputs of GetContentMatchSet to make this more efficient - // If they can be combined, we can have it do a Unique check per file + // Create PortableExecutable and NewExecutable objects for use in the checks + PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); + NewExecutable nex = NewExecutable.Deserialize(fileContent, 0); // Iterate through all content checks Parallel.ForEach(contentCheckClasses, contentCheckClass => @@ -98,7 +100,7 @@ namespace BurnOutSharp.FileType bool foundProtection = false; // Check using custom content checks first - string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludeDebug); + string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludeDebug, pex, nex); foundProtection |= !string.IsNullOrWhiteSpace(protection); if (ShouldAddProtection(contentCheckClass, scanner, protection)) Utilities.AppendToDictionary(protections, file, protection); diff --git a/BurnOutSharp/FileType/GZIP.cs b/BurnOutSharp/FileType/GZIP.cs index e61db8d2..79994204 100644 --- a/BurnOutSharp/FileType/GZIP.cs +++ b/BurnOutSharp/FileType/GZIP.cs @@ -7,7 +7,7 @@ using SharpCompress.Archives.GZip; namespace BurnOutSharp.FileType { - internal class GZIP : IScannable + public class GZIP : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/InstallShieldArchiveV3.cs b/BurnOutSharp/FileType/InstallShieldArchiveV3.cs index 424fa432..058540fe 100644 --- a/BurnOutSharp/FileType/InstallShieldArchiveV3.cs +++ b/BurnOutSharp/FileType/InstallShieldArchiveV3.cs @@ -8,7 +8,7 @@ using UnshieldSharp.Archive; namespace BurnOutSharp.FileType { - internal class InstallShieldArchiveV3 : IScannable + public class InstallShieldArchiveV3 : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/InstallShieldCAB.cs b/BurnOutSharp/FileType/InstallShieldCAB.cs index 0e53d856..da963021 100644 --- a/BurnOutSharp/FileType/InstallShieldCAB.cs +++ b/BurnOutSharp/FileType/InstallShieldCAB.cs @@ -7,7 +7,7 @@ using UnshieldSharp.Cabinet; namespace BurnOutSharp.FileType { - internal class InstallShieldCAB : IScannable + public class InstallShieldCAB : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/MPQ.cs b/BurnOutSharp/FileType/MPQ.cs index e6253eb6..c83a82c7 100644 --- a/BurnOutSharp/FileType/MPQ.cs +++ b/BurnOutSharp/FileType/MPQ.cs @@ -6,7 +6,7 @@ using StormLibSharp; namespace BurnOutSharp.FileType { - internal class MPQ : IScannable + public class MPQ : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/MSI.cs b/BurnOutSharp/FileType/MSI.cs index 740e4a6a..e93b6841 100644 --- a/BurnOutSharp/FileType/MSI.cs +++ b/BurnOutSharp/FileType/MSI.cs @@ -6,7 +6,7 @@ using WixToolset.Dtf.WindowsInstaller; namespace BurnOutSharp.FileType { - internal class MSI : IScannable + public class MSI : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/MicrosoftCAB.cs b/BurnOutSharp/FileType/MicrosoftCAB.cs index ff75f794..502e59d0 100644 --- a/BurnOutSharp/FileType/MicrosoftCAB.cs +++ b/BurnOutSharp/FileType/MicrosoftCAB.cs @@ -7,7 +7,7 @@ using LibMSPackN; namespace BurnOutSharp.FileType { // Specification available at http://download.microsoft.com/download/5/0/1/501ED102-E53F-4CE0-AA6B-B0F93629DDC6/Exchange/%5BMS-CAB%5D.pdf - internal class MicrosoftCAB : IScannable + public class MicrosoftCAB : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/PKZIP.cs b/BurnOutSharp/FileType/PKZIP.cs index 28bf3a08..4cb2360c 100644 --- a/BurnOutSharp/FileType/PKZIP.cs +++ b/BurnOutSharp/FileType/PKZIP.cs @@ -7,7 +7,7 @@ using SharpCompress.Archives.Zip; namespace BurnOutSharp.FileType { - internal class PKZIP : IScannable + public class PKZIP : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/RAR.cs b/BurnOutSharp/FileType/RAR.cs index 7f086f59..0e037516 100644 --- a/BurnOutSharp/FileType/RAR.cs +++ b/BurnOutSharp/FileType/RAR.cs @@ -7,7 +7,7 @@ using SharpCompress.Archives.Rar; namespace BurnOutSharp.FileType { - internal class RAR : IScannable + public class RAR : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/SevenZip.cs b/BurnOutSharp/FileType/SevenZip.cs index ff61c294..6b920838 100644 --- a/BurnOutSharp/FileType/SevenZip.cs +++ b/BurnOutSharp/FileType/SevenZip.cs @@ -7,7 +7,7 @@ using SharpCompress.Archives.SevenZip; namespace BurnOutSharp.FileType { - internal class SevenZip : IScannable + public class SevenZip : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/TapeArchive.cs b/BurnOutSharp/FileType/TapeArchive.cs index d13454db..c7f4493d 100644 --- a/BurnOutSharp/FileType/TapeArchive.cs +++ b/BurnOutSharp/FileType/TapeArchive.cs @@ -7,7 +7,7 @@ using SharpCompress.Archives.Tar; namespace BurnOutSharp.FileType { - internal class TapeArchive : IScannable + public class TapeArchive : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/Textfile.cs b/BurnOutSharp/FileType/Textfile.cs index fc74029e..15521cc0 100644 --- a/BurnOutSharp/FileType/Textfile.cs +++ b/BurnOutSharp/FileType/Textfile.cs @@ -6,7 +6,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.FileType { - internal class Textfile : IScannable + public class Textfile : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/Valve.cs b/BurnOutSharp/FileType/Valve.cs index cfbd33ac..a674b66b 100644 --- a/BurnOutSharp/FileType/Valve.cs +++ b/BurnOutSharp/FileType/Valve.cs @@ -7,7 +7,7 @@ using BurnOutSharp.Tools; namespace BurnOutSharp.FileType { - internal class Valve : IScannable + public class Valve : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/FileType/XZ.cs b/BurnOutSharp/FileType/XZ.cs index 96fbf836..07c3f176 100644 --- a/BurnOutSharp/FileType/XZ.cs +++ b/BurnOutSharp/FileType/XZ.cs @@ -6,7 +6,7 @@ using SharpCompress.Compressors.Xz; namespace BurnOutSharp.FileType { - internal class XZ : IScannable + public class XZ : IScannable { /// public bool ShouldScan(byte[] magic) diff --git a/BurnOutSharp/IContentCheck.cs b/BurnOutSharp/IContentCheck.cs index b7f680b2..8aaceb46 100644 --- a/BurnOutSharp/IContentCheck.cs +++ b/BurnOutSharp/IContentCheck.cs @@ -1,20 +1,19 @@ -namespace BurnOutSharp +using BurnOutSharp.ExecutableType.Microsoft; + +namespace BurnOutSharp { // TODO: This should either include an override that takes a Stream instead of the byte[] // OR have a completely separate check for when it's an executable specifically - // TODO: Once more checks have been converted over to using PortableExecutable, NewExecutable, - // and DOS Executable, then add an override for `CheckContents` that takes an executable type - // as one of the arguments. This will reduce the amount of times the same file will be parsed - // into an in-memory header internal interface IContentCheck { /// /// Check a path for protections based on file contents /// + /// PortableExecutable representing the read-in file /// File to check for protection indicators /// Byte array representing the file contents /// True to include debug data, false otherwise /// String containing any protections found in the file - string CheckContents(string file, byte[] fileContent, bool includeDebug); + string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex); } } diff --git a/BurnOutSharp/Matching/PathMatch.cs b/BurnOutSharp/Matching/PathMatch.cs index f44421f3..feabb52f 100644 --- a/BurnOutSharp/Matching/PathMatch.cs +++ b/BurnOutSharp/Matching/PathMatch.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.Matching /// /// Path matching criteria /// - internal class PathMatch : IMatch + public class PathMatch : IMatch { /// /// String to match diff --git a/BurnOutSharp/Matching/PathMatchSet.cs b/BurnOutSharp/Matching/PathMatchSet.cs index f89594ae..36388036 100644 --- a/BurnOutSharp/Matching/PathMatchSet.cs +++ b/BurnOutSharp/Matching/PathMatchSet.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.Matching /// /// A set of path matches that work together /// - internal class PathMatchSet : MatchSet + public class PathMatchSet : MatchSet { /// /// Function to get a path version for this Matcher diff --git a/BurnOutSharp/PackerType/AdvancedInstaller.cs b/BurnOutSharp/PackerType/AdvancedInstaller.cs index 67e41a37..1475ed3a 100644 --- a/BurnOutSharp/PackerType/AdvancedInstaller.cs +++ b/BurnOutSharp/PackerType/AdvancedInstaller.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.PackerType public class AdvancedInstaller : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs index 2e477179..429eb1d0 100644 --- a/BurnOutSharp/PackerType/Armadillo.cs +++ b/BurnOutSharp/PackerType/Armadillo.cs @@ -10,21 +10,9 @@ namespace BurnOutSharp.PackerType public class Armadillo : IContentCheck { /// - private List GetContentMatchSets() => null; - // { - // // TODO: Remove this if the below section check is proven - // return new List - // { - // // .nicode + (char)0x00 - // new ContentMatchSet(new byte?[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 }, "Armadillo"), - // }; - // } - - /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; @@ -52,10 +40,6 @@ namespace BurnOutSharp.PackerType return match; } - var contentMatchSets = GetContentMatchSets(); - if (contentMatchSets != null && contentMatchSets.Any()) - return MatchUtil.GetFirstMatch(file, fileContent, contentMatchSets, includeDebug); - return null; } } diff --git a/BurnOutSharp/PackerType/CExe.cs b/BurnOutSharp/PackerType/CExe.cs index d9907425..46898d7c 100644 --- a/BurnOutSharp/PackerType/CExe.cs +++ b/BurnOutSharp/PackerType/CExe.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.PackerType @@ -34,7 +35,7 @@ namespace BurnOutSharp.PackerType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/PackerType/EXEStealth.cs b/BurnOutSharp/PackerType/EXEStealth.cs index 89a2c624..0b0d6577 100644 --- a/BurnOutSharp/PackerType/EXEStealth.cs +++ b/BurnOutSharp/PackerType/EXEStealth.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.PackerType @@ -25,7 +26,7 @@ namespace BurnOutSharp.PackerType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/PackerType/InnoSetup.cs b/BurnOutSharp/PackerType/InnoSetup.cs index 180834f4..36d07bad 100644 --- a/BurnOutSharp/PackerType/InnoSetup.cs +++ b/BurnOutSharp/PackerType/InnoSetup.cs @@ -15,10 +15,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/InstallerVISE.cs b/BurnOutSharp/PackerType/InstallerVISE.cs index d3a6bb8b..4bc39fca 100644 --- a/BurnOutSharp/PackerType/InstallerVISE.cs +++ b/BurnOutSharp/PackerType/InstallerVISE.cs @@ -15,10 +15,9 @@ namespace BurnOutSharp.PackerType //TODO: Add exact version detection for Windows builds, make sure versions before 3.X are detected as well, and detect the Mac builds. /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/IntelInstallationFramework.cs b/BurnOutSharp/PackerType/IntelInstallationFramework.cs index 1ba701cc..19fa4440 100644 --- a/BurnOutSharp/PackerType/IntelInstallationFramework.cs +++ b/BurnOutSharp/PackerType/IntelInstallationFramework.cs @@ -8,10 +8,9 @@ namespace BurnOutSharp.PackerType public class IntelInstallationFramework : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs index 0a1b7f74..6cabb02c 100644 --- a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs +++ b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs @@ -17,10 +17,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs index f30aaf11..7625b6dd 100644 --- a/BurnOutSharp/PackerType/NSIS.cs +++ b/BurnOutSharp/PackerType/NSIS.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.PackerType public class NSIS : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs index 0e2130b1..cffd0068 100644 --- a/BurnOutSharp/PackerType/PECompact.cs +++ b/BurnOutSharp/PackerType/PECompact.cs @@ -9,10 +9,9 @@ namespace BurnOutSharp.PackerType public class PECompact : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs index 63c72341..7c5ad7e8 100644 --- a/BurnOutSharp/PackerType/SetupFactory.cs +++ b/BurnOutSharp/PackerType/SetupFactory.cs @@ -12,10 +12,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/UPX.cs b/BurnOutSharp/PackerType/UPX.cs index 70a0626c..74236655 100644 --- a/BurnOutSharp/PackerType/UPX.cs +++ b/BurnOutSharp/PackerType/UPX.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.PackerType public class UPX : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/WinRARSFX.cs b/BurnOutSharp/PackerType/WinRARSFX.cs index 479dcde4..13ebfb64 100644 --- a/BurnOutSharp/PackerType/WinRARSFX.cs +++ b/BurnOutSharp/PackerType/WinRARSFX.cs @@ -18,10 +18,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs index 9fd83e76..001ae9ff 100644 --- a/BurnOutSharp/PackerType/WinZipSFX.cs +++ b/BurnOutSharp/PackerType/WinZipSFX.cs @@ -19,10 +19,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Try to read the contents as a PE executable - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); if (pex != null) { var sections = pex?.SectionTable; @@ -111,7 +110,6 @@ namespace BurnOutSharp.PackerType } // Try to read the contents as an NE executable - NewExecutable nex = NewExecutable.Deserialize(fileContent, 0); if (nex != null) { string version = GetNEHeaderVersion(nex); diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs index 241a88d0..f872af6e 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -29,10 +29,9 @@ namespace BurnOutSharp.PackerType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) { @@ -56,10 +55,6 @@ namespace BurnOutSharp.PackerType new ContentMatch(new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, start: sectionAddr, end: sectionEnd), "Wise Installation Wizard Module"), }; - - string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); - if (!string.IsNullOrWhiteSpace(match)) - return match; } // Get the .rdata section, if it exists diff --git a/BurnOutSharp/PackerType/dotFuscator.cs b/BurnOutSharp/PackerType/dotFuscator.cs index dad34f34..eb74aca9 100644 --- a/BurnOutSharp/PackerType/dotFuscator.cs +++ b/BurnOutSharp/PackerType/dotFuscator.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.PackerType @@ -23,7 +24,7 @@ namespace BurnOutSharp.PackerType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs index 5a6a854f..367d4e03 100644 --- a/BurnOutSharp/ProtectionType/ActiveMARK.cs +++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs @@ -26,10 +26,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs index 727b7c1a..d0b55661 100644 --- a/BurnOutSharp/ProtectionType/AlphaROM.cs +++ b/BurnOutSharp/ProtectionType/AlphaROM.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -18,7 +19,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/Bitpool.cs b/BurnOutSharp/ProtectionType/Bitpool.cs index 973d04f4..cfda7a3c 100644 --- a/BurnOutSharp/ProtectionType/Bitpool.cs +++ b/BurnOutSharp/ProtectionType/Bitpool.cs @@ -1,6 +1,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -30,7 +31,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs index e0a905c7..370a21b2 100644 --- a/BurnOutSharp/ProtectionType/CDCheck.cs +++ b/BurnOutSharp/ProtectionType/CDCheck.cs @@ -22,10 +22,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs index e160a73f..36435518 100644 --- a/BurnOutSharp/ProtectionType/CDCops.cs +++ b/BurnOutSharp/ProtectionType/CDCops.cs @@ -26,10 +26,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/CDKey.cs b/BurnOutSharp/ProtectionType/CDKey.cs index 014f9400..e2e61f69 100644 --- a/BurnOutSharp/ProtectionType/CDKey.cs +++ b/BurnOutSharp/ProtectionType/CDKey.cs @@ -7,10 +7,9 @@ namespace BurnOutSharp.ProtectionType public class CDKey : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs index a999e464..eb2eed66 100644 --- a/BurnOutSharp/ProtectionType/CDLock.cs +++ b/BurnOutSharp/ProtectionType/CDLock.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.ProtectionType public class CDLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs index 1c087c8d..85d58d9c 100644 --- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs +++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -18,7 +19,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index fc0242be..78839fce 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -26,10 +26,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs b/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs index 8a7975d6..213cab38 100644 --- a/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs @@ -1,29 +1,15 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Text; using BurnOutSharp.ExecutableType.Microsoft; -using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType { public class CengaProtectDVD : IContentCheck { /// - private List GetContentMatchSets() => null; - // { - // // TODO: Remove this if the below section check is proven - // return new List - // { - // // .cenega - // new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }, "Cenega ProtectDVD"), - // }; - // } - - /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; @@ -33,10 +19,6 @@ namespace BurnOutSharp.ProtectionType if (cenegaSection != null) return "Cenega ProtectDVD"; - var contentMatchSets = GetContentMatchSets(); - if (contentMatchSets != null && contentMatchSets.Any()) - return MatchUtil.GetFirstMatch(file, fileContent, contentMatchSets, includeDebug); - return null; } } diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs index 3525fa97..78484172 100644 --- a/BurnOutSharp/ProtectionType/CodeLock.cs +++ b/BurnOutSharp/ProtectionType/CodeLock.cs @@ -24,10 +24,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) { diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs index ba8a82d3..d35391c8 100644 --- a/BurnOutSharp/ProtectionType/CopyKiller.cs +++ b/BurnOutSharp/ProtectionType/CopyKiller.cs @@ -1,6 +1,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -23,7 +24,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs index 2b19e736..a23a0b87 100644 --- a/BurnOutSharp/ProtectionType/DVDCops.cs +++ b/BurnOutSharp/ProtectionType/DVDCops.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -24,7 +25,7 @@ namespace BurnOutSharp.ProtectionType /// TODO: Does this look for the `.grand` section like CD-Cops? /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index 32f3e5d3..340dd3e2 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -34,10 +34,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs index b4fffec6..72cb8aa0 100644 --- a/BurnOutSharp/ProtectionType/GFWL.cs +++ b/BurnOutSharp/ProtectionType/GFWL.cs @@ -12,10 +12,9 @@ namespace BurnOutSharp.ProtectionType public class GFWL : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs index a34a8d0d..2634234b 100644 --- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs +++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs @@ -13,10 +13,9 @@ namespace BurnOutSharp.ProtectionType public class ImpulseReactor : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs index a484d684..2f71027b 100644 --- a/BurnOutSharp/ProtectionType/Intenium.cs +++ b/BurnOutSharp/ProtectionType/Intenium.cs @@ -25,10 +25,9 @@ namespace BurnOutSharp.ProtectionType */ /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/JoWood.cs b/BurnOutSharp/ProtectionType/JoWood.cs index b8d8d352..60f6ab4d 100644 --- a/BurnOutSharp/ProtectionType/JoWood.cs +++ b/BurnOutSharp/ProtectionType/JoWood.cs @@ -13,10 +13,9 @@ namespace BurnOutSharp.ProtectionType public class JoWood : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs index e28202a9..c4d3ae3d 100644 --- a/BurnOutSharp/ProtectionType/KeyLock.cs +++ b/BurnOutSharp/ProtectionType/KeyLock.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -22,7 +23,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/LaserLok.cs b/BurnOutSharp/ProtectionType/LaserLok.cs index 5c3cff4d..4ffaf3b2 100644 --- a/BurnOutSharp/ProtectionType/LaserLok.cs +++ b/BurnOutSharp/ProtectionType/LaserLok.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType public class LaserLok : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // TODO: Additional checks that may or may not be useful with the below // @@ -48,7 +48,6 @@ namespace BurnOutSharp.ProtectionType // }, "LaserLok 5"), // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs index 4c45ad77..b4026db6 100644 --- a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs +++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.ProtectionType public class MediaMaxCD3 : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs index e53e1067..bdaabeb0 100644 --- a/BurnOutSharp/ProtectionType/OnlineRegistration.cs +++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs @@ -7,10 +7,9 @@ namespace BurnOutSharp.ProtectionType public class OnlineRegistration : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs index b3059232..ba06171e 100644 --- a/BurnOutSharp/ProtectionType/Origin.cs +++ b/BurnOutSharp/ProtectionType/Origin.cs @@ -1,6 +1,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -25,7 +26,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent,bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs index bbce7356..9bc32fb6 100644 --- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs +++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -46,7 +47,7 @@ namespace BurnOutSharp.ProtectionType // For now, this means that the CheckContents check is redundant for external // use through other programs /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { return MatchUtil.GetFirstMatch(file, fileContent, GetContentMatchSets(), includeDebug); } diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs index 29a50bac..d4d5ad53 100644 --- a/BurnOutSharp/ProtectionType/ProtectDisc.cs +++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs @@ -11,10 +11,9 @@ namespace BurnOutSharp.ProtectionType public class ProtectDISC : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs index b429257b..9b44551c 100644 --- a/BurnOutSharp/ProtectionType/RingPROTECH.cs +++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -22,7 +23,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/SVKP.cs b/BurnOutSharp/ProtectionType/SVKP.cs index 26585bc2..90af275f 100644 --- a/BurnOutSharp/ProtectionType/SVKP.cs +++ b/BurnOutSharp/ProtectionType/SVKP.cs @@ -6,10 +6,9 @@ namespace BurnOutSharp.ProtectionType public class SVKProtector : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { - // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); + // Get the image file header from the executable, if possible if (pex?.ImageFileHeader == null) return null; diff --git a/BurnOutSharp/ProtectionType/SafeCast.cs b/BurnOutSharp/ProtectionType/SafeCast.cs index 7b1feea7..bfb3be80 100644 --- a/BurnOutSharp/ProtectionType/SafeCast.cs +++ b/BurnOutSharp/ProtectionType/SafeCast.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -39,7 +40,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index 35aa10ee..2ae3f5c4 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -40,10 +40,9 @@ namespace BurnOutSharp.ProtectionType }; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index c29ef355..07b11efc 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -1,6 +1,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType @@ -19,7 +20,7 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs index e44a1cb5..48b9dd90 100644 --- a/BurnOutSharp/ProtectionType/SecuROM.cs +++ b/BurnOutSharp/ProtectionType/SecuROM.cs @@ -11,13 +11,13 @@ namespace BurnOutSharp.ProtectionType { // TODO: Investigate why White Label v8 doesn't get detected - http://redump.org/disc/48997/ // TODO: Does the ".shr" section in the code have anything to do with this? + // TODO: Investigate SecuROM for Macintosh public class SecuROM : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs index 4191d605..4faa84be 100644 --- a/BurnOutSharp/ProtectionType/SmartE.cs +++ b/BurnOutSharp/ProtectionType/SmartE.cs @@ -12,10 +12,9 @@ namespace BurnOutSharp.ProtectionType public class SmartE : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index 43a239bd..a7ef6c2d 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -44,10 +44,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; @@ -120,7 +119,7 @@ namespace BurnOutSharp.ProtectionType // Search the last two available sections for (int i = sections.Length - 2; i < sections.Length; i++) { - var nthSection = sections[i]; + var nthSection = i < 0 ? null : sections[i]; if (nthSection != null) { int sectionAddr = (int)nthSection.PointerToRawData; diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs index 2d56bd9e..77d7811c 100644 --- a/BurnOutSharp/ProtectionType/StarForce.cs +++ b/BurnOutSharp/ProtectionType/StarForce.cs @@ -11,10 +11,9 @@ namespace BurnOutSharp.ProtectionType public class StarForce : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs index a6422311..71d000a9 100644 --- a/BurnOutSharp/ProtectionType/Sysiphus.cs +++ b/BurnOutSharp/ProtectionType/Sysiphus.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.ProtectionType public class Sysiphus : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs index c1100da6..92dd06c3 100644 --- a/BurnOutSharp/ProtectionType/Tages.cs +++ b/BurnOutSharp/ProtectionType/Tages.cs @@ -33,10 +33,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs index 05f29d3e..03c179aa 100644 --- a/BurnOutSharp/ProtectionType/ThreePLock.cs +++ b/BurnOutSharp/ProtectionType/ThreePLock.cs @@ -7,10 +7,9 @@ namespace BurnOutSharp.ProtectionType public class ThreePLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs index 7f5ba7ab..52f835f2 100644 --- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs +++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs @@ -9,10 +9,9 @@ namespace BurnOutSharp.ProtectionType public class ThreeTwoOneStudios : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs index 68ad0e42..73f77f25 100644 --- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs +++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs @@ -10,10 +10,9 @@ namespace BurnOutSharp.ProtectionType public class WTMCDProtect : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null; diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs index 33348685..84ebc20e 100644 --- a/BurnOutSharp/ProtectionType/XCP.cs +++ b/BurnOutSharp/ProtectionType/XCP.cs @@ -28,10 +28,9 @@ namespace BurnOutSharp.ProtectionType } /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible - PortableExecutable pex = PortableExecutable.Deserialize(fileContent, 0); var sections = pex?.SectionTable; if (sections == null) return null;