// dnlib: See LICENSE.txt for more info
using System;
using dnlib.IO;
namespace dnlib.PE {
///
/// Represents the IMAGE_DOS_HEADER PE section
///
public sealed class ImageDosHeader : FileSection {
readonly uint ntHeadersOffset;
///
/// File offset of the NT headers
///
public uint NTHeadersOffset => ntHeadersOffset;
///
/// Constructor
///
/// PE file reader
/// Verify section
/// Thrown if verification fails
public ImageDosHeader(ref DataReader reader, bool verify) {
SetStartOffset(ref reader);
ushort sig = reader.ReadUInt16();
if (verify && sig != 0x5A4D)
throw new BadImageFormatException("Invalid DOS signature");
reader.Position = (uint)startOffset + 0x3C;
ntHeadersOffset = reader.ReadUInt32();
SetEndoffset(ref reader);
}
}
}