VirtualBox

Changeset 60715 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Apr 27, 2016 11:27:20 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106899
Message:

ldrPE.cpp: Sigh. Can't expect microsoft to update all their linkers. 32-bit ucrtbase.dll just had to use a different load config dir and header sizes. So, apply the fNewStructHack to kludge #2 as well, making it a much larger kludge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp

    r60699 r60715  
    35773577            }
    35783578            /* Kludge #2: This happens a lot. Structure changes, but the linker doesn't get
    3579                it updated and stores some old size in the directory.  Use the header size. */
     3579               updated and stores some old size in the directory.  Use the header size. */
    35803580            else if (   u.Cfg64.Size == cbExpectV5
    35813581                     || u.Cfg64.Size == cbExpectV4
    35823582                     || u.Cfg64.Size == cbExpectV3
    35833583                     || u.Cfg64.Size == cbExpectV2
    3584                      || u.Cfg64.Size == cbExpectV1)
     3584                     || u.Cfg64.Size == cbExpectV1
     3585                     || (fNewerStructureHack = (u.Cfg64.Size > cbExpectV5 && u.Cfg64.Size <= sizeof(u))) )
    35853586            {
    35863587                Log(("rtldrPEOpen: %s: load cfg dir: Header (%d) and directory (%d) size mismatch, applying the old linker kludge.\n",
    35873588                     pszLogName, u.Cfg64.Size, Dir.Size));
     3589
    35883590                Dir.Size = u.Cfg64.Size;
     3591                uint32_t const uOrgDir = Dir.Size;
    35893592                RT_ZERO(u.Cfg64);
    35903593                rc = rtldrPEReadRVA(pModPe, &u.Cfg64, Dir.Size, Dir.VirtualAddress);
    35913594                if (RT_FAILURE(rc))
    35923595                    return rc;
     3596                if (   fNewerStructureHack
     3597                    && !ASMMemIsZero(&u.abZeros[cbExpectV5], Dir.Size - cbExpectV5))
     3598                {
     3599                    Log(("rtldrPEOpen: %s: load cfg dir: Unknown bytes are non-zero (%u bytes of which %u expected to be zero): %.*Rhxs\n",
     3600                         pszLogName, Dir.Size, Dir.Size - cbExpectV5, Dir.Size - cbExpectV5, &u.abZeros[cbExpectV5]));
     3601                    return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE,
     3602                                         "Grown load config (%u to %u bytes, dir %u) includes non-zero bytes: %.*Rhxs",
     3603                                         cbExpectV5, Dir.Size, uOrgDir, Dir.Size - cbExpectV5, &u.abZeros[cbExpectV5]);
     3604                }
    35933605                rtldrPEConvert32BitLoadConfigTo64Bit(&u.Cfg64);
    35943606                AssertReturn(u.Cfg64.Size == Dir.Size,
     
    36013613                     pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1));
    36023614                return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE,
    3603                                      "Unexpected load config dir size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, or %zu",
     3615                                     "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, or %zu",
    36043616                                     u.Cfg64.Size, Dir.Size, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
    36053617            }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette