VirtualBox

Changeset 75853 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Nov 30, 2018 7:26:42 PM (6 years ago)
Author:
vboxsync
Message:

GuestControl,HGCM,VBoxService: Save/restore related optimizations and changes. bugref:9313

Location:
trunk/src/VBox/Main/src-client
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r75823 r75853  
    3636#include "ConsoleImpl.h"
    3737#include "DisplayImpl.h"
    38 #ifdef VBOX_WITH_GUEST_CONTROL
     38#ifdef VBOX_WITH_DRAG_AND_DROP
    3939# include "GuestImpl.h"
    40 #endif
    41 #ifdef VBOX_WITH_DRAG_AND_DROP
    4240# include "GuestDnDPrivate.h"
    4341#endif
     
    31943192         */
    31953193        rc = i_configGuestProperties(this);
    3196 #endif
    3197 
    3198 #ifdef VBOX_WITH_GUEST_CONTROL
    3199         /*
    3200          * Guest control service.
    3201          */
    3202         rc = i_configGuestControl(this);
    32033194#endif
    32043195
     
    62356226}
    62366227
    6237 /**
    6238  * Set up the Guest Control service.
    6239  */
    6240 /* static */ int Console::i_configGuestControl(void *pvConsole)
    6241 {
    6242 #ifdef VBOX_WITH_GUEST_CONTROL
    6243     AssertReturn(pvConsole, VERR_INVALID_POINTER);
    6244     ComObjPtr<Console> pConsole = static_cast<Console *>(pvConsole);
    6245 
    6246     /* Load the service */
    6247     int rc = pConsole->m_pVMMDev->hgcmLoadService("VBoxGuestControlSvc", "VBoxGuestControlSvc");
    6248 
    6249     if (RT_FAILURE(rc))
    6250     {
    6251         LogRel(("VBoxGuestControlSvc is not available. rc = %Rrc\n", rc));
    6252         /* That is not a fatal failure. */
    6253         rc = VINF_SUCCESS;
    6254     }
    6255     else
    6256     {
    6257         HGCMSVCEXTHANDLE hDummy;
    6258         rc = HGCMHostRegisterServiceExtension(&hDummy, "VBoxGuestControlSvc",
    6259                                               &Guest::i_notifyCtrlDispatcher,
    6260                                               pConsole->i_getGuest());
    6261         if (RT_FAILURE(rc))
    6262             Log(("Cannot register VBoxGuestControlSvc extension!\n"));
    6263         else
    6264             LogRel(("Guest Control service loaded\n"));
    6265     }
    6266 
    6267     return rc;
    6268 #else /* !VBOX_WITH_GUEST_CONTROL */
    6269     return VERR_NOT_SUPPORTED;
    6270 #endif /* !VBOX_WITH_GUEST_CONTROL */
    6271 }
  • trunk/src/VBox/Main/src-client/HGCM.cpp

    r75774 r75853  
    118118
    119119        PUVM m_pUVM;
     120        PPDMIHGCMPORT m_pHgcmPort;
    120121
    121122        /** @name Statistics
     
    130131         * Main HGCM thread methods.
    131132         */
    132         int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM);
     133        int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort);
    133134        void instanceDestroy(void);
    134135
    135136        int saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM);
    136         int loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM);
     137        int loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, uint32_t uVersion);
    137138
    138139        HGCMService();
     
    150151        static DECLCALLBACK(int)  svcHlpInfoDeregister(void *pvInstance, const char *pszName);
    151152        static DECLCALLBACK(uint32_t) svcHlpGetRequestor(VBOXHGCMCALLHANDLE hCall);
     153        static DECLCALLBACK(uint64_t) svcHlpGetVMMDevSessionId(void *pvInstance);
    152154
    153155    public:
     
    156158         * Main HGCM thread methods.
    157159         */
    158         static int LoadService(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM);
     160        static int LoadService(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort);
    159161        void UnloadService(bool fUvmIsInvalid);
    160162
     
    168170
    169171        static int SaveState(PSSMHANDLE pSSM);
    170         static int LoadState(PSSMHANDLE pSSM);
     172        static int LoadState(PSSMHANDLE pSSM, uint32_t uVersion);
    171173
    172174        int CreateAndConnectClient(uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn, uint32_t fRequestor, bool fRestoring);
     
    199201{
    200202    public:
    201         HGCMClient() : HGCMObject(HGCMOBJ_CLIENT), pService(NULL),
    202                         pvData(NULL) {};
     203        HGCMClient(uint32_t a_fRequestor)
     204            : HGCMObject(HGCMOBJ_CLIENT)
     205            , pService(NULL)
     206            , pvData(NULL)
     207            , fRequestor(a_fRequestor)
     208        {}
    203209        ~HGCMClient();
    204210
     
    210216        /** Client specific data. */
    211217        void *pvData;
     218
     219        /** The requestor flags this client was created with.
     220         * @sa VMMDevRequestHeader::fRequestor */
     221        uint32_t fRequestor;
     222
     223    private: /* none of this: */
     224        HGCMClient();
     225        HGCMClient(HGCMClient const &);
     226        HGCMClient &operator=(HGCMClient const &);
    212227};
    213228
     
    215230{
    216231    if (pService->SizeOfClient() > 0)
     232    {
    217233        RTMemFree(pvData);
    218 }
     234        pvData = NULL;
     235    }
     236}
     237
    219238
    220239int HGCMClient::Init(HGCMService *pSvc)
     
    261280#endif
    262281    m_hExtension (NULL),
    263     m_pUVM       (NULL)
     282    m_pUVM       (NULL),
     283    m_pHgcmPort  (NULL)
    264284{
    265285    RT_ZERO(m_fntable);
     
    469489{
    470490    public:
     491        PSSMHANDLE  pSSM;
     492        uint32_t    uVersion;
    471493        uint32_t    u32ClientId;
    472         PSSMHANDLE  pSSM;
    473494};
    474495
     
    684705                if (pClient)
    685706                {
    686                     if (pSvc->m_fntable.pfnLoadState)
     707                    /* fRequestor: Restored by the message sender already. */
     708                    bool fHaveClientState = pSvc->m_fntable.pfnLoadState != NULL;
     709                    if (pMsg->uVersion > HGCM_SAVED_STATE_VERSION_V2)
     710                        rc = SSMR3GetBool(pMsg->pSSM, &fHaveClientState);
     711                    else
     712                        rc = VINF_SUCCESS;
     713                    if (RT_SUCCESS(rc) )
    687714                    {
    688                         rc = pSvc->m_fntable.pfnLoadState(pSvc->m_fntable.pvService, pMsg->u32ClientId,
    689                                                           HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM);
     715                        if (pSvc->m_fntable.pfnLoadState)
     716                            rc = pSvc->m_fntable.pfnLoadState(pSvc->m_fntable.pvService, pMsg->u32ClientId,
     717                                                              HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM,
     718                                                              fHaveClientState ? pMsg->uVersion : 0);
     719                        else
     720                            AssertLogRelStmt(!fHaveClientState, rc = VERR_INTERNAL_ERROR_5);
    690721                    }
    691 
    692722                    hgcmObjDereference(pClient);
    693723                }
     
    710740                if (pClient)
    711741                {
    712                     if (pSvc->m_fntable.pfnSaveState)
     742                    SSMR3PutU32(pMsg->pSSM, pClient->fRequestor); /* Quicker to save this here than in the message sender. */
     743                    rc = SSMR3PutBool(pMsg->pSSM, pSvc->m_fntable.pfnSaveState != NULL);
     744                    if (RT_SUCCESS(rc) && pSvc->m_fntable.pfnSaveState)
    713745                    {
    714746                        g_fSaveState = true;
     
    893925}
    894926
    895 
    896927/**
    897928 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnGetRequestor}
     
    909940
    910941    return pHgcmPort->pfnGetRequestor(pHgcmPort, pCmd);
     942}
     943
     944/**
     945 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnGetVMMDevSessionId}
     946 */
     947/* static */ DECLCALLBACK(uint64_t) HGCMService::svcHlpGetVMMDevSessionId(void *pvInstance)
     948{
     949     HGCMService *pService = static_cast <HGCMService *>(pvInstance);
     950     AssertPtrReturn(pService, UINT64_MAX);
     951
     952     PPDMIHGCMPORT pHgcmPort = pService->m_pHgcmPort;
     953     AssertPtrReturn(pHgcmPort, UINT64_MAX);
     954
     955     return pHgcmPort->pfnGetVMMDevSessionId(pHgcmPort);
    911956}
    912957
     
    933978 */
    934979
    935 int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM)
     980int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort)
    936981{
    937982    LogFlowFunc(("name %s, lib %s\n", pszServiceName, pszServiceLibrary));
     
    9641009        else
    9651010        {
     1011            m_pUVM = pUVM;
     1012            m_pHgcmPort = pHgcmPort;
     1013
    9661014            /* Register statistics: */
    967             m_pUVM = pUVM;
    9681015            STAMR3RegisterFU(pUVM, &m_StatHandleMsg, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
    9691016                             "Message handling", "/HGCM/%s/Msg", pszServiceName);
    9701017
    9711018            /* Initialize service helpers table. */
    972             m_svcHelpers.pfnCallComplete     = svcHlpCallComplete;
    973             m_svcHelpers.pvInstance          = this;
    974             m_svcHelpers.pfnDisconnectClient = svcHlpDisconnectClient;
    975             m_svcHelpers.pfnIsCallRestored   = svcHlpIsCallRestored;
    976             m_svcHelpers.pfnStamRegisterV    = svcHlpStamRegisterV;
    977             m_svcHelpers.pfnStamDeregisterV  = svcHlpStamDeregisterV;
    978             m_svcHelpers.pfnInfoRegister     = svcHlpInfoRegister;
    979             m_svcHelpers.pfnInfoDeregister   = svcHlpInfoDeregister;
    980             m_svcHelpers.pfnGetRequestor     = svcHlpGetRequestor;
     1019            m_svcHelpers.pfnCallComplete       = svcHlpCallComplete;
     1020            m_svcHelpers.pvInstance            = this;
     1021            m_svcHelpers.pfnDisconnectClient   = svcHlpDisconnectClient;
     1022            m_svcHelpers.pfnIsCallRestored     = svcHlpIsCallRestored;
     1023            m_svcHelpers.pfnStamRegisterV      = svcHlpStamRegisterV;
     1024            m_svcHelpers.pfnStamDeregisterV    = svcHlpStamDeregisterV;
     1025            m_svcHelpers.pfnInfoRegister       = svcHlpInfoRegister;
     1026            m_svcHelpers.pfnInfoDeregister     = svcHlpInfoDeregister;
     1027            m_svcHelpers.pfnGetRequestor       = svcHlpGetRequestor;
     1028            m_svcHelpers.pfnGetVMMDevSessionId = svcHlpGetVMMDevSessionId;
    9811029
    9821030            /* Execute the load request on the service thread. */
     
    10221070        STAMR3DeregisterF(m_pUVM, "/HGCM/%s/*", m_pszSvcName);
    10231071    m_pUVM = NULL;
     1072    m_pHgcmPort = NULL;
    10241073
    10251074    RTStrFree(m_pszSvcLibrary);
     
    10511100}
    10521101
    1053 int HGCMService::loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM)
     1102int HGCMService::loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, uint32_t uVersion)
    10541103{
    10551104    LogFlowFunc(("%s\n", m_pszSvcName));
     
    10621111        HGCMMsgLoadSaveStateClient *pMsg = (HGCMMsgLoadSaveStateClient *)pCoreMsg;
    10631112
     1113        pMsg->pSSM        = pSSM;
     1114        pMsg->uVersion    = uVersion;
    10641115        pMsg->u32ClientId = u32ClientId;
    1065         pMsg->pSSM        = pSSM;
    10661116
    10671117        rc = hgcmMsgSend(pMsg);
     
    10751125/** The method creates a service and references it.
    10761126 *
    1077  * @param pszServiceLibrary  The library to be loaded.
    1078  * @param pszServiceName     The name of the service.
    1079  * @param pUVM               The user mode VM handle (for statistics and such).
    1080  * @return VBox rc.
    1081  * @thread main HGCM
    1082  */
    1083 /* static */ int HGCMService::LoadService(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM)
     1127 * @param   pszServiceLibrary  The library to be loaded.
     1128 * @param   pszServiceName     The name of the service.
     1129 * @param   pUVM               The user mode VM handle (for statistics and such).
     1130 * @param   pHgcmPort          The VMMDev HGCM port interface.
     1131 *
     1132 * @return  VBox rc.
     1133 * @thread  main HGCM
     1134 */
     1135/* static */ int HGCMService::LoadService(const char *pszServiceLibrary, const char *pszServiceName,
     1136                                          PUVM pUVM, PPDMIHGCMPORT pHgcmPort)
    10841137{
    10851138    LogFlowFunc(("lib %s, name = %s, pUVM = %p\n", pszServiceLibrary, pszServiceName, pUVM));
     
    11081161        {
    11091162            /* Load the library and call the initialization entry point. */
    1110             rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName, pUVM);
     1163            rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName, pUVM, pHgcmPort);
    11111164
    11121165            if (RT_SUCCESS(rc))
     
    11511204
    11521205    if (fUvmIsInvalid)
     1206    {
    11531207        m_pUVM = NULL;
     1208        m_pHgcmPort = NULL;
     1209    }
    11541210
    11551211    /* Remove the service from the list. */
     
    13541410            Log(("client id 0x%08X\n", u32ClientId));
    13551411
    1356             /* Save the client id. */
     1412            /* Save the client id. (fRequestor is saved via SVC_MSG_SAVESTATE for convenience.) */
    13571413            rc = SSMR3PutU32(pSSM, u32ClientId);
    13581414            AssertRCReturn(rc, rc);
     
    13711427/** The method loads saved HGCM state.
    13721428 *
    1373  * @param pSSM  The saved state context.
     1429 * @param pSSM      The saved state handle.
     1430 * @param uVersion  The state version being loaded.
    13741431 * @return VBox rc.
    13751432 * @thread main HGCM
    13761433 */
    1377 /* static */ int HGCMService::LoadState(PSSMHANDLE pSSM)
     1434/* static */ int HGCMService::LoadState(PSSMHANDLE pSSM, uint32_t uVersion)
    13781435{
    13791436    /* Restore handle count to avoid client id conflicts. */
     
    14241481        while (cClients--)
    14251482        {
    1426             /* Get the client id. */
     1483            /* Get the client ID and fRequest (convieniently save via SVC_MSG_SAVESTATE
     1484               but restored here in time for calling CreateAndConnectClient). */
    14271485            uint32_t u32ClientId;
    14281486            rc = SSMR3GetU32(pSSM, &u32ClientId);
    1429             uint32_t fRequestor = VMMDEV_REQUESTOR_LEGACY; /** @todo save/restore fRequestor. */
    1430             if (RT_FAILURE(rc))
    1431             {
    1432                 pSvc->ReleaseService();
    1433                 AssertFailed();
    1434                 return rc;
    1435             }
     1487            uint32_t fRequestor = VMMDEV_REQUESTOR_LEGACY;
     1488            if (RT_SUCCESS(rc) && uVersion > HGCM_SAVED_STATE_VERSION_V2)
     1489                rc = SSMR3GetU32(pSSM, &fRequestor);
     1490            AssertLogRelMsgRCReturnStmt(rc, ("rc=%Rrc, %s\n", rc, szServiceName), pSvc->ReleaseService(), rc);
    14361491
    14371492            /* Connect the client. */
    14381493            rc = pSvc->CreateAndConnectClient(NULL, u32ClientId, fRequestor, true /*fRestoring*/);
    1439             if (RT_FAILURE(rc))
    1440             {
    1441                 pSvc->ReleaseService();
    1442                 AssertLogRelMsgFailed(("rc=%Rrc %s\n", rc, szServiceName));
    1443                 return rc;
    1444             }
     1494            AssertLogRelMsgRCReturnStmt(rc, ("rc=%Rrc, %s\n", rc, szServiceName), pSvc->ReleaseService(), rc);
    14451495
    14461496            /* Call the service, so the operation is executed by the service thread. */
    1447             rc = pSvc->loadClientState(u32ClientId, pSSM);
    1448             if (RT_FAILURE(rc))
    1449             {
    1450                 pSvc->ReleaseService();
    1451                 AssertLogRelMsgFailed(("rc=%Rrc %s\n", rc, szServiceName));
    1452                 return rc;
    1453             }
     1497            rc = pSvc->loadClientState(u32ClientId, pSSM, uVersion);
     1498            AssertLogRelMsgRCReturnStmt(rc, ("rc=%Rrc, %s\n", rc, szServiceName), pSvc->ReleaseService(), rc);
    14541499        }
    14551500
     
    14751520
    14761521    /* Allocate a client information structure. */
    1477     HGCMClient *pClient = new HGCMClient();
     1522    HGCMClient *pClient = new (std::nothrow) HGCMClient(fRequestor);
    14781523
    14791524    if (!pClient)
     
    18511896        /** The user mode VM handle (for statistics and such). */
    18521897        PUVM pUVM;
     1898        /** The HGCM port on the VMMDev device (for session ID and such). */
     1899        PPDMIHGCMPORT pHgcmPort;
    18531900};
    18541901
     
    18691916{
    18701917    public:
    1871         /* SSM context. */
     1918        /** Saved state handle. */
    18721919        PSSMHANDLE pSSM;
     1920        /** The HGCM saved state version being loaded (ignore for save). */
     1921        uint32_t uVersion;
    18731922};
    18741923
     
    20312080                             pMsg->pszServiceName, pMsg->pszServiceLibrary, pMsg->pUVM));
    20322081
    2033                 rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName, pMsg->pUVM);
     2082                rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName, pMsg->pUVM, pMsg->pHgcmPort);
    20342083            } break;
    20352084
     
    21062155                LogFlowFunc(("HGCM_MSG_LOADSTATE\n"));
    21072156
    2108                 rc = HGCMService::LoadState(pMsg->pSSM);
     2157                rc = HGCMService::LoadState(pMsg->pSSM, pMsg->uVersion);
    21092158            } break;
    21102159
     
    22232272 * @param pszServiceName     The name to be assigned to the service.
    22242273 * @param pUVM               The user mode VM handle (for statistics and such).
     2274 * @param pHgcmPort          The HGCM port on the VMMDev device (for session ID and such).
    22252275 * @return VBox rc.
    22262276 */
    22272277int HGCMHostLoad(const char *pszServiceLibrary,
    22282278                 const char *pszServiceName,
    2229                  PUVM pUVM)
     2279                 PUVM pUVM,
     2280                 PPDMIHGCMPORT pHgcmPort)
    22302281{
    22312282    LogFlowFunc(("lib = %s, name = %s\n", pszServiceLibrary, pszServiceName));
     
    22482299        pMsg->pszServiceName    = pszServiceName;
    22492300        pMsg->pUVM              = pUVM;
     2301        pMsg->pHgcmPort         = pHgcmPort;
    22502302
    22512303        rc = hgcmMsgSend(pMsg);
     
    24032455}
    24042456
    2405 /* Helper to send either HGCM_MSG_SAVESTATE or HGCM_MSG_LOADSTATE messages to the main HGCM thread.
     2457/** Helper to send either HGCM_MSG_SAVESTATE or HGCM_MSG_LOADSTATE messages to the main HGCM thread.
    24062458 *
    24072459 * @param pSSM     The SSM handle.
    2408  * @param u32MsgId The message to be sent: HGCM_MSG_SAVESTATE or HGCM_MSG_LOADSTATE.
     2460 * @param idMsg    The message to be sent: HGCM_MSG_SAVESTATE or HGCM_MSG_LOADSTATE.
     2461 * @param uVersion The state version being loaded.
    24092462 * @return VBox rc.
    24102463 */
    2411 static int hgcmHostLoadSaveState(PSSMHANDLE pSSM,
    2412                                  uint32_t u32MsgId)
    2413 {
    2414     LogFlowFunc(("pSSM = %p, u32MsgId = %d\n", pSSM, u32MsgId));
     2464static int hgcmHostLoadSaveState(PSSMHANDLE pSSM, uint32_t idMsg, uint32_t uVersion)
     2465{
     2466    LogFlowFunc(("pSSM = %p, idMsg = %d, uVersion = uVersion\n", pSSM, idMsg));
    24152467
    24162468    HGCMMsgCore *pCoreMsg;
    2417     int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, u32MsgId, hgcmMainMessageAlloc);
     2469    int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, idMsg, hgcmMainMessageAlloc);
    24182470
    24192471    if (RT_SUCCESS(rc))
     
    24232475
    24242476        pMsg->pSSM = pSSM;
     2477        pMsg->uVersion = uVersion;
    24252478
    24262479        rc = hgcmMsgSend(pMsg);
     
    24312484}
    24322485
    2433 /* Save the state of services.
     2486/** Save the state of services.
    24342487 *
    24352488 * @param pSSM     The SSM handle.
     
    24382491int HGCMHostSaveState(PSSMHANDLE pSSM)
    24392492{
    2440     return hgcmHostLoadSaveState(pSSM, HGCM_MSG_SAVESTATE);
    2441 }
    2442 
    2443 /* Load the state of services.
     2493    return hgcmHostLoadSaveState(pSSM, HGCM_MSG_SAVESTATE, HGCM_SAVED_STATE_VERSION);
     2494}
     2495
     2496/** Load the state of services.
    24442497 *
    24452498 * @param pSSM     The SSM handle.
     2499 * @param uVersion The state version being loaded.
    24462500 * @return VBox rc.
    24472501 */
    2448 int HGCMHostLoadState(PSSMHANDLE pSSM)
    2449 {
    2450     return hgcmHostLoadSaveState(pSSM, HGCM_MSG_LOADSTATE);
     2502int HGCMHostLoadState(PSSMHANDLE pSSM, uint32_t uVersion)
     2503{
     2504    return hgcmHostLoadSaveState(pSSM, HGCM_MSG_LOADSTATE, uVersion);
    24512505}
    24522506
  • trunk/src/VBox/Main/src-client/VMMDevInterface.cpp

    r75574 r75853  
    680680    LogFlowFunc(("Enter\n"));
    681681
    682     if (uVersion != HGCM_SSM_VERSION)
     682    if (   uVersion != HGCM_SAVED_STATE_VERSION
     683        && uVersion != HGCM_SAVED_STATE_VERSION_V2)
    683684        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    684685    Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
    685686
    686     return HGCMHostLoadState(pSSM);
     687    return HGCMHostLoadState(pSSM, uVersion);
    687688}
    688689
     
    692693        return VERR_INVALID_STATE;
    693694
     695    /** @todo Construct all the services in the VMMDev::drvConstruct()!! */
     696    Assert(   (mpDrv && mpDrv->pHGCMPort)
     697           || !strcmp(pszServiceLibrary, "VBoxHostChannel")
     698           || !strcmp(pszServiceLibrary, "VBoxSharedClipboard")
     699           || !strcmp(pszServiceLibrary, "VBoxDragAndDropSvc")
     700           || !strcmp(pszServiceLibrary, "VBoxGuestPropSvc")
     701           || !strcmp(pszServiceLibrary, "VBoxSharedCrOpenGL")
     702           );
    694703    Console::SafeVMPtrQuiet ptrVM(mParent);
    695     return HGCMHostLoad(pszServiceLibrary, pszServiceName, ptrVM.rawUVM());
     704    return HGCMHostLoad(pszServiceLibrary, pszServiceName, ptrVM.rawUVM(), mpDrv ? mpDrv->pHGCMPort : NULL);
    696705}
    697706
     
    864873
    865874#ifdef VBOX_WITH_HGCM
    866     rc = pThis->pVMMDev->hgcmLoadService(VBOXSHAREDFOLDERS_DLL,
    867                                          "VBoxSharedFolders");
     875    /*
     876     * Load & configure the shared folders service.
     877     */
     878    rc = pThis->pVMMDev->hgcmLoadService(VBOXSHAREDFOLDERS_DLL, "VBoxSharedFolders");
    868879    pThis->pVMMDev->fSharedFolderActive = RT_SUCCESS(rc);
    869880    if (RT_SUCCESS(rc))
     
    892903        LogRel(("Failed to load Shared Folders service %Rrc\n", rc));
    893904
    894     rc = PDMDrvHlpSSMRegisterEx(pDrvIns, HGCM_SSM_VERSION, 4096 /* bad guess */,
     905
     906    /*
     907     * Load and configure guest control service.
     908     */
     909# ifdef VBOX_WITH_GUEST_CONTROL
     910    rc = pThis->pVMMDev->hgcmLoadService("VBoxGuestControlSvc", "VBoxGuestControlSvc");
     911    if (RT_SUCCESS(rc))
     912    {
     913        HGCMSVCEXTHANDLE hDummy;
     914        rc = HGCMHostRegisterServiceExtension(&hDummy, "VBoxGuestControlSvc",
     915                                              &Guest::i_notifyCtrlDispatcher,
     916                                              pThis->pVMMDev->mParent->i_getGuest());
     917        if (RT_SUCCESS(rc))
     918            LogRel(("Guest Control service loaded\n"));
     919        else
     920            LogRel(("Warning: Cannot register VBoxGuestControlSvc extension! rc=%Rrc\n", rc));
     921    }
     922    else
     923        LogRel(("Warning!: Failed to load the Guest Control Service! %Rrc\n", rc));
     924# endif /* VBOX_WITH_GUEST_CONTROL */
     925
     926
     927    /*
     928     * The HGCM saved state.
     929     */
     930    rc = PDMDrvHlpSSMRegisterEx(pDrvIns, HGCM_SAVED_STATE_VERSION, 4096 /* bad guess */,
    895931                                NULL, NULL, NULL,
    896932                                NULL, iface_hgcmSave, NULL,
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