LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
ResourceVersion.hpp
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_RESOURCE_VERSION_H
17#define LIEF_PE_RESOURCE_VERSION_H
18#include <ostream>
19#include <sstream>
20#include <memory>
21
22#include "LIEF/visibility.h"
23
24#include "LIEF/Object.hpp"
25
26namespace LIEF {
27namespace PE {
28class ResourceFixedFileInfo;
29class ResourceStringFileInfo;
30class ResourceVarFileInfo;
31
32class ResourcesManager;
33struct ResourcesParser;
34
38class LIEF_API ResourceVersion : public Object {
39 friend class ResourcesManager;
40 friend struct ResourcesParser;
41
42 public:
44 ResourceVersion& operator=(const ResourceVersion&);
45 ~ResourceVersion() override;
46
50 uint16_t type() const;
51
54 const std::u16string& key() const;
55
57 bool has_fixed_file_info() const;
58
61
63 bool has_var_file_info() const;
64
68 ResourceFixedFileInfo* fixed_file_info();
69
75 ResourceStringFileInfo* string_file_info();
76
80 ResourceVarFileInfo* var_file_info();
81
82 void type(uint16_t type);
83
84 void key(std::u16string key) {
85 key_ = std::move(key);
86 }
87 void key(const std::string& key);
88
89 void fixed_file_info(const ResourceFixedFileInfo& fixed_file_info);
90 void remove_fixed_file_info();
91
92 void string_file_info(const ResourceStringFileInfo& string_file_info);
93 void remove_string_file_info();
94
95 void var_file_info(const ResourceVarFileInfo& var_file_info);
96 void remove_var_file_info();
97
98 void accept(Visitor& visitor) const override;
99
100
101 LIEF_API friend std::ostream& operator<<(std::ostream& os, const ResourceVersion& version);
102
103 private:
105
106 uint16_t type_;
107 std::u16string key_;
108
109 // Optional structures
110 std::unique_ptr<ResourceFixedFileInfo> fixed_file_info_;
111 std::unique_ptr<ResourceStringFileInfo> string_file_info_;
112 std::unique_ptr<ResourceVarFileInfo> var_file_info_;
113};
114
115
116
117
118}
119}
120
121
122#endif
Definition Object.hpp:25
Representation of VS_FIXEDFILEINFO Structure.
Definition ResourceFixedFileInfo.hpp:36
Representation of the StringFileInfo structure.
Definition ResourceStringFileInfo.hpp:38
This object describes information about languages supported by the application.
Definition ResourceVarFileInfo.hpp:36
Representation of the data associated with the RT_VERSION entry.
Definition ResourceVersion.hpp:38
bool has_string_file_info() const
true if the version contains a ResourceStringFileInfo
const ResourceVarFileInfo * var_file_info() const
Object that describes information about languages supported by the application This structure is not ...
const ResourceStringFileInfo * string_file_info() const
Object that describes various information about the application's version. The underlying structure i...
const ResourceFixedFileInfo * fixed_file_info() const
Object that describes various information about the application's version. This is an optional inform...
bool has_fixed_file_info() const
true if the version contains a ResourceFixedFileInfo
uint16_t type() const
The type of data in the version resource.
bool has_var_file_info() const
true if the version contains a ResourceVarFileInfo
const std::u16string & key() const
Signature of the structure: Must be the unicode string "VS_VERSION_INFO".
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
Definition Visitor.hpp:219
LIEF namespace.
Definition Abstract/Binary.hpp:32