diff --git a/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs b/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs index 91f66268..3f041878 100644 --- a/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs +++ b/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using BinaryObjectScanner.FileType; using Xunit; @@ -25,8 +26,7 @@ public void ExtractStream_Null_False() string outDir = string.Empty; var extractable = new InstallShieldCAB(); - bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); - Assert.False(actual); + Assert.Throws(() => extractable.Extract(stream, file, outDir, includeDebug: false)); } [Fact] @@ -37,8 +37,7 @@ public void ExtractStream_Empty_False() string outDir = string.Empty; var extractable = new InstallShieldCAB(); - bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); - Assert.False(actual); + Assert.Throws(() => extractable.Extract(stream, file, outDir, includeDebug: false)); } } } diff --git a/BinaryObjectScanner/FileType/InstallShieldCAB.cs b/BinaryObjectScanner/FileType/InstallShieldCAB.cs index d7f9a737..4d923a55 100644 --- a/BinaryObjectScanner/FileType/InstallShieldCAB.cs +++ b/BinaryObjectScanner/FileType/InstallShieldCAB.cs @@ -24,6 +24,8 @@ public bool Extract(string file, string outDir, bool includeDebug) /// public bool Extract(Stream? stream, string file, string outDir, bool includeDebug) { + // Handles getting full path if relative paths were passed. + file = Path.GetFullPath(file); // Get the name of the first cabinet file or header var directory = Path.GetDirectoryName(file); string noExtension = Path.GetFileNameWithoutExtension(file); diff --git a/BinaryObjectScanner/Scanner.cs b/BinaryObjectScanner/Scanner.cs index dc223e19..787e0ea0 100644 --- a/BinaryObjectScanner/Scanner.cs +++ b/BinaryObjectScanner/Scanner.cs @@ -207,7 +207,7 @@ private ProtectionDictionary GetInternalProtections(string file) try { using FileStream fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - return GetInternalProtections(file, fs); + return GetInternalProtections(fs.Name, fs); } catch (Exception ex) {