LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
ResourceVersion.hpp
Go to the documentation of this file.
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
39 friend class ResourcesManager;
40 friend struct ResourcesParser;
41
42 public:
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
69
76
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);
91
92 void string_file_info(const ResourceStringFileInfo& string_file_info);
94
95 void var_file_info(const ResourceVarFileInfo& 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
void key(const std::string &key)
ResourceVersion(const ResourceVersion &)
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 ...
void type(uint16_t type)
const ResourceStringFileInfo * string_file_info() const
Object that describes various information about the application's version. The underlying structure i...
ResourceFixedFileInfo * fixed_file_info()
void key(std::u16string key)
Definition ResourceVersion.hpp:84
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
ResourceVarFileInfo * var_file_info()
ResourceStringFileInfo * string_file_info()
void string_file_info(const ResourceStringFileInfo &string_file_info)
friend std::ostream & operator<<(std::ostream &os, const ResourceVersion &version)
uint16_t type() const
The type of data in the version resource.
void var_file_info(const ResourceVarFileInfo &var_file_info)
ResourceVersion & operator=(const ResourceVersion &)
bool has_var_file_info() const
true if the version contains a ResourceVarFileInfo
void fixed_file_info(const ResourceFixedFileInfo &fixed_file_info)
const std::u16string & key() const
Signature of the structure: Must be the unicode string "VS_VERSION_INFO".
void accept(Visitor &visitor) const override
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
Definition Visitor.hpp:224
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41