VirtualBox

Ignore:
Timestamp:
May 14, 2013 11:39:28 PM (12 years ago)
Author:
vboxsync
Message:

Made it possible to find symbols for windows nt using a image-in-guest-memory loader fallback.

File:
1 edited

Legend:

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

    r46082 r46083  
    264264    LogFlow(("RTLdrOpenInMemory: pszName=%p:{%s} fFlags=%#x enmArch=%d cbImage=%#zu pfnRead=%p pfnDtor=%p pvUser=%p phLdrMod=%p\n",
    265265             pszName, pszName, fFlags, enmArch, cbImage, pfnRead, pfnDtor, pvUser, phLdrMod));
    266     AssertMsgReturn(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
    267     AssertMsgReturn(enmArch > RTLDRARCH_INVALID && enmArch < RTLDRARCH_END, ("%d\n", enmArch), VERR_INVALID_PARAMETER);
     266
    268267    if (!pfnRead || !pfnDtor)
    269268        AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     269    if (!pfnDtor)
     270        pfnDtor = rtldrRdrMemDefaultDtor;
     271    else
     272        AssertPtrReturn(pfnRead, VERR_INVALID_POINTER);
     273
     274    /* The rest of the validations will call the destructor. */
     275    AssertMsgReturnStmt(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags),
     276                        pfnDtor(pvUser), VERR_INVALID_PARAMETER);
     277    AssertMsgReturnStmt(enmArch > RTLDRARCH_INVALID && enmArch < RTLDRARCH_END, ("%d\n", enmArch),
     278                        pfnDtor(pvUser), VERR_INVALID_PARAMETER);
    270279    if (!pfnRead)
    271280        pfnRead = rtldrRdrMemDefaultReader;
    272281    else
    273         AssertPtrReturn(pfnRead, VERR_INVALID_POINTER);
    274     if (!pfnDtor)
    275         pfnDtor = rtldrRdrMemDefaultDtor;
    276     else
    277         AssertPtrReturn(pfnRead, VERR_INVALID_POINTER);
    278     AssertReturn(cbImage > 0, VERR_INVALID_PARAMETER);
    279 
     282        AssertReturnStmt(RT_VALID_PTR(pfnRead), pfnDtor(pvUser), VERR_INVALID_POINTER);
     283    AssertReturnStmt(cbImage > 0, pfnDtor(pvUser), VERR_INVALID_PARAMETER);
    280284
    281285    /*
     
    304308            return rc;
    305309        }
     310
    306311        pReader->pfnDestroy(pReader);
    307312    }
     313    else
     314        pfnDtor(pvUser),
    308315    *phLdrMod = NIL_RTLDRMOD;
     316
    309317    LogFlow(("RTLdrOpen: return %Rrc\n", rc));
    310318    return rc;
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