LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_PE_IMPORT_H
17#define LIEF_PE_IMPORT_H
45 using entries_t = std::vector<ImportEntry>;
46 using it_entries = ref_iterator<entries_t&>;
47 using it_const_entries = const_ref_iterator<const entries_t&>;
49 Import(
const details::pe_import&
import);
51 name_(std::move(name))
56 Import(
const Import& other) =
default;
57 Import(Import&& other)
noexcept =
default;
58 Import&
operator=(Import&& other)
noexcept =
default;
63 return forwarder_chain_;
69 return timedatestamp_;
71 it_const_entries
entries()
const {
101 ImportEntry*
get_entry(
const std::string& name) {
104 return const_cast<ImportEntry*
>(
static_cast<const Import*
>(
this)->get_entry(name));
106 const ImportEntry*
get_entry(
const std::string& name)
const;
107 const std::string&
name()
const {
112 void name(std::string name) {
115 name_ = std::move(name);
140 return iat_directory_;
144 return iat_directory_;
146 ImportEntry&
add_entry(ImportEntry entry) {
149 entries_.push_back(std::move(entry));
150 return entries_.back();
152 ImportEntry&
add_entry(
const std::string& name) {
155 entries_.emplace_back(name);
156 return entries_.back();
179 return nb_original_func_;
182 void accept(Visitor& visitor)
const override;
188 DataDirectory* directory_ =
nullptr;
189 DataDirectory* iat_directory_ =
nullptr;
190 uint32_t ilt_rva_ = 0;
191 uint32_t timedatestamp_ = 0;
192 uint32_t forwarder_chain_ = 0;
193 uint32_t name_rva_ = 0;
194 uint32_t iat_rva_ = 0;
197 size_t nb_original_func_ = 0;
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 data directory entry.
Definition DataDirectory.hpp:42
Class that represents a PE import.
Definition Import.hpp:39
~Import() override=default
it_entries entries()
Definition Import.hpp:77
uint32_t name_rva() const
The original name rva.
Definition Import.hpp:119
DataDirectory * directory()
Return the PE::DataDirectory associated with this import. It should be the one at index PE::DataDirec...
Definition Import.hpp:127
it_const_entries entries() const
Iterator over the PE::ImportEntry.
Definition Import.hpp:73
bool remove_entry(const std::string &name)
Remove the import entry with the given name.
const ImportEntry * get_entry(const std::string &name) const
ImportEntry & add_entry(const std::string &name)
Add a new import entry with the given name (i.e. an imported function)
Definition Import.hpp:154
void import_lookup_table_rva(uint32_t rva)
Definition Import.hpp:169
const DataDirectory * directory() const
Definition Import.hpp:131
uint32_t forwarder_chain() const
The index of the first forwarder reference.
Definition Import.hpp:62
Import(std::string name)
Definition Import.hpp:50
ImportEntry * get_entry(const std::string &name)
Return the imported function with the given name.
Definition Import.hpp:103
bool remove_entry(uint32_t ordinal)
Remove the import entry with the given ordinal number.
void import_address_table_rva(uint32_t rva)
Definition Import.hpp:173
Import & operator=(Import &&other) noexcept=default
Import(const details::pe_import &import)
Import(const Import &other)=default
uint32_t import_lookup_table_rva() const
Return the relative virtual address of the import lookup table.
Definition Import.hpp:93
uint32_t import_address_table_rva() const
The RVA of the import address table (IAT). The content of this table is identical to the content of t...
Definition Import.hpp:86
Import(Import &&other) noexcept=default
Import & operator=(const Import &other)=default
uint32_t timedatestamp() const
The stamp that is set to zero until the image is bound. After the image is bound, this field is set t...
Definition Import.hpp:68
friend std::ostream & operator<<(std::ostream &os, const Import &entry)
void accept(Visitor &visitor) const override
result< uint32_t > get_function_rva_from_iat(const std::string &function) const
Return the Function's RVA from the import address table (IAT)
const DataDirectory * iat_directory() const
Definition Import.hpp:143
const std::string & name() const
Return the library's name (e.g. kernel32.dll)
Definition Import.hpp:109
ImportEntry & add_entry(ImportEntry entry)
Add a new import entry (i.e. an imported function)
Definition Import.hpp:148
DataDirectory * iat_directory()
Return the PE::DataDirectory associated associated with the IAT. It should be the one at index PE::Da...
Definition Import.hpp:139
void name(std::string name)
Change the current import name.
Definition Import.hpp:114
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
Definition DataDirectory.hpp:37
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
PE_TYPE
Definition PE/enums.hpp:22
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42