retdec
|
Class that handles the BoundImport directory. More...
#include <BoundImportDirectory.h>
Public Member Functions | |
virtual | ~BoundImportDirectory ()=default |
int | read (ImageLoader &imageLoader) |
Reads the BoundImport directory table from a PE file. More... | |
int | addBoundImport (const std::string &strModuleName, std::uint32_t dwTds, std::uint16_t dwOmn, std::uint16_t wWfr) |
Adds another bound import. More... | |
int | getModuleIndex (const std::string &strModuleName) const |
Identifies a module through it's name. More... | |
unsigned int | calcNumberOfModules () const |
Returns the number of files in the BoundImport directory. More... | |
int | read (unsigned char *pcBuffer, unsigned int uiSize) |
Reads the BoundImport directory table from a PE file. More... | |
void | rebuild (std::vector< std::uint8_t > &vBuffer, bool fMakeValid=true) const |
Rebuilds the BoundImport directory. More... | |
void | clear () |
Empties the BoundImport directory. More... | |
void | removeBoundImport (const std::string &strModuleName) |
Removes a bound import. More... | |
unsigned int | size () const |
Returns the size of the BoundImport directory. More... | |
int | write (const std::string &strFilename, std::uint32_t dwOffset, bool fMakeValid=true) const |
Writes the current bound import directory to a file. More... | |
std::uint32_t | getTimeDateStamp (std::uint32_t dwBidnr) const |
Retrieves the TimeDateStamp value of a bound import. More... | |
std::uint16_t | getOffsetModuleName (std::uint32_t dwBidnr) const |
Retrieves the OffsetModuleName value of a bound import. More... | |
std::uint16_t | getNumberOfModuleForwarderRefs (std::uint32_t dwBidnr) const |
Retrieves the NumberOfModuleForwarderRefs value of a bound import. More... | |
std::string | getModuleName (std::uint32_t dwBidnr) const |
Retrieves the ModuleName value of a bound import. More... | |
void | setTimeDateStamp (std::uint32_t dwBidnr, std::uint32_t dwTds) |
Updates the TimeDateStamp value of a bound import. More... | |
void | setOffsetModuleName (std::uint32_t dwBidnr, std::uint16_t wOmn) |
Updates the OffsetModuleName value of a bound import. More... | |
void | setNumberOfModuleForwarderRefs (std::uint32_t dwBidnr, std::uint16_t wMfr) |
Updates the NumberOfModuleForwarderRefs value of a bound import. More... | |
void | setModuleName (std::uint32_t dwBidnr, const std::string &strModuleName) |
Updates the ModuleName value of a bound import. More... | |
std::uint32_t | getTimeDateStamp (std::uint32_t dwBidnr, std::uint32_t forwardedModule) const |
std::uint16_t | getOffsetModuleName (std::uint32_t dwBidnr, std::uint32_t forwardedModule) const |
std::uint16_t | getNumberOfModuleForwarderRefs (std::uint32_t dwBidnr, std::uint32_t forwardedModule) const |
std::string | getModuleName (std::uint32_t dwBidnr, std::uint32_t forwardedModule) const |
void | setTimeDateStamp (std::uint32_t dwBidnr, std::uint32_t forwardedModule, std::uint32_t dwTds) |
void | setOffsetModuleName (std::uint32_t dwBidnr, std::uint32_t forwardedModule, std::uint16_t wOmn) |
void | setNumberOfModuleForwarderRefs (std::uint32_t dwBidnr, std::uint32_t forwardedModule, std::uint16_t wMfr) |
void | setModuleName (std::uint32_t dwBidnr, std::uint32_t forwardedModule, const std::string &strModuleName) |
std::uint16_t | calcNumberOfModuleForwarderRefs (std::uint32_t dwBidnr) const |
void | addForwardedModule (std::uint32_t dwBidnr, const std::string &name, std::uint32_t timeStamp=0, std::uint16_t offsetModuleName=0, std::uint16_t forwardedModules=0) |
void | removeForwardedModule (std::uint32_t dwBidnr, std::uint16_t forwardedModule) |
Protected Member Functions | |
int | read (InputBuffer &inpBuffer, unsigned char *data, unsigned int dwSize) |
unsigned int | totalModules () const |
Protected Attributes | |
std::vector< PELIB_IMAGE_BOUND_DIRECTORY > | m_vIbd |
Stores the individual BoundImport fields. More... | |
Class that handles the BoundImport directory.
This class can read and modify the BoundImport directory table of a PE file.
|
virtualdefault |
int PeLib::BoundImportDirectory::addBoundImport | ( | const std::string & | strModuleName, |
std::uint32_t | dwTds, | ||
std::uint16_t | wOmn, | ||
std::uint16_t | wWfr | ||
) |
Adds another bound import.
Adds another bound import to the BoundImport directory.
strModuleName | Name of the PE file which will be imported. |
dwTds | Value of the TimeDateStamp of the bound import field. |
wOmn | Value of the OffsetModuleName of the bound import field. |
wWfr | Value of the NumberOfModuleForwarderRefs of the bound import field. |
void PeLib::BoundImportDirectory::addForwardedModule | ( | std::uint32_t | dwBidnr, |
const std::string & | name, | ||
std::uint32_t | timeStamp = 0 , |
||
std::uint16_t | offsetModuleName = 0 , |
||
std::uint16_t | forwardedModules = 0 |
||
) |
std::uint16_t PeLib::BoundImportDirectory::calcNumberOfModuleForwarderRefs | ( | std::uint32_t | dwBidnr | ) | const |
unsigned int PeLib::BoundImportDirectory::calcNumberOfModules | ( | ) | const |
Returns the number of files in the BoundImport directory.
void PeLib::BoundImportDirectory::clear | ( | ) |
Empties the BoundImport directory.
Removes all bound import files.
int PeLib::BoundImportDirectory::getModuleIndex | ( | const std::string & | strModuleName | ) | const |
Identifies a module through it's name.
Searches for the first instance of a module with the given modulename.
strModuleName | The name of a module. |
std::string PeLib::BoundImportDirectory::getModuleName | ( | std::uint32_t | dwBidnr | ) | const |
Retrieves the ModuleName value of a bound import.
Retrieves the value of the ModuleName value of a bound import field.
dwBidnr | Number of the bound import field. |
std::string PeLib::BoundImportDirectory::getModuleName | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule | ||
) | const |
std::uint16_t PeLib::BoundImportDirectory::getNumberOfModuleForwarderRefs | ( | std::uint32_t | dwBidnr | ) | const |
Retrieves the NumberOfModuleForwarderRefs value of a bound import.
Retrieves the value of the NumberOfModuleForwarderRefs value of a bound import field.
dwBidnr | Number of the bound import field. |
std::uint16_t PeLib::BoundImportDirectory::getNumberOfModuleForwarderRefs | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule | ||
) | const |
std::uint16_t PeLib::BoundImportDirectory::getOffsetModuleName | ( | std::uint32_t | dwBidnr | ) | const |
Retrieves the OffsetModuleName value of a bound import.
Retrieves the value of the OffsetModuleName value of a bound import field.
dwBidnr | Number of the bound import field. |
std::uint16_t PeLib::BoundImportDirectory::getOffsetModuleName | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule | ||
) | const |
std::uint32_t PeLib::BoundImportDirectory::getTimeDateStamp | ( | std::uint32_t | dwBidnr | ) | const |
Retrieves the TimeDateStamp value of a bound import.
Retrieves the value of the TimeDateStamp value of a bound import field.
dwBidnr | Number of the bound import field. |
std::uint32_t PeLib::BoundImportDirectory::getTimeDateStamp | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule | ||
) | const |
int PeLib::BoundImportDirectory::read | ( | ImageLoader & | imageLoader | ) |
Reads the BoundImport directory table from a PE file.
Reads the BoundImport directory from a PE file.
imageLoader | Reference to the image loader |
|
protected |
Searches for the first instance of a module with the given modulename.
inpBuffer | Reference to the input buffer |
data | source data |
dwSize | length of the source data |
int PeLib::BoundImportDirectory::read | ( | unsigned char * | pcBuffer, |
unsigned int | uiSize | ||
) |
Reads the BoundImport directory table from a PE file.
void PeLib::BoundImportDirectory::rebuild | ( | std::vector< std::uint8_t > & | vBuffer, |
bool | fMakeValid = true |
||
) | const |
Rebuilds the BoundImport directory.
Rebuilds the BoundImport directory. The rebuilded BoundImport directory can then be written back to a PE file.
vBuffer | Buffer where the rebuilt BoundImport directory will be stored. |
fMakeValid | If this flag is true a valid directory will be produced. |
void PeLib::BoundImportDirectory::removeBoundImport | ( | const std::string & | strModuleName | ) |
Removes a bound import.
Removes a field specified by the parameter filename from the BoundImport directory.
strModuleName | Name of the file whose field will be removed from the BoundImport directory. |
void PeLib::BoundImportDirectory::removeForwardedModule | ( | std::uint32_t | dwBidnr, |
std::uint16_t | forwardedModule | ||
) |
void PeLib::BoundImportDirectory::setModuleName | ( | std::uint32_t | dwBidnr, |
const std::string & | strModuleName | ||
) |
Updates the ModuleName value of a bound import.
Changes the ModuleName value of an existing bound import field.
dwBidnr | Number of the bound import field which will be changed. |
strModuleName | New value of the ModuleName of the bound import field. |
void PeLib::BoundImportDirectory::setModuleName | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule, | ||
const std::string & | strModuleName | ||
) |
void PeLib::BoundImportDirectory::setNumberOfModuleForwarderRefs | ( | std::uint32_t | dwBidnr, |
std::uint16_t | wMfr | ||
) |
Updates the NumberOfModuleForwarderRefs value of a bound import.
Changes the NumberOfModuleForwarderRefs value of an existing bound import field.
dwBidnr | Number of the bound import field which will be changed. |
wMfr | New value of the NumberOfModuleForwarderRefs of the bound import field. |
void PeLib::BoundImportDirectory::setNumberOfModuleForwarderRefs | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule, | ||
std::uint16_t | wMfr | ||
) |
void PeLib::BoundImportDirectory::setOffsetModuleName | ( | std::uint32_t | dwBidnr, |
std::uint16_t | wOmn | ||
) |
Updates the OffsetModuleName value of a bound import.
Changes the OffsetModuleName value of an existing bound import field.
dwBidnr | Number of the bound import field which will be changed. |
wOmn | New value of the OffsetModuleName of the bound import field. |
void PeLib::BoundImportDirectory::setOffsetModuleName | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule, | ||
std::uint16_t | wOmn | ||
) |
void PeLib::BoundImportDirectory::setTimeDateStamp | ( | std::uint32_t | dwBidnr, |
std::uint32_t | dwTds | ||
) |
Updates the TimeDateStamp value of a bound import.
Changes the TimeDateStamp value of an existing bound import field.
dwBidnr | Number of the bound import field which will be changed. |
dwTds | New value of the TimeDateStamp of the bound import field. |
void PeLib::BoundImportDirectory::setTimeDateStamp | ( | std::uint32_t | dwBidnr, |
std::uint32_t | forwardedModule, | ||
std::uint32_t | dwTds | ||
) |
unsigned int PeLib::BoundImportDirectory::size | ( | ) | const |
Returns the size of the BoundImport directory.
Returns the size of the rebuilt BoundImportDirectory.
|
protected |
int PeLib::BoundImportDirectory::write | ( | const std::string & | strFilename, |
std::uint32_t | dwOffset, | ||
bool | fMakeValid = true |
||
) | const |
Writes the current bound import directory to a file.
strFilename | Name of the file. |
dwOffset | File offset the bound importdirectory will be written to. |
fMakeValid | If this flag is true a valid directory will be produced. |
|
protected |
Stores the individual BoundImport fields.