13 #ifndef RETDEC_PELIB_PEFILE_H
14 #define RETDEC_PELIB_PEFILE_H
51 virtual void setFileName(
const std::string & strFilename) = 0;
72 virtual int readRichHeader(std::size_t offset, std::size_t size,
bool ignoreInvalidKey =
false) = 0;
128 PeFileT(
const std::string& strFileName);
166 int readRichHeader(std::size_t offset, std::size_t size,
bool ignoreInvalidKey =
false) ;
Class for COFF symbol table.
Class for delay import directory.
Class for certificate directory.
Class that handles the BoundImport directory.
Definition: BoundImportDirectory.h:27
Definition: CoffSymbolTable.h:18
Class that handles the Debug directory.
Definition: DebugDirectory.h:22
Definition: DelayImportDirectory.h:20
Class that handles the export directory.
Definition: ExportDirectory.h:26
Class that handles the Import Address Table (IAT)
Definition: IatDirectory.h:26
Definition: ImageLoader.h:138
std::uint32_t getImageBitability() const
Definition: ImageLoader.cpp:432
Class that handles import directories.
Definition: ImportDirectory.h:42
int readImportDirectory()
Reads the import directory of the current file from disc.
Definition: PeFile.cpp:297
std::ifstream m_ifStream
Valid if we opened the file stream ourself.
Definition: PeFile.h:112
ComHeaderDirectory m_comdesc
COM+ descriptor directory of the current file.
Definition: PeFile.h:120
PeFileT()
Definition: PeFile.cpp:25
const ExportDirectory & expDir() const
Accessor function for the export directory.
Definition: PeFile.cpp:153
int loadPeHeaders(bool loadHeadersOnly=false)
Load the PE file using the already-open stream.
Definition: PeFile.cpp:31
int readSecurityDirectory()
Reads the security directory of the current file.
Definition: PeFile.cpp:315
std::string getFileName() const
Returns the name of the current file.
Definition: PeFile.cpp:253
int getFileType() const
returns PEFILE64 or PEFILE32
Definition: PeFile.cpp:42
int readRelocationsDirectory()
Reads the relocations directory of the current file from disc.
Definition: PeFile.cpp:326
int readCoffSymbolTable(ByteBuffer &fileData)
Reads the COFF symbol table of the current file.
Definition: PeFile.cpp:276
ResourceDirectory m_resdir
ResourceDirectory of the current file.
Definition: PeFile.h:118
TlsDirectory m_tlsdir
TLS directory of the current file.
Definition: PeFile.h:124
const BoundImportDirectory & boundImpDir() const
Accessor function for the bound import directory.
Definition: PeFile.cpp:169
DebugDirectory m_debugdir
Debug directory of the current file.
Definition: PeFile.h:122
int readDebugDirectory()
Reads the Debug directory of the current file.
Definition: PeFile.cpp:335
BoundImportDirectory m_boundimpdir
BoundImportDirectory of the current file.
Definition: PeFile.h:117
const ResourceDirectory & resDir() const
Accessor function for the resource directory.
Definition: PeFile.cpp:185
int readExportDirectory()
Reads the export directory of the current file from disc.
Definition: PeFile.cpp:288
int readComHeaderDirectory()
Reads the COM+ descriptor directory of the current file from disc.
Definition: PeFile.cpp:381
const DebugDirectory & debugDir() const
Accessor function for the debug directory.
Definition: PeFile.cpp:240
int readBoundImportDirectory()
Reads the bound import directory of the current file from disc.
Definition: PeFile.cpp:353
DelayImportDirectory m_delayimpdir
Delay import directory of the current file.
Definition: PeFile.h:123
const DelayImportDirectory & delayImports() const
Accessor function for the delay import directory.
Definition: PeFile.cpp:137
RelocationsDirectory m_relocs
Relocations directory of the current file.
Definition: PeFile.h:119
unsigned int getBits() const
Definition: PeFile.h:181
const ImportDirectory & impDir() const
Accessor function for the import directory.
Definition: PeFile.cpp:111
ExportDirectory m_expdir
Export directory of the current file.
Definition: PeFile.h:115
void setFileName(const std::string &strFilename)
Changes the name of the current file.
Definition: PeFile.cpp:261
LoaderError loaderError() const
Returns a loader error, if there was any.
Definition: PeFile.cpp:468
int readDelayImportDirectory()
Reads delay import directory of the current file.
Definition: PeFile.cpp:371
LoaderError checkForInMemoryLayout(LoaderError ldrError) const
Definition: PeFile.cpp:430
const ComHeaderDirectory & comDir() const
Accessor function for the COM+ descriptor directory.
Definition: PeFile.cpp:217
std::istream & m_iStream
Can also reference m_ifStream.
Definition: PeFile.h:113
const IatDirectory & iatDir() const
Accessor function for the IAT directory.
Definition: PeFile.cpp:230
IatDirectory m_iat
Import address table of the current file.
Definition: PeFile.h:121
int readIatDirectory()
Reads the IAT directory of the current file from disc.
Definition: PeFile.cpp:362
const RelocationsDirectory & relocDir() const
Accessor function for the relocations directory.
Definition: PeFile.cpp:201
ImportDirectory m_impdir
Import directory of the current file.
Definition: PeFile.h:116
int readTlsDirectory()
Reads the TLS directory of the current file.
Definition: PeFile.cpp:344
const TlsDirectory & tlsDir() const
Accessor function for the TLS directory.
Definition: PeFile.cpp:124
int readRichHeader(std::size_t offset, std::size_t size, bool ignoreInvalidKey=false)
Reads rich header of the current file.
Definition: PeFile.cpp:271
virtual ~PeFileT()
Default constructor which exists only for the sake of allowing to construct files without filenames.
Definition: PeFile.h:131
LoaderError checkEntryPointErrors() const
Checks the entry point code.
Definition: PeFile.cpp:391
int readResourceDirectory()
Reads the resource directory of the current file from disc.
Definition: PeFile.cpp:306
virtual LoaderError loaderError() const =0
Returns a loader error, if there was any.
virtual int readDebugDirectory()=0
Reads the Debug directory of the current file.
const SecurityDirectory & securityDir() const
Accessor function for the security directory.
Definition: PeFile.cpp:98
virtual int readExportDirectory()=0
Reads the export directory of the current file from disc.
virtual void setFileName(const std::string &strFilename)=0
Changes the name of the current file.
const ImageLoader & imageLoader() const
Accessor function for the image loader.
Definition: PeFile.cpp:64
virtual int readBoundImportDirectory()=0
Reads the bound import directory of the current file from disc.
virtual int readComHeaderDirectory()=0
Reads the COM+ descriptor directory of the current file from disc.
virtual unsigned int getBits() const =0
const RichHeader & richHeader() const
Accessor function for the Rich header.
Definition: PeFile.cpp:78
SecurityDirectory m_secdir
Security directory of the current file.
Definition: PeFile.h:44
virtual int readResourceDirectory()=0
Reads the resource directory of the current file from disc.
virtual int readIatDirectory()=0
Reads the IAT directory of the current file from disc.
virtual ~PeFile()
Definition: PeFile.cpp:28
RichHeader m_richheader
Rich header of the current file.
Definition: PeFile.h:42
virtual int readImportDirectory()=0
Reads the import directory of the current file from disc.
virtual int readCoffSymbolTable(ByteBuffer &fileData)=0
Reads the COFF symbol table of the current file.
virtual int readTlsDirectory()=0
Reads the TLS directory of the current file.
virtual std::string getFileName() const =0
Returns the name of the current file.
virtual int readRelocationsDirectory()=0
Reads the relocations directory of the current file from disc.
virtual int readSecurityDirectory()=0
Reads security directory of the current file.
CoffSymbolTable m_coffsymtab
Symbol table of the current file.
Definition: PeFile.h:43
std::string m_filename
Name of the current file.
Definition: PeFile.h:40
const CoffSymbolTable & coffSymTab() const
Accessor function for the COFF symbol table.
Definition: PeFile.cpp:88
virtual int readDelayImportDirectory()=0
Reads delay import directory of the current file.
ImageLoader m_imageLoader
Definition: PeFile.h:41
virtual int readRichHeader(std::size_t offset, std::size_t size, bool ignoreInvalidKey=false)=0
Reads rich header of the current file.
Class that handles the relocations directory.
Definition: RelocationsDirectory.h:25
Class that represents the resource directory of a PE file.
Definition: ResourceDirectory.h:342
Definition: SecurityDirectory.h:13
Class that handles the TLS directory.
Definition: TlsDirectory.h:25
Definition: BoundImportDirectory.h:21
LoaderError
Definition: PeLibAux.h:47
std::vector< std::uint8_t > ByteBuffer
Definition: PeLibAux.h:126