Example #1
0
 /// <summary>
 /// Creates a new <see cref="NTFields32"/>
 /// instance with the <paramref name="imageBase"/>
 /// <paramref name="sectionAlignment"/>, <paramref name="fileAlignment"/>,
 /// <paramref name="osMajor"/>, <paramref name="osMinor"/>, <paramref name="userMajor"/>,
 /// <paramref name="userMinor"/>, <paramref name="subSysMajor"/>,
 /// <paramref name="subSysMinor"/>, <paramref name="imageSize"/>,
 /// <paramref name="headerSize"/>,
 /// <paramref name="fileChecksum"/>, <paramref name="dllCharacteristics"/>,
 /// <paramref name="stackReserveSize"/>, <paramref name="stackCommitSize"/>,
 /// <paramref name="heapReserveSize"/>, <paramref name="heapCommitSize"/>,
 /// <paramref name="loaderFlags"/>, <paramref name="dataDirectoryCountand"/>
 /// and <paramref name="subSystem"/>
 /// provided.
 /// </summary>
 /// <param name="imageBase">The preferred load address of the
 /// <see cref="PEImage"/>.</param>
 /// <param name="sectionAlignment">The <see cref="UInt32"/> value
 /// used to align the section data in memory when the
 /// <see cref="PEImage"/> is loaded into memory.</param>
 /// <param name="fileAlignment">The <see cref="UInt32"/>
 /// value used to align the section data within the file itself,
 /// used to calculate where the individual sections are.
 /// </param>
 /// <param name="osMajor">The <see cref="UInt16"/> value determining
 /// the operating system's major version the <see cref="PEImage"/>
 /// targets.</param>
 /// <param name="osMinor">the <see cref="UInt16"/> value determining
 /// the operating system's minor version the <see cref="PEImage"/>
 /// targets.</param>
 /// <param name="userMajor">The <see cref="UInt16"/> value which denotes the
 /// major part of the <see cref="PEImage"/> version.</param>
 /// <param name="userMinor">The <see cref="UInt16"/> value which denotes the
 /// minor part of the <see cref="PEImage"/> version.</param>
 /// <param name="subSysMajor">The <see cref="UInt16"/> value which denotes the
 /// major version of the <paramref name="subsystem"/> the
 /// <see cref="PEImage"/> targets.</param>
 /// <param name="subSysMinor">The <see cref="UInt16"/> value which denotes the
 /// minor version of the <paramref name="subsystem"/> the
 /// <see cref="PEImage"/> targets.</param>
 /// <param name="imageSize">The <see cref="UInt32"/> value which determines the size,
 /// in bytes, of the <see cref="PEImage"/> including all headers,
 /// and padding.</param>
 /// <param name="headerSize">The <see cref="UInt32"/> value which notes the
 /// size of all headers defined within the <see cref="PEImage"/>.</param>
 /// <param name="fileChecksum">The <see cref="UInt32"/> value which notes the
 /// checksum hash of the file to determine whether it has
 /// been damaged (usually zero).</param>
 /// <param name="subsystem">The <see cref="PEImageSubsystem"/> which
 /// the <see cref="PEImage"/>
 /// targets.</param>
 public NTFields32(
     uint imageBase, uint sectionAlignment, uint fileAlignment, DWordVersion osVersion,
     DWordVersion binaryVersion, DWordVersion subsystemVersion, uint imageSize,
     uint headerSize, uint fileChecksum, PEImageSubsystem subsystem,
     PEImageDllCharacteristics dllCharacteristics, uint stackReserveSize, uint stackCommitSize,
     uint heapReserveSize, uint heapCommitSize, uint dataDirectoryCount = DefaultDataDirectoryCount)
 {
     this.imageBase          = imageBase;
     this.sectionAlignment   = sectionAlignment;
     this.fileAlignment      = fileAlignment;
     this.osVersion          = osVersion;
     this.binaryVersion      = binaryVersion;
     this.subsystemVersion   = subsystemVersion;
     this.reserved           = 0;
     this.imageSize          = imageSize;
     this.headerSize         = headerSize;
     this.fileChecksum       = fileChecksum;
     this.subsystem          = subsystem;
     this.dllCharacteristics = dllCharacteristics;
     this.stackReserveSize   = stackReserveSize;
     this.stackCommitSize    = stackCommitSize;
     this.heapReserveSize    = heapReserveSize;
     this.heapCommitSize     = heapCommitSize;
     this.loaderFlags        = 0;
     this.dataDirectoryCount = dataDirectoryCount;
 }
Example #2
0
 internal void Read(EndianAwareBinaryReader reader)
 {
     this.imageBase        = reader.ReadUInt32();
     this.sectionAlignment = reader.ReadUInt32();
     this.fileAlignment    = reader.ReadUInt32();
     this.osVersion.Read(reader);
     this.binaryVersion.Read(reader);
     this.subsystemVersion.Read(reader);
     this.reserved           = reader.ReadUInt32();
     this.imageSize          = reader.ReadUInt32();
     this.headerSize         = reader.ReadUInt32();
     this.fileChecksum       = reader.ReadUInt32();
     this.subsystem          = (PEImageSubsystem)reader.ReadUInt16();
     this.dllCharacteristics = (PEImageDllCharacteristics)reader.ReadUInt16();
     this.stackReserveSize   = reader.ReadUInt32();
     this.stackCommitSize    = reader.ReadUInt32();
     this.heapReserveSize    = reader.ReadUInt32();
     this.heapCommitSize     = reader.ReadUInt32();
     this.loaderFlags        = reader.ReadUInt32();
     this.dataDirectoryCount = reader.ReadUInt32();
 }