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_OPTIONAL_HEADER_H
17#define LIEF_PE_OPTIONAL_HEADER_H
34struct pe32_optional_header;
35struct pe64_optional_header;
47 enum class DLL_CHARACTERISTICS:
size_t {
48 HIGH_ENTROPY_VA = 0x0020,
49 DYNAMIC_BASE = 0x0040,
50 FORCE_INTEGRITY = 0x0080,
52 NO_ISOLATION = 0x0200,
55 APPCONTAINER = 0x1000,
58 TERMINAL_SERVER_AWARE = 0x8000
61 enum class SUBSYSTEM:
size_t {
71 EFI_BOOT_SERVICE_DRIVER = 11,
72 EFI_RUNTIME_DRIVER = 12,
75 WINDOWS_BOOT_APPLICATION = 16
82 OptionalHeader&
operator=(
const OptionalHeader&) =
default;
85 static OptionalHeader
create(PE_TYPE type);
94 return major_linker_version_;
99 return minor_linker_version_;
114 return sizeof_initialized_data_;
123 return sizeof_uninitialized_data_;
157 return section_align_;
168 return major_os_version_;
173 return minor_os_version_;
178 return major_image_version_;
183 return minor_image_version_;
188 return major_subsys_version_;
193 return minor_subsys_version_;
199 return win32_version_value_;
206 return sizeof_image_;
211 return sizeof_headers_;
231 return dll_characteristics_;
239 return sizeof_stack_reserve_;
244 return sizeof_stack_commit_;
249 return sizeof_heap_reserve_;
254 return sizeof_heap_commit_;
259 return loader_flags_;
266 bool has(DLL_CHARACTERISTICS c)
const {
269 return (dll_characteristics() &
static_cast<uint32_t
>(c)) != 0;
274 void add(DLL_CHARACTERISTICS c) {
277 dll_characteristics(dll_characteristics() |
static_cast<uint32_t
>(c));
279 void remove(DLL_CHARACTERISTICS c) {
282 dll_characteristics(dll_characteristics() & (~
static_cast<uint32_t
>(c)));
290 major_linker_version_ = value;
294 minor_linker_version_ = value;
298 sizeof_code_ = value;
302 sizeof_initialized_data_ = value;
306 sizeof_uninitialized_data_ = value;
314 baseof_code_ = value;
318 baseof_data_ = value;
326 section_align_ = value;
334 major_os_version_ = value;
338 minor_os_version_ = value;
342 major_image_version_ = value;
346 minor_image_version_ = value;
350 major_subsys_version_ = value;
354 minor_subsys_version_ = value;
358 win32_version_value_ = value;
362 sizeof_image_ = value;
366 sizeof_headers_ = value;
378 dll_characteristics_ = value;
382 sizeof_stack_reserve_ = value;
386 sizeof_stack_commit_ = value;
390 sizeof_heap_reserve_ = value;
394 sizeof_heap_commit_ = value;
398 loader_flags_ = value;
402 nb_rva_size_ = value;
405 void accept(Visitor& visitor)
const override;
419 OptionalHeader() =
default;
421 PE_TYPE magic_ = PE_TYPE::PE32;
422 uint8_t major_linker_version_ = 0;
423 uint8_t minor_linker_version_ = 0;
424 uint32_t sizeof_code_ = 0;
425 uint32_t sizeof_initialized_data_ = 0;
426 uint32_t sizeof_uninitialized_data_ = 0;
427 uint32_t entrypoint_ = 0;
428 uint32_t baseof_code_ = 0;
429 uint32_t baseof_data_ = 0;
430 uint64_t imagebase_ = 0;
431 uint32_t section_align_ = 0;
432 uint32_t file_align_ = 0;
433 uint16_t major_os_version_ = 0;
434 uint16_t minor_os_version_ = 0;
435 uint16_t major_image_version_ = 0;
436 uint16_t minor_image_version_ = 0;
437 uint16_t major_subsys_version_ = 0;
438 uint16_t minor_subsys_version_ = 0;
439 uint32_t win32_version_value_ = 0;
440 uint32_t sizeof_image_ = 0;
441 uint32_t sizeof_headers_ = 0;
442 uint32_t checksum_ = 0;
443 SUBSYSTEM subsystem_ = SUBSYSTEM::UNKNOWN;
444 uint32_t dll_characteristics_ = 0;
445 uint64_t sizeof_stack_reserve_ = 0;
446 uint64_t sizeof_stack_commit_ = 0;
447 uint64_t sizeof_heap_reserve_ = 0;
448 uint64_t sizeof_heap_commit_ = 0;
449 uint32_t loader_flags_ = 0;
450 uint32_t nb_rva_size_ = 0;
Class which represents a PE binary This is the main interface to manage and modify a PE executable.
Definition PE/Binary.hpp:52
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
#define ENABLE_BITMASK_OPERATORS(X)
Definition enums.hpp:24
Definition CodeIntegrity.hpp:26
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
const char * to_string(DataDirectory::TYPES e)
PE_TYPE
Definition PE/enums.hpp:680
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41