Bitdefender Hypervisor Memory Introspection
winpe.h File Reference
#include "winguest.h"
#include "winumcache.h"

Go to the source code of this file.

Data Structures

struct  _IMAGE_DOS_HEADER
 
struct  _IMAGE_FILE_HEADER
 
struct  _IMAGE_SECTION_HEADER
 
struct  _IMAGE_DATA_DIRECTORY
 
struct  _IMAGE_RESOURCE_DATA_ENTRY
 
struct  _IMAGE_RESOURCE_DIRECTORY_ENTRY
 
struct  _IMAGE_OPTIONAL_HEADER
 
struct  _IMAGE_OPTIONAL_HEADER64
 
struct  _IMAGE_NT_HEADERS64
 
struct  _IMAGE_NT_HEADERS
 
struct  _IMAGE_IMPORT_DESCRIPTOR
 
struct  _IMAGE_IMPORT_BY_NAME
 
struct  _IMAGE_THUNK_DATA64
 
struct  _IMAGE_THUNK_DATA32
 
struct  _IMAGE_BASE_RELOCATION
 
struct  _IMAGE_EXPORT_DIRECTORY
 
struct  _IMAGE_RESOURCE_DIRECTORY
 
struct  _IMAGE_BOUND_IMPORT_DESCRIPTOR
 
struct  _RUNTIME_FUNCTION
 
struct  _UNWIND_INFO
 
struct  _INTRO_UNWIND_INFO
 
struct  _INTRO_PE_INFO
 

Macros

#define IMAGE_DOS_SIGNATURE   0x5A4D
 
#define IMAGE_NT_SIGNATURE   0x00004550
 
#define IMAGE_DIRECTORY_ENTRY_EXPORT   0
 
#define IMAGE_DIRECTORY_ENTRY_IMPORT   1
 
#define IMAGE_DIRECTORY_ENTRY_RESOURCE   2
 
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION   3
 
#define IMAGE_DIRECTORY_ENTRY_SECURITY   4
 
#define IMAGE_DIRECTORY_ENTRY_BASERELOC   5
 
#define IMAGE_DIRECTORY_ENTRY_DEBUG   6
 
#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE   7
 
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR   8
 
#define IMAGE_DIRECTORY_ENTRY_TLS   9
 
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG   10
 
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT   11
 
#define IMAGE_DIRECTORY_ENTRY_IAT   12
 
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT   13
 
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR   14
 
#define IMAGE_SIZEOF_SHORT_NAME   8u
 
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES   16
 
#define IMAGE_FIRST_SECTION(ntheader)
 
#define IMAGE_REL_BASED_ABSOLUTE   0
 
#define IMAGE_REL_BASED_HIGH   1
 
#define IMAGE_REL_BASED_LOW   2
 
#define IMAGE_REL_BASED_HIGHLOW   3
 
#define IMAGE_REL_BASED_HIGHADJ   4
 
#define IMAGE_REL_BASED_MIPS_JMPADDR   5
 
#define IMAGE_REL_BASED_SECTION   6
 
#define IMAGE_REL_BASED_REL32   7
 
#define IMAGE_REL_BASED_MIPS_JMPADDR16   9
 
#define IMAGE_REL_BASED_IA64_IMM64   9
 
#define IMAGE_REL_BASED_DIR64   10
 
#define UNW_FLAG_NHANDLER   0x00000000
 
#define UNW_FLAG_EHANDLER   0x00000001
 
#define UNW_FLAG_UHANDLER   0x00000002
 
#define UNW_FLAG_FHANDLER   0x00000003
 
#define UNW_FLAG_CHAININFO   0x00000004
 
#define IMAGE_SCN_TYPE_NO_PAD   0x00000008
 
#define IMAGE_SCN_CNT_CODE   0x00000020
 
#define IMAGE_SCN_CNT_INITIALIZED_DATA   0x00000040
 
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA   0x00000080
 
#define IMAGE_SCN_LNK_OTHER   0x00000100
 
#define IMAGE_SCN_LNK_INFO   0x00000200
 
#define IMAGE_SCN_LNK_REMOVE   0x00000800
 
#define IMAGE_SCN_LNK_COMDAT   0x00001000
 
#define IMAGE_SCN_NO_DEFER_SPEC_EXC   0x00004000
 
#define IMAGE_SCN_GPREL   0x00008000
 
#define IMAGE_SCN_MEM_FARDATA   0x00008000
 
#define IMAGE_SCN_MEM_PURGEABLE   0x00020000
 
#define IMAGE_SCN_MEM_16BIT   0x00020000
 
#define IMAGE_SCN_MEM_LOCKED   0x00040000
 
#define IMAGE_SCN_MEM_PRELOAD   0x00080000
 
#define IMAGE_SCN_ALIGN_1BYTES   0x00100000
 
#define IMAGE_SCN_ALIGN_2BYTES   0x00200000
 
#define IMAGE_SCN_ALIGN_4BYTES   0x00300000
 
#define IMAGE_SCN_ALIGN_8BYTES   0x00400000
 
#define IMAGE_SCN_ALIGN_16BYTES   0x00500000
 
#define IMAGE_SCN_ALIGN_32BYTES   0x00600000
 
#define IMAGE_SCN_ALIGN_64BYTES   0x00700000
 
#define IMAGE_SCN_ALIGN_128BYTES   0x00800000
 
#define IMAGE_SCN_ALIGN_256BYTES   0x00900000
 
#define IMAGE_SCN_ALIGN_512BYTES   0x00A00000
 
#define IMAGE_SCN_ALIGN_1024BYTES   0x00B00000
 
#define IMAGE_SCN_ALIGN_2048BYTES   0x00C00000
 
#define IMAGE_SCN_ALIGN_4096BYTES   0x00D00000
 
#define IMAGE_SCN_ALIGN_8192BYTES   0x00E00000
 
#define IMAGE_SCN_ALIGN_MASK   0x00F00000
 
#define IMAGE_SCN_LNK_NRELOC_OVFL   0x01000000
 
#define IMAGE_SCN_MEM_DISCARDABLE   0x02000000
 
#define IMAGE_SCN_MEM_NOT_CACHED   0x04000000
 
#define IMAGE_SCN_MEM_NOT_PAGED   0x08000000
 
#define IMAGE_SCN_MEM_SHARED   0x10000000
 
#define IMAGE_SCN_MEM_EXECUTE   0x20000000
 
#define IMAGE_SCN_MEM_READ   0x40000000
 
#define IMAGE_SCN_MEM_WRITE   0x80000000
 
#define IMAGE_FILE_MACHINE_UNKNOWN   0
 
#define IMAGE_FILE_MACHINE_I386   0x014c
 
#define IMAGE_FILE_MACHINE_R3000   0x0162
 
#define IMAGE_FILE_MACHINE_R4000   0x0166
 
#define IMAGE_FILE_MACHINE_R10000   0x0168
 
#define IMAGE_FILE_MACHINE_WCEMIPSV2   0x0169
 
#define IMAGE_FILE_MACHINE_ALPHA   0x0184
 
#define IMAGE_FILE_MACHINE_SH3   0x01a2
 
#define IMAGE_FILE_MACHINE_SH3DSP   0x01a3
 
#define IMAGE_FILE_MACHINE_SH3E   0x01a4
 
#define IMAGE_FILE_MACHINE_SH4   0x01a6
 
#define IMAGE_FILE_MACHINE_SH5   0x01a8
 
#define IMAGE_FILE_MACHINE_ARM   0x01c0
 
#define IMAGE_FILE_MACHINE_THUMB   0x01c2
 
#define IMAGE_FILE_MACHINE_AM33   0x01d3
 
#define IMAGE_FILE_MACHINE_POWERPC   0x01F0
 
#define IMAGE_FILE_MACHINE_POWERPCFP   0x01f1
 
#define IMAGE_FILE_MACHINE_IA64   0x0200
 
#define IMAGE_FILE_MACHINE_MIPS16   0x0266
 
#define IMAGE_FILE_MACHINE_ALPHA64   0x0284
 
#define IMAGE_FILE_MACHINE_MIPSFPU   0x0366
 
#define IMAGE_FILE_MACHINE_MIPSFPU16   0x0466
 
#define IMAGE_FILE_MACHINE_AXP64   IMAGE_FILE_MACHINE_ALPHA64
 
