Go to the documentation of this file.
16#ifndef LIEF_PE_FACTORY_H
17#define LIEF_PE_FACTORY_H
37 static std::unique_ptr<Factory>
create(PE_TYPE type);
42 sections_.push_back(std::unique_ptr<Section>(
new Section(section)));
46 Factory&
set_arch(Header::MACHINE_TYPES arch) {
47 pe_->header().machine(arch);
52 pe_->optional_header().addressof_entrypoint(ep);
56 std::unique_ptr<Binary>
get() {
61 return pe_->type() == PE_TYPE::PE32;
65 return pe_->type() == PE_TYPE::PE32_PLUS;
69 return pe_->optional_header().section_alignment();
73 return pe_->optional_header().file_alignment();
80 pe_(std::unique_ptr<Binary>(new Binary{}))
82 std::unique_ptr<Binary> process();
88 uint32_t sizeof_headers()
const;
90 std::vector<std::unique_ptr<Section>> sections_;
91 std::vector<Import> imports_;
92 std::unique_ptr<Binary> pe_;
This factory is used to create PE from scratch.
Definition Factory.hpp:30
Factory & set_arch(Header::MACHINE_TYPES arch)
Definition Factory.hpp:46
Factory & set_entrypoint(uint64_t ep)
Definition Factory.hpp:51
std::unique_ptr< Binary > get()
Definition Factory.hpp:56
bool is_64bit() const
Definition Factory.hpp:64
uint32_t file_align() const
Definition Factory.hpp:72
uint32_t section_align() const
Definition Factory.hpp:68
bool is_32bit() const
Definition Factory.hpp:60
Factory & add_section(const Section §ion)
Definition Factory.hpp:41
Factory & operator=(const Factory &)=delete
Factory(const Factory &)=delete
Factory & operator=(Factory &&)
static std::unique_ptr< Factory > create(PE_TYPE type)
Initiate the factory to construct a PE which the given type.
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:36
result< ok_t > ok_error_t
Opaque structure that is used by LIEF to avoid writing result<void> f(...). Instead,...
Definition errors.hpp:109
#define LIEF_API
Definition visibility.h:41