LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
LIEF::PE::ResourceData Class Reference

Class which represents a Data Node in the PE resources tree. More...

#include <ResourceData.hpp>

Inheritance diagram for LIEF::PE::ResourceData:
Collaboration diagram for LIEF::PE::ResourceData:

Public Member Functions

 ResourceData ()
 ResourceData (std::vector< uint8_t > content, uint32_t code_page=0)
 ResourceData (const std::string &str, uint32_t code_page=0)
 ResourceData (const ResourceData &other)=default
ResourceDataoperator= (const ResourceData &other)=default
void swap (ResourceData &other) noexcept
 ~ResourceData () override=default
std::unique_ptr< ResourceNodeclone () const override
uint32_t code_page () const
 Return the code page that is used to decode code point values within the resource data. Typically, the code page is the unicode code page.
span< const uint8_t > content () const
 Resource content.
span< uint8_t > content ()
uint32_t reserved () const
 Reserved value. Should be 0.
uint32_t offset () const
 Offset of the content within the resource.
void code_page (uint32_t code_page)
void content (std::vector< uint8_t > content)
void content (const std::string &string)
void content (const uint8_t *buffer, size_t size)
void reserved (uint32_t value)
void accept (Visitor &visitor) const override
Public Member Functions inherited from LIEF::PE::ResourceNode
 ResourceNode (const ResourceNode &other)
ResourceNodeoperator= (const ResourceNode &other)
 ResourceNode (ResourceNode &&other)=default
ResourceNodeoperator= (ResourceNode &&other)=default
void swap (ResourceNode &other)
 ~ResourceNode () override
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)
ResourceNodeadd_child (std::unique_ptr< ResourceNode > child)
 Add a new child to the current node, taking the ownership of the provided unique_ptr.
ResourceNodeadd_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 Tcast () const
template<class T>
Tcast ()
std::string to_string () const
void push_child (std::unique_ptr< ResourceNode > node)
Public Member Functions inherited from LIEF::Object
 Object ()
 Object (const Object &other)
Objectoperator= (const Object &other)
 Object (Object &&other) noexcept=default
Objectoperator= (Object &&other) noexcept=default
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 bool classof (const ResourceNode *node)
Static Public Member Functions inherited from LIEF::PE::ResourceNode
static std::unique_ptr< ResourceNodeparse (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< ResourceNodeparse (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< ResourceNodeparse (const std::vector< uint8_t > &buffer, uint64_t rva)
 See doc from other parse functions.
static std::unique_ptr< ResourceNodeparse (span< const uint8_t > buffer, uint64_t rva)
 See doc from other parse functions.
static std::unique_ptr< ResourceNodeparse (BinaryStream &stream, const Binary &bin)

Additional Inherited Members

Public Types inherited from LIEF::PE::ResourceNode
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*>
Public Types inherited from LIEF::Object
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>>>

Detailed Description

Class which represents a Data Node in the PE resources tree.

Constructor & Destructor Documentation

◆ ResourceData() [1/4]

LIEF::PE::ResourceData::ResourceData ( )
inline

◆ ResourceData() [2/4]

LIEF::PE::ResourceData::ResourceData ( std::vector< uint8_t > content,
uint32_t code_page = 0 )
inline

◆ ResourceData() [3/4]

LIEF::PE::ResourceData::ResourceData ( const std::string & str,
uint32_t code_page = 0 )
inline

◆ ResourceData() [4/4]

LIEF::PE::ResourceData::ResourceData ( const ResourceData & other)
default

References ResourceData().

◆ ~ResourceData()

LIEF::PE::ResourceData::~ResourceData ( )
overridedefault

Member Function Documentation

◆ accept()

void LIEF::PE::ResourceData::accept ( Visitor & visitor) const
overridevirtual

Implements LIEF::Object.

◆ classof()

bool LIEF::PE::ResourceData::classof ( const ResourceNode * node)
inlinestatic

◆ clone()

std::unique_ptr< ResourceNode > LIEF::PE::ResourceData::clone ( ) const
inlineoverridevirtual

Implements LIEF::PE::ResourceNode.

References ResourceData().

◆ code_page() [1/2]

uint32_t LIEF::PE::ResourceData::code_page ( ) const
inline

Return the code page that is used to decode code point values within the resource data. Typically, the code page is the unicode code page.

Referenced by code_page(), ResourceData(), and ResourceData().

◆ code_page() [2/2]

void LIEF::PE::ResourceData::code_page ( uint32_t code_page)
inline

References code_page().

◆ content() [1/5]

span< uint8_t > LIEF::PE::ResourceData::content ( )
inline

◆ content() [2/5]

span< const uint8_t > LIEF::PE::ResourceData::content ( ) const
inline

Resource content.

Referenced by content(), and ResourceData().

◆ content() [3/5]

void LIEF::PE::ResourceData::content ( const std::string & string)
inline

◆ content() [4/5]

void LIEF::PE::ResourceData::content ( const uint8_t * buffer,
size_t size )
inline

◆ content() [5/5]

void LIEF::PE::ResourceData::content ( std::vector< uint8_t > content)
inline

References content().

◆ offset()

uint32_t LIEF::PE::ResourceData::offset ( ) const
inline

Offset of the content within the resource.

Warning
This value may change when rebuilding resource table

◆ operator=()

ResourceData & LIEF::PE::ResourceData::operator= ( const ResourceData & other)
default

References ResourceData().

◆ reserved() [1/2]

uint32_t LIEF::PE::ResourceData::reserved ( ) const
inline

Reserved value. Should be 0.

◆ reserved() [2/2]

void LIEF::PE::ResourceData::reserved ( uint32_t value)
inline

◆ swap()

void LIEF::PE::ResourceData::swap ( ResourceData & other)
noexcept

References ResourceData().


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