retdec
|
ResourceNodes represent the nodes in the resource tree. More...
#include <ResourceDirectory.h>
Public Member Functions | |
bool | isLeaf () const |
Indicates if the resource element is a leaf or a node. More... | |
void | makeValid () |
Corrects erroneous values in the ResourceNode. More... | |
unsigned int | getNumberOfChildren () const |
Returns the node's number of children. More... | |
ResourceChild * | addChild () |
Adds another child to node. More... | |
ResourceChild * | getChild (std::size_t uiIndex) |
Returns a node's child. More... | |
const ResourceChild * | getChild (std::size_t uiIndex) const |
void | removeChild (unsigned int uiIndex) |
Removes a node's child. More... | |
std::string | getChildName (unsigned int uiIndex) const |
Returns the name of one of the node's children. More... | |
std::uint32_t | getOffsetToChildName (unsigned int uiIndex) const |
Returns the Name value of one of the node's children. More... | |
std::uint32_t | getOffsetToChildData (unsigned int uiIndex) const |
Returns the OffsetToData value of one of the node's children. More... | |
void | setChildName (unsigned int uiIndex, const std::string &strNewName) |
Sets the name of one of the node's children. More... | |
void | setOffsetToChildName (unsigned int uiIndex, std::uint32_t dwNewOffset) |
Sets the Name value of one of the node's children. More... | |
void | setOffsetToChildData (unsigned int uiIndex, std::uint32_t dwNewOffset) |
Sets the OffsetToData value of one of the node's children. More... | |
std::uint32_t | getCharacteristics () const |
Returns the node's Characteristics value. More... | |
std::uint32_t | getTimeDateStamp () const |
Returns the node's TimeDateStamp value. More... | |
std::uint16_t | getMajorVersion () const |
Returns the node's MajorVersion value. More... | |
std::uint16_t | getMinorVersion () const |
Returns the node's MinorVersion value. More... | |
std::uint16_t | getNumberOfNamedEntries () const |
Returns the node's NumberOfNamedEntries value. More... | |
std::uint16_t | getNumberOfIdEntries () const |
Returns the node's NumberOfIdEntries value. More... | |
void | setCharacteristics (std::uint32_t value) |
Sets the node's Characteristics value. More... | |
void | setTimeDateStamp (std::uint32_t value) |
Sets the node's TimeDateStamp value. More... | |
void | setMajorVersion (std::uint16_t value) |
Sets the node's MajorVersion value. More... | |
void | setMinorVersion (std::uint16_t value) |
Sets the node's MinorVersion value. More... | |
void | setNumberOfNamedEntries (std::uint16_t value) |
Sets the node's NumberOfNamedEntries value. More... | |
void | setNumberOfIdEntries (std::uint16_t value) |
Sets the node's NumberOfIdEntries value. More... | |
ResourceNode () | |
Returns the size of a resource node. More... | |
virtual | ~ResourceNode () override |
Destructor. More... | |
![]() | |
unsigned int | getElementRva () const |
Returns the RVA of the element in the file. More... | |
ResourceElement () | |
Returns the size of a resource element. More... | |
virtual | ~ResourceElement () |
Necessary virtual destructor. More... | |
Protected Member Functions | |
int | read (ImageLoader &imageLoader, std::uint32_t uiRsrcRva, std::uint32_t uiOffset, std::uint32_t sizeOfImage, ResourceDirectory *resDir) |
Reads the next resource node. More... | |
void | rebuild (OutputBuffer &, unsigned int uiOffset, unsigned int uiRva, const std::string &) const |
Writes the next resource node into the OutputBuffer. More... | |
virtual void | recalculate (unsigned int &uiCurrentOffset, unsigned int uiNewRva) override |
Recalculates the tree for different RVA. More... | |
Private Attributes | |
std::vector< ResourceChild > | children |
The node's children. More... | |
PELIB_IMAGE_RESOURCE_DIRECTORY | header |
The node's header. Equivalent to IMAGE_RESOURCE_DIRECTORY from the Win32 API. More... | |
Friends | |
class | ResourceChild |
class | ResourceDirectory |
template<typename T > | |
struct | fixNumberOfEntries |
Additional Inherited Members | |
![]() | |
unsigned int | uiElementRva |
Stores RVA of the resource element in the file. More... | |
ResourceNodes represent the nodes in the resource tree.
PeLib::ResourceNode::ResourceNode | ( | ) |
Returns the size of a resource node.
Constructor
|
overridevirtual |
Destructor.
ResourceChild * PeLib::ResourceNode::addChild | ( | ) |
Adds another child to node.
Adds another child to the current node.
std::uint32_t PeLib::ResourceNode::getCharacteristics | ( | ) | const |
Returns the node's Characteristics value.
Returns the Characteristics value of the node.
ResourceChild * PeLib::ResourceNode::getChild | ( | std::size_t | uiIndex | ) |
Returns a node's child.
Returns a node's child.
uiIndex | Index of the child. |
const ResourceChild * PeLib::ResourceNode::getChild | ( | std::size_t | uiIndex | ) | const |
Returns a node's child.
uiIndex | Index of the child. |
std::string PeLib::ResourceNode::getChildName | ( | unsigned int | uiIndex | ) | const |
Returns the name of one of the node's children.
Returns the name of a child.
uiIndex | Index of the child. |
std::uint16_t PeLib::ResourceNode::getMajorVersion | ( | ) | const |
Returns the node's MajorVersion value.
Returns the MajorVersion value of the node.
std::uint16_t PeLib::ResourceNode::getMinorVersion | ( | ) | const |
Returns the node's MinorVersion value.
Returns the MinorVersion value of the node.
unsigned int PeLib::ResourceNode::getNumberOfChildren | ( | ) | const |
Returns the node's number of children.
Returns the number of children of the current node. Note that this number is the number of defined children, not the value from the header.
std::uint16_t PeLib::ResourceNode::getNumberOfIdEntries | ( | ) | const |
Returns the node's NumberOfIdEntries value.
Returns the NumberOfIdEntries value of the node.
std::uint16_t PeLib::ResourceNode::getNumberOfNamedEntries | ( | ) | const |
Returns the node's NumberOfNamedEntries value.
Returns the NumberOfNamedEntries value of the node.
std::uint32_t PeLib::ResourceNode::getOffsetToChildData | ( | unsigned int | uiIndex | ) | const |
Returns the OffsetToData value of one of the node's children.
Returns the OffsetToData value of a child.
uiIndex | Index of the child. |
std::uint32_t PeLib::ResourceNode::getOffsetToChildName | ( | unsigned int | uiIndex | ) | const |
Returns the Name value of one of the node's children.
Returns the Name value of a child.
uiIndex | Index of the child. |
std::uint32_t PeLib::ResourceNode::getTimeDateStamp | ( | ) | const |
Returns the node's TimeDateStamp value.
Returns the TimeDateStamp value of the node.
|
virtual |
Indicates if the resource element is a leaf or a node.
Checks if a ResourceElement is a leaf or not.
Implements PeLib::ResourceElement.
|
virtual |
Corrects erroneous values in the ResourceNode.
Sorts the node's children and corrects the node's header.
Implements PeLib::ResourceElement.
|
protectedvirtual |
Reads the next resource node.
Reads the next resource node from the input file.
imageLoader | An image loaded into the ImageLoader parser |
uiRsrcRva | RVA of the beginning of the resource directory. |
uiOffset | Offset of the resource node that's to be read. |
sizeOfImage | Size of the image. |
resDir | Resource directory. |
Implements PeLib::ResourceElement.
|
protectedvirtual |
Writes the next resource node into the OutputBuffer.
Rebuilds the current resource node.
obBuffer | OutputBuffer where the rebuilt resource node is stored. |
uiOffset | Offset of the resource node inside the resource directory. |
uiRva | RVA of the resource directory. |
pad | Used for debugging. |
Implements PeLib::ResourceElement.
|
overrideprotectedvirtual |
Recalculates the tree for different RVA.
Recalculates the current node and child nodes for directory with new RVA.
uiCurrentOffset | The current offset of the node in the new directory. |
uiNewRva | The RVA of the new directory. |
Implements PeLib::ResourceElement.
void PeLib::ResourceNode::removeChild | ( | unsigned int | uiIndex | ) |
Removes a node's child.
Removes a child from the current node.
uiIndex | Index of the child. |
void PeLib::ResourceNode::setCharacteristics | ( | std::uint32_t | value | ) |
Sets the node's Characteristics value.
Sets the Characteristics value of the node.
value | New Characteristics value of the node. |
void PeLib::ResourceNode::setChildName | ( | unsigned int | uiIndex, |
const std::string & | strNewName | ||
) |
Sets the name of one of the node's children.
Sets the name of a child.
uiIndex | Index of the child. |
strNewName | New name of the resource. |
void PeLib::ResourceNode::setMajorVersion | ( | std::uint16_t | value | ) |
Sets the node's MajorVersion value.
Sets the MajorVersion value of the node.
value | New MajorVersion value of the node. |
void PeLib::ResourceNode::setMinorVersion | ( | std::uint16_t | value | ) |
Sets the node's MinorVersion value.
Sets the MinorVersion value of the node.
value | New MinorVersion value of the node. |
void PeLib::ResourceNode::setNumberOfIdEntries | ( | std::uint16_t | value | ) |
Sets the node's NumberOfIdEntries value.
Sets the NumberOfIdEntries value of the node.
value | New NumberOfIdEntries value of the node. |
void PeLib::ResourceNode::setNumberOfNamedEntries | ( | std::uint16_t | value | ) |
Sets the node's NumberOfNamedEntries value.
Sets the NumberOfNamedEntries value of the node.
value | New NumberOfNamedEntries value of the node. |
void PeLib::ResourceNode::setOffsetToChildData | ( | unsigned int | uiIndex, |
std::uint32_t | dwNewOffset | ||
) |
Sets the OffsetToData value of one of the node's children.
Sets the OffsetToData value of a child.
uiIndex | Index of the child. |
dwNewOffset | New OffsetToData value of the resource. |
void PeLib::ResourceNode::setOffsetToChildName | ( | unsigned int | uiIndex, |
std::uint32_t | dwNewOffset | ||
) |
Sets the Name value of one of the node's children.
Sets the Name value of a child.
uiIndex | Index of the child. |
dwNewOffset | New Name value of the resource. |
void PeLib::ResourceNode::setTimeDateStamp | ( | std::uint32_t | value | ) |
Sets the node's TimeDateStamp value.
Sets the TimeDateStamp value of the node.
value | New TimeDateStamp value of the node. |
|
friend |
|
friend |
|
friend |
|
private |
The node's children.
|
private |
The node's header. Equivalent to IMAGE_RESOURCE_DIRECTORY from the Win32 API.