PEHeaderBuilder Constructor

Definition

Initializes a new instance of the PEHeader class.

public PEHeaderBuilder (System.Reflection.PortableExecutable.Machine machine = System.Reflection.PortableExecutable.Machine.Unknown, int sectionAlignment = 8192, int fileAlignment = 512, ulong imageBase = 4194304, byte majorLinkerVersion = 48, byte minorLinkerVersion = 0, ushort majorOperatingSystemVersion = 4, ushort minorOperatingSystemVersion = 0, ushort majorImageVersion = 0, ushort minorImageVersion = 0, ushort majorSubsystemVersion = 4, ushort minorSubsystemVersion = 0, System.Reflection.PortableExecutable.Subsystem subsystem = System.Reflection.PortableExecutable.Subsystem.WindowsCui, System.Reflection.PortableExecutable.DllCharacteristics dllCharacteristics = System.Reflection.PortableExecutable.DllCharacteristics.DynamicBase | System.Reflection.PortableExecutable.DllCharacteristics.NoSeh | System.Reflection.PortableExecutable.DllCharacteristics.NxCompatible | System.Reflection.PortableExecutable.DllCharacteristics.TerminalServerAware, System.Reflection.PortableExecutable.Characteristics imageCharacteristics = System.Reflection.PortableExecutable.Characteristics.Dll, ulong sizeOfStackReserve = 1048576, ulong sizeOfStackCommit = 4096, ulong sizeOfHeapReserve = 1048576, ulong sizeOfHeapCommit = 4096);
new System.Reflection.PortableExecutable.PEHeaderBuilder : System.Reflection.PortableExecutable.Machine * int * int * uint64 * byte * byte * uint16 * uint16 * uint16 * uint16 * uint16 * uint16 * System.Reflection.PortableExecutable.Subsystem * System.Reflection.PortableExecutable.DllCharacteristics * System.Reflection.PortableExecutable.Characteristics * uint64 * uint64 * uint64 * uint64 -> System.Reflection.PortableExecutable.PEHeaderBuilder
Public Sub New (Optional machine As Machine = System.Reflection.PortableExecutable.Machine.Unknown, Optional sectionAlignment As Integer = 8192, Optional fileAlignment As Integer = 512, Optional imageBase As ULong = 4194304, Optional majorLinkerVersion As Byte = 48, Optional minorLinkerVersion As Byte = 0, Optional majorOperatingSystemVersion As UShort = 4, Optional minorOperatingSystemVersion As UShort = 0, Optional majorImageVersion As UShort = 0, Optional minorImageVersion As UShort = 0, Optional majorSubsystemVersion As UShort = 4, Optional minorSubsystemVersion As UShort = 0, Optional subsystem As Subsystem = System.Reflection.PortableExecutable.Subsystem.WindowsCui, Optional dllCharacteristics As DllCharacteristics = System.Reflection.PortableExecutable.DllCharacteristics.DynamicBase | System.Reflection.PortableExecutable.DllCharacteristics.NoSeh | System.Reflection.PortableExecutable.DllCharacteristics.NxCompatible | System.Reflection.PortableExecutable.DllCharacteristics.TerminalServerAware, Optional imageCharacteristics As Characteristics = System.Reflection.PortableExecutable.Characteristics.Dll, Optional sizeOfStackReserve As ULong = 1048576, Optional sizeOfStackCommit As ULong = 4096, Optional sizeOfHeapReserve As ULong = 1048576, Optional sizeOfHeapCommit As ULong = 4096)

Parameters

machine
Machine

The target machine's CPU architecture.

sectionAlignment
Int32

The alignment (in bytes) of sections when they are loaded into memory. It must be greater than or equal to fileAlignment. The default is the page size for the architecture.

fileAlignment
Int32

The alignment factor (in bytes) that is used to align the raw data of sections in the image file. The value should be a power of 2 between 512 and 64K, inclusive. The default is 512. If the sectionAlignment is less than the architecture's page size, then fileAlignment must match sectionAlignment.

imageBase
UInt64

The preferred address of the first byte of image when loaded into memory; must be a multiple of 64K.

majorLinkerVersion
Byte

The linker major version number.

minorLinkerVersion
Byte

The linker minor version number.

majorOperatingSystemVersion
UInt16

The major version number of the required operating system.

minorOperatingSystemVersion
UInt16

The minor version number of the required operating system.

majorImageVersion
UInt16

The major version number of the image.

minorImageVersion
UInt16

The minor version number of the image.

majorSubsystemVersion
UInt16

The major version number of the subsystem.

minorSubsystemVersion
UInt16

The minor version number of the subsystem.

subsystem
Subsystem

The subsystem required to run the image.

dllCharacteristics
DllCharacteristics

An object describing the characteristics of the dynamic link library.

imageCharacteristics
Characteristics

An object describing the characteristics of the image.

sizeOfStackReserve
UInt64

The size of the stack to reserve. Only sizeOfStackCommit is committed; the rest is made available one page at a time until the reserve size is reached.

sizeOfStackCommit
UInt64

The size of the stack to commit.

sizeOfHeapReserve
UInt64

The size of the local heap space to reserve. Only sizeOfHeapCommit is committed; the rest is made available one page at a time until the reserve size is reached.

sizeOfHeapCommit
UInt64

The size of the local heap space to commit.

Exceptions

fileAlignment is not power of 2 between 512 and 64K. -or-

sectionAlignment not power of 2.

-or-

sectionAlignment is less than fileAlignment.

Applies to