LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
VCFeature.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_VC_FEATURE_H
17#define LIEF_PE_VC_FEATURE_H
18
19#include "LIEF/visibility.h"
21
22namespace LIEF {
23namespace PE {
24class LIEF_API VCFeature : public Debug {
27 public:
28 static std::unique_ptr<VCFeature>
29 parse(const details::pe_debug& hdr, Section* section, span<uint8_t> payload);
30
31 VCFeature(const details::pe_debug& debug, Section* sec,
32 uint32_t pre_vc, uint32_t c_cpp, uint32_t gs, uint32_t sdl,
33 uint32_t guards) :
34 Debug(debug, sec),
35 pre_vc_(pre_vc), c_cpp_(c_cpp),
36 gs_(gs), sdl_(sdl), guards_(guards)
37 {}
38
39 VCFeature(const VCFeature& other) = default;
40 VCFeature& operator=(const VCFeature& other) = default;
41
42 VCFeature(VCFeature&&) = default;
43 VCFeature& operator=(VCFeature&& other) = default;
44
45 std::unique_ptr<Debug> clone() const override {
46 return std::unique_ptr<Debug>(new VCFeature(*this));
47 }
48 uint32_t pre_vcpp() const {
51 return pre_vc_;
52 }
53 uint32_t c_cpp() const {
56 return c_cpp_;
57 }
58 uint32_t gs() const {
61 return gs_;
62 }
63 uint32_t sdl() const {
70 return sdl_;
71 }
72 uint32_t guards() const {
75 return guards_;
76 }
77
78 VCFeature& pre_vcpp(uint32_t value) {
79 pre_vc_ = value;
80 return *this;
81 }
82
83 VCFeature& c_cpp(uint32_t value) {
84 c_cpp_ = value;
85 return *this;
86 }
87
88 VCFeature& gs(uint32_t value) {
89 gs_ = value;
90 return *this;
91 }
92
93 VCFeature& sdl(uint32_t value) {
94 sdl_ = value;
95 return *this;
96 }
97
98 VCFeature& guards(uint32_t value) {
99 guards_ = value;
100 return *this;
101 }
102
103 static bool classof(const Debug* debug) {
104 return debug->type() == Debug::TYPES::VC_FEATURE;
105 }
106
107 ~VCFeature() override = default;
108
109 std::string to_string() const override;
110 private:
111 uint32_t pre_vc_ = 0;
112 uint32_t c_cpp_ = 0;
113 uint32_t gs_ = 0;
114 uint32_t sdl_ = 0;
115 uint32_t guards_ = 0;
116};
117
118}
119}
120
121#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::VCFeature
This class represents the IMAGE_DEBUG_TYPE_VC_FEATURE debug entry.
Definition VCFeature.hpp:26
LIEF::PE::VCFeature::to_string
std::string to_string() const override
LIEF::PE::VCFeature::guards
uint32_t guards() const
Count for /guardN
Definition VCFeature.hpp:74
LIEF::PE::VCFeature::VCFeature
VCFeature(const VCFeature &other)=default
LIEF::PE::VCFeature::clone
std::unique_ptr< Debug > clone() const override
Definition VCFeature.hpp:45
LIEF::PE::VCFeature::c_cpp
uint32_t c_cpp() const
Count for C/C++
Definition VCFeature.hpp:55
LIEF::PE::VCFeature::operator=
VCFeature & operator=(const VCFeature &other)=default
LIEF::PE::VCFeature::VCFeature
VCFeature(VCFeature &&)=default
LIEF::PE::VCFeature::sdl
VCFeature & sdl(uint32_t value)
Definition VCFeature.hpp:93
LIEF::PE::VCFeature::guards
VCFeature & guards(uint32_t value)
Definition VCFeature.hpp:98
LIEF::PE::VCFeature::classof
static bool classof(const Debug *debug)
Definition VCFeature.hpp:103
LIEF::PE::VCFeature::c_cpp
VCFeature & c_cpp(uint32_t value)
Definition VCFeature.hpp:83
LIEF::PE::VCFeature::sdl
uint32_t sdl() const
Whether /sdl was enabled for this binary.
Definition VCFeature.hpp:69
LIEF::PE::VCFeature::pre_vcpp
uint32_t pre_vcpp() const
Count for Pre-VC++ 11.00
Definition VCFeature.hpp:50
LIEF::PE::VCFeature::gs
VCFeature & gs(uint32_t value)
Definition VCFeature.hpp:88
LIEF::PE::VCFeature::VCFeature
VCFeature(const details::pe_debug &debug, Section *sec, uint32_t pre_vc, uint32_t c_cpp, uint32_t gs, uint32_t sdl, uint32_t guards)
Definition VCFeature.hpp:31
LIEF::PE::VCFeature::pre_vcpp
VCFeature & pre_vcpp(uint32_t value)
Definition VCFeature.hpp:78
LIEF::PE::VCFeature::~VCFeature
~VCFeature() override=default
LIEF::PE::VCFeature::operator=
VCFeature & operator=(VCFeature &&other)=default
LIEF::PE::VCFeature::gs
uint32_t gs() const
Count for /GS (number of guard stack)
Definition VCFeature.hpp:60
LIEF::PE::VCFeature::parse
static std::unique_ptr< VCFeature > parse(const details::pe_debug &hdr, Section *section, span< uint8_t > payload)
Debug.hpp
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41