Migrate many models to StructLayout

This commit is contained in:
Matt Nadareski
2024-04-23 13:30:43 -04:00
parent b19dbf2254
commit c636d3252b
112 changed files with 1044 additions and 646 deletions

View File

@@ -1,6 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DriveRevocationListEntry
{
/// <summary>
@@ -9,13 +12,14 @@ namespace SabreTools.Models.AACS
/// field indicates that only one ID is being revoked, a value of one
/// in the Range field indicates two IDs are being revoked, and so on.
/// </summary>
public ushort Range { get; set; }
public ushort Range;
/// <summary>
/// A 6-byte Drive ID value identifying the Licensed Drive being revoked
/// (or the first in a range of Licensed Drives being revoked, in the
/// case of a non-zero Range value).
/// </summary>
public byte[]? DriveID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? DriveID;
}
}

View File

@@ -1,6 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class HostRevocationListEntry
{
/// <summary>
@@ -9,13 +12,14 @@ namespace SabreTools.Models.AACS
/// field indicates that only one ID is being revoked, a value of one
/// in the Range field indicates two IDs are being revoked, and so on.
/// </summary>
public ushort Range { get; set; }
public ushort Range;
/// <summary>
/// A 6-byte Host ID value identifying the host being revoked (or the
/// first in a range of hosts being revoked, in the case of a non-zero
/// Range value).
/// </summary>
public byte[]? HostID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? HostID;
}
}

View File

@@ -1,6 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SubsetDifference
{
/// <summary>
@@ -9,12 +12,12 @@ namespace SabreTools.Models.AACS
/// the mask. For example, the value 0x01 denotes a mask of
/// 0xFFFFFFFE; value 0x0A denotes a mask of 0xFFFFFC00.
/// </summary>
public byte Mask { get; set; }
public byte Mask;
/// <summary>
/// The last 4 bytes are the uv number, most significant
/// byte first.
/// </summary>
public uint Number { get; set; }
public uint Number;
}
}

View File

@@ -1,24 +1,28 @@
namespace SabreTools.Models.BFPK
using System.Runtime.InteropServices;
namespace SabreTools.Models.BFPK
{
/// <summary>
/// Header
/// </summary>
/// <see cref="https://forum.xentax.com/viewtopic.php?t=5102"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// "BFPK"
/// </summary>
public string? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Magic;
/// <summary>
/// Version
/// </summary>
public int Version { get; set; }
public int Version;
/// <summary>
/// Files
/// </summary>
public int Files { get; set; }
public int Files;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BMP
{
/// <summary>
@@ -5,31 +7,32 @@ namespace SabreTools.Models.BMP
/// and layout of a file that contains a DIB.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapfileheader"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BITMAPFILEHEADER
{
/// <summary>
/// The file type; must be BM.
/// </summary>
public ushort Type { get; set; }
public ushort Type;
/// <summary>
/// The size, in bytes, of the bitmap file.
/// </summary>
public uint Size { get; set; }
public uint Size;
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved1 { get; set; }
public ushort Reserved1;
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved2 { get; set; }
public ushort Reserved2;
/// <summary>
/// The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits.
/// </summary>
public uint OffBits { get; set; }
public uint OffBits;
}
}

View File

@@ -1,9 +1,12 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BMP
{
/// <summary>
/// The BITMAPINFOHEADER structure contains information about the dimensions and
/// color format of a device-independent bitmap (DIB).
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public sealed class BITMAPINFOHEADER
{
/// <summary>
@@ -11,12 +14,12 @@ namespace SabreTools.Models.BMP
/// not include the size of the color table or the size of the color masks,
/// if they are appended to the end of structure.
/// </summary>
public uint Size { get; set; }
public uint Size;
/// <summary>
/// Specifies the width of the bitmap, in pixels.
/// </summary>
public int Width { get; set; }
public int Width;
/// <summary>
/// Specifies the height of the bitmap, in pixels.
@@ -30,19 +33,19 @@ namespace SabreTools.Models.BMP
/// or negative biHeight.
/// - For compressed formats, biHeight must be positive, regardless of image orientation.
/// </summary>
public int Height { get; set; }
public int Height;
/// <summary>
/// Specifies the number of planes for the target device. This value must be set to 1.
/// </summary>
public ushort Planes { get; set; }
public ushort Planes;
/// <summary>
/// Specifies the number of bits per pixel (bpp). For uncompressed formats, this value
/// is the average number of bits per pixel. For compressed formats, this value is the
/// implied bit depth of the uncompressed image, after the image has been decoded.
/// </summary>
public ushort BitCount { get; set; }
public ushort BitCount;
/// <summary>
/// For compressed video and YUV formats, this member is a FOURCC code, specified as a
@@ -59,36 +62,36 @@ namespace SabreTools.Models.BMP
/// If biCompression equals BI_BITFIELDS, the format is either RGB 555 or RGB 565. Use
/// the subtype GUID in the AM_MEDIA_TYPE structure to determine the specific RGB type.
/// </summary>
public uint Compression { get; set; }
public uint Compression;
/// <summary>
/// Specifies the size, in bytes, of the image. This can be set to 0 for uncompressed
/// RGB bitmaps.
/// </summary>
public uint SizeImage { get; set; }
public uint SizeImage;
/// <summary>
/// Specifies the horizontal resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int XPelsPerMeter { get; set; }
public int XPelsPerMeter;
/// <summary>
/// Specifies the vertical resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int YPelsPerMeter { get; set; }
public int YPelsPerMeter;
/// <summary>
/// Specifies the number of color indices in the color table that are actually used by
/// the bitmap.
/// </summary>
public uint ClrUsed { get; set; }
public uint ClrUsed;
/// <summary>
/// Specifies the number of color indices that are considered important for displaying
/// the bitmap. If this value is zero, all colors are important.
/// </summary>
public uint ClrImportant { get; set; }
public uint ClrImportant;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Version
/// </summary>
public uint Version { get; set; }
public uint Version;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Lump
{
/// <summary>
/// Offset
/// </summary>
public uint Offset { get; set; }
public uint Offset;
/// <summary>
/// Length
/// </summary>
public uint Length { get; set; }
public uint Length;
}
}

View File

@@ -1,17 +1,22 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.Compression.LZ
{
/// <summary>
/// Format of first 14 byte of LZ compressed file
/// </summary>
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/kernel32/lzexpand.c"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class FileHeaader
{
public string? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? Magic;
public byte CompressionType { get; set; }
public byte CompressionType;
public char LastChar { get; set; }
[MarshalAs(UnmanagedType.U1)]
public char LastChar;
public uint RealLength { get; set; }
public uint RealLength;
}
}

View File

@@ -1,31 +1,34 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CellAddressTableEntry
{
/// <summary>
/// VOBidn
/// </summary>
public ushort VOBIdentity { get; set; }
public ushort VOBIdentity;
/// <summary>
/// CELLidn
/// </summary>
public byte CellIdentity { get; set; }
public byte CellIdentity;
/// <summary>
/// Reserved
/// </summary>
public byte Reserved { get; set; }
public byte Reserved;
/// <summary>
/// Starting sector within VOB
/// </summary>
public uint StartingSectorWithinVOB { get; set; }
public uint StartingSectorWithinVOB;
/// <summary>
/// Ending sector within VOB
/// </summary>
public uint EndingSectorWithinVOB { get; set; }
public uint EndingSectorWithinVOB;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class LanguageUnitTableEntry
{
/// <summary>
/// ISO639 language code
/// </summary>
public ushort ISO639LanguageCode { get; set; }
public ushort ISO639LanguageCode;
/// <summary>
/// Reserved for language code extension
/// </summary>
public byte Reserved { get; set; }
public byte Reserved;
/// <summary>
/// Menu existence flag [80 = title]
/// </summary>
public byte MenuExistenceFlag { get; set; }
public byte MenuExistenceFlag;
/// <summary>
/// Offset to VMGM_LU, relative to VMGM_PGCI_UT
/// </summary>
public uint LanguageUnitOffset { get; set; }
public uint LanguageUnitOffset;
}
}

View File

@@ -1,21 +1,24 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ParentalManagementMasksTableEntry
{
/// <summary>
/// Country code
/// </summary>
public ushort CountryCode { get; set; }
public ushort CountryCode;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
public ushort Reserved;
/// <summary>
/// Offset to PTL_MAIT
/// </summary>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
public ushort Reserved { get; set; }
/// <summary>
/// End address (last byte of last PGC in this LU)

View File

@@ -1,26 +1,30 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ProgramChainTableEntry
{
/// <summary>
/// PGC category
/// </summary>
public ProgramChainCategory Category { get; set; }
[MarshalAs(UnmanagedType.U1)]
public ProgramChainCategory Category;
/// <summary>
/// Unknown
/// </summary>
public byte Unknown { get; set; }
public byte Unknown;
/// <summary>
/// Parental management mask
/// </summary>
public ushort ParentalManagementMask { get; set; }
public ushort ParentalManagementMask;
/// <summary>
/// Offset to VMGM_PGC, relative to VMGM_LU
/// </summary>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
public ushort Reserved { get; set; }
/// <summary>
/// End address (last byte of last entry)

View File

@@ -1,42 +1,46 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class TitlesTableEntry
{
/// <summary>
/// Title type
/// </summary>
public TitleType TitleType { get; set; }
[MarshalAs(UnmanagedType.U1)]
public TitleType TitleType;
/// <summary>
/// Number of angles
/// </summary>
public byte NumberOfAngles { get; set; }
public byte NumberOfAngles;
/// <summary>
/// Number of chapters (PTTs)
/// </summary>
public ushort NumberOfChapters { get; set; }
public ushort NumberOfChapters;
/// <summary>
/// Parental management mask
/// </summary>
public ushort ParentalManagementMask { get; set; }
public ushort ParentalManagementMask;
/// <summary>
/// Video Title Set number (VTSN)
/// </summary>
public byte VideoTitleSetNumber { get; set; }
public byte VideoTitleSetNumber;
/// <summary>
/// Title number within VTS (VTS_TTN)
/// </summary>
public byte TitleNumberWithinVTS { get; set; }
public byte TitleNumberWithinVTS;
/// <summary>
/// Start sector for VTS, referenced to whole disk
/// (video_ts.ifo starts at sector 00000000)
/// </summary>
public uint VTSStartSector { get; set; }
public uint VTSStartSector;
}
}

View File

@@ -1,22 +1,27 @@
using System.Drawing;
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo.html"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class VideoManagerIFO
{
/// <summary>
/// "DVDVIDEO-VMG"
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public string? Signature;
/// <summary>
/// Last sector of VMG set (last sector of BUP)
/// </summary>
public uint LastVMGSetSector { get; set; }
public uint LastVMGSetSector;
/// <summary>
/// Last sector of IFO
/// </summary>
public uint LastIFOSector { get; set; }
public uint LastIFOSector;
/// <summary>
/// Version number
@@ -24,127 +29,132 @@ namespace SabreTools.Models.DVD
/// - Byte 1, Bits 7-4 - Major version number
/// - Byte 1, Bits 3-0 - Minor version number
/// </summary>
public ushort VersionNumber { get; set; }
public ushort VersionNumber;
/// <summary>
/// VMG category
/// </summary>
/// <remarks>byte1=prohibited region mask</remarks>
public uint VMGCategory { get; set; }
public uint VMGCategory;
/// <summary>
/// Number of volumes
/// </summary>
public ushort NumberOfVolumes { get; set; }
public ushort NumberOfVolumes;
/// <summary>
/// Volume number
/// </summary>
public ushort VolumeNumber { get; set; }
public ushort VolumeNumber;
/// <summary>
/// Side ID
/// </summary>
public byte SideID { get; set; }
public byte SideID;
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets { get; set; }
public ushort NumberOfTitleSets;
/// <summary>
/// Provider ID
/// </summary>
public byte[]? ProviderID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[]? ProviderID;
/// <summary>
/// VMG POS
/// </summary>
public ulong VMGPOS { get; set; }
public ulong VMGPOS;
/// <summary>
/// End byte address of VMGI_MAT
/// </summary>
public uint InformationManagementTableEndByteAddress { get; set; }
public uint InformationManagementTableEndByteAddress;
/// <summary>
/// Start address of FP_PGC (First Play program chain)
/// </summary>
public uint FirstPlayProgramChainStartAddress { get; set; }
public uint FirstPlayProgramChainStartAddress;
/// <summary>
/// Start sector of Menu VOB
/// </summary>
public uint MenuVOBStartSector { get; set; }
public uint MenuVOBStartSector;
/// <summary>
/// Sector pointer to TT_SRPT (table of titles)
/// </summary>
public uint TableOfTitlesSectorPointer { get; set; }
public uint TableOfTitlesSectorPointer;
/// <summary>
/// Sector pointer to VMGM_PGCI_UT (Menu Program Chain table)
/// </summary>
public uint MenuProgramChainTableSectorPointer { get; set; }
public uint MenuProgramChainTableSectorPointer;
/// <summary>
/// Sector pointer to VMG_PTL_MAIT (Parental Management masks)
/// </summary>
public uint ParentalManagementMasksSectorPointer { get; set; }
public uint ParentalManagementMasksSectorPointer;
/// <summary>
/// Sector pointer to VMG_VTS_ATRT (copies of VTS audio/sub-picture attributes)
/// </summary>
public uint AudioSubPictureAttributesSectorPointer { get; set; }
public uint AudioSubPictureAttributesSectorPointer;
/// <summary>
/// Sector pointer to VMG_TXTDT_MG (text data)
/// </summary>
public uint TextDataSectorPointer { get; set; }
public uint TextDataSectorPointer;
/// <summary>
/// Sector pointer to VMGM_C_ADT (menu cell address table)
/// </summary>
public uint MenuCellAddressTableSectorPointer { get; set; }
public uint MenuCellAddressTableSectorPointer;
/// <summary>
/// Sector pointer to VMGM_VOBU_ADMAP (menu VOBU address map)
/// </summary>
public uint MenuVOBUAddressMapSectorPointer { get; set; }
public uint MenuVOBUAddressMapSectorPointer;
/// <summary>
/// Video attributes of VMGM_VOBS
/// </summary>
public byte[]? VideoAttributes { get; set; }
public ushort VideoAttributes;
/// <summary>
/// Number of audio streams in VMGM_VOBS
/// </summary>
public ushort NumberOfAudioStreams { get; set; }
public ushort NumberOfAudioStreams;
/// <summary>
/// Audio attributes of VMGM_VOBS
/// </summary>
public byte[][]? AudioAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public ulong[]? AudioAttributes;
/// <summary>
/// Unknown
/// </summary>
public byte[]? Unknown { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[]? Unknown;
/// <summary>
/// Number of subpicture streams in VMGM_VOBS (0 or 1)
/// </summary>
public ushort NumberOfSubpictureStreams { get; set; }
public ushort NumberOfSubpictureStreams;
/// <summary>
/// Subpicture attributes of VMGM_VOBS
/// </summary>
public byte[]? SubpictureAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? SubpictureAttributes;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 164)]
public byte[]? Reserved;
}
}

View File

@@ -1,22 +1,26 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo.html"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class VideoTitleSetIFO
{
/// <summary>
/// "DVDVIDEO-VTS"
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public string? Signature;
/// <summary>
/// Last sector of title set (last sector of BUP)
/// </summary>
public uint LastTitleSetSector { get; set; }
public uint LastTitleSetSector;
/// <summary>
/// Last sector of IFO
/// </summary>
public uint LastIFOSector { get; set; }
public uint LastIFOSector;
/// <summary>
/// Version number
@@ -24,137 +28,142 @@ namespace SabreTools.Models.DVD
/// - Byte 1, Bits 7-4 - Major version number
/// - Byte 1, Bits 3-0 - Minor version number
/// </summary>
public ushort VersionNumber { get; set; }
public ushort VersionNumber;
/// <summary>
/// VTS category
/// </summary>
/// <remarks>0=unspecified, 1=Karaoke</remarks>
public uint VMGCategory { get; set; }
public uint VMGCategory;
/// <summary>
/// Number of volumes
/// </summary>
public ushort NumberOfVolumes { get; set; }
public ushort NumberOfVolumes;
/// <summary>
/// Volume number
/// </summary>
public ushort VolumeNumber { get; set; }
public ushort VolumeNumber;
/// <summary>
/// Side ID
/// </summary>
public byte SideID { get; set; }
public byte SideID;
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets { get; set; }
public ushort NumberOfTitleSets;
/// <summary>
/// Provider ID
/// </summary>
public byte[]? ProviderID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[]? ProviderID;
/// <summary>
/// VMG POS
/// </summary>
public ulong VMGPOS { get; set; }
public ulong VMGPOS;
/// <summary>
/// End byte address of VTS_MAT
/// </summary>
public uint InformationManagementTableEndByteAddress { get; set; }
public uint InformationManagementTableEndByteAddress;
/// <summary>
/// Start address of FP_PGC (First Play program chain)
/// </summary>
public uint FirstPlayProgramChainStartAddress { get; set; }
public uint FirstPlayProgramChainStartAddress;
/// <summary>
/// Start sector of Menu VOB
/// </summary>
public uint MenuVOBStartSector { get; set; }
public uint MenuVOBStartSector;
/// <summary>
/// Start sector of Title VOB
/// </summary>
public uint TitleVOBStartSector { get; set; }
public uint TitleVOBStartSector;
/// <summary>
/// Sector pointer to VTS_PTT_SRPT (table of Titles and Chapters)
/// </summary>
public uint TableOfTitlesAndChaptersSectorPointer { get; set; }
public uint TableOfTitlesAndChaptersSectorPointer;
/// <summary>
/// Sector pointer to VTS_PGCI (Title Program Chain table)
/// </summary>
public uint TitleProgramChainTableSectorPointer { get; set; }
public uint TitleProgramChainTableSectorPointer;
/// <summary>
/// Sector pointer to VTSM_PGCI_UT (Menu Program Chain table)
/// </summary>
public uint MenuProgramChainTableSectorPointer { get; set; }
public uint MenuProgramChainTableSectorPointer;
/// <summary>
/// Sector pointer to VTS_TMAPTI (time map)
/// </summary>
public uint TimeMapSectorPointer { get; set; }
public uint TimeMapSectorPointer;
/// <summary>
/// Sector pointer to VTSM_C_ADT (menu cell address table)
/// </summary>
public uint MenuCellAddressTableSectorPointer { get; set; }
public uint MenuCellAddressTableSectorPointer;
/// <summary>
/// Sector pointer to VTSM_VOBU_ADMAP (menu VOBU address map)
/// </summary>
public uint MenuVOBUAddressMapSectorPointer { get; set; }
public uint MenuVOBUAddressMapSectorPointer;
/// <summary>
/// Sector pointer to VTS_C_ADT (title set cell address table)
/// </summary>
public uint TitleSetCellAddressTableSectorPointer { get; set; }
public uint TitleSetCellAddressTableSectorPointer;
/// <summary>
/// Sector pointer to VTS_VOBU_ADMAP (title set VOBU address map)
/// </summary>
public uint TitleSetVOBUAddressMapSectorPointer { get; set; }
public uint TitleSetVOBUAddressMapSectorPointer;
/// <summary>
/// Video attributes of VTSM_VOBS
/// </summary>
public byte[]? VideoAttributes { get; set; }
public ushort VideoAttributes;
/// <summary>
/// Number of audio streams in VTSM_VOBS
/// </summary>
public ushort NumberOfAudioStreams { get; set; }
public ushort NumberOfAudioStreams;
/// <summary>
/// Audio attributes of VTSM_VOBS
/// </summary>
public byte[][]? AudioAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public ulong[]? AudioAttributes;
/// <summary>
/// Unknown
/// </summary>
public byte[]? Unknown { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[]? Unknown;
/// <summary>
/// Number of subpicture streams in VTSM_VOBS (0 or 1)
/// </summary>
public ushort NumberOfSubpictureStreams { get; set; }
public ushort NumberOfSubpictureStreams;
/// <summary>
/// Subpicture attributes of VTSM_VOBS
/// </summary>
public byte[]? SubpictureAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? SubpictureAttributes;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 164)]
public byte[]? Reserved;
}
}