#define IMAGE_FILE_MACHINE_TRICORE   0x0520
 
#define IMAGE_FILE_MACHINE_CEF   0x0CEF
 
#define IMAGE_FILE_MACHINE_EBC   0x0EBC
 
#define IMAGE_FILE_MACHINE_AMD64   0x8664
 
#define IMAGE_FILE_MACHINE_M32R   0x9041
 
#define IMAGE_FILE_MACHINE_CEE   0xC0EE
 
#define IMAGE_SUBSYSTEM_UNKNOWN   0
 
#define IMAGE_SUBSYSTEM_NATIVE   1
 
#define IMAGE_SUBSYSTEM_WINDOWS_GUI   2
 
#define IMAGE_SUBSYSTEM_WINDOWS_CUI   3
 
#define IMAGE_SUBSYSTEM_OS2_CUI   5
 
#define IMAGE_SUBSYSTEM_POSIX_CUI   7
 
#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS   8
 
#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI   9
 
#define IMAGE_SUBSYSTEM_EFI_APPLICATION   10
 
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER   11
 
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER   12
 
#define IMAGE_SUBSYSTEM_EFI_ROM   13
 
#define IMAGE_SUBSYSTEM_XBOX   14
 
#define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION   16
 
#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE   0x0040
 
#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY   0x0080
 
#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT   0x0100
 
#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION   0x0200
 
#define IMAGE_DLLCHARACTERISTICS_NO_SEH   0x0400
 
#define IMAGE_DLLCHARACTERISTICS_NO_BIND   0x0800
 
#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER   0x2000
 
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE   0x8000
 
#define IMAGE_OPTIONAL_HEADER_PE32   0x010b
 
#define IMAGE_OPTIONAL_HEADER_PE64   0x020b
 
#define MAX_PATH   260u
 The maximum size of a path (260 characters on windows). More...
 
#define MAX_FUNC_LENGTH   0xa00
 The maximum length (in bytes) of a function. More...
 
#define MAX_FILE_ALIGNMENT   0x10000
 
#define MIN_FILE_ALIGNMENT   0x200
 
#define MAX_NUMBER_SECTIONS   96
 
#define IntPeGetSectionHeaderByName(Base, Buff, Name, Cr3, Sec)   IntPeGetSectionHeadersByName((Base), (Buff), (Name), 1, (Cr3), (Sec), NULL)
 

Typedefs

typedef struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
 
typedef struct _IMAGE_DOS_HEADERPIMAGE_DOS_HEADER
 
typedef struct _IMAGE_FILE_HEADER IMAGE_FILE_HEADER
 
typedef struct _IMAGE_FILE_HEADERPIMAGE_FILE_HEADER
 
typedef struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER
 
typedef struct _IMAGE_SECTION_HEADERPIMAGE_SECTION_HEADER
 
typedef struct _IMAGE_DATA_DIRECTORY IMAGE_DATA_DIRECTORY
 
typedef struct _IMAGE_DATA_DIRECTORYPIMAGE_DATA_DIRECTORY
 
typedef struct _IMAGE_RESOURCE_DATA_ENTRY IMAGE_RESOURCE_DATA_ENTRY
 
typedef struct _IMAGE_RESOURCE_DATA_ENTRYPIMAGE_RESOURCE_DATA_ENTRY
 
typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY IMAGE_RESOURCE_DIRECTORY_ENTRY
 
typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRYPIMAGE_RESOURCE_DIRECTORY_ENTRY
 
typedef struct _IMAGE_OPTIONAL_HEADER IMAGE_OPTIONAL_HEADER32
 
typedef struct _IMAGE_OPTIONAL_HEADERPIMAGE_OPTIONAL_HEADER32
 
typedef struct _IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER64
 
typedef struct _IMAGE_OPTIONAL_HEADER64PIMAGE_OPTIONAL_HEADER64
 
typedef struct _IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS64
 
typedef struct _IMAGE_NT_HEADERS64PIMAGE_NT_HEADERS64
 
typedef struct _IMAGE_NT_HEADERS IMAGE_NT_HEADERS32
 
typedef struct _IMAGE_NT_HEADERSPIMAGE_NT_HEADERS32
 
typedef struct _IMAGE_IMPORT_DESCRIPTOR IMAGE_IMPORT_DESCRIPTOR
 
typedef IMAGE_IMPORT_DESCRIPTORPIMAGE_IMPORT_DESCRIPTOR
 
typedef struct _IMAGE_IMPORT_BY_NAME IMAGE_IMPORT_BY_NAME
 
typedef struct _IMAGE_IMPORT_BY_NAMEPIMAGE_IMPORT_BY_NAME
 
typedef struct _IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA64
 
typedef struct _IMAGE_THUNK_DATA64PIMAGE_THUNK_DATA64
 
typedef struct _IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA32
 
typedef struct _IMAGE_THUNK_DATA32PIMAGE_THUNK_DATA32
 
typedef struct _IMAGE_BASE_RELOCATION IMAGE_BASE_RELOCATION
 
typedef IMAGE_BASE_RELOCATIONPIMAGE_BASE_RELOCATION
 
typedef struct _IMAGE_EXPORT_DIRECTORY IMAGE_EXPORT_DIRECTORY
 
typedef struct _IMAGE_EXPORT_DIRECTORYPIMAGE_EXPORT_DIRECTORY
 
typedef struct _IMAGE_RESOURCE_DIRECTORY IMAGE_RESOURCE_DIRECTORY
 
typedef struct _IMAGE_RESOURCE_DIRECTORYPIMAGE_RESOURCE_DIRECTORY
 
typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR IMAGE_BOUND_IMPORT_DESCRIPTOR
 
typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTORPIMAGE_BOUND_IMPORT_DESCRIPTOR
 
typedef struct _RUNTIME_FUNCTION RUNTIME_FUNCTION
 
typedef struct _RUNTIME_FUNCTIONPRUNTIME_FUNCTION
 
typedef struct _UNWIND_INFO UNWIND_INFO
 
typedef struct _UNWIND_INFOPUNWIND_INFO
 
typedef struct _INTRO_UNWIND_INFO INTRO_UNWIND_INFO
 
typedef struct _INTRO_UNWIND_INFOPINTRO_UNWIND_INFO
 
typedef struct _WIN_UNEXPORTED_FUNCTION WIN_UNEXPORTED_FUNCTION
 
typedef struct _INTRO_PE_INFO INTRO_PE_INFO
 
typedef struct _INTRO_PE_INFOPINTRO_PE_INFO
 

Functions

INTSTATUS IntPeGetRuntimeFunction (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD Rva, RUNTIME_FUNCTION *RuntimeFunction)
 Parses the exception directory and gets the runtime function corresponding to the Rva. More...
 
INTSTATUS IntPeGetRuntimeFunctionInBuffer (QWORD ImageBase, BYTE *Buffer, DWORD BufferSize, DWORD Rva, RUNTIME_FUNCTION *RuntimeFunction)
 Parses the exception directory and gets the runtime function corresponding to the Rva. More...
 
INTSTATUS IntPeParseUnwindData (QWORD ImageBase, BYTE *ImageBaseBuffer, RUNTIME_FUNCTION *RuntimeFunction, DWORD RipOffset, DWORD *ReservedStack, DWORD *BeginAddress, BOOLEAN *InterruptFunction, BOOLEAN *ExceptionFunction, BOOLEAN *HasFramePointer)
 Parse the unwind data for the indicated function and return the prologue size. More...
 
INTSTATUS IntPeParseUnwindDataInBuffer (QWORD ImageBase, BYTE *Buffer, DWORD BufferSize, RUNTIME_FUNCTION *RuntimeFunction, DWORD RipOffset, DWORD *ReservedStack, DWORD *BeginAddress, BOOLEAN *InterruptFunction, BOOLEAN *ExceptionFunction, BOOLEAN *HasFramePointer)
 Parse the unwind data for the indicated function and return the prologue size. More...
 
INTSTATUS IntPeFindFunctionStartInBuffer (QWORD ImageBase, BYTE *Buffer, DWORD BufferSize, DWORD Rva, DWORD *BeginAddress)
 Find the start address of a function, given a Rva pointing inside of it. More...
 
INTSTATUS IntPeFindExportByNameInBuffer (QWORD ImageBase, BYTE *Buffer, DWORD BufferSize, const char *Name, DWORD *ExportRva)
 Find the export name a Rva lies in. More...
 
