LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
DelayImportEntry.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_DELAY_IMPORT_ENTRY_H
17#define LIEF_PE_DELAY_IMPORT_ENTRY_H
18#include <ostream>
19
20#include "LIEF/Object.hpp"
21#include "LIEF/visibility.h"
23
24#include "LIEF/PE/enums.hpp"
25
26namespace LIEF {
27namespace PE {
28class Parser;
29class Builder;
30
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 {}
48
51
52 DelayImportEntry(DelayImportEntry&&) noexcept = default;
53 DelayImportEntry& operator=(DelayImportEntry&&) noexcept = default;
54
55 ~DelayImportEntry() override = default;
56
59 std::string demangled_name() const;
60
62 bool is_ordinal() const;
63
65 uint16_t ordinal() const {
66 static constexpr auto MASK = 0xFFFF;
67 return data_ & MASK;
68 }
69
71 uint64_t hint_name_rva() const {
72 return data();
73 }
74
77 uint16_t hint() const {
78 return hint_;
79 }
80
82 uint64_t iat_value() const {
83 return iat_value_;
84 }
85
87 uint64_t data() const {
88 return data_;
89 }
90
91 void data(uint64_t data) {
92 data_ = data;
93 }
94
95 void accept(Visitor& visitor) const override;
96
97 LIEF_API friend std::ostream& operator<<(std::ostream& os, 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 /* LIEF_PE_DELAY_IMPORT_ENTRY_H */
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
uint64_t iat_value() const
Value of the current entry in the Import Address Table.
Definition DelayImportEntry.hpp:82
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:77
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:71
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:65
uint64_t data() const
Raw value.
Definition DelayImportEntry.hpp:87
void accept(Visitor &visitor) const override
void data(uint64_t data)
Definition DelayImportEntry.hpp:91
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:28
Definition Visitor.hpp:210
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
PE_TYPE
Definition PE/enums.hpp:22
@ PE32_PLUS
64 bits
Definition PE/enums.hpp:24
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41