Go to the documentation of this file.
16#ifndef LIEF_PE_FACTORY_H
17#define LIEF_PE_FACTORY_H
36 static std::unique_ptr<Factory>
create(PE_TYPE type);
41 sections_.push_back(std::unique_ptr<Section>(
new Section(section)));
45 Factory&
set_arch(Header::MACHINE_TYPES arch) {
46 pe_->header().machine(arch);
51 pe_->optional_header().addressof_entrypoint(ep);
55 std::unique_ptr<Binary>
get() {
60 return pe_->type() == PE_TYPE::PE32;
64 return pe_->type() == PE_TYPE::PE32_PLUS;
68 return pe_->optional_header().section_alignment();
72 return pe_->optional_header().file_alignment();
79 pe_(std::unique_ptr<Binary>(new Binary{}))
81 std::unique_ptr<Binary> process();
87 uint32_t sizeof_headers()
const;
89 std::vector<std::unique_ptr<Section>> sections_;
90 std::vector<Import> imports_;
91 std::unique_ptr<Binary> pe_;
This factory is used to create PE from scratch.
Definition Factory.hpp:29
Factory & set_arch(Header::MACHINE_TYPES arch)
Definition Factory.hpp:45
Factory & set_entrypoint(uint64_t ep)
Definition Factory.hpp:50
std::unique_ptr< Binary > get()
Definition Factory.hpp:55
bool is_64bit() const
Definition Factory.hpp:63
uint32_t file_align() const
Definition Factory.hpp:71
uint32_t section_align() const
Definition Factory.hpp:67
bool is_32bit() const
Definition Factory.hpp:59
Factory & add_section(const Section §ion)
Definition Factory.hpp:40
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:39
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