LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
DelayImport.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_H
17#define LIEF_PE_DELAY_IMPORT_H
18
19#include <string>
20#include <ostream>
21
22#include "LIEF/Object.hpp"
23#include "LIEF/visibility.h"
24#include "LIEF/iterators.hpp"
25
27
28namespace LIEF {
29namespace PE {
30
31namespace details {
32struct delay_imports;
33}
34
36class LIEF_API DelayImport : public Object {
37
38 friend class Parser;
39 friend class Builder;
40
41 public:
42 using entries_t = std::vector<DelayImportEntry>;
45
46 DelayImport() = default;
47 DelayImport(const details::delay_imports& import, PE_TYPE type);
48 DelayImport(std::string name) :
49 name_(std::move(name))
50 {}
51
52 ~DelayImport() override = default;
53
54 DelayImport(const DelayImport&) = default;
55 DelayImport& operator=(const DelayImport&) = default;
56
57 DelayImport(DelayImport&&) noexcept = default;
58 DelayImport& operator=(DelayImport&&) noexcept = default;
59
60 void swap(DelayImport& other);
61
64 uint32_t attribute() const {
65 return attribute_;
66 }
67 void attribute(uint32_t hdl) {
68 attribute_ = hdl;
69 }
70
72 const std::string& name() const {
73 return name_;
74 }
75 void name(std::string name) {
76 name_ = std::move(name);
77 }
78
82 uint32_t handle() const {
83 return handle_;
84 }
85 void handle(uint32_t hdl) {
86 handle_ = hdl;
87 }
88
90 uint32_t iat() const {
91 return iat_;
92 }
93 void iat(uint32_t iat) {
94 iat_ = iat;
95 }
96
99 uint32_t names_table() const {
100 return names_table_;
101 }
102 void names_table(uint32_t value) {
103 names_table_ = value;
104 }
105
108 uint32_t biat() const {
109 return bound_iat_;
110 }
111 void biat(uint32_t value) {
112 bound_iat_ = value;
113 }
114
121 uint32_t uiat() const {
122 return unload_iat_;
123 }
124 void uiat(uint32_t value) {
125 unload_iat_ = value;
126 }
127
129 uint32_t timestamp() const {
130 return timestamp_;
131 }
132 void timestamp(uint32_t value) {
133 timestamp_ = value;
134 }
135
138 return entries_;
139 }
140
143 return entries_;
144 }
145
146 void accept(Visitor& visitor) const override;
147
148 LIEF_API friend std::ostream& operator<<(std::ostream& os, const DelayImport& entry);
149
150 private:
151 uint32_t attribute_ = 0;
152 std::string name_;
153 uint32_t handle_ = 0;
154 uint32_t iat_ = 0;
155 uint32_t names_table_ = 0;
156 uint32_t bound_iat_ = 0;
157 uint32_t unload_iat_ = 0;
158 uint32_t timestamp_ = 0;
159 entries_t entries_;
160
161 PE_TYPE type_ = PE_TYPE::PE32;
162};
163
164}
165}
166
167#endif
Definition Object.hpp:25
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
Class that represents a PE delayed import.
Definition DelayImport.hpp:36
DelayImport(const DelayImport &)=default
uint32_t uiat() const
RVA of the unload delay-load import address table or 0 if the table does not exist.
Definition DelayImport.hpp:121
uint32_t timestamp() const
The timestamp of the DLL to which this image has been bound.
Definition DelayImport.hpp:129
~DelayImport() override=default
void name(std::string name)
Definition DelayImport.hpp:75
void timestamp(uint32_t value)
Definition DelayImport.hpp:132
DelayImport(const details::delay_imports &import, PE_TYPE type)
it_const_entries entries() const
Iterator over the DelayImport's entries (DelayImportEntry)
Definition DelayImport.hpp:142
uint32_t handle() const
The RVA of the module handle (in the .data section) It is used for storage by the routine that is sup...
Definition DelayImport.hpp:82
uint32_t names_table() const
RVA of the delay-load import names table. The content of this table has the layout as the Import look...
Definition DelayImport.hpp:99
friend std::ostream & operator<<(std::ostream &os, const DelayImport &entry)
uint32_t biat() const
RVA of the bound delay-load import address table or 0 if the table does not exist.
Definition DelayImport.hpp:108
void accept(Visitor &visitor) const override
void biat(uint32_t value)
Definition DelayImport.hpp:111
std::vector< DelayImportEntry > entries_t
Definition DelayImport.hpp:42
void attribute(uint32_t hdl)
Definition DelayImport.hpp:67
it_entries entries()
Iterator over the DelayImport's entries (DelayImportEntry)
Definition DelayImport.hpp:137
void iat(uint32_t iat)
Definition DelayImport.hpp:93
DelayImport(std::string name)
Definition DelayImport.hpp:48
DelayImport & operator=(const DelayImport &)=default
void names_table(uint32_t value)
Definition DelayImport.hpp:102
const std::string & name() const
Return the library's name (e.g. kernel32.dll)
Definition DelayImport.hpp:72
uint32_t iat() const
RVA of the delay-load import address table.
Definition DelayImport.hpp:90
DelayImport(DelayImport &&) noexcept=default
void handle(uint32_t hdl)
Definition DelayImport.hpp:85
void uiat(uint32_t value)
Definition DelayImport.hpp:124
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
Definition Visitor.hpp:224
Iterator which returns reference on container's values.
Definition iterators.hpp:48
PE_TYPE
Definition PE/enums.hpp:680
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41