Class ImageOptionalHeader
Represents the optional header in the NT header.
Namespace: PeNet.Header.Pe
Assembly: PeNet.dll
Syntax
public class ImageOptionalHeader : AbstractStructure
Constructors
| Improve this Doc View SourceImageOptionalHeader(IRawFile, Int64, Boolean)
Create a new ImageOptionalHeader object.
Declaration
public ImageOptionalHeader(IRawFile peFile, long offset, bool is64Bit)
Parameters
Type | Name | Description |
---|---|---|
IRawFile | peFile | A PE file. |
System.Int64 | offset | Raw offset to the optional header. |
System.Boolean | is64Bit | Set to true, if header is for a x64 application. |
Fields
| Improve this Doc View SourceDataDirectory
The Data Directories.
Declaration
public readonly ImageDataDirectory[] DataDirectory
Field Value
Type | Description |
---|---|
ImageDataDirectory[] |
Properties
| Improve this Doc View SourceAddressOfEntryPoint
RVA of the entry point function.
Declaration
public uint AddressOfEntryPoint { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
BaseOfCode
RVA to the beginning of the code section.
Declaration
public uint BaseOfCode { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
BaseOfData
RVA to the beginning of the data section.
Declaration
public uint BaseOfData { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
CheckSum
Image checksum validated at runtime for drivers, DLLs loaded at boot time and DLLs loaded into a critical system.
Declaration
public uint CheckSum { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
DllCharacteristics
DLL characteristics of the image.
Declaration
public DllCharacteristicsType DllCharacteristics { get; set; }
Property Value
Type | Description |
---|---|
DllCharacteristicsType |
FileAlignment
File alignment of the raw data of the sections in bytes.
Declaration
public uint FileAlignment { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
ImageBase
Preferred address of the image when it's loaded to memory.
Declaration
public ulong ImageBase { get; set; }
Property Value
Type | Description |
---|---|
System.UInt64 |
LoaderFlags
Obsolete
Declaration
public uint LoaderFlags { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Magic
Flag if the file is x32, x64 or a ROM image.
Declaration
public MagicType Magic { get; set; }
Property Value
Type | Description |
---|---|
MagicType |
MajorImageVersion
Major image version.
Declaration
public ushort MajorImageVersion { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
MajorLinkerVersion
Major linker version.
Declaration
public byte MajorLinkerVersion { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
MajorOperatingSystemVersion
Major operation system version to run the file.
Declaration
public ushort MajorOperatingSystemVersion { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
MajorSubsystemVersion
Major version of the subsystem.
Declaration
public ushort MajorSubsystemVersion { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
MinorImageVersion
Minor image version.
Declaration
public ushort MinorImageVersion { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
MinorLinkerVersion
Minor linker version.
Declaration
public byte MinorLinkerVersion { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
MinorOperatingSystemVersion
Minor operation system version to run the file.
Declaration
public ushort MinorOperatingSystemVersion { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
MinorSubsystemVersion
Minor version of the subsystem.
Declaration
public ushort MinorSubsystemVersion { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
NumberOfRvaAndSizes
Number of directory entries in the remainder of the optional header.
Declaration
public uint NumberOfRvaAndSizes { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
SectionAlignment
Section alignment in memory in bytes. Must be greater or equal to the file alignment.
Declaration
public uint SectionAlignment { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
SizeOfCode
Size of all code sections together.
Declaration
public uint SizeOfCode { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
SizeOfHeaders
Sum of the e_lfanwe from the DOS header, the 4 byte signature, size of the file header, size of the optional header and size of all section. Rounded to the next file alignment.
Declaration
public uint SizeOfHeaders { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
SizeOfHeapCommit
Size of the heap commit in bytes.
Declaration
public ulong SizeOfHeapCommit { get; set; }
Property Value
Type | Description |
---|---|
System.UInt64 |
SizeOfHeapReserve
Size of the heap to reserve in bytes.
Declaration
public ulong SizeOfHeapReserve { get; set; }
Property Value
Type | Description |
---|---|
System.UInt64 |
SizeOfImage
Size of the image including all headers in bytes. Must be a multiple of the section alignment.
Declaration
public uint SizeOfImage { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
SizeOfInitializedData
Size of all initialized data sections together.
Declaration
public uint SizeOfInitializedData { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
SizeOfStackCommit
Size of bytes committed for the stack in bytes.
Declaration
public ulong SizeOfStackCommit { get; set; }
Property Value
Type | Description |
---|---|
System.UInt64 |
SizeOfStackReserve
Size of stack reserve in bytes.
Declaration
public ulong SizeOfStackReserve { get; set; }
Property Value
Type | Description |
---|---|
System.UInt64 |
SizeOfUninitializedData
Size of all uninitialized data sections together.
Declaration
public uint SizeOfUninitializedData { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Subsystem
The subsystem required to run the image e.g., Windows GUI, XBOX etc.
Declaration
public SubsystemType Subsystem { get; set; }
Property Value
Type | Description |
---|---|
SubsystemType |
SubsystemResolved
Subsystem resolved to a readable string.
Declaration
public string SubsystemResolved { get; }
Property Value
Type | Description |
---|---|
System.String |
Win32VersionValue
Reserved and must be 0.
Declaration
public uint Win32VersionValue { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Methods
| Improve this Doc View SourceResolveSubsystem(SubsystemType)
Resolve the subsystem attribute to a human readable string.
Declaration
public static string ResolveSubsystem(SubsystemType subsystem)
Parameters
Type | Name | Description |
---|---|---|
SubsystemType | subsystem | Subsystem attribute. |
Returns
Type | Description |
---|---|
System.String | Subsystem as readable string. |