View File

@@ -1,18 +1,21 @@
using System.Runtime.InteropServices;
/// <remarks>
/// Information sourced from https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.PackageUnitEntry
/// </remarks>
namespace SabreTools.Models.Delphi
{
[StructLayout(LayoutKind.Sequential)]
public class PackageUnitEntry
{
/// <remarks>
/// System-dependent pointer type, assumed to be encoded for x86
/// </remarks>
public uint Init { get; set; }
public uint Init;
/// <remarks>
/// System-dependent pointer type, assumed to be encoded for x86
/// </remarks>
public uint FInit { get; set; }
public uint FInit;
}
}

View File

@@ -1,41 +1,44 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntry
{
/// <summary>
/// Flags for the block entry. 0x200F0000 == Not used.
/// </summary>
public uint EntryFlags { get; set; }
public uint EntryFlags;
/// <summary>
/// The offset for the data contained in this block entry in the file.
/// </summary>
public uint FileDataOffset { get; set; }
public uint FileDataOffset;
/// <summary>
/// The length of the data in this block entry.
/// </summary>
public uint FileDataSize { get; set; }
public uint FileDataSize;
/// <summary>
/// The offset to the first data block of this block entry's data.
/// </summary>
public uint FirstDataBlockIndex { get; set; }
public uint FirstDataBlockIndex;
/// <summary>
/// The next block entry in the series. (N/A if == BlockCount.)
/// </summary>
public uint NextBlockEntryIndex { get; set; }
public uint NextBlockEntryIndex;
/// <summary>
/// The previous block entry in the series. (N/A if == BlockCount.)
/// </summary>
public uint PreviousBlockEntryIndex { get; set; }
public uint PreviousBlockEntryIndex;
/// <summary>
/// The offset of the block entry in the directory.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,46 +1,49 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntryHeader
{
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Number of data blocks that point to data.
/// </summary>
public uint BlocksUsed { get; set; }
public uint BlocksUsed;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy4 { get; set; }
public uint Dummy4;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,19 +1,22 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <remarks>
/// Part of version 5 but not version 6.
/// </remarks>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntryMap
{
/// <summary>
/// The previous block entry. (N/A if == BlockCount.)
/// </summary>
public uint PreviousBlockEntryIndex { get; set; }
public uint PreviousBlockEntryIndex;
/// <summary>
/// The next block entry. (N/A if == BlockCount.)
/// </summary>
public uint NextBlockEntryIndex { get; set; }
public uint NextBlockEntryIndex;
}
}

View File

@@ -1,34 +1,37 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <remarks>
/// Part of version 5 but not version 6.
/// </remarks>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntryMapHeader
{
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Index of the first block entry.
/// </summary>
public uint FirstBlockEntryIndex { get; set; }
public uint FirstBlockEntryIndex;
/// <summary>
/// Index of the last block entry.
/// </summary>
public uint LastBlockEntryIndex { get; set; }
public uint LastBlockEntryIndex;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumEntry
{
/// <summary>
/// Checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Size of LPGCFCHECKSUMHEADER & LPGCFCHECKSUMMAPHEADER & in bytes.
/// </summary>
public uint ChecksumSize { get; set; }
public uint ChecksumSize;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapEntry
{
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
/// <summary>
/// Index of first checksum.
/// </summary>
public uint FirstChecksumIndex { get; set; }
public uint FirstChecksumIndex;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapHeader
{
/// <summary>
/// Always 0x14893721
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Number of items.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
}
}

View File

@@ -1,36 +1,39 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DataBlockHeader
{
/// <summary>
/// GCF file version. This field is not part of all file versions.
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Size of each data block in bytes.
/// </summary>
public uint BlockSize { get; set; }
public uint BlockSize;
/// <summary>
/// Offset to first data block.
/// </summary>
public uint FirstBlockOffset { get; set; }
public uint FirstBlockOffset;
/// <summary>
/// Number of data blocks that contain data.
/// </summary>
public uint BlocksUsed { get; set; }
public uint BlocksUsed;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryCopyEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,76 +1,79 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryHeader
{
/// <summary>
/// Always 0x00000004
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Cache ID.
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// GCF file version.
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Number of items in the directory.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of files in the directory.
/// </summary>
public uint FileCount { get; set; }
public uint FileCount;
/// <summary>
/// Always 0x00008000. Data per checksum?
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Size of lpGCFDirectoryEntries & lpGCFDirectoryNames & lpGCFDirectoryInfo1Entries & lpGCFDirectoryInfo2Entries & lpGCFDirectoryCopyEntries & lpGCFDirectoryLocalEntries in bytes.
/// </summary>
public uint DirectorySize { get; set; }
public uint DirectorySize;
/// <summary>
/// Size of the directory names in bytes.
/// </summary>
public uint NameSize { get; set; }
public uint NameSize;
/// <summary>
/// Number of Info1 entires.
/// </summary>
public uint Info1Count { get; set; }
public uint Info1Count;
/// <summary>
/// Number of files to copy.
/// </summary>
public uint CopyCount { get; set; }
public uint CopyCount;
/// <summary>
/// Number of files to keep local.
/// </summary>
public uint LocalCount { get; set; }
public uint LocalCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo1Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo2Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryLocalEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryMapEntry
{
/// <summary>
/// Index of the first data block. (N/A if == BlockCount.)
/// </summary>
public uint FirstBlockIndex { get; set; }
public uint FirstBlockIndex;
}
}

View File

@@ -1,19 +1,22 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <remarks>
/// Added in version 4 or version 5.
/// </remarks>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryMapHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000000
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FragmentationMap
{
/// <summary>
/// The index of the next data block.
/// </summary>
public uint NextDataBlockIndex { get; set; }
public uint NextDataBlockIndex;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FragmentationMapHeader
{
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// The index of the first unused fragmentation map entry.
/// </summary>
public uint FirstUnusedEntry { get; set; }
public uint FirstUnusedEntry;
/// <summary>
/// The block entry terminator; 0 = 0x0000ffff or 1 = 0xffffffff.
/// </summary>
public uint Terminator { get; set; }
public uint Terminator;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,61 +1,64 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000001
/// </summary>
public uint MajorVersion { get; set; }
public uint MajorVersion;
/// <summary>
/// GCF version number.
/// </summary>
public uint MinorVersion { get; set; }
public uint MinorVersion;
/// <summary>
/// Cache ID
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// Last version played
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Total size of GCF file in bytes.
/// </summary>
public uint FileSize { get; set; }
public uint FileSize;
/// <summary>
/// Size of each data block in bytes.
/// </summary>
public uint BlockSize { get; set; }
public uint BlockSize;
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
}
}

View File

@@ -1,10 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.cpp"/>
[StructLayout(LayoutKind.Sequential)]
public class Directory
{
public string? Name { get; set; }
[MarshalAs(UnmanagedType.BStr)]
public string? Name;
public ushort FileCount { get; set; }
public ushort FileCount;
}
}

View File

@@ -1,32 +1,37 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
[StructLayout(LayoutKind.Sequential)]
public class File
{
public byte VolumeEnd { get; set; }
public byte VolumeEnd;
public ushort Index { get; set; }
public ushort Index;
public uint UncompressedSize { get; set; }
public uint UncompressedSize;
public uint CompressedSize { get; set; }
public uint CompressedSize;
public uint Offset { get; set; }
public uint Offset;
public uint DateTime { get; set; }
public uint DateTime;
public uint Reserved0 { get; set; }
public uint Reserved0;
public ushort ChunkSize { get; set; }
public ushort ChunkSize;
public Attributes Attrib { get; set; }
[MarshalAs(UnmanagedType.U1)]
public Attributes Attrib;
public byte IsSplit { get; set; }
public byte IsSplit;
public byte Reserved1 { get; set; }
public byte Reserved1;
public byte VolumeStart { get; set; }
public byte VolumeStart;
public string? Name { get; set; }
[MarshalAs(UnmanagedType.AnsiBStr)]
public string? Name;
}
}

View File

@@ -1,50 +1,53 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
[StructLayout(LayoutKind.Sequential)]
public class Header
{
public uint Signature1 { get; set; }
public uint Signature1;
public uint Signature2 { get; set; }
public uint Signature2;
public ushort Reserved0 { get; set; }
public ushort Reserved0;
public ushort IsMultivolume { get; set; }
public ushort IsMultivolume;
public ushort FileCount { get; set; }
public ushort FileCount;
public uint DateTime { get; set; }
public uint DateTime;
public uint CompressedSize { get; set; }
public uint CompressedSize;
public uint UncompressedSize { get; set; }
public uint UncompressedSize;
public uint Reserved1 { get; set; }
public uint Reserved1;
/// <remarks>
/// Set in first vol only, zero in subsequent vols
/// </remarks>
public byte VolumeTotal { get; set; }
public byte VolumeTotal;
/// <remarks>
/// [1...n]
/// </remarks>
public byte VolumeNumber { get; set; }
public byte VolumeNumber;
public byte Reserved2 { get; set; }
public byte Reserved2;
public uint SplitBeginAddress { get; set; }
public uint SplitBeginAddress;
public uint SplitEndAddress { get; set; }
public uint SplitEndAddress;
public uint TocAddress { get; set; }
public uint TocAddress;
public uint Reserved3 { get; set; }
public uint Reserved3;
public ushort DirCount { get; set; }
public ushort DirCount;
public uint Reserved4 { get; set; }
public uint Reserved4;
public uint Reserved5 { get; set; }
public uint Reserved5;
}
}

View File

@@ -1,31 +1,35 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldCabinet
{
/// <see href="https://github.com/twogood/unshield/blob/main/lib/cabfile.h"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class CommonHeader
{
/// <summary>
/// "ISc("
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Signature;
/// <summary>
/// Encoded version
/// </summary>
public uint Version { get; set; }
public uint Version;
/// <summary>
/// Volume information
/// </summary>
public uint VolumeInfo { get; set; }
public uint VolumeInfo;
/// <summary>
/// Offset to cabinet descriptor
/// </summary>
public uint DescriptorOffset { get; set; }
public uint DescriptorOffset;
/// <summary>
/// Cabinet descriptor size
/// </summary>
public uint DescriptorSize { get; set; }
public uint DescriptorSize;
}
}

View File

@@ -33,7 +33,7 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved0 { get; set; }
public ushort Reserved0 { get; set; }
/// <summary>
/// Reserved offset
@@ -78,6 +78,7 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Reserved
/// </summary>
/// <remarks>32 bytes</remarks>
public byte[]? Reserved1 { get; set; }
/// <summary>
@@ -93,11 +94,13 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Reserved
/// </summary>
/// <remarks>28 bytes</remarks>
public byte[]? Reserved2 { get; set; }
/// <summary>
/// Reserved
/// </summary>
/// <remarks>2 bytes (<= v5), 1 byte (> v5)</remarks>
public byte[]? Reserved3 { get; set; }
/// <summary>

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldCabinet
{
/// <see href="https://github.com/twogood/unshield/blob/main/lib/cabfile.h"/>
@@ -6,116 +8,118 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Offset to the descriptor strings
/// </summary>
public uint StringsOffset { get; set; }
public uint StringsOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved0 { get; set; }
public uint Reserved0;
/// <summary>
/// Offset to the component list
/// </summary>
public uint ComponentListOffset { get; set; }
public uint ComponentListOffset;
/// <summary>
/// Offset to the file table
/// </summary>
public uint FileTableOffset { get; set; }
public uint FileTableOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved1 { get; set; }
public uint Reserved1;
/// <summary>
/// Size of the file table
/// </summary>
public uint FileTableSize { get; set; }
public uint FileTableSize;
/// <summary>
/// Redundant size of the file table
/// </summary>
public uint FileTableSize2 { get; set; }
public uint FileTableSize2;
/// <summary>
/// Number of directories
/// </summary>
public ushort DirectoryCount { get; set; }
public ushort DirectoryCount;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved2 { get; set; }
public uint Reserved2;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved3 { get; set; }
public ushort Reserved3;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved4 { get; set; }
public uint Reserved4;
/// <summary>
/// Number of files
/// </summary>
public uint FileCount { get; set; }
public uint FileCount;
/// <summary>
/// Redundant offset to the file table
/// </summary>
public uint FileTableOffset2 { get; set; }
public uint FileTableOffset2;
/// <summary>
/// Number of component table infos
/// </summary>
public ushort ComponentTableInfoCount { get; set; }
public ushort ComponentTableInfoCount;
/// <summary>
/// Offset to the component table
/// </summary>
public uint ComponentTableOffset { get; set; }
public uint ComponentTableOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved5 { get; set; }
public uint Reserved5;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved6 { get; set; }
public uint Reserved6;
/// <summary>
/// Offsets to the file groups
/// </summary>
public uint[]? FileGroupOffsets { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 71)]
public uint[]? FileGroupOffsets;
/// <summary>
/// Offsets to the components
/// </summary>
public uint[]? ComponentOffsets { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 71)]
public uint[]? ComponentOffsets;
/// <summary>
/// Offset to the setup types
/// </summary>
public uint SetupTypesOffset { get; set; }
public uint SetupTypesOffset;
/// <summary>
/// Offset to the setup table
/// </summary>
public uint SetupTableOffset { get; set; }
public uint SetupTableOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved7 { get; set; }
public uint Reserved7;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved8 { get; set; }
public uint Reserved8;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Fixup Page Table provides a simple mapping of a logical page number
@@ -15,6 +17,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FixupPageTableEntry
{
/// <summary>
@@ -28,6 +31,6 @@
/// This field specifies the offset following the last fixup record in the
/// fixup record table. This is the last entry in the fixup page table. (n + 1)
/// </remarks>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The `information block` in the LE header contains the linker version number,
@@ -10,6 +12,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class InformationBlock
{
/// <summary>
@@ -21,7 +24,8 @@
/// The signature word is used by the loader to identify the EXE
/// file as a valid 32-bit Linear Executable Module Format.
/// </remarks>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? Signature;
/// <summary>
/// Byte Ordering.
@@ -29,7 +33,8 @@
/// <remarks>
/// This byte specifies the byte ordering for the linear EXE format.
/// </remarks>
public ByteOrder ByteOrder { get; set; }
[MarshalAs(UnmanagedType.U1)]
public ByteOrder ByteOrder;
/// <summary>
/// Word Ordering.
@@ -37,7 +42,8 @@
/// <remarks>
/// This byte specifies the Word ordering for the linear EXE format.
/// </remarks>
public WordOrder WordOrder { get; set; }
[MarshalAs(UnmanagedType.U1)]
public WordOrder WordOrder;
/// <summary>
/// Linear EXE Format Level.
@@ -49,7 +55,7 @@
/// future EXE file versions so that an appropriate error message may be
/// displayed if an attempt is made to load them.
/// </remarks>
public uint ExecutableFormatLevel { get; set; }
public uint ExecutableFormatLevel;
/// <summary>
/// Module CPU Type.
@@ -57,7 +63,8 @@
/// <remarks>
/// This field specifies the type of CPU required by this module to run.
/// </remarks>
public CPUType CPUType { get; set; }
[MarshalAs(UnmanagedType.U2)]
public CPUType CPUType;
/// <summary>
/// Module OS Type.
@@ -65,7 +72,8 @@
/// <remarks>
/// This field specifies the type of Operating system required to run this module.
/// </remarks>
public OperatingSystem ModuleOS { get; set; }
[MarshalAs(UnmanagedType.U2)]
public OperatingSystem ModuleOS;
/// <summary>
/// Module version
@@ -74,12 +82,13 @@
/// This is useful for differentiating between revisions of dynamic linked modules.
/// This value is specified at link time by the user.
/// </remarks>
public uint ModuleVersion { get; set; }
public uint ModuleVersion;
/// <summary>
/// Module type flags
/// </summary>
public ModuleFlags ModuleTypeFlags { get; set; }
[MarshalAs(UnmanagedType.U4)]
public ModuleFlags ModuleTypeFlags;
/// <summary>
/// Number of pages in module.
@@ -94,7 +103,7 @@
/// EXE module. This is used to determine the size of the page information tables
/// in the linear EXE module.
/// </remarks>
public uint ModuleNumberPages { get; set; }
public uint ModuleNumberPages;
/// <summary>
/// The Object number to which the Entry Address is relative.
@@ -109,7 +118,7 @@
/// is set, then the object to which this field refers must be a 32-bit object (i.e.,
/// the Big/Default bit must be set in the object flags; see below).
/// </remarks>
public uint InitialObjectCS { get; set; }
public uint InitialObjectCS;
/// <summary>
/// Entry Address of module.
@@ -118,7 +127,7 @@
/// The Entry Address is the starting address for program modules and the library
/// initialization and Library termination address for library modules.
/// </remarks>
public uint InitialEIP { get; set; }
public uint InitialEIP;
/// <summary>
/// The Object number to which the ESP is relative.
@@ -128,7 +137,7 @@
/// nonzero value for a program module to be correctly loaded. This field is ignored
/// for a library module.
/// </remarks>
public uint InitialObjectSS { get; set; }
public uint InitialObjectSS;
/// <summary>
/// Starting stack address of module.
@@ -138,7 +147,7 @@
/// value in this field indicates that the stack pointer is to be initialized to the
/// highest address/offset in the object. This field is ignored for a library module.
/// </remarks>
public uint InitialESP { get; set; }
public uint InitialESP;
/// <summary>
/// The size of one page for this system.
@@ -148,7 +157,7 @@
/// For the initial version of this linear EXE format the page size is 4Kbytes.
/// (The 4K page size is specified by a value of 4096 in this field.)
/// </remarks>
public uint MemoryPageSize { get; set; }
public uint MemoryPageSize;
/// <summary>
/// The shift left bits for page offsets.
@@ -162,7 +171,7 @@
/// 512 byte (disk sector) basis. The default value for this field is 12 (decimal),
/// which give a 4096 byte alignment. All other offsets are byte aligned.
/// </remarks>
public uint BytesOnLastPage { get; set; }
public uint BytesOnLastPage;
/// <summary>
/// Total size of the fixup information in bytes.
@@ -174,7 +183,7 @@
/// - Import Module name Table
/// - Import Procedure Name Table
/// </remarks>
public uint FixupSectionSize { get; set; }
public uint FixupSectionSize;
/// <summary>
/// Checksum for fixup information.
@@ -185,7 +194,7 @@
/// not always loaded into main memory with the 'loader section'. If the checksum
/// feature is not implemented, then the linker will set these fields to zero.
/// </remarks>
public uint FixupSectionChecksum { get; set; }
public uint FixupSectionChecksum;
/// <summary>
/// Size of memory resident tables.
@@ -195,7 +204,7 @@
/// for the module, while the module is in use. This total size includes all
/// tables from the Object Table down to and including the Per-Page Checksum Table.
/// </remarks>
public uint LoaderSectionSize { get; set; }
public uint LoaderSectionSize;
/// <summary>
/// Checksum for loader section.
@@ -205,7 +214,7 @@
/// If the checksum feature is not implemented, then the linker will set these fields
/// to zero.
/// </remarks>
public uint LoaderSectionChecksum { get; set; }
public uint LoaderSectionChecksum;
/// <summary>
/// Object Table offset.
@@ -213,7 +222,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ObjectTableOffset { get; set; }
public uint ObjectTableOffset;
/// <summary>
/// Object Table Count.
@@ -221,7 +230,7 @@
/// <remarks>
/// This defines the number of entries in Object Table.
/// </remarks>
public uint ObjectTableCount { get; set; }
public uint ObjectTableCount;
/// <summary>
/// Object Page Table offset
@@ -229,7 +238,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ObjectPageMapOffset { get; set; }
public uint ObjectPageMapOffset;
/// <summary>
/// Object Iterated Pages offset.
@@ -237,7 +246,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ObjectIterateDataMapOffset { get; set; }
public uint ObjectIterateDataMapOffset;
/// <summary>
/// Resource Table offset
@@ -245,12 +254,12 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ResourceTableOffset { get; set; }
public uint ResourceTableOffset;
/// <summary>
/// Number of entries in Resource Table.
/// </summary>
public uint ResourceTableCount { get; set; }
public uint ResourceTableCount;
/// <summary>
/// Resident Name Table offset.
@@ -258,7 +267,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ResidentNamesTableOffset { get; set; }
public uint ResidentNamesTableOffset;
/// <summary>
/// Entry Table offset.
@@ -266,7 +275,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint EntryTableOffset { get; set; }
public uint EntryTableOffset;
/// <summary>
/// Module Format Directives Table offset.
@@ -274,7 +283,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ModuleDirectivesTableOffset { get; set; }
public uint ModuleDirectivesTableOffset;
/// <summary>
/// Number of Module Format Directives in the Table.
@@ -283,7 +292,7 @@
/// This field specifies the number of entries in the
/// Module Format Directives Table.
/// </remarks>
public uint ModuleDirectivesCount { get; set; }
public uint ModuleDirectivesCount;
/// <summary>
/// Fixup Page Table offset.
@@ -291,7 +300,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint FixupPageTableOffset { get; set; }
public uint FixupPageTableOffset;
/// <summary>
/// Fixup Record Table offset.
@@ -299,7 +308,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint FixupRecordTableOffset { get; set; }
public uint FixupRecordTableOffset;
/// <summary>
/// Import Module Name Table offset.
@@ -307,12 +316,12 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ImportedModulesNameTableOffset { get; set; }
public uint ImportedModulesNameTableOffset;
/// <summary>
/// The number of entries in the Import Module Name Table.
/// </summary>
public uint ImportedModulesCount { get; set; }
public uint ImportedModulesCount;
/// <summary>
/// Import Procedure Name Table offset.
@@ -320,7 +329,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ImportProcedureNameTableOffset { get; set; }
public uint ImportProcedureNameTableOffset;
/// <summary>
/// Per-page Checksum Table offset.
@@ -328,7 +337,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint PerPageChecksumTableOffset { get; set; }
public uint PerPageChecksumTableOffset;
/// <summary>
/// Data Pages Offset.
@@ -336,7 +345,7 @@
/// <remarks>
/// This offset is relative to the beginning of the EXE file.
/// </remarks>
public uint DataPagesOffset { get; set; }
public uint DataPagesOffset;
/// <summary>
/// Number of Preload pages for this module.
@@ -345,7 +354,7 @@
/// Note that OS/2 2.0 does not respect the preload of pages as specified
/// in the executable file for performance reasons.
/// </remarks>
public uint PreloadPageCount { get; set; }
public uint PreloadPageCount;
/// <summary>
/// Non-Resident Name Table offset.
@@ -353,12 +362,12 @@
/// <remarks>
/// This offset is relative to the beginning of the EXE file.
/// </remarks>
public uint NonResidentNamesTableOffset { get; set; }
public uint NonResidentNamesTableOffset;
/// <summary>
/// Number of bytes in the Non-resident name table.
/// </summary>
public uint NonResidentNamesTableLength { get; set; }
public uint NonResidentNamesTableLength;
/// <summary>
/// Non-Resident Name Table Checksum.
@@ -366,7 +375,7 @@
/// <remarks>
/// This is a cryptographic checksum of the Non-Resident Name Table.
/// </remarks>
public uint NonResidentNamesTableChecksum { get; set; }
public uint NonResidentNamesTableChecksum;
/// <summary>
/// The Auto Data Segment Object number.
@@ -376,7 +385,7 @@
/// This field is supported for 16-bit compatibility only and is not used by
/// 32-bit modules.
/// </remarks>
public uint AutomaticDataObject { get; set; }
public uint AutomaticDataObject;
/// <summary>
/// Debug Information offset.
@@ -384,7 +393,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint DebugInformationOffset { get; set; }
public uint DebugInformationOffset;
/// <summary>
/// Debug Information length.
@@ -392,7 +401,7 @@
/// <remarks>
/// The length of the debug information in bytes.
/// </remarks>
public uint DebugInformationLength { get; set; }
public uint DebugInformationLength;
/// <summary>
/// Instance pages in preload section.
@@ -400,7 +409,7 @@
/// <remarks>
/// The number of instance data pages found in the preload section.
/// </remarks>
public uint PreloadInstancePagesNumber { get; set; }
public uint PreloadInstancePagesNumber;
/// <summary>
/// Instance pages in demand section.
@@ -408,7 +417,7 @@
/// <remarks>
/// The number of instance data pages found in the demand section.
/// </remarks>
public uint DemandInstancePagesNumber { get; set; }
public uint DemandInstancePagesNumber;
/// <summary>
/// Heap size added to the Auto DS Object.
@@ -418,6 +427,6 @@
/// by the loader. This field is supported for 16-bit compatibility only and
/// is not used by 32-bit modules.
/// </remarks>
public uint ExtraHeapAllocation { get; set; }
public uint ExtraHeapAllocation;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Module Format Directives Table is an optional table that allows additional
@@ -13,6 +15,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ModuleFormatDirectivesTableEntry
{
/// <summary>
@@ -22,7 +25,8 @@
/// The directive number specifies the type of directive defined. This can be
/// used to determine the format of the information in the directive data.
/// </remarks>
public DirectiveNumber DirectiveNumber { get; set; }
[MarshalAs(UnmanagedType.U2)]
public DirectiveNumber DirectiveNumber;
/// <summary>
/// Directive data length.
@@ -30,7 +34,7 @@
/// <remarks>
/// This specifies the length in byte of the directive data for this directive number.
/// </remarks>
public ushort DirectiveDataLength { get; set; }
public ushort DirectiveDataLength;
/// <summary>
/// Directive data offset.
@@ -40,6 +44,6 @@
/// to beginning of linear EXE header for a resident table, and relative to the
/// beginning of the EXE file for non-resident tables.
/// </remarks>
public uint DirectiveDataOffset { get; set; }
public uint DirectiveDataOffset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Object page table provides information about a logical page in an object.
@@ -13,6 +15,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ObjectPageMapEntry
{
/// <summary>
@@ -35,7 +38,7 @@
/// The logical page number (Object Page Table index), is used to index the Fixup
/// Page Table to find any fixups associated with the logical page.
/// </remarks>
public uint PageDataOffset { get; set; }
public uint PageDataOffset;
/// <summary>
/// Number of bytes of data for this page.
@@ -47,11 +50,12 @@
/// bytes are to be filled with zeros. If the FLAGS field indicates an Iterated Data
/// Page, the iterated data records will completely fill out the remainder.
/// </remarks>
public ushort DataSize { get; set; }
public ushort DataSize;
/// <summary>
/// Attributes specifying characteristics of this logical page.
/// </summary>
public ObjectPageFlags Flags { get; set; }
[MarshalAs(UnmanagedType.U2)]
public ObjectPageFlags Flags;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The object table contains information that describes each segment in
@@ -12,6 +14,7 @@
/// </remarks>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ObjectTableEntry
{
/// <summary>
@@ -24,7 +27,7 @@
/// file for the object. This memory size must also be large enough to
/// contain all of the iterated data and uninitialized data in the EXE file.
/// </remarks>
public uint VirtualSegmentSize { get; set; }
public uint VirtualSegmentSize;
/// <summary>
/// Relocation Base Address.
@@ -34,12 +37,13 @@
/// internal relocation fixups for the module have been removed, this is the
/// address the object will be allocated at by the loader.
/// </remarks>
public uint RelocationBaseAddress { get; set; }
public uint RelocationBaseAddress;
/// <summary>
/// Flag bits for the object.
/// </summary>
public ObjectFlags ObjectFlags { get; set; }
[MarshalAs(UnmanagedType.U2)]
public ObjectFlags ObjectFlags;
/// <summary>
/// Object Page Table Index.
@@ -53,7 +57,7 @@
/// other words the object table entries are sorted based on the object page table
/// index value.
/// </remarks>
public uint PageTableIndex { get; set; }
public uint PageTableIndex;
/// <summary>
/// # of object page table entries for this object.
@@ -69,11 +73,11 @@
/// was neither a zero filled or invalid page, then the additional pages are treated
/// as zero filled pages.
/// </remarks>
public uint PageTableEntries { get; set; }
public uint PageTableEntries;
/// <summary>
/// Reserved for future use. Must be set to zero.
/// </summary>
public uint Reserved { get; set; }
public uint Reserved;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Per-Page Checksum table provides space for a cryptographic checksum for
@@ -11,11 +13,12 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class PerPageChecksumTableEntry
{
/// <summary>
/// Cryptographic checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The resource table is an array of resource table entries. Each resource table
@@ -13,31 +15,33 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceTableEntry
{
/// <summary>
/// Resource type ID.
/// </summary>
public ResourceTableEntryType TypeID { get; set; }
[MarshalAs(UnmanagedType.U4)]
public ResourceTableEntryType TypeID;
/// <summary>
/// An ID used as a name for the resource when referred to.
/// </summary>
public ushort NameID { get; set; }
public ushort NameID;
/// <summary>
/// The number of bytes the resource consists of.
/// </summary>
public uint ResourceSize { get; set; }
public uint ResourceSize;
/// <summary>
/// The number of the object which contains the resource.
/// </summary>
public ushort ObjectNumber { get; set; }
public ushort ObjectNumber;
/// <summary>
/// The offset within the specified object where the resource begins.
/// </summary>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Verify Record Directive Table is an optional table. It maintains a record
@@ -9,6 +11,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class VerifyRecordDirectiveTableEntry
{
/// <summary>
@@ -19,7 +22,7 @@
/// directive table. This is equal to the number of modules referenced by
/// this module.
/// </remarks>
public ushort EntryCount { get; set; }
public ushort EntryCount;
/// <summary>
/// Ordinal index into the Import Module Name Table.
@@ -28,7 +31,7 @@
/// This value is an ordered index in to the Import Module Name Table for
/// the referenced module.
/// </remarks>
public ushort OrdinalIndex { get; set; }
public ushort OrdinalIndex;
/// <summary>
/// Module Version.
@@ -41,7 +44,7 @@
/// number in a module to be incremented anytime the entry point offsets
/// change.
/// </remarks>
public ushort Version { get; set; }
public ushort Version;
/// <summary>
/// Module # of Object Entries.
@@ -50,7 +53,7 @@
/// This field is used to identify the number of object verify entries
/// that follow for the referenced module.
/// </remarks>
public ushort ObjectEntriesCount { get; set; }
public ushort ObjectEntriesCount;
/// <summary>
/// Object # in Module.
@@ -59,7 +62,7 @@
/// This field specifies the object number in the referenced module that
/// is being verified.
/// </remarks>
public ushort ObjectNumberInModule { get; set; }
public ushort ObjectNumberInModule;
/// <summary>
/// Object load base address.
@@ -68,7 +71,7 @@
/// This is the address that the object was loaded at when the fixups were
/// performed.
/// </remarks>
public ushort ObjectLoadBaseAddress { get; set; }
public ushort ObjectLoadBaseAddress;
/// <summary>
/// Object virtual address size.
@@ -77,6 +80,6 @@
/// This field specifies the total amount of virtual memory required for
/// this object.
/// </remarks>
public ushort ObjectVirtualAddressSize { get; set; }
public ushort ObjectVirtualAddressSize;
}
}

View File

@@ -1,19 +1,22 @@
namespace SabreTools.Models.MSDOS
using System.Runtime.InteropServices;
namespace SabreTools.Models.MSDOS
{
/// <summary>
/// Each pointer in the relocation table looks as such
/// </summary>
/// <see href="https://wiki.osdev.org/MZ"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class RelocationEntry
{
/// <summary>
/// Offset of the relocation within provided segment.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// Segment of the relocation, relative to the load segment address.
/// </summary>
public ushort Segment { get; set; }
public ushort Segment;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.MoPaQ
using System.Runtime.InteropServices;
namespace SabreTools.Models.MoPaQ
{
/// <summary>
/// Block table contains informations about file sizes and way of their storage within
@@ -6,26 +8,28 @@
/// of block table entry is (like hash table entry). The block table is also encrypted.
/// </summary>
/// <see href="http://zezula.net/en/mpq/mpqformat.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntry
{
/// <summary>
/// Offset of the beginning of the file data, relative to the beginning of the archive.
/// </summary>
public uint FilePosition { get; set; }
public uint FilePosition;
/// <summary>
/// Compressed file size
/// </summary>
public uint CompressedSize { get; set; }
public uint CompressedSize;
/// <summary>
/// Size of uncompressed file
/// </summary>
public uint UncompressedSize { get; set; }
public uint UncompressedSize;
/// <summary>
/// Flags for the file.
/// </summary>
public FileFlags Flags { get; set; }
[MarshalAs(UnmanagedType.U4)]
public FileFlags Flags;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.MoPaQ
using System.Runtime.InteropServices;
namespace SabreTools.Models.MoPaQ
{
/// <summary>
/// Hash table is used for searching files by name. The file name is converted to
@@ -8,29 +10,31 @@
/// table is 16 bytes.
/// </summary>
/// <see href="http://zezula.net/en/mpq/mpqformat.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class HashEntry
{
/// <summary>
/// The hash of the full file name (part A)
/// </summary>
public uint NameHashPartA { get; set; }
public uint NameHashPartA;
/// <summary>
/// The hash of the full file name (part B)
/// </summary>
public uint NameHashPartB { get; set; }
public uint NameHashPartB;
/// <summary>
/// The language of the file. This is a Windows LANGID data type, and uses the same values.
/// 0 indicates the default language (American English), or that the file is language-neutral.
/// </summary>
public Locale Locale { get; set; }
[MarshalAs(UnmanagedType.I2)]
public Locale Locale;
/// <summary>
/// The platform the file is used for. 0 indicates the default platform.
/// No other values have been observed.
/// </summary>
public ushort Platform { get; set; }
public ushort Platform;
/// <summary>
/// If the hash table entry is valid, this is the index into the block table of the file.
@@ -40,6 +44,6 @@
/// - FFFFFFFEh: Hash table entry is empty, but was valid at some point (a deleted file).
/// Does not terminate searches for a given file.
/// </summary>
public uint BlockIndex { get; set; }
public uint BlockIndex;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumEntry
{
/// <summary>
/// Checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Size of LPNCFCHECKSUMHEADER & LPNCFCHECKSUMMAPHEADER & in bytes.
/// </summary>
public uint ChecksumSize { get; set; }
public uint ChecksumSize;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapEntry
{
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
/// <summary>
/// Index of first checksum.
/// </summary>
public uint FirstChecksumIndex { get; set; }
public uint FirstChecksumIndex;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapHeader
{
/// <summary>
/// Always 0x14893721
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Number of items.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryCopyEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,76 +1,79 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryHeader
{
/// <summary>
/// Always 0x00000004
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Cache ID.
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// NCF file version.
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Number of items in the directory.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of files in the directory.
/// </summary>
public uint FileCount { get; set; }
public uint FileCount;
/// <summary>
/// Always 0x00008000. Data per checksum?
/// </summary>
public uint ChecksumDataLength { get; set; }
public uint ChecksumDataLength;
/// <summary>
/// Size of lpNCFDirectoryEntries & lpNCFDirectoryNames & lpNCFDirectoryInfo1Entries & lpNCFDirectoryInfo2Entries & lpNCFDirectoryCopyEntries & lpNCFDirectoryLocalEntries in bytes.
/// </summary>
public uint DirectorySize { get; set; }
public uint DirectorySize;
/// <summary>
/// Size of the directory names in bytes.
/// </summary>
public uint NameSize { get; set; }
public uint NameSize;
/// <summary>
/// Number of Info1 entires.
/// </summary>
public uint Info1Count { get; set; }
public uint Info1Count;
/// <summary>
/// Number of files to copy.
/// </summary>
public uint CopyCount { get; set; }
public uint CopyCount;
/// <summary>
/// Number of files to keep local.
/// </summary>
public uint LocalCount { get; set; }
public uint LocalCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo1Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo2Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryLocalEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,61 +1,64 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000002
/// </summary>
public uint MajorVersion { get; set; }
public uint MajorVersion;
/// <summary>
/// NCF version number.
/// </summary>
public uint MinorVersion { get; set; }
public uint MinorVersion;
/// <summary>
/// Cache ID
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// Last version played
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Total size of NCF file in bytes.
/// </summary>
public uint FileSize { get; set; }
public uint FileSize;
/// <summary>
/// Size of each data block in bytes.
/// </summary>
public uint BlockSize { get; set; }
public uint BlockSize;
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class UnknownEntry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class UnknownHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000000
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
@@ -6,6 +8,7 @@ namespace SabreTools.Models.NewExecutable
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://github.com/libyal/libexe/blob/main/documentation/Executable%20(EXE)%20file%20format.asciidoc#24-ne-extended-header"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class ExecutableHeader
{
/// <summary>
@@ -13,38 +16,40 @@ namespace SabreTools.Models.NewExecutable
/// "N" is low-order byte.
/// "E" is high-order byte.
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? Magic;
/// <summary>
/// Version number of the linker.
/// </summary>
public byte LinkerVersion { get; set; }
public byte LinkerVersion;
/// <summary>
/// Revision number of the linker.
/// </summary>
public byte LinkerRevision { get; set; }
public byte LinkerRevision;
/// <summary>
/// Entry Table file offset, relative to the beginning of the segmented EXE header.
/// </summary>
public ushort EntryTableOffset { get; set; }
public ushort EntryTableOffset;
/// <summary>
/// Number of bytes in the entry table.
/// </summary>
public ushort EntryTableSize { get; set; }
public ushort EntryTableSize;
/// <summary>
/// 32-bit CRC of entire contents of file.
/// </summary>
/// <remarks>These words are taken as 00 during the calculation.</remarks>
public uint CrcChecksum { get; set; }
public uint CrcChecksum;
/// <summary>
/// Flag word
/// </summary>
public HeaderFlag FlagWord { get; set; }
[MarshalAs(UnmanagedType.U2)]
public HeaderFlag FlagWord;
/// <summary>
/// Segment number of automatic data segment.
@@ -57,26 +62,26 @@ namespace SabreTools.Models.NewExecutable
/// table. The first entry in the segment table is segment
/// number 1.
/// </remarks>
public ushort AutomaticDataSegmentNumber { get; set; }
public ushort AutomaticDataSegmentNumber;
/// <summary>
/// Initial size, in bytes, of dynamic heap added to the
/// data segment. This value is zero if no initial local
/// heap is allocated.
/// </summary>
public ushort InitialHeapAlloc { get; set; }
public ushort InitialHeapAlloc;
/// <summary>
/// Initial size, in bytes, of stack added to the data
/// segment. This value is zero to indicate no initial
/// stack allocation, or when SS is not equal to DS.
/// </summary>
public ushort InitialStackAlloc { get; set; }
public ushort InitialStackAlloc;
/// <summary>
/// Segment number:offset of CS:IP.
/// </summary>
public uint InitialCSIPSetting { get; set; }
public uint InitialCSIPSetting;
/// <summary>
/// Segment number:offset of SS:SP.
@@ -87,108 +92,110 @@ namespace SabreTools.Models.NewExecutable
/// automatic data segment just below the additional heap
/// area.
/// </remarks>
public uint InitialSSSPSetting { get; set; }
public uint InitialSSSPSetting;
/// <summary>
/// Number of entries in the Segment Table.
/// </summary>
public ushort FileSegmentCount { get; set; }
public ushort FileSegmentCount;
/// <summary>
/// Number of entries in the Module Reference Table.
/// </summary>
public ushort ModuleReferenceTableSize { get; set; }
public ushort ModuleReferenceTableSize;
/// <summary>
/// Number of bytes in the Non-Resident Name Table.
/// </summary>
public ushort NonResidentNameTableSize { get; set; }
public ushort NonResidentNameTableSize;
/// <summary>
/// Segment Table file offset, relative to the beginning
/// of the segmented EXE header.
/// </summary>
public ushort SegmentTableOffset { get; set; }
public ushort SegmentTableOffset;
/// <summary>
/// Resource Table file offset, relative to the beginning
/// of the segmented EXE header.
/// </summary>
public ushort ResourceTableOffset { get; set; }
public ushort ResourceTableOffset;
/// <summary>
/// Resident Name Table file offset, relative to the
/// beginning of the segmented EXE header.
/// </summary>
public ushort ResidentNameTableOffset { get; set; }
public ushort ResidentNameTableOffset;
/// <summary>
/// Module Reference Table file offset, relative to the
/// beginning of the segmented EXE header.
/// </summary>
public ushort ModuleReferenceTableOffset { get; set; }
public ushort ModuleReferenceTableOffset;
/// <summary>
/// Imported Names Table file offset, relative to the
/// beginning of the segmented EXE header.
/// </summary>
public ushort ImportedNamesTableOffset { get; set; }
public ushort ImportedNamesTableOffset;
/// <summary>
/// Non-Resident Name Table offset, relative to the
/// beginning of the file.
/// </summary>
public uint NonResidentNamesTableOffset { get; set; }
public uint NonResidentNamesTableOffset;
/// <summary>
/// Number of movable entries in the Entry Table.
/// </summary>
public ushort MovableEntriesCount { get; set; }
public ushort MovableEntriesCount;
/// <summary>
/// Logical sector alignment shift count, log(base 2) of
/// the segment sector size (default 9).
/// </summary>
public ushort SegmentAlignmentShiftCount { get; set; }
public ushort SegmentAlignmentShiftCount;
/// <summary>
/// Number of resource entries.
/// </summary>
public ushort ResourceEntriesCount { get; set; }
public ushort ResourceEntriesCount;
/// <summary>
/// Executable type, used by loader.
/// </summary>
public OperatingSystem TargetOperatingSystem { get; set; }
[MarshalAs(UnmanagedType.U1)]
public OperatingSystem TargetOperatingSystem;
/// <summary>
/// Other OS/2 flags
/// </summary>
public OS2Flag AdditionalFlags { get; set; }
[MarshalAs(UnmanagedType.U1)]
public OS2Flag AdditionalFlags;
/// <summary>
/// Offset to return thunks or start of gangload area
/// </summary>
public ushort ReturnThunkOffset { get; set; }
public ushort ReturnThunkOffset;
/// <summary>
/// Offset to segment reference thunks or size of gangload area
/// </summary>
public ushort SegmentReferenceThunkOffset { get; set; }
public ushort SegmentReferenceThunkOffset;
/// <summary>
/// Minimum code swap area size
/// </summary>
public ushort MinCodeSwapAreaSize { get; set; }
public ushort MinCodeSwapAreaSize;
/// <summary>
/// Windows SDK revison number
/// </summary>
public byte WindowsSDKRevision { get; set; }
public byte WindowsSDKRevision;
/// <summary>
/// Windows SDK version number
/// </summary>
public byte WindowsSDKVersion { get; set; }
public byte WindowsSDKVersion;
}
}

View File

@@ -1,16 +1,19 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportNameRelocationRecord
{
/// <summary>
/// Index into module reference table for the imported module.
/// </summary>
public ushort Index { get; set; }
public ushort Index;
/// <summary>
/// Offset within Imported Names Table to procedure name string.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
}
}

View File

@@ -1,16 +1,19 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportOrdinalRelocationRecord
{
/// <summary>
/// Index into module reference table for the imported module.
/// </summary>
public ushort Index { get; set; }
public ushort Index;
/// <summary>
/// Procedure ordinal number.
/// </summary>
public ushort Ordinal { get; set; }
public ushort Ordinal;
}
}

View File

@@ -1,23 +1,26 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class InternalRefRelocationRecord
{
/// <summary>
/// Segment number for a fixed segment, or 0FFh for a
/// movable segment.
/// </summary>
public byte SegmentNumber { get; set; }
public byte SegmentNumber;
/// <summary>
/// 0
/// </summary>
public byte Reserved { get; set; }
public byte Reserved;
/// <summary>
/// Offset into segment if fixed segment, or ordinal
/// number index into Entry Table if movable segment.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
/// The module-reference table follows the resident-name table. Each entry
@@ -6,11 +8,12 @@
/// names table; each entry is 2 bytes long.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ModuleReferenceTableEntry
{
/// <summary>
/// Offset within Imported Names Table to referenced module name string.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
}
}

View File

@@ -1,17 +1,21 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class OSFixupRelocationRecord
{
/// <summary>
/// Operating system fixup type.
/// Floating-point fixups.
/// </summary>
public OSFixupType FixupType { get; set; }
[MarshalAs(UnmanagedType.U2)]
public OSFixupType FixupType;
/// <summary>
/// 0
/// </summary>
public ushort Reserved { get; set; }
public ushort Reserved;
}
}

View File

@@ -1,10 +1,13 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
/// A table of resources for this type follows. The following is
/// the format of each resource (8 bytes each):
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceTypeResourceEntry
{
/// <summary>
@@ -13,17 +16,18 @@
/// of the alignment shift count value specified at
/// beginning of the resource table.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// Length of the resource in the file (in bytes).
/// </summary>
public ushort Length { get; set; }
public ushort Length;
/// <summary>
/// Flag word.
/// </summary>
public ResourceTypeResourceFlag FlagWord { get; set; }
[MarshalAs(UnmanagedType.U2)]
public ResourceTypeResourceFlag FlagWord;
/// <summary>
/// Resource ID. This is an integer type if the high-order
@@ -31,11 +35,11 @@
/// resource string, the offset is relative to the
/// beginning of the resource table.
/// </summary>
public ushort ResourceID { get; set; }
public ushort ResourceID;
/// <summary>
/// Reserved.
/// </summary>
public uint Reserved { get; set; }
public uint Reserved;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
/// The segment table contains an entry for each segment in the executable
@@ -7,6 +9,7 @@
/// The following is the structure of a segment table entry.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SegmentTableEntry
{
/// <summary>
@@ -14,22 +17,23 @@
/// data, relative to the beginning of the file. Zero means no
/// file data.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// Length of the segment in the file, in bytes. Zero means 64K.
/// </summary>
public ushort Length { get; set; }
public ushort Length;
/// <summary>
/// Flag word.
/// </summary>
public SegmentTableEntryFlag FlagWord { get; set; }
[MarshalAs(UnmanagedType.U2)]
public SegmentTableEntryFlag FlagWord;
/// <summary>
/// Minimum allocation size of the segment, in bytes. Total size
/// of the segment. Zero means 64K.
/// </summary>
public ushort MinimumAllocationSize { get; set; }
public ushort MinimumAllocationSize;
}
}

View File

@@ -1,21 +1,25 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PAK
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/PAKFile.h"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class DirectoryItem
{
/// <summary>
/// Item Name
/// </summary>
public string? ItemName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 56)]
public string? ItemName;
/// <summary>
/// Item Offset
/// </summary>
public uint ItemOffset { get; set; }
public uint ItemOffset;
/// <summary>
/// Item Length
/// </summary>
public uint ItemLength { get; set; }
public uint ItemLength;
}
}

View File

@@ -1,21 +1,25 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PAK
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/PAKFile.h"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// Signature
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Signature;
/// <summary>
/// Directory Offset
/// </summary>
public uint DirectoryOffset { get; set; }
public uint DirectoryOffset;
/// <summary>
/// Directory Length
/// </summary>
public uint DirectoryLength { get; set; }
public uint DirectoryLength;
}
}

View File

@@ -1,24 +1,28 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PFF
{
/// <summary>
/// PFF file footer
/// </summary>
/// <see href="https://devilsclaws.net/download/file-pff-new-bz2"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Footer
{
/// <summary>
/// Current system IP
/// </summary>
public uint SystemIP { get; set; }
public uint SystemIP;
/// <summary>
/// Reserved
/// </summary>
public uint Reserved { get; set; }
public uint Reserved;
/// <summary>
/// King tag
/// </summary>
public string? KingTag { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? KingTag;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PFF
{
/// <summary>
@@ -5,32 +7,34 @@ namespace SabreTools.Models.PFF
/// </summary>
/// <remarks>Versions 2, 3, and 4 supported</remarks>
/// <see href="https://devilsclaws.net/download/file-pff-new-bz2"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// Size of the following header
/// </summary>
public uint HeaderSize { get; set; }
public uint HeaderSize;
/// <summary>
/// Signature
/// </summary>
/// <remarks>Versions 2 and 3 share the same signature but different header sizes</remarks>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Signature;
/// <summary>
/// Number of files
/// </summary>
public uint NumberOfFiles { get; set; }
public uint NumberOfFiles;
/// <summary>
/// File segment size
/// </summary>
public uint FileSegmentSize { get; set; }
public uint FileSegmentSize;
/// <summary>
/// File list offset
/// </summary>
public uint FileListOffset { get; set; }
public uint FileListOffset;
}
}

View File

@@ -7,10 +7,6 @@ namespace SabreTools.Models.PIC
{
/// <summary>
/// Disc Type Identifier
/// = "BDO" for BD-ROM
/// = "BDU" for BD-ROM Ultra
/// = "BDW" for BD-RE
/// = "BDR" for BD-R
/// </summary>
public string? DiscTypeIdentifier { get; set; }

View File

@@ -1,43 +1,47 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class DiscInformationUnitHeader
{
/// <summary>
/// Disc Information Identifier "DI"
/// Emergency Brake Identifier "EB"
/// </summary>
public string? DiscInformationIdentifier { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? DiscInformationIdentifier;
/// <summary>
/// Disc Information Format
/// </summary>
public byte DiscInformationFormat { get; set; }
public byte DiscInformationFormat;
/// <summary>
/// Number of DI units in each DI block
/// </summary>
public byte NumberOfUnitsInBlock { get; set; }
public byte NumberOfUnitsInBlock;
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved0 { get; set; }
public byte Reserved0;
/// <summary>
/// DI unit Sequence Number
/// </summary>
public byte SequenceNumber { get; set; }
public byte SequenceNumber;
/// <summary>
/// Number of bytes in use in this DI unit
/// </summary>
public byte BytesInUse { get; set; }
public byte BytesInUse;
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved1 { get; set; }
public byte Reserved1;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PIC
{
/// <summary>
@@ -5,28 +7,31 @@ namespace SabreTools.Models.PIC
/// </summary>
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
[StructLayout(LayoutKind.Sequential)]
public class DiscInformationUnitTrailer
{
/// <summary>
/// Disc Manufacturer ID
/// </summary>
/// <remarks>6 bytes</remarks>
public byte[]? DiscManufacturerID { get; set; } = new byte[6];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? DiscManufacturerID;
/// <summary>
/// Media Type ID
/// </summary>
/// <remarks>3 bytes</remarks>
public byte[]? MediaTypeID { get; set; } = new byte[3];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[]? MediaTypeID;
/// <summary>
/// Time Stamp
/// </summary>
public ushort TimeStamp { get; set; }
public ushort TimeStamp;
/// <summary>
/// Product Revision Number
/// </summary>
public byte ProductRevisionNumber { get; set; }
public byte ProductRevisionNumber;
}
}

View File

@@ -1,29 +1,32 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Zip64 end of central directory locator
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
[StructLayout(LayoutKind.Sequential)]
public class EndOfCentralDirectoryLocator64
{
/// <summary>
/// ZIP64 end of central directory locator signature (0x07064B50)
/// </summary>
public uint Signature { get; set; }
public uint Signature;
/// <summary>
/// Number of the disk with the start of the end of central directory
/// </summary>
public uint StartDiskNumber { get; set; }
public uint StartDiskNumber;
/// <summary>
/// Relative offset of start of central directory record
/// </summary>
public ulong CentralDirectoryOffset { get; set; }
public ulong CentralDirectoryOffset;
/// <summary>
/// Total number of disks
/// </summary>
public uint TotalDisks { get; set; }
public uint TotalDisks;
}
}

View File

@@ -1,96 +1,110 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PlayStation3
{
/// <see href="https://psdevwiki.com/ps3/PS3_DISC.SFB"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class SFB
{
/// <summary>
/// ".SFB"
/// </summary>
public byte[]? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? Magic;
/// <summary>
/// File version(?)
/// </summary>
public uint FileVersion { get; set; }
public uint FileVersion;
/// <summary>
/// Unknown (zeroes)
/// </summary>
/// <remarks>0x18 bytes</remarks>
public byte[]? Reserved1 { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x18)]
public byte[]? Reserved1;
/// <summary>
/// "HYBRID_FLAG" (Flags type)
/// </summary>
/// <remarks>0x10 bytes</remarks>
public string? FlagsType { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)]
public string? FlagsType;
/// <summary>
/// Disc Content Data Offset
/// </summary>
public uint DiscContentDataOffset { get; set; }
public uint DiscContentDataOffset;
/// <summary>
/// Disc Content Data Length
/// </summary>
public uint DiscContentDataLength { get; set; }
public uint DiscContentDataLength;
/// <summary>
/// Unknown (zeroes)
/// </summary>
/// <remarks>0x08 bytes</remarks>
public byte[]? Reserved2 { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x08)]
public byte[]? Reserved2;
/// <summary>
/// "TITLE_ID" (Disc Title Name)
/// </summary>
/// <remarks>0x08 bytes</remarks>
public string? DiscTitleName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x08)]
public string? DiscTitleName;
/// <summary>
/// Unknown (zeroes)
/// </summary>
/// <remarks>0x08 bytes</remarks>
public byte[]? Reserved3 { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x08)]
public byte[]? Reserved3;
/// <summary>
/// Disc Version Data Offset
/// </summary>
public uint DiscVersionDataOffset { get; set; }
public uint DiscVersionDataOffset;
/// <summary>
/// Disc Version Data Length
/// </summary>
public uint DiscVersionDataLength { get; set; }
public uint DiscVersionDataLength;
/// <summary>
/// Unknown (zeroes)
/// </summary>
/// <remarks>0x188 bytes</remarks>
public byte[]? Reserved4 { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x188)]
public byte[]? Reserved4;
/// <summary>
/// Disc Content (Hybrid Flags)
/// </summary>
/// <remarks>0x20 bytes</remarks>
public string? DiscContent { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string? DiscContent;
/// <summary>
/// Disc Title
/// </summary>
/// <remarks>0x10 bytes</remarks>
public string? DiscTitle { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)]
public string? DiscTitle;
/// <summary>
/// Disc Version
/// </summary>
/// <remarks>0x10 bytes</remarks>
public string? DiscVersion { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)]
public string? DiscVersion;
/// <summary>
/// Unknown (zeroes)
/// </summary>
/// <remarks>0x3C0 bytes</remarks>
public byte[]? Reserved5 { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3C0)]
public byte[]? Reserved5;
}
}

View File

@@ -1,31 +1,35 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PlayStation3
{
/// <see href="https://psdevwiki.com/ps3/PARAM.SFO"/>
[StructLayout(LayoutKind.Sequential)]
public class SFOHeader
{
/// <summary>
/// "\0PSF"
/// </summary>
public byte[]? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? Magic;
/// <summary>
/// Version
/// </summary>
public uint Version { get; set; }
public uint Version;
/// <summary>
/// Absolute start offset of key_table
/// </summary>
public uint KeyTableStart { get; set; }
public uint KeyTableStart;
/// <summary>
/// Absolute start offset of data_table
/// </summary>
public uint DataTableStart { get; set; }
public uint DataTableStart;
/// <summary>
/// Number of entries in index_table, key_table, and data_table
/// </summary>
public uint TablesEntries { get; set; }
public uint TablesEntries;
}
}

View File

@@ -1,33 +1,37 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PlayStation3
{
/// <see href="https://psdevwiki.com/ps3/PARAM.SFO"/>
[StructLayout(LayoutKind.Sequential)]
public class SFOIndexTableEntry
{
/// <summary>
/// Key relative offset.
/// (Absolute start offset of key) - (Absolute start offset of key_table)
/// </summary>
public ushort KeyOffset { get; set; }
public ushort KeyOffset;
/// <summary>
/// Data type
/// </summary>
public DataFormat DataFormat { get; set; }
[MarshalAs(UnmanagedType.U2)]
public DataFormat DataFormat;
/// <summary>
/// Data used length
/// </summary>
public uint DataLength { get; set; }
public uint DataLength;
/// <summary>
/// Data total length. TITLE_ID is always = 16 bytes
/// </summary>
public uint DataMaxLength { get; set; }
public uint DataMaxLength;
/// <summary>
/// Data relative offset.
/// (Absolute start offset of data_1) - (Absolute start offset of data_table)
/// </summary>
public uint DataOffset { get; set; }
public uint DataOffset;
}
}

View File

@@ -1,31 +1,35 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Describes the data in an individual accelerator table resource. The structure definition
/// provided here is for explanation only; it is not present in any standard header file.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/acceltableentry"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class AcceleratorTableEntry
{
/// <summary>
/// Describes keyboard accelerator characteristics.
/// </summary>
public AcceleratorTableFlags Flags { get; set; }
[MarshalAs(UnmanagedType.U2)]
public AcceleratorTableFlags Flags;
/// <summary>
/// An ANSI character value or a virtual-key code that identifies the accelerator key.
/// </summary>
public ushort Ansi { get; set; }
public ushort Ansi;
/// <summary>
/// An identifier for the keyboard accelerator. This is the value passed to the window
/// procedure when the user presses the specified key.
/// </summary>
public ushort Id { get; set; }
public ushort Id;
/// <summary>
/// The number of bytes inserted to ensure that the structure is aligned on a DWORD boundary.
/// </summary>
public ushort Padding { get; set; }
public ushort Padding;
}
}

View File

@@ -1,9 +1,12 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Type or Offset field entry is a WORD (2 bytes).
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BaseRelocationTypeOffsetFieldEntry
{
/// <summary>

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// At the beginning of an object file, or immediately after the signature
@@ -6,48 +8,51 @@
/// Note that the Windows loader limits the number of sections to 96.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class COFFFileHeader
{
/// <summary>
/// The number that identifies the type of target machine.
/// </summary>
public MachineType Machine { get; set; }
[MarshalAs(UnmanagedType.U2)]
public MachineType Machine;
/// <summary>
/// The number of sections. This indicates the size of the section table,
/// which immediately follows the headers.
/// </summary>
public ushort NumberOfSections { get; set; }
public ushort NumberOfSections;
/// <summary>
/// The low 32 bits of the number of seconds since 00:00 January 1, 1970
/// (a C run-time time_t value), which indicates when the file was created.
/// </summary>
public uint TimeDateStamp { get; set; }
public uint TimeDateStamp;
/// <summary>
/// The file offset of the COFF symbol table, or zero if no COFF symbol table
/// is present. This value should be zero for an image because COFF debugging
/// information is deprecated.
/// </summary>
public uint PointerToSymbolTable { get; set; }
public uint PointerToSymbolTable;
/// <summary>
/// The number of entries in the symbol table. This data can be used to locate
/// the string table, which immediately follows the symbol table. This value
/// should be zero for an image because COFF debugging information is deprecated.
/// </summary>
public uint NumberOfSymbols { get; set; }
public uint NumberOfSymbols;
/// <summary>
/// The size of the optional header, which is required for executable files but
/// not for object files. This value should be zero for an object file.
/// </summary>
public ushort SizeOfOptionalHeader { get; set; }
public ushort SizeOfOptionalHeader;
/// <summary>
/// The flags that indicate the attributes of the file.
/// </summary>
public Characteristics Characteristics { get; set; }
[MarshalAs(UnmanagedType.U2)]
public Characteristics Characteristics;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Object files contain COFF relocations, which specify how the section data
@@ -15,6 +17,7 @@
/// specified in the section header.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class COFFRelocation
{
/// <summary>
@@ -24,7 +27,7 @@
/// For example, if the first byte of the section has an address of 0x10,
/// the third byte has an address of 0x12.
/// </summary>
public uint VirtualAddress { get; set; }
public uint VirtualAddress;
/// <summary>
/// A zero-based index into the symbol table. This symbol gives the address
@@ -32,12 +35,13 @@
/// storage class, then the symbol's address is the address with the first
/// section of the same name.
/// </summary>
public uint SymbolTableIndex { get; set; }
public uint SymbolTableIndex;
/// <summary>
/// A value that indicates the kind of relocation that should be performed.
/// Valid relocation types depend on machine type.
/// </summary>
public RelocationType TypeIndicator { get; set; }
[MarshalAs(UnmanagedType.U2)]
public RelocationType TypeIndicator;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Each data directory gives the address and size of a table or string that Windows uses.
@@ -9,6 +11,7 @@
/// that the sections that contain specific tables have specific names.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DataDirectory
{
/// <summary>
@@ -16,11 +19,11 @@
/// is the address of the table relative to the base address of the image when
/// the table is loaded.
/// </summary>
public uint VirtualAddress { get; set; }
public uint VirtualAddress;
/// <summary>
/// The second field gives the size in bytes.
/// </summary>
public uint Size { get; set; }
public uint Size;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Image files contain an optional debug directory that indicates what form
@@ -17,47 +19,49 @@
/// RVA is its address.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DebugDirectoryEntry
{
/// <summary>
/// Reserved, must be zero.
/// </summary>
public uint Characteristics { get; set; }
public uint Characteristics;
/// <summary>
/// The time and date that the debug data was created.
/// </summary>
public uint TimeDateStamp { get; set; }
public uint TimeDateStamp;
/// <summary>
/// The major version number of the debug data format.
/// </summary>
public ushort MajorVersion { get; set; }
public ushort MajorVersion;
/// <summary>
/// The minor version number of the debug data format.
/// </summary>
public ushort MinorVersion { get; set; }
public ushort MinorVersion;
/// <summary>
/// The format of debugging information. This field enables support
/// of multiple debuggers.
/// </summary>
public DebugType DebugType { get; set; }
[MarshalAs(UnmanagedType.U4)]
public DebugType DebugType;
/// <summary>
/// The size of the debug data (not including the debug directory itself).
/// </summary>
public uint SizeOfData { get; set; }
public uint SizeOfData;
/// <summary>
/// The address of the debug data when loaded, relative to the image base.
/// </summary>
public uint AddressOfRawData { get; set; }
public uint AddressOfRawData;
/// <summary>
/// The file pointer to the debug data.
/// </summary>
public uint PointerToRawData { get; set; }
public uint PointerToRawData;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// The delay-load directory table is the counterpart to the import directory
@@ -6,6 +8,7 @@
/// the optional header data directories list (offset 200).
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DelayLoadDirectoryTable
{
/// <summary>
@@ -17,7 +20,7 @@
/// indicating the presence of new fields, or it can be used to indicate
/// behaviors to the delay or unload helper functions.
/// </remarks>
public uint Attributes { get; set; }
public uint Attributes;
/// <summary>
/// The RVA of the name of the DLL to be loaded. The name resides in the
@@ -27,7 +30,7 @@
/// The name of the DLL to be delay-loaded resides in the read-only data
/// section of the image. It is referenced through the szName field.
/// </remarks>
public uint Name { get; set; }
public uint Name;
/// <summary>
/// The RVA of the module handle (in the data section of the image) of the DLL
@@ -39,7 +42,7 @@
/// The phmod field points to the handle. The supplied delay-load helper uses
/// this location to store the handle to the loaded DLL.
/// </remarks>
public uint ModuleHandle { get; set; }
public uint ModuleHandle;
/// <summary>
/// The RVA of the delay-load import address table.
@@ -51,7 +54,7 @@
/// the calling loop. The function pointers are accessed by using the expression
/// pINT->u1.Function.
/// </remarks>
public uint DelayImportAddressTable { get; set; }
public uint DelayImportAddressTable;
/// <summary>
/// The RVA of the delay-load name table, which contains the names of the imports
@@ -63,7 +66,7 @@
/// in the IAT. They consist of the same structures as the standard INT and are
/// accessed by using the expression pINT->u1.AddressOfData->Name[0].
/// </remarks>
public uint DelayImportNameTable { get; set; }
public uint DelayImportNameTable;
/// <summary>
/// The RVA of the bound delay-load address table, if it exists.
@@ -73,7 +76,7 @@
/// IMAGE_THUNK_DATA items that is used along with the timestamp field of the
/// delay-load directory table by a post-process binding phase.
/// </remarks>
public uint BoundDelayImportTable { get; set; }
public uint BoundDelayImportTable;
/// <summary>
/// The RVA of the unload delay-load address table, if it exists. This is an exact
@@ -89,7 +92,7 @@
/// On the unload request, the library can be freed, the *phmod cleared, and the
/// UIAT written over the IAT to restore everything to its preload state.
/// </remarks>
public uint UnloadDelayImportTable { get; set; }
public uint UnloadDelayImportTable;
/// <summary>
/// The timestamp of the DLL to which this image has been bound.
@@ -99,6 +102,6 @@
/// IMAGE_THUNK_DATA items that is used along with the timestamp field of the
/// delay-load directory table by a post-process binding phase.
/// </remarks>
public uint TimeStamp { get; set; }
public uint TimeStamp;
}
}

View File

@@ -42,7 +42,7 @@ namespace SabreTools.Models.PortableExecutable
LastEntry = 0x80,
}
public enum BaseRelocationTypes : uint
public enum BaseRelocationTypes : ushort
{
/// <summary>
/// The base relocation is skipped. This type can be used to pad a block.

View File

@@ -1,85 +1,92 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Contains version information for a file. This information is language and
/// code page independent.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FixedFileInfo
{
/// <summary>
/// Contains the value 0xFEEF04BD. This is used with the szKey member of the VS_VERSIONINFO
/// structure when searching a file for the FixedFileInfo structure.
/// </summary>
public uint Signature { get; set; }
public uint Signature;
/// <summary>
/// The binary version number of this structure. The high-order word of this member contains
/// the major version number, and the low-order word contains the minor version number.
/// </summary>
public uint StrucVersion { get; set; }
public uint StrucVersion;
/// <summary>
/// The most significant 32 bits of the file's binary version number. This member is used with
/// FileVersionLS to form a 64-bit value used for numeric comparisons.
/// </summary>
public uint FileVersionMS { get; set; }
public uint FileVersionMS;
/// <summary>
/// The least significant 32 bits of the file's binary version number. This member is used with
/// FileVersionMS to form a 64-bit value used for numeric comparisons.
/// </summary>
public uint FileVersionLS { get; set; }
public uint FileVersionLS;
/// <summary>
/// The most significant 32 bits of the binary version number of the product with which this file
/// was distributed. This member is used with ProductVersionLS to form a 64-bit value used for
/// numeric comparisons.
/// </summary>
public uint ProductVersionMS { get; set; }
public uint ProductVersionMS;
/// <summary>
/// The least significant 32 bits of the binary version number of the product with which this file
/// was distributed. This member is used with ProductVersionMS to form a 64-bit value used for
/// numeric comparisons.
/// </summary>
public uint ProductVersionLS { get; set; }
public uint ProductVersionLS;
/// <summary>
/// Contains a bitmask that specifies the valid bits in FileFlags. A bit is valid only if it was
/// defined when the file was created.
/// </summary>
public uint FileFlagsMask { get; set; }
public uint FileFlagsMask;
/// <summary>
/// Contains a bitmask that specifies the Boolean attributes of the file.
/// </summary>
public FixedFileInfoFlags FileFlags { get; set; }
[MarshalAs(UnmanagedType.U4)]
public FixedFileInfoFlags FileFlags;
/// <summary>
/// The operating system for which this file was designed.
/// </summary>
public FixedFileInfoOS FileOS { get; set; }
[MarshalAs(UnmanagedType.U4)]
public FixedFileInfoOS FileOS;
/// <summary>
/// The general type of file.
/// </summary>
public FixedFileInfoFileType FileType { get; set; }
[MarshalAs(UnmanagedType.U4)]
public FixedFileInfoFileType FileType;
/// <summary>
/// The function of the file. The possible values depend on the value of FileType. For all values
/// of FileType not described in the following list, FileSubtype is zero.
/// </summary>
public FixedFileInfoFileSubtype FileSubtype { get; set; }
[MarshalAs(UnmanagedType.U4)]
public FixedFileInfoFileSubtype FileSubtype;
/// <summary>
/// The most significant 32 bits of the file's 64-bit binary creation date and time stamp.
/// </summary>
public uint FileDateMS { get; set; }
public uint FileDateMS;
/// <summary>
/// The least significant 32 bits of the file's 64-bit binary creation date and time stamp.
/// </summary>
public uint FileDateLS { get; set; }
public uint FileDateLS;
}
}

View File

@@ -1,22 +1,25 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Contains version information for the menu resource. The structure definition provided
/// here is for explanation only; it is not present in any standard header file.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/menuheader"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class MenuHeader
{
/// <summary>
/// The version number of the menu template. This member must be equal to zero to indicate
/// that this is an RT_MENU created with a standard menu template.
/// </summary>
public ushort Version { get; set; }
public ushort Version;
/// <summary>
/// The size of the menu template header. This value is zero for menus you create with a
/// standard menu template.
/// </summary>
public ushort HeaderSize { get; set; }
public ushort HeaderSize;
}
}

View File

@@ -1,27 +1,30 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Defines the header for an extended menu template. This structure definition is for
/// explanation only; it is not present in any standard header file.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/menuex-template-header"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class MenuHeaderExtended
{
/// <summary>
/// The template version number. This member must be 1 for extended menu templates.
/// </summary>
public ushort Version { get; set; }
public ushort Version;
/// <summary>
/// The offset to the first MENUEX_TEMPLATE_ITEM structure, relative to the end of
/// this structure member. If the first item definition immediately follows the
/// dwHelpId member, this member should be 4.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// The help identifier of menu bar.
/// </summary>
public uint HelpID { get; set; }
public uint HelpID;
}
}

View File

@@ -1,27 +1,30 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Contains information about message strings with identifiers in the range indicated
/// by the LowId and HighId members.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-message_resource_block"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class MessageResourceBlock
{
/// <summary>
/// The lowest message identifier contained within this structure.
/// </summary>
public uint LowId { get; set; }
public uint LowId;
/// <summary>
/// The highest message identifier contained within this structure.
/// </summary>
public uint HighId { get; set; }
public uint HighId;
/// <summary>
/// The offset, in bytes, from the beginning of the MESSAGE_RESOURCE_DATA structure to the
/// MESSAGE_RESOURCE_ENTRY structures in this MESSAGE_RESOURCE_BLOCK. The MESSAGE_RESOURCE_ENTRY
/// structures contain the message strings.
/// </summary>
public uint OffsetToEntries { get; set; }
public uint OffsetToEntries;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Contains the number of icon or cursor components in a resource group. The
@@ -6,23 +8,24 @@
/// in any standard header file.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/newheader"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class NewHeader
{
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved { get; set; }
public ushort Reserved;
/// <summary>
/// The resource type. This member must have one of the following values.
/// - RES_ICON (1): Icon resource type.
/// - RES_CURSOR (2): Cursor resource type.
/// </summary>
public ushort ResType { get; set; }
public ushort ResType;
/// <summary>
/// The number of icon or cursor components in the resource group.
/// </summary>
public ushort ResCount { get; set; }
public ushort ResCount;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Contains information about the resource header itself and the data specific to
@@ -7,6 +9,7 @@
/// explanation only; it is not present in any standard header file.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/resourceheader"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceHeader
{
/// <summary>
@@ -14,12 +17,12 @@
/// particular resource. It does not include any file padding between this
/// resource and any resource that follows it in the resource file.
/// </summary>
public uint DataSize { get; set; }
public uint DataSize;
/// <summary>
/// The size, in bytes, of the resource header data that follows.
/// </summary>
public uint HeaderSize { get; set; }
public uint HeaderSize;
/// <summary>
/// The resource type. The TYPE member can either be a numeric value or a
@@ -32,7 +35,8 @@
///
/// Values less than 256 are reserved for system use.
/// </summary>
public ResourceType ResourceType { get; set; }
[MarshalAs(UnmanagedType.U4)]
public ResourceType ResourceType;
/// <summary>
/// A name that identifies the particular resource. The NAME member, like the TYPE
@@ -44,13 +48,13 @@
/// members because they contain WORD data. However, you may need to add a WORD of
/// padding after the NAME member to align the rest of the header on DWORD boundaries.
/// </summary>
public uint Name { get; set; }
public uint Name;
/// <summary>
/// A predefined resource data version. This will determine which version of the
/// resource data the application should use.
/// </summary>
public uint DataVersion { get; set; }
public uint DataVersion;
/// <summary>
/// A set of attribute flags that can describe the state of the resource. Modifiers
@@ -62,7 +66,8 @@
/// ignored. Resources are loaded when the corresponding module is loaded, and are
/// freed when the module is unloaded.
/// </summary>
public MemoryFlags MemoryFlags { get; set; }
[MarshalAs(UnmanagedType.U2)]
public MemoryFlags MemoryFlags;
/// <summary>
/// The language for the resource or set of resources. Set the value for this member
@@ -75,20 +80,20 @@
/// the strings within the resources, you will need to specify a LanguageId for each
/// one.
/// </summary>
public ushort LanguageId { get; set; }
public ushort LanguageId;
/// <summary>
/// A user-defined version number for the resource data that tools can use to read and
/// write resource files. Set this value with the optional VERSION resource definition
/// statement.
/// </summary>
public uint Version { get; set; }
public uint Version;
/// <summary>
/// Specifies user-defined information about the resource that tools can use to read and
/// write resource files. Set this value with the optional CHARACTERISTICS resource
/// definition statement.
/// </summary>
public uint Characteristics { get; set; }
public uint Characteristics;
}
}

Some files were not shown because too many files have changed in this diff Show More