retdec
Private Types | Private Attributes | List of all members
retdec::fileformat::ImportTable Class Reference

#include <import_table.h>

Collaboration diagram for retdec::fileformat::ImportTable:
Collaboration graph
[legend]

Public Member Functions

Getters
std::size_t getNumberOfLibraries () const
 
std::size_t getNumberOfImports () const
 
std::size_t getNumberOfImportsInLibrary (std::size_t libraryIndex) const
 
std::size_t getNumberOfImportsInLibrary (const std::string &name) const
 
std::size_t getNumberOfImportsInLibraryCaseInsensitive (const std::string &name) const
 
const std::string & getImphashCrc32 () const
 
const std::string & getImphashMd5 () const
 
const std::string & getImphashSha256 () const
 
const std::vector< std::string > & getMissingDependencies () const
 
std::string getLibrary (std::size_t libraryIndex) const
 
const ImportgetImport (std::size_t importIndex) const
 
const ImportgetImport (const std::string &name) const
 
const ImportgetImportOnAddress (unsigned long long address) const
 
Iterators
importsIterator begin () const
 
importsIterator end () const
 
Other methods
void computeHashes ()
 
void clear ()
 
void addLibrary (std::string name, bool missingDependency=false)
 
void addImport (std::unique_ptr< Import > &&import)
 
bool hasLibraries () const
 
bool hasLibrary (const std::string &name) const
 
bool hasLibraryCaseInsensitive (const std::string &name) const
 
bool hasImports () const
 
bool hasImport (const std::string &name) const
 
bool hasImport (unsigned long long address) const
 
bool invalidImpHash () const
 
bool empty () const
 
void dump (std::string &dumpTable) const
 
void dumpLibrary (std::size_t libraryIndex, std::string &libraryDump) const
 

Private Types

using importsIterator = std::vector< std::unique_ptr< Import > >::const_iterator
 

Private Attributes

std::vector< std::string > libraries
 name of libraries More...
 
std::vector< std::string > missingDeps
 missing dependencies More...
 
std::vector< std::unique_ptr< Import > > imports
 stored imports More...
 
std::string impHashCrc32
 imphash CRC32 More...
 
std::string impHashMd5
 imphash MD5 More...
 
std::string impHashSha256
 imphash SHA256 More...
 

Detailed Description

Table of imports

Member Typedef Documentation

◆ importsIterator

using retdec::fileformat::ImportTable::importsIterator = std::vector<std::unique_ptr<Import> >::const_iterator
private

Member Function Documentation

◆ addImport()

void retdec::fileformat::ImportTable::addImport ( std::unique_ptr< Import > &&  import)

Add import

Parameters
importImport which will be added

◆ addLibrary()

void retdec::fileformat::ImportTable::addLibrary ( std::string  name,
bool  isMissingDependency = false 
)

Add name of imported library

Parameters
nameName of imported library
isMissingDependencyIf true, then it means that the library name might be a missing dependency (aka not normally present on the OS)

Order in which are libraries added must be same as order of libraries import in input file

◆ begin()

ImportTable::importsIterator retdec::fileformat::ImportTable::begin ( ) const

Get begin imports iterator

Returns
Begin imports iterator

◆ clear()

void retdec::fileformat::ImportTable::clear ( )

Reset table and delete all records from it

◆ computeHashes()

void retdec::fileformat::ImportTable::computeHashes ( )

Compute import hashes - CRC32, MD5, SHA256.

◆ dump()

void retdec::fileformat::ImportTable::dump ( std::string &  dumpTable) const

Dump information about all imports in table

Parameters
dumpTableInto this parameter is stored dump of import table in an LLVM style

◆ dumpLibrary()

void retdec::fileformat::ImportTable::dumpLibrary ( std::size_t  libraryIndex,
std::string &  libraryDump 
) const

Dump information about selected library

Parameters
libraryIndexIndex of selected library (indexed from 0)
libraryDumpInto this parameter is stored dump of selected library

◆ empty()

bool retdec::fileformat::ImportTable::empty ( ) const

Check if import table is empty

Returns
true if table does not contain any library name or import, false otherwise

◆ end()

ImportTable::importsIterator retdec::fileformat::ImportTable::end ( ) const

Get end imports iterator

Returns
End imports iterator

◆ getImphashCrc32()

const std::string & retdec::fileformat::ImportTable::getImphashCrc32 ( ) const

Get imphash as CRC32

Returns
Imphash as CRC32

◆ getImphashMd5()

const std::string & retdec::fileformat::ImportTable::getImphashMd5 ( ) const

Get imphash as MD5

Returns
Imphash as MD5

◆ getImphashSha256()

const std::string & retdec::fileformat::ImportTable::getImphashSha256 ( ) const

Get imphash as SHA256

Returns
Imphash as SHA256

