Changeset 67948 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 13, 2017 10:00:40 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.