public static AssemblySection ReadPESection(BinaryReader reader) { byte[] name = reader.ReadBytes(8); uint VirtualSize = reader.ReadUInt32(); uint VirtualAddress = reader.ReadUInt32(); uint SizeOfRawData = reader.ReadUInt32(); uint PointerToRawData = reader.ReadUInt32(); uint PointerToRelocations = reader.ReadUInt32(); uint PointerToLinenumbers = reader.ReadUInt32(); uint NumberOfRelocations = reader.ReadUInt16(); uint NumberOfLinenumbers = reader.ReadUInt16(); PESectionFlags Characteristics = (PESectionFlags)reader.ReadUInt32(); int k = 0; while (k < 8 && name[k] != '\0') ++k; string Name = Encoding.ASCII.GetString(name, 0, k); AssemblySection section = new AssemblySection(Name, VirtualAddress, VirtualSize, 0); section.SetFileInfo((int)PointerToRawData, (int)SizeOfRawData); return section; }
public void Add(AssemblySection section) { sections_.Add(section); switch (section.Name) { case SectionType.Text: this.TextSection = section; break; case SectionType.Data: this.DataSection = section; break; } }