Go to the documentation of this file.
16#ifndef LIEF_PE_PARSER_H
17#define LIEF_PE_PARSER_H
41struct pe_resource_directory_table;
49 static constexpr size_t MAX_DATA_SIZE = 3_GB;
53 static constexpr size_t MAX_TLS_CALLBACKS = 3000;
56 static constexpr size_t MAX_DLL_NAME_SIZE = 255;
57 static constexpr size_t MAX_PADDING_SIZE = 1_GB;
76 public:
static std::unique_ptr<Binary>
parse(
const std::string& filename,
79 const ParserConfig& conf = ParserConfig::all());
80 static std::unique_ptr<Binary>
parse(std::vector<uint8_t> data,
83 const ParserConfig& conf = ParserConfig::all());
84 static std::unique_ptr<Binary>
parse(std::unique_ptr<BinaryStream> stream,
87 const ParserConfig& conf = ParserConfig::all());
93 Parser(
const std::string& file);
94 Parser(std::vector<uint8_t> data);
95 Parser(std::unique_ptr<BinaryStream> stream);
102 template<
typename PE_T>
108 template<
typename PE_T>
113 template<
typename PE_T>
116 template<
typename PE_T>
119 template<
typename PE_T>
122 template<
typename PE_T>
123 ok_error_t parse_delay_names_table(DelayImport&
import, uint32_t names_offset);
128 std::unique_ptr<Debug> parse_code_view(
const details::pe_debug& debug_info);
129 std::unique_ptr<Debug> parse_pogo(
const details::pe_debug& debug_info);
130 std::unique_ptr<Debug> parse_repro(
const details::pe_debug& debug_info);
132 template<
typename PE_T>
135 template<
typename PE_T>
147 std::unique_ptr<ResourceNode> parse_resource_node(
148 const details::pe_resource_directory_table& directory_table,
149 uint32_t base_offset, uint32_t current_offset, uint32_t depth = 0);
152 PE_TYPE type_ = PE_TYPE::PE32_PLUS;
153 std::unique_ptr<Binary> binary_;
154 std::set<uint32_t> resource_visited_;
155 std::unique_ptr<BinaryStream> stream_;
156 ParserConfig config_;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
Class which represents a PE binary This is the main interface to manage and modify a PE executable.
Definition PE/Binary.hpp:52
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:38
Class that represents a PE delayed import.
Definition DelayImport.hpp:36
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
static bool is_valid_import_name(const std::string &name)
Check if the given name is a valid import.
static bool is_valid_dll_name(const std::string &name)
Check if the given name is a valid DLL name.
static std::unique_ptr< Binary > parse(std::unique_ptr< BinaryStream > stream, const ParserConfig &conf=ParserConfig::all())
Parse a PE binary from the given BinaryStream.
static std::unique_ptr< Binary > parse(std::vector< uint8_t > data, const ParserConfig &conf=ParserConfig::all())
Parse a PE binary from a data buffer.
Parser(const Parser ©)=delete
static std::unique_ptr< Binary > parse(const std::string &filename, const ParserConfig &conf=ParserConfig::all())
Parse a PE binary from the given filename.
Parser & operator=(const Parser ©)=delete
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:36
Definition CodeIntegrity.hpp:26
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
PE_TYPE
Definition PE/enums.hpp:680
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