LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
DynamicFixupControlTransfer.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_LOAD_CONFIGURATION_DYNAMIC_FIXUP_CONTROL_TRANSFER_H
17#define LIEF_PE_LOAD_CONFIGURATION_DYNAMIC_FIXUP_CONTROL_TRANSFER_H
19#include <memory>
20#include <vector>
21
22#include "LIEF/iterators.hpp"
23
24
25namespace LIEF::PE {
26
30 public:
31 static constexpr auto NO_IAT_INDEX = 0x7fff;
32
36 uint32_t rva = 0;
37
39 bool is_call = false;
40
44
45 std::string to_string() const;
46
47 friend LIEF_API std::ostream& operator<<(std::ostream& os,
48 const reloc_entry_t& entry) {
49 os << entry.to_string();
50 return os;
51 }
52 };
53
54 using reloc_entries_t = std::vector<reloc_entry_t>;
57
60
64
67
68 std::unique_ptr<DynamicFixup> clone() const override {
69 return std::make_unique<DynamicFixupControlTransfer>(*this);
70 }
71
72 std::string to_string() const override;
73
76 return entries_;
77 }
78
80 return entries_;
81 }
82
83 static bool classof(const DynamicFixup* fixup) {
85 }
86
87 ~DynamicFixupControlTransfer() override = default;
88
90 LIEF_LOCAL static std::unique_ptr<DynamicFixupControlTransfer>
91 parse(Parser& ctx, SpanStream& strm);
92
93 private:
94 reloc_entries_t entries_;
95};
96
97
98}
99
100
101#endif
ref_iterator< reloc_entries_t & > it_relocations
Definition DynamicFixupControlTransfer.hpp:55
DynamicFixupControlTransfer & operator=(DynamicFixupControlTransfer &&)=default
std::vector< reloc_entry_t > reloc_entries_t
Definition DynamicFixupControlTransfer.hpp:54
it_const_relocations relocations() const
Definition DynamicFixupControlTransfer.hpp:79
static constexpr auto NO_IAT_INDEX
Definition DynamicFixupControlTransfer.hpp:31
DynamicFixupControlTransfer()
Definition DynamicFixupControlTransfer.hpp:58
DynamicFixupControlTransfer & operator=(const DynamicFixupControlTransfer &)=default
std::unique_ptr< DynamicFixup > clone() const override
Definition DynamicFixupControlTransfer.hpp:68
std::string to_string() const override
const_ref_iterator< const reloc_entries_t & > it_const_relocations
Definition DynamicFixupControlTransfer.hpp:56
it_relocations relocations()
Iterator over the relocations.
Definition DynamicFixupControlTransfer.hpp:75
~DynamicFixupControlTransfer() override=default
static bool classof(const DynamicFixup *fixup)
Definition DynamicFixupControlTransfer.hpp:83
DynamicFixupControlTransfer(DynamicFixupControlTransfer &&)=default
DynamicFixupControlTransfer(const DynamicFixupControlTransfer &)=default
KIND
Definition DynamicFixup.hpp:36
@ GUARD_IMPORT_CONTROL_TRANSFER
If DynamicRelocation::symbol is set to IMAGE_DYNAMIC_RELOCATION_GUARD_IMPORT_CONTROL_TRANSFER.
Definition DynamicFixup.hpp:57
KIND kind() const
Encoding of the fixups.
Definition DynamicFixup.hpp:75
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:53
Definition SpanStream.hpp:32
Iterator which returns reference on container's values.
Definition iterators.hpp:47
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which returns a const ref on container's values.
Definition iterators.hpp:316
Mirror IMAGE_IMPORT_CONTROL_TRANSFER_DYNAMIC_RELOCATION.
Definition DynamicFixupControlTransfer.hpp:34
bool is_call
True if target instruction is a call, false otherwise.
Definition DynamicFixupControlTransfer.hpp:39
friend std::ostream & operator<<(std::ostream &os, const reloc_entry_t &entry)
Definition DynamicFixupControlTransfer.hpp:47
uint32_t rva
RVA to the call instruction.
Definition DynamicFixupControlTransfer.hpp:36
std::string to_string() const
uint16_t iat_index
IAT index of the corresponding import. 0x7FFF is a special value indicating no index.
Definition DynamicFixupControlTransfer.hpp:43
#define LIEF_API
Definition visibility.h:45
#define LIEF_LOCAL
Definition visibility.h:46