using System.Runtime.InteropServices; namespace SabreTools.Data.Models.NewExecutable { /// /// The segment table contains an entry for each segment in the executable /// file. The number of segment table entries are defined in the segmented /// EXE header. The first entry in the segment table is segment number 1. /// The following is the structure of a segment table entry. /// /// /// [StructLayout(LayoutKind.Sequential)] public sealed class SegmentTableEntry { /// /// Logical-sector offset (n byte) to the contents of the segment /// data, relative to the beginning of the file. Zero means no /// file data. /// /// Byte offset is: Offset * (1 << ) public ushort Offset { get; set; } /// /// Length of the segment in the file, in bytes. Zero means 64K. /// public ushort Length { get; set; } /// /// Flag word. /// [MarshalAs(UnmanagedType.U2)] public SegmentTableEntryFlag FlagWord; /// /// Minimum allocation size of the segment, in bytes. Total size /// of the segment. Zero means 64K. /// public ushort MinimumAllocationSize { get; set; } /// /// Segment data /// /// /// Data is not sequential to the entry header. It lives at /// the and has a size of /// public byte[] Data { get; set; } = []; /// /// Per-segment data /// /// /// This only exists if has a flag value /// of . It immediately /// follows . /// public PerSegmentData? PerSegmentData { get; set; } } }