LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
17#ifndef LIEF_PE_RESOURCES_MANAGER_H
18#define LIEF_PE_RESOURCES_MANAGER_H
76 using dialogs_t = std::vector<ResourceDialog>;
77 using it_const_dialogs = const_ref_iterator<dialogs_t>;
79 using icons_t = std::vector<ResourceIcon>;
80 using it_const_icons = const_ref_iterator<icons_t>;
82 using strings_table_t = std::vector<ResourceStringTable>;
83 using it_const_strings_table = const_ref_iterator<strings_table_t>;
85 using accelerators_t = std::vector<ResourceAccelerator>;
86 using it_const_accelerators = const_ref_iterator<accelerators_t>;
94 ResourcesManager&
operator=(
const ResourcesManager&) =
default;
97 ResourcesManager&
operator=(ResourcesManager&&) =
default;
111 return get_node_type(type) !=
nullptr;
116 return get_node_type(TYPE::MANIFEST) !=
nullptr;
122 void manifest(
const std::string& manifest);
128 return get_node_type(TYPE::VERSION) !=
nullptr;
130 result<ResourceVersion>
version()
const;
136 return get_node_type(TYPE::ICON) !=
nullptr &&
137 get_node_type(TYPE::GROUP_ICON) !=
nullptr;
139 it_const_icons
icons()
const;
142 void add_icon(
const ResourceIcon& icon);
146 void change_icon(
const ResourceIcon& original,
const ResourceIcon& newone);
150 return get_node_type(TYPE::DIALOG) !=
nullptr;
152 it_const_dialogs
dialogs()
const;
158 return get_node_type(TYPE::STRING) !=
nullptr;
166 return get_node_type(TYPE::HTML) !=
nullptr;
168 std::vector<std::string>
html()
const;
174 return get_node_type(TYPE::ACCELERATOR) !=
nullptr;
179 std::string
print(uint32_t depth = 0)
const;
183 void accept(Visitor& visitor)
const override;
188 void print_tree(
const ResourceNode& node, std::ostringstream& stream,
189 uint32_t current_depth, uint32_t max_depth)
const;
190 ResourceNode* resources_ =
nullptr;
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:36
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
void add_icon(const ResourceIcon &icon)
Add an icon to the resources.
bool has_version() const
true if resources contain a LIEF::PE::ResourceVersion
Definition ResourcesManager.hpp:127
bool has_html() const
true if the resources contain html
Definition ResourcesManager.hpp:165
it_const_accelerators accelerator() const
Return the list of the accelerator in the resource.
it_const_dialogs dialogs() const
Return the list of the dialogs present in the resource.
ResourceNode * get_node_type(TYPE type)
Return the ResourceNode associated with the given KIND or a nullptr if not found;.
bool has_type(TYPE type) const
true if the resource has the given LIEF::PE::KIND
Definition ResourcesManager.hpp:110
~ResourcesManager() override=default
result< ResourceVersion > version() const
Return the ResourceVersion if any.
bool has_icons() const
true if resources contain a LIEF::PE::ResourceIcon
Definition ResourcesManager.hpp:135
bool has_manifest() const
true if resources contain the Manifest element
Definition ResourcesManager.hpp:115
std::string print(uint32_t depth=0) const
Print the resource tree to the given depth.
static constexpr uint32_t lang_from_id(size_t id)
Definition ResourcesManager.hpp:67
void change_icon(const ResourceIcon &original, const ResourceIcon &newone)
ResourcesManager(ResourceNode &rsrc)
Definition ResourcesManager.hpp:89
std::vector< TYPE > get_types() const
List of TYPE present in the resources.
it_const_icons icons() const
Return the list of the icons present in the resources.
static constexpr uint32_t sublang_from_id(size_t id)
Definition ResourcesManager.hpp:71
TYPE
The different types of resources Ref: From https://docs.microsoft.com/en-us/windows/win32/menurc/reso...
Definition ResourcesManager.hpp:43
it_const_strings_table string_table() const
Return the list of the string table in the resource.
bool has_string_table() const
true if the resources contain a LIEF::PE::ResourceStringTable
Definition ResourcesManager.hpp:157
std::string manifest() const
Return the manifest as a std::string or an empty string if not found or corrupted.
ResourcesManager(const ResourcesManager &)=default
ResourcesManager & operator=(const ResourcesManager &)=default
bool has_accelerator() const
true if the resources contain LIEF::PE::ResourceAccelerator
Definition ResourcesManager.hpp:173
friend std::ostream & operator<<(std::ostream &os, const ResourcesManager &m)
ResourcesManager & operator=(ResourcesManager &&)=default
bool has_dialogs() const
true if resources contain dialogs
Definition ResourcesManager.hpp:149
const ResourceNode * get_node_type(TYPE type) const
void accept(Visitor &visitor) const override
ResourcesManager()=delete
std::vector< std::string > html() const
Return the list of the html resources.
ResourcesManager(ResourcesManager &&)=default
void manifest(const std::string &manifest)
Update the manifest with the given string.
Definition VectorStream.hpp:29
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
const char * to_string(DataDirectory::TYPES e)
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41