Remove LayoutKind.Sequential

This may be replaced in the future when byte-serialzable types are more well-defined
This commit is contained in:
Matt Nadareski
2023-09-10 21:33:22 -04:00
parent 670b8428c2
commit 41a90278d5
71 changed files with 74 additions and 290 deletions

View File

@@ -1,13 +1,10 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// At the beginning of an object file, or immediately after the signature
@@ -8,7 +6,6 @@ namespace SabreTools.Models.PortableExecutable
/// 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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Object files contain COFF relocations, which specify how the section data
@@ -17,7 +15,6 @@ namespace SabreTools.Models.PortableExecutable
/// 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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Each data directory gives the address and size of a table or string that Windows uses.
@@ -11,7 +9,6 @@ namespace SabreTools.Models.PortableExecutable
/// 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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Image files contain an optional debug directory that indicates what form
@@ -19,7 +17,6 @@ namespace SabreTools.Models.PortableExecutable
/// 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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// The delay-load directory table is the counterpart to the import directory
@@ -8,7 +6,6 @@ namespace SabreTools.Models.PortableExecutable
/// 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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Defines the dimensions and style of a control in a dialog box. One or more of these
@@ -8,7 +6,6 @@ namespace SabreTools.Models.PortableExecutable
/// for a dialog box.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-dlgitemtemplate"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DialogItemTemplate
{
/// <summary>

View File

@@ -1,13 +1,10 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// A block of text used by an extended dialog box template to describe the extended dialog box.
/// For a description of the format of an extended dialog box template, see DLGTEMPLATEEX.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/dlgbox/dlgitemtemplateex"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DialogItemTemplateExtended
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Defines the dimensions and style of a dialog box. This structure, always the first
@@ -9,7 +7,6 @@ namespace SabreTools.Models.PortableExecutable
/// structures in the template.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-dlgtemplate"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DialogTemplate
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// An extended dialog box template begins with a DLGTEMPLATEEX header that describes
@@ -13,7 +11,6 @@ namespace SabreTools.Models.PortableExecutable
/// for a dialog box.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/dlgbox/dlgtemplateex"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DialogTemplateExtended
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// The export symbol information begins with the export directory table,
@@ -9,7 +7,6 @@ namespace SabreTools.Models.PortableExecutable
/// imports to the entry points within this image.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ExportDirectoryTable
{
/// <summary>

View File

@@ -1,13 +1,10 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
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>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// The import information begins with the import directory table, which
@@ -12,7 +10,6 @@ namespace SabreTools.Models.PortableExecutable
/// which indicates the end of the directory table.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportDirectoryTableEntry
{
/// <summary>

View File

@@ -1,13 +1,10 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
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>

View File

@@ -1,13 +1,10 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
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>

View File

@@ -1,12 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// PDB 2.0 files
/// </summary>
/// <see href="https://www.debuginfo.com/articles/debuginfomatch.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class NB10ProgramDatabase
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Contains the number of icon or cursor components in a resource group. The
@@ -8,7 +6,6 @@ namespace SabreTools.Models.PortableExecutable
/// 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>

View File

@@ -1,5 +1,4 @@
using System;
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
{
@@ -8,7 +7,6 @@ namespace SabreTools.Models.PortableExecutable
/// or "DS" type which are emitted by Miscrosoft's link.exe from version 7 and above.
/// </summary>
/// <see href="http://www.godevtool.com/Other/pdb.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class RSDSProgramDatabase
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// The resource directory string area consists of Unicode strings, which
@@ -10,7 +8,6 @@ namespace SabreTools.Models.PortableExecutable
/// alignment of the fixed-size directory entries.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceDataEntry
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Each directory table is followed by a series of directory entries that
@@ -15,7 +13,6 @@ namespace SabreTools.Models.PortableExecutable
/// actually consists of directory entries.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceDirectoryTable
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Each row of the section table is, in effect, a section header. This table
@@ -20,7 +18,6 @@ namespace SabreTools.Models.PortableExecutable
/// SectionAlignment value in the optional header.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SectionHeader
{
/// <summary>
@@ -32,11 +29,10 @@ namespace SabreTools.Models.PortableExecutable
/// characters. Long names in object files are truncated if they are emitted
/// to an executable file.
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
#if NET48
public byte[] Name;
public byte[] Name { get; set; } = new byte[8];
#else
public byte[]? Name;
public byte[]? Name { get; set; } = new byte[8];
#endif
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Overlay data associated with SecuROM executables
@@ -10,7 +8,6 @@ namespace SabreTools.Models.PortableExecutable
/// environment by using sample from legally obtained software that
/// is protected by SecuROM.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
public sealed class SecuROMAddD
{
/// <summary>

View File

@@ -1,6 +1,4 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.PortableExecutable
{
/// <summary>
/// Overlay data associated with SecuROM executables
@@ -10,7 +8,6 @@ namespace SabreTools.Models.PortableExecutable
/// environment by using sample from legally obtained software that
/// is protected by SecuROM.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
public sealed class SecuROMAddDEntry
{
/// <summary>