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

Class that handles the Debug directory. More...

#include <DebugDirectory.h>

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

Public Member Functions

virtual ~DebugDirectory ()=default
 
int read (std::istream &inStream, ImageLoader &imageLoader)
 Reads the Debug directory from a file. More...
 
void clear ()
 
void rebuild (std::vector< std::uint8_t > &obBuffer) const
 Rebuilds the current Debug directory. More...
 
unsigned int size () const
 Returns the size the current Debug directory needs after rebuilding. More...
 
int write (const std::string &strFilename, unsigned int uiOffset) const
 Writes the current Debug directory back to a file. More...
 
unsigned int calcNumberOfEntries () const
 Returns the number of DebugDirectory image structures in the current DebugDirectory. More...
 
void addEntry ()
 Adds a new debug structure. More...
 
void removeEntry (std::size_t uiIndex)
 Removes a debug structure. More...
 
std::uint32_t getCharacteristics (std::size_t uiIndex) const
 Returns the Characteristics value of a debug structure. More...
 
std::uint32_t getTimeDateStamp (std::size_t uiIndex) const
 Returns the TimeDateStamp value of a debug structure. More...
 
std::uint16_t getMajorVersion (std::size_t uiIndex) const
 Returns the MajorVersion value of a debug structure. More...
 
std::uint16_t getMinorVersion (std::size_t uiIndex) const
 Returns the MinorVersion value of a debug structure. More...
 
std::uint32_t getType (std::size_t uiIndex) const
 Returns the Type value of a debug structure. More...
 
std::uint32_t getSizeOfData (std::size_t uiIndex) const
 Returns the SizeOfData value of a debug structure. More...
 
std::uint32_t getAddressOfRawData (std::size_t uiIndex) const
 Returns the AddressOfRawData value of a debug structure. More...
 
std::uint32_t getPointerToRawData (std::size_t uiIndex) const
 Returns the PointerToRawData value of a debug structure. More...
 
std::vector< std::uint8_t > getData (std::size_t index) const
 
void setCharacteristics (std::size_t uiIndex, std::uint32_t dwValue)
 Sets the Characteristics value of a debug structure. More...
 
void setTimeDateStamp (std::size_t uiIndex, std::uint32_t dwValue)
 Sets the TimeDateStamp value of a debug structure. More...
 
void setMajorVersion (std::size_t uiIndex, std::uint16_t wValue)
 Sets the MajorVersion value of a debug structure. More...
 
void setMinorVersion (std::size_t uiIndex, std::uint16_t wValue)
 Sets the MinorVersion value of a debug structure. More...
 
void setType (std::size_t uiIndex, std::uint32_t dwValue)
 Sets the Type value of a debug structure. More...
 
void setSizeOfData (std::size_t uiIndex, std::uint32_t dwValue)
 Sets the SizeOfData value of a debug structure. More...
 
void setAddressOfRawData (std::size_t uiIndex, std::uint32_t dwValue)
 Sets the AddressOfRawData value of a debug structure. More...
 
void setPointerToRawData (std::size_t uiIndex, std::uint32_t dwValue)
 Sets the PointerToRawData value of a debug structure. More...
 
void setData (std::size_t index, const std::vector< std::uint8_t > &data)
 
const std::vector< std::pair< unsigned int, unsigned int > > & getOccupiedAddresses () const
 

Protected Member Functions

void read (ImageLoader &imageLoader, std::vector< PELIB_IMG_DEBUG_DIRECTORY > &debugInfo, std::uint32_t rva, std::uint32_t size)
 

Protected Attributes

std::vector< PELIB_IMG_DEBUG_DIRECTORYm_vDebugInfo
 Stores the various DebugDirectory structures. More...
 
std::vector< std::pair< unsigned int, unsigned int > > m_occupiedAddresses
 Stores RVAs which are occupied by this debug directory. More...
 

Detailed Description

Class that handles the Debug directory.

Constructor & Destructor Documentation

◆ ~DebugDirectory()

virtual PeLib::DebugDirectory::~DebugDirectory ( )
virtualdefault

Member Function Documentation

◆ addEntry()

void PeLib::DebugDirectory::addEntry ( )

Adds a new debug structure.

Adds a new debug structure to the debug directory. The initial values of all members of the structure are undefined.

◆ calcNumberOfEntries()

unsigned int PeLib::DebugDirectory::calcNumberOfEntries ( ) const

Returns the number of DebugDirectory image structures in the current DebugDirectory.

Returns
Number of debug structures in the current Debug directory.

◆ clear()

void PeLib::DebugDirectory::clear ( )

◆ getAddressOfRawData()

std::uint32_t PeLib::DebugDirectory::getAddressOfRawData ( std::size_t  uiIndex) const

Returns the AddressOfRawData value of a debug structure.

Returns the AddressOfRawData value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
AddressOfRawData value of the debug structure.

◆ getCharacteristics()

std::uint32_t PeLib::DebugDirectory::getCharacteristics ( std::size_t  uiIndex) const

Returns the Characteristics value of a debug structure.

Returns the Characteristics value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
Characteristics value of the debug structure.

◆ getData()

std::vector< std::uint8_t > PeLib::DebugDirectory::getData ( std::size_t  index) const

◆ getMajorVersion()

std::uint16_t PeLib::DebugDirectory::getMajorVersion ( std::size_t  uiIndex) const

Returns the MajorVersion value of a debug structure.

Returns the MajorVersion value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
MajorVersion value of the debug structure.

◆ getMinorVersion()

std::uint16_t PeLib::DebugDirectory::getMinorVersion ( std::size_t  uiIndex) const

Returns the MinorVersion value of a debug structure.

Returns the MinorVersion value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
MinorVersion value of the debug structure.

