LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
ResourceDialog.hpp
Go to the documentation of this file.
1
2/* Copyright 2017 - 2024 R. Thomas
3 * Copyright 2017 - 2024 Quarkslab
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef LIEF_PE_RESOURCE_DIALOG_H
18#define LIEF_PE_RESOURCE_DIALOG_H
19#include <ostream>
20#include <sstream>
21#include <set>
22
23#include "LIEF/visibility.h"
24#include "LIEF/Object.hpp"
25#include "LIEF/iterators.hpp"
26
27#include "LIEF/PE/enums.hpp"
29
30namespace LIEF {
31namespace PE {
33struct ResourcesParser;
34
35namespace details {
36struct pe_dialog_template_ext;
37struct pe_dialog_template;
38}
39class LIEF_API ResourceDialog : public Object {
48
49 friend class ResourcesManager;
50 friend struct ResourcesParser;
51
52 public:
53 using items_t = std::vector<ResourceDialogItem>;
54 using it_items = ref_iterator<items_t&>;
55 using it_const_items = const_ref_iterator<const items_t&>;
56
58 ResourceDialog(const details::pe_dialog_template_ext& header);
59 ResourceDialog(const details::pe_dialog_template& header);
60
61 ResourceDialog(const ResourceDialog&);
62 ResourceDialog& operator=(const ResourceDialog&);
63
64 ~ResourceDialog() override;
65 bool is_extended() const;
68 uint32_t extended_style() const;
71 std::set<EXTENDED_WINDOW_STYLES> extended_style_list() const;
75
76 bool has_extended_style(EXTENDED_WINDOW_STYLES style) const;
77 uint32_t style() const;
81 std::set<WINDOW_STYLES> style_list() const;
85 bool has_style(WINDOW_STYLES style) const;
86 std::set<DIALOG_BOX_STYLES> dialogbox_style_list() const;
90 bool has_dialogbox_style(DIALOG_BOX_STYLES style) const;
91 int16_t x() const;
94 int16_t y() const;
97 int16_t cx() const;
100 int16_t cy() const;
103 it_const_items items() const;
106 uint32_t lang() const;
109 uint32_t sub_lang() const;
112
113 void lang(uint32_t lang);
114 void sub_lang(uint32_t sub_lang);
115
116
117 // Extended API
118 // ============
119 uint16_t version() const;
122 uint16_t signature() const;
130 uint32_t help_id() const;
133 uint16_t weight() const;
136 uint16_t point_size() const;
139 bool is_italic() const;
142 uint8_t charset() const;
145 const std::u16string& title() const;
148 const std::u16string& typeface() const;
151
152 void accept(Visitor& visitor) const override;
153
154
155 LIEF_API friend std::ostream& operator<<(std::ostream& os, const ResourceDialog& dialog);
156
157 private:
158 uint16_t version_;
159 uint16_t signature_;
160 uint32_t help_id_;
161 uint32_t ext_style_;
162 uint32_t style_;
163
164 int16_t x_;
165 int16_t y_;
166 int16_t cx_;
167 int16_t cy_;
168
169 std::u16string menu_;
170 std::u16string window_class_;
171 std::u16string title_;
172
173 uint16_t point_size_;
174 uint16_t weight_;
175 bool italic_;
176 uint8_t charset_;
177 std::u16string typeface_;
178
179 items_t items_;
180
181 uint32_t lang_;
182 uint32_t sublang_;
183};
184
185
186}
187}
188
189
190#endif
Representation of a dialog box.
Definition ResourceDialog.hpp:47
bool has_extended_style(EXTENDED_WINDOW_STYLES style) const
bool has_style(WINDOW_STYLES style) const
void accept(Visitor &visitor) const override
ResourceDialog(const ResourceDialog &)
bool has_dialogbox_style(DIALOG_BOX_STYLES style) const
bool is_italic() const
Indicates whether the font is italic. If this value is true, the font is italic.
ResourceDialog & operator=(const ResourceDialog &)
uint32_t sub_lang() const
RESOURCE_SUBLANGS associated with the Dialog.
uint32_t help_id() const
The help context identifier for the dialog box window.
friend std::ostream & operator<<(std::ostream &os, const ResourceDialog &dialog)
void sub_lang(uint32_t sub_lang)
const std::u16string & typeface() const
The name of the typeface for the font.
uint16_t signature() const
Indicates whether a template is an extended dialog box template:
int16_t cx() const
The width, in dialog box units, of the dialog box.
uint32_t style() const
The style of the dialog box. This member can be a combination of LIEF::PE::WINDOW_STYLES values and L...
ResourceDialog(const details::pe_dialog_template_ext &header)
bool is_extended() const
true if the dialog is an extended one
uint32_t extended_style() const
The extended windows styles.
it_const_items items() const
Iterator on the controls (ResourceDialogItem) that defines the Dialog (Button, Label....
uint16_t version() const
The version number of the extended dialog box template. This member must be set to 1.
ResourceDialog(const details::pe_dialog_template &header)
int16_t x() const
The x-coordinate, in dialog box units, of the upper-left corner of the dialog box.
uint16_t point_size() const
The point size of the font to use for the text in the dialog box and its controls.
int16_t y() const
The y-coordinate, in dialog box units, of the upper-left corner of the dialog box.
std::set< DIALOG_BOX_STYLES > dialogbox_style_list() const
Return list of LIEF::PE::DIALOG_BOX_STYLES associated with the ResourceDialog::style value.
int16_t cy() const
The height, in dialog box units, of the dialog box.
void lang(uint32_t lang)
uint16_t weight() const
The weight of the font.
std::set< EXTENDED_WINDOW_STYLES > extended_style_list() const
Return list of LIEF::PE::EXTENDED_WINDOW_STYLES associated with the ResourceDialog::extended_style va...
uint8_t charset() const
The character to be used.
const std::u16string & title() const
The title of the dialog box.
std::set< WINDOW_STYLES > style_list() const
Return list of LIEF::PE::WINDOW_STYLES associated with the ResourceDialog::style value.
uint32_t lang() const
RESOURCE_LANGS associated with the Dialog.
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
Definition CodeIntegrity.hpp:26
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41