INTSTATUS IntPeFindKernelExport (const char *Name, QWORD *ExportGva)
 Find an export inside the NT kernel image. More...
 
INTSTATUS IntPeFindExportByName (QWORD ImageBase, BYTE *ImageBaseBuffer, CHAR *Name, DWORD *ExportRva)
 Find the export name a Rva lies in. More...
 
INTSTATUS IntPeFindExportByOrdinal (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD Ordinal, DWORD *ExportRva)
 Find an exported function using its ordinal. More...
 
INTSTATUS IntPeGetExportNameByRva (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD Rva, DWORD ExportNameSize, CHAR *ExportName)
 Find the export name a Rva lies in. More...
 
INTSTATUS IntPeGetExportNameByRvaInBuffer (QWORD ImageBase, BYTE *Buffer, DWORD BufferSize, DWORD Rva, DWORD ExportNameSize, CHAR *ExportName)
 Find the export name a Rva lies in. More...
 
INTSTATUS IntPeFindExportByRvaInBuffer (QWORD ImageBase, BYTE *Buffer, DWORD BufferSize, DWORD Rva)
 Check if the indicated Rva belongs to an exported function. More...
 
INTSTATUS IntPeFindExportByRva (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD Rva)
 Check if a RVA lies inside an exported function. More...
 
INTSTATUS IntPeFindFunctionStart (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD Rva, DWORD *BeginAddress)
 Find the start address of a function, given a Rva pointing inside of it. More...
 
INTSTATUS IntPeGetSectionHeaderByRva (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD GuestRva, IMAGE_SECTION_HEADER *SectionHeader)
 Given a relative virtual address, return the section header which describes the section the RVA lies in. More...
 
INTSTATUS IntPeGetSectionHeaderByIndex (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD Index, IMAGE_SECTION_HEADER *SectionHeader)
 Return the section header located on position Index (0 based). More...
 
INTSTATUS IntPeGetSectionHeadersByName (QWORD ImageBase, BYTE *ImageBaseBuffer, PCHAR Name, DWORD NumberOfSectionHeadersAllocated, QWORD Cr3, IMAGE_SECTION_HEADER *SectionHeaders, DWORD *NumberOfSectionHeadersFilled)
 Return all the section headers matching the indicated Name. More...
 
INTSTATUS IntPeGetDirectory (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD DirectoryEntry, IMAGE_DATA_DIRECTORY *Directory)
 Validate & return the indicated image data directory. More...
 
INTSTATUS IntPeValidateHeader (QWORD ImageBase, BYTE *ImageBaseBuffer, DWORD ImageBaseBufferSize, INTRO_PE_INFO *PeInfo, QWORD Cr3)
 Validates a PE header. More...
 
INTSTATUS IntPeListSectionsHeaders (QWORD ImageBase, BYTE *ImageBuffer, DWORD ImageBufferSize, DWORD *FirstSectionOffset, DWORD *SectionCount)
 Will get the offset to the first section header and the number of sections from the given module. More...
 
INTSTATUS IntPeFindFunctionByPattern (QWORD ImageBase, WIN_UNEXPORTED_FUNCTION_PATTERN *Pattern, BOOLEAN IgnoreSectionHint, DWORD *Rva)
 Find a function using a pattern. More...
 
INTSTATUS IntPeFindFunctionByPatternInBuffer (BYTE *Buffer, DWORD BufferSize, WIN_UNEXPORTED_FUNCTION_PATTERN *Pattern, BOOLEAN IgnoreSectionHint, DWORD *Rva)
 Find a function using a pattern. More...
 

Macro Definition Documentation

◆ IMAGE_DIRECTORY_ENTRY_ARCHITECTURE

#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE   7

Definition at line 28 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_BASERELOC

#define IMAGE_DIRECTORY_ENTRY_BASERELOC   5

Definition at line 25 of file winpe.h.

Referenced by IntLdrLoadPEImage().

◆ IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT

#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT   11

Definition at line 32 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR

#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR   14

Definition at line 35 of file winpe.h.

Referenced by IntPeGetDirectory().

◆ IMAGE_DIRECTORY_ENTRY_DEBUG

#define IMAGE_DIRECTORY_ENTRY_DEBUG   6

Definition at line 26 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT

#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT   13

Definition at line 34 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_EXCEPTION

#define IMAGE_DIRECTORY_ENTRY_EXCEPTION   3

Definition at line 23 of file winpe.h.

Referenced by IntPeGetRuntimeFunction(), and IntPeGetRuntimeFunctionInBuffer().

◆ IMAGE_DIRECTORY_ENTRY_EXPORT

◆ IMAGE_DIRECTORY_ENTRY_GLOBALPTR

#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR   8

Definition at line 29 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_IAT

#define IMAGE_DIRECTORY_ENTRY_IAT   12

◆ IMAGE_DIRECTORY_ENTRY_IMPORT

#define IMAGE_DIRECTORY_ENTRY_IMPORT   1

Definition at line 21 of file winpe.h.

Referenced by IntLdrLoadPEImage().

◆ IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG

#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG   10

Definition at line 31 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_RESOURCE

#define IMAGE_DIRECTORY_ENTRY_RESOURCE   2

Definition at line 22 of file winpe.h.

Referenced by IntExceptWinGetVictimDriver().

◆ IMAGE_DIRECTORY_ENTRY_SECURITY

#define IMAGE_DIRECTORY_ENTRY_SECURITY   4

Definition at line 24 of file winpe.h.

◆ IMAGE_DIRECTORY_ENTRY_TLS

#define IMAGE_DIRECTORY_ENTRY_TLS   9

Definition at line 30 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE

#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE   0x0040

Definition at line 535 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY

#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY   0x0080

Definition at line 536 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_NO_BIND

#define IMAGE_DLLCHARACTERISTICS_NO_BIND   0x0800

Definition at line 543 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_NO_ISOLATION

#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION   0x0200

Definition at line 538 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_NO_SEH

#define IMAGE_DLLCHARACTERISTICS_NO_SEH   0x0400

Definition at line 541 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_NX_COMPAT

#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT   0x0100

Definition at line 537 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE

#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE   0x8000

Definition at line 547 of file winpe.h.

◆ IMAGE_DLLCHARACTERISTICS_WDM_DRIVER

#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER   0x2000

Definition at line 545 of file winpe.h.

◆ IMAGE_DOS_SIGNATURE

#define IMAGE_DOS_SIGNATURE   0x5A4D

NOTE: This file contains MZ/PE related structures. As they are publicly documented in multiple sources, they will not be described here at all. The definitions here have been taken from the Windows SDK.

Definition at line 16 of file winpe.h.

Referenced by IntPeValidateHeader().

◆ IMAGE_FILE_MACHINE_ALPHA

#define IMAGE_FILE_MACHINE_ALPHA   0x0184

Definition at line 485 of file winpe.h.

◆ IMAGE_FILE_MACHINE_ALPHA64

#define IMAGE_FILE_MACHINE_ALPHA64   0x0284

Definition at line 498 of file winpe.h.

◆ IMAGE_FILE_MACHINE_AM33

#define IMAGE_FILE_MACHINE_AM33   0x01d3

Definition at line 493 of file winpe.h.

◆ IMAGE_FILE_MACHINE_AMD64

#define IMAGE_FILE_MACHINE_AMD64   0x8664

Definition at line 505 of file winpe.h.

Referenced by IntLdrLoadPEImage(), and IntPeValidateHeader().

◆ IMAGE_FILE_MACHINE_ARM

#define IMAGE_FILE_MACHINE_ARM   0x01c0

Definition at line 491 of file winpe.h.

◆ IMAGE_FILE_MACHINE_AXP64

#define IMAGE_FILE_MACHINE_AXP64   IMAGE_FILE_MACHINE_ALPHA64

Definition at line 501 of file winpe.h.

◆ IMAGE_FILE_MACHINE_CEE

#define IMAGE_FILE_MACHINE_CEE   0xC0EE

Definition at line 507 of file winpe.h.

◆ IMAGE_FILE_MACHINE_CEF

#define IMAGE_FILE_MACHINE_CEF   0x0CEF

Definition at line 503 of file winpe.h.

◆ IMAGE_FILE_MACHINE_EBC

#define IMAGE_FILE_MACHINE_EBC   0x0EBC

