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>
/// 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;
}
}