LIEF: Library to Instrument Executable Formats Version 0.16.0
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;
30class LIEF_API DelayImportEntry : public LIEF::Symbol {
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
49 DelayImportEntry(const DelayImportEntry&) = default;
50 DelayImportEntry& operator=(const DelayImportEntry&) = default;
51
52 DelayImportEntry(DelayImportEntry&&) noexcept = default;
53 DelayImportEntry& operator=(DelayImportEntry&&) noexcept = default;
54
55 ~DelayImportEntry() override = default;
56 std::string demangled_name() const;
60 bool is_ordinal() const;
63 uint16_t ordinal() const {
66 static constexpr auto MASK = 0xFFFF;
67 return data_ & MASK;
68 }
69 uint64_t hint_name_rva() const {
72 return data();
73 }
74 uint16_t hint() const {
78 return hint_;
79 }
80 uint64_t iat_value() const {
83 return iat_value_;
84 }
85 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;
104 PE_TYPE type_ = PE_TYPE::PE32_PLUS;
105};
106
107}
108}
109
110#endif /* LIEF_PE_DELAY_IMPORT_ENTRY_H */
Symbol.hpp
Object.hpp
enums.hpp
LIEF::PE::Builder
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
LIEF::PE::DelayImportEntry
Class that represents an entry (i.e. an import) in the delay import table (DelayImport).
Definition DelayImportEntry.hpp:38
LIEF::PE::DelayImportEntry::iat_value
uint64_t iat_value() const
Value of the current entry in the Import Address Table.
Definition DelayImportEntry.hpp:82
LIEF::PE::DelayImportEntry::DelayImportEntry
DelayImportEntry(const DelayImportEntry &)=default
LIEF::PE::DelayImportEntry::hint
uint16_t hint() const
Index into the Export::entries that is used to speed-up the symbol resolution.
Definition DelayImportEntry.hpp:77
LIEF::PE::DelayImportEntry::DelayImportEntry
DelayImportEntry(DelayImportEntry &&) noexcept=default
LIEF::PE::DelayImportEntry::operator<<
friend std::ostream & operator<<(std::ostream &os, const DelayImportEntry &entry)
LIEF::PE::DelayImportEntry::hint_name_rva
uint64_t hint_name_rva() const
Definition DelayImportEntry.hpp:71
LIEF::PE::DelayImportEntry::operator=
DelayImportEntry & operator=(const DelayImportEntry &)=default
LIEF::PE::DelayImportEntry::DelayImportEntry
DelayImportEntry(uint64_t data, PE_TYPE type)
Definition DelayImportEntry.hpp:44
LIEF::PE::DelayImportEntry::data
uint64_t data() const
Raw value.
Definition DelayImportEntry.hpp:87
LIEF::PE::DelayImportEntry::accept
void accept(Visitor &visitor) const override
LIEF::PE::DelayImportEntry::data
void data(uint64_t data)
Definition DelayImportEntry.hpp:91
LIEF::PE::DelayImportEntry::DelayImportEntry
DelayImportEntry()=default
LIEF::PE::Parser
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF::PE::PE_TYPE
PE_TYPE
Definition PE/enums.hpp:680
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41