LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
DelayImport.hpp
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/types.hpp"
24#include "LIEF/visibility.h"
25#include "LIEF/iterators.hpp"
26
27#include "LIEF/PE/DelayImportEntry.hpp"
28
29namespace LIEF {
30namespace PE {
31
32namespace details {
33struct delay_imports;
34}
35
37class LIEF_API DelayImport : public Object {
38
39 friend class Parser;
40 friend class Builder;
41
42 public:
43 using entries_t = std::vector<DelayImportEntry>;
46
48 DelayImport(const details::delay_imports& import, PE_TYPE type);
49 DelayImport(std::string name);
50
51 ~DelayImport() override;
52
54 DelayImport& operator=(const DelayImport&);
55
57 DelayImport& operator=(DelayImport&&);
58
59 void swap(DelayImport& other);
60
63 uint32_t attribute() const;
64 void attribute(uint32_t hdl);
65
67 const std::string& name() const;
68 void name(std::string name);
69
73 uint32_t handle() const;
74 void handle(uint32_t hdl);
75
77 uint32_t iat() const;
78 void iat(uint32_t iat);
79
82 uint32_t names_table() const;
83 void names_table(uint32_t value);
84
87 uint32_t biat() const;
88 void biat(uint32_t value);
89
96 uint32_t uiat() const;
97 void uiat(uint32_t value);
98
100 uint32_t timestamp() const;
101 void timestamp(uint32_t value);
102
105
108
109 void accept(Visitor& visitor) const override;
110
111
112 LIEF_API friend std::ostream& operator<<(std::ostream& os, const DelayImport& entry);
113
114 private:
115 uint32_t attribute_ = 0;
116 std::string name_;
117 uint32_t handle_ = 0;
118 uint32_t iat_ = 0;
119 uint32_t names_table_ = 0;
120 uint32_t bound_iat_ = 0;
121 uint32_t unload_iat_ = 0;
122 uint32_t timestamp_ = 0;
123 entries_t entries_;
124
125 PE_TYPE type_ = PE_TYPE::PE32;
126};
127
128}
129}
130
131#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:37
uint32_t uiat() const
RVA of the unload delay-load import address table or 0 if the table does not exist.
uint32_t timestamp() const
The timestamp of the DLL to which this image has been bound.
it_const_entries entries() const
Iterator over the DelayImport's entries (DelayImportEntry)
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...
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...
uint32_t biat() const
RVA of the bound delay-load import address table or 0 if the table does not exist.
it_entries entries()
Iterator over the DelayImport's entries (DelayImportEntry)
uint32_t attribute() const
According to the official PE specifications, this value is reserved and should be set to 0.
const std::string & name() const
Return the library's name (e.g. kernel32.dll)
uint32_t iat() const
RVA of the delay-load import address table.
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
Definition Visitor.hpp:219
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