Definition at line 504 of file winpe.h.

◆ IMAGE_FILE_MACHINE_I386

#define IMAGE_FILE_MACHINE_I386   0x014c

Definition at line 480 of file winpe.h.

Referenced by IntLdrLoadPEImage(), and IntPeValidateHeader().

◆ IMAGE_FILE_MACHINE_IA64

#define IMAGE_FILE_MACHINE_IA64   0x0200

Definition at line 496 of file winpe.h.

◆ IMAGE_FILE_MACHINE_M32R

#define IMAGE_FILE_MACHINE_M32R   0x9041

Definition at line 506 of file winpe.h.

◆ IMAGE_FILE_MACHINE_MIPS16

#define IMAGE_FILE_MACHINE_MIPS16   0x0266

Definition at line 497 of file winpe.h.

◆ IMAGE_FILE_MACHINE_MIPSFPU

#define IMAGE_FILE_MACHINE_MIPSFPU   0x0366

Definition at line 499 of file winpe.h.

◆ IMAGE_FILE_MACHINE_MIPSFPU16

#define IMAGE_FILE_MACHINE_MIPSFPU16   0x0466

Definition at line 500 of file winpe.h.

◆ IMAGE_FILE_MACHINE_POWERPC

#define IMAGE_FILE_MACHINE_POWERPC   0x01F0

Definition at line 494 of file winpe.h.

◆ IMAGE_FILE_MACHINE_POWERPCFP

#define IMAGE_FILE_MACHINE_POWERPCFP   0x01f1

Definition at line 495 of file winpe.h.

◆ IMAGE_FILE_MACHINE_R10000

#define IMAGE_FILE_MACHINE_R10000   0x0168

Definition at line 483 of file winpe.h.

◆ IMAGE_FILE_MACHINE_R3000

#define IMAGE_FILE_MACHINE_R3000   0x0162

Definition at line 481 of file winpe.h.

◆ IMAGE_FILE_MACHINE_R4000

#define IMAGE_FILE_MACHINE_R4000   0x0166

Definition at line 482 of file winpe.h.

◆ IMAGE_FILE_MACHINE_SH3

#define IMAGE_FILE_MACHINE_SH3   0x01a2

Definition at line 486 of file winpe.h.

◆ IMAGE_FILE_MACHINE_SH3DSP

#define IMAGE_FILE_MACHINE_SH3DSP   0x01a3

Definition at line 487 of file winpe.h.

◆ IMAGE_FILE_MACHINE_SH3E

#define IMAGE_FILE_MACHINE_SH3E   0x01a4

Definition at line 488 of file winpe.h.

◆ IMAGE_FILE_MACHINE_SH4

#define IMAGE_FILE_MACHINE_SH4   0x01a6

Definition at line 489 of file winpe.h.

◆ IMAGE_FILE_MACHINE_SH5

#define IMAGE_FILE_MACHINE_SH5   0x01a8

Definition at line 490 of file winpe.h.

◆ IMAGE_FILE_MACHINE_THUMB

#define IMAGE_FILE_MACHINE_THUMB   0x01c2

Definition at line 492 of file winpe.h.

◆ IMAGE_FILE_MACHINE_TRICORE

#define IMAGE_FILE_MACHINE_TRICORE   0x0520

Definition at line 502 of file winpe.h.

◆ IMAGE_FILE_MACHINE_UNKNOWN

#define IMAGE_FILE_MACHINE_UNKNOWN   0

Definition at line 479 of file winpe.h.

◆ IMAGE_FILE_MACHINE_WCEMIPSV2

#define IMAGE_FILE_MACHINE_WCEMIPSV2   0x0169

Definition at line 484 of file winpe.h.

◆ IMAGE_FIRST_SECTION

#define IMAGE_FIRST_SECTION (   ntheader)
Value:
((size_t *)(ntheader) + \
FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \
((ntheader))->FileHeader.SizeOfOptionalHeader \
))
#define FIELD_OFFSET(type, field)
Definition: introdefs.h:239
struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER

Definition at line 301 of file winpe.h.

◆ IMAGE_NT_SIGNATURE

#define IMAGE_NT_SIGNATURE   0x00004550

Definition at line 17 of file winpe.h.

Referenced by IntPeValidateHeader().

◆ IMAGE_NUMBEROF_DIRECTORY_ENTRIES

#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES   16

Definition at line 103 of file winpe.h.

Referenced by IntPeValidateOptionalHeader().

◆ IMAGE_OPTIONAL_HEADER_PE32

#define IMAGE_OPTIONAL_HEADER_PE32   0x010b

Definition at line 550 of file winpe.h.

Referenced by IntPeValidateOptionalHeader().

◆ IMAGE_OPTIONAL_HEADER_PE64

#define IMAGE_OPTIONAL_HEADER_PE64   0x020b

Definition at line 551 of file winpe.h.

Referenced by IntPeValidateOptionalHeader().

◆ IMAGE_REL_BASED_ABSOLUTE

#define IMAGE_REL_BASED_ABSOLUTE   0

Definition at line 310 of file winpe.h.

Referenced by IntLdrFixRelocations().

◆ IMAGE_REL_BASED_DIR64

#define IMAGE_REL_BASED_DIR64   10

Definition at line 323 of file winpe.h.

Referenced by IntLdrFixRelocations().

◆ IMAGE_REL_BASED_HIGH

#define IMAGE_REL_BASED_HIGH   1

Definition at line 311 of file winpe.h.

◆ IMAGE_REL_BASED_HIGHADJ

#define IMAGE_REL_BASED_HIGHADJ   4

Definition at line 314 of file winpe.h.

◆ IMAGE_REL_BASED_HIGHLOW

#define IMAGE_REL_BASED_HIGHLOW   3

Definition at line 313 of file winpe.h.

Referenced by IntLdrFixRelocations().

◆ IMAGE_REL_BASED_IA64_IMM64

#define IMAGE_REL_BASED_IA64_IMM64   9

Definition at line 322 of file winpe.h.

◆ IMAGE_REL_BASED_LOW

#define IMAGE_REL_BASED_LOW   2

Definition at line 312 of file winpe.h.

◆ IMAGE_REL_BASED_MIPS_JMPADDR

#define IMAGE_REL_BASED_MIPS_JMPADDR   5

Definition at line 315 of file winpe.h.

◆ IMAGE_REL_BASED_MIPS_JMPADDR16

#define IMAGE_REL_BASED_MIPS_JMPADDR16   9

Definition at line 321 of file winpe.h.

◆ IMAGE_REL_BASED_REL32

#define IMAGE_REL_BASED_REL32   7

Definition at line 318 of file winpe.h.

◆ IMAGE_REL_BASED_SECTION

#define IMAGE_REL_BASED_SECTION   6

Definition at line 317 of file winpe.h.

◆ IMAGE_SCN_ALIGN_1024BYTES

#define IMAGE_SCN_ALIGN_1024BYTES   0x00B00000

Definition at line 460 of file winpe.h.

◆ IMAGE_SCN_ALIGN_128BYTES

#define IMAGE_SCN_ALIGN_128BYTES   0x00800000

Definition at line 457 of file winpe.h.

◆ IMAGE_SCN_ALIGN_16BYTES

#define IMAGE_SCN_ALIGN_16BYTES   0x00500000

Definition at line 454 of file winpe.h.

◆ IMAGE_SCN_ALIGN_1BYTES

#define IMAGE_SCN_ALIGN_1BYTES   0x00100000

Definition at line 450 of file winpe.h.

◆ IMAGE_SCN_ALIGN_2048BYTES

#define IMAGE_SCN_ALIGN_2048BYTES   0x00C00000

Definition at line 461 of file winpe.h.

◆ IMAGE_SCN_ALIGN_256BYTES

#define IMAGE_SCN_ALIGN_256BYTES   0x00900000

Definition at line 458 of file winpe.h.

◆ IMAGE_SCN_ALIGN_2BYTES

#define IMAGE_SCN_ALIGN_2BYTES   0x00200000

Definition at line 451 of file winpe.h.

◆ IMAGE_SCN_ALIGN_32BYTES

#define IMAGE_SCN_ALIGN_32BYTES   0x00600000

Definition at line 455 of file winpe.h.

◆ IMAGE_SCN_ALIGN_4096BYTES

#define IMAGE_SCN_ALIGN_4096BYTES   0x00D00000

