16#ifndef LIEF_PE_EXPORT_H
17#define LIEF_PE_EXPORT_H
35struct pe_export_directory_table;
44 using entries_t = std::vector<std::unique_ptr<ExportEntry>>;
51 name_(std::move(
name))
62 Export(
const details::pe_export_directory_table& header);
85 return major_version_;
90 return minor_version_;
99 const std::string&
name()
const {
119 return exp_addr_table_rva_;
124 return exp_addr_table_cnt_;
129 return names_addr_table_rva_;
134 return names_addr_table_cnt_;
139 return ord_addr_table_rva_;
143 export_flags_ = flags;
163 name_ = std::move(
name);
177 return const_cast<ExportEntry*
>(
static_cast<const Export*
>(
this)->find_entry(ordinal));
184 return const_cast<ExportEntry*
>(
static_cast<const Export*
>(
this)->find_entry_at(rva));
218 uint32_t export_flags_ = 0;
219 uint32_t name_rva_ = 0;
220 uint32_t timestamp_ = 0;
221 uint16_t major_version_ = 0;
222 uint16_t minor_version_ = 0;
223 uint32_t ordinal_base_ = 0;
224 uint32_t exp_addr_table_rva_ = 0;
225 uint32_t exp_addr_table_cnt_ = 0;
226 uint32_t names_addr_table_rva_ = 0;
227 uint32_t names_addr_table_cnt_ = 0;
228 uint32_t ord_addr_table_rva_ = 0;
229 uint32_t max_ordinal_ = 0;
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
Class which represents a PE Export entry (cf. PE::Export).
Definition ExportEntry.hpp:33
uint32_t ord_addr_table_rva() const
RVA to the list of exported ordinals.
Definition Export.hpp:138
uint32_t export_flags() const
According to the PE specifications this value is reserved and should be set to 0.
Definition Export.hpp:74
Export & operator=(const Export &)
void minor_version(uint16_t minor_version)
Definition Export.hpp:154
ExportEntry & add_entry(const ExportEntry &exp)
Add the given export and return the newly created and added export.
uint16_t major_version() const
The major version number (can be user-defined).
Definition Export.hpp:84
Export & operator=(Export &&)=default
bool remove_entry(uint32_t rva)
Remove the export entry with the given RVA.
Definition Export.hpp:206
uint16_t minor_version() const
The minor version number (can be user-defined).
Definition Export.hpp:89
Export(Export &&)=default
uint32_t ordinal_base() const
The starting number for the exports. Usually this value is set to 1.
Definition Export.hpp:94
const ExportEntry * find_entry(const std::string &name) const
Find the export entry with the given name.
void name(std::string name)
Definition Export.hpp:162
ExportEntry & add_entry(std::string name, uint32_t rva)
Definition Export.hpp:190
void major_version(uint16_t major_version)
Definition Export.hpp:150
Export(const details::pe_export_directory_table &header)
const ExportEntry * find_entry(uint32_t ordinal) const
Find the export entry with the given ordinal number.
ref_iterator< entries_t &, ExportEntry * > it_entries
Definition Export.hpp:45
std::vector< std::unique_ptr< ExportEntry > > entries_t
Definition Export.hpp:44
Export(std::string name)
Definition Export.hpp:58
it_const_entries entries() const
Definition Export.hpp:108
void accept(Visitor &visitor) const override
void export_flags(uint32_t flags)
Definition Export.hpp:142
~Export() override=default
friend class Builder
Definition Export.hpp:40
Export(std::string name, const std::vector< ExportEntry > &entries)
Definition Export.hpp:50
uint32_t export_addr_table_cnt() const
Number of entries in the export address table.
Definition Export.hpp:123
const ExportEntry * find_entry_at(uint32_t rva) const
Find the export entry at the provided RVA.
uint32_t name_rva() const
Address of the ASCII DLL's name (RVA).
Definition Export.hpp:113
ExportEntry * find_entry(const std::string &name)
Definition Export.hpp:169
const_ref_iterator< const entries_t &, const ExportEntry * > it_const_entries
Definition Export.hpp:46
void ordinal_base(uint32_t ordinal_base)
Definition Export.hpp:158
friend class Parser
Definition Export.hpp:41
friend std::ostream & operator<<(std::ostream &os, const Export &exp)
bool remove_entry(const ExportEntry &exp)
Remove the given export entry.
uint32_t names_addr_table_rva() const
RVA to the list of exported names.
Definition Export.hpp:128
const std::string & name() const
The name of the library exported (e.g. KERNEL32.dll).
Definition Export.hpp:99
bool remove_entry(const std::string &name)
Remove the export entry with the given name.
Definition Export.hpp:198
it_entries entries()
Iterator over the ExportEntry.
Definition Export.hpp:104
uint32_t timestamp() const
The time and date that the export data was created.
Definition Export.hpp:79
uint32_t export_addr_table_rva() const
RVA of the export address table.
Definition Export.hpp:118
ExportEntry * find_entry_at(uint32_t rva)
Definition Export.hpp:183
void timestamp(uint32_t timestamp)
Definition Export.hpp:146
ExportEntry * find_entry(uint32_t ordinal)
Definition Export.hpp:176
uint32_t names_addr_table_cnt() const
Number of exports by name.
Definition Export.hpp:133
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
@ E
Definition AcceleratorCodes.hpp:82
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
#define LIEF_API
Definition visibility.h:41