retdec
|
#include <PeFile.h>
Public Member Functions | |
PeFileT (const std::string &strFileName) | |
PeFileT (std::istream &stream) | |
PeFileT () | |
virtual | ~PeFileT () |
Default constructor which exists only for the sake of allowing to construct files without filenames. More... | |
int | loadPeHeaders (bool loadHeadersOnly=false) |
Load the PE file using the already-open stream. More... | |
int | loadPeHeaders (ByteBuffer &fileData, bool loadHeadersOnly=false) |
Alternate load - can be used when the data are already loaded to memory to prevent duplicating large buffers. More... | |
int | getFileType () const |
returns PEFILE64 or PEFILE32 More... | |
std::string | getFileName () const |
Returns the name of the current file. More... | |
void | setFileName (const std::string &strFilename) |
Changes the name of the current file. More... | |
int | readExportDirectory () |
Reads the export directory of the current file from disc. More... | |
int | readImportDirectory () |
Reads the import directory of the current file from disc. More... | |
int | readBoundImportDirectory () |
Reads the bound import directory of the current file from disc. More... | |
int | readResourceDirectory () |
Reads the resource directory of the current file from disc. More... | |
int | readRelocationsDirectory () |
Reads the relocations directory of the current file from disc. More... | |
int | readComHeaderDirectory () |
Reads the COM+ descriptor directory of the current file from disc. More... | |
int | readIatDirectory () |
Reads the IAT directory of the current file from disc. More... | |
int | readDebugDirectory () |
Reads the Debug directory of the current file. More... | |
int | readTlsDirectory () |
Reads the TLS directory of the current file. More... | |
int | readRichHeader (std::size_t offset, std::size_t size, bool ignoreInvalidKey=false) |
Reads rich header of the current file. More... | |
int | readCoffSymbolTable (ByteBuffer &fileData) |
Reads the COFF symbol table of the current file. More... | |
int | readDelayImportDirectory () |
Reads delay import directory of the current file. More... | |
int | readSecurityDirectory () |
Reads the security directory of the current file. More... | |
LoaderError | checkEntryPointErrors () const |
Checks the entry point code. More... | |
LoaderError | checkForInMemoryLayout (LoaderError ldrError) const |
LoaderError | loaderError () const |
Returns a loader error, if there was any. More... | |
unsigned int | getBits () const |
const ExportDirectory & | expDir () const |
Accessor function for the export directory. More... | |
ExportDirectory & | expDir () |
Accessor function for the export directory. More... | |
const ImportDirectory & | impDir () const |
Accessor function for the import directory. More... | |
ImportDirectory & | impDir () |
Accessor function for the import directory. More... | |
const BoundImportDirectory & | boundImpDir () const |
Accessor function for the bound import directory. More... | |
BoundImportDirectory & | boundImpDir () |
Accessor function for the bound import directory. More... | |
const ResourceDirectory & | resDir () const |
Accessor function for the resource directory. More... | |
ResourceDirectory & | resDir () |
Accessor function for the resource directory. More... | |
const RelocationsDirectory & | relocDir () const |
Accessor function for the relocations directory. More... | |
RelocationsDirectory & | relocDir () |
Accessor function for the relocations directory. More... | |
const ComHeaderDirectory & | comDir () const |
Accessor function for the COM+ descriptor directory. More... | |
ComHeaderDirectory & | comDir () |
Accessor function for the COM+ descriptor directory. More... | |
const IatDirectory & | iatDir () const |
Accessor function for the IAT directory. More... | |
IatDirectory & | iatDir () |
Accessor function for the IAT directory. More... | |
const DebugDirectory & | debugDir () const |
Accessor function for the debug directory. More... | |
DebugDirectory & | debugDir () |
Accessor function for the debug directory. More... | |
const DelayImportDirectory & | delayImports () const |
Accessor function for the delay import directory. More... | |
DelayImportDirectory & | delayImports () |
Accessor function for the delay import directory. More... | |
const TlsDirectory & | tlsDir () const |
Accessor function for the TLS directory. More... | |
TlsDirectory & | tlsDir () |
Accessor function for the TLS directory. More... | |
![]() | |
virtual | ~PeFile () |
const ImageLoader & | imageLoader () const |
Accessor function for the image loader. More... | |
ImageLoader & | imageLoader () |
Accessor function for the MZ header. More... | |
const RichHeader & | richHeader () const |
Accessor function for the Rich header. More... | |
RichHeader & | richHeader () |
Accessor function for the Rich header. More... | |
const CoffSymbolTable & | coffSymTab () const |
Accessor function for the COFF symbol table. More... | |
CoffSymbolTable & | coffSymTab () |
Accessor function for the COFF symbol table. More... | |
const SecurityDirectory & | securityDir () const |
Accessor function for the security directory. More... | |
SecurityDirectory & | securityDir () |
Accessor function for the security directory. More... | |
Private Attributes | |
std::ifstream | m_ifStream |
Valid if we opened the file stream ourself. More... | |
std::istream & | m_iStream |
Can also reference m_ifStream. More... | |
ExportDirectory | m_expdir |
Export directory of the current file. More... | |
ImportDirectory | m_impdir |
Import directory of the current file. More... | |
BoundImportDirectory | m_boundimpdir |
BoundImportDirectory of the current file. More... | |
ResourceDirectory | m_resdir |
ResourceDirectory of the current file. More... | |
RelocationsDirectory | m_relocs |
Relocations directory of the current file. More... | |
ComHeaderDirectory | m_comdesc |
COM+ descriptor directory of the current file. More... | |
IatDirectory | m_iat |
Import address table of the current file. More... | |
DebugDirectory | m_debugdir |
Debug directory of the current file. More... | |
DelayImportDirectory | m_delayimpdir |
Delay import directory of the current file. More... | |
TlsDirectory | m_tlsdir |
TLS directory of the current file. More... | |
Additional Inherited Members | |
![]() | |
std::string | m_filename |
Name of the current file. More... | |
ImageLoader | m_imageLoader |
RichHeader | m_richheader |
Rich header of the current file. More... | |
CoffSymbolTable | m_coffsymtab |
Symbol table of the current file. More... | |
SecurityDirectory | m_secdir |
Security directory of the current file. More... | |
This class implements the common structures of PE and PE+ files.
PeLib::PeFileT::PeFileT | ( | const std::string & | strFileName | ) |
PeLib::PeFileT::PeFileT | ( | std::istream & | stream | ) |
PeLib::PeFileT::PeFileT | ( | ) |
|
inlinevirtual |
Default constructor which exists only for the sake of allowing to construct files without filenames.
BoundImportDirectory & PeLib::PeFileT::boundImpDir | ( | ) |
Accessor function for the bound import directory.
const BoundImportDirectory & PeLib::PeFileT::boundImpDir | ( | ) | const |
Accessor function for the bound import directory.
LoaderError PeLib::PeFileT::checkEntryPointErrors | ( | ) | const |
Checks the entry point code.
LoaderError PeLib::PeFileT::checkForInMemoryLayout | ( | LoaderError | ldrError | ) | const |
ComHeaderDirectory & PeLib::PeFileT::comDir | ( | ) |
Accessor function for the COM+ descriptor directory.
const ComHeaderDirectory & PeLib::PeFileT::comDir | ( | ) | const |
Accessor function for the COM+ descriptor directory.
DebugDirectory & PeLib::PeFileT::debugDir | ( | ) |
Accessor function for the debug directory.
const DebugDirectory & PeLib::PeFileT::debugDir | ( | ) | const |
Accessor function for the debug directory.
DelayImportDirectory & PeLib::PeFileT::delayImports | ( | ) |
Accessor function for the delay import directory.
const DelayImportDirectory & PeLib::PeFileT::delayImports | ( | ) | const |
Accessor function for the delay import directory.
ExportDirectory & PeLib::PeFileT::expDir | ( | ) |
Accessor function for the export directory.
const ExportDirectory & PeLib::PeFileT::expDir | ( | ) | const |
Accessor function for the export directory.
|
inlinevirtual |
Implements PeLib::PeFile.
|
virtual |
Returns the name of the current file.
Implements PeLib::PeFile.
int PeLib::PeFileT::getFileType | ( | ) | const |
returns PEFILE64 or PEFILE32
IatDirectory & PeLib::PeFileT::iatDir | ( | ) |
Accessor function for the IAT directory.
const IatDirectory & PeLib::PeFileT::iatDir | ( | ) | const |
Accessor function for the IAT directory.
ImportDirectory & PeLib::PeFileT::impDir | ( | ) |
Accessor function for the import directory.
const ImportDirectory & PeLib::PeFileT::impDir | ( | ) | const |
Accessor function for the import directory.
|
virtual |
Returns a loader error, if there was any.
Implements PeLib::PeFile.
int PeLib::PeFileT::loadPeHeaders | ( | bool | loadHeadersOnly = false | ) |
Load the PE file using the already-open stream.
int PeLib::PeFileT::loadPeHeaders | ( | ByteBuffer & | fileData, |
bool | loadHeadersOnly = false |
||
) |
Alternate load - can be used when the data are already loaded to memory to prevent duplicating large buffers.
|
virtual |
Reads the bound import directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads the COFF symbol table of the current file.
Implements PeLib::PeFile.
|
virtual |
Reads the COM+ descriptor directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads the Debug directory of the current file.
Implements PeLib::PeFile.
|
virtual |
Reads delay import directory of the current file.
Implements PeLib::PeFile.
|
virtual |
Reads the export directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads the IAT directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads the import directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads the relocations directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads the resource directory of the current file from disc.
Implements PeLib::PeFile.
|
virtual |
Reads rich header of the current file.
Implements PeLib::PeFile.
|
virtual |
Reads the security directory of the current file.
Implements PeLib::PeFile.
|
virtual |
Reads the TLS directory of the current file.
Implements PeLib::PeFile.
RelocationsDirectory & PeLib::PeFileT::relocDir | ( | ) |
Accessor function for the relocations directory.
const RelocationsDirectory & PeLib::PeFileT::relocDir | ( | ) | const |
Accessor function for the relocations directory.
ResourceDirectory & PeLib::PeFileT::resDir | ( | ) |
Accessor function for the resource directory.
const ResourceDirectory & PeLib::PeFileT::resDir | ( | ) | const |
Accessor function for the resource directory.
|
virtual |
TlsDirectory & PeLib::PeFileT::tlsDir | ( | ) |
Accessor function for the TLS directory.
const TlsDirectory & PeLib::PeFileT::tlsDir | ( | ) | const |
Accessor function for the TLS directory.
|
private |
BoundImportDirectory of the current file.
|
private |
COM+ descriptor directory of the current file.
|
private |
Debug directory of the current file.
|
private |
Delay import directory of the current file.
|
private |
Export directory of the current file.
|
private |
Import address table of the current file.
|
private |
Valid if we opened the file stream ourself.
|
private |
Import directory of the current file.
|
private |
Can also reference m_ifStream.
|
private |
Relocations directory of the current file.
|
private |
ResourceDirectory of the current file.
|
private |
TLS directory of the current file.