16#ifndef LIEF_PE_IMPORT_H
17#define LIEF_PE_IMPORT_H
46 using entries_t = std::vector<std::unique_ptr<ImportEntry>>;
50 Import(
const details::pe_import&
import);
52 name_(std::move(
name))
65 return forwarder_chain_;
71 return timedatestamp_;
111 const std::string&
name()
const {
117 name_ = std::move(
name);
142 return iat_directory_;
146 return iat_directory_;
151 entries_.emplace_back(
new ImportEntry(std::move(entry)));
152 return *entries_.back();
158 return *entries_.back();
181 return nb_original_func_;
192 uint32_t ilt_rva_ = 0;
193 uint32_t timedatestamp_ = 0;
194 uint32_t forwarder_chain_ = 0;
195 uint32_t name_rva_ = 0;
196 uint32_t iat_rva_ = 0;
199 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 an entry (i.e. an import) in the import table (Import).
Definition ImportEntry.hpp:36
~Import() override=default
it_entries entries()
Definition Import.hpp:79
uint32_t name_rva() const
The original name rva.
Definition Import.hpp:121
DataDirectory * directory()
Return the PE::DataDirectory associated with this import. It should be the one at index PE::DataDirec...
Definition Import.hpp:129
Import(const Import &other)
it_const_entries entries() const
Iterator over the PE::ImportEntry.
Definition Import.hpp:75
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:156
void import_lookup_table_rva(uint32_t rva)
Definition Import.hpp:171
const DataDirectory * directory() const
Definition Import.hpp:133
uint32_t forwarder_chain() const
The index of the first forwarder reference.
Definition Import.hpp:64
Import(std::string name)
Definition Import.hpp:51
ImportEntry * get_entry(const std::string &name)
Return the imported function with the given name.
Definition Import.hpp:105
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:175
Import & operator=(Import &&other) noexcept=default
Import(const details::pe_import &import)
ref_iterator< entries_t &, ImportEntry * > it_entries
Definition Import.hpp:47
Import & operator=(const Import &other)
uint32_t import_lookup_table_rva() const
Return the relative virtual address of the import lookup table.
Definition Import.hpp:95
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:88
Import(Import &&other) noexcept=default
friend class Builder
Definition Import.hpp:43
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:70
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_ref_iterator< const entries_t &, const ImportEntry * > it_const_entries
Definition Import.hpp:48
const DataDirectory * iat_directory() const
Definition Import.hpp:145
const std::string & name() const
Return the library's name (e.g. kernel32.dll).
Definition Import.hpp:111
friend class Parser
Definition Import.hpp:42
ImportEntry & add_entry(ImportEntry entry)
Add a new import entry (i.e. an imported function).
Definition Import.hpp:150
DataDirectory * iat_directory()
Return the PE::DataDirectory associated associated with the IAT. It should be the one at index PE::Da...
Definition Import.hpp:141
void name(std::string name)
Change the current import name.
Definition Import.hpp:116
std::vector< std::unique_ptr< ImportEntry > > entries_t
Definition Import.hpp:46
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
Definition Visitor.hpp:210
Iterator which returns reference on container's values.
Definition iterators.hpp:46
Definition DataDirectory.hpp:37
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
PE_TYPE
Definition PE/enums.hpp:22
@ PE32
32bits
Definition PE/enums.hpp:23
LIEF namespace.
Definition Abstract/Binary.hpp:40
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which return const ref on container's values.
Definition iterators.hpp:257
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:75
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42