17#ifndef LIEF_PE_RESOURCES_MANAGER_H
18#define LIEF_PE_RESOURCES_MANAGER_H
79 using icons_t = std::vector<ResourceIcon>;
111 return get_node_type(type) !=
nullptr;
116 return get_node_type(TYPE::MANIFEST) !=
nullptr;
128 return get_node_type(TYPE::VERSION) !=
nullptr;
136 return get_node_type(TYPE::ICON) !=
nullptr &&
137 get_node_type(TYPE::GROUP_ICON) !=
nullptr;
150 return get_node_type(TYPE::DIALOG) !=
nullptr;
158 return get_node_type(TYPE::STRING) !=
nullptr;
166 return get_node_type(TYPE::HTML) !=
nullptr;
170 std::vector<std::string>
html()
const;
174 return get_node_type(TYPE::ACCELERATOR) !=
nullptr;
181 std::string
print(uint32_t depth = 0)
const;
188 void print_tree(
const ResourceNode& node, std::ostringstream& stream,
189 uint32_t current_depth, uint32_t max_depth)
const;
Definition ResourceIcon.hpp:39
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
std::vector< ResourceIcon > icons_t
Definition ResourcesManager.hpp:79
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
std::vector< ResourceDialog > dialogs_t
Definition ResourcesManager.hpp:76
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::vector< ResourceAccelerator > accelerators_t
Definition ResourcesManager.hpp:85
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
std::vector< ResourceStringTable > strings_table_t
Definition ResourcesManager.hpp:82
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 Visitor.hpp:224
Iterator which returns reference on container's values.
Definition iterators.hpp:48
const char * to_string(DataDirectory::TYPES e)
LIEF namespace.
Definition Abstract/Binary.hpp:32
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:74
#define LIEF_API
Definition visibility.h:41