LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
ExDllCharacteristics.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 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_EX_DLL_CHARACTERISTICS_H
17#define LIEF_PE_EX_DLL_CHARACTERISTICS_H
18#include <vector>
19
20#include "LIEF/enums.hpp"
21#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace PE {
26class LIEF_API ExDllCharacteristics : public Debug {
30 public: enum class CHARACTERISTICS : uint32_t {
33 CET_COMPAT = 0x01,
34 CET_COMPAT_STRICT_MODE = 0x02,
35 CET_SET_CONTEXT_IP_VALIDATION_RELAXED_MODE = 0x04,
36 CET_DYNAMIC_APIS_ALLOW_IN_PROC = 0x08,
37 CET_RESERVED_1 = 0x10,
38 CET_RESERVED_2 = 0x20,
39 FORWARD_CFI_COMPAT = 0x40,
40 HOTPATCH_COMPATIBLE = 0x80,
41 };
42
43 static std::unique_ptr<ExDllCharacteristics>
44 parse(const details::pe_debug& hdr, Section* section, span<uint8_t> payload);
45
46 ExDllCharacteristics(const details::pe_debug& debug, Section* sec,
47 uint32_t characteristics) :
48 Debug(debug, sec),
49 characteristics_(characteristics)
50 {}
51
52 ExDllCharacteristics(const ExDllCharacteristics& other) = default;
53 ExDllCharacteristics& operator=(const ExDllCharacteristics& other) = default;
54
55 ExDllCharacteristics(ExDllCharacteristics&&) = default;
56 ExDllCharacteristics& operator=(ExDllCharacteristics&& other) = default;
57
58 std::unique_ptr<Debug> clone() const override {
59 return std::unique_ptr<Debug>(new ExDllCharacteristics(*this));
60 }
61 CHARACTERISTICS characteristics() const {
64 return (CHARACTERISTICS)characteristics_;
65 }
66 std::vector<CHARACTERISTICS> characteristics_list() const;
69 bool has(CHARACTERISTICS c) const {
72 return (characteristics_ & (uint32_t)c) != 0;
73 }
74
75 static bool classof(const Debug* debug) {
76 return debug->type() == Debug::TYPES::EX_DLLCHARACTERISTICS;
77 }
78
79 ~ExDllCharacteristics() override = default;
80
81 std::string to_string() const override;
82
83 private:
84 uint32_t characteristics_ = 0;
85};
86
87LIEF_API const char* to_string(ExDllCharacteristics::CHARACTERISTICS e);
88
89}
90}
91
92ENABLE_BITMASK_OPERATORS(LIEF::PE::ExDllCharacteristics::CHARACTERISTICS);
93
94#endif
LIEF::PE::Debug
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:40
LIEF::PE::ExDllCharacteristics
This class represents the IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS debug entry.
Definition ExDllCharacteristics.hpp:29
LIEF::PE::ExDllCharacteristics::has
bool has(CHARACTERISTICS c) const
Check if the given CHARACTERISTICS is used.
Definition ExDllCharacteristics.hpp:71
LIEF::PE::ExDllCharacteristics::characteristics
CHARACTERISTICS characteristics() const
Return the characteristics.
Definition ExDllCharacteristics.hpp:63
LIEF::PE::ExDllCharacteristics::ExDllCharacteristics
ExDllCharacteristics(ExDllCharacteristics &&)=default
LIEF::PE::ExDllCharacteristics::ExDllCharacteristics
ExDllCharacteristics(const ExDllCharacteristics &other)=default
LIEF::PE::ExDllCharacteristics::CHARACTERISTICS
CHARACTERISTICS
Extended DLL Characteristics.
Definition ExDllCharacteristics.hpp:32
LIEF::PE::ExDllCharacteristics::clone
std::unique_ptr< Debug > clone() const override
Definition ExDllCharacteristics.hpp:58
LIEF::PE::ExDllCharacteristics::classof
static bool classof(const Debug *debug)
Definition ExDllCharacteristics.hpp:75
LIEF::PE::ExDllCharacteristics::parse
static std::unique_ptr< ExDllCharacteristics > parse(const details::pe_debug &hdr, Section *section, span< uint8_t > payload)
LIEF::PE::ExDllCharacteristics::to_string
std::string to_string() const override
LIEF::PE::ExDllCharacteristics::~ExDllCharacteristics
~ExDllCharacteristics() override=default
LIEF::PE::ExDllCharacteristics::operator=
ExDllCharacteristics & operator=(ExDllCharacteristics &&other)=default
LIEF::PE::ExDllCharacteristics::operator=
ExDllCharacteristics & operator=(const ExDllCharacteristics &other)=default
LIEF::PE::ExDllCharacteristics::characteristics_list
std::vector< CHARACTERISTICS > characteristics_list() const
Characteristics as a vector.
LIEF::PE::ExDllCharacteristics::ExDllCharacteristics
ExDllCharacteristics(const details::pe_debug &debug, Section *sec, uint32_t characteristics)
Definition ExDllCharacteristics.hpp:46
Debug.hpp
enums.hpp
ENABLE_BITMASK_OPERATORS
#define ENABLE_BITMASK_OPERATORS(X)
Definition enums.hpp:24
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF::PE::to_string
const char * to_string(AuxiliaryWeakExternal::CHARACTERISTICS e)
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41