private void SetStreamToStartOfResourceSection(ImageSectionHeader resourceHeader) { _fileStream.Seek((int)resourceHeader.PointerToRawData, SeekOrigin.Begin); }
private bool TryGetSectionHeaderFromDirectoryEntry(DataDirectoryEntry entry, out ImageSectionHeader retSectionHeader) { var directoryEntry = OptionalHeader.DataDirectory[(int) entry]; foreach (var sectionHeader in _sectionHeaders) { if (sectionHeader.VirtualAddress <= directoryEntry.VirtualAddress && sectionHeader.VirtualAddress + sectionHeader.SizeOfRawData > directoryEntry.VirtualAddress) { retSectionHeader = sectionHeader; return true; } } retSectionHeader = new ImageSectionHeader(); return false; }