Definition at line 462 of file winpe.h.

◆ IMAGE_SCN_ALIGN_4BYTES

#define IMAGE_SCN_ALIGN_4BYTES   0x00300000

Definition at line 452 of file winpe.h.

◆ IMAGE_SCN_ALIGN_512BYTES

#define IMAGE_SCN_ALIGN_512BYTES   0x00A00000

Definition at line 459 of file winpe.h.

◆ IMAGE_SCN_ALIGN_64BYTES

#define IMAGE_SCN_ALIGN_64BYTES   0x00700000

Definition at line 456 of file winpe.h.

◆ IMAGE_SCN_ALIGN_8192BYTES

#define IMAGE_SCN_ALIGN_8192BYTES   0x00E00000

Definition at line 463 of file winpe.h.

◆ IMAGE_SCN_ALIGN_8BYTES

#define IMAGE_SCN_ALIGN_8BYTES   0x00400000

Definition at line 453 of file winpe.h.

◆ IMAGE_SCN_ALIGN_MASK

#define IMAGE_SCN_ALIGN_MASK   0x00F00000

Definition at line 465 of file winpe.h.

◆ IMAGE_SCN_CNT_CODE

◆ IMAGE_SCN_CNT_INITIALIZED_DATA

#define IMAGE_SCN_CNT_INITIALIZED_DATA   0x00000040

Definition at line 426 of file winpe.h.

◆ IMAGE_SCN_CNT_UNINITIALIZED_DATA

#define IMAGE_SCN_CNT_UNINITIALIZED_DATA   0x00000080

Definition at line 427 of file winpe.h.

Referenced by IntLdrPreLoadImage().

◆ IMAGE_SCN_GPREL

#define IMAGE_SCN_GPREL   0x00008000

Definition at line 441 of file winpe.h.

◆ IMAGE_SCN_LNK_COMDAT

#define IMAGE_SCN_LNK_COMDAT   0x00001000

Definition at line 433 of file winpe.h.

◆ IMAGE_SCN_LNK_INFO

#define IMAGE_SCN_LNK_INFO   0x00000200

Definition at line 430 of file winpe.h.

◆ IMAGE_SCN_LNK_NRELOC_OVFL

#define IMAGE_SCN_LNK_NRELOC_OVFL   0x01000000

Definition at line 467 of file winpe.h.

◆ IMAGE_SCN_LNK_OTHER

#define IMAGE_SCN_LNK_OTHER   0x00000100

Definition at line 429 of file winpe.h.

◆ IMAGE_SCN_LNK_REMOVE

#define IMAGE_SCN_LNK_REMOVE   0x00000800

Definition at line 432 of file winpe.h.

◆ IMAGE_SCN_MEM_16BIT

#define IMAGE_SCN_MEM_16BIT   0x00020000

Definition at line 446 of file winpe.h.

◆ IMAGE_SCN_MEM_DISCARDABLE

◆ IMAGE_SCN_MEM_EXECUTE

◆ IMAGE_SCN_MEM_FARDATA

#define IMAGE_SCN_MEM_FARDATA   0x00008000

Definition at line 443 of file winpe.h.

◆ IMAGE_SCN_MEM_LOCKED

#define IMAGE_SCN_MEM_LOCKED   0x00040000

Definition at line 447 of file winpe.h.

◆ IMAGE_SCN_MEM_NOT_CACHED

#define IMAGE_SCN_MEM_NOT_CACHED   0x04000000

Definition at line 469 of file winpe.h.

◆ IMAGE_SCN_MEM_NOT_PAGED

#define IMAGE_SCN_MEM_NOT_PAGED   0x08000000

◆ IMAGE_SCN_MEM_PRELOAD

#define IMAGE_SCN_MEM_PRELOAD   0x00080000

Definition at line 448 of file winpe.h.

◆ IMAGE_SCN_MEM_PURGEABLE

#define IMAGE_SCN_MEM_PURGEABLE   0x00020000

Definition at line 445 of file winpe.h.

◆ IMAGE_SCN_MEM_READ

#define IMAGE_SCN_MEM_READ   0x40000000

Definition at line 473 of file winpe.h.

Referenced by IntWinModHookPoly().

◆ IMAGE_SCN_MEM_SHARED

#define IMAGE_SCN_MEM_SHARED   0x10000000

Definition at line 471 of file winpe.h.

◆ IMAGE_SCN_MEM_WRITE

◆ IMAGE_SCN_NO_DEFER_SPEC_EXC

#define IMAGE_SCN_NO_DEFER_SPEC_EXC   0x00004000

Definition at line 438 of file winpe.h.

◆ IMAGE_SCN_TYPE_NO_PAD

#define IMAGE_SCN_TYPE_NO_PAD   0x00000008

Definition at line 422 of file winpe.h.

◆ IMAGE_SIZEOF_SHORT_NAME

#define IMAGE_SIZEOF_SHORT_NAME   8u

Definition at line 74 of file winpe.h.

Referenced by IntPeGetSectionHeadersByName().

◆ IMAGE_SUBSYSTEM_EFI_APPLICATION

#define IMAGE_SUBSYSTEM_EFI_APPLICATION   10

Definition at line 520 of file winpe.h.

◆ IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER

#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER   11

Definition at line 521 of file winpe.h.

◆ IMAGE_SUBSYSTEM_EFI_ROM

#define IMAGE_SUBSYSTEM_EFI_ROM   13

Definition at line 523 of file winpe.h.

◆ IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER

#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER   12

Definition at line 522 of file winpe.h.

◆ IMAGE_SUBSYSTEM_NATIVE

#define IMAGE_SUBSYSTEM_NATIVE   1

Definition at line 513 of file winpe.h.

Referenced by IntLdrLoadPEImage(), and IntWinDagentCheckNativeSubsystem().

◆ IMAGE_SUBSYSTEM_NATIVE_WINDOWS

#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS   8

Definition at line 518 of file winpe.h.

◆ IMAGE_SUBSYSTEM_OS2_CUI

#define IMAGE_SUBSYSTEM_OS2_CUI   5

Definition at line 516 of file winpe.h.

◆ IMAGE_SUBSYSTEM_POSIX_CUI

#define IMAGE_SUBSYSTEM_POSIX_CUI   7

Definition at line 517 of file winpe.h.

◆ IMAGE_SUBSYSTEM_UNKNOWN

#define IMAGE_SUBSYSTEM_UNKNOWN   0

Definition at line 512 of file winpe.h.

◆ IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION

#define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION   16

Definition at line 525 of file winpe.h.

◆ IMAGE_SUBSYSTEM_WINDOWS_CE_GUI

#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI   9

Definition at line 519 of file winpe.h.

◆ IMAGE_SUBSYSTEM_WINDOWS_CUI

#define IMAGE_SUBSYSTEM_WINDOWS_CUI   3

Definition at line 515 of file winpe.h.

◆ IMAGE_SUBSYSTEM_WINDOWS_GUI

#define IMAGE_SUBSYSTEM_WINDOWS_GUI   2

Definition at line 514 of file winpe.h.

◆ IMAGE_SUBSYSTEM_XBOX

#define IMAGE_SUBSYSTEM_XBOX   14

Definition at line 524 of file winpe.h.

◆ IntPeGetSectionHeaderByName

#define IntPeGetSectionHeaderByName (   Base,
  Buff,
  Name,
  Cr3,
  Sec 
)    IntPeGetSectionHeadersByName((Base), (Buff), (Name), 1, (Cr3), (Sec), NULL)

◆ MAX_FILE_ALIGNMENT

#define MAX_FILE_ALIGNMENT   0x10000

Definition at line 584 of file winpe.h.

Referenced by IntPeValidateHeader().

◆ MAX_FUNC_LENGTH

#define MAX_FUNC_LENGTH   0xa00

The maximum length (in bytes) of a function.

Definition at line 582 of file winpe.h.

Referenced by IntPeFindFunctionStart(), IntPeFindFunctionStartInBuffer(), and IntWinStackTraceGet64().

◆ MAX_NUMBER_SECTIONS

#define MAX_NUMBER_SECTIONS   96

the maximum number of sections limited by the Windows loader see https://msdn.microsoft.com/en-us/library/windows/desktop/ms680547(v=vs.85).aspx#file_headers

Definition at line 589 of file winpe.h.

◆ MAX_PATH

