LIEF: Library to Instrument Executable Formats
Version 0.17.0
Loading...
Searching...
No Matches
lief-static-install
include
LIEF
PE
OptionalHeader.h
Go to the documentation of this file.
1
/* Copyright 2017 - 2024 R. Thomas
2
* Copyright 2017 - 2024 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 C_LIEF_PE_OPTIONAL_HEADER_H
17
#define C_LIEF_PE_OPTIONAL_HEADER_H
18
#include <inttypes.h>
19
20
#include "
LIEF/PE/enums.h
"
21
#include "
LIEF/visibility.h
"
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
enum
LIEF_PE_DLL_CHARACTERISTICS
{
28
LIEF_PE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
= 0x0020,
29
LIEF_PE_DLL_CHARACTERISTICS_DYNAMIC_BASE
= 0x0040,
30
LIEF_PE_DLL_CHARACTERISTICS_FORCE_INTEGRITY
= 0x0080,
31
LIEF_PE_DLL_CHARACTERISTICS_NX_COMPAT
= 0x0100,
32
LIEF_PE_DLL_CHARACTERISTICS_NO_ISOLATION
= 0x0200,
33
LIEF_PE_DLL_CHARACTERISTICS_NO_SEH
= 0x0400,
34
LIEF_PE_DLL_CHARACTERISTICS_NO_BIND
= 0x0800,
35
LIEF_PE_DLL_CHARACTERISTICS_APPCONTAINER
= 0x1000,
36
LIEF_PE_DLL_CHARACTERISTICS_WDM_DRIVER
= 0x2000,
37
LIEF_PE_DLL_CHARACTERISTICS_GUARD_CF
= 0x4000,
38
LIEF_PE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE
= 0x8000
39
};
40
41
enum
LIEF_PE_SUBSYSTEM
{
42
LIEF_PE_SUBSYSTEM_UNKNOWN
= 0,
43
LIEF_PE_SUBSYSTEM_NATIVE
= 1,
44
LIEF_PE_SUBSYSTEM_WINDOWS_GUI
= 2,
45
LIEF_PE_SUBSYSTEM_WINDOWS_CUI
= 3,
46
LIEF_PE_SUBSYSTEM_OS2_CUI
= 5,
47
LIEF_PE_SUBSYSTEM_POSIX_CUI
= 7,
48
LIEF_PE_SUBSYSTEM_NATIVE_WINDOWS
= 8,
49
LIEF_PE_SUBSYSTEM_WINDOWS_CE_GUI
= 9,
50
LIEF_PE_SUBSYSTEM_EFI_APPLICATION
= 10,
51
LIEF_PE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
= 11,
52
LIEF_PE_SUBSYSTEM_EFI_RUNTIME_DRIVER
= 12,
53
LIEF_PE_SUBSYSTEM_EFI_ROM
= 13,
54
LIEF_PE_SUBSYSTEM_XBOX
= 14,
55
LIEF_PE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION
= 16
56
};
57
58
struct
Pe_OptionalHeader_t
{
59
enum
LIEF_PE_PE_TYPES
magic
;
60
uint8_t
major_linker_version
;
61
uint8_t
minor_linker_version
;
62
uint32_t
sizeof_code
;
63
uint32_t
sizeof_initialized_data
;
64
uint32_t
sizeof_uninitialized_data
;
65
uint32_t
addressof_entrypoint
;
66
uint32_t
baseof_code
;
67
uint32_t
baseof_data
;
68
uint64_t
imagebase
;
69
uint32_t
section_alignment
;
70
uint32_t
file_alignment
;
71
uint16_t
major_operating_system_version
;
72
uint16_t
minor_operating_system_version
;
73
uint16_t
major_image_version
;
74
uint16_t
minor_image_version
;
75
uint16_t
major_subsystem_version
;
76
uint16_t
minor_subsystem_version
;
77
uint32_t
win32_version_value
;
78
uint32_t
sizeof_image
;
79
uint32_t
sizeof_headers
;
80
uint32_t
checksum
;
81
enum
LIEF_PE_SUBSYSTEM
subsystem
;
82
uint32_t
dll_characteristics
;
83
uint64_t
sizeof_stack_reserve
;
84
uint64_t
sizeof_stack_commit
;
85
uint64_t
sizeof_heap_reserve
;
86
uint64_t
sizeof_heap_commit
;
87
uint32_t
loader_flags
;
88
uint32_t
numberof_rva_and_size
;
89
};
90
91
typedef
struct
Pe_OptionalHeader_t
Pe_OptionalHeader_t
;
92
93
LIEF_API
const
char
*
lief_pe_subsytem_str
(
enum
LIEF_PE_SUBSYSTEM
e);
94
95
#ifdef __cplusplus
96
}
97
#endif
98
99
#endif
LIEF_PE_SUBSYSTEM
LIEF_PE_SUBSYSTEM
Definition
OptionalHeader.h:41
LIEF_PE_SUBSYSTEM_OS2_CUI
@ LIEF_PE_SUBSYSTEM_OS2_CUI
Definition
OptionalHeader.h:46
LIEF_PE_SUBSYSTEM_EFI_RUNTIME_DRIVER
@ LIEF_PE_SUBSYSTEM_EFI_RUNTIME_DRIVER
Definition
OptionalHeader.h:52
LIEF_PE_SUBSYSTEM_POSIX_CUI
@ LIEF_PE_SUBSYSTEM_POSIX_CUI
Definition
OptionalHeader.h:47
LIEF_PE_SUBSYSTEM_WINDOWS_CUI
@ LIEF_PE_SUBSYSTEM_WINDOWS_CUI
Definition
OptionalHeader.h:45
LIEF_PE_SUBSYSTEM_WINDOWS_CE_GUI
@ LIEF_PE_SUBSYSTEM_WINDOWS_CE_GUI
Definition
OptionalHeader.h:49
LIEF_PE_SUBSYSTEM_EFI_ROM
@ LIEF_PE_SUBSYSTEM_EFI_ROM
Definition
OptionalHeader.h:53
LIEF_PE_SUBSYSTEM_NATIVE
@ LIEF_PE_SUBSYSTEM_NATIVE
Definition
OptionalHeader.h:43
LIEF_PE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
@ LIEF_PE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
Definition
OptionalHeader.h:51
LIEF_PE_SUBSYSTEM_EFI_APPLICATION
@ LIEF_PE_SUBSYSTEM_EFI_APPLICATION
Definition
OptionalHeader.h:50
LIEF_PE_SUBSYSTEM_XBOX
@ LIEF_PE_SUBSYSTEM_XBOX
Definition
OptionalHeader.h:54
LIEF_PE_SUBSYSTEM_NATIVE_WINDOWS
@ LIEF_PE_SUBSYSTEM_NATIVE_WINDOWS
Definition
OptionalHeader.h:48
LIEF_PE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION
@ LIEF_PE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION
Definition
OptionalHeader.h:55
LIEF_PE_SUBSYSTEM_UNKNOWN
@ LIEF_PE_SUBSYSTEM_UNKNOWN
Definition
OptionalHeader.h:42
LIEF_PE_SUBSYSTEM_WINDOWS_GUI
@ LIEF_PE_SUBSYSTEM_WINDOWS_GUI
Definition
OptionalHeader.h:44
LIEF_PE_DLL_CHARACTERISTICS
LIEF_PE_DLL_CHARACTERISTICS
Definition
OptionalHeader.h:27
LIEF_PE_DLL_CHARACTERISTICS_NO_ISOLATION
@ LIEF_PE_DLL_CHARACTERISTICS_NO_ISOLATION
Definition
OptionalHeader.h:32
LIEF_PE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE
@ LIEF_PE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE
Definition
OptionalHeader.h:38
LIEF_PE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
@ LIEF_PE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
Definition
OptionalHeader.h:28
LIEF_PE_DLL_CHARACTERISTICS_NO_SEH
@ LIEF_PE_DLL_CHARACTERISTICS_NO_SEH
Definition
OptionalHeader.h:33
LIEF_PE_DLL_CHARACTERISTICS_DYNAMIC_BASE
@ LIEF_PE_DLL_CHARACTERISTICS_DYNAMIC_BASE
Definition
OptionalHeader.h:29
LIEF_PE_DLL_CHARACTERISTICS_NO_BIND
@ LIEF_PE_DLL_CHARACTERISTICS_NO_BIND
Definition
OptionalHeader.h:34
LIEF_PE_DLL_CHARACTERISTICS_WDM_DRIVER
@ LIEF_PE_DLL_CHARACTERISTICS_WDM_DRIVER
Definition
OptionalHeader.h:36
LIEF_PE_DLL_CHARACTERISTICS_GUARD_CF
@ LIEF_PE_DLL_CHARACTERISTICS_GUARD_CF
Definition
OptionalHeader.h:37
LIEF_PE_DLL_CHARACTERISTICS_NX_COMPAT
@ LIEF_PE_DLL_CHARACTERISTICS_NX_COMPAT
Definition
OptionalHeader.h:31
LIEF_PE_DLL_CHARACTERISTICS_APPCONTAINER
@ LIEF_PE_DLL_CHARACTERISTICS_APPCONTAINER
Definition
OptionalHeader.h:35
LIEF_PE_DLL_CHARACTERISTICS_FORCE_INTEGRITY
@ LIEF_PE_DLL_CHARACTERISTICS_FORCE_INTEGRITY
Definition
OptionalHeader.h:30
lief_pe_subsytem_str
const char * lief_pe_subsytem_str(enum LIEF_PE_SUBSYSTEM e)
enums.h
Pe_OptionalHeader_t
Definition
OptionalHeader.h:58
Pe_OptionalHeader_t::major_image_version
uint16_t major_image_version
Definition
OptionalHeader.h:73
Pe_OptionalHeader_t::baseof_code
uint32_t baseof_code
Definition
OptionalHeader.h:66
Pe_OptionalHeader_t::win32_version_value
uint32_t win32_version_value
Definition
OptionalHeader.h:77
Pe_OptionalHeader_t::major_linker_version
uint8_t major_linker_version
Definition
OptionalHeader.h:60
Pe_OptionalHeader_t::baseof_data
uint32_t baseof_data
Definition
OptionalHeader.h:67
Pe_OptionalHeader_t::major_operating_system_version
uint16_t major_operating_system_version
Definition
OptionalHeader.h:71
Pe_OptionalHeader_t::minor_image_version
uint16_t minor_image_version
Definition
OptionalHeader.h:74
Pe_OptionalHeader_t::sizeof_headers
uint32_t sizeof_headers
Definition
OptionalHeader.h:79
Pe_OptionalHeader_t::sizeof_uninitialized_data
uint32_t sizeof_uninitialized_data
Definition
OptionalHeader.h:64
Pe_OptionalHeader_t::major_subsystem_version
uint16_t major_subsystem_version
Definition
OptionalHeader.h:75
Pe_OptionalHeader_t::numberof_rva_and_size
uint32_t numberof_rva_and_size
Definition
OptionalHeader.h:88
Pe_OptionalHeader_t::file_alignment
uint32_t file_alignment
Definition
OptionalHeader.h:70
Pe_OptionalHeader_t::sizeof_image
uint32_t sizeof_image
Definition
OptionalHeader.h:78
Pe_OptionalHeader_t::minor_subsystem_version
uint16_t minor_subsystem_version
Definition
OptionalHeader.h:76
Pe_OptionalHeader_t::minor_linker_version
uint8_t minor_linker_version
Definition
OptionalHeader.h:61
Pe_OptionalHeader_t::sizeof_heap_commit
uint64_t sizeof_heap_commit
Definition
OptionalHeader.h:86
Pe_OptionalHeader_t::section_alignment
uint32_t section_alignment
Definition
OptionalHeader.h:69
Pe_OptionalHeader_t::subsystem
enum LIEF_PE_SUBSYSTEM subsystem
Definition
OptionalHeader.h:81
Pe_OptionalHeader_t::imagebase
uint64_t imagebase
Definition
OptionalHeader.h:68
Pe_OptionalHeader_t::minor_operating_system_version
uint16_t minor_operating_system_version
Definition
OptionalHeader.h:72
Pe_OptionalHeader_t::sizeof_stack_reserve
uint64_t sizeof_stack_reserve
Definition
OptionalHeader.h:83
Pe_OptionalHeader_t::dll_characteristics
uint32_t dll_characteristics
Definition
OptionalHeader.h:82
Pe_OptionalHeader_t::sizeof_heap_reserve
uint64_t sizeof_heap_reserve
Definition
OptionalHeader.h:85
Pe_OptionalHeader_t::sizeof_code
uint32_t sizeof_code
Definition
OptionalHeader.h:62
Pe_OptionalHeader_t::sizeof_initialized_data
uint32_t sizeof_initialized_data
Definition
OptionalHeader.h:63
Pe_OptionalHeader_t::checksum
uint32_t checksum
Definition
OptionalHeader.h:80
Pe_OptionalHeader_t::loader_flags
uint32_t loader_flags
Definition
OptionalHeader.h:87
Pe_OptionalHeader_t::addressof_entrypoint
uint32_t addressof_entrypoint
Definition
OptionalHeader.h:65
Pe_OptionalHeader_t::sizeof_stack_commit
uint64_t sizeof_stack_commit
Definition
OptionalHeader.h:84
Pe_OptionalHeader_t::magic
enum LIEF_PE_PE_TYPES magic
Definition
OptionalHeader.h:59
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.13.0