- Timestamp:
- Jan 11, 2017 10:39:51 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.