◆ MIN_FILE_ALIGNMENT

#define MIN_FILE_ALIGNMENT   0x200

Definition at line 585 of file winpe.h.

◆ UNW_FLAG_CHAININFO

#define UNW_FLAG_CHAININFO   0x00000004

Definition at line 413 of file winpe.h.

Referenced by IntPeParseUnwindData(), and IntPeParseUnwindDataInBuffer().

◆ UNW_FLAG_EHANDLER

#define UNW_FLAG_EHANDLER   0x00000001

Definition at line 410 of file winpe.h.

◆ UNW_FLAG_FHANDLER

#define UNW_FLAG_FHANDLER   0x00000003

Definition at line 412 of file winpe.h.

◆ UNW_FLAG_NHANDLER

#define UNW_FLAG_NHANDLER   0x00000000

Definition at line 409 of file winpe.h.

◆ UNW_FLAG_UHANDLER

#define UNW_FLAG_UHANDLER   0x00000002

Definition at line 411 of file winpe.h.

Typedef Documentation

◆ IMAGE_BASE_RELOCATION

◆ IMAGE_BOUND_IMPORT_DESCRIPTOR

◆ IMAGE_DATA_DIRECTORY

◆ IMAGE_DOS_HEADER

◆ IMAGE_EXPORT_DIRECTORY

◆ IMAGE_FILE_HEADER

◆ IMAGE_IMPORT_BY_NAME

◆ IMAGE_IMPORT_DESCRIPTOR

◆ IMAGE_NT_HEADERS32

◆ IMAGE_NT_HEADERS64

◆ IMAGE_OPTIONAL_HEADER32

◆ IMAGE_OPTIONAL_HEADER64

◆ IMAGE_RESOURCE_DATA_ENTRY

◆ IMAGE_RESOURCE_DIRECTORY

◆ IMAGE_RESOURCE_DIRECTORY_ENTRY

◆ IMAGE_SECTION_HEADER

◆ IMAGE_THUNK_DATA32

◆ IMAGE_THUNK_DATA64

◆ INTRO_PE_INFO

typedef struct _INTRO_PE_INFO INTRO_PE_INFO

Intro PE info structure.

◆ INTRO_UNWIND_INFO

Unwind information.

◆ PIMAGE_BASE_RELOCATION

Definition at line 294 of file winpe.h.

◆ PIMAGE_BOUND_IMPORT_DESCRIPTOR

◆ PIMAGE_DATA_DIRECTORY

◆ PIMAGE_DOS_HEADER

◆ PIMAGE_EXPORT_DIRECTORY

◆ PIMAGE_FILE_HEADER

◆ PIMAGE_IMPORT_BY_NAME

◆ PIMAGE_IMPORT_DESCRIPTOR

Definition at line 248 of file winpe.h.

◆ PIMAGE_NT_HEADERS32

◆ PIMAGE_NT_HEADERS64

◆ PIMAGE_OPTIONAL_HEADER32

◆ PIMAGE_OPTIONAL_HEADER64

◆ PIMAGE_RESOURCE_DATA_ENTRY

◆ PIMAGE_RESOURCE_DIRECTORY

◆ PIMAGE_RESOURCE_DIRECTORY_ENTRY

◆ PIMAGE_SECTION_HEADER

◆ PIMAGE_THUNK_DATA32

◆ PIMAGE_THUNK_DATA64

◆ PINTRO_PE_INFO

typedef struct _INTRO_PE_INFO * PINTRO_PE_INFO

◆ PINTRO_UNWIND_INFO

◆ PRUNTIME_FUNCTION

◆ PUNWIND_INFO

typedef struct _UNWIND_INFO * PUNWIND_INFO

◆ RUNTIME_FUNCTION

◆ UNWIND_INFO

typedef struct _UNWIND_INFO UNWIND_INFO

◆ WIN_UNEXPORTED_FUNCTION

Definition at line 575 of file winpe.h.

Function Documentation

◆ IntPeFindExportByName()

INTSTATUS IntPeFindExportByName ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
CHAR Name,
DWORD ExportRva 
)

Find the export name a Rva lies in.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferBuffer containing the MZ/PE image.
[in]NameExport name to be found.
[out]ExportRvaRva the indicated export is found at.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_NOT_FOUNDIf no export containing the Rva is found.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.
INT_STATUS_INSUFFICIENT_RESOURCESIf a memory alloc fails.

Definition at line 1783 of file winpe.c.

Referenced by IntLdrFixImports(), IntVeDeliverDriverForLoad(), and IntWinApiHook().

◆ IntPeFindExportByNameInBuffer()

INTSTATUS IntPeFindExportByNameInBuffer ( QWORD  ImageBase,
BYTE Buffer,
DWORD  BufferSize,
const char *  Name,
DWORD ExportRva 
)

Find the export name a Rva lies in.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]BufferBuffer containing the MZ/PE image.
[in]BufferSizeSize of the Buffer containing the MZ/PE image.
[in]NameExport name to be found.
[out]ExportRvaRva the indicated export is found at.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_NOT_FOUNDIf no export containing the Rva is found.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.

Definition at line 1586 of file winpe.c.

Referenced by IntPeFindKernelExport(), and IntWinHalFindPerformanceCounterInternal().

◆ IntPeFindExportByOrdinal()

INTSTATUS IntPeFindExportByOrdinal ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  Ordinal,
DWORD ExportRva 
)

Find an exported function using its ordinal.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferBuffer containing the MZ/PE image.
[in]OrdinalOrdinal used to find the export.
[out]ExportRvaRva the indicated export is found at.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_NOT_FOUNDIf no export containing the Rva is found.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.

Definition at line 1961 of file winpe.c.

◆ IntPeFindExportByRva()

INTSTATUS IntPeFindExportByRva ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  Rva 
)

Check if a RVA lies inside an exported function.

Will return success if the given RVA is inside an exported function. Does not return the name since that would be slow. For getting the name use the IntPeGetExportNameByRva.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]RvaThe Rva to be checked.
Return values
INT_STATUS_SUCCESSIf the indicated Rva lies within an export.
INT_STATUS_NOT_FOUNDif the RVA isn't inside an exported function
INT_STATUS_INVALID_OBJECT_TYPEif the ImageBase isn't a valid PE/PE+ object

Definition at line 1103 of file winpe.c.

Referenced by IntExceptWinKernelGetOriginator().

◆ IntPeFindExportByRvaInBuffer()

INTSTATUS IntPeFindExportByRvaInBuffer ( QWORD  ImageBase,
BYTE Buffer,
DWORD  BufferSize,
DWORD  Rva 
)

Check if the indicated Rva belongs to an exported function.

Will return success if the given RVA is inside an exported function. Does not return the name since that would be slow. For getting the name use the IntPeGetExportNameByRva.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]BufferBuffer containing the module.
[in]BufferSizeThe size of the buffer containing the module.
[in]RvaThe Rva to be found.
Return values
INT_STATUS_SUCCESSIf an export is found to contain the given Rva.
INT_STATUS_NOT_FOUNDif the RVA isn't inside an exported function
STATUS_INVALID_OBJECT_TYPEif the ImageBase isn't a valid PE/PE+ object

Definition at line 1223 of file winpe.c.

Referenced by IntExceptWinKernelGetOriginator().

◆ IntPeFindFunctionByPattern()

INTSTATUS IntPeFindFunctionByPattern ( QWORD  ImageBase,
WIN_UNEXPORTED_FUNCTION_PATTERN Pattern,
BOOLEAN  IgnoreSectionHint,
DWORD Rva 
)

Find a function using a pattern.

Searches the indicated guest module for a function matching the provided pattern. This function uses IntPeValidateHeader to validate the MZPE headers before using them.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers) to be validated.
[in]PatternThe searched pattern.
[in]IgnoreSectionHintIf true, the pattern section hint will be ignored.
[out]RvaThe Rva the indicated pattern is found at.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_DATA_BUFFER_TOO_SMALLIf a section exceeds the size of the provided buffer.
INT_STATUS_NOT_FOUNDIf not function matching that pattern is found.

Definition at line 3150 of file winpe.c.

Referenced by IntWinAgentFindPropperSyscall(), IntWinAgentFindSyscallLinkage(), and IntWinApiFindFunctionRva().

◆ IntPeFindFunctionByPatternInBuffer()

INTSTATUS IntPeFindFunctionByPatternInBuffer ( BYTE Buffer,
DWORD  BufferSize,
WIN_UNEXPORTED_FUNCTION_PATTERN Pattern,
BOOLEAN  IgnoreSectionHint,
DWORD Rva 
)

Find a function using a pattern.

Searches the indicated buffer for a function matching the provided pattern.

Parameters
[in]BufferThe buffer to search.
[in]BufferSizeThe size of the Buffer to be searched.
[in]PatternThe searched pattern.
[in]IgnoreSectionHintIf true, the pattern section hint will be ignored.
[out]RvaThe Rva the indicated pattern is found at.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_DATA_BUFFER_TOO_SMALLIf a section exceeds the size of the provided buffer.
INT_STATUS_NOT_FOUNDIf not function matching that pattern is found.

Definition at line 3044 of file winpe.c.

Referenced by IntWinAgentFindSyscallLinkage(), IntWinApiFindFunctionRva(), and IntWinInfHookGetEtwpDebuggerData().

◆ IntPeFindFunctionStart()

INTSTATUS IntPeFindFunctionStart ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  Rva,
DWORD BeginAddress 
)

Find the start address of a function, given a Rva pointing inside of it.

Given a Rva, parse code backwards until we find what looks like the start of the function. This function uses either the exception directory for 64 bit executables or the standard prologue for 32 bit executables to locate the beginning of the function.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers) to be validated.
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]RvaThe Rva we will search the function start for.
[out]BeginAddressThe Rva of the identified function start.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_NOT_SUPPORTEDIf the Rva lies in a non-executable section.
INT_STATUS_NOT_FOUNDIf the function start could not be identified.

Definition at line 3297 of file winpe.c.

Referenced by IntAlertEptFillFromVictimZone(), IntPeFindExportByRva(), and IntPeFindExportByRvaInBuffer().

◆ IntPeFindFunctionStartInBuffer()

INTSTATUS IntPeFindFunctionStartInBuffer ( QWORD  ImageBase,
BYTE Buffer,
DWORD  BufferSize,
DWORD  Rva,
DWORD BeginAddress 
)

Find the start address of a function, given a Rva pointing inside of it.

Given a Rva, parse code backwards until we find what looks like the start of the function. This function uses either the exception directory for 64 bit executables or the standard prologue for 32 bit executables to locate the beginning of the function. For 64-bit MZPEs IntPeParseUnwindDataInBuffer should be used instead.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers) to be validated.
[in]BufferThe buffer containing the MZ/PE image.
[in]BufferSizeThe size of the Buffer containing the MZ/PE image.
[in]RvaThe Rva we will search the function start for.
[out]BeginAddressThe Rva of the identified function start.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_NOT_SUPPORTEDIf the Rva lies in a non-executable section.
INT_STATUS_NOT_FOUNDIf the function start could not be identified.

Definition at line 3624 of file winpe.c.

Referenced by IntAlertEptFillFromVictimZone().

◆ IntPeFindKernelExport()

INTSTATUS IntPeFindKernelExport ( const char *  Name,
QWORD ExportGva 
)

Find an export inside the NT kernel image.

Parameters
[in]NameExport to be found.
[out]ExportGvaGuest virtual address (NOT RVA!) of the identified export.
Return values
INT_STATUS_SUCCESSOn success.

Definition at line 1748 of file winpe.c.

Referenced by IntWinApiHook(), IntWinGuestIsIncreasedUserVa(), IntWinGuestResolveImports(), IntWinHalCreateHalData(), IntWinProcPrepareInstrument(), and IntWinThrPrepareApcHandler().

◆ IntPeGetDirectory()

INTSTATUS IntPeGetDirectory ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  DirectoryEntry,
IMAGE_DATA_DIRECTORY Directory 
)

Validate & return the indicated image data directory.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]DirectoryEntryData directory entry to be fetched.
[out]DirectoryWill contain, upon successful return, the requested data directory.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE is malformed or corrupted in any way.
INT_STATUS_NOT_FOUNDIf the indicated data directory is not present.

Definition at line 552 of file winpe.c.

Referenced by IntExceptWinGetVictimDriver(), IntLdrLoadPEImage(), IntPeFindExportByName(), IntPeFindExportByNameInBuffer(), IntPeFindExportByOrdinal(), IntPeFindExportByRva(), IntPeFindExportByRvaInBuffer(), IntPeGetExportNameByRva(), IntPeGetExportNameByRvaInBuffer(), IntPeGetRuntimeFunction(), IntPeGetRuntimeFunctionInBuffer(), IntWinDrvHeadersInMemory(), IntWinProtectReadNtEat(), and IntWinUmModCacheFillHeaders().

◆ IntPeGetExportNameByRva()

INTSTATUS IntPeGetExportNameByRva ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  Rva,
DWORD  ExportNameSize,
CHAR ExportName 
)

Find the export name a Rva lies in.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]RvaThe Rva for which we wish to find the export name.
[in]ExportNameSizeMaximum length of the ExportName buffer, which will contain the export name, including the NULL-terminator.
[out]ExportNameWill contain upon successful return the name of the export Rva belongs to.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_NOT_FOUNDIf no export containing the Rva is found.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.

Definition at line 1312 of file winpe.c.

Referenced by IntAlertEptFillFromVictimZone().

◆ IntPeGetExportNameByRvaInBuffer()

INTSTATUS IntPeGetExportNameByRvaInBuffer ( QWORD  ImageBase,
BYTE Buffer,
DWORD  BufferSize,
DWORD  Rva,
DWORD  ExportNameSize,
CHAR ExportName 
)

Find the export name a Rva lies in.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]BufferBuffer containing the MZ/PE image.
[in]BufferSizeSize of the Buffer containing the MZ/PE image.
[in]RvaThe Rva for which we wish to find the export name.
[in]ExportNameSizeMaximum length of the ExportName buffer, which will contain the export name.
[out]ExportNameWill contain upon successful return the name of the export Rva belongs to.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_NOT_FOUNDIf no export containing the Rva is found.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.

Definition at line 1457 of file winpe.c.

Referenced by IntAlertEptFillFromVictimZone().

◆ IntPeGetRuntimeFunction()

INTSTATUS IntPeGetRuntimeFunction ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  Rva,
RUNTIME_FUNCTION RuntimeFunction 
)

Parses the exception directory and gets the runtime function corresponding to the Rva.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferBuffer containing the MZ/PE image.
[in]RvaThe Rva whose runtime function is to be found.
[out]RuntimeFunctionThe identified runtime function for the indicated Rva.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.
INT_STATUS_NOT_SUPPORTEDIf the indicated MZ/PE file is not 64 bit.
INT_STATUS_NOT_FOUNDIf no function is found at that RVA

Definition at line 2062 of file winpe.c.

Referenced by IntPeFindFunctionStart(), and IntWinStackTraceGet64().

◆ IntPeGetRuntimeFunctionInBuffer()

INTSTATUS IntPeGetRuntimeFunctionInBuffer ( QWORD  ImageBase,
BYTE Buffer,
DWORD  BufferSize,
DWORD  Rva,
RUNTIME_FUNCTION RuntimeFunction 
)

Parses the exception directory and gets the runtime function corresponding to the Rva.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]BufferBuffer containing the MZ/PE image.
[in]BufferSizeThe size of the Buffer containing the MZ/PE image.
[in]RvaThe Rva whose runtime function is to be found.
[out]RuntimeFunctionThe identified runtime function for the indicated Rva.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE file is malformed or corrupted in any way.
INT_STATUS_NOT_SUPPORTEDIf the indicated MZ/PE file is not 64 bit.
INT_STATUS_NOT_FOUNDIf no function is found at that RVA

Definition at line 2267 of file winpe.c.

Referenced by IntPeFindFunctionStartInBuffer(), and IntWinStackTraceGet64().

◆ IntPeGetSectionHeaderByIndex()

INTSTATUS IntPeGetSectionHeaderByIndex ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  Index,
IMAGE_SECTION_HEADER SectionHeader 
)

Return the section header located on position Index (0 based).

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]IndexIndex of the section header to be returned (0 based).
[out]SectionHeaderWill contain, upon successful return, the section header located at Index.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE is malformed or corrupted in any way.
INT_STATUS_NOT_FOUNDIf the section Index is not found.

Definition at line 838 of file winpe.c.

Referenced by IntPtiMonitorAllPtWriteCandidates().

