VirtualBox

Changeset 6967 in vbox for trunk/src/VBox/Frontends/VBoxBFE


Ignore:
Timestamp:
Feb 14, 2008 7:14:34 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28137
Message:

Don't use the system library path to look for plugins.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBFE/HGCM.cpp

    r6953 r6967  
    9797        char *m_pszSvcName;
    9898        char *m_pszSvcLibrary;
    99        
     99
    100100        RTLDRMOD m_hLdrMod;
    101101        PFNVBOXHGCMSVCLOAD m_pfnLoad;
     
    107107
    108108        uint32_t *m_paClientIds;
    109        
     109
    110110        HGCMSVCEXTHANDLE m_hExtension;
    111111
     
    126126
    127127        static DECLCALLBACK(void) svcHlpCallComplete (VBOXHGCMCALLHANDLE callHandle, int32_t rc);
    128        
     128
    129129    public:
    130130
     
    239239     * If only library name is specified, then try to load it from:
    240240     *   - RTPathAppPrivateArch
    241      *   - RTPathSharedLibs
    242      *   - default system LIBPATH.
     241     *   - RTPathSharedLibs (legacy)
    243242     */
    244243    int rc = VINF_SUCCESS;
    245    
     244
    246245    if (RTPathHavePath (pszName))
    247246    {
     
    251250    else
    252251    {
    253         if (strlen (pszName) >= RTPATH_MAX)
    254         {
    255             return VERR_FILENAME_TOO_LONG;
    256         }
    257    
    258252        /* Try default locations. */
    259253        char szBase[RTPATH_MAX];
    260        
     254
    261255        /* Get the appropriate base path. */
    262256        int i;
    263         for (i = 0; i < 3; i++)
     257        for (i = 0; i < 2; i++)
    264258        {
    265259            if (i == 0)
     
    267261                rc = RTPathAppPrivateArch(szBase, sizeof (szBase));
    268262            }
    269             else if (i == 1)
     263            else
    270264            {
    271265                rc = RTPathSharedLibs(szBase, sizeof (szBase));
    272266            }
    273             else
    274             {
    275                 szBase[0] = 0;
    276                 rc = VINF_SUCCESS;
    277             }
    278            
     267
    279268            if (RT_SUCCESS(rc))
    280269            {
    281270                char szPath[RTPATH_MAX];
    282        
     271
    283272                /* szPath = pszBase + pszName */
    284                 if (szBase[0] != 0)
    285                 {
    286                     rc = RTPathAbsEx (szBase, pszName, szPath, sizeof (szPath));
    287                 }
    288                 else
    289                 {
    290                     strcpy (szPath, pszName);
    291                 }
    292            
     273                rc = RTPathAbsEx (szBase, pszName, szPath, sizeof (szPath));
     274
    293275                if (RT_SUCCESS(rc))
    294276                {
    295277                    rc = RTLdrLoad (szPath, phLdrMod);
    296            
     278
    297279                    if (RT_SUCCESS(rc))
    298280                    {
     
    304286        }
    305287    }
    306    
     288
    307289    return rc;
    308290}
     
    448430    public:
    449431        HGCMMsgHeader () : pCmd (NULL), pHGCMPort (NULL) {};
    450        
     432
    451433        /* Command pointer/identifier. */
    452434        PVBOXHGCMCMD pCmd;
     
    519501        case SVC_MSG_HOSTCALL:    return new HGCMMsgHostCallSvc ();
    520502        case SVC_MSG_GUESTCALL:   return new HGCMMsgCall ();
    521         case SVC_MSG_LOADSTATE:     
     503        case SVC_MSG_LOADSTATE:
    522504        case SVC_MSG_SAVESTATE:   return new HGCMMsgLoadSaveStateClient ();
    523505        case SVC_MSG_REGEXT:      return new HGCMMsgSvcRegisterExtension ();
     
    694676                }
    695677            } break;
    696            
     678
    697679            case SVC_MSG_REGEXT:
    698680            {
     
    700682
    701683                LogFlowFunc(("SVC_MSG_REGEXT handle = %p, pfn = %p\n", pMsg->handle, pMsg->pfnExtension));
    702                
     684
    703685                if (pSvc->m_hExtension)
    704686                {
     
    715697                        rc = VERR_NOT_SUPPORTED;
    716698                    }
    717                    
     699
    718700                    if (VBOX_SUCCESS (rc))
    719701                    {
     
    728710
    729711                LogFlowFunc(("SVC_MSG_UNREGEXT handle = %p\n", pMsg->handle));
    730                
     712
    731713                if (pSvc->m_hExtension != pMsg->handle)
    732714                {
     
    743725                        rc = VERR_NOT_SUPPORTED;
    744726                    }
    745                    
     727
    746728                    pSvc->m_hExtension = NULL;
    747729                }
     
    771753   if (pMsgCore->MsgId () == SVC_MSG_GUESTCALL)
    772754   {
    773        /* Only call the completion for these messages. The helper 
     755       /* Only call the completion for these messages. The helper
    774756        * is called by the service, and the service does not get
    775757        * any other messages.
     
    821803            RTStrFree (m_pszSvcLibrary);
    822804            m_pszSvcLibrary = NULL;
    823            
     805
    824806            RTStrFree (m_pszSvcName);
    825807            m_pszSvcName = NULL;
    826            
     808
    827809            rc = VERR_NO_MEMORY;
    828810        }
     
    832814            m_svcHelpers.pfnCallComplete = svcHlpCallComplete;
    833815            m_svcHelpers.pvInstance      = this;
    834            
     816
    835817            /* Execute the load request on the service thread. */
    836818            HGCMMSGHANDLE hMsg;
     
    942924    HGCMService *pSvc;
    943925    int rc = HGCMService::ResolveService (&pSvc, pszServiceName);
    944    
     926
    945927    if (VBOX_SUCCESS (rc))
    946928    {
     
    968950                pSvc->m_pSvcNext = sm_pSvcListHead;
    969951                pSvc->m_pSvcPrev = NULL;
    970                
     952
    971953                if (sm_pSvcListHead)
    972954                {
     
    10971079    ASMAtomicIncU32 (&m_u32RefCnt);
    10981080    LogFlowFunc(("m_u32RefCnt = %d\n", m_u32RefCnt));
    1099 }       
     1081}
    11001082
    11011083/** The method dereferences a service and deletes it when no more refs.
     
    11561138
    11571139    LogFlowFunc(("%d services to be saved:\n", sm_cServices));
    1158    
     1140
    11591141    /* Save number of services. */
    11601142    rc = SSMR3PutU32(pSSM, sm_cServices);
     
    12281210    rc = SSMR3GetU32(pSSM, &cServices);
    12291211    AssertRCReturn(rc, rc);
    1230    
     1212
    12311213    LogFlowFunc(("%d services to be restored:\n", cServices));
    12321214
     
    12371219        AssertRCReturn(rc, rc);
    12381220        AssertReturn(u32 <= VBOX_HGCM_SVC_NAME_MAX_BYTES, VERR_SSM_UNEXPECTED_DATA);
    1239        
     1221
    12401222        char *pszServiceName = (char *)alloca (u32);
    12411223
     
    12431225        rc = SSMR3GetStrZ(pSSM, pszServiceName, u32);
    12441226        AssertRCReturn(rc, rc);
    1245        
     1227
    12461228        LogFlowFunc(("Restoring service [%s]\n", pszServiceName));
    1247    
     1229
    12481230        /* Resolve the service instance. */
    1249         HGCMService *pSvc; 
     1231        HGCMService *pSvc;
    12501232        rc = ResolveService (&pSvc, pszServiceName);
    12511233        AssertReturn(pSvc, VERR_SSM_UNEXPECTED_DATA);
    1252            
     1234
    12531235        /* Get the number of clients. */
    12541236        uint32_t cClients;
     
    13191301
    13201302    uint32_t handle;
    1321    
     1303
    13221304    if (pu32ClientIdOut != NULL)
    13231305    {
     
    13531335
    13541336            rc = hgcmMsgSend (hMsg);
    1355        
     1337
    13561338            if (VBOX_SUCCESS (rc))
    13571339            {
     
    13631345                    m_cClientsAllocated += 64;
    13641346                }
    1365            
     1347
    13661348                m_paClientIds[m_cClients] = handle;
    13671349                m_cClients++;
     
    13831365        ReferenceService ();
    13841366    }
    1385    
     1367
    13861368    LogFlowFunc(("rc = %Vrc\n", rc));
    13871369    return rc;
     
    14121394
    14131395        rc = hgcmMsgSend (hMsg);
    1414        
     1396
    14151397        /* Remove the client id from the array in any case. */
    14161398        int i;
     
    14211403            {
    14221404                m_cClients--;
    1423                
     1405
    14241406                if (m_cClients > i)
    14251407                {
    14261408                    memmove (&m_paClientIds[i], &m_paClientIds[i + 1], m_cClients - i);
    14271409                }
    1428                
     1410
    14291411                break;
    14301412            }
     
    15701552
    15711553
    1572 /* 
     1554/*
    15731555 * Main HGCM thread that manages services.
    15741556 */
    1575  
     1557
    15761558/* Messages processed by the main HGCM thread. */
    15771559#define HGCM_MSG_CONNECT    (10)  /* Connect a client to a service. */
     
    16671649        case HGCM_MSG_LOAD:       return new HGCMMsgMainLoad ();
    16681650        case HGCM_MSG_HOSTCALL:   return new HGCMMsgMainHostCall ();
    1669         case HGCM_MSG_LOADSTATE:     
     1651        case HGCM_MSG_LOADSTATE:
    16701652        case HGCM_MSG_SAVESTATE:  return new HGCMMsgMainLoadSaveState ();
    16711653        case HGCM_MSG_RESET:      return new HGCMMsgMainReset ();
     
    18191801            {
    18201802                HGCMMsgMainRegisterExtension *pMsg = (HGCMMsgMainRegisterExtension *)pMsgCore;
    1821                
     1803
    18221804                LogFlowFunc(("HGCM_MSG_REGEXT\n"));
    1823                
     1805
    18241806                /* Allocate the handle data. */
    18251807                HGCMSVCEXTHANDLE handle = (HGCMSVCEXTHANDLE)RTMemAllocZ (sizeof (struct _HGCMSVCEXTHANDLEDATA)
    18261808                                                                         + strlen (pMsg->pszServiceName)
    18271809                                                                         + sizeof (char));
    1828                
     1810
    18291811                if (handle == NULL)
    18301812                {
     
    18351817                    handle->pszServiceName = (char *)((uint8_t *)handle + sizeof (struct _HGCMSVCEXTHANDLEDATA));
    18361818                    strcpy (handle->pszServiceName, pMsg->pszServiceName);
    1837                    
     1819
    18381820                    HGCMService *pService;
    18391821                    rc = HGCMService::ResolveService (&pService, handle->pszServiceName);
     
    18451827                        pService->ReleaseService ();
    18461828                    }
    1847                    
     1829
    18481830                    if (VBOX_FAILURE (rc))
    18491831                    {
     
    18721854                    pService->ReleaseService ();
    18731855                }
    1874                
     1856
    18751857                RTMemFree (pMsg->handle);
    18761858            } break;
     
    22372219        HGCMMsgMainHostCall *pMsg = (HGCMMsgMainHostCall *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
    22382220        AssertRelease(pMsg);
    2239        
     2221
    22402222        pMsg->pszServiceName = (char *)pszServiceName;
    22412223        pMsg->u32Function    = u32Function;
     
    22552237{
    22562238    LogFlowFunc(("\n"));
    2257    
     2239
    22582240    /* Disconnect all clients.
    22592241     */
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