libPeConv
A library to load, manipulate, dump PE files.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
peconv::ImportedDllCoverage Class Reference

#include <fix_imports.h>

Public Member Functions

 ImportedDllCoverage (std::set< ULONGLONG > &_addresses, const peconv::ExportsMapper &_exportsMap)
 
bool findCoveringDll ()
 
size_t mapAddressesToFunctions (const std::string &_mappedDllName)
 
bool isMappingComplete ()
 

Public Attributes

std::map< ULONGLONG, std::set< ExportedFunc > > addrToFunc
 
std::set< ULONGLONGnotFound
 
std::string dllName
 

Protected Attributes

std::string mappedDllName
 
std::set< ULONGLONG > & addresses
 
const peconv::ExportsMapperexportsMap
 

Detailed Description

a helper class that allows to find out where the functions are imported from

Definition at line 52 of file fix_imports.h.

Constructor & Destructor Documentation

◆ ImportedDllCoverage()

peconv::ImportedDllCoverage::ImportedDllCoverage ( std::set< ULONGLONG > & _addresses,
const peconv::ExportsMapper & _exportsMap )
inline

A constructor of an object of ImportedDllCoverage class.

Parameters
_addresses: the list of filled imports (VAs): the addresses to be covered
_exportsMap: the map of the exports of all the loaded DLLs (the space in which we will be searching)

Definition at line 60 of file fix_imports.h.

Member Function Documentation

◆ findCoveringDll()

bool ImportedDllCoverage::findCoveringDll ( )

Checks if all the addresses can be covered by one DLL. If yes, this dll will be saved into: dllName.

Returns
true if the covering DLL for the addresses was found. false otherwise.

Definition at line 125 of file fix_imports.cpp.

Here is the call graph for this function:

◆ isMappingComplete()

bool peconv::ImportedDllCoverage::isMappingComplete ( )
inline

Check if the functions mapping is complete.

Returns
the status: true if all the addresses are mapped to specific exports, false if not

Definition at line 85 of file fix_imports.h.

◆ mapAddressesToFunctions()

size_t ImportedDllCoverage::mapAddressesToFunctions ( const std::string & _mappedDllName)

Maps the addresses from the set to functions from the given DLL. Results are saved into: addrToFunc. Addresses that could not be covered by the given DLL are saved into notFound. Before each execution, the content of involved variables is erased.

Parameters
_mappedDllName: the name of the DLL that we will be used to mapping. This DLL is saved into mappedDllName.
Returns
a number of covered functions

Definition at line 186 of file fix_imports.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ addresses

std::set<ULONGLONG>& peconv::ImportedDllCoverage::addresses
protected

A supplied set of the addresses of imported functions. Those addressed will be covered (associated with the corresponding exports from available DLLs, defined by exportsMap).

Definition at line 112 of file fix_imports.h.

◆ addrToFunc

std::map<ULONGLONG, std::set<ExportedFunc> > peconv::ImportedDllCoverage::addrToFunc

A mapping associating each of the covered function addresses with the set of exports (from mapped DLL) that cover this address

Definition at line 90 of file fix_imports.h.

◆ dllName

std::string peconv::ImportedDllCoverage::dllName

Name of the covering DLL

Definition at line 100 of file fix_imports.h.

◆ exportsMap

const peconv::ExportsMapper& peconv::ImportedDllCoverage::exportsMap
protected

A supplied exportsMap. Only used as a lookup, no changes applied.

Definition at line 117 of file fix_imports.h.

◆ mappedDllName

std::string peconv::ImportedDllCoverage::mappedDllName
protected

A name of the DLL that was used for mapping. In a typical scenario it will be the same as covering DLL, but may be set different.

Definition at line 106 of file fix_imports.h.

◆ notFound

std::set<ULONGLONG> peconv::ImportedDllCoverage::notFound

Addresses of the functions not found in the mapped DLL

Definition at line 95 of file fix_imports.h.


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