◆ IntPeGetSectionHeaderByRva()

INTSTATUS IntPeGetSectionHeaderByRva ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  GuestRva,
IMAGE_SECTION_HEADER SectionHeader 
)

Given a relative virtual address, return the section header which describes the section the RVA lies in.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]GuestRvaThe RVA to be found.
[out]SectionHeaderWill contain, upon successful return, the section header describing the section that contains the indicated RVA.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE is malformed or corrupted in any way.
INT_STATUS_NOT_FOUNDIf a section containing the RVA is not found.

Definition at line 707 of file winpe.c.

Referenced by IntExceptGetVictimEpt(), IntExceptWinGetVictimDriver(), IntExceptWinKernelGetOriginator(), IntPeFindFunctionStart(), IntPeFindFunctionStartInBuffer(), IntPtiIsPtrInAgent(), IntWinDagentSendDoubleAgentAlert(), IntWinGuestValidateKernel(), IntWinModFillDriverInjectionData(), IntWinStackTraceGet64(), IntWinStackTraceGetUser32(), and IntWinStackTraceGetUser64().

◆ IntPeGetSectionHeadersByName()

INTSTATUS IntPeGetSectionHeadersByName ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
PCHAR  Name,
DWORD  NumberOfSectionHeadersAllocated,
QWORD  Cr3,
IMAGE_SECTION_HEADER SectionHeaders,
DWORD NumberOfSectionHeadersFilled 
)

Return all the section headers matching the indicated Name.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]NameThe name of the searched sections.
[in]NumberOfSectionHeadersAllocatedNumber of section headers allocated for the results.
[in]Cr3The Cr3 used for mapping the headers in case ImageBaseBuffer is not provided.
[out]SectionHeadersBuffer containing NumberOfSectionHeadersAllocated slots.
[out]NumberOfSectionHeadersFilledNumber of slots filled in the SectionHeaders = number of sections found to have the indicated Name.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE is malformed or corrupted in any way.
INT_STATUS_NOT_FOUNDIf no section with the given name is found.

Definition at line 942 of file winpe.c.

Referenced by IntWinGuestFindDriversNamespace(), IntWinGuestFindDriversNamespaceNoBuffer(), IntWinGuestFindKernelObjectsInternal(), IntWinGuestValidateKernel(), IntWinHalFindHalHeapAndInterruptController(), and IntWinHalFindInterruptController().

◆ IntPeListSectionsHeaders()

INTSTATUS IntPeListSectionsHeaders ( QWORD  ImageBase,
BYTE ImageBuffer,
DWORD  ImageBufferSize,
DWORD FirstSectionOffset,
DWORD SectionCount 
)

Will get the offset to the first section header and the number of sections from the given module.

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]ImageBufferSizeIf ImageBaseBuffer is valid, this indicates its size.
[out]FirstSectionOffsetOffset to the first section header.
[out]SectionCountNumber of sections.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.
INT_STATUS_INVALID_OBJECT_TYPEIf the MZ/PE is malformed or corrupted in any way.

Definition at line 473 of file winpe.c.

Referenced by IntPtiHookPtDriver(), IntVeEnableDisableDriverAccessInProtectedView(), IntVeHookVeDriver(), IntWinDagentHandleSuspModHeaders(), and IntWinModHookModule().

◆ IntPeParseUnwindData()

INTSTATUS IntPeParseUnwindData ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
RUNTIME_FUNCTION RuntimeFunction,
DWORD  RipOffset,
DWORD ReservedStack,
DWORD BeginAddress,
BOOLEAN InterruptFunction,
BOOLEAN ExceptionFunction,
BOOLEAN HasFramePointer 
)

Parse the unwind data for the indicated function and return the prologue size.

Parses the UNWIND_INFO structure(s) of the RuntimeFunction and returns the total space occupied by the function prologue (it can be 0!).

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]ImageBaseBufferBuffer containing the MZ/PE image.
[in]RuntimeFunctionThe runtime function to be parsed.
[in]RipOffsetThe offset inside the function where the RIP is.
[out]ReservedStackSize reserved on the stack for that function.
[out]BeginAddressThe actual beginning of the function (after parsing chained info).
[out]InterruptFunctionTrue if it's an interrupt handler function.
[out]ExceptionFunctionTrue if it's an exception handler function.
[out]HasFramePointerTrue if the function uses a frame pointer.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.

Definition at line 2395 of file winpe.c.

Referenced by IntPeFindFunctionStart(), and IntWinStackTraceGet64().

◆ IntPeParseUnwindDataInBuffer()

INTSTATUS IntPeParseUnwindDataInBuffer ( QWORD  ImageBase,
BYTE Buffer,
DWORD  BufferSize,
RUNTIME_FUNCTION RuntimeFunction,
DWORD  RipOffset,
DWORD ReservedStack,
DWORD BeginAddress,
BOOLEAN InterruptFunction,
BOOLEAN ExceptionFunction,
BOOLEAN HasFramePointer 
)

Parse the unwind data for the indicated function and return the prologue size.

Parses the UNWIND_INFO structure(s) of the RuntimeFunction and returns the total space occupied by the function prologue (it can be 0!).

Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers).
[in]BufferBuffer containing the MZ/PE image.
[in]BufferSizeThe size of the Buffer containing the MZ/PE image.
[in]RuntimeFunctionThe runtime function to be parsed.
[in]RipOffsetThe offset inside the function where the RIP is.
[out]ReservedStackSize reserved on the stack for that function.
[out]BeginAddressThe actual beginning of the function (after parsing chained info).
[out]InterruptFunctionTrue if it's an interrupt handler function.
[out]ExceptionFunctionTrue if it's an exception handler function.
[out]HasFramePointerTrue if the function uses a frame pointer.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.

Definition at line 2726 of file winpe.c.

Referenced by IntPeFindFunctionStartInBuffer(), and IntWinStackTraceGet64().

◆ IntPeValidateHeader()

INTSTATUS IntPeValidateHeader ( QWORD  ImageBase,
BYTE ImageBaseBuffer,
DWORD  ImageBaseBufferSize,
INTRO_PE_INFO PeInfo,
QWORD  Cr3 
)

Validates a PE header.

This function will perform several checks on the given PE header:

  1. MZ and PE signatures;
  2. Optional header size;
  3. Sections (offset, size);
  4. Entry point;
  5. File & section alignment; If all the checks pass (the PE does not look malformed/corrupted), it will return the information in the PeInfo structure. In order to work, at least a page of memory (containing the MZ/PE) headers must be mapped. If the caller provides ImageBaseBuffer, it must make sure that at least one page is available.
Parameters
[in]ImageBaseGuest virtual address of the beginning of the module (headers) to be validated.
[in]ImageBaseBufferAddress where the ImageBase is already mapped in Introcore space, if present.
[in]ImageBaseBufferSizeIf ImageBaseBuffer is valid, this indicates its size.
[out]PeInfoWill contain upon successful validation relevant PE information.
[in]Cr3Optional virtual address space the image lies in.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_NOT_SUPPORTEDIf the base of the PE file is not aligned to 4K.
INT_STATUS_INVALID_OBJECT_TYPEIf the PE file is malformed or corrupted in any way.

Definition at line 131 of file winpe.c.

Referenced by IntLdrGetImageSizeAndEntryPoint(), IntLdrLoadPEImage(), IntModBlockHandleBlockModHeadersInMemory(), IntPeFindExportByNameInBuffer(), IntPeFindExportByRvaInBuffer(), IntPeFindFunctionByPattern(), IntPeFindFunctionByPatternInBuffer(), IntPeFindFunctionStart(), IntPeFindFunctionStartInBuffer(), IntPeGetDirectory(), IntPeGetExportNameByRvaInBuffer(), IntPeGetRuntimeFunction(), IntPeGetRuntimeFunctionInBuffer(), IntPeGetSectionHeaderByIndex(), IntPeGetSectionHeaderByRva(), IntPeGetSectionHeadersByName(), IntPeListSectionsHeaders(), IntSlackAllocWindows(), IntWinDagentCheckNativeSubsystem(), IntWinDepInjectProcess(), IntWinDrvHeadersInMemory(), IntWinDrvObjIsValidDriverObject(), IntWinGuestReadKernel(), IntWinHalReadHal(), IntWinModHookPoly(), and IntWinUmModCacheFillHeaders().