VirtualBox

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


Ignore:
Timestamp:
Jun 17, 2013 2:32:51 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86471
Message:

updates

Location:
trunk/src/VBox/Runtime/common
Files:
3 edited

Legend:

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

    r46164 r46593  
    9494
    9595
     96RTDECL(PFNRT) RTLdrGetFunction(RTLDRMOD hLdrMod, const char *pszSymbol)
     97{
     98    PFNRT pfn;
     99    int rc = RTLdrGetSymbol(hLdrMod, pszSymbol, (void **)&pfn);
     100    if (RT_SUCCESS(rc))
     101        return pfn;
     102    return NULL;
     103}
     104RT_EXPORT_SYMBOL(RTLdrGetFunction);
     105
     106
    96107RTDECL(RTLDRFMT) RTLdrGetFormat(RTLDRMOD hLdrMod)
    97108{
  • trunk/src/VBox/Runtime/common/ldr/ldrNative.cpp

    r46164 r46593  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6363 * Operations for a native module.
    6464 */
    65 static const RTLDROPS s_rtldrNativeOps =
     65static const RTLDROPS g_rtldrNativeOps =
    6666{
    6767    "native",
     
    131131        pMod->Core.u32Magic     = RTLDRMOD_MAGIC;
    132132        pMod->Core.eState       = LDR_STATE_LOADED;
    133         pMod->Core.pOps         = &s_rtldrNativeOps;
     133        pMod->Core.pOps         = &g_rtldrNativeOps;
    134134        pMod->Core.pReader      = NULL;
    135135        pMod->Core.enmFormat    = RTLDRFMT_NATIVE;
     
    148148#endif
    149149        pMod->hNative           = ~(uintptr_t)0;
     150        pMod->fFlags            = fFlags;
    150151
    151152        /*
     
    171172
    172173
     174RTDECL(int) RTLdrLoadSystem(const char *pszFilename, bool fNoUnload, PRTLDRMOD phLdrMod)
     175{
     176    LogFlow(("RTLdrLoadSystem: pszFilename=%p:{%s} fNoUnload=%RTbool phLdrMod=%p\n",
     177             pszFilename, pszFilename, fNoUnload, phLdrMod));
     178
     179    /*
     180     * Validate input.
     181     */
     182    AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
     183    *phLdrMod = NIL_RTLDRMOD;
     184    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
     185    AssertMsgReturn(!RTPathHavePath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
     186
     187    /*
     188     * Check the filename.
     189     */
     190    size_t cchFilename = strlen(pszFilename);
     191    AssertMsgReturn(cchFilename < (RTPATH_MAX / 4) * 3, ("%zu\n", cchFilename), VERR_INVALID_PARAMETER);
     192
     193    const char *pszExt = "";
     194    if (!RTPathHaveExt(pszFilename))
     195        pszExt = RTLdrGetSuff();
     196
     197    /*
     198     * Let the platform specific code do the rest.
     199     */
     200    int rc = rtldrNativeLoadSystem(pszFilename, pszExt, fNoUnload ? RTLDRLOAD_FLAGS_NO_UNLOAD : 0, phLdrMod);
     201    LogFlow(("RTLdrLoadSystem: returns %Rrc\n", rc));
     202    return rc;
     203}
     204
     205
     206RTDECL(void *) RTLdrGetSystemSymbol(const char *pszFilename, const char *pszSymbol)
     207{
     208    void    *pvRet = NULL;
     209    RTLDRMOD hLdrMod;
     210    int rc = RTLdrLoadSystem(pszFilename, true /*fNoUnload*/, &hLdrMod);
     211    if (RT_SUCCESS(rc))
     212    {
     213        rc = RTLdrGetSymbol(hLdrMod, pszSymbol, &pvRet);
     214        if (RT_FAILURE(rc))
     215            pvRet = NULL; /* paranoia */
     216        RTLdrClose(hLdrMod);
     217    }
     218    return pvRet;
     219}
     220
     221
    173222/**
    174223 * Loads a dynamic load library (/shared object) image file residing in the
     
    258307RT_EXPORT_SYMBOL(RTLdrGetSuff);
    259308
     309
     310RTDECL(uintptr_t) RTLdrGetNativeHandle(RTLDRMOD hLdrMod)
     311{
     312    PRTLDRMODNATIVE pThis = (PRTLDRMODNATIVE)hLdrMod;
     313    AssertPtrReturn(pThis, ~(uintptr_t)0);
     314    AssertReturn(pThis->Core.u32Magic == RTLDRMOD_MAGIC, ~(uintptr_t)0);
     315    AssertReturn(pThis->Core.pOps == &g_rtldrNativeOps, ~(uintptr_t)0);
     316    return pThis->hNative;
     317}
     318RT_EXPORT_SYMBOL(RTLdrGetNativeHandle);
     319
  • trunk/src/VBox/Runtime/common/misc/thread.cpp

    r44528 r46593  
    184184    return rc;
    185185}
     186
     187
     188#ifdef IN_RING3
     189/**
     190 * Called when IPRT was first initialized in unobtrusive mode and later changed
     191 * to obtrustive.
     192 *
     193 * This is only applicable in ring-3.
     194 */
     195DECLHIDDEN(void) rtThreadReInitObtrusive(void)
     196{
     197    rtThreadNativeReInitObtrusive();
     198}
     199#endif
    186200
    187201
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