LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
PE/ParserConfig.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_PARSER_CONFIG_H
17#define LIEF_PE_PARSER_CONFIG_H
18#include <string>
19#include <ostream>
20#include "LIEF/visibility.h"
21#include "LIEF/optional.hpp"
22
23namespace LIEF {
24namespace PE {
25
29 static const ParserConfig& default_conf() {
30 static const ParserConfig DEFAULT;
31 return DEFAULT;
32 }
33
35 static ParserConfig all() {
36 ParserConfig config;
37 config.parse_exceptions = true;
38 config.parse_arm64x_binary = true;
39 return config;
40 }
41
43 bool parse_signature = true;
44
46 bool parse_exports = true;
47
49 bool parse_imports = true;
50
52 bool parse_rsrc = true;
53
55 bool parse_reloc = true;
56
61 bool parse_exceptions = false;
62
67 bool parse_arm64x_binary = false;
68
73
74 std::string to_string() const;
75
76 LIEF_API friend std::ostream& operator<<(std::ostream& os,
77 const ParserConfig& config) {
78 os << config.to_string();
79 return os;
80 }
81};
82
83}
84}
85#endif
Definition optional.hpp:23
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
@ DEFAULT
Default implementation.
Definition PE/utils.hpp:35
LIEF namespace.
Definition Abstract/Binary.hpp:41
This structure is used to configure the behavior of the PE Parser (PE::Parser).
Definition PE/ParserConfig.hpp:27
optional< uint64_t > rebase
If set, this value holds the original image base from which the binary should be rebased....
Definition PE/ParserConfig.hpp:72
bool parse_imports
Whether to parse the PE Import Directory.
Definition PE/ParserConfig.hpp:49
bool parse_signature
Whether to parse the PE Authenticode signature.
Definition PE/ParserConfig.hpp:43
bool parse_exceptions
Whether to parse in-depth exception metadata.
Definition PE/ParserConfig.hpp:61
bool parse_rsrc
Whether to parse the PE resources tree.
Definition PE/ParserConfig.hpp:52
std::string to_string() const
bool parse_reloc
Whether to parse PE relocations.
Definition PE/ParserConfig.hpp:55
bool parse_exports
Whether to parse the PE Export Directory.
Definition PE/ParserConfig.hpp:46
friend std::ostream & operator<<(std::ostream &os, const ParserConfig &config)
Definition PE/ParserConfig.hpp:76
static ParserConfig all()
Returns a configuration that enables all optional parsing features.
Definition PE/ParserConfig.hpp:35
static const ParserConfig & default_conf()
Returns the default configuration for the PE Parser.
Definition PE/ParserConfig.hpp:29
bool parse_arm64x_binary
Whether to parse nested ARM64X binaries.
Definition PE/ParserConfig.hpp:67
#define LIEF_API
Definition visibility.h:45