◆ getOccupiedAddresses()

const std::vector< std::pair< unsigned int, unsigned int > > & PeLib::DebugDirectory::getOccupiedAddresses ( ) const

◆ getPointerToRawData()

std::uint32_t PeLib::DebugDirectory::getPointerToRawData ( std::size_t  uiIndex) const

Returns the PointerToRawData value of a debug structure.

Returns the PointerToRawData value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
PointerToRawData value of the debug structure.

◆ getSizeOfData()

std::uint32_t PeLib::DebugDirectory::getSizeOfData ( std::size_t  uiIndex) const

Returns the SizeOfData value of a debug structure.

Returns the SizeOfData value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
SizeOfData value of the debug structure.

◆ getTimeDateStamp()

std::uint32_t PeLib::DebugDirectory::getTimeDateStamp ( std::size_t  uiIndex) const

Returns the TimeDateStamp value of a debug structure.

Returns the TimeDateStamp value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
TimeDateStamp value of the debug structure.

◆ getType()

std::uint32_t PeLib::DebugDirectory::getType ( std::size_t  uiIndex) const

Returns the Type value of a debug structure.

Returns the Type value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
Returns
Type value of the debug structure.

◆ read() [1/2]

void PeLib::DebugDirectory::read ( ImageLoader imageLoader,
std::vector< PELIB_IMG_DEBUG_DIRECTORY > &  debugInfo,
std::uint32_t  rva,
std::uint32_t  size 
)
protected

◆ read() [2/2]

int PeLib::DebugDirectory::read ( std::istream &  inStream,
ImageLoader imageLoader 
)

Reads the Debug directory from a file.

Parameters
inStreamInput stream.
imageLoaderA valid image loader reference which is necessary because some RVA calculations need to be done.

◆ rebuild()

void PeLib::DebugDirectory::rebuild ( std::vector< std::uint8_t > &  vBuffer) const

Rebuilds the current Debug directory.

Rebuilds the current debug directory.

Parameters
vBufferBuffer where the rebuilt directory is stored.

◆ removeEntry()

void PeLib::DebugDirectory::removeEntry ( std::size_t  uiIndex)

Removes a debug structure.

Removes a debug structure from the current debug directory. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.

◆ setAddressOfRawData()

void PeLib::DebugDirectory::setAddressOfRawData ( std::size_t  uiIndex,
std::uint32_t  dwValue 
)

Sets the AddressOfRawData value of a debug structure.

Changes the AddressOfRawData value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
dwValueNew value of the AddressOfRawData value of the debug structure.

◆ setCharacteristics()

void PeLib::DebugDirectory::setCharacteristics ( std::size_t  uiIndex,
std::uint32_t  dwValue 
)

Sets the Characteristics value of a debug structure.

Changes the Characteristics value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
dwValueNew value of the Characteristics value of the debug structure.

◆ setData()

void PeLib::DebugDirectory::setData ( std::size_t  index,
const std::vector< std::uint8_t > &  data 
)

◆ setMajorVersion()

void PeLib::DebugDirectory::setMajorVersion ( std::size_t  uiIndex,
std::uint16_t  wValue 
)

Sets the MajorVersion value of a debug structure.

Changes the MajorVersion value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
wValueNew value of the MajorVersion value of the debug structure.

◆ setMinorVersion()

void PeLib::DebugDirectory::setMinorVersion ( std::size_t  uiIndex,
std::uint16_t  wValue 
)

Sets the MinorVersion value of a debug structure.

Changes the MinorVersion value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
wValueNew value of the MinorVersion value of the debug structure.

◆ setPointerToRawData()

void PeLib::DebugDirectory::setPointerToRawData ( std::size_t  uiIndex,
std::uint32_t  dwValue 
)

Sets the PointerToRawData value of a debug structure.

Changes the PointerToRawData value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
dwValueNew value of the PointerToRawData value of the debug structure.

◆ setSizeOfData()

void PeLib::DebugDirectory::setSizeOfData ( std::size_t  uiIndex,
std::uint32_t  dwValue 
)

Sets the SizeOfData value of a debug structure.

Changes the SizeOfData value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
dwValueNew value of the SizeOfData value of the debug structure.

◆ setTimeDateStamp()

void PeLib::DebugDirectory::setTimeDateStamp ( std::size_t  uiIndex,
std::uint32_t  dwValue 
)

Sets the TimeDateStamp value of a debug structure.

Changes the TimeDateStamp value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
dwValueNew value of the TimeDateStamp value of the debug structure.

◆ setType()

void PeLib::DebugDirectory::setType ( std::size_t  uiIndex,
std::uint32_t  dwValue 
)

Sets the Type value of a debug structure.

Changes the Type value of a debug structure. If an invalid structure is specified by the parameter uiIndex the result will be undefined behaviour.

Parameters
uiIndexIdentifies the debug structure.
dwValueNew value of the Type value of the debug structure.

◆ size()

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

Returns the size the current Debug directory needs after rebuilding.

Returns
Size of the debug directory.

◆ write()

int PeLib::DebugDirectory::write ( const std::string &  strFilename,
unsigned int  uiOffset 
) const

Writes the current Debug directory back to a file.

Parameters
strFilenameName of the file which will be written.
uiOffsetFile offset where the debug directory will be stored.

Member Data Documentation

◆ m_occupiedAddresses

std::vector<std::pair<unsigned int, unsigned int> > PeLib::DebugDirectory::m_occupiedAddresses
protected

Stores RVAs which are occupied by this debug directory.

◆ m_vDebugInfo

std::vector<PELIB_IMG_DEBUG_DIRECTORY> PeLib::DebugDirectory::m_vDebugInfo
protected

Stores the various DebugDirectory structures.


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