From f8ddfcf5aecd4065da706fbd639848bafffca6db Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 26 Sep 2025 19:43:39 -0400 Subject: [PATCH] Add framework for Advanced Installer extraction --- .../Wrappers/PortableExecutable.Extraction.cs | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs b/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs index 7e51a5c5..4b290bca 100644 --- a/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs @@ -14,18 +14,46 @@ namespace SabreTools.Serialization.Wrappers /// - Archives and executables in resource data /// - CExe-compressed resource data /// - SecuROM Matroschka package sections - /// - SFX archives (7z, MS-CAB, PKZIP, RAR) + /// - SFX archives (7z, Advanced Installer, MS-CAB, PKZIP, RAR) /// - Wise installers /// public bool Extract(string outputDirectory, bool includeDebug) { + bool cai = ExtractAdvancedInstaller(outputDirectory, includeDebug); bool cexe = ExtractCExe(outputDirectory, includeDebug); bool matroschka = ExtractMatroschka(outputDirectory, includeDebug); bool overlay = ExtractFromOverlay(outputDirectory, includeDebug); bool resources = ExtractFromResources(outputDirectory, includeDebug); bool wise = ExtractWise(outputDirectory, includeDebug); - return cexe || matroschka || overlay || resources || wise; + return cai || cexe || matroschka || overlay || resources || wise; + } + + /// + /// Extract a Caphyon Advanced Installer SFX overlay + /// + /// Output directory to write to + /// True to include debug data, false otherwise + /// True if extraction succeeded, false otherwise + public bool ExtractAdvancedInstaller(string outputDirectory, bool includeDebug) + { + try + { + // Try to deserialize the source data + var deserializer = new Readers.AdvancedInstaller(); + var sfx = deserializer.Deserialize(_dataSource); + if (sfx == null) + return false; + + // TODO: Loop through the entries and read as much as possible + + return false; + } + catch (Exception ex) + { + if (includeDebug) Console.Error.WriteLine(ex); + return false; + } } ///