Changeset 67948 in vbox
- Timestamp:
- Jul 13, 2017 10:00:40 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116941
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/formats/pecoff.h
r66484 r67948 922 922 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V8; 923 923 924 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 IMAGE_LOAD_CONFIG_DIRECTORY32; 925 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32_V8 PIMAGE_LOAD_CONFIG_DIRECTORY32; 926 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY32_V8 PCIMAGE_LOAD_CONFIG_DIRECTORY32; 924 /** @since Windows 10 build 16237 (or maybe earlier). */ 925 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V9 926 { 927 uint32_t Size; /**< 0x00 */ 928 uint32_t TimeDateStamp; /**< 0x04 */ 929 uint16_t MajorVersion; /**< 0x08 */ 930 uint16_t MinorVersion; /**< 0x0a */ 931 uint32_t GlobalFlagsClear; /**< 0x0c */ 932 uint32_t GlobalFlagsSet; /**< 0x10 */ 933 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */ 934 uint32_t DeCommitFreeBlockThreshold; /**< 0x18 */ 935 uint32_t DeCommitTotalFreeThreshold; /**< 0x1c */ 936 uint32_t LockPrefixTable; /**< 0x20 */ 937 uint32_t MaximumAllocationSize; /**< 0x24 */ 938 uint32_t VirtualMemoryThreshold; /**< 0x28 */ 939 uint32_t ProcessHeapFlags; /**< 0x2c */ 940 uint32_t ProcessAffinityMask; /**< 0x30 */ 941 uint16_t CSDVersion; /**< 0x34 */ 942 uint16_t DependentLoadFlags; /**< 0x36 */ 943 uint32_t EditList; /**< 0x38 */ 944 uint32_t SecurityCookie; /**< 0x3c */ 945 uint32_t SEHandlerTable; /**< 0x40 */ 946 uint32_t SEHandlerCount; /**< 0x44 */ 947 uint32_t GuardCFCCheckFunctionPointer; /**< 0x48 */ 948 uint32_t GuardCFDispatchFunctionPointer; /**< 0x4c */ 949 uint32_t GuardCFFunctionTable; /**< 0x50 */ 950 uint32_t GuardCFFunctionCount; /**< 0x54 */ 951 uint32_t GuardFlags; /**< 0x58 */ 952 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x5c */ 953 uint32_t GuardAddressTakenIatEntryTable; /**< 0x68 */ 954 uint32_t GuardAddressTakenIatEntryCount; /**< 0x6c */ 955 uint32_t GuardLongJumpTargetTable; /**< 0x70 */ 956 uint32_t GuardLongJumpTargetCount; /**< 0x74 */ 957 uint32_t DynamicValueRelocTable; /**< 0x78 */ 958 uint32_t CHPEMetadataPointer; /**< 0x7c Not sure when this was renamed from HybridMetadataPointer. */ 959 uint32_t GuardRFFailureRoutine; /**< 0x80 */ 960 uint32_t GuardRFFailureRoutineFunctionPointer; /**< 0x84 */ 961 uint32_t DynamicValueRelocTableOffset; /**< 0x88 */ 962 uint16_t DynamicValueRelocTableSection; /**< 0x8c */ 963 uint16_t Reserved2; /**< 0x8e */ 964 uint32_t GuardRFVerifyStackPointerFunctionPointer; /**< 0x90 */ 965 uint32_t HotPatchTableOffset; /**< 0x94 */ 966 uint32_t AddressOfSomeUnicodeString; /**< 0x98 - 64-bit version has this member about here. not sure about location yet. */ 967 uint32_t Reserved3QuestionMark; /**< 0x9a - Did they 8-byte pad the structure or is AddressOfSomeUnicodeString 64-bit? */ 968 } IMAGE_LOAD_CONFIG_DIRECTORY32_V9; 969 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V9, 0xa0); 970 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V9 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V9; 971 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V9 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V9; 972 973 typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V9 IMAGE_LOAD_CONFIG_DIRECTORY32; 974 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32_V9 PIMAGE_LOAD_CONFIG_DIRECTORY32; 975 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY32_V9 PCIMAGE_LOAD_CONFIG_DIRECTORY32; 927 976 928 977 … … 1196 1245 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V8; 1197 1246 1198 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 IMAGE_LOAD_CONFIG_DIRECTORY64; 1199 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64_V8 PIMAGE_LOAD_CONFIG_DIRECTORY64; 1200 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY64_V8 PCIMAGE_LOAD_CONFIG_DIRECTORY64; 1247 /** @since Windows 10 build 15002 (or maybe earlier). */ 1248 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V9 1249 { 1250 uint32_t Size; /**< 0x00 */ 1251 uint32_t TimeDateStamp; /**< 0x04 */ 1252 uint16_t MajorVersion; /**< 0x08 */ 1253 uint16_t MinorVersion; /**< 0x0a */ 1254 uint32_t GlobalFlagsClear; /**< 0x0c */ 1255 uint32_t GlobalFlagsSet; /**< 0x10 */ 1256 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */ 1257 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */ 1258 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */ 1259 uint64_t LockPrefixTable; /**< 0x28 */ 1260 uint64_t MaximumAllocationSize; /**< 0x30 */ 1261 uint64_t VirtualMemoryThreshold; /**< 0x38 */ 1262 uint64_t ProcessAffinityMask; /**< 0x40 */ 1263 uint32_t ProcessHeapFlags; /**< 0x48 */ 1264 uint16_t CSDVersion; /**< 0x4c */ 1265 uint16_t DependentLoadFlags; /**< 0x4e */ 1266 uint64_t EditList; /**< 0x50 */ 1267 uint64_t SecurityCookie; /**< 0x58 */ 1268 uint64_t SEHandlerTable; /**< 0x60 */ 1269 uint64_t SEHandlerCount; /**< 0x68 */ 1270 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */ 1271 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */ 1272 uint64_t GuardCFFunctionTable; /**< 0x80 */ 1273 uint64_t GuardCFFunctionCount; /**< 0x88 */ 1274 uint32_t GuardFlags; /**< 0x90 */ 1275 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */ 1276 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */ 1277 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */ 1278 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */ 1279 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */ 1280 uint64_t DynamicValueRelocTable; /**< 0xc0 */ 1281 uint64_t CHPEMetadataPointer; /**< 0xc8 */ 1282 uint64_t GuardRFFailureRoutine; /**< 0xd0 */ 1283 uint64_t GuardRFFailureRoutineFunctionPointer; /**< 0xd8 */ 1284 uint32_t DynamicValueRelocTableOffset; /**< 0xe0 */ 1285 uint16_t DynamicValueRelocTableSection; /**< 0xe4 */ 1286 uint16_t Reserved2; /**< 0xe6 */ 1287 uint64_t GuardRFVerifyStackPointerFunctionPointer; /**< 0xe8 */ 1288 uint32_t HotPatchTableOffset; /**< 0xf0 */ 1289 uint32_t Reserved3; /**< 0xf4 */ 1290 uint64_t AddressOfSomeUnicodeString; /**< 0xf8 - seen in bcrypt and bcryptprimitives pointing to the string "L". */ 1291 } IMAGE_LOAD_CONFIG_DIRECTORY64_V9; 1292 AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V9, 0x100); 1293 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V9 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V9; 1294 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V9 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V9; 1295 1296 typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V9 IMAGE_LOAD_CONFIG_DIRECTORY64; 1297 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64_V9 PIMAGE_LOAD_CONFIG_DIRECTORY64; 1298 typedef PCIMAGE_LOAD_CONFIG_DIRECTORY64_V9 PCIMAGE_LOAD_CONFIG_DIRECTORY64; 1201 1299 1202 1300 /** @} */ -
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r66367 r67948 3039 3039 * volatile everywhere! Trying to prevent the compiler being a smarta$$ and reorder stuff. 3040 3040 */ 3041 IMAGE_LOAD_CONFIG_DIRECTORY32_V8 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V8 volatile *)pLoadCfg; 3042 IMAGE_LOAD_CONFIG_DIRECTORY64_V8 volatile *pLoadCfg64 = pLoadCfg; 3043 3041 IMAGE_LOAD_CONFIG_DIRECTORY32_V9 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V9 volatile *)pLoadCfg; 3042 IMAGE_LOAD_CONFIG_DIRECTORY64_V9 volatile *pLoadCfg64 = pLoadCfg; 3043 3044 pLoadCfg64->AddressOfSomeUnicodeString = pLoadCfg32->AddressOfSomeUnicodeString; 3044 3045 pLoadCfg64->HotPatchTableOffset = pLoadCfg32->HotPatchTableOffset; 3045 3046 pLoadCfg64->GuardRFVerifyStackPointerFunctionPointer = pLoadCfg32->GuardRFVerifyStackPointerFunctionPointer; … … 3605 3606 if (Dir.Size) 3606 3607 { 3608 const size_t cbExpectV9 = !pModPe->f64Bit 3609 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V9) 3610 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V9); 3607 3611 const size_t cbExpectV8 = !pModPe->f64Bit 3608 3612 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V8) … … 3630 3634 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V2) /*No V1*/; 3631 3635 const size_t cbNewHack = cbExpectV5; /* Playing safe here since there might've been revisions between V5 and V6 we don't know about . */ 3632 const size_t cbMaxKnown = cbExpectV 8;3636 const size_t cbMaxKnown = cbExpectV9; 3633 3637 3634 3638 bool fNewerStructureHack = false; 3635 if ( Dir.Size != cbExpectV8 3639 if ( Dir.Size != cbExpectV9 3640 && Dir.Size != cbExpectV8 3636 3641 && Dir.Size != cbExpectV7 3637 3642 && Dir.Size != cbExpectV6 … … 3644 3649 fNewerStructureHack = Dir.Size > cbNewHack /* These structure changes are slowly getting to us! More futher down. */ 3645 3650 && Dir.Size <= sizeof(u); 3646 Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n",3647 pszLogName, Dir.Size, cbExpectV 8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,3651 Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n", 3652 pszLogName, Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1, 3648 3653 fNewerStructureHack ? " Will try ignore extra bytes if all zero." : "")); 3649 3654 if (!fNewerStructureHack) 3650 3655 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE, 3651 "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",3652 Dir.Size, cbExpectV 8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);3656 "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu", 3657 Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1); 3653 3658 } 3654 3659 … … 3688 3693 /* Kludge #2: This happens a lot. Structure changes, but the linker doesn't get 3689 3694 updated and stores some old size in the directory. Use the header size. */ 3690 else if ( u.Cfg64.Size == cbExpectV8 3695 else if ( u.Cfg64.Size == cbExpectV9 3696 || u.Cfg64.Size == cbExpectV8 3691 3697 || u.Cfg64.Size == cbExpectV7 3692 3698 || u.Cfg64.Size == cbExpectV6 … … 3724 3730 else 3725 3731 { 3726 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",3727 pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV 8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1));3732 Log(("rtldrPEOpen: %s: load cfg hdr: unexpected hdr size of %u bytes (dir %u), expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.\n", 3733 pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1)); 3728 3734 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE, 3729 "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",3730 u.Cfg64.Size, Dir.Size, cbExpectV 8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);3735 "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu", 3736 u.Cfg64.Size, Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1); 3731 3737 } 3732 3738 }
Note:
See TracChangeset
for help on using the changeset viewer.