◆ getImport() [1/2]

const Import * retdec::fileformat::ImportTable::getImport ( const std::string &  name) const

Get import by name

Parameters
nameName of the import to get
Returns
Pointer to import with the specified name or nullptr if such import not found

◆ getImport() [2/2]

const Import * retdec::fileformat::ImportTable::getImport ( std::size_t  importIndex) const

Get selected import

Parameters
importIndexIndex of selected import (indexed from 0)
Returns
Pointer to selected import or nullptr if import index is invalid

◆ getImportOnAddress()

const Import * retdec::fileformat::ImportTable::getImportOnAddress ( unsigned long long  address) const

Get selected import

Parameters
addressAdress of selected import
Returns
Pointer to selected import or nullptr if import address is invalid

◆ getLibrary()

std::string retdec::fileformat::ImportTable::getLibrary ( std::size_t  libraryIndex) const

Get name of imported library

Parameters
libraryIndexIndex of selected library (indexed from 0)
Returns
Name of selected library or empty string if library index is invalid

◆ getMissingDependencies()

const std::vector< std::string > & retdec::fileformat::ImportTable::getMissingDependencies ( ) const

Get list of missing dependencies

Returns
Vector of missing dependencies

◆ getNumberOfImports()

std::size_t retdec::fileformat::ImportTable::getNumberOfImports ( ) const

Get number of imports in import table

Returns
Number of imports in import table

◆ getNumberOfImportsInLibrary() [1/2]

std::size_t retdec::fileformat::ImportTable::getNumberOfImportsInLibrary ( const std::string &  name) const

Get number of imports from selected library

Parameters
nameName of selected library
Returns
Number of imports from selected library or 0 if library was not found

◆ getNumberOfImportsInLibrary() [2/2]

std::size_t retdec::fileformat::ImportTable::getNumberOfImportsInLibrary ( std::size_t  libraryIndex) const

Get number of imports from selected library

Parameters
libraryIndexIndex of selected library (indexed from 0)
Returns
Number of imports from selected library or 0 if library index is invalid

◆ getNumberOfImportsInLibraryCaseInsensitive()

std::size_t retdec::fileformat::ImportTable::getNumberOfImportsInLibraryCaseInsensitive ( const std::string &  name) const

Get number of imports from selected library

Parameters
nameName of selected library (cse-insensitive)
Returns
Number of imports from selected library or 0 if library was not found

◆ getNumberOfLibraries()

std::size_t retdec::fileformat::ImportTable::getNumberOfLibraries ( ) const

Get number of libraries which are imported

Returns
Number of libraries which are imported

◆ hasImport() [1/2]

bool retdec::fileformat::ImportTable::hasImport ( const std::string &  name) const

Check if import with name name exists

Parameters
nameName of import
Returns
true if import with name name exists, false otherwise

◆ hasImport() [2/2]

bool retdec::fileformat::ImportTable::hasImport ( unsigned long long  address) const

Check if import on address exists

Parameters
addressAdress of import
Returns
true if has import on address, false otherwise

◆ hasImports()

bool retdec::fileformat::ImportTable::hasImports ( ) const

Find out if there are any imports.

Returns
true if there are some imports, false otherwise

◆ hasLibraries()

bool retdec::fileformat::ImportTable::hasLibraries ( ) const

Find out if there are any libraries.

Returns
true if there are some libraries, false otherwise.

◆ hasLibrary()

bool retdec::fileformat::ImportTable::hasLibrary ( const std::string &  name) const

Find out if there is library with name name

Parameters
nameName of selected library
Returns
true if there is library with name name, false otherwise

◆ hasLibraryCaseInsensitive()

bool retdec::fileformat::ImportTable::hasLibraryCaseInsensitive ( const std::string &  name) const

Find out if there is library with name name (case-insensitive)

Parameters
nameName of selected library
Returns
true if there is library with name name, false otherwise

◆ invalidImpHash()

bool retdec::fileformat::ImportTable::invalidImpHash ( ) const
Returns
True if import hashes are invalid, False otherwise.

Member Data Documentation

◆ impHashCrc32

std::string retdec::fileformat::ImportTable::impHashCrc32
private

imphash CRC32

◆ impHashMd5

std::string retdec::fileformat::ImportTable::impHashMd5
private

imphash MD5

◆ impHashSha256

std::string retdec::fileformat::ImportTable::impHashSha256
private

imphash SHA256

◆ imports

std::vector<std::unique_ptr<Import> > retdec::fileformat::ImportTable::imports
private

stored imports

◆ libraries

std::vector<std::string> retdec::fileformat::ImportTable::libraries
private

name of libraries

◆ missingDeps

std::vector<std::string> retdec::fileformat::ImportTable::missingDeps
private

missing dependencies


The documentation for this class was generated from the following files: