LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
DelayImportEntry.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_PE_DELAY_IMPORT_ENTRY_H
16#define LIEF_PE_DELAY_IMPORT_ENTRY_H
17#include <ostream>
18
20#include "LIEF/Object.hpp"
21#include "LIEF/visibility.h"
22
23#include "LIEF/PE/enums.hpp"
24
25
26namespace LIEF::PE {
27class Parser;
28class Builder;
29
39 friend class Parser;
40 friend class Builder;
41
42 public:
43 DelayImportEntry() = default;
44 DelayImportEntry(uint64_t data, PE_TYPE type) :
45 data_(data),
46 type_(type) {}
47
50
51 DelayImportEntry(DelayImportEntry&&) noexcept = default;
52 DelayImportEntry& operator=(DelayImportEntry&&) noexcept = default;
53
54 ~DelayImportEntry() override = default;
55
58 std::string demangled_name() const;
59
61 bool is_ordinal() const;
62
64 uint16_t ordinal() const {
65 static constexpr auto MASK = 0xFFFF;
66 return data_ & MASK;
67 }
68
70 uint64_t hint_name_rva() const {
71 return data();
72 }
73
76 uint16_t hint() const {
77 return hint_;
78 }
79
81 uint64_t iat_value() const {
82 return iat_value_;
83 }
84
86 uint64_t data() const {
87 return data_;
88 }
89
90 void data(uint64_t data) {
91 data_ = data;
92 }
93
94 void accept(Visitor& visitor) const override;
95
96 LIEF_API friend std::ostream& operator<<(std::ostream& os,
97 const DelayImportEntry& entry);
98
99 private:
100 uint64_t data_ = 0;
101 uint16_t hint_ = 0;
102 uint64_t iat_offset_ = 0;
103 uint64_t iat_value_ = 0;
105};
106
107}
108
109
110#endif
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:43
uint64_t iat_value() const
Value of the current entry in the Import Address Table.
Definition DelayImportEntry.hpp:81
DelayImportEntry(const DelayImportEntry &)=default
uint16_t hint() const
Index into the Export::entries that is used to speed-up the symbol resolution.
Definition DelayImportEntry.hpp:76
DelayImportEntry(DelayImportEntry &&) noexcept=default
friend class Builder
Definition DelayImportEntry.hpp:40
friend std::ostream & operator<<(std::ostream &os, const DelayImportEntry &entry)
std::string demangled_name() const
Demangled representation of the symbol or an empty string if it can't be demangled.
bool is_ordinal() const
True if it is an import by ordinal
uint64_t hint_name_rva() const
Definition DelayImportEntry.hpp:70
DelayImportEntry & operator=(const DelayImportEntry &)=default
DelayImportEntry(uint64_t data, PE_TYPE type)
Definition DelayImportEntry.hpp:44
friend class Parser
Definition DelayImportEntry.hpp:39
uint16_t ordinal() const
The ordinal value.
Definition DelayImportEntry.hpp:64
uint64_t data() const
Raw value.
Definition DelayImportEntry.hpp:86
void accept(Visitor &visitor) const override
void data(uint64_t data)
Definition DelayImportEntry.hpp:90
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:53
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:29
Definition Visitor.hpp:211
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:31
PE_TYPE
Definition PE/enums.hpp:22
@ PE32_PLUS
64 bits
Definition PE/enums.hpp:24
#define LIEF_API
Definition visibility.h:44