Class DosHeader
- Namespace
- AsmResolver.PE.File
- Assembly
- AsmResolver.PE.File.dll
Represents the DOS header (also known as the MZ header) in the portable executable (PE) file format.
public class DosHeader : SegmentBase, ISegment, IOffsetProvider, IWritable
- Inheritance
-
DosHeader
- Implements
- Inherited Members
Constructors
DosHeader()
Creates a new DOS header with the default contents.
public DosHeader()
Fields
DefaultNewHeaderOffset
Indicates the default value of the e_flanew field in the DOS header.
public const int DefaultNewHeaderOffset = 128
Field Value
MinimalDosHeaderLength
Indicates the minimal length of a valid DOS header in a portable executable file.
public const int MinimalDosHeaderLength = 64
Field Value
NextHeaderFieldOffset
Indicates the offset of the e_flanew field in the DOS header.
public const int NextHeaderFieldOffset = 60
Field Value
ValidPEMagic
Indicates the magic constant that every DOS header should start with.
public const ushort ValidPEMagic = 23117
Field Value
Properties
NextHeaderOffset
Gets or sets the offset to the next header (NT header).
public uint NextHeaderOffset { get; set; }
Property Value
Methods
FromReader(ref BinaryStreamReader)
Reads a DOS header structure at the current position of the provided input stream.
public static DosHeader FromReader(ref BinaryStreamReader reader)
Parameters
reader
BinaryStreamReaderThe input stream to read from.
Returns
- DosHeader
The read DOS header.
Exceptions
- BadImageFormatException
Occurs when the input stream does not point to a valid DOS header.
GetPhysicalSize()
Computes the number of bytes that the structure contains.
public override uint GetPhysicalSize()
Returns
- uint
The number of bytes.
Write(BinaryStreamWriter)
Serializes the structure to an output stream.
public override void Write(BinaryStreamWriter writer)
Parameters
writer
BinaryStreamWriterThe output stream to write the data to.