internal static void ReadDOSHeader(MemoryCursor/*!*/ c) { c.Position = 0; int magicNumber = c.UInt16(0); if (magicNumber != 0x5a4d) throw new InvalidMetadataException(ExceptionStrings.BadMagicNumber); c.Position = 0x3c; int ntHeaderOffset = c.Int32(0); c.Position = ntHeaderOffset; }
internal static SectionHeader ReadSectionHeader(MemoryCursor/*!*/ c) { SectionHeader header = new SectionHeader(); header.name = c.ReadASCII(8); header.virtualSize = c.Int32(0); header.virtualAddress = c.Int32(1); header.sizeOfRawData = c.Int32(2); header.pointerToRawData = c.Int32(3); header.pointerToRelocations = c.Int32(4); header.pointerToLinenumbers = c.Int32(5); c.SkipInt32(6); header.numberOfRelocations = c.UInt16(0); header.numberOfLinenumbers = c.UInt16(1); c.SkipInt16(2); header.characteristics = c.Int32(0); c.SkipInt32(1); return header; }
private static CLIHeader/*!*/ ReadCLIHeader(MemoryCursor/*!*/ c) { CLIHeader header = new CLIHeader(); header.cb = c.Int32(0); c.SkipInt32(1); header.majorRuntimeVersion = c.UInt16(0); header.minorRuntimeVersion = c.UInt16(1); c.SkipUInt16(2); header.metaData = ReadDirectoryEntry(c); header.flags = c.Int32(0); header.entryPointToken = c.Int32(1); c.SkipInt32(2); header.resources = ReadDirectoryEntry(c); header.strongNameSignature = ReadDirectoryEntry(c); header.codeManagerTable = ReadDirectoryEntry(c); header.vtableFixups = ReadDirectoryEntry(c); header.exportAddressTableJumps = ReadDirectoryEntry(c); if (header.majorRuntimeVersion < 2) throw new InvalidMetadataException(ExceptionStrings.BadCLIHeader); return header; }