LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
ExDllCharacteristics.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_PE_EX_DLL_CHARACTERISTICS_H
16#define LIEF_PE_EX_DLL_CHARACTERISTICS_H
17#include <vector>
18
20#include "LIEF/enums.hpp"
21#include "LIEF/visibility.h"
22
23
24namespace LIEF::PE {
25
29 public:
31 enum class CHARACTERISTICS : uint32_t {
32 CET_COMPAT = 0x01,
33 CET_COMPAT_STRICT_MODE = 0x02,
34 CET_SET_CONTEXT_IP_VALIDATION_RELAXED_MODE = 0x04,
35 CET_DYNAMIC_APIS_ALLOW_IN_PROC = 0x08,
36 CET_RESERVED_1 = 0x10,
37 CET_RESERVED_2 = 0x20,
38 FORWARD_CFI_COMPAT = 0x40,
39 HOTPATCH_COMPATIBLE = 0x80,
40 };
41
42 static std::unique_ptr<ExDllCharacteristics>
43 parse(const details::pe_debug& hdr, Section* section, span<uint8_t> payload);
44
45 ExDllCharacteristics(const details::pe_debug& debug, Section* sec,
46 uint32_t characteristics) :
47 Debug(debug, sec),
48 characteristics_(characteristics) {}
49
52
55
56 std::unique_ptr<Debug> clone() const override {
57 return std::unique_ptr<Debug>(new ExDllCharacteristics(*this));
58 }
59
62 return (CHARACTERISTICS)characteristics_;
63 }
64
66 std::vector<CHARACTERISTICS> characteristics_list() const;
67
69 bool has(CHARACTERISTICS c) const {
70 return (characteristics_ & (uint32_t)c) != 0;
71 }
72
73 static bool classof(const Debug* debug) {
74 return debug->type() == Debug::TYPES::EX_DLLCHARACTERISTICS;
75 }
76
77 ~ExDllCharacteristics() override = default;
78
79 std::string to_string() const override;
80
81 private:
82 uint32_t characteristics_ = 0;
83};
84
86
87}
88
89
91
92#endif
span< uint8_t > payload()
Debug data associated with this entry.
Debug()=default
const Section * section() const
The section where debug data is located.
Definition debug/Debug.hpp:168
@ EX_DLLCHARACTERISTICS
Extended DLL characteristics.
Definition debug/Debug.hpp:99
bool has(CHARACTERISTICS c) const
Check if the given CHARACTERISTICS is used.
Definition ExDllCharacteristics.hpp:69
CHARACTERISTICS characteristics() const
Return the characteristics.
Definition ExDllCharacteristics.hpp:61
ExDllCharacteristics(ExDllCharacteristics &&)=default
ExDllCharacteristics(const ExDllCharacteristics &other)=default
CHARACTERISTICS
Extended DLL Characteristics.
Definition ExDllCharacteristics.hpp:31
std::unique_ptr< Debug > clone() const override
Definition ExDllCharacteristics.hpp:56
static bool classof(const Debug *debug)
Definition ExDllCharacteristics.hpp:73
static std::unique_ptr< ExDllCharacteristics > parse(const details::pe_debug &hdr, Section *section, span< uint8_t > payload)
std::string to_string() const override
~ExDllCharacteristics() override=default
ExDllCharacteristics & operator=(ExDllCharacteristics &&other)=default
ExDllCharacteristics & operator=(const ExDllCharacteristics &other)=default
std::vector< CHARACTERISTICS > characteristics_list() const
Characteristics as a vector.
ExDllCharacteristics(const details::pe_debug &debug, Section *sec, uint32_t characteristics)
Definition ExDllCharacteristics.hpp:45
Class which represents a PE section.
Definition PE/Section.hpp:46
#define ENABLE_BITMASK_OPERATORS(X)
Definition enums.hpp:23
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:31
const char * to_string(CODE_PAGES e)
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:44