diff options
author | midipix <writeonce@midipix.org> | 2017-02-04 08:36:21 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-02-04 08:36:21 -0500 |
commit | 7a49205fc2984352d35e8e0b989f682d16ed67ff (patch) | |
tree | 53d6df9225fe9e2c55ecf73c6193d1234f335419 /src/internal | |
parent | c747614247235ffb6a5c007919658d3bc87fbd30 (diff) | |
download | mdso-7a49205fc2984352d35e8e0b989f682d16ed67ff.tar.bz2 mdso-7a49205fc2984352d35e8e0b989f682d16ed67ff.tar.xz |
internals: added PE constants and raw struct definitions.
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/perk/perk_consts.h | 371 | ||||
-rw-r--r-- | src/internal/perk/perk_structs.h | 334 |
2 files changed, 705 insertions, 0 deletions
diff --git a/src/internal/perk/perk_consts.h b/src/internal/perk/perk_consts.h new file mode 100644 index 0000000..f948c26 --- /dev/null +++ b/src/internal/perk/perk_consts.h @@ -0,0 +1,371 @@ +#ifndef PERK_CONSTS_H +#define PERK_CONSTS_H + +#ifndef PE_BITWISE +#define PE_BITWISE(x) x +#endif + +#ifndef PE_ARBITRARY +#define PE_ARBITRARY(x) x +#endif + +#define PE_IMAGE_REL_BASED_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_BASED_HIGH PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_BASED_LOW PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_BASED_HIGHLOW PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_BASED_HIGHADJ PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_BASED_MIPS_JMPADDR PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_BASED_ARM_MOV32A PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_BASED_RESERVED PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_BASED_ARM_MOV32T PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_BASED_MIPS_JMPADDR16 PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_BASED_DIR64 PE_ARBITRARY (0x0000000a) +#define PE_WIN_CERT_REVISION_1_0 PE_ARBITRARY (0x00000100) +#define PE_WIN_CERT_REVISION_2_0 PE_ARBITRARY (0x00000200) +#define PE_WIN_CERT_TYPE_X509 PE_ARBITRARY (0x00000001) +#define PE_WIN_CERT_TYPE_PKCS_SIGNED_DATA PE_ARBITRARY (0x00000002) +#define PE_WIN_CERT_TYPE_RESERVED_1 PE_ARBITRARY (0x00000003) +#define PE_WIN_CERT_TYPE_TS_STACK_SIGNED PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_ARM_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_ARM_ADDR32 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_ARM_ADDR32NB PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_ARM_BRANCH24 PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_ARM_BRANCH11 PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_ARM_TOKEN PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_ARM_BLX24 PE_ARBITRARY (0x00000008) +#define PE_IMAGE_REL_ARM_BLX11 PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_ARM_SECTION PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_REL_ARM_SECREL PE_ARBITRARY (0x0000000f) +#define PE_IMAGE_REL_ARM_MOV32A PE_ARBITRARY (0x00000010) +#define PE_IMAGE_REL_ARM_MOV32T PE_ARBITRARY (0x00000011) +#define PE_IMAGE_REL_ARM_BRANCH20T PE_ARBITRARY (0x00000012) +#define PE_IMAGE_REL_ARM_BRANCH24T PE_ARBITRARY (0x00000014) +#define PE_IMAGE_REL_ARM_BLX23T PE_ARBITRARY (0x00000015) +#define PE_IMAGE_REL_SH3_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_SH3_DIRECT16 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_SH3_DIRECT32 PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_SH3_DIRECT8 PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_SH3_DIRECT8_WORD PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_SH3_DIRECT8_LONG PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_SH3_DIRECT4 PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_SH3_DIRECT4_WORD PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_SH3_DIRECT4_LONG PE_ARBITRARY (0x00000008) +#define PE_IMAGE_REL_SH3_PCREL8_WORD PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_SH3_PCREL8_LONG PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_SH3_PCREL12_WORD PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_SH3_STARTOF_SECTION PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_SH3_SIZEOF_SECTION PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_REL_SH3_SECTION PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_REL_SH3_SECREL PE_ARBITRARY (0x0000000f) +#define PE_IMAGE_REL_SH3_DIRECT32_NB PE_ARBITRARY (0x00000010) +#define PE_IMAGE_REL_SH3_GPREL4_LONG PE_ARBITRARY (0x00000011) +#define PE_IMAGE_REL_SH3_TOKEN PE_ARBITRARY (0x00000012) +#define PE_IMAGE_REL_SHM_PCRELPT PE_ARBITRARY (0x00000013) +#define PE_IMAGE_REL_SHM_REFLO PE_ARBITRARY (0x00000014) +#define PE_IMAGE_REL_SHM_REFHALF PE_ARBITRARY (0x00000015) +#define PE_IMAGE_REL_SHM_RELLO PE_ARBITRARY (0x00000016) +#define PE_IMAGE_REL_SHM_RELHALF PE_ARBITRARY (0x00000017) +#define PE_IMAGE_REL_SHM_PAIR PE_ARBITRARY (0x00000018) +#define PE_IMAGE_REL_SHM_NOMODE PE_ARBITRARY (0x00008000) +#define PE_IMAGE_REL_I386_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_I386_DIR16 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_I386_REL16 PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_I386_DIR32 PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_I386_DIR32NB PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_I386_SEG12 PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_I386_SECTION PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_I386_SECREL PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_I386_TOKEN PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_I386_SECREL7 PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_REL_I386_REL32 PE_ARBITRARY (0x00000014) +#define PE_IMAGE_REL_IA64_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_IA64_IMM14 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_IA64_IMM22 PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_IA64_IMM64 PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_IA64_DIR32 PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_IA64_DIR64 PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_IA64_PCREL21B PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_IA64_PCREL21M PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_IA64_PCREL21F PE_ARBITRARY (0x00000008) +#define PE_IMAGE_REL_IA64_GPREL22 PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_IA64_LTOFF22 PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_IA64_SECTION PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_IA64_SECREL22 PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_IA64_SECREL64I PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_REL_IA64_SECREL32 PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_REL_IA64_DIR32NB PE_ARBITRARY (0x00000010) +#define PE_IMAGE_REL_IA64_SREL14 PE_ARBITRARY (0x00000011) +#define PE_IMAGE_REL_IA64_SREL22 PE_ARBITRARY (0x00000012) +#define PE_IMAGE_REL_IA64_SREL32 PE_ARBITRARY (0x00000013) +#define PE_IMAGE_REL_IA64_UREL32 PE_ARBITRARY (0x00000014) +#define PE_IMAGE_REL_IA64_PCREL60X PE_ARBITRARY (0x00000015) +#define PE_IMAGE_REL_IA64_PCREL60B PE_ARBITRARY (0x00000016) +#define PE_IMAGE_REL_IA64_PCREL60F PE_ARBITRARY (0x00000017) +#define PE_IMAGE_REL_IA64_PCREL60I PE_ARBITRARY (0x00000018) +#define PE_IMAGE_REL_IA64_PCREL60M PE_ARBITRARY (0x00000019) +#define PE_IMAGE_REL_IA64_IMMGPREL64 PE_ARBITRARY (0x0000001a) +#define PE_IMAGE_REL_IA64_TOKEN PE_ARBITRARY (0x0000001b) +#define PE_IMAGE_REL_IA64_GPREL32 PE_ARBITRARY (0x0000001c) +#define PE_IMAGE_REL_IA64_ADDEND PE_ARBITRARY (0x0000001f) +#define PE_IMAGE_REL_PPC_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_PPC_ADDR64 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_PPC_ADDR32 PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_PPC_ADDR24 PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_PPC_ADDR16 PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_PPC_ADDR14 PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_PPC_REL24 PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_PPC_REL14 PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_PPC_ADDR32NB PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_PPC_SECREL PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_PPC_SECTION PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_PPC_SECREL16 PE_ARBITRARY (0x0000000f) +#define PE_IMAGE_REL_PPC_REFHI PE_ARBITRARY (0x00000010) +#define PE_IMAGE_REL_PPC_REFLO PE_ARBITRARY (0x00000011) +#define PE_IMAGE_REL_PPC_PAIR PE_ARBITRARY (0x00000012) +#define PE_IMAGE_REL_PPC_SECRELLO PE_ARBITRARY (0x00000013) +#define PE_IMAGE_REL_PPC_GPREL PE_ARBITRARY (0x00000015) +#define PE_IMAGE_REL_PPC_TOKEN PE_ARBITRARY (0x00000016) +#define PE_IMAGE_REL_MIPS_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_MIPS_REFHALF PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_MIPS_REFWORD PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_MIPS_JMPADDR PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_MIPS_REFHI PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_MIPS_REFLO PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_MIPS_GPREL PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_MIPS_LITERAL PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_MIPS_SECTION PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_MIPS_SECREL PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_MIPS_SECRELLO PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_MIPS_SECRELHI PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_REL_MIPS_JMPADDR16 PE_ARBITRARY (0x00000010) +#define PE_IMAGE_REL_MIPS_REFWORDNB PE_ARBITRARY (0x00000022) +#define PE_IMAGE_REL_MIPS_PAIR PE_ARBITRARY (0x00000025) +#define PE_IMAGE_REL_M32R_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_M32R_ADDR32 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_M32R_ADDR32NB PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_M32R_ADDR24 PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_M32R_GPREL16 PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_M32R_PCREL24 PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_M32R_PCREL16 PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_M32R_PCREL8 PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_M32R_REFHALF PE_ARBITRARY (0x00000008) +#define PE_IMAGE_REL_M32R_REFHI PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_M32R_REFLO PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_M32R_PAIR PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_M32R_SECTION PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_M32R_SECREL PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_REL_M32R_TOKEN PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_REL_AMD64_ABSOLUTE PE_ARBITRARY (0x00000000) +#define PE_IMAGE_REL_AMD64_ADDR64 PE_ARBITRARY (0x00000001) +#define PE_IMAGE_REL_AMD64_ADDR32 PE_ARBITRARY (0x00000002) +#define PE_IMAGE_REL_AMD64_ADDR32NB PE_ARBITRARY (0x00000003) +#define PE_IMAGE_REL_AMD64_REL32 PE_ARBITRARY (0x00000004) +#define PE_IMAGE_REL_AMD64_REL32_1 PE_ARBITRARY (0x00000005) +#define PE_IMAGE_REL_AMD64_REL32_2 PE_ARBITRARY (0x00000006) +#define PE_IMAGE_REL_AMD64_REL32_3 PE_ARBITRARY (0x00000007) +#define PE_IMAGE_REL_AMD64_REL32_4 PE_ARBITRARY (0x00000008) +#define PE_IMAGE_REL_AMD64_REL32_5 PE_ARBITRARY (0x00000009) +#define PE_IMAGE_REL_AMD64_SECTION PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_REL_AMD64_SECREL PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_REL_AMD64_SECREL7 PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_REL_AMD64_TOKEN PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_REL_AMD64_SREL32 PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_REL_AMD64_PAIR PE_ARBITRARY (0x0000000f) +#define PE_IMAGE_REL_AMD64_SSPAN32 PE_ARBITRARY (0x00000010) +#define PE_IMAGE_COMDAT_SELECT_NODUPLICATES PE_ARBITRARY (0x00000001) +#define PE_IMAGE_COMDAT_SELECT_ANY PE_ARBITRARY (0x00000002) +#define PE_IMAGE_COMDAT_SELECT_SAME_SIZE PE_ARBITRARY (0x00000003) +#define PE_IMAGE_COMDAT_SELECT_EXACT_MATCH PE_ARBITRARY (0x00000004) +#define PE_IMAGE_COMDAT_SELECT_ASSOCIATIVE PE_ARBITRARY (0x00000005) +#define PE_IMAGE_COMDAT_SELECT_LARGEST PE_ARBITRARY (0x00000006) +#define PE_IMAGE_DLL_RESERVED_X0001 PE_BITWISE (0x00000001) +#define PE_IMAGE_DLL_RESERVED_X0002 PE_BITWISE (0x00000002) +#define PE_IMAGE_DLL_RESERVED_X0004 PE_BITWISE (0x00000004) +#define PE_IMAGE_DLL_RESERVED_X0008 PE_BITWISE (0x00000008) +#define PE_IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE PE_BITWISE (0x00000040) +#define PE_IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY PE_BITWISE (0x00000080) +#define PE_IMAGE_DLL_CHARACTERISTICS_NX_COMPAT PE_BITWISE (0x00000100) +#define PE_IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION PE_BITWISE (0x00000200) +#define PE_IMAGE_DLL_CHARACTERISTICS_NO_SEH PE_BITWISE (0x00000400) +#define PE_IMAGE_DLL_CHARACTERISTICS_NO_BIND PE_BITWISE (0x00000800) +#define PE_IMAGE_DLL_RESERVED_X1000 PE_BITWISE (0x00001000) +#define PE_IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER PE_BITWISE (0x00002000) +#define PE_IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE PE_BITWISE (0x00008000) +#define PE_IMAGE_FILE_RELOCS_STRIPPED PE_BITWISE (0x00000001) +#define PE_IMAGE_FILE_EXECUTABLE_IMAGE PE_BITWISE (0x00000002) +#define PE_IMAGE_FILE_LINE_NUMS_STRIPPED PE_BITWISE (0x00000004) +#define PE_IMAGE_FILE_LOCAL_SYMS_STRIPPED PE_BITWISE (0x00000008) +#define PE_IMAGE_FILE_AGGRESSIVE_WS_TRIM PE_BITWISE (0x00000010) +#define PE_IMAGE_FILE_LARGE_ADDRESS_AWARE PE_BITWISE (0x00000020) +#define PE_IMAGE_FILE_RESERVED_CHARACTERISTIC PE_BITWISE (0x00000040) +#define PE_IMAGE_FILE_BYTES_REVERSED_LO PE_BITWISE (0x00000080) +#define PE_IMAGE_FILE_32BIT_MACHINE PE_BITWISE (0x00000100) +#define PE_IMAGE_FILE_DEBUG_STRIPPED PE_BITWISE (0x00000200) +#define PE_IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP PE_BITWISE (0x00000400) +#define PE_IMAGE_FILE_NET_RUN_FROM_SWAP PE_BITWISE (0x00000800) +#define PE_IMAGE_FILE_SYSTEM PE_BITWISE (0x00001000) +#define PE_IMAGE_FILE_DLL PE_BITWISE (0x00002000) +#define PE_IMAGE_FILE_UP_SYSTEM_ONLY PE_BITWISE (0x00004000) +#define PE_IMAGE_FILE_BYTES_REVERSED_HI PE_BITWISE (0x00008000) +#define PE_IMAGE_DEBUG_TYPE_UNKNOWN PE_ARBITRARY (0x00000000) +#define PE_IMAGE_DEBUG_TYPE_COFF PE_ARBITRARY (0x00000001) +#define PE_IMAGE_DEBUG_TYPE_CODEVIEW PE_ARBITRARY (0x00000002) +#define PE_IMAGE_DEBUG_TYPE_FPO PE_ARBITRARY (0x00000003) +#define PE_IMAGE_DEBUG_TYPE_MISC PE_ARBITRARY (0x00000004) +#define PE_IMAGE_DEBUG_TYPE_EXCEPTION PE_ARBITRARY (0x00000005) +#define PE_IMAGE_DEBUG_TYPE_FIXUP PE_ARBITRARY (0x00000006) +#define PE_IMAGE_DEBUG_TYPE_OMAP_TO_SRC PE_ARBITRARY (0x00000007) +#define PE_IMAGE_DEBUG_TYPE_OMAP_FROM_SRC PE_ARBITRARY (0x00000008) +#define PE_IMAGE_DEBUG_TYPE_BORLAND PE_ARBITRARY (0x00000009) +#define PE_IMAGE_DEBUG_TYPE_RESERVED10 PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_DEBUG_TYPE_CLSID PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_SUBSYSTEM_UNKNOWN PE_ARBITRARY (0x00000000) +#define PE_IMAGE_SUBSYSTEM_NATIVE PE_ARBITRARY (0x00000001) +#define PE_IMAGE_SUBSYSTEM_WINDOWS_GUI PE_ARBITRARY (0x00000002) +#define PE_IMAGE_SUBSYSTEM_WINDOWS_CUI PE_ARBITRARY (0x00000003) +#define PE_IMAGE_SUBSYSTEM_POSIX_CUI PE_ARBITRARY (0x00000007) +#define PE_IMAGE_SUBSYSTEM_WINDOWS_CE_GUI PE_ARBITRARY (0x00000009) +#define PE_IMAGE_SUBSYSTEM_EFI_APPLICATION PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_SUBSYSTEM_EFI_ROM PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_SUBSYSTEM_XBOX PE_ARBITRARY (0x0000000e) +#define PE_IMPORT_ORDINAL PE_ARBITRARY (0x00000000) +#define PE_IMPORT_NAME PE_ARBITRARY (0x00000001) +#define PE_IMPORT_NAME_NOPREFIX PE_ARBITRARY (0x00000002) +#define PE_IMPORT_NAME_UNDECORATE PE_ARBITRARY (0x00000003) +#define PE_IMPORT_CODE PE_ARBITRARY (0x00000000) +#define PE_IMPORT_DATA PE_ARBITRARY (0x00000001) +#define PE_IMPORT_CONST PE_ARBITRARY (0x00000002) +#define PE_IMAGE_FILE_MACHINE_UNKNOWN PE_ARBITRARY (0x00000000) +#define PE_IMAGE_FILE_MACHINE_I386 PE_ARBITRARY (0x0000014c) +#define PE_IMAGE_FILE_MACHINE_R4000 PE_ARBITRARY (0x00000166) +#define PE_IMAGE_FILE_MACHINE_WCEMIPSV2 PE_ARBITRARY (0x00000169) +#define PE_IMAGE_FILE_MACHINE_SH3 PE_ARBITRARY (0x000001a2) +#define PE_IMAGE_FILE_MACHINE_SH3DSP PE_ARBITRARY (0x000001a3) +#define PE_IMAGE_FILE_MACHINE_SH4 PE_ARBITRARY (0x000001a6) +#define PE_IMAGE_FILE_MACHINE_SH5 PE_ARBITRARY (0x000001a8) +#define PE_IMAGE_FILE_MACHINE_ARM PE_ARBITRARY (0x000001c0) +#define PE_IMAGE_FILE_MACHINE_THUMB PE_ARBITRARY (0x000001c2) +#define PE_IMAGE_FILE_MACHINE_ARMV7 PE_ARBITRARY (0x000001c4) +#define PE_IMAGE_FILE_MACHINE_AM33 PE_ARBITRARY (0x000001d3) +#define PE_IMAGE_FILE_MACHINE_POWERPC PE_ARBITRARY (0x000001f0) +#define PE_IMAGE_FILE_MACHINE_POWERPCFP PE_ARBITRARY (0x000001f1) +#define PE_IMAGE_FILE_MACHINE_IA64 PE_ARBITRARY (0x00000200) +#define PE_IMAGE_FILE_MACHINE_MIPS16 PE_ARBITRARY (0x00000266) +#define PE_IMAGE_FILE_MACHINE_MIPSFPU PE_ARBITRARY (0x00000366) +#define PE_IMAGE_FILE_MACHINE_MIPSFPU16 PE_ARBITRARY (0x00000466) +#define PE_IMAGE_FILE_MACHINE_EBC PE_ARBITRARY (0x00000ebc) +#define PE_IMAGE_FILE_MACHINE_AMD64 PE_ARBITRARY (0x00008664) +#define PE_IMAGE_FILE_MACHINE_M32R PE_ARBITRARY (0x00009041) +#define PE_MAGIC_ROM_IMAGE PE_ARBITRARY (0x00000107) +#define PE_MAGIC_PE32 PE_ARBITRARY (0x0000010b) +#define PE_MAGIC_PE32_PLUS PE_ARBITRARY (0x0000020b) +#define PE_IMAGE_SCN_RESERVED_X00000001 PE_BITWISE (0x00000001) +#define PE_IMAGE_SCN_RESERVED_X00000002 PE_BITWISE (0x00000002) +#define PE_IMAGE_SCN_RESERVED_X00000004 PE_BITWISE (0x00000004) +#define PE_IMAGE_SCN_TYPE_NO_PAD PE_BITWISE (0x00000008) +#define PE_IMAGE_SCN_RESERVED_X00000010 PE_BITWISE (0x00000010) +#define PE_IMAGE_SCN_CNT_CODE PE_BITWISE (0x00000020) +#define PE_IMAGE_SCN_CNT_INITIALIZED_DATA PE_BITWISE (0x00000040) +#define PE_IMAGE_SCN_CNT_UNINITIALIZED_DATA PE_BITWISE (0x00000080) +#define PE_IMAGE_SCN_LNK_OTHER PE_BITWISE (0x00000100) +#define PE_IMAGE_SCN_LNK_INFO PE_BITWISE (0x00000200) +#define PE_IMAGE_SCN_RESERVED_X00000400 PE_BITWISE (0x00000400) +#define PE_IMAGE_SCN_LNK_REMOVE PE_BITWISE (0x00000800) +#define PE_IMAGE_SCN_LNK_COMDAT PE_BITWISE (0x00001000) +#define PE_IMAGE_SCN_GPREL PE_BITWISE (0x00008000) +#define PE_IMAGE_SCN_MEM_PURGEABLE PE_BITWISE (0x00020000) +#define PE_IMAGE_SCN_MEM_16BIT PE_BITWISE (0x00020000) +#define PE_IMAGE_SCN_MEM_LOCKED PE_BITWISE (0x00040000) +#define PE_IMAGE_SCN_MEM_PRELOAD PE_BITWISE (0x00080000) +#define PE_IMAGE_SCN_ALIGN_1BYTES PE_BITWISE (0x00100000) +#define PE_IMAGE_SCN_ALIGN_2BYTES PE_BITWISE (0x00200000) +#define PE_IMAGE_SCN_ALIGN_4BYTES PE_BITWISE (0x00300000) +#define PE_IMAGE_SCN_ALIGN_8BYTES PE_BITWISE (0x00400000) +#define PE_IMAGE_SCN_ALIGN_16BYTES PE_BITWISE (0x00500000) +#define PE_IMAGE_SCN_ALIGN_32BYTES PE_BITWISE (0x00600000) +#define PE_IMAGE_SCN_ALIGN_64BYTES PE_BITWISE (0x00700000) +#define PE_IMAGE_SCN_ALIGN_128BYTES PE_BITWISE (0x00800000) +#define PE_IMAGE_SCN_ALIGN_256BYTES PE_BITWISE (0x00900000) +#define PE_IMAGE_SCN_ALIGN_512BYTES PE_BITWISE (0x00a00000) +#define PE_IMAGE_SCN_ALIGN_1024BYTES PE_BITWISE (0x00b00000) +#define PE_IMAGE_SCN_ALIGN_2048BYTES PE_BITWISE (0x00c00000) +#define PE_IMAGE_SCN_ALIGN_4096BYTES PE_BITWISE (0x00d00000) +#define PE_IMAGE_SCN_ALIGN_8192BYTES PE_BITWISE (0x00e00000) +#define PE_IMAGE_SCN_LNK_NRELOC_OVFL PE_BITWISE (0x01000000) +#define PE_IMAGE_SCN_MEM_DISCARDABLE PE_BITWISE (0x02000000) +#define PE_IMAGE_SCN_MEM_NOT_CACHED PE_BITWISE (0x04000000) +#define PE_IMAGE_SCN_MEM_NOT_PAGED PE_BITWISE (0x08000000) +#define PE_IMAGE_SCN_MEM_SHARED PE_BITWISE (0x10000000) +#define PE_IMAGE_SCN_MEM_EXECUTE PE_BITWISE (0x20000000) +#define PE_IMAGE_SCN_MEM_READ PE_BITWISE (0x40000000) +#define PE_IMAGE_SCN_MEM_WRITE PE_BITWISE (0x80000000) +#define PE_IMAGE_SYM_DEBUG PE_ARBITRARY ( -2) +#define PE_IMAGE_SYM_ABSOLUTE PE_ARBITRARY ( -1) +#define PE_IMAGE_SYM_UNDEFINED PE_ARBITRARY (0x00000000) +#define PE_IMAGE_SYM_CLASS_NULL PE_ARBITRARY (0x00000000) +#define PE_IMAGE_SYM_CLASS_AUTOMATIC PE_ARBITRARY (0x00000001) +#define PE_IMAGE_SYM_CLASS_EXTERNAL PE_ARBITRARY (0x00000002) +#define PE_IMAGE_SYM_CLASS_STATIC PE_ARBITRARY (0x00000003) +#define PE_IMAGE_SYM_CLASS_REGISTER PE_ARBITRARY (0x00000004) +#define PE_IMAGE_SYM_CLASS_EXTERNAL_DEF PE_ARBITRARY (0x00000005) +#define PE_IMAGE_SYM_CLASS_LABEL PE_ARBITRARY (0x00000006) +#define PE_IMAGE_SYM_CLASS_UNDEFINED_LABEL PE_ARBITRARY (0x00000007) +#define PE_IMAGE_SYM_CLASS_MEMBER_OF_STRUCT PE_ARBITRARY (0x00000008) +#define PE_IMAGE_SYM_CLASS_ARGUMENT PE_ARBITRARY (0x00000009) +#define PE_IMAGE_SYM_CLASS_STRUCT_TAG PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_SYM_CLASS_MEMBER_OF_UNION PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_SYM_CLASS_UNION_TAG PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_SYM_CLASS_TYPE_DEFINITION PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_SYM_CLASS_UNDEFINED_STATIC PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_SYM_CLASS_ENUM_TAG PE_ARBITRARY (0x0000000f) +#define PE_IMAGE_SYM_CLASS_MEMBER_OF_ENUM PE_ARBITRARY (0x00000010) +#define PE_IMAGE_SYM_CLASS_REGISTER_PARAM PE_ARBITRARY (0x00000011) +#define PE_IMAGE_SYM_CLASS_BIT_FIELD PE_ARBITRARY (0x00000012) +#define PE_IMAGE_SYM_CLASS_BLOCK PE_ARBITRARY (0x00000064) +#define PE_IMAGE_SYM_CLASS_FUNCTION PE_ARBITRARY (0x00000065) +#define PE_IMAGE_SYM_CLASS_END_OF_STRUCT PE_ARBITRARY (0x00000066) +#define PE_IMAGE_SYM_CLASS_FILE PE_ARBITRARY (0x00000067) +#define PE_IMAGE_SYM_CLASS_SECTION PE_ARBITRARY (0x00000068) +#define PE_IMAGE_SYM_CLASS_WEAK_EXTERN PE_ARBITRARY (0x00000069) +#define PE_IMAGE_SYM_CLASS_CLR_TOKEN PE_ARBITRARY (0x0000006b) +#define PE_IMAGE_SYM_CLASS_END_OF_FUNC PE_ARBITRARY (0x000000ff) +#define PE_IMAGE_SYM_TYPE_NULL PE_ARBITRARY (0x00000000) +#define PE_IMAGE_SYM_TYPE_VOID PE_ARBITRARY (0x00000001) +#define PE_IMAGE_SYM_TYPE_CHAR PE_ARBITRARY (0x00000002) +#define PE_IMAGE_SYM_TYPE_SHORT PE_ARBITRARY (0x00000003) +#define PE_IMAGE_SYM_TYPE_INT PE_ARBITRARY (0x00000004) +#define PE_IMAGE_SYM_TYPE_LONG PE_ARBITRARY (0x00000005) +#define PE_IMAGE_SYM_TYPE_FLOAT PE_ARBITRARY (0x00000006) +#define PE_IMAGE_SYM_TYPE_DOUBLE PE_ARBITRARY (0x00000007) +#define PE_IMAGE_SYM_TYPE_STRUCT PE_ARBITRARY (0x00000008) +#define PE_IMAGE_SYM_TYPE_UNION PE_ARBITRARY (0x00000009) +#define PE_IMAGE_SYM_TYPE_ENUM PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_SYM_TYPE_MOE PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_SYM_TYPE_BYTE PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_SYM_TYPE_WORD PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_SYM_TYPE_UINT PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_SYM_TYPE_DWORD PE_ARBITRARY (0x0000000f) +#define PE_IMAGE_SYM_DTYPE_NULL PE_ARBITRARY (0x00000000) +#define PE_IMAGE_SYM_DTYPE_POINTER PE_ARBITRARY (0x00000001) +#define PE_IMAGE_SYM_DTYPE_FUNCTION PE_ARBITRARY (0x00000002) +#define PE_IMAGE_SYM_DTYPE_ARRAY PE_ARBITRARY (0x00000003) +#define PE_IMAGE_DATA_DIR_ORDINAL_EXPORT PE_ARBITRARY (0x00000000) +#define PE_IMAGE_DATA_DIR_ORDINAL_IMPORT PE_ARBITRARY (0x00000001) +#define PE_IMAGE_DATA_DIR_ORDINAL_RESOURCE PE_ARBITRARY (0x00000002) +#define PE_IMAGE_DATA_DIR_ORDINAL_EXCEPTION PE_ARBITRARY (0x00000003) +#define PE_IMAGE_DATA_DIR_ORDINAL_CERTIFICATE PE_ARBITRARY (0x00000004) +#define PE_IMAGE_DATA_DIR_ORDINAL_BASE_RELOCATION PE_ARBITRARY (0x00000005) +#define PE_IMAGE_DATA_DIR_ORDINAL_DEBUG PE_ARBITRARY (0x00000006) +#define PE_IMAGE_DATA_DIR_ORDINAL_ARCHITECTURE PE_ARBITRARY (0x00000007) +#define PE_IMAGE_DATA_DIR_ORDINAL_GLOBAL_PTR PE_ARBITRARY (0x00000008) +#define PE_IMAGE_DATA_DIR_ORDINAL_TLS PE_ARBITRARY (0x00000009) +#define PE_IMAGE_DATA_DIR_ORDINAL_LOAD_CONFIG PE_ARBITRARY (0x0000000a) +#define PE_IMAGE_DATA_DIR_ORDINAL_BOUND_IMPORT PE_ARBITRARY (0x0000000b) +#define PE_IMAGE_DATA_DIR_ORDINAL_IAT PE_ARBITRARY (0x0000000c) +#define PE_IMAGE_DATA_DIR_ORDINAL_DELAY_IMPORT_DESCRIPTOR PE_ARBITRARY (0x0000000d) +#define PE_IMAGE_DATA_DIR_ORDINAL_CLR_RUNTIME_HEADER PE_ARBITRARY (0x0000000e) +#define PE_IMAGE_DATA_DIR_ORDINAL_RESERVED PE_ARBITRARY (0x0000000f) + +#endif diff --git a/src/internal/perk/perk_structs.h b/src/internal/perk/perk_structs.h new file mode 100644 index 0000000..6cacac8 --- /dev/null +++ b/src/internal/perk/perk_structs.h @@ -0,0 +1,334 @@ +#ifndef PERK_STRUCTS_H +#define PERK_STRUCTS_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct pe_raw_image_dos_hdr { + unsigned char dos_magic [0x02]; /* 0x00 */ + unsigned char dos_cblp [0x02]; /* 0x02 */ + unsigned char dos_cp [0x02]; /* 0x04 */ + unsigned char dos_crlc [0x02]; /* 0x06 */ + unsigned char dos_cparhdr [0x02]; /* 0x08 */ + unsigned char dos_minalloc [0x02]; /* 0x0a */ + unsigned char dos_maxalloc [0x02]; /* 0x0c */ + unsigned char dos_ss [0x02]; /* 0x0e */ + unsigned char dos_sp [0x02]; /* 0x10 */ + unsigned char dos_csum [0x02]; /* 0x12 */ + unsigned char dos_ip [0x02]; /* 0x14 */ + unsigned char dos_cs [0x02]; /* 0x16 */ + unsigned char dos_lfarlc [0x02]; /* 0x18 */ + unsigned char dos_ovno [0x02]; /* 0x1a */ + unsigned char dos_res [0x08]; /* 0x1c */ + unsigned char dos_oemid [0x02]; /* 0x24 */ + unsigned char dos_oeminfo [0x02]; /* 0x26 */ + unsigned char dos_res2 [0x14]; /* 0x28 */ + unsigned char dos_lfanew [0x04]; /* 0x3c */ +}; + + +struct pe_raw_coff_image_hdr { + unsigned char cfh_signature [0x04]; /* 0x00 */ + unsigned char cfh_machine [0x02]; /* 0x04 */ + unsigned char cfh_num_of_sections [0x02]; /* 0x06 */ + unsigned char cfh_time_date_stamp [0x04]; /* 0x08 */ + unsigned char cfh_ptr_to_sym_tbl [0x04]; /* 0x0c */ + unsigned char cfh_num_of_syms [0x04]; /* 0x10 */ + unsigned char cfh_size_of_opt_hdr [0x02]; /* 0x14 */ + unsigned char cfh_characteristics [0x02]; /* 0x16 */ +}; + + +struct pe_raw_coff_object_hdr { + unsigned char cfh_machine [0x02]; /* 0x00 */ + unsigned char cfh_num_of_sections [0x02]; /* 0x02 */ + unsigned char cfh_time_date_stamp [0x04]; /* 0x04 */ + unsigned char cfh_ptr_to_sym_tbl [0x04]; /* 0x08 */ + unsigned char cfh_num_of_syms [0x04]; /* 0x0c */ + unsigned char cfh_size_of_opt_hdr [0x02]; /* 0x10 */ + unsigned char cfh_characteristics [0x02]; /* 0x12 */ +}; + + +struct pe_raw_opt_hdr_std { + unsigned char coh_magic [0x02]; /* 0x00 */ + unsigned char coh_major_linker_ver [0x01]; /* 0x02 */ + unsigned char coh_minor_linker_ver [0x01]; /* 0x03 */ + unsigned char coh_size_of_code [0x04]; /* 0x04 */ + unsigned char coh_size_of_inited_data [0x04]; /* 0x08 */ + unsigned char coh_size_of_uninited_data [0x04]; /* 0x0c */ + unsigned char coh_entry_point [0x04]; /* 0x10 */ + unsigned char coh_base_of_code [0x04]; /* 0x14 */ +}; + + +struct pe_raw_opt_hdr_align { + unsigned char coh_section_align [0x04]; /* 0x20 */ + unsigned char coh_file_align [0x04]; /* 0x24 */ +}; + + +struct pe_raw_opt_hdr_vers { + unsigned char coh_major_os_ver [0x02]; /* 0x28 */ + unsigned char coh_minor_os_ver [0x02]; /* 0x2a */ + unsigned char coh_major_image_ver [0x02]; /* 0x2c */ + unsigned char coh_minor_image_ver [0x02]; /* 0x2e */ + unsigned char coh_major_subsys_ver [0x02]; /* 0x30 */ + unsigned char coh_minor_subsys_ver [0x02]; /* 0x32 */ + unsigned char coh_win32_ver [0x04]; /* 0x34 */ +}; + + +struct pe_raw_opt_hdr_img { + unsigned char coh_size_of_image [0x04]; /* 0x38 */ + unsigned char coh_size_of_headers [0x04]; /* 0x3c */ + unsigned char coh_checksum [0x04]; /* 0x40 */ + unsigned char coh_subsystem [0x02]; /* 0x44 */ + unsigned char coh_dll_characteristics [0x02]; /* 0x46 */ +}; + + +struct pe_raw_opt_hdr_ldr { + unsigned char coh_loader_flags [0x04]; + unsigned char coh_rva_and_sizes [0x04]; +}; + + +struct pe_raw_opt_hdr_dirs { + unsigned char coh_export_tbl [0x08]; + unsigned char coh_import_tbl [0x08]; + unsigned char coh_resource_tbl [0x08]; + unsigned char coh_exception_tbl [0x08]; + unsigned char coh_certificate_tbl [0x08]; + unsigned char coh_base_reloc_tbl [0x08]; + unsigned char coh_debug [0x08]; + unsigned char coh_arch [0x08]; + unsigned char coh_global_ptr [0x08]; + unsigned char coh_tls_tbl [0x08]; + unsigned char coh_load_config_tbl [0x08]; + unsigned char coh_bound_import [0x08]; + unsigned char coh_iat [0x08]; + unsigned char coh_delay_import_descriptor [0x08]; + unsigned char coh_clr_runtime_hdr [0x08]; + unsigned char coh_reserved [0x08]; +}; + + +struct pe_raw_data_dirs { + unsigned char coh_rva_and_sizes [0x04]; + unsigned char coh_export_tbl [0x08]; + unsigned char coh_import_tbl [0x08]; + unsigned char coh_resource_tbl [0x08]; + unsigned char coh_exception_tbl [0x08]; + unsigned char coh_certificate_tbl [0x08]; + unsigned char coh_base_reloc_tbl [0x08]; + unsigned char coh_debug [0x08]; + unsigned char coh_arch [0x08]; + unsigned char coh_global_ptr [0x08]; + unsigned char coh_tls_tbl [0x08]; + unsigned char coh_load_config_tbl [0x08]; + unsigned char coh_bound_import [0x08]; + unsigned char coh_iat [0x08]; + unsigned char coh_delay_import_descriptor [0x08]; + unsigned char coh_clr_runtime_hdr [0x08]; + unsigned char coh_reserved [0x08]; +}; + + +struct pe_raw_opt_hdr_32 { + unsigned char coh_magic [0x02]; /* 0x00 */ + unsigned char coh_major_linker_ver [0x01]; /* 0x02 */ + unsigned char coh_minor_linker_ver [0x01]; /* 0x03 */ + unsigned char coh_size_of_code [0x04]; /* 0x04 */ + unsigned char coh_size_of_inited_data [0x04]; /* 0x08 */ + unsigned char coh_size_of_uninited_data [0x04]; /* 0x0c */ + unsigned char coh_entry_point [0x04]; /* 0x10 */ + unsigned char coh_base_of_code [0x04]; /* 0x14 */ + unsigned char coh_base_of_data [0x04]; /* 0x18 */ + unsigned char coh_image_base [0x04]; /* 0x1c */ + unsigned char coh_section_align [0x04]; /* 0x20 */ + unsigned char coh_file_align [0x04]; /* 0x24 */ + unsigned char coh_major_os_ver [0x02]; /* 0x28 */ + unsigned char coh_minor_os_ver [0x02]; /* 0x2a */ + unsigned char coh_major_image_ver [0x02]; /* 0x2c */ + unsigned char coh_minor_image_ver [0x02]; /* 0x2e */ + unsigned char coh_major_subsys_ver [0x02]; /* 0x30 */ + unsigned char coh_minor_subsys_ver [0x02]; /* 0x32 */ + unsigned char coh_win32_ver [0x04]; /* 0x34 */ + unsigned char coh_size_of_image [0x04]; /* 0x38 */ + unsigned char coh_size_of_headers [0x04]; /* 0x3c */ + unsigned char coh_checksum [0x04]; /* 0x40 */ + unsigned char coh_subsystem [0x02]; /* 0x44 */ + unsigned char coh_dll_characteristics [0x02]; /* 0x46 */ + unsigned char coh_size_of_stack_reserve [0x04]; /* 0x48 */ + unsigned char coh_size_of_stack_commit [0x04]; /* 0x4c */ + unsigned char coh_size_of_heap_reserve [0x04]; /* 0x50 */ + unsigned char coh_size_of_heap_commit [0x04]; /* 0x54 */ + unsigned char coh_loader_flags [0x04]; /* 0x58 */ + unsigned char coh_rva_and_sizes [0x04]; /* 0x5c */ + unsigned char coh_export_tbl [0x08]; /* 0x60 */ + unsigned char coh_import_tbl [0x08]; /* 0x68 */ + unsigned char coh_resource_tbl [0x08]; /* 0x70 */ + unsigned char coh_exception_tbl [0x08]; /* 0x78 */ + unsigned char coh_certificate_tbl [0x08]; /* 0x80 */ + unsigned char coh_base_reloc_tbl [0x08]; /* 0x88 */ + unsigned char coh_debug [0x08]; /* 0x90 */ + unsigned char coh_arch [0x08]; /* 0x98 */ + unsigned char coh_global_ptr [0x08]; /* 0xa0 */ + unsigned char coh_tls_tbl [0x08]; /* 0xa8 */ + unsigned char coh_load_config_tbl [0x08]; /* 0xb0 */ + unsigned char coh_bound_import [0x08]; /* 0xb8 */ + unsigned char coh_iat [0x08]; /* 0xc0 */ + unsigned char coh_delay_import_descriptor [0x08]; /* 0xc8 */ + unsigned char coh_clr_runtime_hdr [0x08]; /* 0xd0 */ + unsigned char coh_reserved [0x08]; /* 0xd8 */ +}; + + +struct pe_raw_opt_hdr_64 { + unsigned char coh_magic [0x02]; /* 0x00 */ + unsigned char coh_major_linker_ver [0x01]; /* 0x02 */ + unsigned char coh_minor_linker_ver [0x01]; /* 0x03 */ + unsigned char coh_size_of_code [0x04]; /* 0x04 */ + unsigned char coh_size_of_inited_data [0x04]; /* 0x08 */ + unsigned char coh_size_of_uninited_data [0x04]; /* 0x0c */ + unsigned char coh_entry_point [0x04]; /* 0x10 */ + unsigned char coh_base_of_code [0x04]; /* 0x14 */ + unsigned char coh_image_base [0x08]; /* 0x18 */ + unsigned char coh_section_align [0x04]; /* 0x20 */ + unsigned char coh_file_align [0x04]; /* 0x24 */ + unsigned char coh_major_os_ver [0x02]; /* 0x28 */ + unsigned char coh_minor_os_ver [0x02]; /* 0x2a */ + unsigned char coh_major_image_ver [0x02]; /* 0x2c */ + unsigned char coh_minor_image_ver [0x02]; /* 0x2e */ + unsigned char coh_major_subsys_ver [0x02]; /* 0x30 */ + unsigned char coh_minor_subsys_ver [0x02]; /* 0x32 */ + unsigned char coh_win32_ver [0x04]; /* 0x34 */ + unsigned char coh_size_of_image [0x04]; /* 0x38 */ + unsigned char coh_size_of_headers [0x04]; /* 0x3c */ + unsigned char coh_checksum [0x04]; /* 0x40 */ + unsigned char coh_subsystem [0x02]; /* 0x44 */ + unsigned char coh_dll_characteristics [0x02]; /* 0x46 */ + unsigned char coh_size_of_stack_reserve [0x08]; /* 0x48 */ + unsigned char coh_size_of_stack_commit [0x08]; /* 0x50 */ + unsigned char coh_size_of_heap_reserve [0x08]; /* 0x58 */ + unsigned char coh_size_of_heap_commit [0x08]; /* 0x60 */ + unsigned char coh_loader_flags [0x04]; /* 0x68 */ + unsigned char coh_rva_and_sizes [0x04]; /* 0x6c */ + unsigned char coh_export_tbl [0x08]; /* 0x70 */ + unsigned char coh_import_tbl [0x08]; /* 0x78 */ + unsigned char coh_resource_tbl [0x08]; /* 0x80 */ + unsigned char coh_exception_tbl [0x08]; /* 0x88 */ + unsigned char coh_certificate_tbl [0x08]; /* 0x90 */ + unsigned char coh_base_reloc_tbl [0x08]; /* 0x98 */ + unsigned char coh_debug [0x08]; /* 0xa0 */ + unsigned char coh_arch [0x08]; /* 0xa8 */ + unsigned char coh_global_ptr [0x08]; /* 0xb0 */ + unsigned char coh_tls_tbl [0x08]; /* 0xb8 */ + unsigned char coh_load_config_tbl [0x08]; /* 0xc0 */ + unsigned char coh_bound_import [0x08]; /* 0xc8 */ + unsigned char coh_iat [0x08]; /* 0xd0 */ + unsigned char coh_delay_import_descriptor [0x08]; /* 0xd8 */ + unsigned char coh_clr_runtime_hdr [0x08]; /* 0xe0 */ + unsigned char coh_reserved [0x08]; /* 0xe8 */ +}; + + +union pe_raw_opt_hdr { + struct pe_raw_opt_hdr_32 opt_hdr_32; + struct pe_raw_opt_hdr_64 opt_hdr_64; +}; + + +struct pe_raw_image_data_dir { + unsigned char dh_rva [0x04]; /* 0x00 */ + unsigned char dh_size [0x04]; /* 0x04 */ +}; + + +struct pe_raw_sec_hdr { + unsigned char sh_name [0x08]; /* 0x00 */ + unsigned char sh_virtual_size [0x04]; /* 0x08 */ + unsigned char sh_virtual_addr [0x04]; /* 0x0c */ + unsigned char sh_size_of_raw_data [0x04]; /* 0x10 */ + unsigned char sh_ptr_to_raw_data [0x04]; /* 0x14 */ + unsigned char sh_ptr_to_relocs [0x04]; /* 0x18 */ + unsigned char sh_ptr_to_line_nums [0x04]; /* 0x1c */ + unsigned char sh_num_of_relocs [0x02]; /* 0x20 */ + unsigned char sh_num_of_line_nums [0x02]; /* 0x22 */ + unsigned char sh_characteristics [0x04]; /* 0x24 */ +}; + + +struct pe_raw_export_hdr { + unsigned char eh_export_flags [0x04]; /* 0x00 */ + unsigned char eh_time_date_stamp [0x04]; /* 0x04 */ + unsigned char eh_major_ver [0x02]; /* 0x08 */ + unsigned char eh_minor_ver [0x02]; /* 0x0a */ + unsigned char eh_name_rva [0x04]; /* 0x0c */ + unsigned char eh_ordinal_base [0x04]; /* 0x10 */ + unsigned char eh_addr_tbl_entries [0x04]; /* 0x14 */ + unsigned char eh_num_of_name_ptrs [0x04]; /* 0x18 */ + unsigned char eh_export_addr_tbl_rva [0x04]; /* 0x1c */ + unsigned char eh_name_ptr_rva [0x04]; /* 0x20 */ + unsigned char eh_ordinal_tbl_rva [0x04]; /* 0x24 */ +}; + + +union pe_raw_export_addr_tbl { + unsigned char ee_export_rva [0x04]; /* 0x00 */ + unsigned char ee_forwarder_rva [0x04]; /* 0x00 */ +}; + + +struct pe_raw_import_hdr { + unsigned char ih_import_lookup_tbl_rva [0x04]; /* 0x00 */ + unsigned char ih_time_date_stamp [0x04]; /* 0x04 */ + unsigned char ih_forwarder_chain [0x04]; /* 0x08 */ + unsigned char ih_name_rva [0x04]; /* 0x0c */ + unsigned char ih_import_addr_tbl_rva [0x04]; /* 0x10 */ +}; + + +union pe_raw_import_lookup { + unsigned char ii_import_lookup_entry_64 [0x08]; /* 0x00 */ + unsigned char ii_import_lookup_entry_32 [0x04]; /* 0x00 */ + unsigned char ii_hint_name_tbl_rva [0x04]; /* 0x00 */ + unsigned char ii_ordinal_number [0x02]; /* 0x00 */ +}; + + +struct pe_raw_hint_name_entry { + unsigned char ii_hint [0x02]; /* 0x00 */ + unsigned char ii_name [0x02]; /* 0x02 */ +}; + + +struct pe_raw_coff_symbol { + unsigned char cs_name [0x08]; /* 0x00 */ + unsigned char cs_value [0x04]; /* 0x08 */ + unsigned char cs_section_number [0x02]; /* 0x0c */ + unsigned char cs_type [0x02]; /* 0x0e */ + unsigned char cs_storage_class [0x01]; /* 0x10 */ + unsigned char cs_num_of_aux_symbols [0x01]; /* 0x11 */ +}; + + +struct pe_raw_coff_symbol_name { + union { + unsigned char cs_short_name [0x08]; /* 0x00 */ + + struct { + unsigned char cs_zeroes [0x04]; /* 0x00 */ + unsigned char cs_offset [0x04]; /* 0x04 */ + } long_name; + }; +}; + + +#ifdef __cplusplus +} +#endif + +#endif |