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

The Resource Manager provides an enhanced API to manipulate the resource tree. More...

#include <ResourcesManager.hpp>

Inheritance diagram for LIEF::PE::ResourcesManager:
Collaboration diagram for LIEF::PE::ResourcesManager:

Public Types

enum class  TYPE {
  CURSOR = 1 , BITMAP = 2 , ICON = 3 , MENU = 4 ,
  DIALOG = 5 , STRING = 6 , FONTDIR = 7 , FONT = 8 ,
  ACCELERATOR = 9 , RCDATA = 10 , MESSAGETABLE = 11 , GROUP_CURSOR = 12 ,
  GROUP_ICON = 14 , VERSION = 16 , DLGINCLUDE = 17 , PLUGPLAY = 19 ,
  VXD = 20 , ANICURSOR = 21 , ANIICON = 22 , HTML = 23 ,
  MANIFEST = 24
}
 The different types of resources Ref: From https://docs.microsoft.com/en-us/windows/win32/menurc/resource-types. More...
 
using dialogs_t = std::vector<ResourceDialog>
 
using it_const_dialogs = const_ref_iterator<dialogs_t>
 
using icons_t = std::vector<ResourceIcon>
 
using it_const_icons = const_ref_iterator<icons_t>
 
using strings_table_t = std::vector<ResourceStringTable>
 
using it_const_strings_table = const_ref_iterator<strings_table_t>
 
using accelerators_t = std::vector<ResourceAccelerator>
 
using it_const_accelerators = const_ref_iterator<accelerators_t>
 
- 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>>>
 

Public Member Functions

 ResourcesManager ()=delete
 
 ResourcesManager (ResourceNode &rsrc)
 
 ResourcesManager (const ResourcesManager &)=default
 
ResourcesManageroperator= (const ResourcesManager &)=default
 
 ResourcesManager (ResourcesManager &&)=default
 
ResourcesManageroperator= (ResourcesManager &&)=default
 
 ~ResourcesManager () override=default
 
ResourceNodeget_node_type (TYPE type)
 Return the ResourceNode associated with the given KIND or a nullptr if not found;.
 
const ResourceNodeget_node_type (TYPE type) const
 
std::vector< TYPEget_types () const
 List of TYPE present in the resources.
 
bool has_type (TYPE type) const
 true if the resource has the given LIEF::PE::KIND
 
bool has_manifest () const
 true if resources contain the Manifest element
 
std::string manifest () const
 Return the manifest as a std::string or an empty string if not found or corrupted.
 
void manifest (const std::string &manifest)
 Update the manifest with the given string.
 
bool has_version () const
 true if resources contain a LIEF::PE::ResourceVersion
 
result< ResourceVersionversion () const
 Return the ResourceVersion if any.
 
bool has_icons () const
 true if resources contain a LIEF::PE::ResourceIcon
 
it_const_icons icons () const
 Return the list of the icons present in the resources.
 
void add_icon (const ResourceIcon &icon)
 Add an icon to the resources.
 
void change_icon (const ResourceIcon &original, const ResourceIcon &newone)
 
bool has_dialogs () const
 true if resources contain dialogs
 
it_const_dialogs dialogs () const
 Return the list of the dialogs present in the resource.
 
bool has_string_table () const
 true if the resources contain a LIEF::PE::ResourceStringTable
 
it_const_strings_table string_table () const
 Return the list of the string table in the resource.
 
bool has_html () const
 true if the resources contain html
 
std::vector< std::string > html () const
 Return the list of the html resources.
 
bool has_accelerator () const
 true if the resources contain LIEF::PE::ResourceAccelerator
 
it_const_accelerators accelerator () const
 Return the list of the accelerator in the resource.
 
std::string print (uint32_t depth=0) const
 Print the resource tree to the given depth.
 
void accept (Visitor &visitor) const override
 
- Public Member Functions inherited from LIEF::Object
 Object ()
 
 Object (const Object &other)
 
Objectoperator= (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 constexpr uint32_t lang_from_id (size_t id)
 
static constexpr uint32_t sublang_from_id (size_t id)
 

Detailed Description

The Resource Manager provides an enhanced API to manipulate the resource tree.

Member Typedef Documentation

◆ accelerators_t

◆ dialogs_t

◆ icons_t

◆ it_const_accelerators

◆ it_const_dialogs

◆ it_const_icons

◆ it_const_strings_table

◆ strings_table_t

Member Enumeration Documentation

◆ TYPE

The different types of resources Ref: From https://docs.microsoft.com/en-us/windows/win32/menurc/resource-types.

Enumerator
CURSOR 
BITMAP 
ICON 
MENU 
DIALOG 
STRING 
FONTDIR 
FONT 
ACCELERATOR 
RCDATA 
MESSAGETABLE 
GROUP_CURSOR 
GROUP_ICON 
VERSION 
DLGINCLUDE 
PLUGPLAY 
VXD 
ANICURSOR 
ANIICON 
HTML 
MANIFEST 

Constructor & Destructor Documentation

◆ ResourcesManager() [1/4]

LIEF::PE::ResourcesManager::ResourcesManager ( )
delete

◆ ResourcesManager() [2/4]

LIEF::PE::ResourcesManager::ResourcesManager ( ResourceNode & rsrc)
inline

◆ ResourcesManager() [3/4]

LIEF::PE::ResourcesManager::ResourcesManager ( const ResourcesManager & )
default

◆ ResourcesManager() [4/4]

LIEF::PE::ResourcesManager::ResourcesManager ( ResourcesManager && )
default

◆ ~ResourcesManager()

LIEF::PE::ResourcesManager::~ResourcesManager ( )
overridedefault

Member Function Documentation

◆ accelerator()

it_const_accelerators LIEF::PE::ResourcesManager::accelerator ( ) const

Return the list of the accelerator in the resource.

◆ accept()

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

Implements LIEF::Object.

◆ add_icon()

void LIEF::PE::ResourcesManager::add_icon ( const ResourceIcon & icon)

Add an icon to the resources.

◆ change_icon()

void LIEF::PE::ResourcesManager::change_icon ( const ResourceIcon & original,
const ResourceIcon & newone )

◆ dialogs()

it_const_dialogs LIEF::PE::ResourcesManager::dialogs ( ) const

Return the list of the dialogs present in the resource.

◆ get_node_type() [1/2]

ResourceNode * LIEF::PE::ResourcesManager::get_node_type ( TYPE type)

Return the ResourceNode associated with the given KIND or a nullptr if not found;.

◆ get_node_type() [2/2]

const ResourceNode * LIEF::PE::ResourcesManager::get_node_type ( TYPE type) const

◆ get_types()

std::vector< TYPE > LIEF::PE::ResourcesManager::get_types ( ) const

List of TYPE present in the resources.

◆ has_accelerator()

bool LIEF::PE::ResourcesManager::has_accelerator ( ) const
inline

true if the resources contain LIEF::PE::ResourceAccelerator

◆ has_dialogs()

bool LIEF::PE::ResourcesManager::has_dialogs ( ) const
inline

true if resources contain dialogs

◆ has_html()

bool LIEF::PE::ResourcesManager::has_html ( ) const
inline

true if the resources contain html

◆ has_icons()

bool LIEF::PE::ResourcesManager::has_icons ( ) const
inline

true if resources contain a LIEF::PE::ResourceIcon

◆ has_manifest()

bool LIEF::PE::ResourcesManager::has_manifest ( ) const
inline

true if resources contain the Manifest element

◆ has_string_table()

bool LIEF::PE::ResourcesManager::has_string_table ( ) const
inline

true if the resources contain a LIEF::PE::ResourceStringTable

◆ has_type()

bool LIEF::PE::ResourcesManager::has_type ( TYPE type) const
inline

true if the resource has the given LIEF::PE::KIND

◆ has_version()

bool LIEF::PE::ResourcesManager::has_version ( ) const
inline

true if resources contain a LIEF::PE::ResourceVersion

◆ html()

std::vector< std::string > LIEF::PE::ResourcesManager::html ( ) const

Return the list of the html resources.

◆ icons()

it_const_icons LIEF::PE::ResourcesManager::icons ( ) const

Return the list of the icons present in the resources.

◆ lang_from_id()

static constexpr uint32_t LIEF::PE::ResourcesManager::lang_from_id ( size_t id)
inlinestaticconstexpr

◆ manifest() [1/2]

std::string LIEF::PE::ResourcesManager::manifest ( ) const

Return the manifest as a std::string or an empty string if not found or corrupted.

◆ manifest() [2/2]

void LIEF::PE::ResourcesManager::manifest ( const std::string & manifest)

Update the manifest with the given string.

◆ operator=() [1/2]

ResourcesManager & LIEF::PE::ResourcesManager::operator= ( const ResourcesManager & )
default

◆ operator=() [2/2]

ResourcesManager & LIEF::PE::ResourcesManager::operator= ( ResourcesManager && )
default

◆ print()

std::string LIEF::PE::ResourcesManager::print ( uint32_t depth = 0) const

Print the resource tree to the given depth.

◆ string_table()

it_const_strings_table LIEF::PE::ResourcesManager::string_table ( ) const

Return the list of the string table in the resource.

◆ sublang_from_id()

static constexpr uint32_t LIEF::PE::ResourcesManager::sublang_from_id ( size_t id)
inlinestaticconstexpr

◆ version()

result< ResourceVersion > LIEF::PE::ResourcesManager::version ( ) const

Return the ResourceVersion if any.


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