void init() { seek(0); if (reader.ReadUInt16() != 0x5A4D) throw new BadImageFormatException("Not a PE file"); skip(29 * 2); seek(reader.ReadUInt32()); if (reader.ReadUInt32() != 0x4550) throw new BadImageFormatException("Not a PE file"); fileHeader = new FileHeader(reader); optionalHeader = new OptionalHeader(reader); sectionHeaders = new SectionHeader[fileHeader.numberOfSections]; for (int i = 0; i < sectionHeaders.Length; i++) sectionHeaders[i] = new SectionHeader(reader); uint netRva = optionalHeader.dataDirectories[14].virtualAddress; if (netRva != 0) { seekRva(netRva); cor20Header = new Cor20Header(reader); dotNetSection = getSectionHeader(netRva); seekRva(cor20Header.metadataDirectory.virtualAddress); cor20Header.initMetadataTable(); } uint resourceRva = optionalHeader.dataDirectories[2].virtualAddress; uint resourceOffset = 0; if (resourceRva != 0) resourceOffset = rvaToOffset(resourceRva); resources = new Resources(reader, resourceOffset, optionalHeader.dataDirectories[2].size); }
public ResourceDirectory(string name, Resources resources, int offset) : base(name) { init(resources, offset); }
void init(Resources resources, int offset) { this.resources = resources; this.offset = offset; initializeEntries(); }
public ResourceDirectory(int id, Resources resources, int offset) : base(id) { init(resources, offset); }