VirtualBox

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


Ignore:
Timestamp:
Feb 18, 2008 4:12:49 PM (17 years ago)
Author:
vboxsync
Message:

Frontends/VBoxBFE: updated HGCM in VBoxBFE after r28172, r28177 and r28183

File:
1 edited

Legend:

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

    r6967 r6998  
    3030#include <iprt/critsect.h>
    3131#include <iprt/asm.h>
     32#include <iprt/ldr.h>
    3233#include <iprt/param.h>
    3334#include <iprt/path.h>
    34 #include <iprt/ldr.h>
    3535#include <iprt/string.h>
    3636#include <iprt/semaphore.h>
     
    126126
    127127        static DECLCALLBACK(void) svcHlpCallComplete (VBOXHGCMCALLHANDLE callHandle, int32_t rc);
    128 
     128        static DECLCALLBACK(void) svcHlpDisconnectClient (void *pvInstance, uint32_t u32ClientId);
     129       
    129130    public:
    130131
     
    147148
    148149        int CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn);
    149         int DisconnectClient (uint32_t u32ClientId);
     150        int DisconnectClient (uint32_t u32ClientId, bool fFromService);
    150151
    151152        int HostCall (uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms);
     
    765766}
    766767
     768/* static */ DECLCALLBACK(void) HGCMService::svcHlpDisconnectClient (void *pvInstance, uint32_t u32ClientId)
     769{
     770     HGCMService *pService = static_cast <HGCMService *> (pvInstance);
     771     
     772     if (pService)
     773     {
     774         pService->DisconnectClient (u32ClientId, true);
     775     }
     776}
     777
    767778static DECLCALLBACK(void) hgcmMsgCompletionCallback (int32_t result, HGCMMsgCore *pMsgCore)
    768779{
     
    812823        {
    813824            /* Initialize service helpers table. */
    814             m_svcHelpers.pfnCallComplete = svcHlpCallComplete;
    815             m_svcHelpers.pvInstance      = this;
     825            m_svcHelpers.pfnCallComplete     = svcHlpCallComplete;
     826            m_svcHelpers.pvInstance          = this;
     827            m_svcHelpers.pfnDisconnectClient = svcHlpDisconnectClient;
    816828
    817829            /* Execute the load request on the service thread. */
     
    11161128        {
    11171129            LogFlowFunc(("handle %d\n", pSvc->m_paClientIds[0]));
    1118             pSvc->DisconnectClient (pSvc->m_paClientIds[0]);
     1130            pSvc->DisconnectClient (pSvc->m_paClientIds[0], false);
    11191131        }
    11201132
     
    13751387 * @return VBox rc.
    13761388 */
    1377 int HGCMService::DisconnectClient (uint32_t u32ClientId)
    1378 {
    1379     LogFlowFunc(("client id = %d\n", u32ClientId));
    1380 
    1381     /* Call the service. */
    1382     HGCMMSGHANDLE hMsg;
    1383 
    1384     int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_DISCONNECT, hgcmMessageAllocSvc);
    1385 
    1386     if (VBOX_SUCCESS(rc))
    1387     {
    1388         HGCMMsgSvcDisconnect *pMsg = (HGCMMsgSvcDisconnect *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
    1389         AssertRelease(pMsg);
    1390 
    1391         pMsg->u32ClientId = u32ClientId;
    1392 
    1393         hgcmObjDereference (pMsg);
    1394 
    1395         rc = hgcmMsgSend (hMsg);
    1396 
     1389int HGCMService::DisconnectClient (uint32_t u32ClientId, bool fFromService)
     1390{
     1391    int rc = VINF_SUCCESS;
     1392
     1393    LogFlowFunc(("client id = %d, fFromService = %d\n", u32ClientId, fFromService));
     1394
     1395    if (!fFromService)
     1396    {
     1397        /* Call the service. */
     1398        HGCMMSGHANDLE hMsg;
     1399
     1400        rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_DISCONNECT, hgcmMessageAllocSvc);
     1401
     1402        if (VBOX_SUCCESS(rc))
     1403        {
     1404            HGCMMsgSvcDisconnect *pMsg = (HGCMMsgSvcDisconnect *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
     1405            AssertRelease(pMsg);
     1406
     1407            pMsg->u32ClientId = u32ClientId;
     1408
     1409            hgcmObjDereference (pMsg);
     1410
     1411            rc = hgcmMsgSend (hMsg);
     1412        }
     1413    }
     1414
     1415    if (VBOX_SUCCESS (rc))
     1416    {
    13971417        /* Remove the client id from the array in any case. */
    13981418        int i;
     
    17301750
    17311751                /* Call the service instance to disconnect the client. */
    1732                 rc = pService->DisconnectClient (pMsg->u32ClientId);
     1752                rc = pService->DisconnectClient (pMsg->u32ClientId, false);
    17331753
    17341754                hgcmObjDereference (pClient);
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