retdec
Public Member Functions | Protected Attributes | List of all members
PeLib::RelocationsDirectory Class Reference

Class that handles the relocations directory. More...

#include <RelocationsDirectory.h>

Collaboration diagram for PeLib::RelocationsDirectory:
Collaboration graph
[legend]

Public Member Functions

 RelocationsDirectory ()
 Error detected by the import table parser. More...
 
virtual ~RelocationsDirectory ()=default
 
int read (ImageLoader &imageLoader)
 Read a file's relocations directory. More...
 
LoaderError loaderError () const
 Retrieve the loader error. More...
 
void setLoaderError (LoaderError ldrError)
 
unsigned int calcNumberOfRelocations () const
 Returns the number of relocations in the relocations directory. More...
 
unsigned int calcNumberOfRelocationData (unsigned int ulRelocation) const
 Returns the number of relocation data entries of a specific relocation. More...
 
void read (const std::uint8_t *data, std::uint32_t uiSize, std::uint32_t sizeOfImage)
 Read a file's relocations directory. More...
 
unsigned int size () const
 Returns the size of the relocations directory. More...
 
std::uint32_t getVirtualAddress (unsigned int ulRelocation) const
 Returns the VA of a relocation. More...
 
std::uint32_t getSizeOfBlock (unsigned int ulRelocation) const
 Returns the SizeOfBlock value of a relocation. More...
 
std::uint16_t getRelocationData (unsigned int ulRelocation, unsigned int ulDataNumber) const
 Returns the RelocationData of a relocation. More...
 
void setRelocationData (unsigned int ulRelocation, unsigned int ulDataNumber, std::uint16_t wData)
 Changes the relocation data of a relocation. More...
 
void setVirtualAddress (unsigned int ulRelocation, std::uint32_t dwValue)
 Changes the VirtualAddress of a relocation. More...
 
void setSizeOfBlock (unsigned int ulRelocation, std::uint32_t dwValue)
 Changes the SizeOfBlock of a relocation. More...
 
void addRelocation ()
 
void addRelocationData (unsigned int ulRelocation, std::uint16_t wValue)
 Adds new data to a relocation. More...
 
void removeRelocationData (unsigned int ulRelocation, std::uint16_t wValue)
 Removes data from a relocation. More...
 
void removeRelocation (unsigned int index)
 
void removeRelocationData (unsigned int relocindex, unsigned int dataindex)
 

Protected Attributes

std::vector< IMG_BASE_RELOCm_vRelocations
 Used to store the relocation data. More...
 
LoaderError m_ldrError
 

Detailed Description

Class that handles the relocations directory.

This class handles the relocations directory.

Constructor & Destructor Documentation

◆ RelocationsDirectory()

PeLib::RelocationsDirectory::RelocationsDirectory ( )

Error detected by the import table parser.

Constructor and destructor

Constructor

◆ ~RelocationsDirectory()

virtual PeLib::RelocationsDirectory::~RelocationsDirectory ( )
virtualdefault

Member Function Documentation

◆ addRelocation()

void PeLib::RelocationsDirectory::addRelocation ( )

◆ addRelocationData()

void PeLib::RelocationsDirectory::addRelocationData ( unsigned int  ulRelocation,
std::uint16_t  wValue 
)

Adds new data to a relocation.

◆ calcNumberOfRelocationData()

unsigned int PeLib::RelocationsDirectory::calcNumberOfRelocationData ( unsigned int  ulRelocation) const

Returns the number of relocation data entries of a specific relocation.

◆ calcNumberOfRelocations()

unsigned int PeLib::RelocationsDirectory::calcNumberOfRelocations ( ) const

Returns the number of relocations in the relocations directory.

◆ getRelocationData()

std::uint16_t PeLib::RelocationsDirectory::getRelocationData ( unsigned int  ulRelocation,
unsigned int  ulDataNumber 
) const

Returns the RelocationData of a relocation.

◆ getSizeOfBlock()

std::uint32_t PeLib::RelocationsDirectory::getSizeOfBlock ( unsigned int  ulRelocation) const

Returns the SizeOfBlock value of a relocation.

◆ getVirtualAddress()

std::uint32_t PeLib::RelocationsDirectory::getVirtualAddress ( unsigned int  ulRelocation) const

Returns the VA of a relocation.

◆ loaderError()

LoaderError PeLib::RelocationsDirectory::loaderError ( ) const

Retrieve the loader error.

Get the error that was detected during parsing of relocations

◆ read() [1/2]

void PeLib::RelocationsDirectory::read ( const std::uint8_t *  data,
std::uint32_t  uiSize,
std::uint32_t  sizeOfImage 
)

Read a file's relocations directory.

◆ read() [2/2]

int PeLib::RelocationsDirectory::read ( ImageLoader imageLoader)

Read a file's relocations directory.

◆ removeRelocation()

void PeLib::RelocationsDirectory::removeRelocation ( unsigned int  index)

◆ removeRelocationData() [1/2]

void PeLib::RelocationsDirectory::removeRelocationData ( unsigned int  relocindex,
unsigned int  dataindex 
)

◆ removeRelocationData() [2/2]

void PeLib::RelocationsDirectory::removeRelocationData ( unsigned int  ulRelocation,
std::uint16_t  wValue 
)

Removes data from a relocation.

◆ setLoaderError()

void PeLib::RelocationsDirectory::setLoaderError ( LoaderError  ldrError)

◆ setRelocationData()

void PeLib::RelocationsDirectory::setRelocationData ( unsigned int  ulRelocation,
unsigned int  ulDataNumber,
std::uint16_t  wData 
)

Changes the relocation data of a relocation.

◆ setSizeOfBlock()

void PeLib::RelocationsDirectory::setSizeOfBlock ( unsigned int  ulRelocation,
std::uint32_t  dwValue 
)

Changes the SizeOfBlock of a relocation.

◆ setVirtualAddress()

void PeLib::RelocationsDirectory::setVirtualAddress ( unsigned int  ulRelocation,
std::uint32_t  dwValue 
)

Changes the VirtualAddress of a relocation.

◆ size()

unsigned int PeLib::RelocationsDirectory::size ( ) const

Returns the size of the relocations directory.

Member Data Documentation

◆ m_ldrError

LoaderError PeLib::RelocationsDirectory::m_ldrError
protected

◆ m_vRelocations

std::vector<IMG_BASE_RELOC> PeLib::RelocationsDirectory::m_vRelocations
protected

Used to store the relocation data.


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