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,4 +1,6 @@
namespace SabreTools.Models.PortableExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Overlay data associated with SecuROM executables
@@ -8,60 +10,62 @@
/// environment by using sample from legally obtained software that
/// is protected by SecuROM.
/// </remarks>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class SecuROMAddDEntry
{
/// <summary>
/// Physical offset of the embedded file
/// </summary>
public uint PhysicalOffset { get; set; }
public uint PhysicalOffset;
/// <summary>
/// Length of the embedded file
/// </summary>
/// <remarks>The last entry seems to be 4 bytes short in 4.47.00.0039</remarks>
public uint Length { get; set; }
public uint Length;
/// <summary>
/// Unknown (0x08)
/// </summary>
/// <remarks>3149224 [3496, 48] in the sample (all 3 entries) in 4.47.00.0039</remarks>
public uint Unknown08h { get; set; }
public uint Unknown08h;
/// <summary>
/// Unknown (0x0C)
/// </summary>
/// <remarks>3147176 [1448, 48] in the sample (all 3 entries) in 4.47.00.0039</remarks>
public uint Unknown0Ch { get; set; }
public uint Unknown0Ch;
/// <summary>
/// Unknown (0x10)
/// </summary>
/// <remarks>3149224 [3496, 48] in the sample (all 3 entries) in 4.47.00.0039</remarks>
public uint Unknown10h { get; set; }
public uint Unknown10h;
/// <summary>
/// Unknown (0x14)
/// </summary>
/// <remarks>1245044 [65396, 18] in the sample (all 3 entries) in 4.47.00.0039</remarks>
public uint Unknown14h { get; set; }
public uint Unknown14h;
/// <summary>
/// Unknown (0x18)
/// </summary>
/// <remarks>4214725 [20421, 64] in the sample (all 3 entries) in 4.47.00.0039</remarks>
public uint Unknown18h { get; set; }
public uint Unknown18h;
/// <summary>
/// Unknown (0x1C)
/// </summary>
/// <remarks>2 [2, 0] in the sample (all 3 entries) in 4.47.00.0039</remarks>
public uint Unknown1Ch { get; set; }
public uint Unknown1Ch;
/// <summary>
/// Entry file name (null-terminated)
/// </summary>
/// <remarks>12 bytes long in the sample (all 3 entries) in 4.47.00.0039</remarks>
public string? FileName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public string? FileName;
/// <summary>
/// Unknown (0x2C)
@@ -70,6 +74,6 @@
/// Offset based on consistent-sized filenames (12 bytes) in 4.47.00.0039
/// 132 [132, 0] in the sample (all 3 entries) in 4.47.00.0039
/// </remarks>
public uint Unknown2Ch { get; set; }
public uint Unknown2Ch;
}
}