LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_PE_BINARY_H
17#define LIEF_PE_BINARY_H
61 public:
using sections_t = std::vector<std::unique_ptr<Section>>;
64 using it_sections = ref_iterator<sections_t&, Section*>;
67 using it_const_sections = const_ref_iterator<const sections_t&, const Section*>;
70 using data_directories_t = std::vector<std::unique_ptr<DataDirectory>>;
73 using it_data_directories = ref_iterator<data_directories_t&, DataDirectory*>;
76 using it_const_data_directories = const_ref_iterator<const data_directories_t&, const DataDirectory*>;
79 using relocations_t = std::vector<std::unique_ptr<Relocation>>;
82 using it_relocations = ref_iterator<relocations_t&, Relocation*>;
85 using it_const_relocations = const_ref_iterator<const relocations_t&, const Relocation*>;
88 using imports_t = std::vector<Import>;
91 using it_imports = ref_iterator<imports_t&>;
94 using it_const_imports = const_ref_iterator<const imports_t&>;
97 using delay_imports_t = std::vector<DelayImport>;
100 using it_delay_imports = ref_iterator<delay_imports_t&>;
103 using it_const_delay_imports = const_ref_iterator<const delay_imports_t&>;
106 using debug_entries_t = std::vector<std::unique_ptr<Debug>>;
109 using it_debug_entries = ref_iterator<debug_entries_t&, Debug*>;
112 using it_const_debug_entries = const_ref_iterator<const debug_entries_t&, const Debug*>;
115 using symbols_t = std::vector<std::unique_ptr<Symbol>>;
118 using it_symbols = ref_iterator<symbols_t&, Symbol*>;
121 using it_const_symbols = const_ref_iterator<const symbols_t&, const Symbol*>;
124 using strings_table_t = std::vector<COFFString>;
127 using it_strings_table = ref_iterator<strings_table_t&>;
130 using it_const_strings_table = const_ref_iterator<const strings_table_t&>;
133 using signatures_t = std::vector<Signature>;
136 using it_signatures = ref_iterator<signatures_t&>;
139 using it_const_signatures = const_ref_iterator<const signatures_t&>;
142 using exceptions_t = std::vector<std::unique_ptr<ExceptionInfo>>;
145 using it_exceptions = ref_iterator<exceptions_t&, ExceptionInfo*>;
148 using it_const_exceptions = const_ref_iterator<const exceptions_t&, const ExceptionInfo*>;
169 uint64_t rva = VA - optional_header().imagebase();
170 return rva_to_offset(rva);
183 return optional_header().imagebase();
190 return const_cast<Section*
>(
static_cast<const Binary*
>(
this)->section_from_offset(offset));
198 return const_cast<Section*
>(
static_cast<const Binary*
>(
this)->section_from_rva(virtual_address));
232 return optional_header_;
236 return optional_header_;
261 TLS&
tls(
const TLS& tls);
267 return tls_ !=
nullptr;
277 return !imports_.empty();
284 return !signatures_.empty();
291 return export_ !=
nullptr;
296 return resources_ !=
nullptr;
301 return exceptions_dir()->size() != 0;
308 return !relocations_.empty();
313 return !debug_.empty();
318 return loadconfig_ !=
nullptr;
344 Signature::VERIFICATION_CHECKS checks = Signature::VERIFICATION_CHECKS::DEFAULT)
const;
356 Signature::VERIFICATION_CHECKS checks = Signature::VERIFICATION_CHECKS::DEFAULT)
const;
357 std::vector<uint8_t>
authentihash(ALGORITHMS algo)
const;
364 return export_.get();
368 return export_.get();
384 return strings_table_;
388 return strings_table_;
396 auto it = std::find_if(strings_table_.begin(), strings_table_.end(),
397 [offset] (
const COFFString& item) {
398 return offset == item.offset();
401 return it == strings_table_.end() ? nullptr : &*it;
405 return const_cast<Binary*
>(
this)->find_coff_string(offset);
410 return resources_.get();
414 return resources_.get();
431 return const_cast<Section*
>(
static_cast<const Binary*
>(
this)->get_section(name));
439 return const_cast<Section*
>(
static_cast<const Binary*
>(
this)->import_section());
441 void remove_section(
const std::string& name,
bool clear =
false)
override;
448 void remove(
const Section& section,
bool clear =
false);
474 return data_directories_;
478 return data_directories_;
483 return const_cast<DataDirectory*
>(
static_cast<const Binary*
>(
this)->data_directory(type));
486 bool has(DataDirectory::TYPES type)
const {
489 return data_directory(type) !=
nullptr;
491 it_debug_entries
debug() {
497 it_const_debug_entries
debug()
const {
516 return loadconfig_.get();
520 return loadconfig_.get();
522 span<const uint8_t>
overlay()
const {
534 return overlay_offset_;
536 span<const uint8_t>
dos_stub()
const {
545 void dos_stub(std::vector<uint8_t> content) {
548 dos_stub_ = std::move(content);
553 return rich_header_.get();
557 return rich_header_.get();
565 return rich_header_ !=
nullptr;
576 Import*
get_import(
const std::string& import_name) {
581 return const_cast<Import*
>(
static_cast<const Binary*
>(
this)->get_import(import_name));
584 const Import*
get_import(
const std::string& import_name)
const;
585 bool has_import(
const std::string& import_name)
const {
588 return get_import(import_name) !=
nullptr;
593 return !delay_imports_.empty();
598 return delay_imports_;
602 return delay_imports_;
608 return const_cast<DelayImport*
>(
static_cast<const Binary*
>(
this)->get_delay_import(import_name));
615 return get_delay_import(import_name) !=
nullptr;
620 imports_.emplace_back(name);
621 return imports_.back();
633 std::unique_ptr<Builder>
write(
const std::string& filename) {
636 return write(filename, Builder::config_t());
638 std::unique_ptr<Builder>
write(
const std::string& filename,
642 const Builder::config_t& config);
643 std::unique_ptr<Builder>
write(std::ostream& os) {
649 return write(os, Builder::config_t());
652 std::unique_ptr<Builder>
write(std::ostream& os,
653 const Builder::config_t& config);
655 void accept(Visitor& visitor)
const override;
656 void patch_address(uint64_t address,
const std::vector<uint8_t>& patch_value,
663 VA_TYPES addr_type = VA_TYPES::AUTO)
override;
665 void patch_address(uint64_t address, uint64_t patch_value,
size_t size =
sizeof(uint64_t),
673 VA_TYPES addr_type = VA_TYPES::AUTO)
override;
675 void fill_address(uint64_t address,
size_t size, uint8_t value = 0,
678 VA_TYPES addr_type = VA_TYPES::AUTO);
686 uint64_t virtual_address, uint64_t size,
687 Binary::VA_TYPES addr_type = Binary::VA_TYPES::AUTO)
const override;
691 return optional_header_.imagebase() + optional_header_.addressof_entrypoint();
693 bool is_pie()
const override {
696 return optional_header_.has(OptionalHeader::DLL_CHARACTERISTICS::DYNAMIC_BASE);
698 bool has_nx()
const override {
701 return optional_header_.has(OptionalHeader::DLL_CHARACTERISTICS::NX_COMPAT);
708 return data_directory(DataDirectory::TYPES::EXPORT_TABLE);
712 return data_directory(DataDirectory::TYPES::EXPORT_TABLE);
717 return data_directory(DataDirectory::TYPES::IMPORT_TABLE);
721 return data_directory(DataDirectory::TYPES::IMPORT_TABLE);
726 return data_directory(DataDirectory::TYPES::RESOURCE_TABLE);
730 return data_directory(DataDirectory::TYPES::RESOURCE_TABLE);
735 return data_directory(DataDirectory::TYPES::EXCEPTION_TABLE);
739 return data_directory(DataDirectory::TYPES::EXCEPTION_TABLE);
745 return data_directory(DataDirectory::TYPES::CERTIFICATE_TABLE);
749 return data_directory(DataDirectory::TYPES::CERTIFICATE_TABLE);
754 return data_directory(DataDirectory::TYPES::BASE_RELOCATION_TABLE);
758 return data_directory(DataDirectory::TYPES::BASE_RELOCATION_TABLE);
763 return data_directory(DataDirectory::TYPES::DEBUG_DIR);
767 return data_directory(DataDirectory::TYPES::DEBUG_DIR);
772 return data_directory(DataDirectory::TYPES::TLS_TABLE);
776 return data_directory(DataDirectory::TYPES::TLS_TABLE);
781 return data_directory(DataDirectory::TYPES::LOAD_CONFIG_TABLE);
785 return data_directory(DataDirectory::TYPES::LOAD_CONFIG_TABLE);
790 return data_directory(DataDirectory::TYPES::IAT);
794 return data_directory(DataDirectory::TYPES::IAT);
799 return data_directory(DataDirectory::TYPES::DELAY_IMPORT_DESCRIPTOR);
803 return data_directory(DataDirectory::TYPES::DELAY_IMPORT_DESCRIPTOR);
838 return const_cast<Binary*
>(
this)->find_exception_at(rva);
859 return nested_.get();
863 return nested_.get();
866 static bool classof(
const LIEF::Binary* bin) {
867 return bin->
format() == Binary::FORMATS::PE;
870 std::ostream&
print(std::ostream& os)
const override;
872 LIEF_LOCAL std::unique_ptr<Binary> move_nested_pe_binary() {
877 auto ret = std::move(nested_);
883 struct sizing_info_t {
884 uint32_t nb_tls_callbacks = 0;
885 uint32_t load_config_size = 0;
887 result<uint64_t> make_space_for_new_section();
895 LIEF::Header get_abstract_header()
const override {
906 std::vector<std::string> get_abstract_imported_libraries()
const override;
908 void update_lookup_address_table_offset();
910 void shift(uint64_t from, uint64_t by);
912 PE_TYPE type_ = PE_TYPE::PE32_PLUS;
913 DosHeader dos_header_;
915 OptionalHeader optional_header_;
917 int32_t available_sections_space_ = 0;
919 signatures_t signatures_;
920 sections_t sections_;
921 data_directories_t data_directories_;
923 strings_table_t strings_table_;
924 relocations_t relocations_;
926 delay_imports_t delay_imports_;
927 debug_entries_t debug_;
928 exceptions_t exceptions_;
929 uint64_t overlay_offset_ = 0;
930 std::vector<uint8_t> overlay_;
931 std::vector<uint8_t> dos_stub_;
932 std::vector<uint8_t> section_offset_padding_;
934 std::unique_ptr<RichHeader> rich_header_;
935 std::unique_ptr<Export> export_;
936 std::unique_ptr<ResourceNode> resources_;
937 std::unique_ptr<TLS> tls_;
938 std::unique_ptr<LoadConfiguration> loadconfig_;
939 std::unique_ptr<Binary> nested_;
941 sizing_info_t sizing_info_;
std::vector< Function > functions_t
Definition Abstract/Binary.hpp:67
FORMATS format() const
Executable format (ELF, PE, Mach-O) of the underlying binary.
Definition Abstract/Binary.hpp:109
std::vector< Symbol * > symbols_t
Internal container.
Definition Abstract/Binary.hpp:79
std::vector< Section * > sections_t
Internal container.
Definition Abstract/Binary.hpp:70
std::vector< Relocation * > relocations_t
Internal container.
Definition Abstract/Binary.hpp:88
Class which represents a PE binary This is the main interface to manage and modify a PE executable.
Definition PE/Binary.hpp:56
OptionalHeader & optional_header()
Header that follows the header(). It is named optional from the COFF specfication but it is mandatory...
Definition PE/Binary.hpp:231
const DataDirectory * export_dir() const
Definition PE/Binary.hpp:711
void remove_all_relocations()
Remove all the relocations.
DataDirectory * export_dir()
Return the data directory associated with the export table.
Definition PE/Binary.hpp:707
it_exceptions exceptions()
Iterator over the exception (_RUNTIME_FUNCTION) functions.
Definition PE/Binary.hpp:822
std::unique_ptr< Builder > write(std::ostream &os)
Reconstruct the binary object and write the raw PE in os stream.
Definition PE/Binary.hpp:648
std::vector< uint8_t > authentihash(ALGORITHMS algo) const
Compute the authentihash according to the algorithm provided in the first parameter.
void remove_tls()
Remove the TLS from the binary.
const LoadConfiguration * load_configuration() const
Retrun the LoadConfiguration object or a nullptr if the binary does not use the LoadConfiguration.
Definition PE/Binary.hpp:515
std::ostream & print(std::ostream &os) const override
it_const_delay_imports delay_imports() const
Definition PE/Binary.hpp:601
it_const_debug_entries debug() const
Definition PE/Binary.hpp:497
void remove_section(const std::string &name, bool clear=false) override
Delete the section with the given name.
void patch_address(uint64_t address, uint64_t patch_value, size_t size=sizeof(uint64_t), VA_TYPES addr_type=VA_TYPES::AUTO) override
Patch the address with the given value.
bool is_pie() const override
Check if the binary is position independent.
Definition PE/Binary.hpp:695
LIEF::Binary::functions_t ctor_functions() const override
Return the list of the binary constructors.
DataDirectory * exceptions_dir()
Return the data directory associated with the exceptions.
Definition PE/Binary.hpp:734
void dos_stub(std::vector< uint8_t > content)
Update the DOS stub content.
Definition PE/Binary.hpp:547
DataDirectory * delay_dir()
Return the data directory associated with delayed imports.
Definition PE/Binary.hpp:798
it_imports imports()
Return an iterator over the binary imports.
Definition PE/Binary.hpp:569
bool has_resources() const
Check if the current binary has resources.
Definition PE/Binary.hpp:295
const DataDirectory * import_dir() const
Definition PE/Binary.hpp:720
TLS & tls(const TLS &tls)
Set a TLS object in the current Binary.
const ResourceNode * resources() const
Definition PE/Binary.hpp:413
bool has_debug() const
Check if the current binary contains debug information.
Definition PE/Binary.hpp:312
const DataDirectory * iat_dir() const
Definition PE/Binary.hpp:793
DelayImport * get_delay_import(const std::string &import_name)
Returns the DelayImport matching the given name. If it can't be found, it returns a nullptr.
Definition PE/Binary.hpp:607
it_const_exceptions exceptions() const
Definition PE/Binary.hpp:826
const DataDirectory * tls_dir() const
Definition PE/Binary.hpp:775
const DataDirectory * debug_dir() const
Definition PE/Binary.hpp:766
bool has_relocations() const
Check if the current binary has relocations.
Definition PE/Binary.hpp:307
bool has_exports() const
Check if the current binary has exports.
Definition PE/Binary.hpp:290
uint64_t virtual_size() const
Compute the binary's virtual size. It should match OptionalHeader::sizeof_image.
uint64_t rva_to_offset(uint64_t RVA) const
Convert a Relative Virtual Address into an offset.
result< ResourcesManager > resources_manager() const
Return the ResourcesManager (class to manage resources more easily than the tree one)
bool remove_import(const std::string &name)
Remove the imported library with the given name
const COFFString * find_coff_string(uint32_t offset) const
Definition PE/Binary.hpp:404
bool clear_debug()
Remove all debug info from the binary.
result< uint64_t > offset_to_virtual_address(uint64_t offset, uint64_t slide=0) const override
Convert the given offset into a virtual address.
it_const_imports imports() const
Definition PE/Binary.hpp:573
const OptionalHeader & optional_header() const
Definition PE/Binary.hpp:235
it_signatures signatures()
Definition PE/Binary.hpp:332
Signature::VERIFICATION_FLAGS verify_signature(const Signature &sig, Signature::VERIFICATION_CHECKS checks=Signature::VERIFICATION_CHECKS::DEFAULT) const
Verify the binary with the Signature object provided in the first parameter. It can be used to verify...
Debug * add_debug_info(const Debug &entry)
Add a new debug entry.
span< const uint8_t > overlay() const
Return the overlay content.
Definition PE/Binary.hpp:524
bool is_arm64x() const
True if this binary is compiled in ARM64X mode (contains both ARM64 and ARM64EC code)
bool is_arm64ec() const
True if this binary is compiled in ARM64EC mode (emulation compatible)
DataDirectory * rsrc_dir()
Return the data directory associated with the resources tree.
Definition PE/Binary.hpp:725
span< const uint8_t > get_content_from_virtual_address(uint64_t virtual_address, uint64_t size, Binary::VA_TYPES addr_type=Binary::VA_TYPES::AUTO) const override
Return the content located at the provided virtual address.
const DataDirectory * data_directory(DataDirectory::TYPES type) const
DataDirectory * tls_dir()
Return the data directory associated with TLS.
Definition PE/Binary.hpp:771
const DataDirectory * rsrc_dir() const
Definition PE/Binary.hpp:729
void fill_address(uint64_t address, size_t size, uint8_t value=0, VA_TYPES addr_type=VA_TYPES::AUTO)
Fill the content at the provided with a fixed value.
bool has_rich_header() const
Check if the current binary has a RichHeader object.
Definition PE/Binary.hpp:564
bool has_signatures() const
Check if the current binary contains signatures.
Definition PE/Binary.hpp:283
bool has_delay_imports() const
Check if the current binary contains delay imports.
Definition PE/Binary.hpp:592
const DataDirectory * load_config_dir() const
Definition PE/Binary.hpp:784
void rich_header(const RichHeader &rich_header)
Set a RichHeader object in the current Binary.
DataDirectory * relocation_dir()
Return the data directory associated with the relocation table.
Definition PE/Binary.hpp:753
const DataDirectory * exceptions_dir() const
Definition PE/Binary.hpp:738
TLS * tls()
Return a reference to the TLS object.
Definition PE/Binary.hpp:254
it_const_data_directories data_directories() const
Definition PE/Binary.hpp:477
uint64_t entrypoint() const override
Return the binary's entrypoint (It is the same value as OptionalHeader::addressof_entrypoint.
Definition PE/Binary.hpp:690
Signature::VERIFICATION_FLAGS verify_signature(Signature::VERIFICATION_CHECKS checks=Signature::VERIFICATION_CHECKS::DEFAULT) const
Verify the binary against the embedded signature(s) (if any) First, it checks that the embedded signa...
const ExceptionInfo * find_exception_at(uint32_t rva) const
Definition PE/Binary.hpp:837
const Import * get_import(const std::string &import_name) const
uint64_t last_section_offset() const
const DataDirectory * delay_dir() const
Definition PE/Binary.hpp:802
COFFString * find_coff_string(uint32_t offset)
Try to find the COFF string at the given offset in the COFF string table.
Definition PE/Binary.hpp:395
static bool classof(const LIEF::Binary *bin)
Definition PE/Binary.hpp:866
const Section * get_section(const std::string &name) const
it_symbols symbols()
Return binary Symbols.
Definition PE/Binary.hpp:374
Section * import_section()
Definition PE/Binary.hpp:438
void accept(Visitor &visitor) const override
Method so that a visitor can visit us.
LIEF::Binary::functions_t functions() const
All functions found in the binary
LIEF::Binary::functions_t exception_functions() const
Functions found in the Exception table directory.
void patch_address(uint64_t address, const std::vector< uint8_t > &patch_value, VA_TYPES addr_type=VA_TYPES::AUTO) override
Patch the content at virtual address address with patch_value.
const Section * section_from_offset(uint64_t offset) const
uint32_t compute_checksum() const
Re-compute the value of OptionalHeader::checksum. If both values do not match, it could mean that the...
std::unique_ptr< Builder > write(std::ostream &os, const Builder::config_t &config)
Import & add_import(const std::string &name)
Add an imported library (i.e. DLL) to the binary.
Definition PE/Binary.hpp:619
ResourceNode * set_resources(std::unique_ptr< ResourceNode > root)
span< uint8_t > overlay()
Definition PE/Binary.hpp:528
uint64_t overlay_offset() const
Return the original overlay offset.
Definition PE/Binary.hpp:533
const DelayImport * get_delay_import(const std::string &import_name) const
Section * section_from_rva(uint64_t virtual_address)
Find the section associated that encompasses the given RVA.
Definition PE/Binary.hpp:197
Section * add_section(const Section §ion)
Add a section to the binary and return the section added.
const Section * import_section() const
Return the section associated with import table or a nullptr if the binary does not have an import ta...
const Export * get_export() const
Definition PE/Binary.hpp:367
PE_TYPE type() const
Return PE32 or PE32+
Definition PE/Binary.hpp:156
bool has_tls() const
Check if the current binary has a TLS object.
Definition PE/Binary.hpp:266
Export & set_export(const Export &export_table)
DataDirectory * data_directory(DataDirectory::TYPES type)
Return the DataDirectory with the given type (or index)
Definition PE/Binary.hpp:482
Section * section_from_offset(uint64_t offset)
Find the section associated that encompasses the given offset.
Definition PE/Binary.hpp:189
bool has_exceptions() const
Check if the current binary has exceptions.
Definition PE/Binary.hpp:300
it_delay_imports delay_imports()
Return an iterator over the binary's delay imports.
Definition PE/Binary.hpp:597
it_const_symbols symbols() const
Definition PE/Binary.hpp:378
const RichHeader * rich_header() const
Definition PE/Binary.hpp:556
bool is_reproducible_build() const
Check if the current binary is reproducible build, replacing timestamps by a compile hash.
std::unique_ptr< Builder > write(const std::string &filename, const Builder::config_t &config)
Reconstruct the binary object with the given configuration and write it in filename
DataDirectory * debug_dir()
Return the data directory associated with the debug table.
Definition PE/Binary.hpp:762
uint64_t va_to_offset(uint64_t VA) const
Convert the absolute virtual address into an offset.
Definition PE/Binary.hpp:168
const DataDirectory * relocation_dir() const
Definition PE/Binary.hpp:757
Binary * nested_pe_binary()
Definition PE/Binary.hpp:862
DosHeader & dos_header()
Return a reference to the PE::DosHeader object.
Definition PE/Binary.hpp:212
it_const_relocations relocations() const
Definition PE/Binary.hpp:462
const Section * section_from_rva(uint64_t virtual_address) const
DataDirectory * iat_dir()
Return the data directory associated with the IAT.
Definition PE/Binary.hpp:789
DataDirectory * cert_dir()
Return the data directory associated with the certificate table (authenticode)
Definition PE/Binary.hpp:744
bool has_nx() const override
Check if the binary uses NX protection.
Definition PE/Binary.hpp:700
span< const uint8_t > dos_stub() const
Return the DOS stub content.
Definition PE/Binary.hpp:538
Header & header()
Return a reference to the PE::Header object.
Definition PE/Binary.hpp:221
it_relocations relocations()
Return an iterator over the PE's Relocation.
Definition PE/Binary.hpp:458
uint64_t imagebase() const override
Return binary's imagebase. 0 if not relevant.
Definition PE/Binary.hpp:182
bool has_configuration() const
Check if the current binary has a load configuration.
Definition PE/Binary.hpp:317
const CodeViewPDB * codeview_pdb() const
Return the CodeViewPDB object if present.
const TLS * tls() const
Definition PE/Binary.hpp:258
ResourceNode * resources()
Return resources as a tree or a nullptr if there is no resources.
Definition PE/Binary.hpp:409
ResourceNode * set_resources(const ResourceNode &root)
Change or set the current resource tree with the new one provided in parameter.
bool has(DataDirectory::TYPES type) const
Check if the current binary has the given DataDirectory::TYPES.
Definition PE/Binary.hpp:488
LoadConfiguration * load_configuration()
Definition PE/Binary.hpp:519
uint32_t sizeof_headers() const
Compute the size of all the headers.
bool remove_debug(const Debug &entry)
Remove a specific debug entry.
DataDirectory * load_config_dir()
Return the data directory associated with the load config.
Definition PE/Binary.hpp:780
const Binary * nested_pe_binary() const
If the current binary contains dynamic relocations (e.g. LIEF::PE::DynamicFixupARM64X),...
Definition PE/Binary.hpp:858
Import * get_import(const std::string &import_name)
Return the Import matching the provided name (case sensitive)
Definition PE/Binary.hpp:580
std::unique_ptr< Builder > write(const std::string &filename)
Reconstruct the binary object and write the raw PE in filename
Definition PE/Binary.hpp:635
it_strings_table coff_string_table()
Definition PE/Binary.hpp:387
it_const_signatures signatures() const
Return an iterator over the Signature object(s) if the binary is signed.
Definition PE/Binary.hpp:328
it_debug_entries debug()
Return an iterator over the Debug entries.
Definition PE/Binary.hpp:493
it_const_sections sections() const
Definition PE/Binary.hpp:207
it_const_strings_table coff_string_table() const
Iterator over the strings located in the COFF string table.
Definition PE/Binary.hpp:383
bool has_delay_import(const std::string &import_name) const
True if the binary delay-imports the given library name
Definition PE/Binary.hpp:614
bool has_imports() const
Check if the current binary contains imports.
Definition PE/Binary.hpp:276
ExceptionInfo * find_exception_at(uint32_t rva)
Try to find the exception info at the given RVA.
void remove(const Section §ion, bool clear=false)
Remove the given section.
const Header & header() const
Definition PE/Binary.hpp:225
const DataDirectory * cert_dir() const
Definition PE/Binary.hpp:748
it_data_directories data_directories()
Return an iterator over the DataDirectory present in the Binary.
Definition PE/Binary.hpp:473
it_sections sections()
Return an iterator over the PE's Section.
Definition PE/Binary.hpp:203
void remove_all_imports()
Remove all libraries in the binary.
Definition PE/Binary.hpp:630
Export * get_export()
Return the Export object.
Definition PE/Binary.hpp:363
span< uint8_t > dos_stub()
Definition PE/Binary.hpp:542
bool has_import(const std::string &import_name) const
True if the binary imports the given library name
Definition PE/Binary.hpp:587
DataDirectory * import_dir()
Return the data directory associated with the import table.
Definition PE/Binary.hpp:716
Relocation & add_relocation(const Relocation &relocation)
Add a new PE Relocation.
Section * get_section(const std::string &name)
Return binary's section from its name. If the secion can't be found, return a nullptr.
Definition PE/Binary.hpp:430
RichHeader * rich_header()
Return a reference to the RichHeader object.
Definition PE/Binary.hpp:552
const DosHeader & dos_header() const
Definition PE/Binary.hpp:216
CodeView PDB specialization.
Definition CodeViewPDB.hpp:35
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:40
This class is the base class for any exception or runtime function entry.
Definition ExceptionInfo.hpp:33
Class which represents a PE Export.
Definition Export.hpp:38
This factory is used to create PE from scratch.
Definition Factory.hpp:30
This class represents the load configuration data associated with the IMAGE_LOAD_CONFIG_DIRECTORY.
Definition LoadConfiguration.hpp:46
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
Class which represents the Base Relocation Block We usually find this structure in the ....
Definition PE/Relocation.hpp:42
Class which represents a Data Node in the PE resources tree.
Definition ResourceData.hpp:33
Definition ResourceDirectory.hpp:33
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:45
Class which represents the PE Thread Local Storage.
Definition TLS.hpp:43
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
PE_TYPE
Definition PE/enums.hpp:22
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42