mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-16 21:37:05 +00:00
Handle MS-CAB compression type masking better
This commit is contained in:
@@ -183,7 +183,7 @@ namespace BurnOutSharp.Builders
|
||||
|
||||
folder.CabStartOffset = data.ReadUInt32();
|
||||
folder.DataCount = data.ReadUInt16();
|
||||
folder.CompressionType = (CompressionType)(data.ReadUInt16() & (ushort)CompressionType.MASK_TYPE);
|
||||
folder.CompressionType = (CompressionType)data.ReadUInt16();
|
||||
|
||||
if (header.FolderReservedSize > 0)
|
||||
folder.ReservedData = data.ReadBytes(header.FolderReservedSize);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -190,7 +189,7 @@ namespace BurnOutSharp.Wrappers
|
||||
else // if (x >= 4)
|
||||
return a[n - x + b] ^ S(a, b, x - 4);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Folders
|
||||
@@ -224,7 +223,7 @@ namespace BurnOutSharp.Wrappers
|
||||
foreach (var dataBlock in folder.DataBlocks)
|
||||
{
|
||||
byte[] decompressed = null;
|
||||
switch (folder.CompressionType)
|
||||
switch (folder.CompressionType & Models.MicrosoftCabinet.CompressionType.MASK_TYPE)
|
||||
{
|
||||
case Models.MicrosoftCabinet.CompressionType.TYPE_NONE:
|
||||
decompressed = dataBlock.CompressedData;
|
||||
@@ -469,7 +468,7 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Folder {i}");
|
||||
Console.WriteLine($" Cab start offset = {entry.CabStartOffset}");
|
||||
Console.WriteLine($" Data count = {entry.DataCount}");
|
||||
Console.WriteLine($" Compression type = {entry.CompressionType}");
|
||||
Console.WriteLine($" Compression type = {entry.CompressionType} ({entry.CompressionType & Models.MicrosoftCabinet.CompressionType.MASK_TYPE})");
|
||||
if (entry.ReservedData == null)
|
||||
Console.WriteLine($" Reserved data = [NULL]");
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user