LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Class which represents a Node in the resource tree. More...
#include <ResourceNode.hpp>
Public Types | |
enum class | TYPE { UNKNOWN = 0 , DATA , DIRECTORY } |
Enum that identifies the type of a node in the resource tree. More... | |
using | childs_t = std::vector<std::unique_ptr<ResourceNode>> |
using | it_childs = ref_iterator<childs_t&, ResourceNode*> |
using | it_const_childs = const_ref_iterator<const childs_t&, ResourceNode*> |
![]() | |
template<class T > | |
using | output_t = add_pointer_t<decay_t<T>> |
template<class T > | |
using | output_const_t = add_pointer_t<add_const_t<decay_t<T>>> |
Public Member Functions | |
ResourceNode (const ResourceNode &other) | |
ResourceNode & | operator= (const ResourceNode &other) |
ResourceNode (ResourceNode &&other)=default | |
ResourceNode & | operator= (ResourceNode &&other)=default |
void | swap (ResourceNode &other) |
~ResourceNode () override | |
virtual std::unique_ptr< ResourceNode > | clone () const =0 |
uint32_t | id () const |
Integer that identifies the Type, Name, or Language ID of the entry depending on its depth in the tree. | |
const std::u16string & | name () const |
Name of the entry (if any) | |
std::string | utf8_name () const |
UTF-8 representation of the name() | |
it_childs | childs () |
Iterator on node's children. | |
it_const_childs | childs () const |
bool | has_name () const |
True if the entry uses a name as ID | |
uint32_t | depth () const |
Current depth of the Node in the resource tree. | |
bool | is_directory () const |
True if the current entry is a ResourceDirectory. | |
bool | is_data () const |
True if the current entry is a ResourceData. | |
void | id (uint32_t id) |
void | name (const std::string &name) |
void | name (std::u16string name) |
ResourceNode & | add_child (std::unique_ptr< ResourceNode > child) |
Add a new child to the current node, taking the ownership of the provided unique_ptr | |
ResourceNode & | add_child (const ResourceNode &child) |
Add a new child to the current node. | |
void | delete_child (uint32_t id) |
Delete the node with the given id | |
void | delete_child (const ResourceNode &node) |
Delete the given node from the node's children. | |
void | accept (Visitor &visitor) const override |
template<class T > | |
const T * | cast () const |
template<class T > | |
T * | cast () |
std::string | to_string () const |
void | push_child (std::unique_ptr< ResourceNode > node) |
![]() | |
Object () | |
Object (const Object &other) | |
Object & | operator= (const Object &other) |
template<class T > | |
output_t< T > | as () |
template<class T > | |
output_const_t< T > | as () const |
virtual bool | operator== (const Object &other) const |
virtual bool | operator!= (const Object &other) const |
virtual | ~Object () |
Static Public Member Functions | |
static std::unique_ptr< ResourceNode > | parse (BinaryStream &stream, uint64_t rva) |
Parse the resource tree from the provided BinaryStream stream and with the original RVA provided in the second parameter. | |
static std::unique_ptr< ResourceNode > | parse (const uint8_t *buffer, size_t size, uint64_t rva) |
Parse the resource tree from the provided buffer referenced by a pointer and the size. The second parameter is the RVA where the resource is (or was) located. | |
static std::unique_ptr< ResourceNode > | parse (const std::vector< uint8_t > &buffer, uint64_t rva) |
See doc from other parse functions. | |
static std::unique_ptr< ResourceNode > | parse (span< const uint8_t > buffer, uint64_t rva) |
See doc from other parse functions. | |
static std::unique_ptr< ResourceNode > | parse (BinaryStream &stream, const Binary &bin) |
Class which represents a Node in the resource tree.
using LIEF::PE::ResourceNode::childs_t = std::vector<std::unique_ptr<ResourceNode>> |
using LIEF::PE::ResourceNode::it_const_childs = const_ref_iterator<const childs_t&, ResourceNode*> |
|
strong |
LIEF::PE::ResourceNode::ResourceNode | ( | const ResourceNode & | other | ) |
|
default |
|
override |
|
overridevirtual |
Implements LIEF::Object.
|
inline |
Add a new child to the current node.
References clone().
ResourceNode & LIEF::PE::ResourceNode::add_child | ( | std::unique_ptr< ResourceNode > | child | ) |
Add a new child to the current node, taking the ownership of the provided unique_ptr
References LIEF::PE::T.
References LIEF::PE::T.
|
inline |
Iterator on node's children.
|
inline |
|
pure virtual |
Implemented in LIEF::PE::ResourceData, and LIEF::PE::ResourceDirectory.
Referenced by add_child().
void LIEF::PE::ResourceNode::delete_child | ( | const ResourceNode & | node | ) |
Delete the given node from the node's children.
void LIEF::PE::ResourceNode::delete_child | ( | uint32_t | id | ) |
Delete the node with the given id
|
inline |
Current depth of the Node in the resource tree.
|
inline |
True
if the entry uses a name as ID
|
inline |
Integer that identifies the Type, Name, or Language ID of the entry depending on its depth in the tree.
|
inline |
|
inline |
True
if the current entry is a ResourceData.
It can be safely casted with:
Referenced by LIEF::PE::ResourceData::classof().
|
inline |
True
if the current entry is a ResourceDirectory.
It can be safely casted with:
Referenced by LIEF::PE::ResourceDirectory::classof().
|
inline |
Name of the entry (if any)
void LIEF::PE::ResourceNode::name | ( | const std::string & | name | ) |
|
inline |
ResourceNode & LIEF::PE::ResourceNode::operator= | ( | const ResourceNode & | other | ) |
|
default |
|
static |
|
static |
Parse the resource tree from the provided BinaryStream stream and with the original RVA provided in the second parameter.
The RVA value should be come from the DataDirectory::RVA associated with the resource tree.
|
inlinestatic |
See doc from other parse functions.
|
static |
Parse the resource tree from the provided buffer referenced by a pointer and the size. The second parameter is the RVA where the resource is (or was) located.
|
inlinestatic |
See doc from other parse functions.
|
inline |
void LIEF::PE::ResourceNode::swap | ( | ResourceNode & | other | ) |
|
inline |
std::string LIEF::PE::ResourceNode::utf8_name | ( | ) | const |
UTF-8 representation of the name()