VirtualBox

Changeset 3384 in kBuild for trunk/src/kWorker


Ignore:
Timestamp:
Jun 17, 2020 8:22:04 PM (4 years ago)
Author:
bird
Message:

kWorker: Hack for older windows versions where api-ms-win-crt-*.dll resolve to actual forwarder DLLs. We need to link them to ucrtbase.dll so we can patch it. Forwarder DLLs cannot be patched.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kWorker/kWorker.c

    r3378 r3384  
    24762476        }
    24772477        else
     2478        {
    24782479            KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: %s -> %s - A real DLL!\n", pszName, pMod->pszPath));
     2480            /* HACK ALERT! If api-ms-win-crt-* find ucrtbase.dll and attach it as the
     2481                           real module as we cannot make replacements in the virtual
     2482                           API set forward DLLs. */
     2483            /** @todo Find a way of scanning the exports and collect forwarder DLLs and
     2484             *        imported DLLs. kLdrModEnumSymbols()? */
     2485            if (   pMod->pVirtualApiMod == NULL
     2486                && kHlpStrNICompAscii(pszName, TUPLE("api-ms-win-crt-")) == 0)
     2487            {
     2488                HMODULE hModReal = GetModuleHandleW(L"ucrtbase.dll");
     2489                if (hModReal)
     2490                {
     2491                    PKWMODULE pRealMod = kwLdrModuleForLoadedNativeByHandle(hModReal, K_TRUE /*fEnsureCrtSlot*/, "ucrtbase.dll");
     2492                    if (pRealMod)
     2493                    {
     2494                        KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: Linking %s to '%s'.\n", pszName, pRealMod->pszPath));
     2495                        pMod->pVirtualApiMod = pRealMod;
     2496                    }
     2497                    else
     2498                        KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: kwLdrModuleForLoadedNativeByHandle failed for ucrtbase.dll/%s!\n", pszName));
     2499                }
     2500                else
     2501                    KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: no ucrtbase.dll found for %s!\n", pszName));
     2502            }
     2503        }
    24792504    }
    24802505
Note: See TracChangeset for help on using the changeset viewer.

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