mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-23 07:14:49 +00:00
Add and use MS-CAB constants
This commit is contained in:
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using BurnOutSharp.Models.MicrosoftCabinet;
|
||||
using BurnOutSharp.Utilities;
|
||||
using static BurnOutSharp.Models.MicrosoftCabinet.Constants;
|
||||
|
||||
namespace BurnOutSharp.Builders
|
||||
{
|
||||
@@ -125,8 +126,9 @@ namespace BurnOutSharp.Builders
|
||||
{
|
||||
CFHEADER header = new CFHEADER();
|
||||
|
||||
header.Signature = data.ReadUInt32();
|
||||
if (header.Signature != 0x4643534D)
|
||||
byte[] signature = data.ReadBytes(4);
|
||||
header.Signature = Encoding.ASCII.GetString(signature);
|
||||
if (header.Signature != SignatureString)
|
||||
return null;
|
||||
|
||||
header.Reserved1 = data.ReadUInt32();
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BurnOutSharp.Models.MicrosoftCabinet
|
||||
/// Contains the characters "M", "S", "C", and "F" (bytes 0x4D, 0x53, 0x43,
|
||||
/// 0x46). This field is used to ensure that the file is a cabinet (.cab) file.
|
||||
/// </summary>
|
||||
public uint Signature;
|
||||
public string Signature;
|
||||
|
||||
/// <summary>
|
||||
/// Reserved field; MUST be set to 0 (zero).
|
||||
|
||||
11
BurnOutSharp.Models/MicrosoftCabinet/Constants.cs
Normal file
11
BurnOutSharp.Models/MicrosoftCabinet/Constants.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace BurnOutSharp.Models.MicrosoftCabinet
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public static readonly byte[] SignatureBytes = new byte[] { 0x4d, 0x53, 0x43, 0x46 };
|
||||
|
||||
public const string SignatureString = "MSCF";
|
||||
|
||||
public const uint SignatureUInt32 = 0x4643534d;
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Header
|
||||
|
||||
/// <inheritdoc cref="Models.MicrosoftCabinet.CFHEADER.Signature"/>
|
||||
public uint Signature => _cabinet.Header.Signature;
|
||||
public string Signature => _cabinet.Header.Signature;
|
||||
|
||||
/// <inheritdoc cref="Models.MicrosoftCabinet.CFHEADER.Reserved1"/>
|
||||
public uint Reserved1 => _cabinet.Header.Reserved1;
|
||||
|
||||
Reference in New Issue
Block a user