Changeset 65240 in vbox
- Timestamp:
- Jan 11, 2017 10:39:51 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/iprt/formats/pecoff.h (modified) (3 diffs)
-
src/VBox/Runtime/common/ldr/ldrPE.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/formats/pecoff.h
r64204 r65240 790 790 uint32_t GuardLongJumpTargetCount; /**< 0x74 */ 791 791 uint32_t DynamicValueRelocTable; /**< 0x78 */ 792 uint32_t HybridMetadataPointer; /**< 0x7c */ 793 uint32_t FailFastIndirectProc; /**< 0x80 - temporary name, rename when we get symbols */ 794 uint32_t FailFastPointer; /**< 0x84 - temporary name, rename when we get symbols */ 795 uint32_t UnknownZero1; /**< 0x88 - temporary name, rename when we get symbols */ 792 uint32_t CHPEMetadataPointer; /**< 0x7c Not sure when this was renamed from HybridMetadataPointer. */ 793 uint32_t GuardRFFailureRoutine; /**< 0x80 */ 794 uint32_t GuardRFFailureRoutineFunctionPointer; /**< 0x84 */ 795 uint32_t DynamicValueRelocTableOffset; /**< 0x88 */ 796 uint16_t DynamicValueRelocTableSection; /**< 0x8c */ 797 uint16_t Reserved2; /**< 0x8e */ 796 798 } IMAGE_LOAD_CONFIG_DIRECTORY32_V7; 797 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V7, 0x 8c);799 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V7, 0x90); 798 800 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V7 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V7; 799 801 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V7 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V7; 800 802 801 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V7 IMAGE_LOAD_CONFIG_DIRECTORY32; 802 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32_V7 PIMAGE_LOAD_CONFIG_DIRECTORY32; 803 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY32_V7 PCIMAGE_LOAD_CONFIG_DIRECTORY32; 803 /** @since Windows 10 build 15002 (or maybe earlier). */ 804 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V8 805 { 806 uint32_t Size; /**< 0x00 */ 807 uint32_t TimeDateStamp; /**< 0x04 */ 808 uint16_t MajorVersion; /**< 0x08 */ 809 uint16_t MinorVersion; /**< 0x0a */ 810 uint32_t GlobalFlagsClear; /**< 0x0c */ 811 uint32_t GlobalFlagsSet; /**< 0x10 */ 812 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */ 813 uint32_t DeCommitFreeBlockThreshold; /**< 0x18 */ 814 uint32_t DeCommitTotalFreeThreshold; /**< 0x1c */ 815 uint32_t LockPrefixTable; /**< 0x20 */ 816 uint32_t MaximumAllocationSize; /**< 0x24 */ 817 uint32_t VirtualMemoryThreshold; /**< 0x28 */ 818 uint32_t ProcessHeapFlags; /**< 0x2c */ 819 uint32_t ProcessAffinityMask; /**< 0x30 */ 820 uint16_t CSDVersion; /**< 0x34 */ 821 uint16_t DependentLoadFlags; /**< 0x36 */ 822 uint32_t EditList; /**< 0x38 */ 823 uint32_t SecurityCookie; /**< 0x3c */ 824 uint32_t SEHandlerTable; /**< 0x40 */ 825 uint32_t SEHandlerCount; /**< 0x44 */ 826 uint32_t GuardCFCCheckFunctionPointer; /**< 0x48 */ 827 uint32_t GuardCFDispatchFunctionPointer; /**< 0x4c */ 828 uint32_t GuardCFFunctionTable; /**< 0x50 */ 829 uint32_t GuardCFFunctionCount; /**< 0x54 */ 830 uint32_t GuardFlags; /**< 0x58 */ 831 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x5c */ 832 uint32_t GuardAddressTakenIatEntryTable; /**< 0x68 */ 833 uint32_t GuardAddressTakenIatEntryCount; /**< 0x6c */ 834 uint32_t GuardLongJumpTargetTable; /**< 0x70 */ 835 uint32_t GuardLongJumpTargetCount; /**< 0x74 */ 836 uint32_t DynamicValueRelocTable; /**< 0x78 */ 837 uint32_t CHPEMetadataPointer; /**< 0x7c Not sure when this was renamed from HybridMetadataPointer. */ 838 uint32_t GuardRFFailureRoutine; /**< 0x80 */ 839 uint32_t GuardRFFailureRoutineFunctionPointer; /**< 0x84 */ 840 uint32_t DynamicValueRelocTableOffset; /**< 0x88 */ 841 uint16_t DynamicValueRelocTableSection; /**< 0x8c */ 842 uint16_t Reserved2; /**< 0x8e */ 843 uint32_t GuardRFVerifyStackPointerFunctionPointer; /**< 0x90 */ 844 uint32_t HotPatchTableOffset; /**< 0x94 */ 845 } IMAGE_LOAD_CONFIG_DIRECTORY32_V8; 846 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V8, 0x98); 847 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V8; 848 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V8; 849 850 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 IMAGE_LOAD_CONFIG_DIRECTORY32; 851 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32_V8 PIMAGE_LOAD_CONFIG_DIRECTORY32; 852 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY32_V8 PCIMAGE_LOAD_CONFIG_DIRECTORY32; 804 853 805 854 … … 1013 1062 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */ 1014 1063 uint64_t DynamicValueRelocTable; /**< 0xc0 */ 1015 uint64_t HybridMetadataPointer; /**< 0xc8 */ 1016 uint64_t FailFastIndirectProc; /**< 0xd0 - temporary name, rename when we get symbols */ 1017 uint64_t FailFastPointer; /**< 0xd8 - temporary name, rename when we get symbols */ 1018 uint64_t UnknownZero1; /**< 0xe0 - temporary name, rename when we get symbols */ 1064 uint64_t CHPEMetadataPointer; /**< 0xc8 Not sure when this was renamed from HybridMetadataPointer. */ 1065 uint64_t GuardRFFailureRoutine; /**< 0xd0 */ 1066 uint64_t GuardRFFailureRoutineFunctionPointer; /**< 0xd8 */ 1067 uint32_t DynamicValueRelocTableOffset; /**< 0xe0 */ 1068 uint16_t DynamicValueRelocTableSection; /**< 0xe4 */ 1069 uint16_t Reserved2; /**< 0xe6 */ 1019 1070 } IMAGE_LOAD_CONFIG_DIRECTORY64_V7; 1020 1071 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V7, 0xe8); … … 1022 1073 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V7 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V7; 1023 1074 1024 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V7 IMAGE_LOAD_CONFIG_DIRECTORY64; 1025 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64_V7 PIMAGE_LOAD_CONFIG_DIRECTORY64; 1026 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY64_V7 PCIMAGE_LOAD_CONFIG_DIRECTORY64; 1075 /** @since Windows 10 build 15002 (or maybe earlier). */ 1076 #pragma pack(4) /* Stupid, stupid microsofties! */ 1077 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V8 1078 { 1079 uint32_t Size; /**< 0x00 */ 1080 uint32_t TimeDateStamp; /**< 0x04 */ 1081 uint16_t MajorVersion; /**< 0x08 */ 1082 uint16_t MinorVersion; /**< 0x0a */ 1083 uint32_t GlobalFlagsClear; /**< 0x0c */ 1084 uint32_t GlobalFlagsSet; /**< 0x10 */ 1085 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */ 1086 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */ 1087 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */ 1088 uint64_t LockPrefixTable; /**< 0x28 */ 1089 uint64_t MaximumAllocationSize; /**< 0x30 */ 1090 uint64_t VirtualMemoryThreshold; /**< 0x38 */ 1091 uint64_t ProcessAffinityMask; /**< 0x40 */ 1092 uint32_t ProcessHeapFlags; /**< 0x48 */ 1093 uint16_t CSDVersion; /**< 0x4c */ 1094 uint16_t DependentLoadFlags; /**< 0x4e */ 1095 uint64_t EditList; /**< 0x50 */ 1096 uint64_t SecurityCookie; /**< 0x58 */ 1097 uint64_t SEHandlerTable; /**< 0x60 */ 1098 uint64_t SEHandlerCount; /**< 0x68 */ 1099 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */ 1100 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */ 1101 uint64_t GuardCFFunctionTable; /**< 0x80 */ 1102 uint64_t GuardCFFunctionCount; /**< 0x88 */ 1103 uint32_t GuardFlags; /**< 0x90 */ 1104 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */ 1105 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */ 1106 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */ 1107 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */ 1108 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */ 1109 uint64_t DynamicValueRelocTable; /**< 0xc0 */ 1110 uint64_t CHPEMetadataPointer; /**< 0xc8 */ 1111 uint64_t GuardRFFailureRoutine; /**< 0xd0 */ 1112 uint64_t GuardRFFailureRoutineFunctionPointer; /**< 0xd8 */ 1113 uint32_t DynamicValueRelocTableOffset; /**< 0xe0 */ 1114 uint16_t DynamicValueRelocTableSection; /**< 0xe4 */ 1115 uint16_t Reserved2; /**< 0xe6 */ 1116 uint64_t GuardRFVerifyStackPointerFunctionPointer; /**< 0xe8 */ 1117 uint32_t HotPatchTableOffset; /**< 0xf0 */ 1118 } IMAGE_LOAD_CONFIG_DIRECTORY64_V8; 1119 #pragma pack() 1120 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V8, 0xf4); 1121 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V8; 1122 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V8; 1123 1124 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 IMAGE_LOAD_CONFIG_DIRECTORY64; 1125 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64_V8 PIMAGE_LOAD_CONFIG_DIRECTORY64; 1126 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY64_V8 PCIMAGE_LOAD_CONFIG_DIRECTORY64; 1027 1127 1028 1128 /** @} */ -
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r64891 r65240 2979 2979 * volatile everywhere! Trying to prevent the compiler being a smarta$$ and reorder stuff. 2980 2980 */ 2981 IMAGE_LOAD_CONFIG_DIRECTORY32_V7 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V7 volatile *)pLoadCfg; 2982 IMAGE_LOAD_CONFIG_DIRECTORY64_V7 volatile *pLoadCfg64 = pLoadCfg; 2983 2981 IMAGE_LOAD_CONFIG_DIRECTORY32_V8 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V8 volatile *)pLoadCfg; 2982 IMAGE_LOAD_CONFIG_DIRECTORY64_V8 volatile *pLoadCfg64 = pLoadCfg; 2983 2984 pLoadCfg64->HotPatchTableOffset = pLoadCfg32->HotPatchTableOffset; 2985 pLoadCfg64->GuardRFVerifyStackPointerFunctionPointer = pLoadCfg32->GuardRFVerifyStackPointerFunctionPointer; 2986 pLoadCfg64->Reserved2 = pLoadCfg32->Reserved2; 2987 pLoadCfg64->DynamicValueRelocTableSection = pLoadCfg32->DynamicValueRelocTableSection; 2988 pLoadCfg64->DynamicValueRelocTableOffset = pLoadCfg32->DynamicValueRelocTableOffset; 2989 pLoadCfg64->GuardRFFailureRoutineFunctionPointer = pLoadCfg32->GuardRFFailureRoutineFunctionPointer; 2990 pLoadCfg64->GuardRFFailureRoutine = pLoadCfg32->GuardRFFailureRoutine; 2991 pLoadCfg64->CHPEMetadataPointer = pLoadCfg32->CHPEMetadataPointer; 2992 pLoadCfg64->DynamicValueRelocTable = pLoadCfg32->DynamicValueRelocTable; 2993 pLoadCfg64->GuardLongJumpTargetCount = pLoadCfg32->GuardLongJumpTargetCount; 2994 pLoadCfg64->GuardLongJumpTargetTable = pLoadCfg32->GuardLongJumpTargetTable; 2995 pLoadCfg64->GuardAddressTakenIatEntryCount = pLoadCfg32->GuardAddressTakenIatEntryCount; 2984 2996 pLoadCfg64->GuardAddressTakenIatEntryTable = pLoadCfg32->GuardAddressTakenIatEntryTable; 2985 pLoadCfg64->GuardAddressTakenIatEntryCount = pLoadCfg32->GuardAddressTakenIatEntryCount;2986 pLoadCfg64->GuardLongJumpTargetTable = pLoadCfg32->GuardLongJumpTargetTable;2987 pLoadCfg64->GuardLongJumpTargetCount = pLoadCfg32->GuardLongJumpTargetCount;2988 2997 pLoadCfg64->CodeIntegrity.Reserved = pLoadCfg32->CodeIntegrity.Reserved; 2989 2998 pLoadCfg64->CodeIntegrity.CatalogOffset = pLoadCfg32->CodeIntegrity.CatalogOffset; … … 3536 3545 if (Dir.Size) 3537 3546 { 3547 const size_t cbExpectV8 = !pModPe->f64Bit 3548 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V8) 3549 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V8); 3538 3550 const size_t cbExpectV7 = !pModPe->f64Bit 3539 3551 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V7) … … 3558 3570 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V2) /*No V1*/; 3559 3571 const size_t cbNewHack = cbExpectV5; /* Playing safe here since there might've been revisions between V5 and V6 we don't know about . */ 3560 const size_t cbMaxKnown = cbExpectV 7;3572 const size_t cbMaxKnown = cbExpectV8; 3561 3573 3562 3574 bool fNewerStructureHack = false; 3563 if ( Dir.Size != cbExpectV7 3575 if ( Dir.Size != cbExpectV8 3576 && Dir.Size != cbExpectV7 3564 3577 && Dir.Size != cbExpectV6 3565 3578 && Dir.Size != cbExpectV5 … … 3571 3584 fNewerStructureHack = Dir.Size > cbNewHack /* These structure changes are slowly getting to us! More futher down. */ 3572 3585 && Dir.Size <= sizeof(u); 3573 Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n",3574 pszLogName, Dir.Size, cbExpectV 7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,3586 Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n", 3587 pszLogName, Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1, 3575 3588 fNewerStructureHack ? " Will try ignore extra bytes if all zero." : "")); 3576 3589 if (!fNewerStructureHack) 3577 3590 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE, 3578 "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, or %zu",3579 Dir.Size, cbExpectV 7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);3591 "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu", 3592 Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1); 3580 3593 } 3581 3594 … … 3615 3628 /* Kludge #2: This happens a lot. Structure changes, but the linker doesn't get 3616 3629 updated and stores some old size in the directory. Use the header size. */ 3617 else if ( u.Cfg64.Size == cbExpectV7 3630 else if ( u.Cfg64.Size == cbExpectV8 3631 || u.Cfg64.Size == cbExpectV7 3618 3632 || u.Cfg64.Size == cbExpectV6 3619 3633 || u.Cfg64.Size == cbExpectV5 … … 3650 3664 else 3651 3665 { 3652 Log(("rtldrPEOpen: %s: load cfg hdr: unexpected hdr size of %u bytes (dir %u), expected %zu, %zu, %zu, %zu, %zu, %zu, or %zu.\n",3653 pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV 7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1));3666 Log(("rtldrPEOpen: %s: load cfg hdr: unexpected hdr size of %u bytes (dir %u), expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.\n", 3667 pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1)); 3654 3668 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE, 3655 "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, or %zu",3656 u.Cfg64.Size, Dir.Size, cbExpectV 7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);3669 "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu", 3670 u.Cfg64.Size, Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1); 3657 3671 } 3658 3672 } … … 3699 3713 u.Cfg64.GuardAddressTakenIatEntryTable, u.Cfg64.GuardAddressTakenIatEntryCount, 3700 3714 u.Cfg64.GuardLongJumpTargetTable, u.Cfg64.GuardLongJumpTargetCount )); 3715 #if 0 /* ntdll 15002 uses this. */ 3701 3716 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_GUARD_CF_STUFF, 3702 3717 "Guard bits in load config: %RX64,%RX64,%RX64,%RX64,%RX32,%RX64,%RX64,%RX64,%RX64!", … … 3705 3720 u.Cfg64.GuardAddressTakenIatEntryTable, u.Cfg64.GuardAddressTakenIatEntryCount, 3706 3721 u.Cfg64.GuardLongJumpTargetTable, u.Cfg64.GuardLongJumpTargetCount); 3722 #endif 3707 3723 } 3708 3724 }
Note:
See TracChangeset
for help on using the changeset viewer.

