Remove libmspack4n submodule

This commit is contained in:
Matt Nadareski
2025-08-25 20:39:18 -04:00
parent 91aea728ac
commit 692da62dee
9 changed files with 4 additions and 66 deletions

6
.gitmodules vendored
View File

@@ -1,9 +1,3 @@
[submodule "BinaryObjectScanner/_EXTERNAL/stormlibsharp"]
path = BinaryObjectScanner/_EXTERNAL/stormlibsharp
url = https://github.com/robpaveza/stormlibsharp.git
[submodule "BinaryObjectScanner/_EXTERNAL/libmspack4n"]
path = BinaryObjectScanner/_EXTERNAL/libmspack4n
url = https://github.com/activescott/libmspack4n.git
[submodule "BinaryObjectScanner/_EXTERNAL/LessIO"]
path = BinaryObjectScanner/_EXTERNAL/LessIO
url = https://github.com/activescott/LessIO.git

View File

@@ -41,9 +41,6 @@
<DefaultItemExcludes>
$(DefaultItemExcludes);
**\AssemblyInfo.cs;
_EXTERNAL\LessIO\src\LessIO.Tests\**;
_EXTERNAL\libmspack4n\lib\**;
_EXTERNAL\libmspack4n\libmspack4ntest\**;
_EXTERNAL\stormlibsharp\lib\**;
_EXTERNAL\stormlibsharp\src\TestConsole\**
</DefaultItemExcludes>

View File

@@ -2,11 +2,7 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO.Extensions;
#if (NET40_OR_GREATER || NETCOREAPP) && WINX86
using LibMSPackN;
#else
using SabreTools.Models.MicrosoftCabinet;
#endif
namespace BinaryObjectScanner.FileType
{
@@ -30,7 +26,6 @@ namespace BinaryObjectScanner.FileType
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
#if NET20 || NET35 || !WINX86
// TODO: Remove once Serialization is updated
// Get a wrapper for the set, if possible
@@ -61,46 +56,6 @@ namespace BinaryObjectScanner.FileType
}
return true;
#else
try
{
if (!File.Exists(file))
return false;
// Loop over each entry
var cabArchive = new MSCabinet(file);
foreach (var compressedFile in cabArchive.GetFiles())
{
try
{
// Ensure directory separators are consistent
string fileName = compressedFile.Filename;
if (Path.DirectorySeparatorChar == '\\')
fileName = fileName.Replace('/', '\\');
else if (Path.DirectorySeparatorChar == '/')
fileName = fileName.Replace('\\', '/');
string tempFile = Path.Combine(outDir, fileName);
var directoryName = Path.GetDirectoryName(tempFile);
if (directoryName != null && !Directory.Exists(directoryName))
Directory.CreateDirectory(directoryName);
compressedFile.ExtractTo(tempFile);
}
catch (Exception ex)
{
if (includeDebug) Console.Error.WriteLine(ex);
}
}
return true;
}
catch (Exception ex)
{
if (includeDebug) Console.Error.WriteLine(ex);
return false;
}
#endif
}
/// <summary>

View File

@@ -4,7 +4,7 @@ using SabreTools.Serialization.Wrappers;
namespace BinaryObjectScanner.Packer
{
// TODO: Add extraction, which should be possible with LibMSPackN, but it refuses to extract due to SFX files lacking the typical CAB identifiers.
// TODO: Add extraction
// https://raw.githubusercontent.com/wolfram77web/app-peid/master/userdb.txt
public class MicrosoftCABSFX : IExtractableExecutable<PortableExecutable>
{

View File

@@ -4,6 +4,4 @@ This directory contains multiple external libraries. Here is the status of each:
| Directory | Library | Status |
| --------- | ------- | ------ |
| LessIO | [LessIO](https://github.com/activescott/LessIO) | External submodule |
| libmspack4n | [libmspack4n](https://github.com/activescott/libmspack4n) | External submodule |
| stormlibsharp | [stormlibsharp](https://github.com/robpaveza/stormlibsharp) | External submodule |

View File

@@ -297,14 +297,12 @@ namespace ExtractionTool
szdd.Extract(Path.GetFileName(file), outputDirectory);
}
// Microsoft Cabinet archive -- Implementation partially moved to Serialization
// Microsoft Cabinet archive -- Implementation moved to Serialization
else if (ft == WrapperType.MicrosoftCAB)
{
// Build the cabinet information
Console.WriteLine("Extracting MS-CAB contents");
#if NET20 || NET35 || !WINX86
Console.WriteLine("WARNING: LZX compression not supported so some files may be skipped!");
#endif
Console.WriteLine("WARNING: LZX and Quantum compression schemes are not supported so some files may be skipped!");
Console.WriteLine();
// Extract using the FileType

View File

@@ -6,8 +6,6 @@ C# protection, packer, and archive scanning library. This currently compiles as
The following non-project libraries (or ports thereof) are used for file handling:
- [LessIO](https://github.com/activescott/LessIO) - Used by libmspack4n for IO handling
- [libmspack4n](https://github.com/activescott/libmspack4n) MS-CAB extraction [Unused in .NET Framework 2.0/3.5, non-Windows, and non-x86 builds due to Windows-specific libraries]
- [SharpCompress](https://github.com/adamhathcock/sharpcompress) - Common archive format extraction
- [StormLibSharp](https://github.com/robpaveza/stormlibsharp) - MoPaQ extraction [Unused in .NET Framework 2.0/3.5/4.0, non-Windows, and non-x86 builds due to Windows-specific libraries]
- [UnshieldSharp](https://github.com/mnadareski/UnshieldSharp) - InstallShield CAB extraction
@@ -212,7 +210,7 @@ Below is a list of container formats that are supported in some way:
| InstallShield CAB | Yes | Yes | Yes | Via `UnshieldSharp` |
| Linear Executable | No | No | No | Skeleton only |
| Link Data Security encrypted file | No | Yes | No | |
| Microsoft cabinet file | Yes | Yes | Yes* | Via `libmspack4n`, Windows x86 only, .NET Framework 4.5.2 and above |
| Microsoft cabinet file | Yes | Yes | Yes* | Does not support LZX or Quantum compression |
| Microsoft LZ-compressed files | No | Yes | Yes | |
| MoPaQ game data archive (MPQ) | No | Yes | Yes* | Via `StormLibSharp`, Windows x86 only, .NET Framework 4.5.2 and above |
| MS-DOS Executable | Yes | Yes | No | Incomplete |