LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
CodeIntegrity.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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_CODE_INTEGRITY_H
17#define LIEF_PE_CODE_INTEGRITY_H
18#include <ostream>
19#include <cstdint>
20
22#include "LIEF/errors.hpp"
23#include "LIEF/Object.hpp"
24#include "LIEF/visibility.h"
25
26namespace LIEF {
27class BinaryStream;
28
29namespace PE {
30class Parser;
31
33 public:
35 CodeIntegrity() = default;
36
37 ~CodeIntegrity() override = default;
38
40 CodeIntegrity(const CodeIntegrity&) = default;
41
44
46 uint16_t flags() const {
47 return flags_;
48 }
49
51 uint16_t catalog() const {
52 return catalog_;
53 }
54
55 uint32_t catalog_offset() const {
56 return catalog_offset_;
57 }
58
60 uint32_t reserved() const {
61 return reserved_;
62 }
63
65 flags_ = flags;
66 return *this;
67 }
68
70 catalog_ = catalog;
71 return *this;
72 }
73
75 catalog_offset_ = catalog_offset;
76 return *this;
77 }
78
80 reserved_ = reserved;
81 return *this;
82 }
83
84 void accept(Visitor& visitor) const override;
85
86 LIEF_API friend std::ostream& operator<<(std::ostream& os,
87 const CodeIntegrity& entry);
88
89 private:
90 uint16_t flags_ = 0;
91 uint16_t catalog_ = 0;
92
93 uint32_t catalog_offset_ = 0;
94 uint32_t reserved_ = 0;
95};
96}
97}
98
99#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:35
CodeIntegrity(CodeIntegrity &&)=default
void accept(Visitor &visitor) const override
static result< CodeIntegrity > parse(Parser &ctx, BinaryStream &stream)
CodeIntegrity & operator=(const CodeIntegrity &)=default
CodeIntegrity & catalog(uint16_t catalog)
Definition CodeIntegrity.hpp:69
uint16_t flags() const
Flags to indicate if CI information is available, etc.
Definition CodeIntegrity.hpp:46
CodeIntegrity & operator=(CodeIntegrity &&)=default
uint16_t catalog() const
0xFFFF means not available
Definition CodeIntegrity.hpp:51
CodeIntegrity & catalog_offset(uint32_t catalog_offset)
Definition CodeIntegrity.hpp:74
CodeIntegrity(const CodeIntegrity &)=default
uint32_t catalog_offset() const
Definition CodeIntegrity.hpp:55
~CodeIntegrity() override=default
CodeIntegrity & reserved(uint32_t reserved)
Definition CodeIntegrity.hpp:79
CodeIntegrity & flags(uint16_t flags)
Definition CodeIntegrity.hpp:64
uint32_t reserved() const
Additional bitmask to be defined later.
Definition CodeIntegrity.hpp:60
friend std::ostream & operator<<(std::ostream &os, const CodeIntegrity &entry)
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:53
Definition Visitor.hpp:212
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:79
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:41
#define LIEF_API
Definition visibility.h:45