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>>;
61 Export(
const details::pe_export_directory_table& header);
84 return major_version_;
89 return minor_version_;
98 const std::string&
name()
const {
118 return exp_addr_table_rva_;
123 return exp_addr_table_cnt_;
128 return names_addr_table_rva_;
133 return names_addr_table_cnt_;
138 return ord_addr_table_rva_;
142 export_flags_ = flags;
162 name_ = std::move(
name);
170 static_cast<const Export*
>(
this)->find_entry(
name)
179 static_cast<const Export*
>(
this)->find_entry(ordinal)
188 static_cast<const Export*
>(
this)->find_entry_at(rva)
223 uint32_t export_flags_ = 0;
224 uint32_t name_rva_ = 0;
225 uint32_t timestamp_ = 0;
226 uint16_t major_version_ = 0;
227 uint16_t minor_version_ = 0;
228 uint32_t ordinal_base_ = 0;
229 uint32_t exp_addr_table_rva_ = 0;
230 uint32_t exp_addr_table_cnt_ = 0;
231 uint32_t names_addr_table_rva_ = 0;
232 uint32_t names_addr_table_cnt_ = 0;
233 uint32_t ord_addr_table_rva_ = 0;
234 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:137
uint32_t export_flags() const
According to the PE specifications this value is reserved and should be set to 0.
Definition Export.hpp:73
Export & operator=(const Export &)
void minor_version(uint16_t minor_version)
Definition Export.hpp:153
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:83
Export & operator=(Export &&)=default
bool remove_entry(uint32_t rva)
Remove the export entry with the given RVA.
Definition Export.hpp:211
uint16_t minor_version() const
The minor version number (can be user-defined).
Definition Export.hpp:88
Export(Export &&)=default
uint32_t ordinal_base() const
The starting number for the exports. Usually this value is set to 1.
Definition Export.hpp:93
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:161
ExportEntry & add_entry(std::string name, uint32_t rva)
Definition Export.hpp:195
void major_version(uint16_t major_version)
Definition Export.hpp:149
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:107
void accept(Visitor &visitor) const override
void export_flags(uint32_t flags)
Definition Export.hpp:141
~Export() override=default
friend class Builder
Definition Export.hpp:40
Export(std::string name, const std::vector< ExportEntry > &entries)
Definition Export.hpp:51
uint32_t export_addr_table_cnt() const
Number of entries in the export address table.
Definition Export.hpp:122
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:112
ExportEntry * find_entry(const std::string &name)
Definition Export.hpp:168
void ordinal_base(uint32_t ordinal_base)
Definition Export.hpp:157
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:127
const std::string & name() const
The name of the library exported (e.g. KERNEL32.dll).
Definition Export.hpp:98
bool remove_entry(const std::string &name)
Remove the export entry with the given name.
Definition Export.hpp:203
it_entries entries()
Iterator over the ExportEntry.
Definition Export.hpp:103
uint32_t timestamp() const
The time and date that the export data was created.
Definition Export.hpp:78
const_ref_iterator< const entries_t &, const ExportEntry * > it_const_entries
Definition Export.hpp:46
uint32_t export_addr_table_rva() const
RVA of the export address table.
Definition Export.hpp:117
ExportEntry * find_entry_at(uint32_t rva)
Definition Export.hpp:186
void timestamp(uint32_t timestamp)
Definition Export.hpp:145
ExportEntry * find_entry(uint32_t ordinal)
Definition Export.hpp:177
uint32_t names_addr_table_cnt() const
Number of exports by name.
Definition Export.hpp:132
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:52
Definition Visitor.hpp:212
Iterator which returns reference on container's values.
Definition iterators.hpp:45
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:286
#define LIEF_API
Definition visibility.h:43