LIEF: Library to Instrument Executable Formats Version 0.16.0
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 {
31
33struct ResourcesParser;
34class LIEF_API ResourceVersion : public Object {
39 friend class ResourcesManager;
40 friend struct ResourcesParser;
41
42 public:
43 ResourceVersion(const ResourceVersion&);
44 ResourceVersion& operator=(const ResourceVersion&);
45 ~ResourceVersion() override;
46 uint16_t type() const;
51 const std::u16string& key() const;
55 bool has_fixed_file_info() const;
58 bool has_string_file_info() const;
61 bool has_var_file_info() const;
64 const ResourceFixedFileInfo* fixed_file_info() const;
68 ResourceFixedFileInfo* fixed_file_info();
69 const ResourceStringFileInfo* string_file_info() const;
75 ResourceStringFileInfo* string_file_info();
76 const ResourceVarFileInfo* var_file_info() const;
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);
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:
104 ResourceVersion();
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
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
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