LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
DynamicFixupControlTransfer.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_LOAD_CONFIGURATION_DYNAMIC_FIXUP_CONTROL_TRANSFER_H
17#define LIEF_PE_LOAD_CONFIGURATION_DYNAMIC_FIXUP_CONTROL_TRANSFER_H
18#include <vector>
20
21#include "LIEF/iterators.hpp"
22
23namespace LIEF {
24namespace PE {
29 public:
30 static constexpr auto NO_IAT_INDEX = 0x7fff;
31 struct LIEF_API reloc_entry_t { uint32_t rva = 0;
36 bool is_call = false;
39 uint16_t iat_index = NO_IAT_INDEX;
43
44 std::string to_string() const;
45
46 friend LIEF_API
47 std::ostream& operator<<(std::ostream& os, const reloc_entry_t& entry)
48 {
49 os << entry.to_string();
50 return os;
51 }
52 };
53
54 using reloc_entries_t = std::vector<reloc_entry_t>;
55 using it_relocations = ref_iterator<reloc_entries_t&>;
56 using it_const_relocations = const_ref_iterator<const reloc_entries_t&>;
57
59 DynamicFixup(KIND::GUARD_IMPORT_CONTROL_TRANSFER)
60 {}
61
62 DynamicFixupControlTransfer(const DynamicFixupControlTransfer&) = default;
63 DynamicFixupControlTransfer& operator=(const DynamicFixupControlTransfer&) = default;
64
65 DynamicFixupControlTransfer(DynamicFixupControlTransfer&&) = default;
66 DynamicFixupControlTransfer& operator=(DynamicFixupControlTransfer&&) = default;
67
68 std::unique_ptr<DynamicFixup> clone() const override {
69 return std::unique_ptr<DynamicFixupControlTransfer>(new DynamicFixupControlTransfer(*this));
70 }
71
72 std::string to_string() const override;
73 it_relocations relocations() {
76 return entries_;
77 }
78
79 it_const_relocations relocations() const {
80 return entries_;
81 }
82
83 static bool classof(const DynamicFixup* fixup) {
84 return fixup->kind() == KIND::GUARD_IMPORT_CONTROL_TRANSFER;
85 }
86
87 ~DynamicFixupControlTransfer() override = default;
88 LIEF_LOCAL static
91 std::unique_ptr<DynamicFixupControlTransfer> parse(Parser& ctx, SpanStream& strm);
92
93 private:
94 reloc_entries_t entries_;
95};
96
97
98}
99}
100
101#endif
DynamicFixup.hpp
LIEF::PE::DynamicFixupControlTransfer
This class wraps fixups associated with the (special) symbol value: IMAGE_DYNAMIC_RELOCATION_GUARD_IM...
Definition DynamicFixupControlTransfer.hpp:28
LIEF::PE::DynamicFixupControlTransfer::operator=
DynamicFixupControlTransfer & operator=(DynamicFixupControlTransfer &&)=default
LIEF::PE::DynamicFixupControlTransfer::relocations
it_const_relocations relocations() const
Definition DynamicFixupControlTransfer.hpp:79
LIEF::PE::DynamicFixupControlTransfer::DynamicFixupControlTransfer
DynamicFixupControlTransfer()
Definition DynamicFixupControlTransfer.hpp:58
LIEF::PE::DynamicFixupControlTransfer::operator=
DynamicFixupControlTransfer & operator=(const DynamicFixupControlTransfer &)=default
LIEF::PE::DynamicFixupControlTransfer::clone
std::unique_ptr< DynamicFixup > clone() const override
Definition DynamicFixupControlTransfer.hpp:68
LIEF::PE::DynamicFixupControlTransfer::to_string
std::string to_string() const override
LIEF::PE::DynamicFixupControlTransfer::relocations
it_relocations relocations()
Iterator over the relocations.
Definition DynamicFixupControlTransfer.hpp:75
LIEF::PE::DynamicFixupControlTransfer::~DynamicFixupControlTransfer
~DynamicFixupControlTransfer() override=default
LIEF::PE::DynamicFixupControlTransfer::classof
static bool classof(const DynamicFixup *fixup)
Definition DynamicFixupControlTransfer.hpp:83
LIEF::PE::DynamicFixupControlTransfer::DynamicFixupControlTransfer
DynamicFixupControlTransfer(DynamicFixupControlTransfer &&)=default
LIEF::PE::DynamicFixupControlTransfer::DynamicFixupControlTransfer
DynamicFixupControlTransfer(const DynamicFixupControlTransfer &)=default
LIEF::PE::DynamicFixup
This is the base class for any fixups located in DynamicRelocation.
Definition DynamicFixup.hpp:34
LIEF::PE::DynamicFixup::kind
KIND kind() const
Encoding of the fixups.
Definition DynamicFixup.hpp:73
iterators.hpp
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
LIEF::PE::DynamicFixupControlTransfer::reloc_entry_t::operator<<
friend std::ostream & operator<<(std::ostream &os, const reloc_entry_t &entry)
Definition DynamicFixupControlTransfer.hpp:47
LIEF::PE::DynamicFixupControlTransfer::reloc_entry_t::to_string
std::string to_string() const
LIEF_API
#define LIEF_API
Definition visibility.h:41
LIEF_LOCAL
#define LIEF_LOCAL
Definition visibility.h:42