VirtualBox

Changeset 11781

Show
Ignore:
Timestamp:
08/28/08 20:34:38 (3 months ago)
Author:
vboxsync
Message:

VBoxHDD-new: Prepend library path to plugin name to fix plugin detection on MacOS X

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp

    r11484 r11781  
    182182    if (!pBackend) 
    183183    { 
     184        char szSharedLibPath[RTPATH_MAX]; 
    184185        char *pszPluginName; 
    185186 
     187        rc = RTPathSharedLibs(szSharedLibPath, sizeof(szSharedLibPath)); 
     188        if (RT_FAILURE(rc)) 
     189            return rc; 
     190 
    186191        /* HDD Format Plugins have VBoxHDD as prefix, prepend it. */ 
    187         RTStrAPrintf(&pszPluginName, "%s%s", 
    188                      VBOX_HDDFORMAT_PLUGIN_PREFIX, pszBackend); 
     192        RTStrAPrintf(&pszPluginName, "%s/%s%s", 
     193                     szSharedLibPath, VBOX_HDDFORMAT_PLUGIN_PREFIX, pszBackend); 
    189194        if (!pszPluginName) 
    190195        { 
     
    193198        } 
    194199 
    195         /* Try to load the plugin (RTldrLoad takes care of the suffix). */ 
     200        /* Try to load the plugin (RTLdrLoad takes care of the suffix). */ 
    196201        rc = RTLdrLoad(pszPluginName, &hPlugin); 
    197202        if (RT_SUCCESS(rc)) 
     
    699704            PFNVBOXHDDFORMATLOAD pfnHDDFormatLoad = NULL; 
    700705            PVBOXHDDBACKEND pBackend = NULL; 
     706            char *pszPluginPath = NULL; 
    701707 
    702708            if (rc == VERR_BUFFER_OVERFLOW) 
     
    717723                continue; 
    718724 
    719             rc = RTLdrLoad(pPluginDirEntry->szName, &hPlugin); 
     725            /* Prepend the path to the libraries. */ 
     726            rc = RTStrAPrintf(&pszPluginPath, "%s/%s", szPath, pPluginDirEntry->szName); 
     727            if (RT_FAILURE(rc)) 
     728            { 
     729                rc = VERR_NO_MEMORY; 
     730                break; 
     731            } 
     732 
     733            rc = RTLdrLoad(pszPluginPath, &hPlugin); 
    720734            if (RT_SUCCESS(rc)) 
    721735            { 
     
    757771                RTLdrClose(hPlugin); 
    758772            } 
     773            RTStrFree(pszPluginPath); 
    759774        } 
    760775        if (rc == VERR_NO_MORE_FILES) 
     
    947962            PFNVBOXHDDFORMATLOAD pfnHDDFormatLoad = NULL; 
    948963            PVBOXHDDBACKEND pBackend = NULL; 
     964            char *pszPluginPath = NULL; 
    949965 
    950966            if (rc == VERR_BUFFER_OVERFLOW) 
     
    965981                continue; 
    966982 
    967             rc = RTLdrLoad(pPluginDirEntry->szName, &hPlugin); 
     983            /* Prepend the path to the libraries. */ 
     984            rc = RTStrAPrintf(&pszPluginPath, "%s/%s", szPath, pPluginDirEntry->szName); 
     985            if (RT_FAILURE(rc)) 
     986            { 
     987                rc = VERR_NO_MEMORY; 
     988                break; 
     989            } 
     990 
     991            rc = RTLdrLoad(pszPluginPath, &hPlugin); 
    968992            if (RT_SUCCESS(rc)) 
    969993            { 
     
    10091033                RTLdrClose(hPlugin); 
    10101034            } 
     1035            RTStrFree(pszPluginPath); 
    10111036 
    10121037            /* 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy