Fix warnings from nullabilty

This commit is contained in:
Matt Nadareski
2023-09-04 21:14:41 -04:00
parent 46824bd91d
commit 0e23d131fe
212 changed files with 3018 additions and 1 deletions

View File

@@ -7,264 +7,508 @@ namespace SabreTools.Models.PortableExecutable
public sealed class AssemblyManifest
{
[XmlAttribute("manifestVersion")]
#if NET48
public string ManifestVersion;
#else
public string? ManifestVersion;
#endif
#region Group
[XmlElement("assemblyIdentity")]
#if NET48
public AssemblyIdentity[] AssemblyIdentities;
#else
public AssemblyIdentity[]? AssemblyIdentities;
#endif
[XmlElement("noInheritable")]
#if NET48
public AssemblyNoInheritable[] NoInheritables;
#else
public AssemblyNoInheritable[]? NoInheritables;
#endif
#endregion
#region Group
[XmlElement("description")]
#if NET48
public AssemblyDescription Description;
#else
public AssemblyDescription? Description;
#endif
[XmlElement("noInherit")]
#if NET48
public AssemblyNoInherit NoInherit;
#else
public AssemblyNoInherit? NoInherit;
#endif
//[XmlElement("noInheritable")]
//public AssemblyNoInheritable NoInheritable;
[XmlElement("comInterfaceExternalProxyStub")]
#if NET48
public AssemblyCOMInterfaceExternalProxyStub[] COMInterfaceExternalProxyStub;
#else
public AssemblyCOMInterfaceExternalProxyStub[]? COMInterfaceExternalProxyStub;
#endif
[XmlElement("dependency")]
#if NET48
public AssemblyDependency[] Dependency;
#else
public AssemblyDependency[]? Dependency;
#endif
[XmlElement("file")]
#if NET48
public AssemblyFile[] File;
#else
public AssemblyFile[]? File;
#endif
[XmlElement("clrClass")]
#if NET48
public AssemblyCommonLanguageRuntimeClass[] CLRClass;
#else
public AssemblyCommonLanguageRuntimeClass[]? CLRClass;
#endif
[XmlElement("clrSurrogate")]
#if NET48
public AssemblyCommonLanguageSurrogateClass[] CLRSurrogate;
#else
public AssemblyCommonLanguageSurrogateClass[]? CLRSurrogate;
#endif
#endregion
[XmlAnyElement]
#if NET48
public object[] EverythingElse;
#else
public object[]? EverythingElse;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyActiveCodePage
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyAutoElevate
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyBindingRedirect
{
[XmlAttribute("oldVersion")]
#if NET48
public string OldVersion;
#else
public string? OldVersion;
#endif
[XmlAttribute("newVersion")]
#if NET48
public string NewVersion;
#else
public string? NewVersion;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyCOMClass
{
[XmlAttribute("clsid")]
#if NET48
public string CLSID;
#else
public string? CLSID;
#endif
[XmlAttribute("threadingModel")]
#if NET48
public string ThreadingModel;
#else
public string? ThreadingModel;
#endif
[XmlAttribute("progid")]
#if NET48
public string ProgID;
#else
public string? ProgID;
#endif
[XmlAttribute("tlbid")]
#if NET48
public string TLBID;
#else
public string? TLBID;
#endif
[XmlAttribute("description")]
#if NET48
public string Description;
#else
public string? Description;
#endif
[XmlElement("progid")]
#if NET48
public AssemblyProgID[] ProgIDs;
#else
public AssemblyProgID[]? ProgIDs;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyCOMInterfaceExternalProxyStub
{
[XmlAttribute("iid")]
#if NET48
public string IID;
#else
public string? IID;
#endif
[XmlAttribute("name")]
#if NET48
public string Name;
#else
public string? Name;
#endif
[XmlAttribute("tlbid")]
#if NET48
public string TLBID;
#else
public string? TLBID;
#endif
[XmlAttribute("numMethods")]
#if NET48
public string NumMethods;
#else
public string? NumMethods;
#endif
[XmlAttribute("proxyStubClsid32")]
#if NET48
public string ProxyStubClsid32;
#else
public string? ProxyStubClsid32;
#endif
[XmlAttribute("baseInterface")]
#if NET48
public string BaseInterface;
#else
public string? BaseInterface;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyCOMInterfaceProxyStub
{
[XmlAttribute("iid")]
#if NET48
public string IID;
#else
public string? IID;
#endif
[XmlAttribute("name")]
#if NET48
public string Name;
#else
public string? Name;
#endif
[XmlAttribute("tlbid")]
#if NET48
public string TLBID;
#else
public string? TLBID;
#endif
[XmlAttribute("numMethods")]
#if NET48
public string NumMethods;
#else
public string? NumMethods;
#endif
[XmlAttribute("proxyStubClsid32")]
#if NET48
public string ProxyStubClsid32;
#else
public string? ProxyStubClsid32;
#endif
[XmlAttribute("baseInterface")]
#if NET48
public string BaseInterface;
#else
public string? BaseInterface;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyCommonLanguageRuntimeClass
{
[XmlAttribute("name")]
#if NET48
public string Name;
#else
public string? Name;
#endif
[XmlAttribute("clsid")]
#if NET48
public string CLSID;
#else
public string? CLSID;
#endif
[XmlAttribute("progid")]
#if NET48
public string ProgID;
#else
public string? ProgID;
#endif
[XmlAttribute("tlbid")]
#if NET48
public string TLBID;
#else
public string? TLBID;
#endif
[XmlAttribute("description")]
#if NET48
public string Description;
#else
public string? Description;
#endif
[XmlAttribute("runtimeVersion")]
#if NET48
public string RuntimeVersion;
#else
public string? RuntimeVersion;
#endif
[XmlAttribute("threadingModel")]
#if NET48
public string ThreadingModel;
#else
public string? ThreadingModel;
#endif
[XmlElement("progid")]
#if NET48
public AssemblyProgID[] ProgIDs;
#else
public AssemblyProgID[]? ProgIDs;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyCommonLanguageSurrogateClass
{
[XmlAttribute("clsid")]
#if NET48
public string CLSID;
#else
public string? CLSID;
#endif
[XmlAttribute("name")]
#if NET48
public string Name;
#else
public string? Name;
#endif
[XmlAttribute("runtimeVersion")]
#if NET48
public string RuntimeVersion;
#else
public string? RuntimeVersion;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDependency
{
[XmlElement("dependentAssembly")]
#if NET48
public AssemblyDependentAssembly DependentAssembly;
#else
public AssemblyDependentAssembly? DependentAssembly;
#endif
[XmlAttribute("optional")]
#if NET48
public string Optional;
#else
public string? Optional;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDependentAssembly
{
[XmlElement("assemblyIdentity")]
#if NET48
public AssemblyIdentity AssemblyIdentity;
#else
public AssemblyIdentity? AssemblyIdentity;
#endif
[XmlElement("bindingRedirect")]
#if NET48
public AssemblyBindingRedirect[] BindingRedirect;
#else
public AssemblyBindingRedirect[]? BindingRedirect;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDescription
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDisableTheming
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDisableWindowFiltering
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDPIAware
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyDPIAwareness
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyFile
{
[XmlAttribute("name")]
#if NET48
public string Name;
#else
public string? Name;
#endif
[XmlAttribute("hash")]
#if NET48
public string Hash;
#else
public string? Hash;
#endif
[XmlAttribute("hashalg")]
#if NET48
public string HashAlgorithm;
#else
public string? HashAlgorithm;
#endif
[XmlAttribute("size")]
#if NET48
public string Size;
#else
public string? Size;
#endif
#region Group
[XmlElement("comClass")]
#if NET48
public AssemblyCOMClass[] COMClass;
#else
public AssemblyCOMClass[]? COMClass;
#endif
[XmlElement("comInterfaceProxyStub")]
#if NET48
public AssemblyCOMInterfaceProxyStub[] COMInterfaceProxyStub;
#else
public AssemblyCOMInterfaceProxyStub[]? COMInterfaceProxyStub;
#endif
[XmlElement("typelib")]
#if NET48
public AssemblyTypeLib[] Typelib;
#else
public AssemblyTypeLib[]? Typelib;
#endif
[XmlElement("windowClass")]
#if NET48
public AssemblyWindowClass[] WindowClass;
#else
public AssemblyWindowClass[]? WindowClass;
#endif
#endregion
}
@@ -273,50 +517,90 @@ namespace SabreTools.Models.PortableExecutable
public sealed class AssemblyGDIScaling
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyHeapType
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyHighResolutionScrollingAware
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyIdentity
{
[XmlAttribute("name")]
#if NET48
public string Name;
#else
public string? Name;
#endif
[XmlAttribute("version")]
#if NET48
public string Version;
#else
public string? Version;
#endif
[XmlAttribute("type")]
#if NET48
public string Type;
#else
public string? Type;
#endif
[XmlAttribute("processorArchitecture")]
#if NET48
public string ProcessorArchitecture;
#else
public string? ProcessorArchitecture;
#endif
[XmlAttribute("publicKeyToken")]
#if NET48
public string PublicKeyToken;
#else
public string? PublicKeyToken;
#endif
[XmlAttribute("language")]
#if NET48
public string Language;
#else
public string? Language;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyLongPathAware
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
@@ -333,57 +617,101 @@ namespace SabreTools.Models.PortableExecutable
public sealed class AssemblyPrinterDriverIsolation
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyProgID
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblySupportedOS
{
[XmlAttribute("Id")]
#if NET48
public string Id;
#else
public string? Id;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyTypeLib
{
[XmlElement("tlbid")]
#if NET48
public string TLBID;
#else
public string? TLBID;
#endif
[XmlElement("version")]
#if NET48
public string Version;
#else
public string? Version;
#endif
[XmlElement("helpdir")]
#if NET48
public string HelpDir;
#else
public string? HelpDir;
#endif
[XmlElement("resourceid")]
#if NET48
public string ResourceID;
#else
public string? ResourceID;
#endif
[XmlElement("flags")]
#if NET48
public string Flags;
#else
public string? Flags;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyUltraHighResolutionScrollingAware
{
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
/// <see href="https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema"/>
public sealed class AssemblyWindowClass
{
[XmlAttribute("versioned")]
#if NET48
public string Versioned;
#else
public string? Versioned;
#endif
[XmlText]
#if NET48
public string Value;
#else
public string? Value;
#endif
}
// TODO: Left off at <ElementType name="progid" />

View File

@@ -58,6 +58,10 @@
/// Contains a certificate, such as an Authenticode signature.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#certificate-data"/>
#if NET48
public byte[] Certificate;
#else
public byte[]? Certificate;
#endif
}
}

View File

@@ -46,6 +46,10 @@
/// in the Page RVA field for the block. This offset
/// specifies where the base relocation is to be applied.
/// </summary>
#if NET48
public BaseRelocationTypeOffsetFieldEntry[] TypeOffsetFieldEntries;
#else
public BaseRelocationTypeOffsetFieldEntry[]? TypeOffsetFieldEntries;
#endif
}
}

View File

@@ -20,6 +20,10 @@
/// Following the size are null-terminated strings that are pointed to by symbols
/// in the COFF symbol table.
/// </summary>
#if NET48
public string[] Strings;
#else
public string[]? Strings;
#endif
}
}

View File

@@ -29,7 +29,11 @@ namespace SabreTools.Models.PortableExecutable
/// the name is less than 8 bytes long.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
#if NET48
public byte[] ShortName;
#else
public byte[]? ShortName;
#endif
/// <summary>
/// A field that is set to all zeros if the name is longer than 8 bytes.
@@ -162,7 +166,11 @@ namespace SabreTools.Models.PortableExecutable
/// Unused
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
#if NET48
public byte[] AuxFormat2Unused2;
#else
public byte[]? AuxFormat2Unused2;
#endif
/// <summary>
/// The symbol-table index of the next .bf symbol record. If the function is the
@@ -214,7 +222,11 @@ namespace SabreTools.Models.PortableExecutable
/// Unused
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
#if NET48
public byte[] AuxFormat3Unused;
#else
public byte[]? AuxFormat3Unused;
#endif
#endregion
@@ -229,7 +241,11 @@ namespace SabreTools.Models.PortableExecutable
/// with nulls if it is less than the maximum length.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
#if NET48
public byte[] AuxFormat4FileName;
#else
public byte[]? AuxFormat4FileName;
#endif
#endregion
@@ -278,7 +294,11 @@ namespace SabreTools.Models.PortableExecutable
/// Unused
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
#if NET48
public byte[] AuxFormat5Unused;
#else
public byte[]? AuxFormat5Unused;
#endif
#endregion
@@ -306,7 +326,11 @@ namespace SabreTools.Models.PortableExecutable
/// Reserved, must be zero.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
#if NET48
public byte[] AuxFormat6Reserved2;
#else
public byte[]? AuxFormat6Reserved2;
#endif
#endregion

View File

@@ -33,7 +33,11 @@
/// <summary>
/// Describes keyboard accelerator characteristics.
/// </summary>
#if NET48
public NewHeader NEWHEADER;
#else
public NewHeader? NEWHEADER;
#endif
// TODO: Add array of entries in the resource
}

View File

@@ -33,6 +33,10 @@
/// file and is not mapped into the run-time address space). If it is mapped,
/// the RVA is its address.
/// </summary>
#if NET48
public DebugDirectoryEntry[] DebugDirectoryTable;
#else
public DebugDirectoryEntry[]? DebugDirectoryTable;
#endif
}
}

View File

@@ -14,12 +14,20 @@
/// <summary>
/// Dialog box header structure
/// </summary>
#if NET48
public DialogTemplate DialogTemplate;
#else
public DialogTemplate? DialogTemplate;
#endif
/// <summary>
/// Dialog box extended header structure
/// </summary>
#if NET48
public DialogTemplateExtended ExtendedDialogTemplate;
#else
public DialogTemplateExtended? ExtendedDialogTemplate;
#endif
#endregion
@@ -31,7 +39,11 @@
/// box. The cdit member specifies the number of DLGITEMTEMPLATE structures in the template.
/// These DLGITEMTEMPLATE structures must be aligned on DWORD boundaries.
/// </summary>
#if NET48
public DialogItemTemplate[] DialogItemTemplates;
#else
public DialogItemTemplate[]? DialogItemTemplates;
#endif
/// <summary>
/// Following the DLGTEMPLATEEX header in an extended dialog box template is one or more
@@ -39,7 +51,11 @@
/// member of the DLGITEMTEMPLATEEX structure specifies the number of DLGITEMTEMPLATEEX
/// structures that follow in the template.
/// </summary>
#if NET48
public DialogItemTemplateExtended[] ExtendedDialogItemTemplates;
#else
public DialogItemTemplateExtended[]? ExtendedDialogItemTemplates;
#endif
#endregion
}

View File

@@ -89,7 +89,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string ClassResource;
#else
public string? ClassResource;
#endif
/// <summary>
/// The ordinal value of a predefined system class.
@@ -108,7 +112,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string TitleResource;
#else
public string? TitleResource;
#endif
/// <summary>
/// An ordinal value of a resource, such as an icon, in an executable file
@@ -128,6 +136,10 @@ namespace SabreTools.Models.PortableExecutable
/// When the system creates the control, it passes a pointer to this data in the lParam parameter of the
/// WM_CREATE message that it sends to the control.
/// </summary>
#if NET48
public byte[] CreationData;
#else
public byte[]? CreationData;
#endif
}
}

View File

@@ -87,7 +87,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string ClassResource;
#else
public string? ClassResource;
#endif
/// <summary>
/// The ordinal value of a predefined system class.
@@ -106,7 +110,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string TitleResource;
#else
public string? TitleResource;
#endif
/// <summary>
/// An ordinal value of a resource, such as an icon, in an executable file
@@ -126,6 +134,10 @@ namespace SabreTools.Models.PortableExecutable
/// When the system creates the control, it passes a pointer to this data in the lParam parameter of the
/// WM_CREATE message that it sends to the control.
/// </summary>
#if NET48
public byte[] CreationData;
#else
public byte[]? CreationData;
#endif
}
}

View File

@@ -99,7 +99,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the menu, class, title, or typeface arrays, you must use
/// Unicode strings.
/// </remarks>
#if NET48
public string MenuResource;
#else
public string? MenuResource;
#endif
/// <summary>
/// The ordinal value of a menu resource in an executable file.
@@ -118,7 +122,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the menu, class, title, or typeface arrays, you must use
/// Unicode strings.
/// </remarks>
#if NET48
public string ClassResource;
#else
public string? ClassResource;
#endif
/// <summary>
/// The ordinal value of a predefined system class.
@@ -134,7 +142,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the menu, class, title, or typeface arrays, you must use
/// Unicode strings.
/// </remarks>
#if NET48
public string TitleResource;
#else
public string? TitleResource;
#endif
/// <summary>
/// The 16-bit point size value and the typeface array follow the title array, but only if the
@@ -158,6 +170,10 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the menu, class, title, or typeface arrays, you must use
/// Unicode strings.
/// </remarks>
#if NET48
public string Typeface;
#else
public string? Typeface;
#endif
}
}

View File

@@ -110,7 +110,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string MenuResource;
#else
public string? MenuResource;
#endif
/// <summary>
/// The ordinal value of a menu resource in an executable file.
@@ -128,7 +132,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string ClassResource;
#else
public string? ClassResource;
#endif
/// <summary>
/// The ordinal value of a predefined system window class.
@@ -143,7 +151,11 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string TitleResource;
#else
public string? TitleResource;
#endif
/// <summary>
/// The point size of the font to use for the text in the dialog box and its controls.
@@ -183,6 +195,10 @@ namespace SabreTools.Models.PortableExecutable
/// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the
/// MultiByteToWideChar function to generate Unicode strings from ANSI strings.
/// </remarks>
#if NET48
public string Typeface;
#else
public string? Typeface;
#endif
}
}

View File

@@ -16,6 +16,10 @@
/// The FONTDIRENTRY structure for the specified font directly follows the DIRENTRY structure
/// for that font.
/// </summary>
#if NET48
public FontDirEntry Entry;
#else
public FontDirEntry? Entry;
#endif
}
}

View File

@@ -12,24 +12,40 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// MS-DOS executable stub
/// </summary>
#if NET48
public MSDOS.Executable Stub { get; set; }
#else
public MSDOS.Executable? Stub { get; set; }
#endif
/// <summary>
/// After the MS-DOS stub, at the file offset specified at offset 0x3c, is a 4-byte
/// signature that identifies the file as a PE format image file. This signature is "PE\0\0"
/// (the letters "P" and "E" followed by two null bytes).
/// </summary>
#if NET48
public string Signature { get; set; }
#else
public string? Signature { get; set; }
#endif
/// <summary>
/// COFF file header
/// </summary>
#if NET48
public COFFFileHeader COFFFileHeader { get; set; }
#else
public COFFFileHeader? COFFFileHeader { get; set; }
#endif
/// <summary>
/// Optional header
/// </summary>
#if NET48
public OptionalHeader OptionalHeader { get; set; }
#else
public OptionalHeader? OptionalHeader { get; set; }
#endif
// TODO: Support grouped sections in section reading and parsing
// https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#grouped-sections-object-only
@@ -40,27 +56,47 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// Section table
/// </summary>
#if NET48
public SectionHeader[] SectionTable { get; set; }
#else
public SectionHeader[]? SectionTable { get; set; }
#endif
/// <summary>
/// COFF symbol table
/// </summary>
#if NET48
public COFFSymbolTableEntry[] COFFSymbolTable { get; set; }
#else
public COFFSymbolTableEntry[]? COFFSymbolTable { get; set; }
#endif
/// <summary>
/// COFF string table
/// </summary>
#if NET48
public COFFStringTable COFFStringTable { get; set; }
#else
public COFFStringTable? COFFStringTable { get; set; }
#endif
/// <summary>
/// Attribute certificate table
/// </summary>
#if NET48
public AttributeCertificateTableEntry[] AttributeCertificateTable { get; set; }
#else
public AttributeCertificateTableEntry[]? AttributeCertificateTable { get; set; }
#endif
/// <summary>
/// Delay-load directory table
/// </summary>
#if NET48
public DelayLoadDirectoryTable DelayLoadDirectoryTable { get; set; }
#else
public DelayLoadDirectoryTable? DelayLoadDirectoryTable { get; set; }
#endif
#region Named Sections
@@ -71,12 +107,20 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// Base relocation table (.reloc)
/// </summary>
#if NET48
public BaseRelocationBlock[] BaseRelocationTable { get; set; }
#else
public BaseRelocationBlock[]? BaseRelocationTable { get; set; }
#endif
/// <summary>
/// Debug table (.debug*)
/// </summary>
#if NET48
public DebugTable DebugTable { get; set; }
#else
public DebugTable? DebugTable { get; set; }
#endif
// .drectve - A section is a directive section if it has the IMAGE_SCN_LNK_INFO
// flag set in the section header and has the .drectve section name. The linker
@@ -97,17 +141,29 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// Export table (.edata)
/// </summary>
#if NET48
public ExportTable ExportTable { get; set; }
#else
public ExportTable? ExportTable { get; set; }
#endif
/// <summary>
/// Import table (.idata)
/// </summary>
#if NET48
public ImportTable ImportTable { get; set; }
#else
public ImportTable? ImportTable { get; set; }
#endif
/// <summary>
/// Resource directory table (.rsrc)
/// </summary>
#if NET48
public ResourceDirectoryTable ResourceDirectoryTable { get; set; }
#else
public ResourceDirectoryTable? ResourceDirectoryTable { get; set; }
#endif
// .sxdata - The valid exception handlers of an object are listed in the .sxdata
// section of that object. The section is marked IMAGE_SCN_LNK_INFO. It contains

View File

@@ -42,7 +42,11 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// ASCII string that contains the name of the DLL.
/// </summary>
#if NET48
public string Name;
#else
public string? Name;
#endif
/// <summary>
/// The starting ordinal number for exports in this image. This field specifies

View File

@@ -13,6 +13,10 @@
/// <summary>
/// The pointers are 32 bits each and are relative to the image base.
/// </summary>
#if NET48
public uint[] Pointers;
#else
public uint[]? Pointers;
#endif
}
}

View File

@@ -22,6 +22,10 @@
/// <summary>
/// A series of null-terminated ASCII strings of variable length.
/// </summary>
#if NET48
public string[] Strings;
#else
public string[]? Strings;
#endif
}
}

View File

@@ -37,6 +37,10 @@
/// <summary>
/// An array of 16-bit unbiased indexes into the export address table
/// </summary>
#if NET48
public ushort[] Indexes;
#else
public ushort[]? Indexes;
#endif
}
}

View File

@@ -19,7 +19,11 @@
/// A table with just one row (unlike the debug directory). This table indicates the
/// locations and sizes of the other export tables.
/// </summary>
#if NET48
public ExportDirectoryTable ExportDirectoryTable;
#else
public ExportDirectoryTable? ExportDirectoryTable;
#endif
/// <summary>
/// An array of RVAs of exported symbols. These are the actual addresses of the exported
@@ -27,12 +31,20 @@
/// can import a symbol by using an index to this table (an ordinal) or, optionally, by
/// using the public name that corresponds to the ordinal if a public name is defined.
/// </summary>
#if NET48
public ExportAddressTableEntry[] ExportAddressTable;
#else
public ExportAddressTableEntry[]? ExportAddressTable;
#endif
/// <summary>
/// An array of pointers to the public export names, sorted in ascending order.
/// </summary>
#if NET48
public ExportNamePointerTable NamePointerTable;
#else
public ExportNamePointerTable? NamePointerTable;
#endif
/// <summary>
/// An array of the ordinals that correspond to members of the name pointer table. The
@@ -40,7 +52,11 @@
/// must have the same number of members. Each ordinal is an index into the export address
/// table.
/// </summary>
#if NET48
public ExportOrdinalTable OrdinalTable;
#else
public ExportOrdinalTable? OrdinalTable;
#endif
/// <summary>
/// A series of null-terminated ASCII strings. Members of the name pointer table point into
@@ -48,6 +64,10 @@
/// exported; they are not necessarily the same as the private names that are used within
/// the image file.
/// </summary>
#if NET48
public ExportNameTable ExportNameTable;
#else
public ExportNameTable? ExportNameTable;
#endif
}
}

View File

@@ -22,7 +22,11 @@
/// The font supplier's copyright information.
/// </summary>
/// <remarks>60 characters</remarks>
#if NET48
public byte[] Copyright;
#else
public byte[]? Copyright;
#endif
/// <summary>
/// The type of font file.
@@ -164,11 +168,19 @@
/// <summary>
/// The name of the device if this font file is designated for a specific device.
/// </summary>
#if NET48
public string DeviceName;
#else
public string? DeviceName;
#endif
/// <summary>
/// The typeface name of the font.
/// </summary>
#if NET48
public string FaceName;
#else
public string? FaceName;
#endif
}
}

View File

@@ -16,6 +16,10 @@
/// A structure that contains a unique ordinal identifier for each font in the resource. The DE
/// member is a placeholder for the variable-length array of DIRENTRY structures.
/// </summary>
#if NET48
public DirEntry[] DE;
#else
public DirEntry[]? DE;
#endif
}
}

View File

@@ -18,6 +18,10 @@
/// must be matched to the public name in the DLL. This string is case sensitive
/// and terminated by a null byte.
/// </summary>
#if NET48
public string Name;
#else
public string? Name;
#endif
}
}

View File

@@ -42,7 +42,11 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// ASCII string that contains the name of the DLL.
/// </summary>
#if NET48
public string Name;
#else
public string? Name;
#endif
/// <summary>
/// The RVA of the import address table. The contents of this table are identical

View File

@@ -23,23 +23,39 @@ namespace SabreTools.Models.PortableExecutable
/// The import information begins with the import directory table, which describes the
/// remainder of the import information.
/// </summary>
#if NET48
public ImportDirectoryTableEntry[] ImportDirectoryTable;
#else
public ImportDirectoryTableEntry[]? ImportDirectoryTable;
#endif
/// <summary>
/// An import lookup table is an array of 32-bit numbers for PE32 or an array of 64-bit
/// numbers for PE32+.
/// </summary>
#if NET48
public Dictionary<int, ImportLookupTableEntry[]> ImportLookupTables;
#else
public Dictionary<int, ImportLookupTableEntry?[]?>? ImportLookupTables;
#endif
/// <summary>
/// These addresses are the actual memory addresses of the symbols, although technically
/// they are still called "virtual addresses".
/// </summary>
#if NET48
public Dictionary<int, ImportAddressTableEntry[]> ImportAddressTables;
#else
public Dictionary<int, ImportAddressTableEntry?[]?>? ImportAddressTables;
#endif
/// <summary>
/// One hint/name table suffices for the entire import section.
/// </summary>
#if NET48
public HintNameTableEntry[] HintNameTable;
#else
public HintNameTableEntry[]? HintNameTable;
#endif
}
}

View File

@@ -282,7 +282,11 @@
/// Code integrity information.
/// </summary>
/// <remarks>12 bytes</remarks>
#if NET48
public byte[] CodeIntegrity;
#else
public byte[]? CodeIntegrity;
#endif
#region GuardAddressTakenIatEntryTable

View File

@@ -24,7 +24,11 @@
/// A null-terminated Unicode string that contains the text for this menu item.
/// There is no fixed limit on the size of this string.
/// </summary>
#if NET48
public string NormalMenuText;
#else
public string? NormalMenuText;
#endif
#endregion
@@ -55,7 +59,11 @@
/// A null-terminated Unicode string that contains the text for this menu item.
/// There is no fixed limit on the size of this string.
/// </summary>
#if NET48
public string PopupMenuText;
#else
public string? PopupMenuText;
#endif
#endregion
}

View File

@@ -32,6 +32,10 @@
/// A null-terminated Unicode string that contains the text for this menu item.
/// There is no fixed limit on the size of this string.
/// </summary>
#if NET48
public string MenuText;
#else
public string? MenuText;
#endif
}
}

View File

@@ -14,12 +14,20 @@
/// <summary>
/// Menu header structure
/// </summary>
#if NET48
public MenuHeader MenuHeader;
#else
public MenuHeader? MenuHeader;
#endif
/// <summary>
/// Menu extended header structure
/// </summary>
#if NET48
public MenuHeaderExtended ExtendedMenuHeader;
#else
public MenuHeaderExtended? ExtendedMenuHeader;
#endif
#endregion
@@ -28,12 +36,20 @@
/// <summary>
/// Menu items
/// </summary>
#if NET48
public MenuItem[] MenuItems;
#else
public MenuItem[]? MenuItems;
#endif
/// <summary>
/// Extended menu items
/// </summary>
#if NET48
public MenuItemExtended[] ExtendedMenuItems;
#else
public MenuItemExtended[]? ExtendedMenuItems;
#endif
#endregion
}

View File

@@ -17,11 +17,19 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// An array of structures. The array is the size indicated by the NumberOfBlocks member.
/// </summary>
#if NET48
public MessageResourceBlock[] Blocks;
#else
public MessageResourceBlock[]? Blocks;
#endif
/// <summary>
/// Message resource entries
/// </summary>
#if NET48
public Dictionary<uint, MessageResourceEntry> Entries;
#else
public Dictionary<uint, MessageResourceEntry?>? Entries;
#endif
}
}

View File

@@ -20,6 +20,10 @@
/// <summary>
/// Pointer to an array that contains the error message or message box display text.
/// </summary>
#if NET48
public string Text;
#else
public string? Text;
#endif
}
}

View File

@@ -37,6 +37,10 @@ namespace SabreTools.Models.PortableExecutable
/// Null-terminated name of the PDB file. It can also contain full
/// or partial path to the file.
/// </summary>
#if NET48
public string PdbFileName;
#else
public string? PdbFileName;
#endif
}
}

View File

@@ -275,37 +275,65 @@
/// <summary>
/// The export table address and size.
/// </summary>
#if NET48
public DataDirectory ExportTable;
#else
public DataDirectory? ExportTable;
#endif
/// <summary>
/// The import table address and size.
/// </summary>
#if NET48
public DataDirectory ImportTable;
#else
public DataDirectory? ImportTable;
#endif
/// <summary>
/// The resource table address and size.
/// </summary>
#if NET48
public DataDirectory ResourceTable;
#else
public DataDirectory? ResourceTable;
#endif
/// <summary>
/// The exception table address and size.
/// </summary>
#if NET48
public DataDirectory ExceptionTable;
#else
public DataDirectory? ExceptionTable;
#endif
/// <summary>
/// The attribute certificate table address and size.
/// </summary>
#if NET48
public DataDirectory CertificateTable;
#else
public DataDirectory? CertificateTable;
#endif
/// <summary>
/// The base relocation table address and size.
/// </summary>
#if NET48
public DataDirectory BaseRelocationTable;
#else
public DataDirectory? BaseRelocationTable;
#endif
/// <summary>
/// The debug data starting address and size.
/// </summary>
#if NET48
public DataDirectory Debug;
#else
public DataDirectory? Debug;
#endif
/// <summary>
/// Reserved, must be 0
@@ -316,37 +344,65 @@
/// The RVA of the value to be stored in the global pointer register.
/// The size member of this structure must be set to zero.
/// </summary>
#if NET48
public DataDirectory GlobalPtr;
#else
public DataDirectory? GlobalPtr;
#endif
/// <summary>
/// The thread local storage (TLS) table address and size.
/// </summary>
#if NET48
public DataDirectory ThreadLocalStorageTable;
#else
public DataDirectory? ThreadLocalStorageTable;
#endif
/// <summary>
/// The load configuration table address and size.
/// </summary>
#if NET48
public DataDirectory LoadConfigTable;
#else
public DataDirectory? LoadConfigTable;
#endif
/// <summary>
/// The bound import table address and size.
/// </summary>
#if NET48
public DataDirectory BoundImport;
#else
public DataDirectory? BoundImport;
#endif
/// <summary>
/// The import address table address and size
/// </summary>
#if NET48
public DataDirectory ImportAddressTable;
#else
public DataDirectory? ImportAddressTable;
#endif
/// <summary>
/// The delay import descriptor address and size.
/// </summary>
#if NET48
public DataDirectory DelayImportDescriptor;
#else
public DataDirectory? DelayImportDescriptor;
#endif
/// <summary>
/// The CLR runtime header address and size.
/// </summary>
#if NET48
public DataDirectory CLRRuntimeHeader;
#else
public DataDirectory? CLRRuntimeHeader;
#endif
/// <summary>
/// Reserved, must be zero

View File

@@ -31,6 +31,10 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// zero terminated UTF8 path and file name
/// </summary>
#if NET48
public string PathAndFileName;
#else
public string? PathAndFileName;
#endif
}
}

View File

@@ -27,7 +27,11 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// The resource data that is pointed to by the Data RVA field.
/// </summary>
#if NET48
public byte[] Data;
#else
public byte[]? Data;
#endif
/// <summary>
/// The code page that is used to decode code point values within the

View File

@@ -31,7 +31,11 @@
/// A string that gives the Type, Name, or Language ID entry, depending on
/// level of table.
/// </summary>
#if NET48
public ResourceDirectoryString Name;
#else
public ResourceDirectoryString? Name;
#endif
/// <summary>
/// A 32-bit integer that identifies the Type, Name, or Language ID entry.
@@ -50,7 +54,11 @@
/// <summary>
/// Resource data entry (a leaf).
/// </summary>
#if NET48
public ResourceDataEntry DataEntry;
#else
public ResourceDataEntry? DataEntry;
#endif
/// <summary>
/// High bit 1. The lower 31 bits are the address of another resource
@@ -61,7 +69,11 @@
/// <summary>
/// Another resource directory table (the next level down).
/// </summary>
#if NET48
public ResourceDirectoryTable Subdirectory;
#else
public ResourceDirectoryTable? Subdirectory;
#endif
#endregion
}

View File

@@ -18,6 +18,10 @@
/// <summary>
/// The variable-length Unicode string data, word-aligned.
/// </summary>
#if NET48
public byte[] UnicodeString;
#else
public byte[]? UnicodeString;
#endif
}
}

View File

@@ -57,6 +57,10 @@ namespace SabreTools.Models.PortableExecutable
/// strings to identify Type, Name, or Language entries (depending on the
/// level of the table).
/// </summary>
#if NET48
public ResourceDirectoryEntry[] Entries;
#else
public ResourceDirectoryEntry[]? Entries;
#endif
}
}

View File

@@ -33,7 +33,11 @@ namespace SabreTools.Models.PortableExecutable
/// to an executable file.
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
#if NET48
public byte[] Name;
#else
public byte[]? Name;
#endif
/// <summary>
/// The total size of the section when loaded into memory. If this value is
@@ -104,11 +108,19 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// COFF Relocations (Object Only)
/// </summary>
#if NET48
public COFFRelocation[] COFFRelocations;
#else
public COFFRelocation[]? COFFRelocations;
#endif
/// <summary>
/// COFF Line Numbers (Deprecated)
/// </summary>
#if NET48
public COFFLineNumber[] COFFLineNumbers;
#else
public COFFLineNumber[]? COFFLineNumbers;
#endif
}
}

View File

@@ -30,12 +30,20 @@ namespace SabreTools.Models.PortableExecutable
/// <summary>
/// Version, always 8 bytes?
/// </summary>
#if NET48
public string Version;
#else
public string? Version;
#endif
/// <summary>
/// Unknown (Build? Formatted as a string)
/// </summary>
#if NET48
public char[] Build;
#else
public char[]? Build;
#endif
/// <summary>
/// Unknown (0x14h), Variable number of bytes before entry table
@@ -50,11 +58,19 @@ namespace SabreTools.Models.PortableExecutable
/// "554900-001" in 4.84.76.7968
/// "548520-001" in 4.85.07.0009
/// </remarks>
#if NET48
public byte[] Unknown14h;
#else
public byte[]? Unknown14h;
#endif
/// <summary>
/// Entry table
/// </summary>
#if NET48
public SecuROMAddDEntry[] Entries;
#else
public SecuROMAddDEntry[]? Entries;
#endif
}
}

View File

@@ -64,7 +64,11 @@ namespace SabreTools.Models.PortableExecutable
/// Entry file name (null-terminated)
/// </summary>
/// <remarks>12 bytes long in the sample (all 3 entries) in 4.47.00.0039</remarks>
#if NET48
public string FileName;
#else
public string? FileName;
#endif
/// <summary>
/// Unknown (0x2C)

View File

@@ -64,7 +64,11 @@
/// set in the dwFileFlags member of the VS_FIXEDFILEINFO structure. For example, Value
/// could be "Private build for Olivetti solving mouse problems on M250 and M250E computers".
/// </summary>
#if NET48
public string Key;
#else
public string? Key;
#endif
/// <summary>
/// As many zero words as necessary to align the Value member on a 32-bit boundary.
@@ -74,6 +78,10 @@
/// <summary>
/// A zero-terminated string. See the szKey member description for more information.
/// </summary>
#if NET48
public string Value;
#else
public string? Value;
#endif
}
}

View File

@@ -26,7 +26,11 @@
/// <summary>
/// The Unicode string L"StringFileInfo".
/// </summary>
#if NET48
public string Key;
#else
public string? Key;
#endif
/// <summary>
/// As many zero words as necessary to align the Children member on a 32-bit boundary.
@@ -38,6 +42,10 @@
/// member indicates the appropriate language and code page for displaying the text in
/// that StringTable structure.
/// </summary>
#if NET48
public StringTable[] Children;
#else
public StringTable[]? Children;
#endif
}
}

View File

@@ -31,7 +31,11 @@
/// identifier contains two parts: the low-order 10 bits specify the major language,
/// and the high-order 6 bits specify the sublanguage.
/// </summary>
#if NET48
public string Key;
#else
public string? Key;
#endif
/// <summary>
/// As many zero words as necessary to align the Children member on a 32-bit boundary.
@@ -41,6 +45,10 @@
/// <summary>
/// An array of one or more StringData structures.
/// </summary>
#if NET48
public StringData[] Children;
#else
public StringData[]? Children;
#endif
}
}

View File

@@ -26,7 +26,11 @@
/// <summary>
/// The Unicode string L"Translation".
/// </summary>
#if NET48
public string Key;
#else
public string? Key;
#endif
/// <summary>
/// As many zero words as necessary to align the Value member on a 32-bit boundary.
@@ -45,6 +49,10 @@
/// independent. If the Var structure is omitted, the file will be interpreted as both
/// language and code page independent.
/// </summary>
#if NET48
public uint[] Value;
#else
public uint[]? Value;
#endif
}
}

View File

@@ -26,7 +26,11 @@
/// <summary>
/// The Unicode string L"VarFileInfo".
/// </summary>
#if NET48
public string Key;
#else
public string? Key;
#endif
/// <summary>
/// As many zero words as necessary to align the Children member on a 32-bit boundary.
@@ -36,6 +40,10 @@
/// <summary>
/// Typically contains a list of languages that the application or DLL supports.
/// </summary>
#if NET48
public VarData[] Children;
#else
public VarData[]? Children;
#endif
}
}

View File

@@ -29,7 +29,11 @@
/// <summary>
/// The Unicode string L"VS_VERSION_INFO".
/// </summary>
#if NET48
public string Key;
#else
public string? Key;
#endif
/// <summary>
/// Contains as many zero words as necessary to align the Value member on a 32-bit boundary.
@@ -40,7 +44,11 @@
/// Arbitrary data associated with this VS_VERSIONINFO structure. The ValueLength member
/// specifies the length of this member; if ValueLength is zero, this member does not exist.
/// </summary>
#if NET48
public FixedFileInfo Value;
#else
public FixedFileInfo? Value;
#endif
/// <summary>
/// As many zero words as necessary to align the Children member on a 32-bit boundary.
@@ -51,11 +59,19 @@
/// <summary>
/// The StringFileInfo structure to store user-defined string information data.
/// </summary>
#if NET48
public StringFileInfo StringFileInfo;
#else
public StringFileInfo? StringFileInfo;
#endif
/// <summary>
/// The VarFileInfo structure to store language information data.
/// </summary>
#if NET48
public VarFileInfo VarFileInfo;
#else
public VarFileInfo? VarFileInfo;
#endif
}
}