/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ namespace dnSpy.Contracts.Hex.Files.PE { /// /// PE headers /// public abstract class PeHeaders : IBufferFileHeaders { /// /// Constructor /// protected PeHeaders() { } /// /// Gets the DOS header /// public abstract PeDosHeaderData DosHeader { get; } /// /// Gets the file header /// public abstract PeFileHeaderData FileHeader { get; } /// /// Gets the optional header /// public abstract PeOptionalHeaderData OptionalHeader { get; } /// /// Gets the sections /// public abstract PeSectionsData Sections { get; } /// /// true if file layout, false if memory layout /// public abstract bool IsFileLayout { get; } /// /// Converts to a buffer position. This method uses data /// from cached section headers. /// /// RVA /// public abstract HexPosition RvaToBufferPosition(uint rva); /// /// Converts a buffer position to an RVA. If the input is invalid, 0 is returned. /// This method uses data from cached section headers. /// /// Buffer position /// public abstract uint BufferPositionToRva(HexPosition position); /// /// Converts a buffer position to a file position in the PE file. If the input is invalid, 0 is returned. /// This method uses data from cached section headers. /// /// Buffer position /// public abstract ulong BufferPositionToFilePosition(HexPosition position); /// /// Converts a file position in the PE file to a buffer position. If the input is invalid, 0 is returned. /// This method uses data from cached section headers. /// /// File position /// public abstract HexPosition FilePositionToBufferPosition(ulong position); } }