diff --git a/BinaryObjectScanner.FileType/AACSMediaKeyBlock.cs b/BinaryObjectScanner.FileType/AACSMediaKeyBlock.cs index 8ff31b02..03f26267 100644 --- a/BinaryObjectScanner.FileType/AACSMediaKeyBlock.cs +++ b/BinaryObjectScanner.FileType/AACSMediaKeyBlock.cs @@ -34,7 +34,7 @@ namespace BinaryObjectScanner.FileType return null; // Derive the version, if possible - var typeAndVersion = mkb.Records.FirstOrDefault(r => r.RecordType == SabreTools.Models.AACS.RecordType.TypeAndVersion); + var typeAndVersion = mkb.Model.Records.FirstOrDefault(r => r.RecordType == SabreTools.Models.AACS.RecordType.TypeAndVersion); if (typeAndVersion == null) return "AACS (Unknown Version)"; else diff --git a/BinaryObjectScanner.FileType/BDPlusSVM.cs b/BinaryObjectScanner.FileType/BDPlusSVM.cs index 71db4540..01e657ed 100644 --- a/BinaryObjectScanner.FileType/BDPlusSVM.cs +++ b/BinaryObjectScanner.FileType/BDPlusSVM.cs @@ -33,7 +33,7 @@ namespace BinaryObjectScanner.FileType return null; // Format the date - string date = $"{svm.Year:0000}/{svm.Month:00}/{svm.Day:00}"; + string date = $"{svm.Model.Year:0000}/{svm.Model.Month:00}/{svm.Model.Day:00}"; // Return the formatted value return $"BD+ {date}"; diff --git a/BinaryObjectScanner.GameEngine/RenderWare.cs b/BinaryObjectScanner.GameEngine/RenderWare.cs index 2e3ed610..b92b32a7 100644 --- a/BinaryObjectScanner.GameEngine/RenderWare.cs +++ b/BinaryObjectScanner.GameEngine/RenderWare.cs @@ -21,7 +21,7 @@ namespace BinaryObjectScanner.GameEngine public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/ASPack.cs b/BinaryObjectScanner.Packer/ASPack.cs index 5c311286..f0920d37 100644 --- a/BinaryObjectScanner.Packer/ASPack.cs +++ b/BinaryObjectScanner.Packer/ASPack.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/AdvancedInstaller.cs b/BinaryObjectScanner.Packer/AdvancedInstaller.cs index f4904b30..0059cce8 100644 --- a/BinaryObjectScanner.Packer/AdvancedInstaller.cs +++ b/BinaryObjectScanner.Packer/AdvancedInstaller.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/Armadillo.cs b/BinaryObjectScanner.Packer/Armadillo.cs index 1fc45d2b..e5e9cb0a 100644 --- a/BinaryObjectScanner.Packer/Armadillo.cs +++ b/BinaryObjectScanner.Packer/Armadillo.cs @@ -15,7 +15,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/AutoPlayMediaStudio.cs b/BinaryObjectScanner.Packer/AutoPlayMediaStudio.cs index 981371c0..d39e36b8 100644 --- a/BinaryObjectScanner.Packer/AutoPlayMediaStudio.cs +++ b/BinaryObjectScanner.Packer/AutoPlayMediaStudio.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/CExe.cs b/BinaryObjectScanner.Packer/CExe.cs index bef925f9..98d84321 100644 --- a/BinaryObjectScanner.Packer/CExe.cs +++ b/BinaryObjectScanner.Packer/CExe.cs @@ -19,7 +19,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/EXEStealth.cs b/BinaryObjectScanner.Packer/EXEStealth.cs index 4ac29fbf..6acbd266 100644 --- a/BinaryObjectScanner.Packer/EXEStealth.cs +++ b/BinaryObjectScanner.Packer/EXEStealth.cs @@ -41,7 +41,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/EmbeddedExecutable.cs b/BinaryObjectScanner.Packer/EmbeddedExecutable.cs index bfcad3bf..60003889 100644 --- a/BinaryObjectScanner.Packer/EmbeddedExecutable.cs +++ b/BinaryObjectScanner.Packer/EmbeddedExecutable.cs @@ -17,7 +17,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/GenteeInstaller.cs b/BinaryObjectScanner.Packer/GenteeInstaller.cs index cd128bfc..aff6daf8 100644 --- a/BinaryObjectScanner.Packer/GenteeInstaller.cs +++ b/BinaryObjectScanner.Packer/GenteeInstaller.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/HyperTechCrackProof.cs b/BinaryObjectScanner.Packer/HyperTechCrackProof.cs index 78aa25f9..4db6fad3 100644 --- a/BinaryObjectScanner.Packer/HyperTechCrackProof.cs +++ b/BinaryObjectScanner.Packer/HyperTechCrackProof.cs @@ -16,14 +16,14 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // This check may be overly limiting, as it excludes the sample provided to DiE (https://github.com/horsicq/Detect-It-Easy/issues/102). // TODO: Find further samples and invesitgate if the "peC" section is only present on specific versions. bool peCSection = pex.ContainsSection("peC", exact: true); - bool importTableMatch = (pex.ImportTable?.ImportDirectoryTable?.Any(idte => idte.Name == "KeRnEl32.dLl") ?? false); + bool importTableMatch = (pex.Model.ImportTable?.ImportDirectoryTable?.Any(idte => idte.Name == "KeRnEl32.dLl") ?? false); if (peCSection && importTableMatch) return "HyperTech CrackProof"; diff --git a/BinaryObjectScanner.Packer/InnoSetup.cs b/BinaryObjectScanner.Packer/InnoSetup.cs index 3bfe6a6b..a91dca99 100644 --- a/BinaryObjectScanner.Packer/InnoSetup.cs +++ b/BinaryObjectScanner.Packer/InnoSetup.cs @@ -19,7 +19,7 @@ namespace BinaryObjectScanner.Packer return null; // Check for "Inno" in the reserved words - if (nex.Stub_Reserved2[4] == 0x6E49 && nex.Stub_Reserved2[5] == 0x6F6E) + if (nex.Model.Stub?.Header?.Reserved2[4] == 0x6E49 && nex.Model.Stub?.Header?.Reserved2[5] == 0x6F6E) { string version = GetOldVersion(file, nex); if (!string.IsNullOrWhiteSpace(version)) @@ -35,7 +35,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/InstallAnywhere.cs b/BinaryObjectScanner.Packer/InstallAnywhere.cs index 48aa0b0d..84c8e86d 100644 --- a/BinaryObjectScanner.Packer/InstallAnywhere.cs +++ b/BinaryObjectScanner.Packer/InstallAnywhere.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/InstallerVISE.cs b/BinaryObjectScanner.Packer/InstallerVISE.cs index a302ebff..cd1a3601 100644 --- a/BinaryObjectScanner.Packer/InstallerVISE.cs +++ b/BinaryObjectScanner.Packer/InstallerVISE.cs @@ -15,7 +15,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/IntelInstallationFramework.cs b/BinaryObjectScanner.Packer/IntelInstallationFramework.cs index 8a4c39ea..b8f2b02c 100644 --- a/BinaryObjectScanner.Packer/IntelInstallationFramework.cs +++ b/BinaryObjectScanner.Packer/IntelInstallationFramework.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/MicrosoftCABSFX.cs b/BinaryObjectScanner.Packer/MicrosoftCABSFX.cs index bcbc5a9c..33a8f861 100644 --- a/BinaryObjectScanner.Packer/MicrosoftCABSFX.cs +++ b/BinaryObjectScanner.Packer/MicrosoftCABSFX.cs @@ -15,7 +15,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/NSIS.cs b/BinaryObjectScanner.Packer/NSIS.cs index 418bd14b..95b60328 100644 --- a/BinaryObjectScanner.Packer/NSIS.cs +++ b/BinaryObjectScanner.Packer/NSIS.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/NeoLite.cs b/BinaryObjectScanner.Packer/NeoLite.cs index b9b6ceaa..a167b3ee 100644 --- a/BinaryObjectScanner.Packer/NeoLite.cs +++ b/BinaryObjectScanner.Packer/NeoLite.cs @@ -21,7 +21,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/PECompact.cs b/BinaryObjectScanner.Packer/PECompact.cs index 7e5adaa0..72506ff5 100644 --- a/BinaryObjectScanner.Packer/PECompact.cs +++ b/BinaryObjectScanner.Packer/PECompact.cs @@ -12,12 +12,12 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // 0x4F434550 is "PECO" - if (pex.PointerToSymbolTable == 0x4F434550) + if (pex.Model.COFFFileHeader?.PointerToSymbolTable == 0x4F434550) return "PE Compact v1.x"; // TODO: Get more granular version detection. PiD is somehow able to detect version ranges based diff --git a/BinaryObjectScanner.Packer/Petite.cs b/BinaryObjectScanner.Packer/Petite.cs index 09e2ac9e..00fed95c 100644 --- a/BinaryObjectScanner.Packer/Petite.cs +++ b/BinaryObjectScanner.Packer/Petite.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/SetupFactory.cs b/BinaryObjectScanner.Packer/SetupFactory.cs index 2614e454..332ec73a 100644 --- a/BinaryObjectScanner.Packer/SetupFactory.cs +++ b/BinaryObjectScanner.Packer/SetupFactory.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/SevenZipSFX.cs b/BinaryObjectScanner.Packer/SevenZipSFX.cs index 9992017d..ad898c8b 100644 --- a/BinaryObjectScanner.Packer/SevenZipSFX.cs +++ b/BinaryObjectScanner.Packer/SevenZipSFX.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/Shrinker.cs b/BinaryObjectScanner.Packer/Shrinker.cs index c12728db..89c1d990 100644 --- a/BinaryObjectScanner.Packer/Shrinker.cs +++ b/BinaryObjectScanner.Packer/Shrinker.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/UPX.cs b/BinaryObjectScanner.Packer/UPX.cs index a14cf34e..554c97de 100644 --- a/BinaryObjectScanner.Packer/UPX.cs +++ b/BinaryObjectScanner.Packer/UPX.cs @@ -20,7 +20,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/WinRARSFX.cs b/BinaryObjectScanner.Packer/WinRARSFX.cs index 06380889..ffd369e2 100644 --- a/BinaryObjectScanner.Packer/WinRARSFX.cs +++ b/BinaryObjectScanner.Packer/WinRARSFX.cs @@ -15,7 +15,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Packer/WinZipSFX.cs b/BinaryObjectScanner.Packer/WinZipSFX.cs index 00b1577f..0b4a1328 100644 --- a/BinaryObjectScanner.Packer/WinZipSFX.cs +++ b/BinaryObjectScanner.Packer/WinZipSFX.cs @@ -19,11 +19,11 @@ namespace BinaryObjectScanner.Packer return null; // If the resident-name table doesnt exist - if (nex.ResidentNameTable == null) + if (nex.Model.ResidentNameTable == null) return null; // Check for the WinZip name string - bool winZipNameFound = nex.ResidentNameTable.Where(rnte => rnte?.NameString != null) + bool winZipNameFound = nex.Model.ResidentNameTable.Where(rnte => rnte?.NameString != null) .Select(rnte => Encoding.ASCII.GetString(rnte.NameString)) .Any(s => s.Contains("WZ-SE-01")); @@ -43,12 +43,12 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // Check the export directory table, if it exists - if (pex.ExportTable?.ExportDirectoryTable != null) + if (pex.Model.ExportTable?.ExportDirectoryTable != null) { string version = GetPEExportDirectoryVersion(pex); if (!string.IsNullOrWhiteSpace(version)) @@ -127,146 +127,146 @@ namespace BinaryObjectScanner.Packer #region 2.0 Variants // 2.0 (MS-DOS/16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0086 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0086 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x00012BE6 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006C - && nex.NonResidentNamesTableOffset == 0x000044B8 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x00012BE6 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006C + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000044B8 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "2.0 (MS-DOS/16-bit)"; // 2.0 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0086 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0086 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x00013174 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006C - && nex.NonResidentNamesTableOffset == 0x00000198 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x00013174 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006C + && nex.Model.Header?.NonResidentNamesTableOffset == 0x00000198 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "2.0 (16-bit)"; // Compact 2.0 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0080 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0080 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x000124A0 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0003 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006A - && nex.NonResidentNamesTableOffset == 0x00000192 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x000124A0 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0003 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006A + && nex.Model.Header?.NonResidentNamesTableOffset == 0x00000192 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Compact 2.0 (16-bit)"; // Software Installation 2.0 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00CD - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00CD + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x000136FA - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0005 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0097 - && nex.ModuleReferenceTableOffset == 0x00A3 - && nex.ImportedNamesTableOffset == 0x00AD - && nex.NonResidentNamesTableOffset == 0x000001DF - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x000136FA + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0005 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0097 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x00A3 + && nex.Model.Header?.ImportedNamesTableOffset == 0x00AD + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001DF + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Software Installation 2.0 (16-bit)"; #endregion @@ -274,145 +274,145 @@ namespace BinaryObjectScanner.Packer #region 2.1 RC2 Variants // 2.1 RC2 (MS-DOS/16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0086 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0086 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x00013386 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006C - && nex.NonResidentNamesTableOffset == 0x000043C8 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x00013386 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006C + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000043C8 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "2.1 RC2 (MS-DOS/16-bit)"; // 2.1 RC2 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00BE - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00BE + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x00013E56 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0090 - && nex.ModuleReferenceTableOffset == 0x009C - && nex.ImportedNamesTableOffset == 0x00A4 - && nex.NonResidentNamesTableOffset == 0x000001D0 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x00013E56 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0090 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x009C + && nex.Model.Header?.ImportedNamesTableOffset == 0x00A4 + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001D0 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "2.1 RC2 (16-bit)"; // Compact 2.1 RC2 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0080 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0080 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x00012B84 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0003 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006A - && nex.NonResidentNamesTableOffset == 0x00000192 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x00012B84 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0003 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006A + && nex.Model.Header?.NonResidentNamesTableOffset == 0x00000192 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Compact 2.1 RC2 (16-bit)"; // Software Installation 2.1 RC2 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00BE - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00BE + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x000143AC - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0090 - && nex.ModuleReferenceTableOffset == 0x009C - && nex.ImportedNamesTableOffset == 0x00A4 - && nex.NonResidentNamesTableOffset == 0x000001D0 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x000143AC + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0090 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x009C + && nex.Model.Header?.ImportedNamesTableOffset == 0x00A4 + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001D0 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Software Installation 2.1 RC2 (16-bit)"; #endregion @@ -420,145 +420,145 @@ namespace BinaryObjectScanner.Packer #region 2.1 Variants // 2.1 (MS-DOS/16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0086 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0086 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x3A00 - && nex.InitialCSIPSetting == 0x00013396 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006C - && nex.NonResidentNamesTableOffset == 0x000043C8 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x3A00 + && nex.Model.Header?.InitialCSIPSetting == 0x00013396 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006C + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000043C8 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "2.1 (MS-DOS/16-bit)"; // 2.1 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00BE - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00BE + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x3A00 - && nex.InitialCSIPSetting == 0x00013E7E - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0090 - && nex.ModuleReferenceTableOffset == 0x009C - && nex.ImportedNamesTableOffset == 0x00A4 - && nex.NonResidentNamesTableOffset == 0x000001D0 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x3A00 + && nex.Model.Header?.InitialCSIPSetting == 0x00013E7E + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0090 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x009C + && nex.Model.Header?.ImportedNamesTableOffset == 0x00A4 + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001D0 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "2.1 (16-bit)"; // Compact 2.1 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0080 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0080 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x3A00 - && nex.InitialCSIPSetting == 0x00012B90 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0003 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006A - && nex.NonResidentNamesTableOffset == 0x00000192 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x3A00 + && nex.Model.Header?.InitialCSIPSetting == 0x00012B90 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0003 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006A + && nex.Model.Header?.NonResidentNamesTableOffset == 0x00000192 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Compact 2.1 (16-bit)"; // Software Installation 2.1 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00BE - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00BE + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x3A00 - && nex.InitialCSIPSetting == 0x00014408 - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0090 - && nex.ModuleReferenceTableOffset == 0x009C - && nex.ImportedNamesTableOffset == 0x00A4 - && nex.NonResidentNamesTableOffset == 0x000001D0 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x3A00 + && nex.Model.Header?.InitialCSIPSetting == 0x00014408 + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0090 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x009C + && nex.Model.Header?.ImportedNamesTableOffset == 0x00A4 + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001D0 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Software Installation 2.1 (16-bit)"; #endregion @@ -566,109 +566,109 @@ namespace BinaryObjectScanner.Packer #region Misc. Variants // Personal Edition (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x0086 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x0086 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.ProtectedModeOnly | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x4000 - && nex.InitialCSIPSetting == 0x0001317C - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0058 - && nex.ModuleReferenceTableOffset == 0x0064 - && nex.ImportedNamesTableOffset == 0x006C - && nex.NonResidentNamesTableOffset == 0x00000198 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x4000 + && nex.Model.Header?.InitialCSIPSetting == 0x0001317C + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0058 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x0064 + && nex.Model.Header?.ImportedNamesTableOffset == 0x006C + && nex.Model.Header?.NonResidentNamesTableOffset == 0x00000198 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Personal Edition (16-bit)"; // Personal Edition 32-bit (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00BE - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00BE + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x2000 - && nex.InitialStackAlloc == 0x3C00 - && nex.InitialCSIPSetting == 0x00013E7C - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0004 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0090 - && nex.ModuleReferenceTableOffset == 0x009C - && nex.ImportedNamesTableOffset == 0x00A4 - && nex.NonResidentNamesTableOffset == 0x000001D0 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x2000 + && nex.Model.Header?.InitialStackAlloc == 0x3C00 + && nex.Model.Header?.InitialCSIPSetting == 0x00013E7C + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0004 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0090 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x009C + && nex.Model.Header?.ImportedNamesTableOffset == 0x00A4 + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001D0 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Personal Edition 32-bit (16-bit)"; // Personal Edition 32-bit Build 1260/1285 (16-bit) - if (nex.LinkerVersion == 0x11 - && nex.LinkerRevision == 0x20 - && nex.EntryTableOffset == 0x00C6 - && nex.EntryTableSize == 0x0002 - && nex.CrcChecksum == 0x00000000 - && nex.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA + if (nex.Model.Header?.LinkerVersion == 0x11 + && nex.Model.Header?.LinkerRevision == 0x20 + && nex.Model.Header?.EntryTableOffset == 0x00C6 + && nex.Model.Header?.EntryTableSize == 0x0002 + && nex.Model.Header?.CrcChecksum == 0x00000000 + && nex.Model.Header?.FlagWord == (SabreTools.Models.NewExecutable.HeaderFlag.MULTIPLEDATA | SabreTools.Models.NewExecutable.HeaderFlag.FullScreen | SabreTools.Models.NewExecutable.HeaderFlag.WindowsPMCompatible) - && nex.AutomaticDataSegmentNumber == 0x0003 - && nex.InitialHeapAlloc == 0x43DC - && nex.InitialStackAlloc == 0x2708 - && nex.InitialCSIPSetting == 0x00014ADC - && nex.InitialSSSPSetting == 0x00030000 - && nex.FileSegmentCount == 0x0003 - && nex.ModuleReferenceTableSize == 0x0005 - && nex.NonResidentNameTableSize == 0x004B - && nex.SegmentTableOffset == 0x0040 - && nex.ResourceTableOffset == 0x0058 - && nex.ResidentNameTableOffset == 0x0090 - && nex.ModuleReferenceTableOffset == 0x009C - && nex.ImportedNamesTableOffset == 0x00A6 - && nex.NonResidentNamesTableOffset == 0x000001D8 - && nex.MovableEntriesCount == 0x0000 - && nex.SegmentAlignmentShiftCount == 0x0001 - && nex.ResourceEntriesCount == 0x0000 - && nex.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS - && nex.AdditionalFlags == 0x00 - && nex.ReturnThunkOffset == 0x0000 - && nex.SegmentReferenceThunkOffset == 0x0000 - && nex.MinCodeSwapAreaSize == 0x0000 - && nex.WindowsSDKRevision == 0x00 - && nex.WindowsSDKVersion == 0x03) + && nex.Model.Header?.AutomaticDataSegmentNumber == 0x0003 + && nex.Model.Header?.InitialHeapAlloc == 0x43DC + && nex.Model.Header?.InitialStackAlloc == 0x2708 + && nex.Model.Header?.InitialCSIPSetting == 0x00014ADC + && nex.Model.Header?.InitialSSSPSetting == 0x00030000 + && nex.Model.Header?.FileSegmentCount == 0x0003 + && nex.Model.Header?.ModuleReferenceTableSize == 0x0005 + && nex.Model.Header?.NonResidentNameTableSize == 0x004B + && nex.Model.Header?.SegmentTableOffset == 0x0040 + && nex.Model.Header?.ResourceTableOffset == 0x0058 + && nex.Model.Header?.ResidentNameTableOffset == 0x0090 + && nex.Model.Header?.ModuleReferenceTableOffset == 0x009C + && nex.Model.Header?.ImportedNamesTableOffset == 0x00A6 + && nex.Model.Header?.NonResidentNamesTableOffset == 0x000001D8 + && nex.Model.Header?.MovableEntriesCount == 0x0000 + && nex.Model.Header?.SegmentAlignmentShiftCount == 0x0001 + && nex.Model.Header?.ResourceEntriesCount == 0x0000 + && nex.Model.Header?.TargetOperatingSystem == SabreTools.Models.NewExecutable.OperatingSystem.WINDOWS + && nex.Model.Header?.AdditionalFlags == 0x00 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.ReturnThunkOffset == 0x0000 + && nex.Model.Header?.MinCodeSwapAreaSize == 0x0000 + && nex.Model.Header?.WindowsSDKRevision == 0x00 + && nex.Model.Header?.WindowsSDKVersion == 0x03) return "Personal Edition 32-bit Build 1260/1285 (16-bit)"; #endregion @@ -682,8 +682,8 @@ namespace BinaryObjectScanner.Packer /// TODO: Research to see if the versions are embedded elsewhere in these files private string GetPEExportDirectoryVersion(PortableExecutable pex) { - string sfxFileName = pex.ExportTable.ExportDirectoryTable.Name; - uint sfxTimeDateStamp = pex.ExportTable.ExportDirectoryTable.TimeDateStamp; + string sfxFileName = pex.Model.ExportTable.ExportDirectoryTable.Name; + uint sfxTimeDateStamp = pex.Model.ExportTable.ExportDirectoryTable.TimeDateStamp; string assemblyVersion = pex.AssemblyVersion ?? "Unknown Version"; // Standard diff --git a/BinaryObjectScanner.Packer/WiseInstaller.cs b/BinaryObjectScanner.Packer/WiseInstaller.cs index 42fac0ad..4d0faa89 100644 --- a/BinaryObjectScanner.Packer/WiseInstaller.cs +++ b/BinaryObjectScanner.Packer/WiseInstaller.cs @@ -47,7 +47,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -120,7 +120,7 @@ namespace BinaryObjectScanner.Packer private FormatProperty MatchesNEVersion(NewExecutable nex) { // TODO: Offset is _not_ the EXE header address, rather where the data starts. Fix this. - switch (nex.Stub_NewExeHeaderAddr) + switch (nex.Model.Stub?.Header?.NewExeHeaderAddr) { case 0x84b0: return new FormatProperty { Dll = false, ArchiveStart = 0x11, ArchiveEnd = -1, InitText = false, FilenamePosition = 0x04, NoCrc = true }; diff --git a/BinaryObjectScanner.Packer/dotFuscator.cs b/BinaryObjectScanner.Packer/dotFuscator.cs index dbe98369..179fea5a 100644 --- a/BinaryObjectScanner.Packer/dotFuscator.cs +++ b/BinaryObjectScanner.Packer/dotFuscator.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Packer public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ActiveMARK.cs b/BinaryObjectScanner.Protection/ActiveMARK.cs index fa111ea9..1a679319 100644 --- a/BinaryObjectScanner.Protection/ActiveMARK.cs +++ b/BinaryObjectScanner.Protection/ActiveMARK.cs @@ -37,7 +37,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/AegiSoft.cs b/BinaryObjectScanner.Protection/AegiSoft.cs index 79af4abb..3ca4953d 100644 --- a/BinaryObjectScanner.Protection/AegiSoft.cs +++ b/BinaryObjectScanner.Protection/AegiSoft.cs @@ -23,7 +23,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/AlphaROM.cs b/BinaryObjectScanner.Protection/AlphaROM.cs index 4f78adb8..196521f0 100644 --- a/BinaryObjectScanner.Protection/AlphaROM.cs +++ b/BinaryObjectScanner.Protection/AlphaROM.cs @@ -50,7 +50,7 @@ namespace BinaryObjectScanner.Protection // TODO: Add version detection for Alpha-ROM. // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ByteShield.cs b/BinaryObjectScanner.Protection/ByteShield.cs index 420bd011..e32a6d52 100644 --- a/BinaryObjectScanner.Protection/ByteShield.cs +++ b/BinaryObjectScanner.Protection/ByteShield.cs @@ -44,7 +44,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -69,7 +69,7 @@ namespace BinaryObjectScanner.Protection return $"ByteShield Activation Client {pex.GetInternalVersion()}"; // Found in "ByteShield.dll" in Redump entry 6236 - name = pex.ExportTable?.ExportDirectoryTable?.Name; + name = pex.Model.ExportTable?.ExportDirectoryTable?.Name; if (name?.Equals("ByteShield Client") == true) return "ByteShield Component Module"; diff --git a/BinaryObjectScanner.Protection/CDCheck.cs b/BinaryObjectScanner.Protection/CDCheck.cs index 2e41de6e..6d31544c 100644 --- a/BinaryObjectScanner.Protection/CDCheck.cs +++ b/BinaryObjectScanner.Protection/CDCheck.cs @@ -9,7 +9,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/CDDVDCops.cs b/BinaryObjectScanner.Protection/CDDVDCops.cs index 0d3e24af..6b16524c 100644 --- a/BinaryObjectScanner.Protection/CDDVDCops.cs +++ b/BinaryObjectScanner.Protection/CDDVDCops.cs @@ -102,7 +102,7 @@ namespace BinaryObjectScanner.Protection // Check the imported-name table // Found in "h3blade.exe" in Redump entry 85077. - bool importedNameTableEntries = nex.ImportedNameTable? + bool importedNameTableEntries = nex.Model.ImportedNameTable? .Select(kvp => kvp.Value) .Where(inte => inte.NameString != null) .Select(inte => Encoding.ASCII.GetString(inte.NameString)) @@ -112,7 +112,7 @@ namespace BinaryObjectScanner.Protection // Check the nonresident-name table // Found in "CDCOPS.DLL" in Redump entry 85077. - bool nonresidentNameTableEntries = nex.NonResidentNameTable? + bool nonresidentNameTableEntries = nex.Model.NonResidentNameTable? .Where(nrnte => nrnte.NameString != null) .Select(nrnte => Encoding.ASCII.GetString(nrnte.NameString)) .Any(s => s.Contains("CDcops assembly-language DLL")) ?? false; @@ -126,7 +126,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/CDGuard.cs b/BinaryObjectScanner.Protection/CDGuard.cs index 5358929e..2b4f5383 100644 --- a/BinaryObjectScanner.Protection/CDGuard.cs +++ b/BinaryObjectScanner.Protection/CDGuard.cs @@ -27,26 +27,26 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // TODO: Investigate the numerous ".guard" sections present in "Randevu.exe" in Redump entry 97142. // Get the export directory table - if (pex.ExportTable?.ExportDirectoryTable != null) + if (pex.Model.ExportTable?.ExportDirectoryTable != null) { // Found in "cdguard.dll" in Redump entry 97142 and IA item "pahgeby-he3hakomkou". - bool match = pex.ExportTable.ExportDirectoryTable.Name?.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase) == true; + bool match = pex.Model.ExportTable.ExportDirectoryTable.Name?.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase) == true; if (match) return "CD-Guard Copy Protection System"; } // Get the import directory table - if (pex.ImportTable?.ImportDirectoryTable != null) + if (pex.Model.ImportTable?.ImportDirectoryTable != null) { // Found in "Randevu.exe" in Redump entry 97142. - bool match = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name?.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase) == true); + bool match = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name?.Equals("cdguard.dll", StringComparison.OrdinalIgnoreCase) == true); if (match) return "CD-Guard Copy Protection System"; } diff --git a/BinaryObjectScanner.Protection/CDKey.cs b/BinaryObjectScanner.Protection/CDKey.cs index 2c8cd422..8c3a4af0 100644 --- a/BinaryObjectScanner.Protection/CDKey.cs +++ b/BinaryObjectScanner.Protection/CDKey.cs @@ -10,7 +10,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/CDLock.cs b/BinaryObjectScanner.Protection/CDLock.cs index d7a60495..227fac11 100644 --- a/BinaryObjectScanner.Protection/CDLock.cs +++ b/BinaryObjectScanner.Protection/CDLock.cs @@ -30,7 +30,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/CDSHiELDSE.cs b/BinaryObjectScanner.Protection/CDSHiELDSE.cs index 9f03ca8e..a2dd5e34 100644 --- a/BinaryObjectScanner.Protection/CDSHiELDSE.cs +++ b/BinaryObjectScanner.Protection/CDSHiELDSE.cs @@ -11,15 +11,15 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // TODO: Indicates Hypertech Crack Proof as well? //// Get the import directory table - //if (pex.ImportTable?.ImportDirectoryTable != null) + //if (pex.Model.ImportTable?.ImportDirectoryTable != null) //{ - // bool match = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "KeRnEl32.dLl"); + // bool match = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "KeRnEl32.dLl"); // if (match) // return "CDSHiELD SE"; //} diff --git a/BinaryObjectScanner.Protection/CenegaProtectDVD.cs b/BinaryObjectScanner.Protection/CenegaProtectDVD.cs index 23258415..8a3a3a72 100644 --- a/BinaryObjectScanner.Protection/CenegaProtectDVD.cs +++ b/BinaryObjectScanner.Protection/CenegaProtectDVD.cs @@ -18,15 +18,15 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // Get the export directory table - if (pex.ExportTable?.ExportDirectoryTable != null) + if (pex.Model.ExportTable?.ExportDirectoryTable != null) { // Found in "cenega.dll" in IA item "speed-pack". - bool match = pex.ExportTable.ExportDirectoryTable.Name?.Equals("ProtectDVD.dll", StringComparison.OrdinalIgnoreCase) == true; + bool match = pex.Model.ExportTable.ExportDirectoryTable.Name?.Equals("ProtectDVD.dll", StringComparison.OrdinalIgnoreCase) == true; if (match) return "Cenega ProtectDVD"; } diff --git a/BinaryObjectScanner.Protection/ChosenBytesCodeLock.cs b/BinaryObjectScanner.Protection/ChosenBytesCodeLock.cs index 9728ad39..ae1250e1 100644 --- a/BinaryObjectScanner.Protection/ChosenBytesCodeLock.cs +++ b/BinaryObjectScanner.Protection/ChosenBytesCodeLock.cs @@ -26,7 +26,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/CopyLok.cs b/BinaryObjectScanner.Protection/CopyLok.cs index 9e59996b..07eb4799 100644 --- a/BinaryObjectScanner.Protection/CopyLok.cs +++ b/BinaryObjectScanner.Protection/CopyLok.cs @@ -26,7 +26,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/CrypKey.cs b/BinaryObjectScanner.Protection/CrypKey.cs index 17f16735..b07fd83b 100644 --- a/BinaryObjectScanner.Protection/CrypKey.cs +++ b/BinaryObjectScanner.Protection/CrypKey.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Cucko.cs b/BinaryObjectScanner.Protection/Cucko.cs index 9a332347..73398b5c 100644 --- a/BinaryObjectScanner.Protection/Cucko.cs +++ b/BinaryObjectScanner.Protection/Cucko.cs @@ -15,7 +15,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Denuvo.cs b/BinaryObjectScanner.Protection/Denuvo.cs index 6155b496..e850efbd 100644 --- a/BinaryObjectScanner.Protection/Denuvo.cs +++ b/BinaryObjectScanner.Protection/Denuvo.cs @@ -34,7 +34,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/DiscGuard.cs b/BinaryObjectScanner.Protection/DiscGuard.cs index fa3ab0c8..d448acd1 100644 --- a/BinaryObjectScanner.Protection/DiscGuard.cs +++ b/BinaryObjectScanner.Protection/DiscGuard.cs @@ -41,7 +41,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/EasyAntiCheat.cs b/BinaryObjectScanner.Protection/EasyAntiCheat.cs index dd06bbe7..acbe687c 100644 --- a/BinaryObjectScanner.Protection/EasyAntiCheat.cs +++ b/BinaryObjectScanner.Protection/EasyAntiCheat.cs @@ -25,7 +25,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ElectronicArts.cs b/BinaryObjectScanner.Protection/ElectronicArts.cs index 5b86c310..b9a647e8 100644 --- a/BinaryObjectScanner.Protection/ElectronicArts.cs +++ b/BinaryObjectScanner.Protection/ElectronicArts.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Engine32.cs b/BinaryObjectScanner.Protection/Engine32.cs index 4970a66c..6d418c4d 100644 --- a/BinaryObjectScanner.Protection/Engine32.cs +++ b/BinaryObjectScanner.Protection/Engine32.cs @@ -19,17 +19,17 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // Most every tested sample of "engine32.dll" has a product name of "engine32", and the file description typically follows the naming pattern of "[Game Name] DLL-helper". // Detects Engine32 within the game executables that contain it. - if (pex.ImportTable?.ImportDirectoryTable != null && pex.ImportHintNameTable != null) + if (pex.Model.ImportTable?.ImportDirectoryTable != null && pex.Model.ImportTable?.HintNameTable != null) { - bool importDirectoryTableMatch = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name?.Equals("ENGINE32.DLL", StringComparison.OrdinalIgnoreCase) == true); - bool hintNameTableMatch = pex.ImportHintNameTable.Any(ihne => ihne == "InitEngine"); + bool importDirectoryTableMatch = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name?.Equals("ENGINE32.DLL", StringComparison.OrdinalIgnoreCase) == true); + bool hintNameTableMatch = pex.Model.ImportTable?.HintNameTable.Any(ihne => ihne.Name == "InitEngine") ?? false; // The Hint/Name Table Entry "DeinitEngine" is present in every tested sample, aside from TOCA Race Driver 2 (Redump entries 104593-104596). @@ -38,10 +38,10 @@ namespace BinaryObjectScanner.Protection } // Detects Engine32 within the file "engine32.dll". - if (pex.ExportNameTable != null) + if (pex.Model.ExportTable?.ExportNameTable?.Strings != null) { - bool exportNameTableMatch1 = pex.ExportNameTable.Any(s => s == "engine32.dll"); - bool exportNameTableMatch2 = pex.ExportNameTable.Any(s => s == "DeinitEngine"); + bool exportNameTableMatch1 = pex.Model.ExportTable.ExportNameTable.Strings.Any(s => s == "engine32.dll"); + bool exportNameTableMatch2 = pex.Model.ExportTable.ExportNameTable.Strings.Any(s => s == "DeinitEngine"); if (exportNameTableMatch1 && exportNameTableMatch2) return "Engine32"; diff --git a/BinaryObjectScanner.Protection/GFWL.cs b/BinaryObjectScanner.Protection/GFWL.cs index a20ce42b..1e104f91 100644 --- a/BinaryObjectScanner.Protection/GFWL.cs +++ b/BinaryObjectScanner.Protection/GFWL.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -25,9 +25,9 @@ namespace BurnOutSharp.ProtectionType return $"Games for Windows LIVE {pex.GetInternalVersion()}"; // Get the import directory table - if (pex.ImportTable?.ImportDirectoryTable != null) + if (pex.Model.ImportTable?.ImportDirectoryTable != null) { - bool match = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "xlive.dll"); + bool match = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "xlive.dll"); if (match) return "Games for Windows LIVE"; } diff --git a/BinaryObjectScanner.Protection/Gefest.cs b/BinaryObjectScanner.Protection/Gefest.cs index 50be8be7..ff60ba51 100644 --- a/BinaryObjectScanner.Protection/Gefest.cs +++ b/BinaryObjectScanner.Protection/Gefest.cs @@ -23,7 +23,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/HexaLock.cs b/BinaryObjectScanner.Protection/HexaLock.cs index 4d102b65..f455f726 100644 --- a/BinaryObjectScanner.Protection/HexaLock.cs +++ b/BinaryObjectScanner.Protection/HexaLock.cs @@ -36,7 +36,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ImpulseReactor.cs b/BinaryObjectScanner.Protection/ImpulseReactor.cs index d070a8dd..95e8b418 100644 --- a/BinaryObjectScanner.Protection/ImpulseReactor.cs +++ b/BinaryObjectScanner.Protection/ImpulseReactor.cs @@ -16,7 +16,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -33,7 +33,7 @@ namespace BinaryObjectScanner.Protection return $"Stardock Product Activation {pex.GetInternalVersion()}"; // TODO: Check for CVP* instead? - bool containsCheck = pex.ExportNameTable?.Any(s => s?.StartsWith("CVPInitializeClient") ?? false) ?? false; + bool containsCheck = pex.Model.ExportTable?.ExportNameTable?.Strings?.Any(s => s?.StartsWith("CVPInitializeClient") ?? false) ?? false; bool containsCheck2 = false; // Get the .rdata section strings, if they exist diff --git a/BinaryObjectScanner.Protection/Intenium.cs b/BinaryObjectScanner.Protection/Intenium.cs index bb819470..5ae660cc 100644 --- a/BinaryObjectScanner.Protection/Intenium.cs +++ b/BinaryObjectScanner.Protection/Intenium.cs @@ -26,7 +26,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/JoWood.cs b/BinaryObjectScanner.Protection/JoWood.cs index ae6df73e..1f24aa54 100644 --- a/BinaryObjectScanner.Protection/JoWood.cs +++ b/BinaryObjectScanner.Protection/JoWood.cs @@ -16,15 +16,15 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // Get the .ext section, if it exists if (pex.ContainsSection(".ext ", exact: true)) { - bool importTableMatches = (pex.ImportTable?.ImportDirectoryTable?.Any(idte => idte.Name == "kernel32.dll") ?? false) - && (pex.ImportHintNameTable?.Any(s => s == "VirtualProtect") ?? false); + bool importTableMatches = (pex.Model.ImportTable?.ImportDirectoryTable?.Any(idte => idte.Name == "kernel32.dll") ?? false) + && (pex.Model.ImportTable?.HintNameTable?.Any(s => s.Name == "VirtualProtect") ?? false); // Get the .dcrtext section, if it exists if (pex.ContainsSection(".dcrtext") && importTableMatches) diff --git a/BinaryObjectScanner.Protection/LabelGate.cs b/BinaryObjectScanner.Protection/LabelGate.cs index 0ebccaff..b0da5c7a 100644 --- a/BinaryObjectScanner.Protection/LabelGate.cs +++ b/BinaryObjectScanner.Protection/LabelGate.cs @@ -23,7 +23,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/LaserLok.cs b/BinaryObjectScanner.Protection/LaserLok.cs index 4c55b6df..a55ab0f4 100644 --- a/BinaryObjectScanner.Protection/LaserLok.cs +++ b/BinaryObjectScanner.Protection/LaserLok.cs @@ -49,7 +49,7 @@ namespace BinaryObjectScanner.Protection // }, "LaserLok 5"), // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -63,14 +63,14 @@ namespace BinaryObjectScanner.Protection 0x6C, 0x61, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x73, 0x2E, 0x50, 0x45 }; - int endDosStub = (int)pex.Stub_NewExeHeaderAddr; + int endDosStub = (int)(pex.Model.Stub?.Header?.NewExeHeaderAddr ?? 0); bool containsCheck = pex.StubExecutableData.FirstPosition(check, out int position); // Check the executable tables - bool containsCheck2 = (pex.ImportTable?.HintNameTable.Any(hnte => hnte.Name == "GetModuleHandleA") ?? false) - && (pex.ImportTable?.HintNameTable.Any(hnte => hnte.Name == "GetProcAddress") ?? false) - && (pex.ImportTable?.HintNameTable.Any(hnte => hnte.Name == "LoadLibraryA") ?? false) - && (pex.ImportTable?.ImportDirectoryTable.Any(idte => idte.Name == "KERNEL32.dll") ?? false); + bool containsCheck2 = (pex.Model.ImportTable?.HintNameTable.Any(hnte => hnte.Name == "GetModuleHandleA") ?? false) + && (pex.Model.ImportTable?.HintNameTable.Any(hnte => hnte.Name == "GetProcAddress") ?? false) + && (pex.Model.ImportTable?.HintNameTable.Any(hnte => hnte.Name == "LoadLibraryA") ?? false) + && (pex.Model.ImportTable?.ImportDirectoryTable.Any(idte => idte.Name == "KERNEL32.dll") ?? false); int position2 = -1; diff --git a/BinaryObjectScanner.Protection/MGIRegistration.cs b/BinaryObjectScanner.Protection/MGIRegistration.cs index d5bcea65..87dcdeca 100644 --- a/BinaryObjectScanner.Protection/MGIRegistration.cs +++ b/BinaryObjectScanner.Protection/MGIRegistration.cs @@ -11,7 +11,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Macrovision.CDilla.cs b/BinaryObjectScanner.Protection/Macrovision.CDilla.cs index a954e882..350c5841 100644 --- a/BinaryObjectScanner.Protection/Macrovision.CDilla.cs +++ b/BinaryObjectScanner.Protection/Macrovision.CDilla.cs @@ -68,7 +68,7 @@ namespace BinaryObjectScanner.Protection internal string CDillaCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Macrovision.CactusDataShield.cs b/BinaryObjectScanner.Protection/Macrovision.CactusDataShield.cs index 031f6b1e..a076f836 100644 --- a/BinaryObjectScanner.Protection/Macrovision.CactusDataShield.cs +++ b/BinaryObjectScanner.Protection/Macrovision.CactusDataShield.cs @@ -34,7 +34,7 @@ namespace BinaryObjectScanner.Protection internal string CactusDataShieldCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Macrovision.FLEXnet.cs b/BinaryObjectScanner.Protection/Macrovision.FLEXnet.cs index 47d27d28..318f7609 100644 --- a/BinaryObjectScanner.Protection/Macrovision.FLEXnet.cs +++ b/BinaryObjectScanner.Protection/Macrovision.FLEXnet.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Protection internal string FLEXnetCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Macrovision.RipGuard.cs b/BinaryObjectScanner.Protection/Macrovision.RipGuard.cs index 1596ce17..4914b8e4 100644 --- a/BinaryObjectScanner.Protection/Macrovision.RipGuard.cs +++ b/BinaryObjectScanner.Protection/Macrovision.RipGuard.cs @@ -22,7 +22,7 @@ namespace BinaryObjectScanner.Protection internal string RipGuardCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Macrovision.SafeCast.cs b/BinaryObjectScanner.Protection/Macrovision.SafeCast.cs index ee81947f..161b9648 100644 --- a/BinaryObjectScanner.Protection/Macrovision.SafeCast.cs +++ b/BinaryObjectScanner.Protection/Macrovision.SafeCast.cs @@ -45,7 +45,7 @@ namespace BinaryObjectScanner.Protection return null; // Check for the CDAC01AA name string. - bool cdac01aaNameFound = nex.ResidentNameTable.Where(rnte => rnte?.NameString != null) + bool cdac01aaNameFound = nex.Model.ResidentNameTable.Where(rnte => rnte?.NameString != null) .Select(rnte => Encoding.ASCII.GetString(rnte.NameString)) .Any(s => s.Contains("CDAC01AA")); @@ -71,7 +71,7 @@ namespace BinaryObjectScanner.Protection internal string SafeCastCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -79,9 +79,9 @@ namespace BinaryObjectScanner.Protection // TODO: Investigate string table entries: "CDWP02DG", "CDWP02DG", "CDWS02DG" // Get the import directory table, if it exists - if (pex.ImportTable?.ImportDirectoryTable != null) + if (pex.Model.ImportTable?.ImportDirectoryTable != null) { - if (pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name?.Equals("CdaC14BA.dll", StringComparison.OrdinalIgnoreCase) == true)) + if (pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name?.Equals("CdaC14BA.dll", StringComparison.OrdinalIgnoreCase) == true)) return "SafeCast"; } diff --git a/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs b/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs index 49c8256d..cd52ff6e 100644 --- a/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs +++ b/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs @@ -45,17 +45,17 @@ namespace BinaryObjectScanner.Protection internal string SafeDiscCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; // Found in Redump entry 57986. - bool hintNameTableMatch = pex.ImportHintNameTable?.Any(ihne => ihne == "LTDLL_Authenticate") ?? false; + bool hintNameTableMatch = pex.Model.ImportTable?.HintNameTable?.Any(ihne => ihne.Name == "LTDLL_Authenticate") ?? false; if (hintNameTableMatch) return "SafeDisc Lite"; // Found in Redump entry 57986. - bool importTableMatch = (pex.ImportTable?.ImportDirectoryTable?.Any(idte => idte.Name == "ltdll.dll") ?? false); + bool importTableMatch = (pex.Model.ImportTable?.ImportDirectoryTable?.Any(idte => idte.Name == "ltdll.dll") ?? false); if (importTableMatch) return "SafeDisc Lite"; diff --git a/BinaryObjectScanner.Protection/Macrovision.cs b/BinaryObjectScanner.Protection/Macrovision.cs index c4e913b7..40d28a68 100644 --- a/BinaryObjectScanner.Protection/Macrovision.cs +++ b/BinaryObjectScanner.Protection/Macrovision.cs @@ -49,7 +49,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/MediaCloQ.cs b/BinaryObjectScanner.Protection/MediaCloQ.cs index e64278e6..25cef360 100644 --- a/BinaryObjectScanner.Protection/MediaCloQ.cs +++ b/BinaryObjectScanner.Protection/MediaCloQ.cs @@ -19,7 +19,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/MediaMaxCD3.cs b/BinaryObjectScanner.Protection/MediaMaxCD3.cs index 849c4d2b..24166862 100644 --- a/BinaryObjectScanner.Protection/MediaMaxCD3.cs +++ b/BinaryObjectScanner.Protection/MediaMaxCD3.cs @@ -20,7 +20,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -53,9 +53,9 @@ namespace BinaryObjectScanner.Protection } // Get the export name table - if (pex.ExportNameTable != null) + if (pex.Model.ExportTable?.ExportNameTable?.Strings != null) { - if (pex.ExportNameTable.Any(s => s == "DllInstallSbcp")) + if (pex.Model.ExportTable.ExportNameTable.Strings.Any(s => s == "DllInstallSbcp")) return "MediaMax CD-3"; } diff --git a/BinaryObjectScanner.Protection/NEACProtect.cs b/BinaryObjectScanner.Protection/NEACProtect.cs index c3430773..ef388045 100644 --- a/BinaryObjectScanner.Protection/NEACProtect.cs +++ b/BinaryObjectScanner.Protection/NEACProtect.cs @@ -26,7 +26,7 @@ namespace BinaryObjectScanner.Protection { // Most of the relevant executables are highly obfuscated, making executable detection mostly impractical. // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/OnlineRegistration.cs b/BinaryObjectScanner.Protection/OnlineRegistration.cs index 510585da..314f13e1 100644 --- a/BinaryObjectScanner.Protection/OnlineRegistration.cs +++ b/BinaryObjectScanner.Protection/OnlineRegistration.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/OpenMG.cs b/BinaryObjectScanner.Protection/OpenMG.cs index 57b0f8d8..2b78554f 100644 --- a/BinaryObjectScanner.Protection/OpenMG.cs +++ b/BinaryObjectScanner.Protection/OpenMG.cs @@ -20,7 +20,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Origin.cs b/BinaryObjectScanner.Protection/Origin.cs index f48989a2..ecf56936 100644 --- a/BinaryObjectScanner.Protection/Origin.cs +++ b/BinaryObjectScanner.Protection/Origin.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/PlayJ.cs b/BinaryObjectScanner.Protection/PlayJ.cs index 2ccbf9c6..e99fe69b 100644 --- a/BinaryObjectScanner.Protection/PlayJ.cs +++ b/BinaryObjectScanner.Protection/PlayJ.cs @@ -17,7 +17,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ProtectDisc.cs b/BinaryObjectScanner.Protection/ProtectDisc.cs index 0504930c..6794cc14 100644 --- a/BinaryObjectScanner.Protection/ProtectDisc.cs +++ b/BinaryObjectScanner.Protection/ProtectDisc.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/RainbowSentinel.cs b/BinaryObjectScanner.Protection/RainbowSentinel.cs index fbd0cf18..3714a139 100644 --- a/BinaryObjectScanner.Protection/RainbowSentinel.cs +++ b/BinaryObjectScanner.Protection/RainbowSentinel.cs @@ -27,7 +27,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/SVKP.cs b/BinaryObjectScanner.Protection/SVKP.cs index 75443d78..258ebe26 100644 --- a/BinaryObjectScanner.Protection/SVKP.cs +++ b/BinaryObjectScanner.Protection/SVKP.cs @@ -27,7 +27,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -77,7 +77,7 @@ namespace BinaryObjectScanner.Protection } // 0x504B5653 is "SVKP" - if (pex.PointerToSymbolTable == 0x504B5653) + if (pex.Model.COFFFileHeader?.PointerToSymbolTable == 0x504B5653) return "SVKP"; // Get the .svkp section, if it exists. diff --git a/BinaryObjectScanner.Protection/SecuROM.cs b/BinaryObjectScanner.Protection/SecuROM.cs index d8e06726..a9de55a7 100644 --- a/BinaryObjectScanner.Protection/SecuROM.cs +++ b/BinaryObjectScanner.Protection/SecuROM.cs @@ -16,7 +16,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/SmartE.cs b/BinaryObjectScanner.Protection/SmartE.cs index 528e7c13..e3b2469b 100644 --- a/BinaryObjectScanner.Protection/SmartE.cs +++ b/BinaryObjectScanner.Protection/SmartE.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/SoftLock.cs b/BinaryObjectScanner.Protection/SoftLock.cs index 0bf72fcf..9a1fdaa8 100644 --- a/BinaryObjectScanner.Protection/SoftLock.cs +++ b/BinaryObjectScanner.Protection/SoftLock.cs @@ -18,7 +18,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/SolidShield.cs b/BinaryObjectScanner.Protection/SolidShield.cs index 5034a290..9a7b866a 100644 --- a/BinaryObjectScanner.Protection/SolidShield.cs +++ b/BinaryObjectScanner.Protection/SolidShield.cs @@ -18,7 +18,7 @@ namespace BurnOutSharp.ProtectionType // TODO: Investigate ".pseudo" section found in "tvdm.dll" in Redump entry 68166. // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -86,17 +86,17 @@ namespace BurnOutSharp.ProtectionType } // Get the import directory table, if it exists - if (pex.ImportTable?.ImportDirectoryTable != null) + if (pex.Model.ImportTable?.ImportDirectoryTable != null) { - bool match = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "dvm.dll"); + bool match = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "dvm.dll"); if (match) return "SolidShield EXE Wrapper v1"; - match = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "activation.x86.dll"); + match = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "activation.x86.dll"); if (match) return "SolidShield EXE Wrapper v2"; - match = pex.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "activation.x64.dll"); + match = pex.Model.ImportTable.ImportDirectoryTable.Any(idte => idte.Name == "activation.x64.dll"); if (match) return "SolidShield EXE Wrapper v2"; } diff --git a/BinaryObjectScanner.Protection/StarForce.cs b/BinaryObjectScanner.Protection/StarForce.cs index 86122cdf..6d625c34 100644 --- a/BinaryObjectScanner.Protection/StarForce.cs +++ b/BinaryObjectScanner.Protection/StarForce.cs @@ -21,7 +21,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; @@ -52,10 +52,10 @@ namespace BinaryObjectScanner.Protection // return $"StarForce {Tools.Utilities.GetInternalVersion(pex)}"; // Check the export name table - if (pex.ExportNameTable != null) + if (pex.Model.ExportTable?.ExportNameTable?.Strings != null) { // TODO: Should we just check for "PSA_*" instead of a single entry? - if (pex.ExportNameTable.Any(s => s == "PSA_GetDiscLabel")) + if (pex.Model.ExportTable.ExportNameTable.Strings.Any(s => s == "PSA_GetDiscLabel")) return $"StarForce {pex.GetInternalVersion()}"; } diff --git a/BinaryObjectScanner.Protection/Steam.cs b/BinaryObjectScanner.Protection/Steam.cs index 1c15b66e..3e90ea2d 100644 --- a/BinaryObjectScanner.Protection/Steam.cs +++ b/BinaryObjectScanner.Protection/Steam.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Sysiphus.cs b/BinaryObjectScanner.Protection/Sysiphus.cs index ed7c319e..61bc0ed1 100644 --- a/BinaryObjectScanner.Protection/Sysiphus.cs +++ b/BinaryObjectScanner.Protection/Sysiphus.cs @@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Tages.cs b/BinaryObjectScanner.Protection/Tages.cs index 6fee460d..83b31aa6 100644 --- a/BinaryObjectScanner.Protection/Tages.cs +++ b/BinaryObjectScanner.Protection/Tages.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Themida.cs b/BinaryObjectScanner.Protection/Themida.cs index 4717d68e..7bded37d 100644 --- a/BinaryObjectScanner.Protection/Themida.cs +++ b/BinaryObjectScanner.Protection/Themida.cs @@ -29,7 +29,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ThreePLock.cs b/BinaryObjectScanner.Protection/ThreePLock.cs index 9ef9080d..b4b79b26 100644 --- a/BinaryObjectScanner.Protection/ThreePLock.cs +++ b/BinaryObjectScanner.Protection/ThreePLock.cs @@ -14,7 +14,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/ThreeTwoOneStudios.cs b/BinaryObjectScanner.Protection/ThreeTwoOneStudios.cs index 0fadb0d9..eeab50e2 100644 --- a/BinaryObjectScanner.Protection/ThreeTwoOneStudios.cs +++ b/BinaryObjectScanner.Protection/ThreeTwoOneStudios.cs @@ -10,7 +10,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/Uplay.cs b/BinaryObjectScanner.Protection/Uplay.cs index 81015b77..c86f3920 100644 --- a/BinaryObjectScanner.Protection/Uplay.cs +++ b/BinaryObjectScanner.Protection/Uplay.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/WMDS.cs b/BinaryObjectScanner.Protection/WMDS.cs index 640f187f..c0ce2ca2 100644 --- a/BinaryObjectScanner.Protection/WMDS.cs +++ b/BinaryObjectScanner.Protection/WMDS.cs @@ -20,7 +20,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/WTMCDProtect.cs b/BinaryObjectScanner.Protection/WTMCDProtect.cs index e1e77248..4298eb46 100644 --- a/BinaryObjectScanner.Protection/WTMCDProtect.cs +++ b/BinaryObjectScanner.Protection/WTMCDProtect.cs @@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/XCP.cs b/BinaryObjectScanner.Protection/XCP.cs index 012e8146..538140ca 100644 --- a/BinaryObjectScanner.Protection/XCP.cs +++ b/BinaryObjectScanner.Protection/XCP.cs @@ -16,7 +16,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Protection/nProtect.cs b/BinaryObjectScanner.Protection/nProtect.cs index 7e7b71ab..fff91989 100644 --- a/BinaryObjectScanner.Protection/nProtect.cs +++ b/BinaryObjectScanner.Protection/nProtect.cs @@ -32,7 +32,7 @@ namespace BinaryObjectScanner.Protection public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible - var sections = pex?.SectionTable; + var sections = pex?.Model.SectionTable; if (sections == null) return null; diff --git a/BinaryObjectScanner.Wrappers/AACSMediaKeyBlock.cs b/BinaryObjectScanner.Wrappers/AACSMediaKeyBlock.cs index 1b623f5b..2acb9377 100644 --- a/BinaryObjectScanner.Wrappers/AACSMediaKeyBlock.cs +++ b/BinaryObjectScanner.Wrappers/AACSMediaKeyBlock.cs @@ -13,21 +13,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Records - - /// -#if NET48 - public Record[] Records => this.Model.Records; -#else - public Record?[]? Records => this.Model.Records; -#endif - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/BDPlusSVM.cs b/BinaryObjectScanner.Wrappers/BDPlusSVM.cs index 3327b9bd..f886e496 100644 --- a/BinaryObjectScanner.Wrappers/BDPlusSVM.cs +++ b/BinaryObjectScanner.Wrappers/BDPlusSVM.cs @@ -13,50 +13,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - /// -#if NET48 - public string Signature => this.Model.Signature; -#else - public string? Signature => this.Model.Signature; -#endif - - /// -#if NET48 - public byte[] Unknown1 => this.Model.Unknown1; -#else - public byte[]? Unknown1 => this.Model.Unknown1; -#endif - - /// - public ushort Year => this.Model.Year; - - /// - public byte Month => this.Model.Month; - - /// - public byte Day => this.Model.Day; - - /// -#if NET48 - public byte[] Unknown2 => this.Model.Unknown2; -#else - public byte[]? Unknown2 => this.Model.Unknown2; -#endif - - /// - public uint Length => this.Model.Length; - - /// -#if NET48 - public byte[] Data => this.Model.Data; -#else - public byte[]? Data => this.Model.Data; -#endif - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/BFPK.cs b/BinaryObjectScanner.Wrappers/BFPK.cs index 62cb703b..996d20b7 100644 --- a/BinaryObjectScanner.Wrappers/BFPK.cs +++ b/BinaryObjectScanner.Wrappers/BFPK.cs @@ -14,46 +14,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Magic => this.Model.Header.Magic; -#else - public string? Magic => this.Model.Header?.Magic; -#endif - - /// -#if NET48 - public int Version => this.Model.Header.Version; -#else - public int? Version => this.Model.Header?.Version; -#endif - - /// -#if NET48 - public int Files => this.Model.Header.Files; -#else - public int? Files => this.Model.Header?.Files; -#endif - - #endregion - - #region Files - - /// -#if NET48 - public SabreTools.Models.BFPK.FileEntry[] FileTable => this.Model.Files; -#else - public SabreTools.Models.BFPK.FileEntry?[]? FileTable => this.Model.Files; -#endif - - #endregion - - #endregion - #region Constructors /// @@ -144,12 +104,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no files - if (FileTable == null || FileTable.Length == 0) + if (this.Model.Files == null || this.Model.Files.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < FileTable.Length; i++) + for (int i = 0; i < this.Model.Files.Length; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -166,15 +126,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractFile(int index, string outputDirectory) { // If we have no files - if (Files == 0 || FileTable == null || FileTable.Length == 0) + if (this.Model.Files == null || this.Model.Files.Length == 0) return false; // If we have an invalid index - if (index < 0 || index >= FileTable.Length) + if (index < 0 || index >= this.Model.Files.Length) return false; // Get the file information - var file = FileTable[index]; + var file = this.Model.Files[index]; if (file == null) return false; diff --git a/BinaryObjectScanner.Wrappers/BSP.cs b/BinaryObjectScanner.Wrappers/BSP.cs index 5b4324af..d57f4b30 100644 --- a/BinaryObjectScanner.Wrappers/BSP.cs +++ b/BinaryObjectScanner.Wrappers/BSP.cs @@ -15,61 +15,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public uint Version => this.Model.Header.Version; -#else - public uint? Version => this.Model.Header?.Version; -#endif - - #endregion - - #region Lumps - - /// -#if NET48 - public SabreTools.Models.BSP.Lump[] Lumps => this.Model.Lumps; -#else - public SabreTools.Models.BSP.Lump?[]? Lumps => this.Model.Lumps; -#endif - - #endregion - - #region Texture Header - - /// -#if NET48 - public uint TextureCount => this.Model.TextureHeader.TextureCount; -#else - public uint? TextureCount => this.Model.TextureHeader?.TextureCount; -#endif - - /// -#if NET48 - public uint[] Offsets => this.Model.TextureHeader.Offsets; -#else - public uint[]? Offsets => this.Model.TextureHeader?.Offsets; -#endif - - #endregion - - #region Textures - - /// -#if NET48 - public SabreTools.Models.BSP.Texture[] Textures => this.Model.Textures; -#else - public SabreTools.Models.BSP.Texture?[]? Textures => this.Model.Textures; -#endif - - #endregion - - #endregion - #region Constructors /// @@ -172,12 +117,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAllLumps(string outputDirectory) { // If we have no lumps - if (Lumps == null || Lumps.Length == 0) + if (this.Model.Lumps == null || this.Model.Lumps.Length == 0) return false; // Loop through and extract all lumps to the output bool allExtracted = true; - for (int i = 0; i < Lumps.Length; i++) + for (int i = 0; i < this.Model.Lumps.Length; i++) { allExtracted &= ExtractLump(i, outputDirectory); } @@ -194,15 +139,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractLump(int index, string outputDirectory) { // If we have no lumps - if (Lumps == null || Lumps.Length == 0) + if (this.Model.Lumps == null || this.Model.Lumps.Length == 0) return false; // If the lumps index is invalid - if (index < 0 || index >= Lumps.Length) + if (index < 0 || index >= this.Model.Lumps.Length) return false; // Get the lump - var lump = Lumps[index]; + var lump = this.Model.Lumps[index]; if (lump == null) return false; @@ -268,12 +213,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAllTextures(string outputDirectory) { // If we have no textures - if (Offsets == null || Offsets.Length == 0) + if (this.Model.TextureHeader?.Offsets == null || this.Model.TextureHeader.Offsets.Length == 0) return false; // Loop through and extract all lumps to the output bool allExtracted = true; - for (int i = 0; i < Offsets.Length; i++) + for (int i = 0; i < this.Model.TextureHeader.Offsets.Length; i++) { allExtracted &= ExtractTexture(i, outputDirectory); } @@ -290,15 +235,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractTexture(int index, string outputDirectory) { // If we have no textures - if (Textures == null || Textures.Length == 0) + if (this.Model.Textures == null || this.Model.Textures.Length == 0) return false; // If the texture index is invalid - if (index < 0 || index >= Textures.Length) + if (index < 0 || index >= this.Model.Textures.Length) return false; // Get the texture - var texture = Textures[index]; + var texture = this.Model.Textures[index]; if (texture == null) return false; diff --git a/BinaryObjectScanner.Wrappers/CFB.cs b/BinaryObjectScanner.Wrappers/CFB.cs index 743a5a6a..698541eb 100644 --- a/BinaryObjectScanner.Wrappers/CFB.cs +++ b/BinaryObjectScanner.Wrappers/CFB.cs @@ -14,202 +14,24 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public ulong Signature => this.Model.Header.Signature; -#else - public ulong? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public Guid CLSID => this.Model.Header.CLSID; -#else - public Guid? CLSID => this.Model.Header?.CLSID; -#endif - - /// -#if NET48 - public ushort MinorVersion => this.Model.Header.MinorVersion; -#else - public ushort? MinorVersion => this.Model.Header?.MinorVersion; -#endif - - /// -#if NET48 - public ushort MajorVersion => this.Model.Header.MajorVersion; -#else - public ushort? MajorVersion => this.Model.Header?.MajorVersion; -#endif - - /// -#if NET48 - public ushort ByteOrder => this.Model.Header.ByteOrder; -#else - public ushort? ByteOrder => this.Model.Header?.ByteOrder; -#endif - - /// -#if NET48 - public ushort SectorShift => this.Model.Header.SectorShift; -#else - public ushort? SectorShift => this.Model.Header?.SectorShift; -#endif - - /// -#if NET48 - public ushort MiniSectorShift => this.Model.Header.MiniSectorShift; -#else - public ushort? MiniSectorShift => this.Model.Header?.MiniSectorShift; -#endif - - /// -#if NET48 - public byte[] Reserved => this.Model.Header.Reserved; -#else - public byte[]? Reserved => this.Model.Header?.Reserved; -#endif - - /// -#if NET48 - public uint NumberOfDirectorySectors => this.Model.Header.NumberOfDirectorySectors; -#else - public uint? NumberOfDirectorySectors => this.Model.Header?.NumberOfDirectorySectors; -#endif - - /// -#if NET48 - public uint NumberOfFATSectors => this.Model.Header.NumberOfFATSectors; -#else - public uint? NumberOfFATSectors => this.Model.Header?.NumberOfFATSectors; -#endif - - /// -#if NET48 - public uint FirstDirectorySectorLocation => this.Model.Header.FirstDirectorySectorLocation; -#else - public uint? FirstDirectorySectorLocation => this.Model.Header?.FirstDirectorySectorLocation; -#endif - - /// -#if NET48 - public uint TransactionSignatureNumber => this.Model.Header.TransactionSignatureNumber; -#else - public uint? TransactionSignatureNumber => this.Model.Header?.TransactionSignatureNumber; -#endif - - /// -#if NET48 - public uint MiniStreamCutoffSize => this.Model.Header.MiniStreamCutoffSize; -#else - public uint? MiniStreamCutoffSize => this.Model.Header?.MiniStreamCutoffSize; -#endif - - /// -#if NET48 - public uint FirstMiniFATSectorLocation => this.Model.Header.FirstMiniFATSectorLocation; -#else - public uint? FirstMiniFATSectorLocation => this.Model.Header?.FirstMiniFATSectorLocation; -#endif - - /// -#if NET48 - public uint NumberOfMiniFATSectors => this.Model.Header.NumberOfMiniFATSectors; -#else - public uint? NumberOfMiniFATSectors => this.Model.Header?.NumberOfMiniFATSectors; -#endif - - /// -#if NET48 - public uint FirstDIFATSectorLocation => this.Model.Header.FirstDIFATSectorLocation; -#else - public uint? FirstDIFATSectorLocation => this.Model.Header?.FirstDIFATSectorLocation; -#endif - - /// -#if NET48 - public uint NumberOfDIFATSectors => this.Model.Header.NumberOfDIFATSectors; -#else - public uint? NumberOfDIFATSectors => this.Model.Header?.NumberOfDIFATSectors; -#endif - - /// -#if NET48 - public SabreTools.Models.CFB.SectorNumber[] DIFAT => this.Model.Header.DIFAT; -#else - public SabreTools.Models.CFB.SectorNumber?[]? DIFAT => this.Model.Header?.DIFAT; -#endif - - #endregion - - #region FAT Sector Numbers - - /// -#if NET48 - public SabreTools.Models.CFB.SectorNumber[] FATSectorNumbers => this.Model.FATSectorNumbers; -#else - public SabreTools.Models.CFB.SectorNumber?[]? FATSectorNumbers => this.Model.FATSectorNumbers; -#endif - - #endregion - - #region Mini FAT Sector Numbers - - /// -#if NET48 - public SabreTools.Models.CFB.SectorNumber[] MiniFATSectorNumbers => this.Model.MiniFATSectorNumbers; -#else - public SabreTools.Models.CFB.SectorNumber?[]? MiniFATSectorNumbers => this.Model.MiniFATSectorNumbers; -#endif - - #endregion - - #region DIFAT Sector Numbers - - /// -#if NET48 - public SabreTools.Models.CFB.SectorNumber[] DIFATSectorNumbers => this.Model.DIFATSectorNumbers; -#else - public SabreTools.Models.CFB.SectorNumber?[]? DIFATSectorNumbers => this.Model.DIFATSectorNumbers; -#endif - - #endregion - - #region Directory Entries - - /// -#if NET48 - public SabreTools.Models.CFB.DirectoryEntry[] DirectoryEntries => this.Model.DirectoryEntries; -#else - public SabreTools.Models.CFB.DirectoryEntry?[]? DirectoryEntries => this.Model.DirectoryEntries; -#endif - - #endregion - - #endregion - #region Extension Properties /// /// Normal sector size in bytes /// #if NET48 - public long SectorSize => (long)Math.Pow(2, SectorShift); + public long SectorSize => (long)Math.Pow(2, this.Model.Header.SectorShift); #else - public long SectorSize => (long)Math.Pow(2, SectorShift ?? 0); + public long SectorSize => (long)Math.Pow(2, this.Model.Header?.SectorShift ?? 0); #endif /// /// Mini sector size in bytes /// #if NET48 - public long MiniSectorSize => (long)Math.Pow(2, MiniSectorShift); + public long MiniSectorSize => (long)Math.Pow(2, this.Model.Header.MiniSectorShift); #else - public long MiniSectorSize => (long)Math.Pow(2, MiniSectorShift ?? 0); + public long MiniSectorSize => (long)Math.Pow(2, this.Model.Header?.MiniSectorShift ?? 0); #endif #endregion @@ -309,9 +131,9 @@ namespace BinaryObjectScanner.Wrappers { // If we have an invalid sector #if NET48 - if (startingSector < 0 || FATSectorNumbers == null || (long)startingSector >= FATSectorNumbers.Length) + if (startingSector < 0 || this.Model.FATSectorNumbers == null || (long)startingSector >= this.Model.FATSectorNumbers.Length) #else - if (startingSector == null || startingSector < 0 || FATSectorNumbers == null || (long)startingSector >= FATSectorNumbers.Length) + if (startingSector == null || startingSector < 0 || this.Model.FATSectorNumbers == null || (long)startingSector >= this.Model.FATSectorNumbers.Length) #endif return null; @@ -332,9 +154,9 @@ namespace BinaryObjectScanner.Wrappers // Get the next sector from the lookup table #if NET48 - var nextSector = FATSectorNumbers[(uint)lastSector]; + var nextSector = this.Model.FATSectorNumbers[(uint)lastSector]; #else - var nextSector = FATSectorNumbers[(uint)lastSector!.Value]; + var nextSector = this.Model.FATSectorNumbers[(uint)lastSector!.Value]; #endif // If we have an end of chain or free sector @@ -426,9 +248,9 @@ namespace BinaryObjectScanner.Wrappers { // If we have an invalid sector #if NET48 - if (startingSector < 0 || MiniFATSectorNumbers == null || (long)startingSector >= MiniFATSectorNumbers.Length) + if (startingSector < 0 || this.Model.MiniFATSectorNumbers == null || (long)startingSector >= this.Model.MiniFATSectorNumbers.Length) #else - if (startingSector == null || startingSector < 0 || MiniFATSectorNumbers == null || (long)startingSector >= MiniFATSectorNumbers.Length) + if (startingSector == null || startingSector < 0 || this.Model.MiniFATSectorNumbers == null || (long)startingSector >= this.Model.MiniFATSectorNumbers.Length) #endif return null; @@ -449,9 +271,9 @@ namespace BinaryObjectScanner.Wrappers // Get the next sector from the lookup table #if NET48 - var nextSector = MiniFATSectorNumbers[(uint)lastSector]; + var nextSector = this.Model.MiniFATSectorNumbers[(uint)lastSector]; #else - var nextSector = MiniFATSectorNumbers[(uint)lastSector!.Value]; + var nextSector = this.Model.MiniFATSectorNumbers[(uint)lastSector!.Value]; #endif // If we have an end of chain or free sector diff --git a/BinaryObjectScanner.Wrappers/CIA.cs b/BinaryObjectScanner.Wrappers/CIA.cs index c95071b5..5604c818 100644 --- a/BinaryObjectScanner.Wrappers/CIA.cs +++ b/BinaryObjectScanner.Wrappers/CIA.cs @@ -12,541 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public uint HeaderSize => this.Model.Header.HeaderSize; -#else - public uint? HeaderSize => this.Model.Header?.HeaderSize; -#endif - - /// -#if NET48 - public ushort Type => this.Model.Header.Type; -#else - public ushort? Type => this.Model.Header?.Type; -#endif - - /// -#if NET48 - public ushort Version => this.Model.Header.Version; -#else - public ushort? Version => this.Model.Header?.Version; -#endif - - /// -#if NET48 - public uint CertificateChainSize => this.Model.Header.CertificateChainSize; -#else - public uint? CertificateChainSize => this.Model.Header?.CertificateChainSize; -#endif - - /// -#if NET48 - public uint TicketSize => this.Model.Header.TicketSize; -#else - public uint? TicketSize => this.Model.Header?.TicketSize; -#endif - - /// -#if NET48 - public uint TMDFileSize => this.Model.Header.TMDFileSize; -#else - public uint? TMDFileSize => this.Model.Header?.TMDFileSize; -#endif - - /// -#if NET48 - public uint MetaSize => this.Model.Header.MetaSize; -#else - public uint? MetaSize => this.Model.Header?.MetaSize; -#endif - - /// -#if NET48 - public ulong ContentSize => this.Model.Header.ContentSize; -#else - public ulong? ContentSize => this.Model.Header?.ContentSize; -#endif - - /// -#if NET48 - public byte[] ContentIndex => this.Model.Header.ContentIndex; -#else - public byte[]? ContentIndex => this.Model.Header?.ContentIndex; -#endif - - #endregion - - #region Certificate Chain - - /// -#if NET48 - public SabreTools.Models.N3DS.Certificate[] CertificateChain => this.Model.CertificateChain; -#else - public SabreTools.Models.N3DS.Certificate?[]? CertificateChain => this.Model.CertificateChain; -#endif - - #endregion - - #region Ticket - - /// -#if NET48 - public SabreTools.Models.N3DS.SignatureType T_SignatureType => this.Model.Ticket.SignatureType; -#else - public SabreTools.Models.N3DS.SignatureType? T_SignatureType => this.Model.Ticket?.SignatureType; -#endif - - /// -#if NET48 - public ushort T_SignatureSize => this.Model.Ticket.SignatureSize; -#else - public ushort? T_SignatureSize => this.Model.Ticket?.SignatureSize; -#endif - - /// -#if NET48 - public byte T_PaddingSize => this.Model.Ticket.PaddingSize; -#else - public byte? T_PaddingSize => this.Model.Ticket?.PaddingSize; -#endif - - /// -#if NET48 - public byte[] T_Signature => this.Model.Ticket.Signature; -#else - public byte[]? T_Signature => this.Model.Ticket?.Signature; -#endif - - /// -#if NET48 - public byte[] T_Padding => this.Model.Ticket.Padding; -#else - public byte[]? T_Padding => this.Model.Ticket?.Padding; -#endif - - /// -#if NET48 - public string T_Issuer => this.Model.Ticket.Issuer; -#else - public string? T_Issuer => this.Model.Ticket?.Issuer; -#endif - - /// -#if NET48 - public byte[] T_ECCPublicKey => this.Model.Ticket.ECCPublicKey; -#else - public byte[]? T_ECCPublicKey => this.Model.Ticket?.ECCPublicKey; -#endif - - /// -#if NET48 - public byte T_Version => this.Model.Ticket.Version; -#else - public byte? T_Version => this.Model.Ticket?.Version; -#endif - - /// -#if NET48 - public byte T_CaCrlVersion => this.Model.Ticket.CaCrlVersion; -#else - public byte? T_CaCrlVersion => this.Model.Ticket?.CaCrlVersion; -#endif - - /// -#if NET48 - public byte T_SignerCrlVersion => this.Model.Ticket.SignerCrlVersion; -#else - public byte? T_SignerCrlVersion => this.Model.Ticket?.SignerCrlVersion; -#endif - - /// -#if NET48 - public byte[] T_TitleKey => this.Model.Ticket.TitleKey; -#else - public byte[]? T_TitleKey => this.Model.Ticket?.TitleKey; -#endif - - /// -#if NET48 - public byte T_Reserved1 => this.Model.Ticket.Reserved1; -#else - public byte? T_Reserved1 => this.Model.Ticket?.Reserved1; -#endif - - /// -#if NET48 - public ulong T_TicketID => this.Model.Ticket.TicketID; -#else - public ulong? T_TicketID => this.Model.Ticket?.TicketID; -#endif - - /// -#if NET48 - public uint T_ConsoleID => this.Model.Ticket.ConsoleID; -#else - public uint? T_ConsoleID => this.Model.Ticket?.ConsoleID; -#endif - - /// -#if NET48 - public ulong T_TitleID => this.Model.Ticket.TitleID; -#else - public ulong? T_TitleID => this.Model.Ticket?.TitleID; -#endif - - /// -#if NET48 - public byte[] T_Reserved2 => this.Model.Ticket.Reserved2; -#else - public byte[]? T_Reserved2 => this.Model.Ticket?.Reserved2; -#endif - - /// -#if NET48 - public ushort T_TicketTitleVersion => this.Model.Ticket.TicketTitleVersion; -#else - public ushort? T_TicketTitleVersion => this.Model.Ticket?.TicketTitleVersion; -#endif - - /// -#if NET48 - public byte[] T_Reserved3 => this.Model.Ticket.Reserved3; -#else - public byte[]? T_Reserved3 => this.Model.Ticket?.Reserved3; -#endif - - /// -#if NET48 - public byte T_LicenseType => this.Model.Ticket.LicenseType; -#else - public byte? T_LicenseType => this.Model.Ticket?.LicenseType; -#endif - - /// -#if NET48 - public byte T_CommonKeyYIndex => this.Model.Ticket.CommonKeyYIndex; -#else - public byte? T_CommonKeyYIndex => this.Model.Ticket?.CommonKeyYIndex; -#endif - - /// -#if NET48 - public byte[] T_Reserved4 => this.Model.Ticket.Reserved4; -#else - public byte[]? T_Reserved4 => this.Model.Ticket?.Reserved4; -#endif - - /// -#if NET48 - public uint T_eShopAccountID => this.Model.Ticket.eShopAccountID; -#else - public uint? T_eShopAccountID => this.Model.Ticket?.eShopAccountID; -#endif - - /// -#if NET48 - public byte T_Reserved5 => this.Model.Ticket.Reserved5; -#else - public byte? T_Reserved5 => this.Model.Ticket?.Reserved5; -#endif - - /// -#if NET48 - public byte T_Audit => this.Model.Ticket.Audit; -#else - public byte? T_Audit => this.Model.Ticket?.Audit; -#endif - - /// -#if NET48 - public byte[] T_Reserved6 => this.Model.Ticket.Reserved6; -#else - public byte[]? T_Reserved6 => this.Model.Ticket?.Reserved6; -#endif - - /// -#if NET48 - public uint[] T_Limits => this.Model.Ticket.Limits; -#else - public uint[]? T_Limits => this.Model.Ticket?.Limits; -#endif - - /// -#if NET48 - public uint T_ContentIndexSize => this.Model.Ticket.ContentIndexSize; -#else - public uint? T_ContentIndexSize => this.Model.Ticket?.ContentIndexSize; -#endif - - /// -#if NET48 - public byte[] T_ContentIndex => this.Model.Ticket.ContentIndex; -#else - public byte[]? T_ContentIndex => this.Model.Ticket?.ContentIndex; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.Certificate[] T_CertificateChain => this.Model.Ticket.CertificateChain; -#else - public SabreTools.Models.N3DS.Certificate?[]? T_CertificateChain => this.Model.Ticket?.CertificateChain; -#endif - - #endregion - - #region Title Metadata - - /// -#if NET48 - public SabreTools.Models.N3DS.SignatureType TMD_SignatureType => this.Model.TMDFileData.SignatureType; -#else - public SabreTools.Models.N3DS.SignatureType? TMD_SignatureType => this.Model.TMDFileData?.SignatureType; -#endif - - /// -#if NET48 - public ushort TMD_SignatureSize => this.Model.TMDFileData.SignatureSize; -#else - public ushort? TMD_SignatureSize => this.Model.TMDFileData?.SignatureSize; -#endif - - /// -#if NET48 - public byte TMD_PaddingSize => this.Model.TMDFileData.PaddingSize; -#else - public byte? TMD_PaddingSize => this.Model.TMDFileData?.PaddingSize; -#endif - - /// -#if NET48 - public byte[] TMD_Signature => this.Model.TMDFileData.Signature; -#else - public byte[]? TMD_Signature => this.Model.TMDFileData?.Signature; -#endif - - /// -#if NET48 - public byte[] TMD_Padding1 => this.Model.TMDFileData.Padding1; -#else - public byte[]? TMD_Padding1 => this.Model.TMDFileData?.Padding1; -#endif - - /// -#if NET48 - public string TMD_Issuer => this.Model.TMDFileData.Issuer; -#else - public string? TMD_Issuer => this.Model.TMDFileData?.Issuer; -#endif - - /// -#if NET48 - public byte TMD_Version => this.Model.TMDFileData.Version; -#else - public byte? TMD_Version => this.Model.TMDFileData?.Version; -#endif - - /// -#if NET48 - public byte TMD_CaCrlVersion => this.Model.TMDFileData.CaCrlVersion; -#else - public byte? TMD_CaCrlVersion => this.Model.TMDFileData?.CaCrlVersion; -#endif - - /// -#if NET48 - public byte TMD_SignerCrlVersion => this.Model.TMDFileData.SignerCrlVersion; -#else - public byte? TMD_SignerCrlVersion => this.Model.TMDFileData?.SignerCrlVersion; -#endif - - /// -#if NET48 - public byte TMD_Reserved1 => this.Model.TMDFileData.Reserved1; -#else - public byte? TMD_Reserved1 => this.Model.TMDFileData?.Reserved1; -#endif - - /// -#if NET48 - public ulong TMD_SystemVersion => this.Model.TMDFileData.SystemVersion; -#else - public ulong? TMD_SystemVersion => this.Model.TMDFileData?.SystemVersion; -#endif - - /// -#if NET48 - public ulong TMD_TitleID => this.Model.TMDFileData.TitleID; -#else - public ulong? TMD_TitleID => this.Model.TMDFileData?.TitleID; -#endif - - /// -#if NET48 - public uint TMD_TitleType => this.Model.TMDFileData.TitleType; -#else - public uint? TMD_TitleType => this.Model.TMDFileData?.TitleType; -#endif - - /// -#if NET48 - public ushort TMD_GroupID => this.Model.TMDFileData.GroupID; -#else - public ushort? TMD_GroupID => this.Model.TMDFileData?.GroupID; -#endif - - /// -#if NET48 - public uint TMD_SaveDataSize => this.Model.TMDFileData.SaveDataSize; -#else - public uint? TMD_SaveDataSize => this.Model.TMDFileData?.SaveDataSize; -#endif - - /// -#if NET48 - public uint TMD_SRLPrivateSaveDataSize => this.Model.TMDFileData.SRLPrivateSaveDataSize; -#else - public uint? TMD_SRLPrivateSaveDataSize => this.Model.TMDFileData?.SRLPrivateSaveDataSize; -#endif - - /// -#if NET48 - public byte[] TMD_Reserved2 => this.Model.TMDFileData.Reserved2; -#else - public byte[]? TMD_Reserved2 => this.Model.TMDFileData?.Reserved2; -#endif - - /// -#if NET48 - public byte TMD_SRLFlag => this.Model.TMDFileData.SRLFlag; -#else - public byte? TMD_SRLFlag => this.Model.TMDFileData?.SRLFlag; -#endif - - /// -#if NET48 - public byte[] TMD_Reserved3 => this.Model.TMDFileData.Reserved3; -#else - public byte[]? TMD_Reserved3 => this.Model.TMDFileData?.Reserved3; -#endif - - /// -#if NET48 - public uint TMD_AccessRights => this.Model.TMDFileData.AccessRights; -#else - public uint? TMD_AccessRights => this.Model.TMDFileData?.AccessRights; -#endif - - /// -#if NET48 - public ushort TMD_TitleVersion => this.Model.TMDFileData.TitleVersion; -#else - public ushort? TMD_TitleVersion => this.Model.TMDFileData?.TitleVersion; -#endif - - /// -#if NET48 - public ushort TMD_ContentCount => this.Model.TMDFileData.ContentCount; -#else - public ushort? TMD_ContentCount => this.Model.TMDFileData?.ContentCount; -#endif - - /// -#if NET48 - public ushort TMD_BootContent => this.Model.TMDFileData.BootContent; -#else - public ushort? TMD_BootContent => this.Model.TMDFileData?.BootContent; -#endif - - /// -#if NET48 - public byte[] TMD_Padding2 => this.Model.TMDFileData.Padding2; -#else - public byte[]? TMD_Padding2 => this.Model.TMDFileData?.Padding2; -#endif - - /// -#if NET48 - public byte[] TMD_SHA256HashContentInfoRecords => this.Model.TMDFileData.SHA256HashContentInfoRecords; -#else - public byte[]? TMD_SHA256HashContentInfoRecords => this.Model.TMDFileData?.SHA256HashContentInfoRecords; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.ContentInfoRecord[] TMD_ContentInfoRecords => this.Model.TMDFileData.ContentInfoRecords; -#else - public SabreTools.Models.N3DS.ContentInfoRecord?[]? TMD_ContentInfoRecords => this.Model.TMDFileData?.ContentInfoRecords; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.ContentChunkRecord[] TMD_ContentChunkRecords => this.Model.TMDFileData.ContentChunkRecords; -#else - public SabreTools.Models.N3DS.ContentChunkRecord?[]? TMD_ContentChunkRecords => this.Model.TMDFileData?.ContentChunkRecords; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.Certificate[] TMD_CertificateChain => this.Model.TMDFileData.CertificateChain; -#else - public SabreTools.Models.N3DS.Certificate?[]? TMD_CertificateChain => this.Model.TMDFileData?.CertificateChain; -#endif - - #endregion - - #region Partitions - - /// -#if NET48 - public SabreTools.Models.N3DS.NCCHHeader[] Partitions => this.Model.Partitions; -#else - public SabreTools.Models.N3DS.NCCHHeader?[]? Partitions => this.Model.Partitions; -#endif - - #endregion - - #region Meta Data - - /// -#if NET48 - public byte[] MD_TitleIDDependencyList => this.Model.MetaData?.TitleIDDependencyList; -#else - public byte[]? MD_TitleIDDependencyList => this.Model.MetaData?.TitleIDDependencyList; -#endif - - /// -#if NET48 - public byte[] MD_Reserved1 => this.Model.MetaData?.Reserved1; -#else - public byte[]? MD_Reserved1 => this.Model.MetaData?.Reserved1; -#endif - - /// - public uint? MD_CoreVersion => this.Model.MetaData?.CoreVersion; - - /// -#if NET48 - public byte[] MD_Reserved2 => this.Model.MetaData?.Reserved2; -#else - public byte[]? MD_Reserved2 => this.Model.MetaData?.Reserved2; -#endif - - /// -#if NET48 - public byte[] MD_IconData => this.Model.MetaData?.IconData; -#else - public byte[]? MD_IconData => this.Model.MetaData?.IconData; -#endif - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/GCF.cs b/BinaryObjectScanner.Wrappers/GCF.cs index 8c848f4b..d4caaa95 100644 --- a/BinaryObjectScanner.Wrappers/GCF.cs +++ b/BinaryObjectScanner.Wrappers/GCF.cs @@ -14,542 +14,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public uint Dummy0 => this.Model.Header.Dummy0; -#else - public uint? Dummy0 => this.Model.Header?.Dummy0; -#endif - - /// -#if NET48 - public uint MajorVersion => this.Model.Header.MajorVersion; -#else - public uint? MajorVersion => this.Model.Header?.MajorVersion; -#endif - - /// -#if NET48 - public uint MinorVersion => this.Model.Header.MinorVersion; -#else - public uint? MinorVersion => this.Model.Header?.MinorVersion; -#endif - - /// -#if NET48 - public uint CacheID => this.Model.Header.CacheID; -#else - public uint? CacheID => this.Model.Header?.CacheID; -#endif - - /// -#if NET48 - public uint LastVersionPlayed => this.Model.Header.LastVersionPlayed; -#else - public uint? LastVersionPlayed => this.Model.Header?.LastVersionPlayed; -#endif - - /// -#if NET48 - public uint Dummy1 => this.Model.Header.Dummy1; -#else - public uint? Dummy1 => this.Model.Header?.Dummy1; -#endif - - /// -#if NET48 - public uint Dummy2 => this.Model.Header.Dummy2; -#else - public uint? Dummy2 => this.Model.Header?.Dummy2; -#endif - - /// -#if NET48 - public uint FileSize => this.Model.Header.FileSize; -#else - public uint? FileSize => this.Model.Header?.FileSize; -#endif - - /// -#if NET48 - public uint BlockSize => this.Model.Header.BlockSize; -#else - public uint? BlockSize => this.Model.Header?.BlockSize; -#endif - - /// -#if NET48 - public uint BlockCount => this.Model.Header.BlockCount; -#else - public uint? BlockCount => this.Model.Header?.BlockCount; -#endif - - /// -#if NET48 - public uint Dummy3 => this.Model.Header.Dummy3; -#else - public uint? Dummy3 => this.Model.Header?.Dummy3; -#endif - - #endregion - - #region Block Entry Header - - /// -#if NET48 - public uint BEH_BlockCount => this.Model.BlockEntryHeader.BlockCount; -#else - public uint? BEH_BlockCount => this.Model.BlockEntryHeader?.BlockCount; -#endif - - /// -#if NET48 - public uint BEH_BlocksUsed => this.Model.BlockEntryHeader.BlocksUsed; -#else - public uint? BEH_BlocksUsed => this.Model.BlockEntryHeader?.BlocksUsed; -#endif - - /// -#if NET48 - public uint BEH_Dummy0 => this.Model.BlockEntryHeader.Dummy0; -#else - public uint? BEH_Dummy0 => this.Model.BlockEntryHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint BEH_Dummy1 => this.Model.BlockEntryHeader.Dummy1; -#else - public uint? BEH_Dummy1 => this.Model.BlockEntryHeader?.Dummy1; -#endif - - /// -#if NET48 - public uint BEH_Dummy2 => this.Model.BlockEntryHeader.Dummy2; -#else - public uint? BEH_Dummy2 => this.Model.BlockEntryHeader?.Dummy2; -#endif - - /// -#if NET48 - public uint BEH_Dummy3 => this.Model.BlockEntryHeader.Dummy3; -#else - public uint? BEH_Dummy3 => this.Model.BlockEntryHeader?.Dummy3; -#endif - - /// -#if NET48 - public uint BEH_Dummy4 => this.Model.BlockEntryHeader.Dummy4; -#else - public uint? BEH_Dummy4 => this.Model.BlockEntryHeader?.Dummy4; -#endif - - /// -#if NET48 - public uint BEH_Checksum => this.Model.BlockEntryHeader.Checksum; -#else - public uint? BEH_Checksum => this.Model.BlockEntryHeader?.Checksum; -#endif - - #endregion - - #region Block Entries - - /// -#if NET48 - public SabreTools.Models.GCF.BlockEntry[] BlockEntries => this.Model.BlockEntries; -#else - public SabreTools.Models.GCF.BlockEntry?[]? BlockEntries => this.Model.BlockEntries; -#endif - - #endregion - - #region Fragmentation Map Header - - /// -#if NET48 - public uint FMH_BlockCount => this.Model.FragmentationMapHeader.BlockCount; -#else - public uint? FMH_BlockCount => this.Model.FragmentationMapHeader?.BlockCount; -#endif - - /// -#if NET48 - public uint FMH_FirstUnusedEntry => this.Model.FragmentationMapHeader.FirstUnusedEntry; -#else - public uint? FMH_FirstUnusedEntry => this.Model.FragmentationMapHeader?.FirstUnusedEntry; -#endif - - /// -#if NET48 - public uint FMH_Terminator => this.Model.FragmentationMapHeader.Terminator; -#else - public uint? FMH_Terminator => this.Model.FragmentationMapHeader?.Terminator; -#endif - - /// -#if NET48 - public uint FMH_Checksum => this.Model.FragmentationMapHeader.Checksum; -#else - public uint? FMH_Checksum => this.Model.FragmentationMapHeader?.Checksum; -#endif - - #endregion - - #region Fragmentation Maps - - /// -#if NET48 - public SabreTools.Models.GCF.FragmentationMap[] FragmentationMaps => this.Model.FragmentationMaps; -#else - public SabreTools.Models.GCF.FragmentationMap?[]? FragmentationMaps => this.Model.FragmentationMaps; -#endif - - #endregion - - #region Block Entry Map Header - - /// - public uint? BEMH_BlockCount => this.Model.BlockEntryMapHeader?.BlockCount; - - /// - public uint? BEMH_FirstBlockEntryIndex => this.Model.BlockEntryMapHeader?.FirstBlockEntryIndex; - - /// - public uint? BEMH_LastBlockEntryIndex => this.Model.BlockEntryMapHeader?.LastBlockEntryIndex; - - /// - public uint? BEMH_Dummy0 => this.Model.BlockEntryMapHeader?.Dummy0; - - /// - public uint? BEMH_Checksum => this.Model.BlockEntryMapHeader?.Checksum; - - #endregion - - #region Block Entry Maps - - /// -#if NET48 - public SabreTools.Models.GCF.BlockEntryMap[] BlockEntryMaps => this.Model.BlockEntryMaps; -#else - public SabreTools.Models.GCF.BlockEntryMap?[]? BlockEntryMaps => this.Model.BlockEntryMaps; -#endif - - #endregion - - #region Directory Header - - /// -#if NET48 - public uint DH_Dummy0 => this.Model.DirectoryHeader.Dummy0; -#else - public uint? DH_Dummy0 => this.Model.DirectoryHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint DH_CacheID => this.Model.DirectoryHeader.CacheID; -#else - public uint? DH_CacheID => this.Model.DirectoryHeader?.CacheID; -#endif - - /// -#if NET48 - public uint DH_LastVersionPlayed => this.Model.DirectoryHeader.LastVersionPlayed; -#else - public uint? DH_LastVersionPlayed => this.Model.DirectoryHeader?.LastVersionPlayed; -#endif - - /// -#if NET48 - public uint DH_ItemCount => this.Model.DirectoryHeader.ItemCount; -#else - public uint? DH_ItemCount => this.Model.DirectoryHeader?.ItemCount; -#endif - - /// -#if NET48 - public uint DH_FileCount => this.Model.DirectoryHeader.FileCount; -#else - public uint? DH_FileCount => this.Model.DirectoryHeader?.FileCount; -#endif - - /// -#if NET48 - public uint DH_Dummy1 => this.Model.DirectoryHeader.Dummy1; -#else - public uint? DH_Dummy1 => this.Model.DirectoryHeader?.Dummy1; -#endif - - /// -#if NET48 - public uint DH_DirectorySize => this.Model.DirectoryHeader.DirectorySize; -#else - public uint? DH_DirectorySize => this.Model.DirectoryHeader?.DirectorySize; -#endif - - /// -#if NET48 - public uint DH_NameSize => this.Model.DirectoryHeader.NameSize; -#else - public uint? DH_NameSize => this.Model.DirectoryHeader?.NameSize; -#endif - - /// -#if NET48 - public uint DH_Info1Count => this.Model.DirectoryHeader.Info1Count; -#else - public uint? DH_Info1Count => this.Model.DirectoryHeader?.Info1Count; -#endif - - /// -#if NET48 - public uint DH_CopyCount => this.Model.DirectoryHeader.CopyCount; -#else - public uint? DH_CopyCount => this.Model.DirectoryHeader?.CopyCount; -#endif - - /// -#if NET48 - public uint DH_LocalCount => this.Model.DirectoryHeader.LocalCount; -#else - public uint? DH_LocalCount => this.Model.DirectoryHeader?.LocalCount; -#endif - - /// -#if NET48 - public uint DH_Dummy2 => this.Model.DirectoryHeader.Dummy2; -#else - public uint? DH_Dummy2 => this.Model.DirectoryHeader?.Dummy2; -#endif - - /// -#if NET48 - public uint DH_Dummy3 => this.Model.DirectoryHeader.Dummy3; -#else - public uint? DH_Dummy3 => this.Model.DirectoryHeader?.Dummy3; -#endif - - /// -#if NET48 - public uint DH_Checksum => this.Model.DirectoryHeader.Checksum; -#else - public uint? DH_Checksum => this.Model.DirectoryHeader?.Checksum; -#endif - - #endregion - - #region Directory Entries - - /// -#if NET48 - public SabreTools.Models.GCF.DirectoryEntry[] DirectoryEntries => this.Model.DirectoryEntries; -#else - public SabreTools.Models.GCF.DirectoryEntry?[]? DirectoryEntries => this.Model.DirectoryEntries; -#endif - - #endregion - - #region Directory Names - - /// -#if NET48 - public Dictionary DirectoryNames => this.Model.DirectoryNames; -#else - public Dictionary? DirectoryNames => this.Model.DirectoryNames; -#endif - - #endregion - - #region Directory Info 1 Entries - - /// -#if NET48 - public SabreTools.Models.GCF.DirectoryInfo1Entry[] DirectoryInfo1Entries => this.Model.DirectoryInfo1Entries; -#else - public SabreTools.Models.GCF.DirectoryInfo1Entry?[]? DirectoryInfo1Entries => this.Model.DirectoryInfo1Entries; -#endif - - #endregion - - #region Directory Info 2 Entries - - /// -#if NET48 - public SabreTools.Models.GCF.DirectoryInfo2Entry[] DirectoryInfo2Entries => this.Model.DirectoryInfo2Entries; -#else - public SabreTools.Models.GCF.DirectoryInfo2Entry?[]? DirectoryInfo2Entries => this.Model.DirectoryInfo2Entries; -#endif - - #endregion - - #region Directory Copy Entries - - /// -#if NET48 - public SabreTools.Models.GCF.DirectoryCopyEntry[] DirectoryCopyEntries => this.Model.DirectoryCopyEntries; -#else - public SabreTools.Models.GCF.DirectoryCopyEntry?[]? DirectoryCopyEntries => this.Model.DirectoryCopyEntries; -#endif - - #endregion - - #region Directory Local Entries - - /// -#if NET48 - public SabreTools.Models.GCF.DirectoryLocalEntry[] DirectoryLocalEntries => this.Model.DirectoryLocalEntries; -#else - public SabreTools.Models.GCF.DirectoryLocalEntry?[]? DirectoryLocalEntries => this.Model.DirectoryLocalEntries; -#endif - - #endregion - - #region Directory Map Header - - /// - public uint? DMH_Dummy0 => this.Model.DirectoryMapHeader?.Dummy0; - - /// - public uint? DMH_Dummy1 => this.Model.DirectoryMapHeader?.Dummy1; - - #endregion - - #region Directory Map Entries - - /// -#if NET48 - public SabreTools.Models.GCF.DirectoryMapEntry[] DirectoryMapEntries => this.Model.DirectoryMapEntries; -#else - public SabreTools.Models.GCF.DirectoryMapEntry?[]? DirectoryMapEntries => this.Model.DirectoryMapEntries; -#endif - - #endregion - - #region Checksum Header - - /// -#if NET48 - public uint CH_Dummy0 => this.Model.ChecksumHeader.Dummy0; -#else - public uint? CH_Dummy0 => this.Model.ChecksumHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint CH_ChecksumSize => this.Model.ChecksumHeader.ChecksumSize; -#else - public uint? CH_ChecksumSize => this.Model.ChecksumHeader?.ChecksumSize; -#endif - - #endregion - - #region Checksum Map Header - - /// -#if NET48 - public uint CMH_Dummy0 => this.Model.ChecksumMapHeader.Dummy0; -#else - public uint? CMH_Dummy0 => this.Model.ChecksumMapHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint CMH_Dummy1 => this.Model.ChecksumMapHeader.Dummy1; -#else - public uint? CMH_Dummy1 => this.Model.ChecksumMapHeader?.Dummy1; -#endif - - /// -#if NET48 - public uint CMH_ItemCount => this.Model.ChecksumMapHeader.ItemCount; -#else - public uint? CMH_ItemCount => this.Model.ChecksumMapHeader?.ItemCount; -#endif - - /// -#if NET48 - public uint CMH_ChecksumCount => this.Model.ChecksumMapHeader.ChecksumCount; -#else - public uint? CMH_ChecksumCount => this.Model.ChecksumMapHeader?.ChecksumCount; -#endif - - #endregion - - #region Checksum Map Entries - - /// -#if NET48 - public SabreTools.Models.GCF.ChecksumMapEntry[] ChecksumMapEntries => this.Model.ChecksumMapEntries; -#else - public SabreTools.Models.GCF.ChecksumMapEntry?[]? ChecksumMapEntries => this.Model.ChecksumMapEntries; -#endif - - #endregion - - #region Checksum Entries - - /// -#if NET48 - public SabreTools.Models.GCF.ChecksumEntry[] ChecksumEntries => this.Model.ChecksumEntries; -#else - public SabreTools.Models.GCF.ChecksumEntry?[]? ChecksumEntries => this.Model.ChecksumEntries; -#endif - - #endregion - - #region Data Block Header - - /// -#if NET48 - public uint DBH_LastVersionPlayed => this.Model.DataBlockHeader.LastVersionPlayed; -#else - public uint? DBH_LastVersionPlayed => this.Model.DataBlockHeader?.LastVersionPlayed; -#endif - - /// -#if NET48 - public uint DBH_BlockCount => this.Model.DataBlockHeader.BlockCount; -#else - public uint? DBH_BlockCount => this.Model.DataBlockHeader?.BlockCount; -#endif - - /// -#if NET48 - public uint DBH_BlockSize => this.Model.DataBlockHeader.BlockSize; -#else - public uint? DBH_BlockSize => this.Model.DataBlockHeader?.BlockSize; -#endif - - /// -#if NET48 - public uint DBH_FirstBlockOffset => this.Model.DataBlockHeader.FirstBlockOffset; -#else - public uint? DBH_FirstBlockOffset => this.Model.DataBlockHeader?.FirstBlockOffset; -#endif - - /// -#if NET48 - public uint DBH_BlocksUsed => this.Model.DataBlockHeader.BlocksUsed; -#else - public uint? DBH_BlocksUsed => this.Model.DataBlockHeader?.BlocksUsed; -#endif - - /// -#if NET48 - public uint DBH_Checksum => this.Model.DataBlockHeader.Checksum; -#else - public uint? DBH_Checksum => this.Model.DataBlockHeader?.Checksum; -#endif - - #endregion - - #endregion - #region Extension Properties /// @@ -568,16 +32,16 @@ namespace BinaryObjectScanner.Wrappers return _files; // If we don't have a required property - if (DirectoryEntries == null || DirectoryMapEntries == null || BlockEntries == null) + if (this.Model.DirectoryEntries == null || this.Model.DirectoryMapEntries == null || this.Model.BlockEntries == null) return null; // Otherwise, scan and build the files var files = new List(); - for (int i = 0; i < DirectoryEntries.Length; i++) + for (int i = 0; i < this.Model.DirectoryEntries.Length; i++) { // Get the directory entry - var directoryEntry = DirectoryEntries[i]; - var directoryMapEntry = DirectoryMapEntries[i]; + var directoryEntry = this.Model.DirectoryEntries[i]; + var directoryMapEntry = this.Model.DirectoryMapEntries[i]; if (directoryEntry == null || directoryMapEntry == null) continue; @@ -602,7 +66,7 @@ namespace BinaryObjectScanner.Wrappers uint index = directoryEntry.ParentIndex; while (index != 0xFFFFFFFF) { - var parentDirectoryEntry = DirectoryEntries[index]; + var parentDirectoryEntry = this.Model.DirectoryEntries[index]; if (parentDirectoryEntry == null) break; @@ -612,9 +76,9 @@ namespace BinaryObjectScanner.Wrappers // Traverse the block entries index = directoryMapEntry.FirstBlockIndex; - while (index != DBH_BlockCount) + while (index != this.Model.DataBlockHeader?.BlockCount) { - var nextBlock = BlockEntries[index]; + var nextBlock = this.Model.BlockEntries[index]; if (nextBlock == null) break; @@ -656,23 +120,15 @@ namespace BinaryObjectScanner.Wrappers #if NET6_0_OR_GREATER // If we don't have a block count, offset, or size - if (DBH_BlockCount == null || DBH_FirstBlockOffset == null || DBH_BlockSize == null) + if (this.Model.DataBlockHeader?.BlockCount == null || this.Model.DataBlockHeader?.FirstBlockOffset == null || this.Model.DataBlockHeader?.BlockSize == null) return null; #endif // Otherwise, build the data block set -#if NET48 - _dataBlockOffsets = new long[DBH_BlockCount]; -#else - _dataBlockOffsets = new long[DBH_BlockCount.Value]; -#endif - for (int i = 0; i < DBH_BlockCount; i++) + _dataBlockOffsets = new long[this.Model.DataBlockHeader.BlockCount]; + for (int i = 0; i < this.Model.DataBlockHeader.BlockCount; i++) { -#if NET48 - long dataBlockOffset = DBH_FirstBlockOffset + (i * DBH_BlockSize); -#else - long dataBlockOffset = DBH_FirstBlockOffset.Value + (i * DBH_BlockSize.Value); -#endif + long dataBlockOffset = this.Model.DataBlockHeader.FirstBlockOffset + (i * this.Model.DataBlockHeader.BlockSize); _dataBlockOffsets[i] = dataBlockOffset; } @@ -859,11 +315,7 @@ namespace BinaryObjectScanner.Wrappers { long dataBlockOffset = DataBlockOffsets[dataBlockIndex++]; dataBlockOffsets.Add(dataBlockOffset); -#if NET48 - blockEntrySize -= DBH_BlockSize; -#else - blockEntrySize -= DBH_BlockSize ?? 0; -#endif + blockEntrySize -= this.Model.DataBlockHeader?.BlockSize ?? 0; } } @@ -900,11 +352,10 @@ namespace BinaryObjectScanner.Wrappers long fileSize = file.Size; for (int i = 0; i < dataBlockOffsets.Count; i++) { + int readSize = (int)Math.Min(this.Model.DataBlockHeader?.BlockSize ?? 0, fileSize); #if NET48 - int readSize = (int)Math.Min(DBH_BlockSize, fileSize); byte[] data = ReadFromDataSource((int)dataBlockOffsets[i], readSize); #else - int readSize = (int)Math.Min(DBH_BlockSize ?? 0, fileSize); byte[]? data = ReadFromDataSource((int)dataBlockOffsets[i], readSize); #endif if (data == null) diff --git a/BinaryObjectScanner.Wrappers/InstallShieldCabinet.cs b/BinaryObjectScanner.Wrappers/InstallShieldCabinet.cs index f7c8969d..30b3816e 100644 --- a/BinaryObjectScanner.Wrappers/InstallShieldCabinet.cs +++ b/BinaryObjectScanner.Wrappers/InstallShieldCabinet.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.IO; using System.Text; @@ -13,407 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Common Header - - /// -#if NET48 - public string Signature => this.Model.CommonHeader.Signature; -#else - public string? Signature => this.Model.CommonHeader?.Signature; -#endif - - /// -#if NET48 - public uint Version => this.Model.CommonHeader.Version; -#else - public uint? Version => this.Model.CommonHeader?.Version; -#endif - - /// -#if NET48 - public uint VolumeInfo => this.Model.CommonHeader.VolumeInfo; -#else - public uint? VolumeInfo => this.Model.CommonHeader?.VolumeInfo; -#endif - - /// -#if NET48 - public uint DescriptorOffset => this.Model.CommonHeader.DescriptorOffset; -#else - public uint? DescriptorOffset => this.Model.CommonHeader?.DescriptorOffset; -#endif - - /// -#if NET48 - public uint DescriptorSize => this.Model.CommonHeader.DescriptorSize; -#else - public uint? DescriptorSize => this.Model.CommonHeader?.DescriptorSize; -#endif - - #endregion - - #region Volume Header - - /// -#if NET48 - public uint DataOffset => this.Model.VolumeHeader.DataOffset; -#else - public uint? DataOffset => this.Model.VolumeHeader?.DataOffset; -#endif - - /// -#if NET48 - public uint DataOffsetHigh => this.Model.VolumeHeader.DataOffsetHigh; -#else - public uint? DataOffsetHigh => this.Model.VolumeHeader?.DataOffsetHigh; -#endif - - /// -#if NET48 - public uint FirstFileIndex => this.Model.VolumeHeader.FirstFileIndex; -#else - public uint? FirstFileIndex => this.Model.VolumeHeader?.FirstFileIndex; -#endif - - /// -#if NET48 - public uint LastFileIndex => this.Model.VolumeHeader.LastFileIndex; -#else - public uint? LastFileIndex => this.Model.VolumeHeader?.LastFileIndex; -#endif - - /// -#if NET48 - public uint FirstFileOffset => this.Model.VolumeHeader.FirstFileOffset; -#else - public uint? FirstFileOffset => this.Model.VolumeHeader?.FirstFileOffset; -#endif - - /// -#if NET48 - public uint FirstFileOffsetHigh => this.Model.VolumeHeader.FirstFileOffsetHigh; -#else - public uint? FirstFileOffsetHigh => this.Model.VolumeHeader?.FirstFileOffsetHigh; -#endif - - /// -#if NET48 - public uint FirstFileSizeExpanded => this.Model.VolumeHeader.FirstFileSizeExpanded; -#else - public uint? FirstFileSizeExpanded => this.Model.VolumeHeader?.FirstFileSizeExpanded; -#endif - - /// -#if NET48 - public uint FirstFileSizeExpandedHigh => this.Model.VolumeHeader.FirstFileSizeExpandedHigh; -#else - public uint? FirstFileSizeExpandedHigh => this.Model.VolumeHeader?.FirstFileSizeExpandedHigh; -#endif - - /// -#if NET48 - public uint FirstFileSizeCompressed => this.Model.VolumeHeader.FirstFileSizeCompressed; -#else - public uint? FirstFileSizeCompressed => this.Model.VolumeHeader?.FirstFileSizeCompressed; -#endif - - /// -#if NET48 - public uint FirstFileSizeCompressedHigh => this.Model.VolumeHeader.FirstFileSizeCompressedHigh; -#else - public uint? FirstFileSizeCompressedHigh => this.Model.VolumeHeader?.FirstFileSizeCompressedHigh; -#endif - - /// -#if NET48 - public uint LastFileOffset => this.Model.VolumeHeader.LastFileOffset; -#else - public uint? LastFileOffset => this.Model.VolumeHeader?.LastFileOffset; -#endif - - /// -#if NET48 - public uint LastFileOffsetHigh => this.Model.VolumeHeader.LastFileOffsetHigh; -#else - public uint? LastFileOffsetHigh => this.Model.VolumeHeader?.LastFileOffsetHigh; -#endif - - /// -#if NET48 - public uint LastFileSizeExpanded => this.Model.VolumeHeader.LastFileSizeExpanded; -#else - public uint? LastFileSizeExpanded => this.Model.VolumeHeader?.LastFileSizeExpanded; -#endif - - /// -#if NET48 - public uint LastFileSizeExpandedHigh => this.Model.VolumeHeader.LastFileSizeExpandedHigh; -#else - public uint? LastFileSizeExpandedHigh => this.Model.VolumeHeader?.LastFileSizeExpandedHigh; -#endif - - /// -#if NET48 - public uint LastFileSizeCompressed => this.Model.VolumeHeader.LastFileSizeCompressed; -#else - public uint? LastFileSizeCompressed => this.Model.VolumeHeader?.LastFileSizeCompressed; -#endif - - /// -#if NET48 - public uint LastFileSizeCompressedHigh => this.Model.VolumeHeader.LastFileSizeCompressedHigh; -#else - public uint? LastFileSizeCompressedHigh => this.Model.VolumeHeader?.LastFileSizeCompressedHigh; -#endif - - #endregion - - #region Descriptor - - /// -#if NET48 - public uint StringsOffset => this.Model.Descriptor.StringsOffset; -#else - public uint? StringsOffset => this.Model.Descriptor?.StringsOffset; -#endif - - /// -#if NET48 - public byte[] Reserved0 => this.Model.Descriptor.Reserved0; -#else - public byte[]? Reserved0 => this.Model.Descriptor?.Reserved0; -#endif - - /// -#if NET48 - public uint ComponentListOffset => this.Model.Descriptor.ComponentListOffset; -#else - public uint? ComponentListOffset => this.Model.Descriptor?.ComponentListOffset; -#endif - - /// -#if NET48 - public uint FileTableOffset => this.Model.Descriptor.FileTableOffset; -#else - public uint? FileTableOffset => this.Model.Descriptor?.FileTableOffset; -#endif - - /// -#if NET48 - public byte[] Reserved1 => this.Model.Descriptor.Reserved1; -#else - public byte[]? Reserved1 => this.Model.Descriptor?.Reserved1; -#endif - - /// -#if NET48 - public uint FileTableSize => this.Model.Descriptor.FileTableSize; -#else - public uint? FileTableSize => this.Model.Descriptor?.FileTableSize; -#endif - - /// -#if NET48 - public uint FileTableSize2 => this.Model.Descriptor.FileTableSize2; -#else - public uint? FileTableSize2 => this.Model.Descriptor?.FileTableSize2; -#endif - - /// -#if NET48 - public ushort DirectoryCount => this.Model.Descriptor.DirectoryCount; -#else - public ushort? DirectoryCount => this.Model.Descriptor?.DirectoryCount; -#endif - - /// -#if NET48 - public byte[] Reserved2 => this.Model.Descriptor.Reserved2; -#else - public byte[]? Reserved2 => this.Model.Descriptor?.Reserved2; -#endif - - /// -#if NET48 - public byte[] Reserved3 => this.Model.Descriptor.Reserved3; -#else - public byte[]? Reserved3 => this.Model.Descriptor?.Reserved3; -#endif - - /// -#if NET48 - public byte[] Reserved4 => this.Model.Descriptor.Reserved4; -#else - public byte[]? Reserved4 => this.Model.Descriptor?.Reserved4; -#endif - - /// -#if NET48 - public uint FileCount => this.Model.Descriptor.FileCount; -#else - public uint? FileCount => this.Model.Descriptor?.FileCount; -#endif - - /// -#if NET48 - public uint FileTableOffset2 => this.Model.Descriptor.FileTableOffset2; -#else - public uint? FileTableOffset2 => this.Model.Descriptor?.FileTableOffset2; -#endif - - /// -#if NET48 - public ushort ComponentTableInfoCount => this.Model.Descriptor.ComponentTableInfoCount; -#else - public ushort? ComponentTableInfoCount => this.Model.Descriptor?.ComponentTableInfoCount; -#endif - - /// -#if NET48 - public uint ComponentTableOffset => this.Model.Descriptor.ComponentTableOffset; -#else - public uint? ComponentTableOffset => this.Model.Descriptor?.ComponentTableOffset; -#endif - - /// -#if NET48 - public byte[] Reserved5 => this.Model.Descriptor.Reserved5; -#else - public byte[]? Reserved5 => this.Model.Descriptor?.Reserved5; -#endif - - /// -#if NET48 - public byte[] Reserved6 => this.Model.Descriptor.Reserved6; -#else - public byte[]? Reserved6 => this.Model.Descriptor?.Reserved6; -#endif - - /// -#if NET48 - public uint[] D_FileGroupOffsets => this.Model.Descriptor.FileGroupOffsets; -#else - public uint[]? D_FileGroupOffsets => this.Model.Descriptor?.FileGroupOffsets; -#endif - - /// -#if NET48 - public uint[] D_ComponentOffsets => this.Model.Descriptor.ComponentOffsets; -#else - public uint[]? D_ComponentOffsets => this.Model.Descriptor?.ComponentOffsets; -#endif - - /// -#if NET48 - public uint SetupTypesOffset => this.Model.Descriptor.SetupTypesOffset; -#else - public uint? SetupTypesOffset => this.Model.Descriptor?.SetupTypesOffset; -#endif - - /// -#if NET48 - public uint SetupTableOffset => this.Model.Descriptor.SetupTableOffset; -#else - public uint? SetupTableOffset => this.Model.Descriptor?.SetupTableOffset; -#endif - - /// -#if NET48 - public byte[] Reserved7 => this.Model.Descriptor.Reserved7; -#else - public byte[]? Reserved7 => this.Model.Descriptor?.Reserved7; -#endif - - /// -#if NET48 - public byte[] Reserved8 => this.Model.Descriptor.Reserved8; -#else - public byte[]? Reserved8 => this.Model.Descriptor?.Reserved8; -#endif - - #endregion - - #region File Descriptor Offsets - - /// -#if NET48 - public uint[] FileDescriptorOffsets => this.Model.FileDescriptorOffsets; -#else - public uint[]? FileDescriptorOffsets => this.Model.FileDescriptorOffsets; -#endif - - #endregion - - #region Directory Descriptors - - /// -#if NET48 - public string[] DirectoryNames => this.Model.DirectoryNames; -#else - public string[]? DirectoryNames => this.Model.DirectoryNames; -#endif - - #endregion - - #region File Descriptors - - /// -#if NET48 - public SabreTools.Models.InstallShieldCabinet.FileDescriptor[] FileDescriptors => this.Model.FileDescriptors; -#else - public SabreTools.Models.InstallShieldCabinet.FileDescriptor?[]? FileDescriptors => this.Model.FileDescriptors; -#endif - - #endregion - - #region File Group Offsets - - /// -#if NET48 - public Dictionary FileGroupOffsets => this.Model.FileGroupOffsets; -#else - public Dictionary? FileGroupOffsets => this.Model.FileGroupOffsets; -#endif - - #endregion - - #region File Groups - - /// -#if NET48 - public SabreTools.Models.InstallShieldCabinet.FileGroup[] FileGroups => this.Model.FileGroups; -#else - public SabreTools.Models.InstallShieldCabinet.FileGroup?[]? FileGroups => this.Model.FileGroups; -#endif - - #endregion - - #region Component Offsets - - /// -#if NET48 - public Dictionary ComponentOffsets => this.Model.ComponentOffsets; -#else - public Dictionary? ComponentOffsets => this.Model.ComponentOffsets; -#endif - - #endregion - - #region Components - - /// -#if NET48 - public SabreTools.Models.InstallShieldCabinet.Component[] Components => this.Model.Components; -#else - public SabreTools.Models.InstallShieldCabinet.Component?[]? Components => this.Model.Components; -#endif - - #endregion - - #endregion - #region Extension Properties /// @@ -423,11 +21,7 @@ namespace BinaryObjectScanner.Wrappers { get { -#if NET48 - uint majorVersion = Version; -#else - uint majorVersion = Version ?? 0; -#endif + uint majorVersion = this.Model.CommonHeader?.Version ?? 0; if (majorVersion >> 24 == 1) { majorVersion = (majorVersion >> 12) & 0x0F; diff --git a/BinaryObjectScanner.Wrappers/LinearExecutable.cs b/BinaryObjectScanner.Wrappers/LinearExecutable.cs index 60be683e..7c429591 100644 --- a/BinaryObjectScanner.Wrappers/LinearExecutable.cs +++ b/BinaryObjectScanner.Wrappers/LinearExecutable.cs @@ -13,603 +13,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region MS-DOS Stub - - #region Standard Fields - - /// -#if NET48 - public string Stub_Magic => this.Model.Stub.Header.Magic; -#else - public string? Stub_Magic => this.Model.Stub?.Header?.Magic; -#endif - - /// -#if NET48 - public ushort Stub_LastPageBytes => this.Model.Stub.Header.LastPageBytes; -#else - public ushort? Stub_LastPageBytes => this.Model.Stub?.Header?.LastPageBytes; -#endif - - /// -#if NET48 - public ushort Stub_Pages => this.Model.Stub.Header.Pages; -#else - public ushort? Stub_Pages => this.Model.Stub?.Header?.Pages; -#endif - - /// -#if NET48 - public ushort Stub_RelocationItems => this.Model.Stub.Header.RelocationItems; -#else - public ushort? Stub_RelocationItems => this.Model.Stub?.Header?.RelocationItems; -#endif - - /// -#if NET48 - public ushort Stub_HeaderParagraphSize => this.Model.Stub.Header.HeaderParagraphSize; -#else - public ushort? Stub_HeaderParagraphSize => this.Model.Stub?.Header?.HeaderParagraphSize; -#endif - - /// -#if NET48 - public ushort Stub_MinimumExtraParagraphs => this.Model.Stub.Header.MinimumExtraParagraphs; -#else - public ushort? Stub_MinimumExtraParagraphs => this.Model.Stub?.Header?.MinimumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort Stub_MaximumExtraParagraphs => this.Model.Stub.Header.MaximumExtraParagraphs; -#else - public ushort? Stub_MaximumExtraParagraphs => this.Model.Stub?.Header?.MaximumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort Stub_InitialSSValue => this.Model.Stub.Header.InitialSSValue; -#else - public ushort? Stub_InitialSSValue => this.Model.Stub?.Header?.InitialSSValue; -#endif - - /// -#if NET48 - public ushort Stub_InitialSPValue => this.Model.Stub.Header.InitialSPValue; -#else - public ushort? Stub_InitialSPValue => this.Model.Stub?.Header?.InitialSPValue; -#endif - - /// -#if NET48 - public ushort Stub_Checksum => this.Model.Stub.Header.Checksum; -#else - public ushort? Stub_Checksum => this.Model.Stub?.Header?.Checksum; -#endif - - /// -#if NET48 - public ushort Stub_InitialIPValue => this.Model.Stub.Header.InitialIPValue; -#else - public ushort? Stub_InitialIPValue => this.Model.Stub?.Header?.InitialIPValue; -#endif - - /// -#if NET48 - public ushort Stub_InitialCSValue => this.Model.Stub.Header.InitialCSValue; -#else - public ushort? Stub_InitialCSValue => this.Model.Stub?.Header?.InitialCSValue; -#endif - - /// -#if NET48 - public ushort Stub_RelocationTableAddr => this.Model.Stub.Header.RelocationTableAddr; -#else - public ushort? Stub_RelocationTableAddr => this.Model.Stub?.Header?.RelocationTableAddr; -#endif - - /// -#if NET48 - public ushort Stub_OverlayNumber => this.Model.Stub.Header.OverlayNumber; -#else - public ushort? Stub_OverlayNumber => this.Model.Stub?.Header?.OverlayNumber; -#endif - - #endregion - - #region PE Extensions - - /// -#if NET48 - public ushort[] Stub_Reserved1 => this.Model.Stub.Header.Reserved1; -#else - public ushort[]? Stub_Reserved1 => this.Model.Stub?.Header?.Reserved1; -#endif - - /// -#if NET48 - public ushort Stub_OEMIdentifier => this.Model.Stub.Header.OEMIdentifier; -#else - public ushort? Stub_OEMIdentifier => this.Model.Stub?.Header?.OEMIdentifier; -#endif - - /// -#if NET48 - public ushort Stub_OEMInformation => this.Model.Stub.Header.OEMInformation; -#else - public ushort? Stub_OEMInformation => this.Model.Stub?.Header?.OEMInformation; -#endif - - /// -#if NET48 - public ushort[] Stub_Reserved2 => this.Model.Stub.Header.Reserved2; -#else - public ushort[]? Stub_Reserved2 => Model?.Stub?.Header?.Reserved2; -#endif - - /// -#if NET48 - public uint Stub_NewExeHeaderAddr => this.Model.Stub.Header.NewExeHeaderAddr; -#else - public uint? Stub_NewExeHeaderAddr => this.Model.Stub?.Header?.NewExeHeaderAddr; -#endif - - #endregion - - #endregion - - #region Information Block - - /// -#if NET48 - public string Signature => this.Model.InformationBlock.Signature; -#else - public string? Signature => this.Model.InformationBlock?.Signature; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ByteOrder ByteOrder => this.Model.InformationBlock.ByteOrder; -#else - public SabreTools.Models.LinearExecutable.ByteOrder? ByteOrder => this.Model.InformationBlock?.ByteOrder; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.WordOrder WordOrder => this.Model.InformationBlock.WordOrder; -#else - public SabreTools.Models.LinearExecutable.WordOrder? WordOrder => this.Model.InformationBlock?.WordOrder; -#endif - - /// -#if NET48 - public uint ExecutableFormatLevel => this.Model.InformationBlock.ExecutableFormatLevel; -#else - public uint? ExecutableFormatLevel => this.Model.InformationBlock?.ExecutableFormatLevel; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.CPUType CPUType => this.Model.InformationBlock.CPUType; -#else - public SabreTools.Models.LinearExecutable.CPUType? CPUType => this.Model.InformationBlock?.CPUType; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.OperatingSystem ModuleOS => this.Model.InformationBlock.ModuleOS; -#else - public SabreTools.Models.LinearExecutable.OperatingSystem? ModuleOS => this.Model.InformationBlock?.ModuleOS; -#endif - - /// -#if NET48 - public uint ModuleVersion => this.Model.InformationBlock.ModuleVersion; -#else - public uint? ModuleVersion => this.Model.InformationBlock?.ModuleVersion; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ModuleFlags ModuleTypeFlags => this.Model.InformationBlock.ModuleTypeFlags; -#else - public SabreTools.Models.LinearExecutable.ModuleFlags? ModuleTypeFlags => this.Model.InformationBlock?.ModuleTypeFlags; -#endif - - /// -#if NET48 - public uint ModuleNumberPages => this.Model.InformationBlock.ModuleNumberPages; -#else - public uint? ModuleNumberPages => this.Model.InformationBlock?.ModuleNumberPages; -#endif - - /// -#if NET48 - public uint InitialObjectCS => this.Model.InformationBlock.InitialObjectCS; -#else - public uint? InitialObjectCS => this.Model.InformationBlock?.InitialObjectCS; -#endif - - /// -#if NET48 - public uint InitialEIP => this.Model.InformationBlock.InitialEIP; -#else - public uint? InitialEIP => this.Model.InformationBlock?.InitialEIP; -#endif - - /// -#if NET48 - public uint InitialObjectSS => this.Model.InformationBlock.InitialObjectSS; -#else - public uint? InitialObjectSS => this.Model.InformationBlock?.InitialObjectSS; -#endif - - /// -#if NET48 - public uint InitialESP => this.Model.InformationBlock.InitialESP; -#else - public uint? InitialESP => this.Model.InformationBlock?.InitialESP; -#endif - - /// -#if NET48 - public uint MemoryPageSize => this.Model.InformationBlock.MemoryPageSize; -#else - public uint? MemoryPageSize => this.Model.InformationBlock?.MemoryPageSize; -#endif - - /// -#if NET48 - public uint BytesOnLastPage => this.Model.InformationBlock.BytesOnLastPage; -#else - public uint? BytesOnLastPage => this.Model.InformationBlock?.BytesOnLastPage; -#endif - - /// -#if NET48 - public uint FixupSectionSize => this.Model.InformationBlock.FixupSectionSize; -#else - public uint? FixupSectionSize => this.Model.InformationBlock?.FixupSectionSize; -#endif - - /// -#if NET48 - public uint FixupSectionChecksum => this.Model.InformationBlock.FixupSectionChecksum; -#else - public uint? FixupSectionChecksum => this.Model.InformationBlock?.FixupSectionChecksum; -#endif - - /// -#if NET48 - public uint LoaderSectionSize => this.Model.InformationBlock.LoaderSectionSize; -#else - public uint? LoaderSectionSize => this.Model.InformationBlock?.LoaderSectionSize; -#endif - - /// -#if NET48 - public uint LoaderSectionChecksum => this.Model.InformationBlock.LoaderSectionChecksum; -#else - public uint? LoaderSectionChecksum => this.Model.InformationBlock?.LoaderSectionChecksum; -#endif - - /// -#if NET48 - public uint ObjectTableOffset => this.Model.InformationBlock.ObjectTableOffset; -#else - public uint? ObjectTableOffset => this.Model.InformationBlock?.ObjectTableOffset; -#endif - - /// -#if NET48 - public uint ObjectTableCount => this.Model.InformationBlock.ObjectTableCount; -#else - public uint? ObjectTableCount => this.Model.InformationBlock?.ObjectTableCount; -#endif - - /// -#if NET48 - public uint ObjectPageMapOffset => this.Model.InformationBlock.ObjectPageMapOffset; -#else - public uint? ObjectPageMapOffset => this.Model.InformationBlock?.ObjectPageMapOffset; -#endif - - /// -#if NET48 - public uint ObjectIterateDataMapOffset => this.Model.InformationBlock.ObjectIterateDataMapOffset; -#else - public uint? ObjectIterateDataMapOffset => this.Model.InformationBlock?.ObjectIterateDataMapOffset; -#endif - - /// -#if NET48 - public uint ResourceTableOffset => this.Model.InformationBlock.ResourceTableOffset; -#else - public uint? ResourceTableOffset => this.Model.InformationBlock?.ResourceTableOffset; -#endif - - /// -#if NET48 - public uint ResourceTableCount => this.Model.InformationBlock.ResourceTableCount; -#else - public uint? ResourceTableCount => this.Model.InformationBlock?.ResourceTableCount; -#endif - - /// -#if NET48 - public uint ResidentNamesTableOffset => this.Model.InformationBlock.ResidentNamesTableOffset; -#else - public uint? ResidentNamesTableOffset => this.Model.InformationBlock?.ResidentNamesTableOffset; -#endif - - /// -#if NET48 - public uint EntryTableOffset => this.Model.InformationBlock.EntryTableOffset; -#else - public uint? EntryTableOffset => this.Model.InformationBlock?.EntryTableOffset; -#endif - - /// -#if NET48 - public uint ModuleDirectivesTableOffset => this.Model.InformationBlock.ModuleDirectivesTableOffset; -#else - public uint? ModuleDirectivesTableOffset => this.Model.InformationBlock?.ModuleDirectivesTableOffset; -#endif - - /// -#if NET48 - public uint ModuleDirectivesCount => this.Model.InformationBlock.ModuleDirectivesCount; -#else - public uint? ModuleDirectivesCount => this.Model.InformationBlock?.ModuleDirectivesCount; -#endif - - /// -#if NET48 - public uint FixupPageTableOffset => this.Model.InformationBlock.FixupPageTableOffset; -#else - public uint? FixupPageTableOffset => this.Model.InformationBlock?.FixupPageTableOffset; -#endif - - /// -#if NET48 - public uint FixupRecordTableOffset => this.Model.InformationBlock.FixupRecordTableOffset; -#else - public uint? FixupRecordTableOffset => this.Model.InformationBlock?.FixupRecordTableOffset; -#endif - - /// -#if NET48 - public uint ImportedModulesNameTableOffset => this.Model.InformationBlock.ImportedModulesNameTableOffset; -#else - public uint? ImportedModulesNameTableOffset => this.Model.InformationBlock?.ImportedModulesNameTableOffset; -#endif - - /// -#if NET48 - public uint ImportedModulesCount => this.Model.InformationBlock.ImportedModulesCount; -#else - public uint? ImportedModulesCount => this.Model.InformationBlock?.ImportedModulesCount; -#endif - - /// -#if NET48 - public uint ImportProcedureNameTableOffset => this.Model.InformationBlock.ImportProcedureNameTableOffset; -#else - public uint? ImportProcedureNameTableOffset => this.Model.InformationBlock?.ImportProcedureNameTableOffset; -#endif - - /// -#if NET48 - public uint PerPageChecksumTableOffset => this.Model.InformationBlock.PerPageChecksumTableOffset; -#else - public uint? PerPageChecksumTableOffset => this.Model.InformationBlock?.PerPageChecksumTableOffset; -#endif - - /// -#if NET48 - public uint DataPagesOffset => this.Model.InformationBlock.DataPagesOffset; -#else - public uint? DataPagesOffset => this.Model.InformationBlock?.DataPagesOffset; -#endif - - /// -#if NET48 - public uint PreloadPageCount => this.Model.InformationBlock.PreloadPageCount; -#else - public uint? PreloadPageCount => this.Model.InformationBlock?.PreloadPageCount; -#endif - - /// -#if NET48 - public uint NonResidentNamesTableOffset => this.Model.InformationBlock.NonResidentNamesTableOffset; -#else - public uint? NonResidentNamesTableOffset => this.Model.InformationBlock?.NonResidentNamesTableOffset; -#endif - - /// -#if NET48 - public uint NonResidentNamesTableLength => this.Model.InformationBlock.NonResidentNamesTableLength; -#else - public uint? NonResidentNamesTableLength => this.Model.InformationBlock?.NonResidentNamesTableLength; -#endif - - /// -#if NET48 - public uint NonResidentNamesTableChecksum => this.Model.InformationBlock.NonResidentNamesTableChecksum; -#else - public uint? NonResidentNamesTableChecksum => this.Model.InformationBlock?.NonResidentNamesTableChecksum; -#endif - - /// -#if NET48 - public uint AutomaticDataObject => this.Model.InformationBlock.AutomaticDataObject; -#else - public uint? AutomaticDataObject => this.Model.InformationBlock?.AutomaticDataObject; -#endif - - /// -#if NET48 - public uint DebugInformationOffset => this.Model.InformationBlock.DebugInformationOffset; -#else - public uint? DebugInformationOffset => this.Model.InformationBlock?.DebugInformationOffset; -#endif - - /// -#if NET48 - public uint DebugInformationLength => this.Model.InformationBlock.DebugInformationLength; -#else - public uint? DebugInformationLength => this.Model.InformationBlock?.DebugInformationLength; -#endif - - /// -#if NET48 - public uint PreloadInstancePagesNumber => this.Model.InformationBlock.PreloadInstancePagesNumber; -#else - public uint? PreloadInstancePagesNumber => this.Model.InformationBlock?.PreloadInstancePagesNumber; -#endif - - /// -#if NET48 - public uint DemandInstancePagesNumber => this.Model.InformationBlock.DemandInstancePagesNumber; -#else - public uint? DemandInstancePagesNumber => this.Model.InformationBlock?.DemandInstancePagesNumber; -#endif - - /// -#if NET48 - public uint ExtraHeapAllocation => this.Model.InformationBlock.ExtraHeapAllocation; -#else - public uint? ExtraHeapAllocation => this.Model.InformationBlock?.ExtraHeapAllocation; -#endif - - #endregion - - #region Tables - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ObjectTableEntry[] ObjectTable => this.Model.ObjectTable; -#else - public SabreTools.Models.LinearExecutable.ObjectTableEntry?[]? ObjectTable => this.Model.ObjectTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ObjectPageMapEntry[] ObjectPageMap => this.Model.ObjectPageMap; -#else - public SabreTools.Models.LinearExecutable.ObjectPageMapEntry?[]? ObjectPageMap => this.Model.ObjectPageMap; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ResourceTableEntry[] ResourceTable => this.Model.ResourceTable; -#else - public SabreTools.Models.LinearExecutable.ResourceTableEntry?[]? ResourceTable => this.Model.ResourceTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ResidentNamesTableEntry[] ResidentNamesTable => this.Model.ResidentNamesTable; -#else - public SabreTools.Models.LinearExecutable.ResidentNamesTableEntry?[]? ResidentNamesTable => this.Model.ResidentNamesTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.EntryTableBundle[] EntryTable => this.Model.EntryTable; -#else - public SabreTools.Models.LinearExecutable.EntryTableBundle?[]? EntryTable => this.Model.EntryTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ModuleFormatDirectivesTableEntry[] ModuleFormatDirectivesTable => this.Model.ModuleFormatDirectivesTable; -#else - public SabreTools.Models.LinearExecutable.ModuleFormatDirectivesTableEntry?[]? ModuleFormatDirectivesTable => this.Model.ModuleFormatDirectivesTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.VerifyRecordDirectiveTableEntry[] VerifyRecordDirectiveTable => this.Model.VerifyRecordDirectiveTable; -#else - public SabreTools.Models.LinearExecutable.VerifyRecordDirectiveTableEntry?[]? VerifyRecordDirectiveTable => this.Model.VerifyRecordDirectiveTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.PerPageChecksumTableEntry[] PerPageChecksumTable => this.Model.PerPageChecksumTable; -#else - public SabreTools.Models.LinearExecutable.PerPageChecksumTableEntry?[]? PerPageChecksumTable => this.Model.PerPageChecksumTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.FixupPageTableEntry[] FixupPageTable => this.Model.FixupPageTable; -#else - public SabreTools.Models.LinearExecutable.FixupPageTableEntry?[]? FixupPageTable => this.Model.FixupPageTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.FixupRecordTableEntry[] FixupRecordTable => this.Model.FixupRecordTable; -#else - public SabreTools.Models.LinearExecutable.FixupRecordTableEntry?[]? FixupRecordTable => this.Model.FixupRecordTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ImportModuleNameTableEntry[] ImportModuleNameTable => this.Model.ImportModuleNameTable; -#else - public SabreTools.Models.LinearExecutable.ImportModuleNameTableEntry?[]? ImportModuleNameTable => this.Model.ImportModuleNameTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.ImportModuleProcedureNameTableEntry[] ImportModuleProcedureNameTable => this.Model.ImportModuleProcedureNameTable; -#else - public SabreTools.Models.LinearExecutable.ImportModuleProcedureNameTableEntry?[]? ImportModuleProcedureNameTable => this.Model.ImportModuleProcedureNameTable; -#endif - - /// -#if NET48 - public SabreTools.Models.LinearExecutable.NonResidentNamesTableEntry[] NonResidentNamesTable => this.Model.NonResidentNamesTable; -#else - public SabreTools.Models.LinearExecutable.NonResidentNamesTableEntry?[]? NonResidentNamesTable => this.Model.NonResidentNamesTable; -#endif - - #endregion - - #region Debug Information - - /// -#if NET48 - public string DI_Signature => this.Model.DebugInformation?.Signature; -#else - public string? DI_Signature => this.Model.DebugInformation?.Signature; -#endif - - /// - public SabreTools.Models.LinearExecutable.DebugFormatType? DI_FormatType => this.Model.DebugInformation?.FormatType; - - /// -#if NET48 - public byte[] DebuggerData => this.Model.DebugInformation?.DebuggerData; -#else - public byte[]? DebuggerData => this.Model.DebugInformation?.DebuggerData; -#endif - - #endregion - - #endregion - - #region Extension Properties - - // TODO: Determine what extension properties are needed - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/MSDOS.cs b/BinaryObjectScanner.Wrappers/MSDOS.cs index a4570e93..6a063a5c 100644 --- a/BinaryObjectScanner.Wrappers/MSDOS.cs +++ b/BinaryObjectScanner.Wrappers/MSDOS.cs @@ -12,162 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Magic => this.Model.Header.Magic; -#else - public string? Magic => this.Model.Header?.Magic; -#endif - - /// -#if NET48 - public ushort LastPageBytes => this.Model.Header.LastPageBytes; -#else - public ushort? LastPageBytes => this.Model.Header?.LastPageBytes; -#endif - - /// -#if NET48 - public ushort Pages => this.Model.Header.Pages; -#else - public ushort? Pages => this.Model.Header?.Pages; -#endif - - /// -#if NET48 - public ushort RelocationItems => this.Model.Header.RelocationItems; -#else - public ushort? RelocationItems => this.Model.Header?.RelocationItems; -#endif - - /// -#if NET48 - public ushort HeaderParagraphSize => this.Model.Header.HeaderParagraphSize; -#else - public ushort? HeaderParagraphSize => this.Model.Header?.HeaderParagraphSize; -#endif - - /// -#if NET48 - public ushort MinimumExtraParagraphs => this.Model.Header.MinimumExtraParagraphs; -#else - public ushort? MinimumExtraParagraphs => this.Model.Header?.MinimumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort MaximumExtraParagraphs => this.Model.Header.MaximumExtraParagraphs; -#else - public ushort? MaximumExtraParagraphs => this.Model.Header?.MaximumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort InitialSSValue => this.Model.Header.InitialSSValue; -#else - public ushort? InitialSSValue => this.Model.Header?.InitialSSValue; -#endif - - /// -#if NET48 - public ushort InitialSPValue => this.Model.Header.InitialSPValue; -#else - public ushort? InitialSPValue => this.Model.Header?.InitialSPValue; -#endif - - /// -#if NET48 - public ushort Checksum => this.Model.Header.Checksum; -#else - public ushort? Checksum => this.Model.Header?.Checksum; -#endif - - /// -#if NET48 - public ushort InitialIPValue => this.Model.Header.InitialIPValue; -#else - public ushort? InitialIPValue => this.Model.Header?.InitialIPValue; -#endif - - /// -#if NET48 - public ushort InitialCSValue => this.Model.Header.InitialCSValue; -#else - public ushort? InitialCSValue => this.Model.Header?.InitialCSValue; -#endif - - /// -#if NET48 - public ushort RelocationTableAddr => this.Model.Header.RelocationTableAddr; -#else - public ushort? RelocationTableAddr => this.Model.Header?.RelocationTableAddr; -#endif - - /// -#if NET48 - public ushort OverlayNumber => this.Model.Header.OverlayNumber; -#else - public ushort? OverlayNumber => this.Model.Header?.OverlayNumber; -#endif - - #endregion - - #region PE Extensions - - /// -#if NET48 - public ushort[] Reserved1 => this.Model.Header.Reserved1; -#else - public ushort[]? Reserved1 => this.Model.Header?.Reserved1; -#endif - - /// -#if NET48 - public ushort OEMIdentifier => this.Model.Header.OEMIdentifier; -#else - public ushort? OEMIdentifier => this.Model.Header?.OEMIdentifier; -#endif - - /// -#if NET48 - public ushort OEMInformation => this.Model.Header.OEMInformation; -#else - public ushort? OEMInformation => this.Model.Header?.OEMInformation; -#endif - - /// -#if NET48 - public ushort[] Reserved2 => this.Model.Header.Reserved2; -#else - public ushort[]? Reserved2 => this.Model.Header?.Reserved2; -#endif - - /// -#if NET48 - public uint NewExeHeaderAddr => this.Model.Header.NewExeHeaderAddr; -#else - public uint? NewExeHeaderAddr => this.Model.Header?.NewExeHeaderAddr; -#endif - - #endregion - - #region Relocation Table - - /// -#if NET48 - public SabreTools.Models.MSDOS.RelocationEntry[] RelocationTable => this.Model.RelocationTable; -#else - public SabreTools.Models.MSDOS.RelocationEntry?[]? RelocationTable => this.Model.RelocationTable; -#endif - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/MicrosoftCabinet.cs b/BinaryObjectScanner.Wrappers/MicrosoftCabinet.cs index a8cbe8d3..5e92db3a 100644 --- a/BinaryObjectScanner.Wrappers/MicrosoftCabinet.cs +++ b/BinaryObjectScanner.Wrappers/MicrosoftCabinet.cs @@ -14,183 +14,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint Reserved1 => this.Model.Header.Reserved1; -#else - public uint? Reserved1 => this.Model.Header?.Reserved1; -#endif - - /// -#if NET48 - public uint CabinetSize => this.Model.Header.CabinetSize; -#else - public uint? CabinetSize => this.Model.Header?.CabinetSize; -#endif - - /// -#if NET48 - public uint Reserved2 => this.Model.Header.Reserved2; -#else - public uint? Reserved2 => this.Model.Header?.Reserved2; -#endif - - /// -#if NET48 - public uint FilesOffset => this.Model.Header.FilesOffset; -#else - public uint? FilesOffset => this.Model.Header?.FilesOffset; -#endif - - /// -#if NET48 - public uint Reserved3 => this.Model.Header.Reserved3; -#else - public uint? Reserved3 => this.Model.Header?.Reserved3; -#endif - - /// -#if NET48 - public byte VersionMinor => this.Model.Header.VersionMinor; -#else - public byte? VersionMinor => this.Model.Header?.VersionMinor; -#endif - - /// -#if NET48 - public byte VersionMajor => this.Model.Header.VersionMajor; -#else - public byte? VersionMajor => this.Model.Header?.VersionMajor; -#endif - - /// -#if NET48 - public ushort FolderCount => this.Model.Header.FolderCount; -#else - public ushort? FolderCount => this.Model.Header?.FolderCount; -#endif - - /// -#if NET48 - public ushort FileCount => this.Model.Header.FileCount; -#else - public ushort? FileCount => this.Model.Header?.FileCount; -#endif - - /// -#if NET48 - public SabreTools.Models.MicrosoftCabinet.HeaderFlags Flags => this.Model.Header.Flags; -#else - public SabreTools.Models.MicrosoftCabinet.HeaderFlags? Flags => this.Model.Header?.Flags; -#endif - - /// -#if NET48 - public ushort SetID => this.Model.Header.SetID; -#else - public ushort? SetID => this.Model.Header?.SetID; -#endif - - /// -#if NET48 - public ushort CabinetIndex => this.Model.Header.CabinetIndex; -#else - public ushort? CabinetIndex => this.Model.Header?.CabinetIndex; -#endif - - /// -#if NET48 - public ushort HeaderReservedSize => this.Model.Header.HeaderReservedSize; -#else - public ushort? HeaderReservedSize => this.Model.Header?.HeaderReservedSize; -#endif - - /// -#if NET48 - public byte FolderReservedSize => this.Model.Header.FolderReservedSize; -#else - public byte? FolderReservedSize => this.Model.Header?.FolderReservedSize; -#endif - - /// -#if NET48 - public byte DataReservedSize => this.Model.Header.DataReservedSize; -#else - public byte? DataReservedSize => this.Model.Header?.DataReservedSize; -#endif - - /// -#if NET48 - public byte[] ReservedData => this.Model.Header.ReservedData; -#else - public byte[]? ReservedData => this.Model.Header?.ReservedData; -#endif - - /// -#if NET48 - public string CabinetPrev => this.Model.Header.CabinetPrev; -#else - public string? CabinetPrev => this.Model.Header?.CabinetPrev; -#endif - - /// -#if NET48 - public string DiskPrev => this.Model.Header.DiskPrev; -#else - public string? DiskPrev => this.Model.Header?.DiskPrev; -#endif - - /// -#if NET48 - public string CabinetNext => this.Model.Header.CabinetNext; -#else - public string? CabinetNext => this.Model.Header?.CabinetNext; -#endif - - /// -#if NET48 - public string DiskNext => this.Model.Header.DiskNext; -#else - public string? DiskNext => this.Model.Header?.DiskNext; -#endif - - #endregion - - #region Folders - - /// -#if NET48 - public SabreTools.Models.MicrosoftCabinet.CFFOLDER[] Folders => this.Model.Folders; -#else - public SabreTools.Models.MicrosoftCabinet.CFFOLDER?[]? Folders => this.Model.Folders; -#endif - - #endregion - - #region Files - - /// -#if NET48 - public SabreTools.Models.MicrosoftCabinet.CFFILE[] Files => this.Model.Files; -#else - public SabreTools.Models.MicrosoftCabinet.CFFILE?[]? Files => this.Model.Files; -#endif - - #endregion - - #endregion - #region Constructors /// @@ -322,11 +145,11 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have an invalid folder index - if (folderIndex < 0 || Folders == null || folderIndex >= Folders.Length) + if (folderIndex < 0 || this.Model.Folders == null || folderIndex >= this.Model.Folders.Length) return null; // Get the folder header - var folder = Folders[folderIndex]; + var folder = this.Model.Folders[folderIndex]; if (folder == null) return null; @@ -395,12 +218,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no files - if (Files == null || Files.Length == 0) + if (this.Model.Files == null || this.Model.Files.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < Files.Length; i++) + for (int i = 0; i < this.Model.Files.Length; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -417,7 +240,7 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractFile(int index, string outputDirectory) { // If we have an invalid file index - if (index < 0 || Files == null || index >= Files.Length) + if (index < 0 || this.Model.Files == null || index >= this.Model.Files.Length) return false; // If we have an invalid output directory @@ -428,7 +251,7 @@ namespace BinaryObjectScanner.Wrappers Directory.CreateDirectory(outputDirectory); // Get the file header - var file = Files[index]; + var file = this.Model.Files[index]; if (file == null || file.FileSize == 0) return false; @@ -461,11 +284,11 @@ namespace BinaryObjectScanner.Wrappers public DateTime? GetDateTime(int fileIndex) { // If we have an invalid file index - if (fileIndex < 0 || Files == null || fileIndex >= Files.Length) + if (fileIndex < 0 || this.Model.Files == null || fileIndex >= this.Model.Files.Length) return null; // Get the file header - var file = Files[fileIndex]; + var file = this.Model.Files[fileIndex]; if (file == null) return null; @@ -505,11 +328,11 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have an invalid file index - if (fileIndex < 0 || Files == null || fileIndex >= Files.Length) + if (fileIndex < 0 || this.Model.Files == null || fileIndex >= this.Model.Files.Length) return null; // Get the file header - var file = Files[fileIndex]; + var file = this.Model.Files[fileIndex]; if (file == null || file.FileSize == 0) return null; diff --git a/BinaryObjectScanner.Wrappers/N3DS.cs b/BinaryObjectScanner.Wrappers/N3DS.cs index 91399142..dfbb6c23 100644 --- a/BinaryObjectScanner.Wrappers/N3DS.cs +++ b/BinaryObjectScanner.Wrappers/N3DS.cs @@ -12,418 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - #region Common to all NCSD files - - /// -#if NET48 - public byte[] RSA2048Signature => this.Model.Header.RSA2048Signature; -#else - public byte[]? RSA2048Signature => this.Model.Header?.RSA2048Signature; -#endif - - /// -#if NET48 - public string MagicNumber => this.Model.Header.MagicNumber; -#else - public string? MagicNumber => this.Model.Header?.MagicNumber; -#endif - - /// -#if NET48 - public uint ImageSizeInMediaUnits => this.Model.Header.ImageSizeInMediaUnits; -#else - public uint? ImageSizeInMediaUnits => this.Model.Header?.ImageSizeInMediaUnits; -#endif - - /// -#if NET48 - public byte[] MediaId => this.Model.Header.MediaId; -#else - public byte[]? MediaId => this.Model.Header?.MediaId; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.FilesystemType PartitionsFSType => this.Model.Header.PartitionsFSType; -#else - public SabreTools.Models.N3DS.FilesystemType? PartitionsFSType => this.Model.Header?.PartitionsFSType; -#endif - - /// -#if NET48 - public byte[] PartitionsCryptType => this.Model.Header.PartitionsCryptType; -#else - public byte[]? PartitionsCryptType => this.Model.Header?.PartitionsCryptType; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.PartitionTableEntry[] PartitionsTable => this.Model.Header.PartitionsTable; -#else - public SabreTools.Models.N3DS.PartitionTableEntry?[]? PartitionsTable => this.Model.Header?.PartitionsTable; -#endif - - #endregion - - #region CTR Cart Image (CCI) Specific - - /// -#if NET48 - public byte[] ExheaderHash => this.Model.Header.ExheaderHash; -#else - public byte[]? ExheaderHash => this.Model.Header?.ExheaderHash; -#endif - - /// -#if NET48 - public uint AdditionalHeaderSize => this.Model.Header.AdditionalHeaderSize; -#else - public uint? AdditionalHeaderSize => this.Model.Header?.AdditionalHeaderSize; -#endif - - /// -#if NET48 - public uint SectorZeroOffset => this.Model.Header.SectorZeroOffset; -#else - public uint? SectorZeroOffset => this.Model.Header?.SectorZeroOffset; -#endif - - /// -#if NET48 - public byte[] PartitionFlags => this.Model.Header.PartitionFlags; -#else - public byte[]? PartitionFlags => this.Model.Header?.PartitionFlags; -#endif - - /// -#if NET48 - public ulong[] PartitionIdTable => this.Model.Header.PartitionIdTable; -#else - public ulong[]? PartitionIdTable => this.Model.Header?.PartitionIdTable; -#endif - - /// -#if NET48 - public byte[] Reserved1 => this.Model.Header.Reserved1; -#else - public byte[]? Reserved1 => this.Model.Header?.Reserved1; -#endif - - /// -#if NET48 - public byte[] Reserved2 => this.Model.Header.Reserved2; -#else - public byte[]? Reserved2 => this.Model.Header?.Reserved2; -#endif - - /// -#if NET48 - public byte FirmUpdateByte1 => this.Model.Header.FirmUpdateByte1; -#else - public byte? FirmUpdateByte1 => this.Model.Header?.FirmUpdateByte1; -#endif - - /// -#if NET48 - public byte FirmUpdateByte2 => this.Model.Header.FirmUpdateByte2; -#else - public byte? FirmUpdateByte2 => this.Model.Header?.FirmUpdateByte2; -#endif - - #endregion - - #region Raw NAND Format Specific - - /// -#if NET48 - public byte[] Unknown => this.Model.Header.Unknown; -#else - public byte[]? Unknown => this.Model.Header?.Unknown; -#endif - - /// -#if NET48 - public byte[] EncryptedMBR => this.Model.Header.EncryptedMBR; -#else - public byte[]? EncryptedMBR => this.Model.Header?.EncryptedMBR; -#endif - - #endregion - - #endregion - - #region Card Info Header - - /// -#if NET48 - public uint CIH_WritableAddressMediaUnits => this.Model.CardInfoHeader.WritableAddressMediaUnits; -#else - public uint? CIH_WritableAddressMediaUnits => this.Model.CardInfoHeader?.WritableAddressMediaUnits; -#endif - - /// -#if NET48 - public uint CIH_CardInfoBitmask => this.Model.CardInfoHeader.CardInfoBitmask; -#else - public uint? CIH_CardInfoBitmask => this.Model.CardInfoHeader?.CardInfoBitmask; -#endif - - /// -#if NET48 - public byte[] CIH_Reserved1 => this.Model.CardInfoHeader.Reserved1; -#else - public byte[]? CIH_Reserved1 => this.Model.CardInfoHeader?.Reserved1; -#endif - - /// -#if NET48 - public uint CIH_FilledSize => this.Model.CardInfoHeader.FilledSize; -#else - public uint? CIH_FilledSize => this.Model.CardInfoHeader?.FilledSize; -#endif - - /// -#if NET48 - public byte[] CIH_Reserved2 => this.Model.CardInfoHeader.Reserved2; -#else - public byte[]? CIH_Reserved2 => this.Model.CardInfoHeader?.Reserved2; -#endif - - /// -#if NET48 - public ushort CIH_TitleVersion => this.Model.CardInfoHeader.TitleVersion; -#else - public ushort? CIH_TitleVersion => this.Model.CardInfoHeader?.TitleVersion; -#endif - - /// -#if NET48 - public ushort CIH_CardRevision => this.Model.CardInfoHeader.CardRevision; -#else - public ushort? CIH_CardRevision => this.Model.CardInfoHeader?.CardRevision; -#endif - - /// -#if NET48 - public byte[] CIH_Reserved3 => this.Model.CardInfoHeader.Reserved3; -#else - public byte[]? CIH_Reserved3 => this.Model.CardInfoHeader?.Reserved3; -#endif - - /// -#if NET48 - public byte[] CIH_CVerTitleID => this.Model.CardInfoHeader.CVerTitleID; -#else - public byte[]? CIH_CVerTitleID => this.Model.CardInfoHeader?.CVerTitleID; -#endif - - /// -#if NET48 - public ushort CIH_CVerVersionNumber => this.Model.CardInfoHeader.CVerVersionNumber; -#else - public ushort? CIH_CVerVersionNumber => this.Model.CardInfoHeader?.CVerVersionNumber; -#endif - - /// -#if NET48 - public byte[] CIH_Reserved4 => this.Model.CardInfoHeader.Reserved4; -#else - public byte[]? CIH_Reserved4 => this.Model.CardInfoHeader?.Reserved4; -#endif - - #endregion - - #region Development Card Info Header - - #region Initial Data - - /// -#if NET48 - public byte[] DCIH_ID_CardSeedKeyY => this.Model.DevelopmentCardInfoHeader?.InitialData?.CardSeedKeyY; -#else - public byte[]? DCIH_ID_CardSeedKeyY => this.Model.DevelopmentCardInfoHeader?.InitialData?.CardSeedKeyY; -#endif - - /// -#if NET48 - public byte[] DCIH_ID_EncryptedCardSeed => this.Model.DevelopmentCardInfoHeader?.InitialData?.EncryptedCardSeed; -#else - public byte[]? DCIH_ID_EncryptedCardSeed => this.Model.DevelopmentCardInfoHeader?.InitialData?.EncryptedCardSeed; -#endif - - /// -#if NET48 - public byte[] DCIH_ID_CardSeedAESMAC => this.Model.DevelopmentCardInfoHeader?.InitialData?.CardSeedAESMAC; -#else - public byte[]? DCIH_ID_CardSeedAESMAC => this.Model.DevelopmentCardInfoHeader?.InitialData?.CardSeedAESMAC; -#endif - - /// -#if NET48 - public byte[] DCIH_ID_CardSeedNonce => this.Model.DevelopmentCardInfoHeader?.InitialData?.CardSeedNonce; -#else - public byte[]? DCIH_ID_CardSeedNonce => this.Model.DevelopmentCardInfoHeader?.InitialData?.CardSeedNonce; -#endif - - /// -#if NET48 - public byte[] DCIH_ID_Reserved => this.Model.DevelopmentCardInfoHeader?.InitialData?.Reserved; -#else - public byte[]? DCIH_ID_Reserved => this.Model.DevelopmentCardInfoHeader?.InitialData?.Reserved; -#endif - - /// -#if NET48 - public SabreTools.Models.N3DS.NCCHHeader DCIH_ID_BackupHeader => this.Model.DevelopmentCardInfoHeader?.InitialData?.BackupHeader; -#else - public SabreTools.Models.N3DS.NCCHHeader? DCIH_ID_BackupHeader => this.Model.DevelopmentCardInfoHeader?.InitialData?.BackupHeader; -#endif - - #endregion - - /// -#if NET48 - public byte[] DCIH_CardDeviceReserved1 => this.Model.DevelopmentCardInfoHeader?.CardDeviceReserved1; -#else - public byte[]? DCIH_CardDeviceReserved1 => this.Model.DevelopmentCardInfoHeader?.CardDeviceReserved1; -#endif - - /// -#if NET48 - public byte[] DCIH_TitleKey => this.Model.DevelopmentCardInfoHeader?.TitleKey; -#else - public byte[]? DCIH_TitleKey => this.Model.DevelopmentCardInfoHeader?.TitleKey; -#endif - - /// -#if NET48 - public byte[] DCIH_CardDeviceReserved2 => this.Model.DevelopmentCardInfoHeader?.CardDeviceReserved2; -#else - public byte[]? DCIH_CardDeviceReserved2 => this.Model.DevelopmentCardInfoHeader?.CardDeviceReserved2; -#endif - - #region Test Data - - /// -#if NET48 - public byte[] DCIH_TD_Signature => this.Model.DevelopmentCardInfoHeader?.TestData?.Signature; -#else - public byte[]? DCIH_TD_Signature => this.Model.DevelopmentCardInfoHeader?.TestData?.Signature; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_AscendingByteSequence => this.Model.DevelopmentCardInfoHeader?.TestData?.AscendingByteSequence; -#else - public byte[]? DCIH_TD_AscendingByteSequence => this.Model.DevelopmentCardInfoHeader?.TestData?.AscendingByteSequence; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_DescendingByteSequence => this.Model.DevelopmentCardInfoHeader?.TestData?.DescendingByteSequence; -#else - public byte[]? DCIH_TD_DescendingByteSequence => this.Model.DevelopmentCardInfoHeader?.TestData?.DescendingByteSequence; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_Filled00 => this.Model.DevelopmentCardInfoHeader?.TestData?.Filled00; -#else - public byte[]? DCIH_TD_Filled00 => this.Model.DevelopmentCardInfoHeader?.TestData?.Filled00; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_FilledFF => this.Model.DevelopmentCardInfoHeader?.TestData?.FilledFF; -#else - public byte[]? DCIH_TD_FilledFF => this.Model.DevelopmentCardInfoHeader?.TestData?.FilledFF; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_Filled0F => this.Model.DevelopmentCardInfoHeader?.TestData?.Filled0F; -#else - public byte[]? DCIH_TD_Filled0F => this.Model.DevelopmentCardInfoHeader?.TestData?.Filled0F; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_FilledF0 => this.Model.DevelopmentCardInfoHeader?.TestData?.FilledF0; -#else - public byte[]? DCIH_TD_FilledF0 => this.Model.DevelopmentCardInfoHeader?.TestData?.FilledF0; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_Filled55 => this.Model.DevelopmentCardInfoHeader?.TestData?.Filled55; -#else - public byte[]? DCIH_TD_Filled55 => this.Model.DevelopmentCardInfoHeader?.TestData?.Filled55; -#endif - - /// -#if NET48 - public byte[] DCIH_TD_FilledAA => this.Model.DevelopmentCardInfoHeader?.TestData?.FilledAA; -#else - public byte[]? DCIH_TD_FilledAA => this.Model.DevelopmentCardInfoHeader?.TestData?.FilledAA; -#endif - - /// - public byte? DCIH_TD_FinalByte => this.Model.DevelopmentCardInfoHeader?.TestData?.FinalByte; - - #endregion - - #endregion - - #region Partitions - - /// -#if NET48 - public SabreTools.Models.N3DS.NCCHHeader[] Partitions => this.Model.Partitions; -#else - public SabreTools.Models.N3DS.NCCHHeader?[]? Partitions => this.Model.Partitions; -#endif - - #endregion - - #region Extended Headers - - /// -#if NET48 - public SabreTools.Models.N3DS.NCCHExtendedHeader[] ExtendedHeaders => this.Model.ExtendedHeaders; -#else - public SabreTools.Models.N3DS.NCCHExtendedHeader?[]? ExtendedHeaders => this.Model.ExtendedHeaders; -#endif - - #endregion - - #region ExeFS Headers - - /// -#if NET48 - public SabreTools.Models.N3DS.ExeFSHeader[] ExeFSHeaders => this.Model.ExeFSHeaders; -#else - public SabreTools.Models.N3DS.ExeFSHeader?[]? ExeFSHeaders => this.Model.ExeFSHeaders; -#endif - - #endregion - - #region RomFS Headers - - /// -#if NET48 - public SabreTools.Models.N3DS.RomFSHeader[] RomFSHeaders => this.Model.RomFSHeaders; -#else - public SabreTools.Models.N3DS.RomFSHeader?[]? RomFSHeaders => this.Model.RomFSHeaders; -#endif - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/NCF.cs b/BinaryObjectScanner.Wrappers/NCF.cs index 263269f4..36a66220 100644 --- a/BinaryObjectScanner.Wrappers/NCF.cs +++ b/BinaryObjectScanner.Wrappers/NCF.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.IO; using System.Text; @@ -13,360 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public uint Dummy0 => this.Model.Header.Dummy0; -#else - public uint? Dummy0 => this.Model.Header?.Dummy0; -#endif - - /// -#if NET48 - public uint MajorVersion => this.Model.Header.MajorVersion; -#else - public uint? MajorVersion => this.Model.Header?.MajorVersion; -#endif - - /// -#if NET48 - public uint MinorVersion => this.Model.Header.MinorVersion; -#else - public uint? MinorVersion => this.Model.Header?.MinorVersion; -#endif - - /// -#if NET48 - public uint CacheID => this.Model.Header.CacheID; -#else - public uint? CacheID => this.Model.Header?.CacheID; -#endif - - /// -#if NET48 - public uint LastVersionPlayed => this.Model.Header.LastVersionPlayed; -#else - public uint? LastVersionPlayed => this.Model.Header?.LastVersionPlayed; -#endif - - /// -#if NET48 - public uint Dummy1 => this.Model.Header.Dummy1; -#else - public uint? Dummy1 => this.Model.Header?.Dummy1; -#endif - - /// -#if NET48 - public uint Dummy2 => this.Model.Header.Dummy2; -#else - public uint? Dummy2 => this.Model.Header?.Dummy2; -#endif - - /// -#if NET48 - public uint FileSize => this.Model.Header.FileSize; -#else - public uint? FileSize => this.Model.Header?.FileSize; -#endif - - /// -#if NET48 - public uint BlockSize => this.Model.Header.BlockSize; -#else - public uint? BlockSize => this.Model.Header?.BlockSize; -#endif - - /// -#if NET48 - public uint BlockCount => this.Model.Header.BlockCount; -#else - public uint? BlockCount => this.Model.Header?.BlockCount; -#endif - - /// -#if NET48 - public uint Dummy3 => this.Model.Header.Dummy3; -#else - public uint? Dummy3 => this.Model.Header?.Dummy3; -#endif - - #endregion - - #region Directory Header - - /// -#if NET48 - public uint DH_Dummy0 => this.Model.DirectoryHeader.Dummy0; -#else - public uint? DH_Dummy0 => this.Model.DirectoryHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint DH_CacheID => this.Model.DirectoryHeader.CacheID; -#else - public uint? DH_CacheID => this.Model.DirectoryHeader?.CacheID; -#endif - - /// -#if NET48 - public uint DH_LastVersionPlayed => this.Model.DirectoryHeader.LastVersionPlayed; -#else - public uint? DH_LastVersionPlayed => this.Model.DirectoryHeader?.LastVersionPlayed; -#endif - - /// -#if NET48 - public uint DH_ItemCount => this.Model.DirectoryHeader.ItemCount; -#else - public uint? DH_ItemCount => this.Model.DirectoryHeader?.ItemCount; -#endif - - /// -#if NET48 - public uint DH_FileCount => this.Model.DirectoryHeader.FileCount; -#else - public uint? DH_FileCount => this.Model.DirectoryHeader?.FileCount; -#endif - - /// -#if NET48 - public uint DH_ChecksumDataLength => this.Model.DirectoryHeader.ChecksumDataLength; -#else - public uint? DH_ChecksumDataLength => this.Model.DirectoryHeader?.ChecksumDataLength; -#endif - - /// -#if NET48 - public uint DH_DirectorySize => this.Model.DirectoryHeader.DirectorySize; -#else - public uint? DH_DirectorySize => this.Model.DirectoryHeader?.DirectorySize; -#endif - - /// -#if NET48 - public uint DH_NameSize => this.Model.DirectoryHeader.NameSize; -#else - public uint? DH_NameSize => this.Model.DirectoryHeader?.NameSize; -#endif - - /// -#if NET48 - public uint DH_Info1Count => this.Model.DirectoryHeader.Info1Count; -#else - public uint? DH_Info1Count => this.Model.DirectoryHeader?.Info1Count; -#endif - - /// -#if NET48 - public uint DH_CopyCount => this.Model.DirectoryHeader.CopyCount; -#else - public uint? DH_CopyCount => this.Model.DirectoryHeader?.CopyCount; -#endif - - /// -#if NET48 - public uint DH_LocalCount => this.Model.DirectoryHeader.LocalCount; -#else - public uint? DH_LocalCount => this.Model.DirectoryHeader?.LocalCount; -#endif - - /// -#if NET48 - public uint DH_Dummy1 => this.Model.DirectoryHeader.Dummy1; -#else - public uint? DH_Dummy1 => this.Model.DirectoryHeader?.Dummy1; -#endif - - /// -#if NET48 - public uint DH_Dummy2 => this.Model.DirectoryHeader.Dummy2; -#else - public uint? DH_Dummy2 => this.Model.DirectoryHeader?.Dummy2; -#endif - - /// -#if NET48 - public uint DH_Checksum => this.Model.DirectoryHeader.Checksum; -#else - public uint? DH_Checksum => this.Model.DirectoryHeader?.Checksum; -#endif - - #endregion - - #region Directory Entries - - /// -#if NET48 - public SabreTools.Models.NCF.DirectoryEntry[] DirectoryEntries => this.Model.DirectoryEntries; -#else - public SabreTools.Models.NCF.DirectoryEntry?[]? DirectoryEntries => this.Model.DirectoryEntries; -#endif - - #endregion - - #region Directory Names - - /// -#if NET48 - public Dictionary DirectoryNames => this.Model.DirectoryNames; -#else - public Dictionary? DirectoryNames => this.Model.DirectoryNames; -#endif - - #endregion - - #region Directory Info 1 Entries - - /// -#if NET48 - public SabreTools.Models.NCF.DirectoryInfo1Entry[] DirectoryInfo1Entries => this.Model.DirectoryInfo1Entries; -#else - public SabreTools.Models.NCF.DirectoryInfo1Entry?[]? DirectoryInfo1Entries => this.Model.DirectoryInfo1Entries; -#endif - - #endregion - - #region Directory Info 2 Entries - - /// -#if NET48 - public SabreTools.Models.NCF.DirectoryInfo2Entry[] DirectoryInfo2Entries => this.Model.DirectoryInfo2Entries; -#else - public SabreTools.Models.NCF.DirectoryInfo2Entry?[]? DirectoryInfo2Entries => this.Model.DirectoryInfo2Entries; -#endif - - #endregion - - #region Directory Copy Entries - - /// -#if NET48 - public SabreTools.Models.NCF.DirectoryCopyEntry[] DirectoryCopyEntries => this.Model.DirectoryCopyEntries; -#else - public SabreTools.Models.NCF.DirectoryCopyEntry?[]? DirectoryCopyEntries => this.Model.DirectoryCopyEntries; -#endif - - #endregion - - #region Directory Local Entries - - /// -#if NET48 - public SabreTools.Models.NCF.DirectoryLocalEntry[] DirectoryLocalEntries => this.Model.DirectoryLocalEntries; -#else - public SabreTools.Models.NCF.DirectoryLocalEntry?[]? DirectoryLocalEntries => this.Model.DirectoryLocalEntries; -#endif - - #endregion - - #region Unknown Header - - /// -#if NET48 - public uint UH_Dummy0 => this.Model.UnknownHeader.Dummy0; -#else - public uint? UH_Dummy0 => this.Model.UnknownHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint UH_Dummy1 => this.Model.UnknownHeader.Dummy1; -#else - public uint? UH_Dummy1 => this.Model.UnknownHeader?.Dummy1; -#endif - - #endregion - - #region Unknown Entries - - /// -#if NET48 - public SabreTools.Models.NCF.UnknownEntry[] UnknownEntries => this.Model.UnknownEntries; -#else - public SabreTools.Models.NCF.UnknownEntry?[]? UnknownEntries => this.Model.UnknownEntries; -#endif - - #endregion - - #region Checksum Header - - /// -#if NET48 - public uint CH_Dummy0 => this.Model.ChecksumHeader.Dummy0; -#else - public uint? CH_Dummy0 => this.Model.ChecksumHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint CH_ChecksumSize => this.Model.ChecksumHeader.ChecksumSize; -#else - public uint? CH_ChecksumSize => this.Model.ChecksumHeader?.ChecksumSize; -#endif - - #endregion - - #region Checksum Map Header - - /// -#if NET48 - public uint CMH_Dummy0 => this.Model.ChecksumMapHeader.Dummy0; -#else - public uint? CMH_Dummy0 => this.Model.ChecksumMapHeader?.Dummy0; -#endif - - /// -#if NET48 - public uint CMH_Dummy1 => this.Model.ChecksumMapHeader.Dummy1; -#else - public uint? CMH_Dummy1 => this.Model.ChecksumMapHeader?.Dummy1; -#endif - - /// -#if NET48 - public uint CMH_ItemCount => this.Model.ChecksumMapHeader.ItemCount; -#else - public uint? CMH_ItemCount => this.Model.ChecksumMapHeader?.ItemCount; -#endif - - /// -#if NET48 - public uint CMH_ChecksumCount => this.Model.ChecksumMapHeader.ChecksumCount; -#else - public uint? CMH_ChecksumCount => this.Model.ChecksumMapHeader?.ChecksumCount; -#endif - - #endregion - - #region Checksum Map Entries - - /// -#if NET48 - public SabreTools.Models.NCF.ChecksumMapEntry[] ChecksumMapEntries => this.Model.ChecksumMapEntries; -#else - public SabreTools.Models.NCF.ChecksumMapEntry?[]? ChecksumMapEntries => this.Model.ChecksumMapEntries; -#endif - - #endregion - - #region Checksum Entries - - /// -#if NET48 - public SabreTools.Models.NCF.ChecksumEntry[] ChecksumEntries => this.Model.ChecksumEntries; -#else - public SabreTools.Models.NCF.ChecksumEntry?[]? ChecksumEntries => this.Model.ChecksumEntries; -#endif - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/NewExecutable.cs b/BinaryObjectScanner.Wrappers/NewExecutable.cs index 9b377b99..429bb456 100644 --- a/BinaryObjectScanner.Wrappers/NewExecutable.cs +++ b/BinaryObjectScanner.Wrappers/NewExecutable.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Text; @@ -14,435 +13,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region MS-DOS Stub - - #region Standard Fields - - /// -#if NET48 - public string Stub_Magic => this.Model.Stub.Header.Magic; -#else - public string? Stub_Magic => this.Model.Stub?.Header?.Magic; -#endif - - /// -#if NET48 - public ushort Stub_LastPageBytes => this.Model.Stub.Header.LastPageBytes; -#else - public ushort? Stub_LastPageBytes => this.Model.Stub?.Header?.LastPageBytes; -#endif - - /// -#if NET48 - public ushort Stub_Pages => this.Model.Stub.Header.Pages; -#else - public ushort? Stub_Pages => this.Model.Stub?.Header?.Pages; -#endif - - /// -#if NET48 - public ushort Stub_RelocationItems => this.Model.Stub.Header.RelocationItems; -#else - public ushort? Stub_RelocationItems => this.Model.Stub?.Header?.RelocationItems; -#endif - - /// -#if NET48 - public ushort Stub_HeaderParagraphSize => this.Model.Stub.Header.HeaderParagraphSize; -#else - public ushort? Stub_HeaderParagraphSize => this.Model.Stub?.Header?.HeaderParagraphSize; -#endif - - /// -#if NET48 - public ushort Stub_MinimumExtraParagraphs => this.Model.Stub.Header.MinimumExtraParagraphs; -#else - public ushort? Stub_MinimumExtraParagraphs => this.Model.Stub?.Header?.MinimumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort Stub_MaximumExtraParagraphs => this.Model.Stub.Header.MaximumExtraParagraphs; -#else - public ushort? Stub_MaximumExtraParagraphs => this.Model.Stub?.Header?.MaximumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort Stub_InitialSSValue => this.Model.Stub.Header.InitialSSValue; -#else - public ushort? Stub_InitialSSValue => this.Model.Stub?.Header?.InitialSSValue; -#endif - - /// -#if NET48 - public ushort Stub_InitialSPValue => this.Model.Stub.Header.InitialSPValue; -#else - public ushort? Stub_InitialSPValue => this.Model.Stub?.Header?.InitialSPValue; -#endif - - /// -#if NET48 - public ushort Stub_Checksum => this.Model.Stub.Header.Checksum; -#else - public ushort? Stub_Checksum => this.Model.Stub?.Header?.Checksum; -#endif - - /// -#if NET48 - public ushort Stub_InitialIPValue => this.Model.Stub.Header.InitialIPValue; -#else - public ushort? Stub_InitialIPValue => this.Model.Stub?.Header?.InitialIPValue; -#endif - - /// -#if NET48 - public ushort Stub_InitialCSValue => this.Model.Stub.Header.InitialCSValue; -#else - public ushort? Stub_InitialCSValue => this.Model.Stub?.Header?.InitialCSValue; -#endif - - /// -#if NET48 - public ushort Stub_RelocationTableAddr => this.Model.Stub.Header.RelocationTableAddr; -#else - public ushort? Stub_RelocationTableAddr => this.Model.Stub?.Header?.RelocationTableAddr; -#endif - - /// -#if NET48 - public ushort Stub_OverlayNumber => this.Model.Stub.Header.OverlayNumber; -#else - public ushort? Stub_OverlayNumber => this.Model.Stub?.Header?.OverlayNumber; -#endif - - #endregion - - #region PE Extensions - - /// -#if NET48 - public ushort[] Stub_Reserved1 => this.Model.Stub.Header.Reserved1; -#else - public ushort[]? Stub_Reserved1 => this.Model.Stub?.Header?.Reserved1; -#endif - - /// -#if NET48 - public ushort Stub_OEMIdentifier => this.Model.Stub.Header.OEMIdentifier; -#else - public ushort? Stub_OEMIdentifier => this.Model.Stub?.Header?.OEMIdentifier; -#endif - - /// -#if NET48 - public ushort Stub_OEMInformation => this.Model.Stub.Header.OEMInformation; -#else - public ushort? Stub_OEMInformation => this.Model.Stub?.Header?.OEMInformation; -#endif - - /// -#if NET48 - public ushort[] Stub_Reserved2 => this.Model.Stub.Header.Reserved2; -#else - public ushort[]? Stub_Reserved2 => this.Model.Stub?.Header?.Reserved2; -#endif - - /// -#if NET48 - public uint Stub_NewExeHeaderAddr => this.Model.Stub.Header.NewExeHeaderAddr; -#else - public uint? Stub_NewExeHeaderAddr => this.Model.Stub?.Header?.NewExeHeaderAddr; -#endif - - #endregion - - #endregion - - #region Header - - /// -#if NET48 - public string Magic => this.Model.Header.Magic; -#else - public string? Magic => this.Model.Header?.Magic; -#endif - - /// -#if NET48 - public byte LinkerVersion => this.Model.Header.LinkerVersion; -#else - public byte? LinkerVersion => this.Model.Header?.LinkerVersion; -#endif - - /// -#if NET48 - public byte LinkerRevision => this.Model.Header.LinkerRevision; -#else - public byte? LinkerRevision => this.Model.Header?.LinkerRevision; -#endif - - /// -#if NET48 - public ushort EntryTableOffset => this.Model.Header.EntryTableOffset; -#else - public ushort? EntryTableOffset => this.Model.Header?.EntryTableOffset; -#endif - - /// -#if NET48 - public ushort EntryTableSize => this.Model.Header.EntryTableSize; -#else - public ushort? EntryTableSize => this.Model.Header?.EntryTableSize; -#endif - - /// -#if NET48 - public uint CrcChecksum => this.Model.Header.CrcChecksum; -#else - public uint? CrcChecksum => this.Model.Header?.CrcChecksum; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.HeaderFlag FlagWord => this.Model.Header.FlagWord; -#else - public SabreTools.Models.NewExecutable.HeaderFlag? FlagWord => this.Model.Header?.FlagWord; -#endif - - /// -#if NET48 - public ushort AutomaticDataSegmentNumber => this.Model.Header.AutomaticDataSegmentNumber; -#else - public ushort? AutomaticDataSegmentNumber => this.Model.Header?.AutomaticDataSegmentNumber; -#endif - - /// -#if NET48 - public ushort InitialHeapAlloc => this.Model.Header.InitialHeapAlloc; -#else - public ushort? InitialHeapAlloc => this.Model.Header?.InitialHeapAlloc; -#endif - - /// -#if NET48 - public ushort InitialStackAlloc => this.Model.Header.InitialStackAlloc; -#else - public ushort? InitialStackAlloc => this.Model.Header?.InitialStackAlloc; -#endif - - /// -#if NET48 - public uint InitialCSIPSetting => this.Model.Header.InitialCSIPSetting; -#else - public uint? InitialCSIPSetting => this.Model.Header?.InitialCSIPSetting; -#endif - - /// -#if NET48 - public uint InitialSSSPSetting => this.Model.Header.InitialSSSPSetting; -#else - public uint? InitialSSSPSetting => this.Model.Header?.InitialSSSPSetting; -#endif - - /// -#if NET48 - public ushort FileSegmentCount => this.Model.Header.FileSegmentCount; -#else - public ushort? FileSegmentCount => this.Model.Header?.FileSegmentCount; -#endif - - /// -#if NET48 - public ushort ModuleReferenceTableSize => this.Model.Header.ModuleReferenceTableSize; -#else - public ushort? ModuleReferenceTableSize => this.Model.Header?.ModuleReferenceTableSize; -#endif - - /// -#if NET48 - public ushort NonResidentNameTableSize => this.Model.Header.NonResidentNameTableSize; -#else - public ushort? NonResidentNameTableSize => this.Model.Header?.NonResidentNameTableSize; -#endif - - /// -#if NET48 - public ushort SegmentTableOffset => this.Model.Header.SegmentTableOffset; -#else - public ushort? SegmentTableOffset => this.Model.Header?.SegmentTableOffset; -#endif - - /// -#if NET48 - public ushort ResourceTableOffset => this.Model.Header.ResourceTableOffset; -#else - public ushort? ResourceTableOffset => this.Model.Header?.ResourceTableOffset; -#endif - - /// -#if NET48 - public ushort ResidentNameTableOffset => this.Model.Header.ResidentNameTableOffset; -#else - public ushort? ResidentNameTableOffset => this.Model.Header?.ResidentNameTableOffset; -#endif - - /// -#if NET48 - public ushort ModuleReferenceTableOffset => this.Model.Header.ModuleReferenceTableOffset; -#else - public ushort? ModuleReferenceTableOffset => this.Model.Header?.ModuleReferenceTableOffset; -#endif - - /// -#if NET48 - public ushort ImportedNamesTableOffset => this.Model.Header.ImportedNamesTableOffset; -#else - public ushort? ImportedNamesTableOffset => this.Model.Header?.ImportedNamesTableOffset; -#endif - - /// -#if NET48 - public uint NonResidentNamesTableOffset => this.Model.Header.NonResidentNamesTableOffset; -#else - public uint? NonResidentNamesTableOffset => this.Model.Header?.NonResidentNamesTableOffset; -#endif - - /// -#if NET48 - public ushort MovableEntriesCount => this.Model.Header.MovableEntriesCount; -#else - public ushort? MovableEntriesCount => this.Model.Header?.MovableEntriesCount; -#endif - - /// -#if NET48 - public ushort SegmentAlignmentShiftCount => this.Model.Header.SegmentAlignmentShiftCount; -#else - public ushort? SegmentAlignmentShiftCount => this.Model.Header?.SegmentAlignmentShiftCount; -#endif - - /// -#if NET48 - public ushort ResourceEntriesCount => this.Model.Header.ResourceEntriesCount; -#else - public ushort? ResourceEntriesCount => this.Model.Header?.ResourceEntriesCount; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.OperatingSystem TargetOperatingSystem => this.Model.Header.TargetOperatingSystem; -#else - public SabreTools.Models.NewExecutable.OperatingSystem? TargetOperatingSystem => this.Model.Header?.TargetOperatingSystem; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.OS2Flag AdditionalFlags => this.Model.Header.AdditionalFlags; -#else - public SabreTools.Models.NewExecutable.OS2Flag? AdditionalFlags => this.Model.Header?.AdditionalFlags; -#endif - - /// -#if NET48 - public ushort ReturnThunkOffset => this.Model.Header.ReturnThunkOffset; -#else - public ushort? ReturnThunkOffset => this.Model.Header?.ReturnThunkOffset; -#endif - - /// -#if NET48 - public ushort SegmentReferenceThunkOffset => this.Model.Header.SegmentReferenceThunkOffset; -#else - public ushort? SegmentReferenceThunkOffset => this.Model.Header?.SegmentReferenceThunkOffset; -#endif - - /// -#if NET48 - public ushort MinCodeSwapAreaSize => this.Model.Header.MinCodeSwapAreaSize; -#else - public ushort? MinCodeSwapAreaSize => this.Model.Header?.MinCodeSwapAreaSize; -#endif - - /// -#if NET48 - public byte WindowsSDKRevision => this.Model.Header.WindowsSDKRevision; -#else - public byte? WindowsSDKRevision => this.Model.Header?.WindowsSDKRevision; -#endif - - /// -#if NET48 - public byte WindowsSDKVersion => this.Model.Header.WindowsSDKVersion; -#else - public byte? WindowsSDKVersion => this.Model.Header?.WindowsSDKVersion; -#endif - - #endregion - - #region Tables - - /// -#if NET48 - public SabreTools.Models.NewExecutable.SegmentTableEntry[] SegmentTable => this.Model.SegmentTable; -#else - public SabreTools.Models.NewExecutable.SegmentTableEntry?[]? SegmentTable => this.Model.SegmentTable; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.ResourceTable ResourceTable => this.Model.ResourceTable; -#else - public SabreTools.Models.NewExecutable.ResourceTable? ResourceTable => this.Model.ResourceTable; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.ResidentNameTableEntry[] ResidentNameTable => this.Model.ResidentNameTable; -#else - public SabreTools.Models.NewExecutable.ResidentNameTableEntry?[]? ResidentNameTable => this.Model.ResidentNameTable; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.ModuleReferenceTableEntry[] ModuleReferenceTable => this.Model.ModuleReferenceTable; -#else - public SabreTools.Models.NewExecutable.ModuleReferenceTableEntry?[]? ModuleReferenceTable => this.Model.ModuleReferenceTable; -#endif - - /// -#if NET48 - public Dictionary ImportedNameTable => this.Model.ImportedNameTable; -#else - public Dictionary? ImportedNameTable => this.Model.ImportedNameTable; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.EntryTableBundle[] EntryTable => this.Model.EntryTable; -#else - public SabreTools.Models.NewExecutable.EntryTableBundle?[]? EntryTable => this.Model.EntryTable; -#endif - - /// -#if NET48 - public SabreTools.Models.NewExecutable.NonResidentNameTableEntry[] NonResidentNameTable => this.Model.NonResidentNameTable; -#else - public SabreTools.Models.NewExecutable.NonResidentNameTableEntry?[]? NonResidentNameTable => this.Model.NonResidentNameTable; -#endif - - #endregion - - #endregion - - #region Extension Properties - - // TODO: Determine what extension properties are needed - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/Nitro.cs b/BinaryObjectScanner.Wrappers/Nitro.cs index bd07a1e5..1929d312 100644 --- a/BinaryObjectScanner.Wrappers/Nitro.cs +++ b/BinaryObjectScanner.Wrappers/Nitro.cs @@ -12,557 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Common Header - - /// -#if NET48 - public string GameTitle => this.Model.CommonHeader.GameTitle; -#else - public string? GameTitle => this.Model.CommonHeader?.GameTitle; -#endif - - /// -#if NET48 - public uint GameCode => this.Model.CommonHeader.GameCode; -#else - public uint? GameCode => this.Model.CommonHeader?.GameCode; -#endif - - /// -#if NET48 - public string MakerCode => this.Model.CommonHeader.MakerCode; -#else - public string? MakerCode => this.Model.CommonHeader?.MakerCode; -#endif - - /// -#if NET48 - public SabreTools.Models.Nitro.Unitcode UnitCode => this.Model.CommonHeader.UnitCode; -#else - public SabreTools.Models.Nitro.Unitcode? UnitCode => this.Model.CommonHeader?.UnitCode; -#endif - - /// -#if NET48 - public byte EncryptionSeedSelect => this.Model.CommonHeader.EncryptionSeedSelect; -#else - public byte? EncryptionSeedSelect => this.Model.CommonHeader?.EncryptionSeedSelect; -#endif - - /// -#if NET48 - public byte DeviceCapacity => this.Model.CommonHeader.DeviceCapacity; -#else - public byte? DeviceCapacity => this.Model.CommonHeader?.DeviceCapacity; -#endif - - /// -#if NET48 - public byte[] Reserved1 => this.Model.CommonHeader.Reserved1; -#else - public byte[]? Reserved1 => this.Model.CommonHeader?.Reserved1; -#endif - - /// -#if NET48 - public ushort GameRevision => this.Model.CommonHeader.GameRevision; -#else - public ushort? GameRevision => this.Model.CommonHeader?.GameRevision; -#endif - - /// -#if NET48 - public byte RomVersion => this.Model.CommonHeader.RomVersion; -#else - public byte? RomVersion => this.Model.CommonHeader?.RomVersion; -#endif - - /// -#if NET48 - public byte InternalFlags => this.Model.CommonHeader.InternalFlags; -#else - public byte? InternalFlags => this.Model.CommonHeader?.InternalFlags; -#endif - - /// -#if NET48 - public uint ARM9RomOffset => this.Model.CommonHeader.ARM9RomOffset; -#else - public uint? ARM9RomOffset => this.Model.CommonHeader?.ARM9RomOffset; -#endif - - /// -#if NET48 - public uint ARM9EntryAddress => this.Model.CommonHeader.ARM9EntryAddress; -#else - public uint? ARM9EntryAddress => this.Model.CommonHeader?.ARM9EntryAddress; -#endif - - /// -#if NET48 - public uint ARM9LoadAddress => this.Model.CommonHeader.ARM9LoadAddress; -#else - public uint? ARM9LoadAddress => this.Model.CommonHeader?.ARM9LoadAddress; -#endif - - /// -#if NET48 - public uint ARM9Size => this.Model.CommonHeader.ARM9Size; -#else - public uint? ARM9Size => this.Model.CommonHeader?.ARM9Size; -#endif - - /// -#if NET48 - public uint ARM7RomOffset => this.Model.CommonHeader.ARM7RomOffset; -#else - public uint? ARM7RomOffset => this.Model.CommonHeader?.ARM7RomOffset; -#endif - - /// -#if NET48 - public uint ARM7EntryAddress => this.Model.CommonHeader.ARM7EntryAddress; -#else - public uint? ARM7EntryAddress => this.Model.CommonHeader?.ARM7EntryAddress; -#endif - - /// -#if NET48 - public uint ARM7LoadAddress => this.Model.CommonHeader.ARM7LoadAddress; -#else - public uint? ARM7LoadAddress => this.Model.CommonHeader?.ARM7LoadAddress; -#endif - - /// -#if NET48 - public uint ARM7Size => this.Model.CommonHeader.ARM7Size; -#else - public uint? ARM7Size => this.Model.CommonHeader?.ARM7Size; -#endif - - /// -#if NET48 - public uint FileNameTableOffset => this.Model.CommonHeader.FileNameTableOffset; -#else - public uint? FileNameTableOffset => this.Model.CommonHeader?.FileNameTableOffset; -#endif - - /// -#if NET48 - public uint FileNameTableLength => this.Model.CommonHeader.FileNameTableLength; -#else - public uint? FileNameTableLength => this.Model.CommonHeader?.FileNameTableLength; -#endif - - /// -#if NET48 - public uint FileAllocationTableOffset => this.Model.CommonHeader.FileAllocationTableOffset; -#else - public uint? FileAllocationTableOffset => this.Model.CommonHeader?.FileAllocationTableOffset; -#endif - - /// -#if NET48 - public uint FileAllocationTableLength => this.Model.CommonHeader.FileAllocationTableLength; -#else - public uint? FileAllocationTableLength => this.Model.CommonHeader?.FileAllocationTableLength; -#endif - - /// -#if NET48 - public uint ARM9OverlayOffset => this.Model.CommonHeader.ARM9OverlayOffset; -#else - public uint? ARM9OverlayOffset => this.Model.CommonHeader?.ARM9OverlayOffset; -#endif - - /// -#if NET48 - public uint ARM9OverlayLength => this.Model.CommonHeader.ARM9OverlayLength; -#else - public uint? ARM9OverlayLength => this.Model.CommonHeader?.ARM9OverlayLength; -#endif - - /// -#if NET48 - public uint ARM7OverlayOffset => this.Model.CommonHeader.ARM7OverlayOffset; -#else - public uint? ARM7OverlayOffset => this.Model.CommonHeader?.ARM7OverlayOffset; -#endif - - /// -#if NET48 - public uint ARM7OverlayLength => this.Model.CommonHeader.ARM7OverlayLength; -#else - public uint? ARM7OverlayLength => this.Model.CommonHeader?.ARM7OverlayLength; -#endif - - /// -#if NET48 - public uint NormalCardControlRegisterSettings => this.Model.CommonHeader.NormalCardControlRegisterSettings; -#else - public uint? NormalCardControlRegisterSettings => this.Model.CommonHeader?.NormalCardControlRegisterSettings; -#endif - - /// -#if NET48 - public uint SecureCardControlRegisterSettings => this.Model.CommonHeader.SecureCardControlRegisterSettings; -#else - public uint? SecureCardControlRegisterSettings => this.Model.CommonHeader?.SecureCardControlRegisterSettings; -#endif - - /// -#if NET48 - public uint IconBannerOffset => this.Model.CommonHeader.IconBannerOffset; -#else - public uint? IconBannerOffset => this.Model.CommonHeader?.IconBannerOffset; -#endif - - /// -#if NET48 - public ushort SecureAreaCRC => this.Model.CommonHeader.SecureAreaCRC; -#else - public ushort? SecureAreaCRC => this.Model.CommonHeader?.SecureAreaCRC; -#endif - - /// -#if NET48 - public ushort SecureTransferTimeout => this.Model.CommonHeader.SecureTransferTimeout; -#else - public ushort? SecureTransferTimeout => this.Model.CommonHeader?.SecureTransferTimeout; -#endif - - /// -#if NET48 - public uint ARM9Autoload => this.Model.CommonHeader.ARM9Autoload; -#else - public uint? ARM9Autoload => this.Model.CommonHeader?.ARM9Autoload; -#endif - - /// -#if NET48 - public uint ARM7Autoload => this.Model.CommonHeader.ARM7Autoload; -#else - public uint? ARM7Autoload => this.Model.CommonHeader?.ARM7Autoload; -#endif - - /// -#if NET48 - public byte[] SecureDisable => this.Model.CommonHeader.SecureDisable; -#else - public byte[]? SecureDisable => this.Model.CommonHeader?.SecureDisable; -#endif - - /// -#if NET48 - public uint NTRRegionRomSize => this.Model.CommonHeader.NTRRegionRomSize; -#else - public uint? NTRRegionRomSize => this.Model.CommonHeader?.NTRRegionRomSize; -#endif - - /// -#if NET48 - public uint HeaderSize => this.Model.CommonHeader.HeaderSize; -#else - public uint? HeaderSize => this.Model.CommonHeader?.HeaderSize; -#endif - - /// -#if NET48 - public byte[] Reserved2 => this.Model.CommonHeader.Reserved2; -#else - public byte[]? Reserved2 => this.Model.CommonHeader?.Reserved2; -#endif - - /// -#if NET48 - public byte[] NintendoLogo => this.Model.CommonHeader.NintendoLogo; -#else - public byte[]? NintendoLogo => this.Model.CommonHeader?.NintendoLogo; -#endif - - /// -#if NET48 - public ushort NintendoLogoCRC => this.Model.CommonHeader.NintendoLogoCRC; -#else - public ushort? NintendoLogoCRC => this.Model.CommonHeader?.NintendoLogoCRC; -#endif - - /// -#if NET48 - public ushort HeaderCRC => this.Model.CommonHeader.HeaderCRC; -#else - public ushort? HeaderCRC => this.Model.CommonHeader?.HeaderCRC; -#endif - - /// -#if NET48 - public byte[] DebuggerReserved => this.Model.CommonHeader.DebuggerReserved; -#else - public byte[]? DebuggerReserved => this.Model.CommonHeader?.DebuggerReserved; -#endif - - #endregion - - #region Extended DSi Header - - /// -#if NET48 - public uint[] GlobalMBK15Settings => this.Model.ExtendedDSiHeader?.GlobalMBK15Settings; -#else - public uint[]? GlobalMBK15Settings => this.Model.ExtendedDSiHeader?.GlobalMBK15Settings; -#endif - - /// -#if NET48 - public uint[] LocalMBK68SettingsARM9 => this.Model.ExtendedDSiHeader?.LocalMBK68SettingsARM9; -#else - public uint[]? LocalMBK68SettingsARM9 => this.Model.ExtendedDSiHeader?.LocalMBK68SettingsARM9; -#endif - - /// -#if NET48 - public uint[] LocalMBK68SettingsARM7 => this.Model.ExtendedDSiHeader?.LocalMBK68SettingsARM7; -#else - public uint[]? LocalMBK68SettingsARM7 => this.Model.ExtendedDSiHeader?.LocalMBK68SettingsARM7; -#endif - - /// - public uint? GlobalMBK9Setting => this.Model.ExtendedDSiHeader?.GlobalMBK9Setting; - - /// - public uint? RegionFlags => this.Model.ExtendedDSiHeader?.RegionFlags; - - /// - public uint? AccessControl => this.Model.ExtendedDSiHeader?.AccessControl; - - /// - public uint? ARM7SCFGEXTMask => this.Model.ExtendedDSiHeader?.ARM7SCFGEXTMask; - - /// - public uint? ReservedFlags => this.Model.ExtendedDSiHeader?.ReservedFlags; - - /// - public uint? ARM9iRomOffset => this.Model.ExtendedDSiHeader?.ARM9iRomOffset; - - /// - public uint? Reserved3 => this.Model.ExtendedDSiHeader?.Reserved3; - - /// - public uint? ARM9iLoadAddress => this.Model.ExtendedDSiHeader?.ARM9iLoadAddress; - - /// - public uint? ARM9iSize => this.Model.ExtendedDSiHeader?.ARM9iSize; - - /// - public uint? ARM7iRomOffset => this.Model.ExtendedDSiHeader?.ARM7iRomOffset; - - /// - public uint? Reserved4 => this.Model.ExtendedDSiHeader?.Reserved4; - - /// - public uint? ARM7iLoadAddress => this.Model.ExtendedDSiHeader?.ARM7iLoadAddress; - - /// - public uint? ARM7iSize => this.Model.ExtendedDSiHeader?.ARM7iSize; - - /// - public uint? DigestNTRRegionOffset => this.Model.ExtendedDSiHeader?.DigestNTRRegionOffset; - - /// - public uint? DigestNTRRegionLength => this.Model.ExtendedDSiHeader?.DigestNTRRegionLength; - - /// - public uint? DigestTWLRegionOffset => this.Model.ExtendedDSiHeader?.DigestTWLRegionOffset; - - /// - public uint? DigestTWLRegionLength => this.Model.ExtendedDSiHeader?.DigestTWLRegionLength; - - /// - public uint? DigestSectorHashtableRegionOffset => this.Model.ExtendedDSiHeader?.DigestSectorHashtableRegionOffset; - - /// - public uint? DigestSectorHashtableRegionLength => this.Model.ExtendedDSiHeader?.DigestSectorHashtableRegionLength; - - /// - public uint? DigestBlockHashtableRegionOffset => this.Model.ExtendedDSiHeader?.DigestBlockHashtableRegionOffset; - - /// - public uint? DigestBlockHashtableRegionLength => this.Model.ExtendedDSiHeader?.DigestBlockHashtableRegionLength; - - /// - public uint? DigestSectorSize => this.Model.ExtendedDSiHeader?.DigestSectorSize; - - /// - public uint? DigestBlockSectorCount => this.Model.ExtendedDSiHeader?.DigestBlockSectorCount; - - /// - public uint? IconBannerSize => this.Model.ExtendedDSiHeader?.IconBannerSize; - - /// - public uint? Unknown1 => this.Model.ExtendedDSiHeader?.Unknown1; - - /// - public uint? ModcryptArea1Offset => this.Model.ExtendedDSiHeader?.ModcryptArea1Offset; - - /// - public uint? ModcryptArea1Size => this.Model.ExtendedDSiHeader?.ModcryptArea1Size; - - /// - public uint? ModcryptArea2Offset => this.Model.ExtendedDSiHeader?.ModcryptArea2Offset; - - /// - public uint? ModcryptArea2Size => this.Model.ExtendedDSiHeader?.ModcryptArea2Size; - - /// -#if NET48 - public byte[] TitleID => this.Model.ExtendedDSiHeader?.TitleID; -#else - public byte[]? TitleID => this.Model.ExtendedDSiHeader?.TitleID; -#endif - - /// - public uint? DSiWarePublicSavSize => this.Model.ExtendedDSiHeader?.DSiWarePublicSavSize; - - /// - public uint? DSiWarePrivateSavSize => this.Model.ExtendedDSiHeader?.DSiWarePrivateSavSize; - - /// -#if NET48 - public byte[] ReservedZero => this.Model.ExtendedDSiHeader?.ReservedZero; -#else - public byte[]? ReservedZero => this.Model.ExtendedDSiHeader?.ReservedZero; -#endif - - /// -#if NET48 - public byte[] Unknown2 => this.Model.ExtendedDSiHeader?.Unknown2; -#else - public byte[]? Unknown2 => this.Model.ExtendedDSiHeader?.Unknown2; -#endif - - /// -#if NET48 - public byte[] ARM9WithSecureAreaSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM9WithSecureAreaSHA1HMACHash; -#else - public byte[]? ARM9WithSecureAreaSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM9WithSecureAreaSHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] ARM7SHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM7SHA1HMACHash; -#else - public byte[]? ARM7SHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM7SHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] DigestMasterSHA1HMACHash => this.Model.ExtendedDSiHeader?.DigestMasterSHA1HMACHash; -#else - public byte[]? DigestMasterSHA1HMACHash => this.Model.ExtendedDSiHeader?.DigestMasterSHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] BannerSHA1HMACHash => this.Model.ExtendedDSiHeader?.BannerSHA1HMACHash; -#else - public byte[]? BannerSHA1HMACHash => this.Model.ExtendedDSiHeader?.BannerSHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] ARM9iDecryptedSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM9iDecryptedSHA1HMACHash; -#else - public byte[]? ARM9iDecryptedSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM9iDecryptedSHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] ARM7iDecryptedSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM7iDecryptedSHA1HMACHash; -#else - public byte[]? ARM7iDecryptedSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM7iDecryptedSHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] Reserved5 => this.Model.ExtendedDSiHeader?.Reserved5; -#else - public byte[]? Reserved5 => this.Model.ExtendedDSiHeader?.Reserved5; -#endif - - /// -#if NET48 - public byte[] ARM9NoSecureAreaSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM9NoSecureAreaSHA1HMACHash; -#else - public byte[]? ARM9NoSecureAreaSHA1HMACHash => this.Model.ExtendedDSiHeader?.ARM9NoSecureAreaSHA1HMACHash; -#endif - - /// -#if NET48 - public byte[] Reserved6 => this.Model.ExtendedDSiHeader?.Reserved6; -#else - public byte[]? Reserved6 => this.Model.ExtendedDSiHeader?.Reserved6; -#endif - - /// -#if NET48 - public byte[] ReservedAndUnchecked => this.Model.ExtendedDSiHeader?.ReservedAndUnchecked; -#else - public byte[]? ReservedAndUnchecked => this.Model.ExtendedDSiHeader?.ReservedAndUnchecked; -#endif - - /// -#if NET48 - public byte[] RSASignature => this.Model.ExtendedDSiHeader?.RSASignature; -#else - public byte[]? RSASignature => this.Model.ExtendedDSiHeader?.RSASignature; -#endif - - #endregion - - #region Secure Area - - /// -#if NET48 - public byte[] SecureArea => this.Model.SecureArea; -#else - public byte[]? SecureArea => this.Model.SecureArea; -#endif - - #endregion - - #region Name Table - - /// -#if NET48 - public SabreTools.Models.Nitro.FolderAllocationTableEntry[] FolderAllocationTable => this.Model.NameTable.FolderAllocationTable; -#else - public SabreTools.Models.Nitro.FolderAllocationTableEntry?[]? FolderAllocationTable => this.Model.NameTable?.FolderAllocationTable; -#endif - - /// -#if NET48 - public SabreTools.Models.Nitro.NameListEntry[] NameList => this.Model.NameTable.NameList; -#else - public SabreTools.Models.Nitro.NameListEntry?[]? NameList => this.Model.NameTable?.NameList; -#endif - - #endregion - - #region File Allocation Table - - /// -#if NET48 - public SabreTools.Models.Nitro.FileAllocationTableEntry[] FileAllocationTable => this.Model.FileAllocationTable; -#else - public SabreTools.Models.Nitro.FileAllocationTableEntry?[]? FileAllocationTable => this.Model.FileAllocationTable; -#endif - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/PAK.cs b/BinaryObjectScanner.Wrappers/PAK.cs index 21782f77..d07eb6d2 100644 --- a/BinaryObjectScanner.Wrappers/PAK.cs +++ b/BinaryObjectScanner.Wrappers/PAK.cs @@ -12,52 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint DirectoryOffset => this.Model.Header.DirectoryOffset; -#else - public uint? DirectoryOffset => this.Model.Header?.DirectoryOffset; -#endif - - /// -#if NET48 - public uint DirectoryLength => this.Model.Header.DirectoryLength; -#else - public uint? DirectoryLength => this.Model.Header?.DirectoryLength; -#endif - - #endregion - - #region Directory Items - - /// -#if NET48 - public SabreTools.Models.PAK.DirectoryItem[] DirectoryItems => this.Model.DirectoryItems; -#else - public SabreTools.Models.PAK.DirectoryItem?[]? DirectoryItems => this.Model.DirectoryItems; -#endif - - #endregion - - #endregion - - #region Extension Properties - - // TODO: Figure out what extensions are needed - - #endregion - #region Constructors /// @@ -160,12 +114,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no directory items - if (DirectoryItems == null || DirectoryItems.Length == 0) + if (this.Model.DirectoryItems == null || this.Model.DirectoryItems.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < DirectoryItems.Length; i++) + for (int i = 0; i < this.Model.DirectoryItems.Length; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -182,15 +136,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractFile(int index, string outputDirectory) { // If we have no directory items - if (DirectoryItems == null || DirectoryItems.Length == 0) + if (this.Model.DirectoryItems == null || this.Model.DirectoryItems.Length == 0) return false; // If the directory item index is invalid - if (index < 0 || index >= DirectoryItems.Length) + if (index < 0 || index >= this.Model.DirectoryItems.Length) return false; // Get the directory item - var directoryItem = DirectoryItems[index]; + var directoryItem = this.Model.DirectoryItems[index]; if (directoryItem == null) return false; diff --git a/BinaryObjectScanner.Wrappers/PFF.cs b/BinaryObjectScanner.Wrappers/PFF.cs index 7c8d6555..d9161276 100644 --- a/BinaryObjectScanner.Wrappers/PFF.cs +++ b/BinaryObjectScanner.Wrappers/PFF.cs @@ -12,85 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public uint HeaderSize => this.Model.Header.HeaderSize; -#else - public uint? HeaderSize => this.Model.Header?.HeaderSize; -#endif - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint NumberOfFiles => this.Model.Header.NumberOfFiles; -#else - public uint? NumberOfFiles => this.Model.Header?.NumberOfFiles; -#endif - - /// -#if NET48 - public uint FileSegmentSize => this.Model.Header.FileSegmentSize; -#else - public uint? FileSegmentSize => this.Model.Header?.FileSegmentSize; -#endif - - /// -#if NET48 - public uint FileListOffset => this.Model.Header.FileListOffset; -#else - public uint? FileListOffset => this.Model.Header?.FileListOffset; -#endif - - #endregion - - #region Segments - - /// -#if NET48 - public SabreTools.Models.PFF.Segment[] Segments => this.Model.Segments; -#else - public SabreTools.Models.PFF.Segment?[]? Segments => this.Model.Segments; -#endif - - #endregion - - #region Footer - - /// -#if NET48 - public uint SystemIP => this.Model.Footer.SystemIP; -#else - public uint? SystemIP => this.Model.Footer?.SystemIP; -#endif - - /// -#if NET48 - public uint Reserved => this.Model.Footer.Reserved; -#else - public uint? Reserved => this.Model.Footer?.Reserved; -#endif - - /// -#if NET48 - public string KingTag => this.Model.Footer.KingTag; -#else - public string? KingTag => this.Model.Footer?.KingTag; -#endif - - #endregion - - #endregion - #region Constructors /// @@ -179,12 +100,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no segments - if (Segments == null || Segments.Length == 0) + if (this.Model.Segments == null || this.Model.Segments.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < Segments.Length; i++) + for (int i = 0; i < this.Model.Segments.Length; i++) { allExtracted &= ExtractSegment(i, outputDirectory); } @@ -201,15 +122,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractSegment(int index, string outputDirectory) { // If we have no segments - if (NumberOfFiles == 0 || Segments == null || Segments.Length == 0) + if (this.Model.Header?.NumberOfFiles == null || this.Model.Header.NumberOfFiles == 0 || this.Model.Segments == null || this.Model.Segments.Length == 0) return false; // If we have an invalid index - if (index < 0 || index >= Segments.Length) + if (index < 0 || index >= this.Model.Segments.Length) return false; // Get the segment information - var file = Segments[index]; + var file = this.Model.Segments[index]; if (file == null) return false; diff --git a/BinaryObjectScanner.Wrappers/PlayJAudioFile.cs b/BinaryObjectScanner.Wrappers/PlayJAudioFile.cs index 4d81528f..becac0da 100644 --- a/BinaryObjectScanner.Wrappers/PlayJAudioFile.cs +++ b/BinaryObjectScanner.Wrappers/PlayJAudioFile.cs @@ -12,295 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Audio Header - - /// -#if NET48 - public uint Signature => this.Model.Header.Signature; -#else - public uint? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint Version => this.Model.Header.Version; -#else - public uint? Version => this.Model.Header?.Version; -#endif - - #region V1 Only - - /// - public uint? V1_TrackID => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.TrackID; - - /// - public uint? V1_UnknownOffset1 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.UnknownOffset1; - - /// - public uint? V1_UnknownOffset2 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.UnknownOffset2; - - /// - public uint? V1_UnknownOffset3 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.UnknownOffset3; - - /// - public uint? V1_Unknown1 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.Unknown1; - - /// - public uint? V1_Unknown2 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.Unknown2; - - /// - public uint? V1_Year => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.Year; - - /// - public uint? V1_TrackNumber => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.TrackNumber; - - /// - public SabreTools.Models.PlayJ.Subgenre? V1_Subgenre => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.Subgenre; - - /// - public uint? V1_Duration => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV1)?.Duration; - - #endregion - - #region V2 Only - - /// - public uint? V2_Unknown1 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown1; - - /// - public uint? V2_Unknown2 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown2; - - /// - public uint? V2_Unknown3 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown3; - - /// - public uint? V2_Unknown4 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown4; - - /// - public uint? V2_Unknown5 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown5; - - /// - public uint? V2_Unknown6 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown6; - - /// - public uint? V2_UnknownOffset1 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.UnknownOffset1; - - /// - public uint? V2_Unknown7 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown7; - - /// - public uint? V2_Unknown8 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown8; - - /// - public uint? V2_Unknown9 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown9; - - /// - public uint? V2_UnknownOffset2 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.UnknownOffset2; - - /// - public uint? V2_Unknown10 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown10; - - /// - public uint? V2_Unknown11 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown11; - - /// - public uint? V2_Unknown12 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown12; - - /// - public uint? V2_Unknown13 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown13; - - /// - public uint? V2_Unknown14 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown14; - - /// - public uint? V2_Unknown15 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown15; - - /// - public uint? V2_Unknown16 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown16; - - /// - public uint? V2_Unknown17 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown17; - - /// - public uint? V2_TrackID => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.TrackID; - - /// - public uint? V2_Year => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Year; - - /// - public uint? V2_TrackNumber => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.TrackNumber; - - /// - public uint? V2_Unknown18 => (Model.Header as SabreTools.Models.PlayJ.AudioHeaderV2)?.Unknown18; - - #endregion - - /// -#if NET48 - public ushort TrackLength => this.Model.Header.TrackLength; -#else - public ushort? TrackLength => this.Model.Header?.TrackLength; -#endif - - /// -#if NET48 - public string Track => this.Model.Header.Track; -#else - public string? Track => this.Model.Header?.Track; -#endif - - /// -#if NET48 - public ushort ArtistLength => this.Model.Header.ArtistLength; -#else - public ushort? ArtistLength => this.Model.Header?.ArtistLength; -#endif - - /// -#if NET48 - public string Artist => this.Model.Header.Artist; -#else - public string? Artist => this.Model.Header?.Artist; -#endif - - /// -#if NET48 - public ushort AlbumLength => this.Model.Header.AlbumLength; -#else - public ushort? AlbumLength => this.Model.Header?.AlbumLength; -#endif - - /// -#if NET48 - public string Album => this.Model.Header.Album; -#else - public string? Album => this.Model.Header?.Album; -#endif - - /// -#if NET48 - public ushort WriterLength => this.Model.Header.WriterLength; -#else - public ushort? WriterLength => this.Model.Header?.WriterLength; -#endif - - /// -#if NET48 - public string Writer => this.Model.Header.Writer; -#else - public string? Writer => this.Model.Header?.Writer; -#endif - - /// -#if NET48 - public ushort PublisherLength => this.Model.Header.PublisherLength; -#else - public ushort? PublisherLength => this.Model.Header?.PublisherLength; -#endif - - /// -#if NET48 - public string Publisher => this.Model.Header.Publisher; -#else - public string? Publisher => this.Model.Header?.Publisher; -#endif - - /// -#if NET48 - public ushort LabelLength => this.Model.Header.LabelLength; -#else - public ushort? LabelLength => this.Model.Header?.LabelLength; -#endif - - /// -#if NET48 - public string Label => this.Model.Header.Label; -#else - public string? Label => this.Model.Header?.Label; -#endif - - /// -#if NET48 - public ushort CommentsLength => this.Model.Header.CommentsLength; -#else - public ushort? CommentsLength => this.Model.Header?.CommentsLength; -#endif - - /// -#if NET48 - public string Comments => this.Model.Header.Comments; -#else - public string? Comments => this.Model.Header?.Comments; -#endif - - #endregion - - #region Unknown Block 1 - - /// -#if NET48 - public uint UB1_Length => this.Model.UnknownBlock1.Length; -#else - public uint? UB1_Length => this.Model.UnknownBlock1?.Length; -#endif - - /// -#if NET48 - public byte[] UB1_Data => this.Model.UnknownBlock1.Data; -#else - public byte[]? UB1_Data => this.Model.UnknownBlock1?.Data; -#endif - - #endregion - - #region V1 Only - - #region Unknown Value 2 - - /// - public uint UnknownValue2 => this.Model.UnknownValue2; - - #endregion - - #region Unknown Block 3 - - /// -#if NET48 - public byte[] UB3_Data => this.Model.UnknownBlock3.Data; -#else - public byte[]? UB3_Data => this.Model.UnknownBlock3?.Data; -#endif - - #endregion - - #endregion - - #region V2 Only - - #region Data Files Count - - /// - public uint DataFilesCount => this.Model.DataFilesCount; - - #endregion - - #region Unknown Block 3 - - /// -#if NET48 - public SabreTools.Models.PlayJ.DataFile[] DataFiles => this.Model.DataFiles; -#else - public SabreTools.Models.PlayJ.DataFile?[]? DataFiles => this.Model.DataFiles; -#endif - - #endregion - - #endregion - - #endregion - #region Constructors /// diff --git a/BinaryObjectScanner.Wrappers/PortableExecutable.cs b/BinaryObjectScanner.Wrappers/PortableExecutable.cs index 8be9c174..3ccabd6e 100644 --- a/BinaryObjectScanner.Wrappers/PortableExecutable.cs +++ b/BinaryObjectScanner.Wrappers/PortableExecutable.cs @@ -17,635 +17,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region MS-DOS Stub - - #region Standard Fields - - /// -#if NET48 - public string Stub_Magic => this.Model.Stub.Header.Magic; -#else - public string? Stub_Magic => this.Model.Stub?.Header?.Magic; -#endif - - /// -#if NET48 - public ushort Stub_LastPageBytes => this.Model.Stub.Header.LastPageBytes; -#else - public ushort? Stub_LastPageBytes => this.Model.Stub?.Header?.LastPageBytes; -#endif - - /// -#if NET48 - public ushort Stub_Pages => this.Model.Stub.Header.Pages; -#else - public ushort? Stub_Pages => this.Model.Stub?.Header?.Pages; -#endif - - /// -#if NET48 - public ushort Stub_RelocationItems => this.Model.Stub.Header.RelocationItems; -#else - public ushort? Stub_RelocationItems => this.Model.Stub?.Header?.RelocationItems; -#endif - - /// -#if NET48 - public ushort Stub_HeaderParagraphSize => this.Model.Stub.Header.HeaderParagraphSize; -#else - public ushort? Stub_HeaderParagraphSize => this.Model.Stub?.Header?.HeaderParagraphSize; -#endif - - /// -#if NET48 - public ushort Stub_MinimumExtraParagraphs => this.Model.Stub.Header.MinimumExtraParagraphs; -#else - public ushort? Stub_MinimumExtraParagraphs => this.Model.Stub?.Header?.MinimumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort Stub_MaximumExtraParagraphs => this.Model.Stub.Header.MaximumExtraParagraphs; -#else - public ushort? Stub_MaximumExtraParagraphs => this.Model.Stub?.Header?.MaximumExtraParagraphs; -#endif - - /// -#if NET48 - public ushort Stub_InitialSSValue => this.Model.Stub.Header.InitialSSValue; -#else - public ushort? Stub_InitialSSValue => this.Model.Stub?.Header?.InitialSSValue; -#endif - - /// -#if NET48 - public ushort Stub_InitialSPValue => this.Model.Stub.Header.InitialSPValue; -#else - public ushort? Stub_InitialSPValue => this.Model.Stub?.Header?.InitialSPValue; -#endif - - /// -#if NET48 - public ushort Stub_Checksum => this.Model.Stub.Header.Checksum; -#else - public ushort? Stub_Checksum => this.Model.Stub?.Header?.Checksum; -#endif - - /// -#if NET48 - public ushort Stub_InitialIPValue => this.Model.Stub.Header.InitialIPValue; -#else - public ushort? Stub_InitialIPValue => this.Model.Stub?.Header?.InitialIPValue; -#endif - - /// -#if NET48 - public ushort Stub_InitialCSValue => this.Model.Stub.Header.InitialCSValue; -#else - public ushort? Stub_InitialCSValue => this.Model.Stub?.Header?.InitialCSValue; -#endif - - /// -#if NET48 - public ushort Stub_RelocationTableAddr => this.Model.Stub.Header.RelocationTableAddr; -#else - public ushort? Stub_RelocationTableAddr => this.Model.Stub?.Header?.RelocationTableAddr; -#endif - - /// -#if NET48 - public ushort Stub_OverlayNumber => this.Model.Stub.Header.OverlayNumber; -#else - public ushort? Stub_OverlayNumber => this.Model.Stub?.Header?.OverlayNumber; -#endif - - #endregion - - #region PE Extensions - - /// -#if NET48 - public ushort[] Stub_Reserved1 => this.Model.Stub.Header.Reserved1; -#else - public ushort[]? Stub_Reserved1 => this.Model.Stub?.Header?.Reserved1; -#endif - - /// -#if NET48 - public ushort Stub_OEMIdentifier => this.Model.Stub.Header.OEMIdentifier; -#else - public ushort? Stub_OEMIdentifier => this.Model.Stub?.Header?.OEMIdentifier; -#endif - - /// -#if NET48 - public ushort Stub_OEMInformation => this.Model.Stub.Header.OEMInformation; -#else - public ushort? Stub_OEMInformation => this.Model.Stub?.Header?.OEMInformation; -#endif - - /// -#if NET48 - public ushort[] Stub_Reserved2 => this.Model.Stub.Header.Reserved2; -#else - public ushort[]? Stub_Reserved2 => this.Model.Stub?.Header?.Reserved2; -#endif - - /// -#if NET48 - public uint Stub_NewExeHeaderAddr => this.Model.Stub.Header.NewExeHeaderAddr; -#else - public uint? Stub_NewExeHeaderAddr => this.Model.Stub?.Header?.NewExeHeaderAddr; -#endif - - #endregion - - #endregion - - /// -#if NET48 - public string Signature => this.Model.Signature; -#else - public string? Signature => this.Model.Signature; -#endif - - #region COFF File Header - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.MachineType Machine => this.Model.COFFFileHeader.Machine; -#else - public SabreTools.Models.PortableExecutable.MachineType? Machine => this.Model.COFFFileHeader?.Machine; -#endif - - /// -#if NET48 - public ushort NumberOfSections => this.Model.COFFFileHeader.NumberOfSections; -#else - public ushort? NumberOfSections => this.Model.COFFFileHeader?.NumberOfSections; -#endif - - /// -#if NET48 - public uint TimeDateStamp => this.Model.COFFFileHeader.TimeDateStamp; -#else - public uint? TimeDateStamp => this.Model.COFFFileHeader?.TimeDateStamp; -#endif - - /// -#if NET48 - public uint PointerToSymbolTable => this.Model.COFFFileHeader.PointerToSymbolTable; -#else - public uint? PointerToSymbolTable => this.Model.COFFFileHeader?.PointerToSymbolTable; -#endif - - /// -#if NET48 - public uint NumberOfSymbols => this.Model.COFFFileHeader.NumberOfSymbols; -#else - public uint? NumberOfSymbols => this.Model.COFFFileHeader?.NumberOfSymbols; -#endif - - /// -#if NET48 - public uint SizeOfOptionalHeader => this.Model.COFFFileHeader.SizeOfOptionalHeader; -#else - public uint? SizeOfOptionalHeader => this.Model.COFFFileHeader?.SizeOfOptionalHeader; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.Characteristics Characteristics => this.Model.COFFFileHeader.Characteristics; -#else - public SabreTools.Models.PortableExecutable.Characteristics? Characteristics => this.Model.COFFFileHeader?.Characteristics; -#endif - - #endregion - - #region Optional Header - - #region Standard Fields - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber OH_Magic => this.Model.OptionalHeader.Magic; -#else - public SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber? OH_Magic => this.Model.OptionalHeader?.Magic; -#endif - - /// -#if NET48 - public byte OH_MajorLinkerVersion => this.Model.OptionalHeader.MajorLinkerVersion; -#else - public byte? OH_MajorLinkerVersion => this.Model.OptionalHeader?.MajorLinkerVersion; -#endif - - /// -#if NET48 - public byte OH_MinorLinkerVersion => this.Model.OptionalHeader.MinorLinkerVersion; -#else - public byte? OH_MinorLinkerVersion => this.Model.OptionalHeader?.MinorLinkerVersion; -#endif - - /// -#if NET48 - public uint OH_SizeOfCode => this.Model.OptionalHeader.SizeOfCode; -#else - public uint? OH_SizeOfCode => this.Model.OptionalHeader?.SizeOfCode; -#endif - - /// -#if NET48 - public uint OH_SizeOfInitializedData => this.Model.OptionalHeader.SizeOfInitializedData; -#else - public uint? OH_SizeOfInitializedData => this.Model.OptionalHeader?.SizeOfInitializedData; -#endif - - /// -#if NET48 - public uint OH_SizeOfUninitializedData => this.Model.OptionalHeader.SizeOfUninitializedData; -#else - public uint? OH_SizeOfUninitializedData => this.Model.OptionalHeader?.SizeOfUninitializedData; -#endif - - /// -#if NET48 - public uint OH_AddressOfEntryPoint => this.Model.OptionalHeader.AddressOfEntryPoint; -#else - public uint? OH_AddressOfEntryPoint => this.Model.OptionalHeader?.AddressOfEntryPoint; -#endif - - /// -#if NET48 - public uint OH_BaseOfCode => this.Model.OptionalHeader.BaseOfCode; -#else - public uint? OH_BaseOfCode => this.Model.OptionalHeader?.BaseOfCode; -#endif - - /// - public uint? OH_BaseOfData => this.Model.OptionalHeader?.Magic == SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber.PE32 - ? (uint?)Model.OptionalHeader.BaseOfData - : null; - - #endregion - - #region Windows-Specific Fields - - /// - public ulong OH_ImageBase => this.Model.OptionalHeader?.Magic == SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber.PE32 - ? Model.OptionalHeader.ImageBase_PE32 - : Model.OptionalHeader?.ImageBase_PE32Plus ?? 0; - - /// -#if NET48 - public uint OH_SectionAlignment => this.Model.OptionalHeader.SectionAlignment; -#else - public uint? OH_SectionAlignment => this.Model.OptionalHeader?.SectionAlignment; -#endif - - /// -#if NET48 - public uint OH_FileAlignment => this.Model.OptionalHeader.FileAlignment; -#else - public uint? OH_FileAlignment => this.Model.OptionalHeader?.FileAlignment; -#endif - - /// -#if NET48 - public ushort OH_MajorOperatingSystemVersion => this.Model.OptionalHeader.MajorOperatingSystemVersion; -#else - public ushort? OH_MajorOperatingSystemVersion => this.Model.OptionalHeader?.MajorOperatingSystemVersion; -#endif - - /// -#if NET48 - public ushort OH_MinorOperatingSystemVersion => this.Model.OptionalHeader.MinorOperatingSystemVersion; -#else - public ushort? OH_MinorOperatingSystemVersion => this.Model.OptionalHeader?.MinorOperatingSystemVersion; -#endif - - /// -#if NET48 - public ushort OH_MajorImageVersion => this.Model.OptionalHeader.MajorImageVersion; -#else - public ushort? OH_MajorImageVersion => this.Model.OptionalHeader?.MajorImageVersion; -#endif - - /// -#if NET48 - public ushort OH_MinorImageVersion => this.Model.OptionalHeader.MinorImageVersion; -#else - public ushort? OH_MinorImageVersion => this.Model.OptionalHeader?.MinorImageVersion; -#endif - - /// -#if NET48 - public ushort OH_MajorSubsystemVersion => this.Model.OptionalHeader.MajorSubsystemVersion; -#else - public ushort? OH_MajorSubsystemVersion => this.Model.OptionalHeader?.MajorSubsystemVersion; -#endif - - /// -#if NET48 - public ushort OH_MinorSubsystemVersion => this.Model.OptionalHeader.MinorSubsystemVersion; -#else - public ushort? OH_MinorSubsystemVersion => this.Model.OptionalHeader?.MinorSubsystemVersion; -#endif - - /// -#if NET48 - public uint OH_Win32VersionValue => this.Model.OptionalHeader.Win32VersionValue; -#else - public uint? OH_Win32VersionValue => this.Model.OptionalHeader?.Win32VersionValue; -#endif - - /// -#if NET48 - public uint OH_SizeOfImage => this.Model.OptionalHeader.SizeOfImage; -#else - public uint? OH_SizeOfImage => this.Model.OptionalHeader?.SizeOfImage; -#endif - - /// -#if NET48 - public uint OH_SizeOfHeaders => this.Model.OptionalHeader.SizeOfHeaders; -#else - public uint? OH_SizeOfHeaders => this.Model.OptionalHeader?.SizeOfHeaders; -#endif - - /// -#if NET48 - public uint OH_CheckSum => this.Model.OptionalHeader.CheckSum; -#else - public uint? OH_CheckSum => this.Model.OptionalHeader?.CheckSum; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.WindowsSubsystem OH_Subsystem => this.Model.OptionalHeader.Subsystem; -#else - public SabreTools.Models.PortableExecutable.WindowsSubsystem? OH_Subsystem => this.Model.OptionalHeader?.Subsystem; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DllCharacteristics OH_DllCharacteristics => this.Model.OptionalHeader.DllCharacteristics; -#else - public SabreTools.Models.PortableExecutable.DllCharacteristics? OH_DllCharacteristics => this.Model.OptionalHeader?.DllCharacteristics; -#endif - - /// - public ulong OH_SizeOfStackReserve => this.Model.OptionalHeader?.Magic == SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber.PE32 - ? Model.OptionalHeader.SizeOfStackReserve_PE32 - : Model.OptionalHeader?.SizeOfStackReserve_PE32Plus ?? 0; - - /// - public ulong OH_SizeOfStackCommit => this.Model.OptionalHeader?.Magic == SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber.PE32 - ? Model.OptionalHeader.SizeOfStackCommit_PE32 - : Model.OptionalHeader?.SizeOfStackCommit_PE32Plus ?? 0; - - /// - public ulong OH_SizeOfHeapReserve => this.Model.OptionalHeader?.Magic == SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber.PE32 - ? Model.OptionalHeader.SizeOfHeapReserve_PE32 - : Model.OptionalHeader?.SizeOfHeapReserve_PE32Plus ?? 0; - - /// - public ulong OH_SizeOfHeapCommit => this.Model.OptionalHeader?.Magic == SabreTools.Models.PortableExecutable.OptionalHeaderMagicNumber.PE32 - ? Model.OptionalHeader.SizeOfHeapCommit_PE32 - : Model.OptionalHeader?.SizeOfHeapCommit_PE32Plus ?? 0; - - /// -#if NET48 - public uint OH_LoaderFlags => this.Model.OptionalHeader.LoaderFlags; -#else - public uint? OH_LoaderFlags => this.Model.OptionalHeader?.LoaderFlags; -#endif - - /// -#if NET48 - public uint OH_NumberOfRvaAndSizes => this.Model.OptionalHeader.NumberOfRvaAndSizes; -#else - public uint? OH_NumberOfRvaAndSizes => this.Model.OptionalHeader?.NumberOfRvaAndSizes; -#endif - - #endregion - - #region Data Directories - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_ExportTable => this.Model.OptionalHeader.ExportTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_ExportTable => this.Model.OptionalHeader?.ExportTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_ImportTable => this.Model.OptionalHeader.ImportTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_ImportTable => this.Model.OptionalHeader?.ImportTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_ResourceTable => this.Model.OptionalHeader.ResourceTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_ResourceTable => this.Model.OptionalHeader?.ResourceTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_ExceptionTable => this.Model.OptionalHeader.ExceptionTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_ExceptionTable => this.Model.OptionalHeader?.ExceptionTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_CertificateTable => this.Model.OptionalHeader.CertificateTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_CertificateTable => this.Model.OptionalHeader?.CertificateTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_BaseRelocationTable => this.Model.OptionalHeader.BaseRelocationTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_BaseRelocationTable => this.Model.OptionalHeader?.BaseRelocationTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_Debug => this.Model.OptionalHeader.Debug; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_Debug => this.Model.OptionalHeader?.Debug; -#endif - - /// -#if NET48 - public ulong OH_Architecture => this.Model.OptionalHeader.Architecture; -#else - public ulong? OH_Architecture => this.Model.OptionalHeader?.Architecture; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_GlobalPtr => this.Model.OptionalHeader.GlobalPtr; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_GlobalPtr => this.Model.OptionalHeader?.GlobalPtr; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_ThreadLocalStorageTable => this.Model.OptionalHeader.ThreadLocalStorageTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_ThreadLocalStorageTable => this.Model.OptionalHeader?.ThreadLocalStorageTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_LoadConfigTable => this.Model.OptionalHeader.LoadConfigTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_LoadConfigTable => this.Model.OptionalHeader?.LoadConfigTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_BoundImport => this.Model.OptionalHeader.BoundImport; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_BoundImport => this.Model.OptionalHeader?.BoundImport; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_ImportAddressTable => this.Model.OptionalHeader.ImportAddressTable; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_ImportAddressTable => this.Model.OptionalHeader?.ImportAddressTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_DelayImportDescriptor => this.Model.OptionalHeader.DelayImportDescriptor; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_DelayImportDescriptor => this.Model.OptionalHeader?.DelayImportDescriptor; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DataDirectory OH_CLRRuntimeHeader => this.Model.OptionalHeader.CLRRuntimeHeader; -#else - public SabreTools.Models.PortableExecutable.DataDirectory? OH_CLRRuntimeHeader => this.Model.OptionalHeader?.CLRRuntimeHeader; -#endif - - /// -#if NET48 - public ulong OH_Reserved => this.Model.OptionalHeader.Reserved; -#else - public ulong? OH_Reserved => this.Model.OptionalHeader?.Reserved; -#endif - - #endregion - - #endregion - - #region Tables - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.SectionHeader[] SectionTable => this.Model.SectionTable; -#else - public SabreTools.Models.PortableExecutable.SectionHeader?[]? SectionTable => this.Model.SectionTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.COFFSymbolTableEntry[] COFFSymbolTable => this.Model.COFFSymbolTable; -#else - public SabreTools.Models.PortableExecutable.COFFSymbolTableEntry?[]? COFFSymbolTable => this.Model.COFFSymbolTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.COFFStringTable COFFStringTable => this.Model.COFFStringTable; -#else - public SabreTools.Models.PortableExecutable.COFFStringTable? COFFStringTable => this.Model.COFFStringTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.AttributeCertificateTableEntry[] AttributeCertificateTable => this.Model.AttributeCertificateTable; -#else - public SabreTools.Models.PortableExecutable.AttributeCertificateTableEntry?[]? AttributeCertificateTable => this.Model.AttributeCertificateTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DelayLoadDirectoryTable DelayLoadDirectoryTable => this.Model.DelayLoadDirectoryTable; -#else - public SabreTools.Models.PortableExecutable.DelayLoadDirectoryTable? DelayLoadDirectoryTable => this.Model.DelayLoadDirectoryTable; -#endif - - #endregion - - #region Sections - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.BaseRelocationBlock[] BaseRelocationTable => this.Model.BaseRelocationTable; -#else - public SabreTools.Models.PortableExecutable.BaseRelocationBlock?[]? BaseRelocationTable => this.Model.BaseRelocationTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.DebugTable DebugTable => this.Model.DebugTable; -#else - public SabreTools.Models.PortableExecutable.DebugTable? DebugTable => this.Model.DebugTable; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.ExportTable ExportTable => this.Model.ExportTable; -#else - public SabreTools.Models.PortableExecutable.ExportTable? ExportTable => this.Model.ExportTable; -#endif - - /// -#if NET48 - public string[] ExportNameTable => this.Model.ExportTable?.ExportNameTable?.Strings; -#else - public string[]? ExportNameTable => this.Model.ExportTable?.ExportNameTable?.Strings; -#endif - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.ImportTable ImportTable => this.Model.ImportTable; -#else - public SabreTools.Models.PortableExecutable.ImportTable? ImportTable => this.Model.ImportTable; -#endif - - /// -#if NET48 - public string[] ImportHintNameTable => this.Model.ImportTable?.HintNameTable != null -#else - public string?[]? ImportHintNameTable => this.Model.ImportTable?.HintNameTable != null -#endif - ? Model.ImportTable.HintNameTable.Select(entry => entry?.Name).ToArray() - : null; - - /// -#if NET48 - public SabreTools.Models.PortableExecutable.ResourceDirectoryTable ResourceDirectoryTable => this.Model.ResourceDirectoryTable; -#else - public SabreTools.Models.PortableExecutable.ResourceDirectoryTable? ResourceDirectoryTable => this.Model.ResourceDirectoryTable; -#endif - - #endregion - - #endregion - #region Extension Properties /// @@ -668,16 +39,12 @@ namespace BinaryObjectScanner.Wrappers // TODO: Don't scan the known header data as well // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // Populate the raw header padding data based on the source -#if NET48 - uint headerStartAddress = Stub_NewExeHeaderAddr; -#else - uint headerStartAddress = Stub_NewExeHeaderAddr ?? 0; -#endif - uint firstSectionAddress = SectionTable + uint headerStartAddress = this.Model.Stub?.Header?.NewExeHeaderAddr ?? 0; + uint firstSectionAddress = this.Model.SectionTable .Select(s => s?.PointerToRawData ?? 0) .Where(s => s != 0) .OrderBy(s => s) @@ -711,16 +78,12 @@ namespace BinaryObjectScanner.Wrappers // TODO: Don't scan the known header data as well // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // Populate the raw header padding data based on the source -#if NET48 - uint headerStartAddress = Stub_NewExeHeaderAddr; -#else - uint headerStartAddress = Stub_NewExeHeaderAddr ?? 0; -#endif - uint firstSectionAddress = SectionTable + uint headerStartAddress = this.Model.Stub?.Header?.NewExeHeaderAddr ?? 0; + uint firstSectionAddress = this.Model.SectionTable .Select(s => s?.PointerToRawData ?? 0) .Where(s => s != 0) .OrderBy(s => s) @@ -748,27 +111,21 @@ namespace BinaryObjectScanner.Wrappers lock (_sourceDataLock) { // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; -#if NET6_0_OR_GREATER // If the address is missing - if (OH_AddressOfEntryPoint == null) + if (this.Model.OptionalHeader?.AddressOfEntryPoint == null) return null; -#endif // If we have no entry point -#if NET48 - int entryPointAddress = (int)OH_AddressOfEntryPoint.ConvertVirtualAddress(SectionTable); -#else - int entryPointAddress = (int)OH_AddressOfEntryPoint.Value.ConvertVirtualAddress(SectionTable); -#endif + int entryPointAddress = (int)this.Model.OptionalHeader.AddressOfEntryPoint.ConvertVirtualAddress(this.Model.SectionTable); if (entryPointAddress == 0) return null; // If the entry point matches with the start of a section, use that int entryPointSection = FindEntryPointSectionIndex(); - if (entryPointSection >= 0 && OH_AddressOfEntryPoint == SectionTable[entryPointSection]?.VirtualAddress) + if (entryPointSection >= 0 && this.Model.OptionalHeader.AddressOfEntryPoint == this.Model.SectionTable[entryPointSection]?.VirtualAddress) return GetSectionData(entryPointSection); // If we already have cached data, just use that immediately @@ -804,27 +161,27 @@ namespace BinaryObjectScanner.Wrappers return -1; // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return -1; // If we have certificate data, use that as the end - if (OH_CertificateTable != null) + if (this.Model.OptionalHeader?.CertificateTable != null) { - int certificateTableAddress = (int)OH_CertificateTable.VirtualAddress.ConvertVirtualAddress(SectionTable); + int certificateTableAddress = (int)this.Model.OptionalHeader.CertificateTable.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (certificateTableAddress != 0 && certificateTableAddress < endOfFile) endOfFile = certificateTableAddress; } // Search through all sections and find the furthest a section goes int endOfSectionData = -1; - foreach (var section in SectionTable) + foreach (var section in this.Model.SectionTable) { // If we have an invalid section if (section == null) continue; // If we have an invalid section address - int sectionAddress = (int)section.VirtualAddress.ConvertVirtualAddress(SectionTable); + int sectionAddress = (int)section.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (sectionAddress == 0) continue; @@ -879,27 +236,27 @@ namespace BinaryObjectScanner.Wrappers return null; // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // If we have certificate data, use that as the end - if (OH_CertificateTable != null) + if (this.Model.OptionalHeader?.CertificateTable != null) { - int certificateTableAddress = (int)OH_CertificateTable.VirtualAddress.ConvertVirtualAddress(SectionTable); + int certificateTableAddress = (int)this.Model.OptionalHeader.CertificateTable.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (certificateTableAddress != 0 && certificateTableAddress < endOfFile) endOfFile = certificateTableAddress; } // Search through all sections and find the furthest a section goes int endOfSectionData = -1; - foreach (var section in SectionTable) + foreach (var section in this.Model.SectionTable) { // If we have an invalid section if (section == null) continue; // If we have an invalid section address - int sectionAddress = (int)section.VirtualAddress.ConvertVirtualAddress(SectionTable); + int sectionAddress = (int)section.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (sectionAddress == 0) continue; @@ -961,28 +318,27 @@ namespace BinaryObjectScanner.Wrappers return null; // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // If we have certificate data, use that as the end - if (OH_CertificateTable != null) + if (this.Model.OptionalHeader?.CertificateTable != null) { - var certificateTable = OH_CertificateTable; - int certificateTableAddress = (int)certificateTable.VirtualAddress.ConvertVirtualAddress(SectionTable); + int certificateTableAddress = (int)this.Model.OptionalHeader.CertificateTable.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (certificateTableAddress != 0 && certificateTableAddress < endOfFile) endOfFile = certificateTableAddress; } // Search through all sections and find the furthest a section goes int endOfSectionData = -1; - foreach (var section in SectionTable) + foreach (var section in this.Model.SectionTable) { // If we have an invalid section if (section == null) continue; // If we have an invalid section address - int sectionAddress = (int)section.VirtualAddress.ConvertVirtualAddress(SectionTable); + int sectionAddress = (int)section.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (sectionAddress == 0) continue; @@ -1039,14 +395,14 @@ namespace BinaryObjectScanner.Wrappers return _sectionNames; // If there are no sections - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // Otherwise, build and return the cached array - _sectionNames = new string[SectionTable.Length]; + _sectionNames = new string[this.Model.SectionTable.Length]; for (int i = 0; i < _sectionNames.Length; i++) { - var section = SectionTable[i]; + var section = this.Model.SectionTable[i]; if (section == null) continue; @@ -1085,14 +441,12 @@ namespace BinaryObjectScanner.Wrappers if (_stubExecutableData != null) return _stubExecutableData; -#if NET6_0_OR_GREATER - if (Stub_NewExeHeaderAddr == null) + if (this.Model.Stub?.Header?.NewExeHeaderAddr == null) return null; -#endif // Populate the raw stub executable data based on the source int endOfStubHeader = 0x40; - int lengthOfStubExecutableData = (int)Stub_NewExeHeaderAddr - endOfStubHeader; + int lengthOfStubExecutableData = (int)this.Model.Stub.Header.NewExeHeaderAddr - endOfStubHeader; _stubExecutableData = ReadFromDataSource(endOfStubHeader, lengthOfStubExecutableData); // Cache and return the stub executable data, even if null @@ -1119,8 +473,8 @@ namespace BinaryObjectScanner.Wrappers return _debugData; // If we have no resource table, just return - if (DebugTable?.DebugDirectoryTable == null - || DebugTable.DebugDirectoryTable.Length == 0) + if (this.Model.DebugTable?.DebugDirectoryTable == null + || this.Model.DebugTable.DebugDirectoryTable.Length == 0) return null; // Otherwise, build and return the cached dictionary @@ -1148,13 +502,13 @@ namespace BinaryObjectScanner.Wrappers return _resourceData; // If we have no resource table, just return - if (OH_ResourceTable == null - || OH_ResourceTable.VirtualAddress == 0 - || ResourceDirectoryTable == null) + if (this.Model.OptionalHeader?.ResourceTable == null + || this.Model.OptionalHeader.ResourceTable.VirtualAddress == 0 + || this.Model.ResourceDirectoryTable == null) return null; // Otherwise, build and return the cached dictionary - ParseResourceDirectoryTable(ResourceDirectoryTable, types: new List()); + ParseResourceDirectoryTable(this.Model.ResourceDirectoryTable, types: new List()); return _resourceData; } } @@ -1826,13 +1180,13 @@ namespace BinaryObjectScanner.Wrappers private void ParseDebugTable() { // If there is no debug table - if (DebugTable?.DebugDirectoryTable == null) + if (this.Model.DebugTable?.DebugDirectoryTable == null) return; // Loop through all debug table entries - for (int i = 0; i < DebugTable.DebugDirectoryTable.Length; i++) + for (int i = 0; i < this.Model.DebugTable.DebugDirectoryTable.Length; i++) { - var entry = DebugTable.DebugDirectoryTable[i]; + var entry = this.Model.DebugTable.DebugDirectoryTable[i]; if (entry == null) continue; @@ -2270,28 +1624,23 @@ namespace BinaryObjectScanner.Wrappers public int FindEntryPointSectionIndex() { // If the section table is missing - if (SectionTable == null) + if (this.Model.SectionTable == null) return -1; -#if NET6_0_OR_GREATER // If the address is missing - if (OH_AddressOfEntryPoint == null) + if (this.Model.OptionalHeader?.AddressOfEntryPoint == null) return -1; -#endif // If we don't have an entry point + if (this.Model.OptionalHeader.AddressOfEntryPoint.ConvertVirtualAddress(this.Model.SectionTable) == 0) + return -1; + + // Otherwise, find the section it exists within #if NET48 - if (OH_AddressOfEntryPoint.ConvertVirtualAddress(SectionTable) == 0) - return -1; - - // Otherwise, find the section it exists within - return OH_AddressOfEntryPoint.ContainingSectionIndex(SectionTable); + return this.Model.OptionalHeader.AddressOfEntryPoint.ContainingSectionIndex(this.Model.SectionTable); #else - if (OH_AddressOfEntryPoint.Value.ConvertVirtualAddress(SectionTable) == 0) - return -1; - // Otherwise, find the section it exists within - return OH_AddressOfEntryPoint.Value.ContainingSectionIndex(SectionTable + return this.Model.OptionalHeader.AddressOfEntryPoint.ContainingSectionIndex(this.Model.SectionTable .Where(sh => sh != null) .Cast() .ToArray()); @@ -2311,7 +1660,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist @@ -2324,7 +1673,7 @@ namespace BinaryObjectScanner.Wrappers return null; // Return the section - return SectionTable[index]; + return this.Model.SectionTable[index]; } /// @@ -2340,7 +1689,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist @@ -2353,7 +1702,7 @@ namespace BinaryObjectScanner.Wrappers return null; // Return the section - return SectionTable[index]; + return this.Model.SectionTable[index]; } /// @@ -2368,15 +1717,15 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionTable == null || !SectionTable.Any()) + if (this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist - if (index < 0 || index >= SectionTable.Length) + if (index < 0 || index >= this.Model.SectionTable.Length) return null; // Return the section - return SectionTable[index]; + return this.Model.SectionTable[index]; } /// @@ -2392,7 +1741,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist @@ -2417,7 +1766,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist @@ -2441,19 +1790,19 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist - if (index < 0 || index >= SectionTable.Length) + if (index < 0 || index >= this.Model.SectionTable.Length) return null; // Get the section data from the table - var section = SectionTable[index]; + var section = this.Model.SectionTable[index]; if (section == null) return null; - uint address = section.VirtualAddress.ConvertVirtualAddress(SectionTable); + uint address = section.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (address == 0) return null; @@ -2495,7 +1844,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist @@ -2520,7 +1869,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist @@ -2544,19 +1893,19 @@ namespace BinaryObjectScanner.Wrappers #endif { // If we have no sections - if (SectionNames == null || !SectionNames.Any() || SectionTable == null || !SectionTable.Any()) + if (SectionNames == null || !SectionNames.Any() || this.Model.SectionTable == null || !this.Model.SectionTable.Any()) return null; // If the section doesn't exist - if (index < 0 || index >= SectionTable.Length) + if (index < 0 || index >= this.Model.SectionTable.Length) return null; // Get the section data from the table - var section = SectionTable[index]; + var section = this.Model.SectionTable[index]; if (section == null) return null; - uint address = section.VirtualAddress.ConvertVirtualAddress(SectionTable); + uint address = section.VirtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (address == 0) return null; @@ -2601,7 +1950,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If the table doesn't exist - if (index < 0 || index > 16) + if (this.Model.OptionalHeader == null || index < 0 || index > 16) return null; // Get the virtual address and size from the entries @@ -2609,64 +1958,64 @@ namespace BinaryObjectScanner.Wrappers switch (index) { case 1: - virtualAddress = OH_ExportTable?.VirtualAddress ?? 0; - size = OH_ExportTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ExportTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ExportTable?.Size ?? 0; break; case 2: - virtualAddress = OH_ImportTable?.VirtualAddress ?? 0; - size = OH_ImportTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ImportTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ImportTable?.Size ?? 0; break; case 3: - virtualAddress = OH_ResourceTable?.VirtualAddress ?? 0; - size = OH_ResourceTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ResourceTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ResourceTable?.Size ?? 0; break; case 4: - virtualAddress = OH_ExceptionTable?.VirtualAddress ?? 0; - size = OH_ExceptionTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ExceptionTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ExceptionTable?.Size ?? 0; break; case 5: - virtualAddress = OH_CertificateTable?.VirtualAddress ?? 0; - size = OH_CertificateTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.CertificateTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.CertificateTable?.Size ?? 0; break; case 6: - virtualAddress = OH_BaseRelocationTable?.VirtualAddress ?? 0; - size = OH_BaseRelocationTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.BaseRelocationTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.BaseRelocationTable?.Size ?? 0; break; case 7: - virtualAddress = OH_Debug?.VirtualAddress ?? 0; - size = OH_Debug?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.Debug?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.Debug?.Size ?? 0; break; case 8: // Architecture Table virtualAddress = 0; size = 0; break; case 9: - virtualAddress = OH_GlobalPtr?.VirtualAddress ?? 0; - size = OH_GlobalPtr?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.GlobalPtr?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.GlobalPtr?.Size ?? 0; break; case 10: - virtualAddress = OH_ThreadLocalStorageTable?.VirtualAddress ?? 0; - size = OH_ThreadLocalStorageTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ThreadLocalStorageTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ThreadLocalStorageTable?.Size ?? 0; break; case 11: - virtualAddress = OH_LoadConfigTable?.VirtualAddress ?? 0; - size = OH_LoadConfigTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.LoadConfigTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.LoadConfigTable?.Size ?? 0; break; case 12: - virtualAddress = OH_BoundImport?.VirtualAddress ?? 0; - size = OH_BoundImport?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.BoundImport?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.BoundImport?.Size ?? 0; break; case 13: - virtualAddress = OH_ImportAddressTable?.VirtualAddress ?? 0; - size = OH_ImportAddressTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ImportAddressTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ImportAddressTable?.Size ?? 0; break; case 14: - virtualAddress = OH_DelayImportDescriptor?.VirtualAddress ?? 0; - size = OH_DelayImportDescriptor?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.DelayImportDescriptor?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.DelayImportDescriptor?.Size ?? 0; break; case 15: - virtualAddress = OH_CLRRuntimeHeader?.VirtualAddress ?? 0; - size = OH_CLRRuntimeHeader?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.CLRRuntimeHeader?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.CLRRuntimeHeader?.Size ?? 0; break; case 16: // Reserved virtualAddress = 0; @@ -2675,11 +2024,11 @@ namespace BinaryObjectScanner.Wrappers } // If there is no section table - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // Get the physical address from the virtual one - uint address = virtualAddress.ConvertVirtualAddress(SectionTable); + uint address = virtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (address == 0 || size == 0) return null; @@ -2718,7 +2067,7 @@ namespace BinaryObjectScanner.Wrappers #endif { // If the table doesn't exist - if (index < 0 || index > 16) + if (this.Model.OptionalHeader == null || index < 0 || index > 16) return null; // Get the virtual address and size from the entries @@ -2726,64 +2075,64 @@ namespace BinaryObjectScanner.Wrappers switch (index) { case 1: - virtualAddress = OH_ExportTable?.VirtualAddress ?? 0; - size = OH_ExportTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ExportTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ExportTable?.Size ?? 0; break; case 2: - virtualAddress = OH_ImportTable?.VirtualAddress ?? 0; - size = OH_ImportTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ImportTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ImportTable?.Size ?? 0; break; case 3: - virtualAddress = OH_ResourceTable?.VirtualAddress ?? 0; - size = OH_ResourceTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ResourceTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ResourceTable?.Size ?? 0; break; case 4: - virtualAddress = OH_ExceptionTable?.VirtualAddress ?? 0; - size = OH_ExceptionTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ExceptionTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ExceptionTable?.Size ?? 0; break; case 5: - virtualAddress = OH_CertificateTable?.VirtualAddress ?? 0; - size = OH_CertificateTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.CertificateTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.CertificateTable?.Size ?? 0; break; case 6: - virtualAddress = OH_BaseRelocationTable?.VirtualAddress ?? 0; - size = OH_BaseRelocationTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.BaseRelocationTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.BaseRelocationTable?.Size ?? 0; break; case 7: - virtualAddress = OH_Debug?.VirtualAddress ?? 0; - size = OH_Debug?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.Debug?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.Debug?.Size ?? 0; break; case 8: // Architecture Table virtualAddress = 0; size = 0; break; case 9: - virtualAddress = OH_GlobalPtr?.VirtualAddress ?? 0; - size = OH_GlobalPtr?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.GlobalPtr?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.GlobalPtr?.Size ?? 0; break; case 10: - virtualAddress = OH_ThreadLocalStorageTable?.VirtualAddress ?? 0; - size = OH_ThreadLocalStorageTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ThreadLocalStorageTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ThreadLocalStorageTable?.Size ?? 0; break; case 11: - virtualAddress = OH_LoadConfigTable?.VirtualAddress ?? 0; - size = OH_LoadConfigTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.LoadConfigTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.LoadConfigTable?.Size ?? 0; break; case 12: - virtualAddress = OH_BoundImport?.VirtualAddress ?? 0; - size = OH_BoundImport?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.BoundImport?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.BoundImport?.Size ?? 0; break; case 13: - virtualAddress = OH_ImportAddressTable?.VirtualAddress ?? 0; - size = OH_ImportAddressTable?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.ImportAddressTable?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.ImportAddressTable?.Size ?? 0; break; case 14: - virtualAddress = OH_DelayImportDescriptor?.VirtualAddress ?? 0; - size = OH_DelayImportDescriptor?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.DelayImportDescriptor?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.DelayImportDescriptor?.Size ?? 0; break; case 15: - virtualAddress = OH_CLRRuntimeHeader?.VirtualAddress ?? 0; - size = OH_CLRRuntimeHeader?.Size ?? 0; + virtualAddress = this.Model.OptionalHeader.CLRRuntimeHeader?.VirtualAddress ?? 0; + size = this.Model.OptionalHeader.CLRRuntimeHeader?.Size ?? 0; break; case 16: // Reserved virtualAddress = 0; @@ -2792,11 +2141,11 @@ namespace BinaryObjectScanner.Wrappers } // If there is no section table - if (SectionTable == null) + if (this.Model.SectionTable == null) return null; // Get the physical address from the virtual one - uint address = virtualAddress.ConvertVirtualAddress(SectionTable); + uint address = virtualAddress.ConvertVirtualAddress(this.Model.SectionTable); if (address == 0 || size == 0) return null; diff --git a/BinaryObjectScanner.Wrappers/Quantum.cs b/BinaryObjectScanner.Wrappers/Quantum.cs index 0d69a715..35c5aac3 100644 --- a/BinaryObjectScanner.Wrappers/Quantum.cs +++ b/BinaryObjectScanner.Wrappers/Quantum.cs @@ -12,70 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public byte MajorVersion => this.Model.Header.MajorVersion; -#else - public byte? MajorVersion => this.Model.Header?.MajorVersion; -#endif - - /// -#if NET48 - public byte MinorVersion => this.Model.Header.MinorVersion; -#else - public byte? MinorVersion => this.Model.Header?.MinorVersion; -#endif - - /// -#if NET48 - public ushort FileCount => this.Model.Header.FileCount; -#else - public ushort? FileCount => this.Model.Header?.FileCount; -#endif - - /// -#if NET48 - public byte TableSize => this.Model.Header.TableSize; -#else - public byte? TableSize => this.Model.Header?.TableSize; -#endif - - /// -#if NET48 - public byte CompressionFlags => this.Model.Header.CompressionFlags; -#else - public byte? CompressionFlags => this.Model.Header?.CompressionFlags; -#endif - - #endregion - - #region File List - - /// -#if NET48 - public SabreTools.Models.Quantum.FileDescriptor[] FileList => this.Model.FileList; -#else - public SabreTools.Models.Quantum.FileDescriptor?[]? FileList => this.Model.FileList; -#endif - - #endregion - - /// - public long CompressedDataOffset => this.Model.CompressedDataOffset; - - #endregion - #region Constructors /// @@ -166,12 +102,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no files - if (FileList == null || FileList.Length == 0) + if (this.Model.FileList == null || this.Model.FileList.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < FileList.Length; i++) + for (int i = 0; i < this.Model.FileList.Length; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -188,18 +124,18 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractFile(int index, string outputDirectory) { // If we have no files - if (FileCount == 0 || FileList == null || FileList.Length == 0) + if (this.Model.Header == null || this.Model.Header.FileCount == 0 || this.Model.FileList == null || this.Model.FileList.Length == 0) return false; // If we have an invalid index - if (index < 0 || index >= FileList.Length) + if (index < 0 || index >= this.Model.FileList.Length) return false; // Get the file information - var fileDescriptor = FileList[index]; + var fileDescriptor = this.Model.FileList[index]; // Read the entire compressed data - int compressedDataOffset = (int)CompressedDataOffset; + int compressedDataOffset = (int)this.Model.CompressedDataOffset; int compressedDataLength = GetEndOfFile() - compressedDataOffset; #if NET48 byte[] compressedData = ReadFromDataSource(compressedDataOffset, compressedDataLength); diff --git a/BinaryObjectScanner.Wrappers/SGA.cs b/BinaryObjectScanner.Wrappers/SGA.cs index a9df300b..de208a01 100644 --- a/BinaryObjectScanner.Wrappers/SGA.cs +++ b/BinaryObjectScanner.Wrappers/SGA.cs @@ -15,382 +15,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public ushort MajorVersion => this.Model.Header.MajorVersion; -#else - public ushort? MajorVersion => this.Model.Header?.MajorVersion; -#endif - - /// -#if NET48 - public ushort MinorVersion => this.Model.Header.MinorVersion; -#else - public ushort? MinorVersion => this.Model.Header?.MinorVersion; -#endif - - /// -#if NET48 - public byte[] FileMD5 -#else - public byte[]? FileMD5 -#endif - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Header as SabreTools.Models.SGA.Header4)?.FileMD5; - case 5: return (Model.Header as SabreTools.Models.SGA.Header4)?.FileMD5; - default: return null; - }; - } - } - - /// -#if NET48 - public string Name -#else - public string? Name -#endif - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Header as SabreTools.Models.SGA.Header4)?.Name; - case 5: return (Model.Header as SabreTools.Models.SGA.Header4)?.Name; - case 6: return (Model.Header as SabreTools.Models.SGA.Header6)?.Name; - case 7: return (Model.Header as SabreTools.Models.SGA.Header6)?.Name; - default: return null; - }; - } - } - - /// -#if NET48 - public byte[] HeaderMD5 -#else - public byte[]? HeaderMD5 -#endif - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Header as SabreTools.Models.SGA.Header4)?.HeaderMD5; - case 5: return (Model.Header as SabreTools.Models.SGA.Header4)?.HeaderMD5; - default: return null; - }; - } - } - - /// - public uint? HeaderLength - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Header as SabreTools.Models.SGA.Header4)?.HeaderLength; - case 5: return (Model.Header as SabreTools.Models.SGA.Header4)?.HeaderLength; - case 6: return (Model.Header as SabreTools.Models.SGA.Header6)?.HeaderLength; - case 7: return (Model.Header as SabreTools.Models.SGA.Header6)?.HeaderLength; - default: return null; - }; - } - } - - /// - public uint? FileDataOffset - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Header as SabreTools.Models.SGA.Header4)?.FileDataOffset; - case 5: return (Model.Header as SabreTools.Models.SGA.Header4)?.FileDataOffset; - case 6: return (Model.Header as SabreTools.Models.SGA.Header6)?.FileDataOffset; - case 7: return (Model.Header as SabreTools.Models.SGA.Header6)?.FileDataOffset; - default: return null; - }; - } - } - - /// - public uint? Dummy0 - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Header as SabreTools.Models.SGA.Header4)?.Dummy0; - case 5: return (Model.Header as SabreTools.Models.SGA.Header4)?.Dummy0; - case 6: return (Model.Header as SabreTools.Models.SGA.Header6)?.Dummy0; - case 7: return (Model.Header as SabreTools.Models.SGA.Header6)?.Dummy0; - default: return null; - }; - } - } - - #endregion - - #region Directory - - #region Directory Header - - /// - public uint? SectionOffset - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.SectionOffset; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.SectionOffset; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.SectionOffset; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.SectionOffset; - default: return null; - }; - } - } - - /// - public uint? SectionCount - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.SectionCount; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.SectionCount; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.SectionCount; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.SectionCount; - default: return null; - }; - } - } - - /// - public uint? FolderOffset - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.FolderOffset; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.FolderOffset; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.FolderOffset; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.FolderOffset; - default: return null; - }; - } - } - - /// - public uint? FolderCount - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.FolderCount; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.FolderCount; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.FolderCount; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.FolderCount; - default: return null; - }; - } - } - - /// - public uint? FileOffset - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.FileOffset; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.FileOffset; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.FileOffset; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.FileOffset; - default: return null; - }; - } - } - - /// - public uint? FileCount - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.FileCount; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.FileCount; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.FileCount; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.FileCount; - default: return null; - }; - } - } - - /// - public uint? StringTableOffset - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.StringTableOffset; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.StringTableOffset; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.StringTableOffset; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.StringTableOffset; - default: return null; - }; - } - } - - /// - public uint? StringTableCount - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.DirectoryHeader?.StringTableCount; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.DirectoryHeader?.StringTableCount; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.DirectoryHeader?.StringTableCount; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.StringTableCount; - default: return null; - }; - } - } - - /// - public uint? HashTableOffset - { - get - { - switch (MajorVersion) - { - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.HashTableOffset; - default: return null; - }; - } - } - - /// - public uint? BlockSize - { - get - { - switch (MajorVersion) - { - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.DirectoryHeader?.BlockSize; - default: return null; - }; - } - } - - #endregion - - #region Sections - - /// -#if NET48 - public object[] Sections -#else - public object?[]? Sections -#endif - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.Sections; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.Sections; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.Sections; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.Sections; - default: return null; - }; - } - } - - #endregion - - #region Folders - - /// -#if NET48 - public object[] Folders -#else - public object?[]? Folders -#endif - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.Folders; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.Folders; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.Folders; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.Folders; - default: return null; - }; - } - } - - #endregion - - #region Files - - /// -#if NET48 - public object[] Files -#else - public object?[]? Files -#endif - { - get - { - switch (MajorVersion) - { - case 4: return (Model.Directory as SabreTools.Models.SGA.Directory4)?.Files; - case 5: return (Model.Directory as SabreTools.Models.SGA.Directory5)?.Files; - case 6: return (Model.Directory as SabreTools.Models.SGA.Directory6)?.Files; - case 7: return (Model.Directory as SabreTools.Models.SGA.Directory7)?.Files; - default: return null; - }; - } - } - - #endregion - - // TODO: Figure out how to deal with all of the parts of the directory - // TODO: Should anything be passed through? - - #endregion - - #endregion - - #region Extension Properties - - // TODO: Figure out what extension oroperties are needed - - #endregion - #region Constructors /// @@ -492,13 +116,24 @@ namespace BinaryObjectScanner.Wrappers /// True if all files extracted, false otherwise public bool ExtractAll(string outputDirectory) { + // Get the number of files + int filesLength; + switch (this.Model.Header?.MajorVersion) + { + case 4: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory4)?.Files?.Length ?? 0; break; + case 5: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory5)?.Files?.Length ?? 0; break; + case 6: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory6)?.Files?.Length ?? 0; break; + case 7: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory7)?.Files?.Length ?? 0; break; + default: return false; + } + // If we have no files - if (Files == null || Files.Length == 0) + if (filesLength == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < Files.Length; i++) + for (int i = 0; i < filesLength; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -514,16 +149,40 @@ namespace BinaryObjectScanner.Wrappers /// True if the file extracted, false otherwise public bool ExtractFile(int index, string outputDirectory) { + // Get the number of files + int filesLength; + switch (this.Model.Header?.MajorVersion) + { + case 4: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory4)?.Files?.Length ?? 0; break; + case 5: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory5)?.Files?.Length ?? 0; break; + case 6: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory6)?.Files?.Length ?? 0; break; + case 7: filesLength = (Model.Directory as SabreTools.Models.SGA.Directory7)?.Files?.Length ?? 0; break; + default: return false; + } + // If we have no files - if (Files == null || Files.Length == 0) + if (filesLength == 0) return false; // If the files index is invalid - if (index < 0 || index >= Files.Length) + if (index < 0 || index >= filesLength) return false; // Get the files - var file = Files[index]; +#if NET48 + object file; +#else + object? file; +#endif + switch (this.Model.Header?.MajorVersion) + { + case 4: file = (Model.Directory as SabreTools.Models.SGA.Directory4)?.Files?[index]; break; + case 5: file = (Model.Directory as SabreTools.Models.SGA.Directory5)?.Files?[index]; break; + case 6: file = (Model.Directory as SabreTools.Models.SGA.Directory6)?.Files?[index]; break; + case 7: file = (Model.Directory as SabreTools.Models.SGA.Directory7)?.Files?[index]; break; + default: return false; + } + if (file == null) return false; @@ -533,7 +192,7 @@ namespace BinaryObjectScanner.Wrappers #else string? filename; #endif - switch (MajorVersion) + switch (this.Model.Header?.MajorVersion) { case 4: case 5: filename = (file as SabreTools.Models.SGA.File4)?.Name; break; @@ -555,19 +214,26 @@ namespace BinaryObjectScanner.Wrappers #else object? folder; #endif - switch (MajorVersion) + switch (this.Model.Header?.MajorVersion) { - case 4: folder = (Folders as SabreTools.Models.SGA.Folder4[])?.FirstOrDefault(f => index >= f.FileStartIndex && index <= f.FileEndIndex); break; - case 5: - case 6: - case 7: folder = (Folders as SabreTools.Models.SGA.Folder5[])?.FirstOrDefault(f => index >= f.FileStartIndex && index <= f.FileEndIndex); break; +#if NET48 + case 4: folder = (Model.Directory as SabreTools.Models.SGA.Directory4)?.Folders?.FirstOrDefault(f => index >= f.FileStartIndex && index <= f.FileEndIndex); break; + case 5: folder = (Model.Directory as SabreTools.Models.SGA.Directory5)?.Folders?.FirstOrDefault(f => index >= f.FileStartIndex && index <= f.FileEndIndex); break; + case 6: folder = (Model.Directory as SabreTools.Models.SGA.Directory6)?.Folders?.FirstOrDefault(f => index >= f.FileStartIndex && index <= f.FileEndIndex); break; + case 7: folder = (Model.Directory as SabreTools.Models.SGA.Directory7)?.Folders?.FirstOrDefault(f => index >= f.FileStartIndex && index <= f.FileEndIndex); break; +#else + case 4: folder = (Model.Directory as SabreTools.Models.SGA.Directory4)?.Folders?.FirstOrDefault(f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex); break; + case 5: folder = (Model.Directory as SabreTools.Models.SGA.Directory5)?.Folders?.FirstOrDefault(f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex); break; + case 6: folder = (Model.Directory as SabreTools.Models.SGA.Directory6)?.Folders?.FirstOrDefault(f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex); break; + case 7: folder = (Model.Directory as SabreTools.Models.SGA.Directory7)?.Folders?.FirstOrDefault(f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex); break; +#endif default: return false; } // If we have a parent folder if (folder != null) { - switch (MajorVersion) + switch (this.Model.Header?.MajorVersion) { case 4: parentNames.Add((folder as SabreTools.Models.SGA.Folder4)?.Name); break; case 5: @@ -585,7 +251,7 @@ namespace BinaryObjectScanner.Wrappers // Get the file offset long fileOffset; - switch (MajorVersion) + switch (this.Model.Header?.MajorVersion) { case 4: case 5: fileOffset = (file as SabreTools.Models.SGA.File4)?.Offset ?? 0; break; @@ -595,11 +261,18 @@ namespace BinaryObjectScanner.Wrappers } // Adjust the file offset - fileOffset += FileDataOffset ?? 0; + switch (this.Model.Header?.MajorVersion) + { + case 4: fileOffset += (Model.Header as SabreTools.Models.SGA.Header4)?.FileDataOffset ?? 0; break; + case 5: fileOffset += (Model.Header as SabreTools.Models.SGA.Header4)?.FileDataOffset ?? 0; break; + case 6: fileOffset += (Model.Header as SabreTools.Models.SGA.Header6)?.FileDataOffset ?? 0; break; + case 7: fileOffset += (Model.Header as SabreTools.Models.SGA.Header6)?.FileDataOffset ?? 0; break; + default: return false; + }; // Get the file sizes long fileSize, outputFileSize; - switch (MajorVersion) + switch (this.Model.Header?.MajorVersion) { case 4: case 5: diff --git a/BinaryObjectScanner.Wrappers/VBSP.cs b/BinaryObjectScanner.Wrappers/VBSP.cs index b3cfa1d7..c4052f84 100644 --- a/BinaryObjectScanner.Wrappers/VBSP.cs +++ b/BinaryObjectScanner.Wrappers/VBSP.cs @@ -13,44 +13,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public int Version => this.Model.Header.Version; -#else - public int? Version => this.Model.Header?.Version; -#endif - - /// -#if NET48 - public SabreTools.Models.VBSP.Lump[] Lumps => this.Model.Header.Lumps; -#else - public SabreTools.Models.VBSP.Lump?[]? Lumps => this.Model.Header?.Lumps; -#endif - - /// -#if NET48 - public int MapRevision => this.Model.Header.MapRevision; -#else - public int? MapRevision => this.Model.Header?.MapRevision; -#endif - - #endregion - - #region Extension Properties - - // TODO: Figure out what extension oroperties are needed - - #endregion - #region Constructors /// @@ -153,12 +115,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAllLumps(string outputDirectory) { // If we have no lumps - if (Lumps == null || Lumps.Length == 0) + if (this.Model.Header?.Lumps == null || this.Model.Header.Lumps.Length == 0) return false; // Loop through and extract all lumps to the output bool allExtracted = true; - for (int i = 0; i < Lumps.Length; i++) + for (int i = 0; i < this.Model.Header.Lumps.Length; i++) { allExtracted &= ExtractLump(i, outputDirectory); } @@ -175,15 +137,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractLump(int index, string outputDirectory) { // If we have no lumps - if (Lumps == null || Lumps.Length == 0) + if (this.Model.Header?.Lumps == null || this.Model.Header.Lumps.Length == 0) return false; // If the lumps index is invalid - if (index < 0 || index >= Lumps.Length) + if (index < 0 || index >= this.Model.Header.Lumps.Length) return false; // Get the lump - var lump = Lumps[index]; + var lump = this.Model.Header.Lumps[index]; if (lump == null) return false; diff --git a/BinaryObjectScanner.Wrappers/VPK.cs b/BinaryObjectScanner.Wrappers/VPK.cs index 89316176..84eac02b 100644 --- a/BinaryObjectScanner.Wrappers/VPK.cs +++ b/BinaryObjectScanner.Wrappers/VPK.cs @@ -15,73 +15,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public uint Signature => this.Model.Header.Signature; -#else - public uint? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint Version => this.Model.Header.Version; -#else - public uint? Version => this.Model.Header?.Version; -#endif - - /// -#if NET48 - public uint DirectoryLength => this.Model.Header.DirectoryLength; -#else - public uint? DirectoryLength => this.Model.Header?.DirectoryLength; -#endif - - #endregion - - #region Extended Header - - /// - public uint? Dummy0 => this.Model.ExtendedHeader?.Dummy0; - - /// - public uint? ArchiveHashLength => this.Model.ExtendedHeader?.ArchiveHashLength; - - /// - public uint? ExtraLength => this.Model.ExtendedHeader?.ExtraLength; - - /// - public uint? Dummy1 => this.Model.ExtendedHeader?.Dummy1; - - #endregion - - #region Archive Hashes - - /// -#if NET48 - public SabreTools.Models.VPK.ArchiveHash[] ArchiveHashes => this.Model.ArchiveHashes; -#else - public SabreTools.Models.VPK.ArchiveHash?[]? ArchiveHashes => this.Model.ArchiveHashes; -#endif - - #endregion - - #region Directory Items - - /// -#if NET48 - public SabreTools.Models.VPK.DirectoryItem[] DirectoryItems => this.Model.DirectoryItems; -#else - public SabreTools.Models.VPK.DirectoryItem?[]? DirectoryItems => this.Model.DirectoryItems; -#endif - - #endregion - - #endregion - #region Extension Properties /// @@ -120,9 +53,9 @@ namespace BinaryObjectScanner.Wrappers return null; // Get the archive count - int archiveCount = DirectoryItems == null + int archiveCount = this.Model.DirectoryItems == null ? 0 - : DirectoryItems + : this.Model.DirectoryItems .Select(di => di?.DirectoryEntry) .Select(de => de?.ArchiveIndex ?? 0) .Where(ai => ai != HL_VPK_NO_ARCHIVE) @@ -261,12 +194,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no directory items - if (DirectoryItems == null || DirectoryItems.Length == 0) + if (this.Model.DirectoryItems == null || this.Model.DirectoryItems.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < DirectoryItems.Length; i++) + for (int i = 0; i < this.Model.DirectoryItems.Length; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -283,15 +216,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractFile(int index, string outputDirectory) { // If we have no directory items - if (DirectoryItems == null || DirectoryItems.Length == 0) + if (this.Model.DirectoryItems == null || this.Model.DirectoryItems.Length == 0) return false; // If the directory item index is invalid - if (index < 0 || index >= DirectoryItems.Length) + if (index < 0 || index >= this.Model.DirectoryItems.Length) return false; // Get the directory item - var directoryItem = DirectoryItems[index]; + var directoryItem = this.Model.DirectoryItems[index]; if (directoryItem?.DirectoryEntry == null) return false; diff --git a/BinaryObjectScanner.Wrappers/WAD.cs b/BinaryObjectScanner.Wrappers/WAD.cs index 819e2f0e..798b50d6 100644 --- a/BinaryObjectScanner.Wrappers/WAD.cs +++ b/BinaryObjectScanner.Wrappers/WAD.cs @@ -12,63 +12,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint LumpCount => this.Model.Header.LumpCount; -#else - public uint? LumpCount => this.Model.Header?.LumpCount; -#endif - - /// -#if NET48 - public uint LumpOffset => this.Model.Header.LumpOffset; -#else - public uint? LumpOffset => this.Model.Header?.LumpOffset; -#endif - - #endregion - - #region Lumps - - /// -#if NET48 - public SabreTools.Models.WAD.Lump[] Lumps => this.Model.Lumps; -#else - public SabreTools.Models.WAD.Lump?[]? Lumps => this.Model.Lumps; -#endif - - #endregion - - #region Lump Infos - - /// -#if NET48 - public SabreTools.Models.WAD.LumpInfo[] LumpInfos => this.Model.LumpInfos; -#else - public SabreTools.Models.WAD.LumpInfo?[]? LumpInfos => this.Model.LumpInfos; -#endif - - #endregion - - #endregion - - #region Extension Properties - - // TODO: Figure out what extension oroperties are needed - - #endregion - #region Constructors /// @@ -171,12 +114,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAllLumps(string outputDirectory) { // If we have no lumps - if (Lumps == null || Lumps.Length == 0) + if (this.Model.Lumps == null || this.Model.Lumps.Length == 0) return false; // Loop through and extract all lumps to the output bool allExtracted = true; - for (int i = 0; i < Lumps.Length; i++) + for (int i = 0; i < this.Model.Lumps.Length; i++) { allExtracted &= ExtractLump(i, outputDirectory); } @@ -193,15 +136,15 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractLump(int index, string outputDirectory) { // If we have no lumps - if (Lumps == null || Lumps.Length == 0) + if (this.Model.Lumps == null || this.Model.Lumps.Length == 0) return false; // If the lumps index is invalid - if (index < 0 || index >= Lumps.Length) + if (index < 0 || index >= this.Model.Lumps.Length) return false; // Get the lump - var lump = Lumps[index]; + var lump = this.Model.Lumps[index]; if (lump == null) return false; diff --git a/BinaryObjectScanner.Wrappers/WrapperFactory.cs b/BinaryObjectScanner.Wrappers/WrapperFactory.cs index dd2e0982..5740c502 100644 --- a/BinaryObjectScanner.Wrappers/WrapperFactory.cs +++ b/BinaryObjectScanner.Wrappers/WrapperFactory.cs @@ -84,19 +84,14 @@ namespace BinaryObjectScanner.Wrappers return null; // Check for a valid new executable address -#if NET48 - if (msdos.NewExeHeaderAddr >= stream.Length) -#else - if (msdos.NewExeHeaderAddr == null || msdos.NewExeHeaderAddr >= stream.Length) -#endif + if (msdos.Model.Header?.NewExeHeaderAddr == null || msdos.Model.Header.NewExeHeaderAddr >= stream.Length) return wrapper; // Try to read the executable info + stream.Seek(msdos.Model.Header.NewExeHeaderAddr, SeekOrigin.Begin); #if NET48 - stream.Seek(msdos.NewExeHeaderAddr, SeekOrigin.Begin); byte[] magic = stream.ReadBytes(4); #else - stream.Seek(msdos.NewExeHeaderAddr.Value, SeekOrigin.Begin); byte[]? magic = stream.ReadBytes(4); #endif diff --git a/BinaryObjectScanner.Wrappers/XZP.cs b/BinaryObjectScanner.Wrappers/XZP.cs index 3e8d1cd6..b06500f7 100644 --- a/BinaryObjectScanner.Wrappers/XZP.cs +++ b/BinaryObjectScanner.Wrappers/XZP.cs @@ -13,145 +13,6 @@ namespace BinaryObjectScanner.Wrappers #endregion - #region Pass-Through Properties - - #region Header - - /// -#if NET48 - public string Signature => this.Model.Header.Signature; -#else - public string? Signature => this.Model.Header?.Signature; -#endif - - /// -#if NET48 - public uint Version => this.Model.Header.Version; -#else - public uint? Version => this.Model.Header?.Version; -#endif - - /// -#if NET48 - public uint PreloadDirectoryEntryCount => this.Model.Header.PreloadDirectoryEntryCount; -#else - public uint? PreloadDirectoryEntryCount => this.Model.Header?.PreloadDirectoryEntryCount; -#endif - - /// -#if NET48 - public uint DirectoryEntryCount => this.Model.Header.DirectoryEntryCount; -#else - public uint? DirectoryEntryCount => this.Model.Header?.DirectoryEntryCount; -#endif - - /// -#if NET48 - public uint PreloadBytes => this.Model.Header.PreloadBytes; -#else - public uint? PreloadBytes => this.Model.Header?.PreloadBytes; -#endif - - /// -#if NET48 - public uint HeaderLength => this.Model.Header.HeaderLength; -#else - public uint? HeaderLength => this.Model.Header?.HeaderLength; -#endif - - /// -#if NET48 - public uint DirectoryItemCount => this.Model.Header.DirectoryItemCount; -#else - public uint? DirectoryItemCount => this.Model.Header?.DirectoryItemCount; -#endif - - /// -#if NET48 - public uint DirectoryItemOffset => this.Model.Header.DirectoryItemOffset; -#else - public uint? DirectoryItemOffset => this.Model.Header?.DirectoryItemOffset; -#endif - - /// -#if NET48 - public uint DirectoryItemLength => this.Model.Header.DirectoryItemLength; -#else - public uint? DirectoryItemLength => this.Model.Header?.DirectoryItemLength; -#endif - - #endregion - - #region Directory Entries - - /// -#if NET48 - public SabreTools.Models.XZP.DirectoryEntry[] DirectoryEntries => this.Model.DirectoryEntries; -#else - public SabreTools.Models.XZP.DirectoryEntry?[]? DirectoryEntries => this.Model.DirectoryEntries; -#endif - - #endregion - - #region Preload Directory Entries - - /// -#if NET48 - public SabreTools.Models.XZP.DirectoryEntry[] PreloadDirectoryEntries => this.Model.PreloadDirectoryEntries; -#else - public SabreTools.Models.XZP.DirectoryEntry?[]? PreloadDirectoryEntries => this.Model.PreloadDirectoryEntries; -#endif - - #endregion - - #region Preload Directory Entries - - /// -#if NET48 - public SabreTools.Models.XZP.DirectoryMapping[] PreloadDirectoryMappings => this.Model.PreloadDirectoryMappings; -#else - public SabreTools.Models.XZP.DirectoryMapping?[]? PreloadDirectoryMappings => this.Model.PreloadDirectoryMappings; -#endif - - #endregion - - #region Directory Items - - /// -#if NET48 - public SabreTools.Models.XZP.DirectoryItem[] DirectoryItems => this.Model.DirectoryItems; -#else - public SabreTools.Models.XZP.DirectoryItem?[]? DirectoryItems => this.Model.DirectoryItems; -#endif - - #endregion - - #region Footer - - /// -#if NET48 - public uint F_FileLength => this.Model.Footer.FileLength; -#else - public uint? F_FileLength => this.Model.Footer?.FileLength; -#endif - - /// -#if NET48 - public string F_Signature => this.Model.Footer.Signature; -#else - public string? F_Signature => this.Model.Footer?.Signature; -#endif - - #endregion - - #endregion - - #region Extension Properties - - // TODO: Figure out what extensions are needed - - #endregion - #region Constructors /// @@ -254,12 +115,12 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractAll(string outputDirectory) { // If we have no directory entries - if (DirectoryEntries == null || DirectoryEntries.Length == 0) + if (this.Model.DirectoryEntries == null || this.Model.DirectoryEntries.Length == 0) return false; // Loop through and extract all files to the output bool allExtracted = true; - for (int i = 0; i < DirectoryEntries.Length; i++) + for (int i = 0; i < this.Model.DirectoryEntries.Length; i++) { allExtracted &= ExtractFile(i, outputDirectory); } @@ -276,24 +137,24 @@ namespace BinaryObjectScanner.Wrappers public bool ExtractFile(int index, string outputDirectory) { // If we have no directory entries - if (DirectoryEntries == null || DirectoryEntries.Length == 0) + if (this.Model.DirectoryEntries == null || this.Model.DirectoryEntries.Length == 0) return false; // If we have no directory items - if (DirectoryItems == null || DirectoryItems.Length == 0) + if (this.Model.DirectoryItems == null || this.Model.DirectoryItems.Length == 0) return false; // If the directory entry index is invalid - if (index < 0 || index >= DirectoryEntries.Length) + if (index < 0 || index >= this.Model.DirectoryEntries.Length) return false; // Get the directory entry - var directoryEntry = DirectoryEntries[index]; + var directoryEntry = this.Model.DirectoryEntries[index]; if (directoryEntry == null) return false; // Get the associated directory item - var directoryItem = DirectoryItems.Where(di => di?.FileNameCRC == directoryEntry.FileNameCRC).FirstOrDefault(); + var directoryItem = this.Model.DirectoryItems.Where(di => di?.FileNameCRC == directoryEntry.FileNameCRC).FirstOrDefault(); if (directoryItem == null) return false;