LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
DelayImportEntry.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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
58 bool is_ordinal() const;
59
61 uint16_t ordinal() const {
62 static constexpr auto MASK = 0xFFFF;
63 return data_ & MASK;
64 }
65
67 uint64_t hint_name_rva() const {
68 return data();
69 }
70
73 uint16_t hint() const {
74 return hint_;
75 }
76
78 uint64_t iat_value() const {
79 return iat_value_;
80 }
81
83 uint64_t data() const {
84 return data_;
85 }
86
87 void data(uint64_t data) {
88 data_ = data;
89 }
90
91 void accept(Visitor& visitor) const override;
92
93 LIEF_API friend std::ostream& operator<<(std::ostream& os, const DelayImportEntry& entry);
94
95 private:
96 uint64_t data_ = 0;
97 uint16_t hint_ = 0;
98 uint64_t iat_offset_ = 0;
99 uint64_t iat_value_ = 0;
100 PE_TYPE type_ = PE_TYPE::PE32_PLUS;
101};
102
103}
104}
105
106#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
Class that represents an entry (i.e. an import) in the delay import table (DelayImport).
Definition DelayImportEntry.hpp:38
uint64_t iat_value() const
Value of the current entry in the Import Address Table.
Definition DelayImportEntry.hpp:78
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:73
DelayImportEntry(DelayImportEntry &&) noexcept=default
friend std::ostream & operator<<(std::ostream &os, const DelayImportEntry &entry)
uint64_t hint_name_rva() const
Definition DelayImportEntry.hpp:67
DelayImportEntry & operator=(const DelayImportEntry &)=default
DelayImportEntry(uint64_t data, PE_TYPE type)
Definition DelayImportEntry.hpp:44
uint64_t data() const
Raw value.
Definition DelayImportEntry.hpp:83
void accept(Visitor &visitor) const override
void data(uint64_t data)
Definition DelayImportEntry.hpp:87
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:28
Definition Visitor.hpp:224
PE_TYPE
Definition PE/enums.hpp:680
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41