VirtualBox

Changeset 81820 in vbox


Ignore:
Timestamp:
Nov 13, 2019 11:19:52 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134611
Message:

Shared Clipboard/Transfers: Update.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/SharedClipboard.h

    r81768 r81820  
    278278extern int ClipStopX11(CLIPBACKEND *pBackend);
    279279extern int ClipAnnounceFormatToX11(CLIPBACKEND *pBackend, SHCLFORMATS vboxFormats);
    280 extern int ClipRequestDataFromX11(CLIPBACKEND *pBackend, SHCLFORMATS vboxFormat, CLIPREADCBREQ *pReq);
     280extern int ClipReadDataFromX11(CLIPBACKEND *pBackend, SHCLFORMATS vboxFormat, CLIPREADCBREQ *pReq);
    281281/** @} */
    282282
  • trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp

    r81369 r81820  
    263263                    {
    264264                        pReq->u32Format = fFormats;
    265                         ClipRequestDataFromX11(g_ctx.pBackend, fFormats,
     265                        ClipReadDataFromX11(g_ctx.pBackend, fFormats,
    266266                                               pReq);
    267267                    }
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r81750 r81820  
    428428#endif
    429429
     430    LogRel2(("Shared Clipboard: Reported formats = 0x%x\n", fFormats));
     431
    430432    ClipReportX11FormatsCallback(pCtx->pFrontend, fFormats);
    431433}
     
    711713    }
    712714
    713 #if defined(DEBUG) && !defined(TESTCASE)
     715#if !defined(TESTCASE)
    714716    if (pValue)
    715717    {
    716718        for (i = 0; i < *pcLen; ++i)
     719        {
    717720            if (pAtoms[i])
    718721            {
    719722                char *pszName = XGetAtomName(XtDisplay(widget), pAtoms[i]);
    720                 LogFunc(("Found target '%s'\n", pszName));
     723                LogRel2(("Shared Clipboard: Found target '%s'\n", pszName));
    721724                XFree(pszName);
    722725            }
    723726            else
    724727                LogFunc(("Found empty target\n"));
     728        }
    725729    }
    726730#endif
     
    16521656 *                              clipboard context data.  Must be freed by the worker.
    16531657 */
    1654 static void clipNewVBoxFormatsWorker(void *pUserData,
    1655                                      void * /* interval */)
     1658static void clipAnnounceFormatToX11Worker(void *pUserData,
     1659                                          void * /* interval */)
    16561660{
    16571661    CLIPNEWVBOXFORMATS *pFormats = (CLIPNEWVBOXFORMATS *)pUserData;
     
    16721676
    16731677/**
    1674  * VBox is taking possession of the Shared Clipboard.
    1675  *
    1676  * @param                       u32Formats clipboard formats that VBox is offering.
    1677  * @note  X11 backend code
     1678 * Announces new clipboard formats to the host.
     1679 *
     1680 * @returns VBox status code.
     1681 * @param   u32Formats          Clipboard formats offered.
    16781682 */
    16791683int ClipAnnounceFormatToX11(CLIPBACKEND *pCtx, uint32_t u32Formats)
     
    16941698        pFormats->formats = u32Formats;
    16951699
    1696         rc = clipQueueToEventThread(pCtx, clipNewVBoxFormatsWorker,
     1700        rc = clipQueueToEventThread(pCtx, clipAnnounceFormatToX11Worker,
    16971701                                    (XtPointer) pFormats);
    16981702    }
     
    19391943}
    19401944
    1941 
    1942 
    1943 /** A structure containing information about where to store a request
    1944  * for the X11 clipboard contents. */
    1945 struct _CLIPREADX11CBREQ
    1946 {
    1947     /** The format VBox would like the data in */
     1945/**
     1946 * A structure containing information about where to store a request
     1947 * for the X11 clipboard contents.
     1948 */
     1949typedef struct _CLIPREADX11CBREQ
     1950{
     1951    /** The format VBox would like the data in. */
    19481952    SHCLFORMAT       mFormat;
    1949     /** @todo Put the following variables in an union or just use one for all formats? */
    1950     /** The text format we requested from X11 if we requested text */
    1951     CLIPX11FORMAT    mTextFormat;
    1952     /** The bitmap format we requested from X11 if we requested bitmap */
    1953     CLIPX11FORMAT    mBitmapFormat;
    1954     /** The HTML format we requested from X11 if we requested HTML */
    1955     CLIPX11FORMAT    mHtmlFormat;
    1956 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1957     /** The URI list format we requested from X11 if we requested URI lists. */
    1958     CLIPX11FORMAT    mURIListFormat;
    1959 #endif
    1960     /** The clipboard context this request is associated with */
     1953    /** The format we requested from X11. */
     1954    CLIPX11FORMAT    mX11Format;
     1955    /** The clipboard context this request is associated with. */
    19611956    CLIPBACKEND     *mpCtx;
    19621957    /** The request structure passed in from the backend. */
    19631958    CLIPREADCBREQ   *mpReq;
    1964 };
    1965 
    1966 typedef struct _CLIPREADX11CBREQ CLIPREADX11CBREQ;
     1959} CLIPREADX11CBREQ;
    19671960
    19681961/**
     
    19801973    CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pClient;
    19811974
    1982     LogFlowFunc(("pReq->mFormat=%02X, pReq->mTextFormat=%u, pReq->mBitmapFormat=%u, pReq->mHtmlFormat=%u, pReq->mCtx=%p\n",
    1983                  pReq->mFormat, pReq->mTextFormat, pReq->mBitmapFormat, pReq->mHtmlFormat, pReq->mpCtx));
    1984 
    1985 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1986     LogFlowFunc(("pReq->mURIListFormat=%u\n", pReq->mURIListFormat));
    1987 #endif
     1975    LogFlowFunc(("pReq->mFormat=%02X, pReq->mX11Format=%u, pReq->mCtx=%p\n", pReq->mFormat, pReq->mX11Format, pReq->mpCtx));
    19881976
    19891977    AssertPtr(pReq->mpCtx);
     
    20031991    {
    20041992        /* In which format is the clipboard data? */
    2005         switch (clipRealFormatForX11Format(pReq->mTextFormat))
     1993        switch (clipRealFormatForX11Format(pReq->mX11Format))
    20061994        {
    20071995            case UTF8:
     
    20332021    {
    20342022        /* In which format is the clipboard data? */
    2035         switch (clipRealFormatForX11Format(pReq->mBitmapFormat))
     2023        switch (clipRealFormatForX11Format(pReq->mX11Format))
    20362024        {
    20372025            case BMP:
     
    20652053    {
    20662054        /* In which format is the clipboard data? */
    2067         switch (clipRealFormatForX11Format(pReq->mHtmlFormat))
     2055        switch (clipRealFormatForX11Format(pReq->mX11Format))
    20682056        {
    20692057            case HTML:
     
    21232111    {
    21242112        /* In which format is the clipboard data? */
    2125         switch (clipRealFormatForX11Format(pReq->mURIListFormat))
     2113        switch (clipRealFormatForX11Format(pReq->mX11Format))
    21262114        {
    21272115            case URI_LIST:
     
    22232211
    22242212/**
    2225  * Worker function for ClipRequestDataFromX11 which runs on the event thread.
    2226  */
    2227 static void clipReadX11Worker(void *pvUserData, void * /* interval */)
     2213 * Worker function for ClipReadDataFromX11 which runs on the event thread.
     2214 */
     2215static void clipReadDataFromX11Worker(void *pvUserData, void * /* interval */)
    22282216{
    22292217    AssertPtrReturnVoid(pvUserData);
     
    22382226    if (pReq->mFormat == VBOX_SHCL_FMT_UNICODETEXT)
    22392227    {
    2240         pReq->mTextFormat = pCtx->X11TextFormat;
    2241         if (pReq->mTextFormat != INVALID)
     2228        pReq->mX11Format = pCtx->X11TextFormat;
     2229        if (pReq->mX11Format != INVALID)
    22422230        {
    22432231            /* Send out a request for the data to the current clipboard owner. */
     
    22472235    else if (pReq->mFormat == VBOX_SHCL_FMT_BITMAP)
    22482236    {
    2249         pReq->mBitmapFormat = pCtx->X11BitmapFormat;
    2250         if (pReq->mBitmapFormat != INVALID)
     2237        pReq->mX11Format = pCtx->X11BitmapFormat;
     2238        if (pReq->mX11Format != INVALID)
    22512239        {
    22522240            /* Send out a request for the data to the current clipboard owner. */
     
    22562244    else if (pReq->mFormat == VBOX_SHCL_FMT_HTML)
    22572245    {
    2258         pReq->mHtmlFormat = pCtx->X11HTMLFormat;
    2259         if (pReq->mHtmlFormat != INVALID)
     2246        pReq->mX11Format = pCtx->X11HTMLFormat;
     2247        if (pReq->mX11Format != INVALID)
    22602248        {
    22612249            /* Send out a request for the data to the current clipboard owner. */
     
    22662254    else if (pReq->mFormat == VBOX_SHCL_FMT_URI_LIST)
    22672255    {
    2268         pReq->mURIListFormat = pCtx->X11URIListFormat;
    2269         if (pReq->mURIListFormat != INVALID)
     2256        pReq->mX11Format = pCtx->X11URIListFormat;
     2257        if (pReq->mX11Format != INVALID)
    22702258        {
    22712259            /* Send out a request for the data to the current clipboard owner. */
     
    22972285 * @param  pCtx                 Context data for the clipboard backend.
    22982286 * @param  u32Format            The format that the VBox would like to receive the data in.
    2299  * @param  pv                   Where to write the data to.
    2300  * @param  cb                   The size of the buffer to write the data to.
    2301  * @param  pcbActual            Where to write the actual size of the written data.
     2287 * @param  pReq                 Read callback request to use. Must be free'd in the callback.
    23022288 *
    23032289 * @note   We allocate a request structure which must be freed by the worker.
    23042290 */
    2305 int ClipRequestDataFromX11(CLIPBACKEND *pCtx, uint32_t u32Format, CLIPREADCBREQ *pReq)
     2291int ClipReadDataFromX11(CLIPBACKEND *pCtx, uint32_t u32Format, CLIPREADCBREQ *pReq)
    23062292{
    23072293    /*
     
    23162302    if (pX11Req)
    23172303    {
     2304        pX11Req->mpCtx   = pCtx;
    23182305        pX11Req->mFormat = u32Format;
    2319         pX11Req->mpCtx   = pCtx;
    23202306        pX11Req->mpReq   = pReq;
    23212307
    23222308        /* We use this to schedule a worker function on the event thread. */
    2323         rc = clipQueueToEventThread(pCtx, clipReadX11Worker, (XtPointer)pX11Req);
     2309        rc = clipQueueToEventThread(pCtx, clipReadDataFromX11Worker, (XtPointer)pX11Req);
    23242310    }
    23252311    else
     
    27162702        char *pc;
    27172703        CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq, *pReqRet = NULL;
    2718         ClipRequestDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
     2704        ClipReadDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
    27192705        int rc = VINF_SUCCESS;
    27202706        uint32_t cbActual = 0;
     
    27732759        char *pc;
    27742760        CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq, *pReqRet = NULL;
    2775         ClipRequestDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
     2761        ClipReadDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
    27762762        int rc = VINF_SUCCESS;
    27772763        uint32_t cbActual = 0;
     
    28492835{
    28502836    CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq;
    2851     int rc = ClipRequestDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
     2837    int rc = ClipReadDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
    28522838    RTTESTI_CHECK_MSG(rc == VERR_NO_DATA, ("context: %s\n", pcszTestCtx));
    28532839}
     
    28862872        char *pc;
    28872873        CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq, *pReqRet = NULL;
    2888         ClipRequestDataFromX11(pCtx, 100, pReq);  /* Bad format. */
     2874        ClipReadDataFromX11(pCtx, 100, pReq);  /* Bad format. */
    28892875        int rc = VINF_SUCCESS;
    28902876        uint32_t cbActual = 0;
     
    29952981    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, NULL,
    29962982                              0, 8);
    2997     ClipRequestDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
     2983    ClipReadDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
    29982984    tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    29992985    RTTEST_CHECK_MSG(hTest, rc == VERR_NO_DATA,
     
    30132999    /*** request for an invalid VBox format from X11 ***/
    30143000    RTTestSub(hTest, "a request for an invalid VBox format from X11");
    3015     ClipRequestDataFromX11(pCtx, 0xffff, pReq);
     3001    ClipReadDataFromX11(pCtx, 0xffff, pReq);
    30163002    tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    30173003    RTTEST_CHECK_MSG(hTest, rc == VERR_NOT_IMPLEMENTED,
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h

    r81768 r81820  
    138138    /** General client state data. */
    139139    SHCLCLIENTSTATE          State;
     140    RTCRITSECT               CritSect;
    140141    /** The client's message queue (FIFO). */
    141142    RTCList<SHCLCLIENTMSG *> queueMsg;
     
    210211int shClSvcSetSource(PSHCLCLIENT pClient, SHCLSOURCE enmSource);
    211212
    212 void shclSvcMsgQueueReset(PSHCLCLIENT pClient);
    213 PSHCLCLIENTMSG shclSvcMsgAlloc(uint32_t uMsg, uint32_t cParms);
    214 void shclSvcMsgFree(PSHCLCLIENTMSG pMsg);
    215 void shclSvcMsgSetPeekReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms);
    216 int shclSvcMsgAdd(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg, bool fAppend);
    217 int shclSvcMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fWait);
    218 int shclSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    219 
    220 int shclSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID);
    221 void shclSvcClientReset(PSHCLCLIENT pClient);
    222 
    223 int shclSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID);
    224 int shclSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState);
     213void shClSvcMsgQueueReset(PSHCLCLIENT pClient);
     214PSHCLCLIENTMSG shClSvcMsgAlloc(uint32_t uMsg, uint32_t cParms);
     215void shClSvcMsgFree(PSHCLCLIENTMSG pMsg);
     216void shClSvcMsgSetPeekReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms);
     217int shClSvcMsgAdd(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg, bool fAppend);
     218int shClSvcMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fWait);
     219int shClSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     220
     221int shClSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID);
     222void shClSvcClientDestroy(PSHCLCLIENT pClient);
     223void shClSvcClientReset(PSHCLCLIENT pClient);
     224
     225int shClSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID);
     226int shClSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState);
    225227void shclSvcClientStateReset(PSHCLCLIENTSTATE pClientState);
    226228
    227 int shclSvcClientWakeup(PSHCLCLIENT pClient);
     229int shClSvcClientWakeup(PSHCLCLIENT pClient);
    228230
    229231# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     
    232234int shClSvcTransferStop(PSHCLCLIENT pClient, PSHCLTRANSFER pTransfer);
    233235bool shClSvcTransferMsgIsAllowed(uint32_t uMode, uint32_t uMsg);
    234 void shclSvcClientTransfersReset(PSHCLCLIENT pClient);
     236void shClSvcClientTransfersReset(PSHCLCLIENT pClient);
    235237#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    236238
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp

    r81698 r81820  
    6565 * @param   pClient             Client to reset transfers for.
    6666 */
    67 void shclSvcClientTransfersReset(PSHCLCLIENT pClient)
     67void shClSvcClientTransfersReset(PSHCLCLIENT pClient)
    6868{
    6969    if (!pClient)
     
    120120    int rc;
    121121
    122     PSHCLCLIENTMSG pMsgHdr = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_HDR_READ,
     122    PSHCLCLIENTMSG pMsgHdr = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_HDR_READ,
    123123                                             VBOX_SHCL_CPARMS_ROOT_LIST_HDR_READ_REQ);
    124124    if (pMsgHdr)
     
    130130        HGCMSvcSetU32(&pMsgHdr->paParms[1], 0 /* fRoots */);
    131131
    132         rc = shclSvcMsgAdd(pClient, pMsgHdr, true /* fAppend */);
     132        rc = shClSvcMsgAdd(pClient, pMsgHdr, true /* fAppend */);
    133133        if (RT_SUCCESS(rc))
    134134        {
     
    136136            AssertRC(rc2);
    137137
    138             rc = shclSvcClientWakeup(pClient);
     138            rc = shClSvcClientWakeup(pClient);
    139139            if (RT_SUCCESS(rc))
    140140            {
     
    161161                                for (uint32_t i = 0; i < pSrcRootListHdr->cRoots; i++)
    162162                                {
    163                                     PSHCLCLIENTMSG pMsgEntry = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_ENTRY_READ,
     163                                    PSHCLCLIENTMSG pMsgEntry = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_ENTRY_READ,
    164164                                                                               VBOX_SHCL_CPARMS_ROOT_LIST_ENTRY_READ_REQ);
    165165
     
    175175                                    AssertRC(rc2);
    176176
    177                                     rc = shclSvcMsgAdd(pClient, pMsgEntry, true /* fAppend */);
     177                                    rc = shClSvcMsgAdd(pClient, pMsgEntry, true /* fAppend */);
    178178                                    if (RT_FAILURE(rc))
    179179                                        break;
     
    239239    int rc;
    240240
    241     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_OPEN,
     241    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_OPEN,
    242242                                          VBOX_SHCL_CPARMS_LIST_OPEN);
    243243    if (pMsg)
     
    251251        if (RT_SUCCESS(rc))
    252252        {
    253             rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     253            rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    254254            if (RT_SUCCESS(rc))
    255255            {
     
    257257                AssertRC(rc2);
    258258
    259                 rc = shclSvcClientWakeup(pClient);
     259                rc = shClSvcClientWakeup(pClient);
    260260                if (RT_SUCCESS(rc))
    261261                {
     
    299299    int rc;
    300300
    301     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_CLOSE,
     301    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_CLOSE,
    302302                                          VBOX_SHCL_CPARMS_LIST_CLOSE);
    303303    if (pMsg)
     
    311311        if (RT_SUCCESS(rc))
    312312        {
    313             rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     313            rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    314314            if (RT_SUCCESS(rc))
    315315            {
     
    317317                AssertRC(rc2);
    318318
    319                 rc = shclSvcClientWakeup(pClient);
     319                rc = shClSvcClientWakeup(pClient);
    320320                if (RT_SUCCESS(rc))
    321321                {
     
    347347    int rc;
    348348
    349     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_HDR_READ,
     349    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_HDR_READ,
    350350                                          VBOX_SHCL_CPARMS_LIST_HDR_READ_REQ);
    351351    if (pMsg)
     
    358358        HGCMSvcSetU32(&pMsg->paParms[2], 0 /* fFlags */);
    359359
    360         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     360        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    361361        if (RT_SUCCESS(rc))
    362362        {
     
    364364            AssertRC(rc2);
    365365
    366             rc = shclSvcClientWakeup(pClient);
     366            rc = shClSvcClientWakeup(pClient);
    367367            if (RT_SUCCESS(rc))
    368368            {
     
    408408    int rc;
    409409
    410     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_ENTRY_READ,
     410    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_ENTRY_READ,
    411411                                          VBOX_SHCL_CPARMS_LIST_ENTRY_READ);
    412412    if (pMsg)
     
    419419        HGCMSvcSetU32(&pMsg->paParms[2], 0 /* fInfo */);
    420420
    421         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     421        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    422422        if (RT_SUCCESS(rc))
    423423        {
     
    425425            AssertRC(rc2);
    426426
    427             rc = shclSvcClientWakeup(pClient);
     427            rc = shClSvcClientWakeup(pClient);
    428428            if (RT_SUCCESS(rc))
    429429            {
     
    468468    int rc;
    469469
    470     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_OPEN,
     470    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_OPEN,
    471471                                          VBOX_SHCL_CPARMS_OBJ_OPEN);
    472472    if (pMsg)
     
    485485        HGCMSvcSetU32(&pMsg->paParms[4], pCreateParms->fCreate);
    486486
    487         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     487        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    488488        if (RT_SUCCESS(rc))
    489489        {
     
    491491            AssertRC(rc2);
    492492
    493             rc = shclSvcClientWakeup(pClient);
     493            rc = shClSvcClientWakeup(pClient);
    494494            if (RT_SUCCESS(rc))
    495495            {
     
    530530    int rc;
    531531
    532     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_CLOSE,
     532    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_CLOSE,
    533533                                          VBOX_SHCL_CPARMS_OBJ_CLOSE);
    534534    if (pMsg)
     
    540540        HGCMSvcSetU64(&pMsg->paParms[1], hObj);
    541541
    542         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     542        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    543543        if (RT_SUCCESS(rc))
    544544        {
     
    546546            AssertRC(rc2);
    547547
    548             rc = shclSvcClientWakeup(pClient);
     548            rc = shClSvcClientWakeup(pClient);
    549549            if (RT_SUCCESS(rc))
    550550            {
     
    586586    int rc;
    587587
    588     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_READ,
     588    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_READ,
    589589                                          VBOX_SHCL_CPARMS_OBJ_READ_REQ);
    590590    if (pMsg)
     
    598598        HGCMSvcSetU32(&pMsg->paParms[3], fFlags);
    599599
    600         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     600        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    601601        if (RT_SUCCESS(rc))
    602602        {
     
    604604            AssertRC(rc2);
    605605
    606             rc = shclSvcClientWakeup(pClient);
     606            rc = shClSvcClientWakeup(pClient);
    607607            if (RT_SUCCESS(rc))
    608608            {
     
    645645    int rc;
    646646
    647     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_WRITE,
     647    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_WRITE,
    648648                                          VBOX_SHCL_CPARMS_OBJ_WRITE);
    649649    if (pMsg)
     
    657657        HGCMSvcSetU64(&pMsg->paParms[3], fFlags);
    658658
    659         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     659        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    660660        if (RT_SUCCESS(rc))
    661661        {
     
    663663            AssertRC(rc2);
    664664
    665             rc = shclSvcClientWakeup(pClient);
     665            rc = shClSvcClientWakeup(pClient);
    666666            if (RT_SUCCESS(rc))
    667667            {
     
    19561956    /* puEvent is optional. */
    19571957
    1958     PSHCLCLIENTMSG pMsgReadData = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_STATUS,
     1958    PSHCLCLIENTMSG pMsgReadData = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_TRANSFER_STATUS,
    19591959                                                  VBOX_SHCL_CPARMS_TRANSFER_STATUS);
    19601960    if (!pMsgReadData)
     
    19701970    HGCMSvcSetU32(&pMsgReadData->paParms[4], 0 /* fFlags, unused */);
    19711971
    1972     int rc = shclSvcMsgAdd(pClient, pMsgReadData, true /* fAppend */);
     1972    int rc = shClSvcMsgAdd(pClient, pMsgReadData, true /* fAppend */);
    19731973    if (RT_SUCCESS(rc))
    19741974    {
     
    19761976        if (RT_SUCCESS(rc))
    19771977        {
    1978             rc = shclSvcClientWakeup(pClient);
     1978            rc = shClSvcClientWakeup(pClient);
    19791979            if (RT_SUCCESS(rc))
    19801980            {
     
    22142214            AssertPtr(pClient);
    22152215
    2216             shclSvcClientTransfersReset(pClient);
     2216            shClSvcClientTransfersReset(pClient);
    22172217
    22182218            ++itClient;
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.h

    r80863 r81820  
    2222#endif
    2323
    24 int sharedClipboardSvcTransferHandler(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE callHandle, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival);
    25 int sharedClipboardSvcTransferHostHandler(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    26 
    27 int sharedClipboardSvcTransferAreaRegister(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer);
    28 int sharedClipboardSvcTransferAreaUnregister(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer);
    29 int sharedClipboardSvcTransferAreaAttach(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer, SHCLAREAID uID);
    30 int sharedClipboardSvcTransferAreaDetach(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer);
    31 
    3224#endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_transfers_h */
    3325
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11-stubs.cpp

    r80847 r81820  
    9696 */
    9797int SharedClipboardSvcImplFormatAnnounce(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx,
    98                                        PSHCLFORMATDATA pFormats)
     98                                         PSHCLFORMATDATA pFormats)
    9999{
    100100    RT_NOREF(pClient, pCmdCtx, pFormats);
     
    111111 */
    112112int SharedClipboardSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx,
    113                                  PSHCLDATABLOCK pData, uint32_t *pcbActual)
     113                                   PSHCLDATABLOCK pData, uint32_t *pcbActual)
    114114{
    115115    RT_NOREF(pClient, pCmdCtx, pData);
     
    122122
    123123int SharedClipboardSvcImplWriteData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx,
    124                                   PSHCLDATABLOCK pData)
     124                                    PSHCLDATABLOCK pData)
    125125{
    126126    RT_NOREF(pClient, pCmdCtx, pData);
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r81746 r81820  
    209209        if (RT_SUCCESS(rc))
    210210        {
    211             rc = ClipRequestDataFromX11(pClient->State.pCtx->pBackend, pData->uFormat, pReq);
     211            rc = ClipReadDataFromX11(pClient->State.pCtx->pBackend, pData->uFormat, pReq);
    212212            if (RT_SUCCESS(rc))
    213213            {
     
    409409        {
    410410    #endif
    411             rc = ClipRequestDataFromX11(pClient->State.pCtx->pBackend, VBOX_SHCL_FMT_URI_LIST, pReq);
     411            rc = ClipReadDataFromX11(pClient->State.pCtx->pBackend, VBOX_SHCL_FMT_URI_LIST, pReq);
    412412    #if 0
    413413            if (RT_SUCCESS(rc))
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r81769 r81820  
    336336 * @param   pClient             Pointer to the client data structure to reset message queue for.
    337337 */
    338 void shclSvcMsgQueueReset(PSHCLCLIENT pClient)
     338void shClSvcMsgQueueReset(PSHCLCLIENT pClient)
    339339{
    340340    LogFlowFuncEnter();
     
    354354 * @param   cParms              Number of HGCM parameters to allocate.
    355355 */
    356 PSHCLCLIENTMSG shclSvcMsgAlloc(uint32_t uMsg, uint32_t cParms)
     356PSHCLCLIENTMSG shClSvcMsgAlloc(uint32_t uMsg, uint32_t cParms)
    357357{
    358358    PSHCLCLIENTMSG pMsg = (PSHCLCLIENTMSG)RTMemAlloc(sizeof(SHCLCLIENTMSG));
     
    379379 *                              The pointer will be invalid after calling this function.
    380380 */
    381 void shclSvcMsgFree(PSHCLCLIENTMSG pMsg)
     381void shClSvcMsgFree(PSHCLCLIENTMSG pMsg)
    382382{
    383383    if (!pMsg)
     
    400400 * @remarks ASSUMES the parameters has been cleared by clientMsgPeek.
    401401 */
    402 void shclSvcMsgSetPeekReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms)
     402void shClSvcMsgSetPeekReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms)
    403403{
    404404    Assert(cDstParms >= 2);
     
    432432 *                      This is needed for certain messages which need to stay around for more than one (guest) call.
    433433 */
    434 int shclSvcMsgSetGetHostMsgOldReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms,
     434int shClSvcMsgSetGetHostMsgOldReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms,
    435435                                     bool *pfRemove)
    436436{
     
    522522 * @param   fAppend             Whether to append or prepend the message to the queue.
    523523 */
    524 int shclSvcMsgAdd(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg, bool fAppend)
     524int shClSvcMsgAdd(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg, bool fAppend)
    525525{
    526526    AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
     
    545545 * @param   uClientID           HGCM client ID to assign client to.
    546546 */
    547 int shclSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID)
     547int shClSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID)
    548548{
    549549    AssertPtrReturn(pClient, VERR_INVALID_POINTER);
     
    554554    LogFlowFunc(("[Client %RU32]\n", pClient->State.uClientID));
    555555
    556     /* Create the client's own event source. */
    557     int rc = ShClEventSourceCreate(&pClient->Events, 0 /* ID, ignored */);
     556    int rc = RTCritSectInit(&pClient->CritSect);
    558557    if (RT_SUCCESS(rc))
    559558    {
    560         LogFlowFunc(("[Client %RU32] Using event source %RU32\n", uClientID, pClient->Events.uID));
    561 
    562         /* Reset the client state. */
    563         shclSvcClientStateReset(&pClient->State);
    564 
    565         /* (Re-)initialize the client state. */
    566         rc = shclSvcClientStateInit(&pClient->State, uClientID);
     559        /* Create the client's own event source. */
     560        rc = ShClEventSourceCreate(&pClient->Events, 0 /* ID, ignored */);
     561        if (RT_SUCCESS(rc))
     562        {
     563            LogFlowFunc(("[Client %RU32] Using event source %RU32\n", uClientID, pClient->Events.uID));
     564
     565            /* Reset the client state. */
     566            shclSvcClientStateReset(&pClient->State);
     567
     568            /* (Re-)initialize the client state. */
     569            rc = shClSvcClientStateInit(&pClient->State, uClientID);
    567570
    568571#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    569         if (RT_SUCCESS(rc))
    570             rc = ShClTransferCtxInit(&pClient->TransferCtx);
     572            if (RT_SUCCESS(rc))
     573                rc = ShClTransferCtxInit(&pClient->TransferCtx);
    571574#endif
     575        }
    572576    }
    573577
     
    577581
    578582/**
     583 * Destroys a Shared Clipboard client.
     584 *
     585 * @param   pClient             Client to destroy.
     586 */
     587void shClSvcClientDestroy(PSHCLCLIENT pClient)
     588{
     589    AssertPtrReturnVoid(pClient);
     590
     591    LogFlowFunc(("[Client %RU32]\n", pClient->State.uClientID));
     592
     593    /* Make sure to send a quit message to the guest so that it can terminate gracefully. */
     594    if (pClient->Pending.uType)
     595    {
     596        if (pClient->Pending.cParms >= 2)
     597        {
     598            HGCMSvcSetU32(&pClient->Pending.paParms[0], VBOX_SHCL_HOST_MSG_QUIT);
     599            HGCMSvcSetU32(&pClient->Pending.paParms[1], 0);
     600        }
     601        g_pHelpers->pfnCallComplete(pClient->Pending.hHandle, VINF_SUCCESS);
     602        pClient->Pending.uType = 0;
     603    }
     604
     605    ShClEventSourceDestroy(&pClient->Events);
     606
     607    shClSvcClientStateDestroy(&pClient->State);
     608
     609    int rc2 = RTCritSectDelete(&pClient->CritSect);
     610    AssertRC(rc2);
     611
     612    ClipboardClientMap::iterator itClient = g_mapClients.find(pClient->State.uClientID);
     613    if (itClient != g_mapClients.end())
     614    {
     615        g_mapClients.erase(itClient);
     616    }
     617    else
     618        AssertFailed();
     619
     620    LogFlowFuncLeave();
     621}
     622
     623/**
    579624 * Resets a Shared Clipboard client.
    580625 *
    581626 * @param   pClient             Client to reset.
    582627 */
    583 void shclSvcClientReset(PSHCLCLIENT pClient)
     628void shClSvcClientReset(PSHCLCLIENT pClient)
    584629{
    585630    if (!pClient)
     
    589634
    590635    /* Reset message queue. */
    591     shclSvcMsgQueueReset(pClient);
     636    shClSvcMsgQueueReset(pClient);
    592637
    593638    /* Reset event source. */
     
    598643
    599644#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    600     shclSvcClientTransfersReset(pClient);
     645    shClSvcClientTransfersReset(pClient);
    601646#endif
    602647
     
    618663 * @param   paParms     Array of parameters.
    619664 */
    620 int shclSvcClientReportFeatures(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall,
     665int shClSvcClientReportFeatures(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall,
    621666                                uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    622667{
     
    666711 * @param   paParms     Array of parameters.
    667712 */
    668 int shclSvcClientQueryFeatures(VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     713int shClSvcClientQueryFeatures(VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    669714{
    670715    /*
     
    704749 *                      immediately.
    705750 */
    706 int shclSvcMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[],
     751int shClSvcMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[],
    707752                   bool fWait)
    708753{
     
    751796        if (pFirstMsg)
    752797        {
    753             shclSvcMsgSetPeekReturn(pFirstMsg, paParms, cParms);
     798            shClSvcMsgSetPeekReturn(pFirstMsg, paParms, cParms);
    754799            LogFlowFunc(("[Client %RU32] VBOX_SHCL_GUEST_FN_MSG_PEEK_XXX -> VINF_SUCCESS (idMsg=%u (%s), cParms=%u)\n",
    755800                         pClient->State.uClientID, pFirstMsg->uMsg, ShClHostMsgToStr(pFirstMsg->uMsg),
     
    793838 * @param   paParms     Array of parameters.
    794839 */
    795 int shclSvcMsgGetOld(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     840int shClSvcMsgGetOld(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    796841{
    797842    int rc;
     
    818863
    819864            bool fRemove;
    820             rc = shclSvcMsgSetGetHostMsgOldReturn(pFirstMsg, paParms, cParms, &fRemove);
     865            rc = shClSvcMsgSetGetHostMsgOldReturn(pFirstMsg, paParms, cParms, &fRemove);
    821866            if (RT_SUCCESS(rc))
    822867            {
     
    827872                {
    828873                    pClient->queueMsg.removeFirst();
    829                     shclSvcMsgFree(pFirstMsg);
     874                    shClSvcMsgFree(pFirstMsg);
    830875
    831876                    rc = VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */
     
    871916 * @param   paParms      Array of parameters.
    872917 */
    873 int shclSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     918int shClSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    874919{
    875920    /*
     
    9611006                {
    9621007                    pClient->queueMsg.removeFirst();
    963                     shclSvcMsgFree(pFirstMsg);
     1008                    shClSvcMsgFree(pFirstMsg);
    9641009                }
    9651010
     
    9861031 * @param   pClient             Client to wake up.
    9871032 */
    988 int shclSvcClientWakeup(PSHCLCLIENT pClient)
     1033int shClSvcClientWakeup(PSHCLCLIENT pClient)
    9891034{
    9901035    int rc = VINF_NO_CHANGE;
     
    10091054                if (pClient->Pending.uType == VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT)
    10101055                {
    1011                     shclSvcMsgSetPeekReturn(pFirstMsg, pClient->Pending.paParms, pClient->Pending.cParms);
     1056                    shClSvcMsgSetPeekReturn(pFirstMsg, pClient->Pending.paParms, pClient->Pending.cParms);
    10121057                    fDonePending = true;
    10131058                }
     
    10151060                {
    10161061                    bool fRemove;
    1017                     rc = shclSvcMsgSetGetHostMsgOldReturn(pFirstMsg, pClient->Pending.paParms, pClient->Pending.cParms,
     1062                    rc = shClSvcMsgSetGetHostMsgOldReturn(pFirstMsg, pClient->Pending.paParms, pClient->Pending.cParms,
    10181063                                                          &fRemove);
    10191064                    if (RT_SUCCESS(rc))
     
    10241069                             * remove the actual message from our queue right now. */
    10251070                            pClient->queueMsg.removeFirst();
    1026                             shclSvcMsgFree(pFirstMsg);
     1071                            shClSvcMsgFree(pFirstMsg);
    10271072                        }
    10281073
     
    10741119    int rc;
    10751120
    1076     PSHCLCLIENTMSG pMsgReadData = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_READ_DATA,
     1121    PSHCLCLIENTMSG pMsgReadData = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_READ_DATA,
    10771122                                                  VBOX_SHCL_CPARMS_READ_DATA_REQ);
    10781123    if (pMsgReadData)
     
    10881133        HGCMSvcSetU32(&pMsgReadData->paParms[3], pClient->State.cbChunkSize);
    10891134
    1090         rc = shclSvcMsgAdd(pClient, pMsgReadData, true /* fAppend */);
     1135        rc = shClSvcMsgAdd(pClient, pMsgReadData, true /* fAppend */);
    10911136        if (RT_SUCCESS(rc))
    10921137        {
     
    10941139            if (RT_SUCCESS(rc))
    10951140            {
    1096                 rc = shclSvcClientWakeup(pClient);
     1141                rc = shClSvcClientWakeup(pClient);
    10971142                if (RT_SUCCESS(rc))
    10981143                {
     
    11571202    int rc;
    11581203
    1159     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(VBOX_SHCL_HOST_MSG_FORMATS_REPORT, 3);
     1204    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(VBOX_SHCL_HOST_MSG_FORMATS_REPORT, 3);
    11601205    if (pMsg)
    11611206    {
     
    11671212        HGCMSvcSetU32(&pMsg->paParms[2], 0 /* fFlags */);
    11681213
    1169         rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     1214        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    11701215        if (RT_SUCCESS(rc))
    11711216        {
     
    11851230                pClient->State.fFlags |= SHCLCLIENTSTATE_FLAGS_READ_ACTIVE;
    11861231
    1187                 rc = shclSvcClientWakeup(pClient);
     1232                rc = shClSvcClientWakeup(pClient);
    11881233#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    11891234            }
     
    14641509 * @param   pRc                 Where to store the received error code.
    14651510 */
    1466 static int shclSvcGetError(uint32_t cParms, VBOXHGCMSVCPARM paParms[], int *pRc)
     1511static int shClSvcGetError(uint32_t cParms, VBOXHGCMSVCPARM paParms[], int *pRc)
    14671512{
    14681513    AssertPtrReturn(paParms, VERR_INVALID_PARAMETER);
     
    15371582static DECLCALLBACK(int) svcDisconnect(void *, uint32_t u32ClientID, void *pvClient)
    15381583{
     1584    RT_NOREF(u32ClientID);
     1585
    15391586    LogFunc(("u32ClientID=%RU32\n", u32ClientID));
    15401587
     
    15431590
    15441591#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1545     shclSvcClientTransfersReset(pClient);
     1592    shClSvcClientTransfersReset(pClient);
    15461593#endif
    15471594
    15481595    ShClSvcImplDisconnect(pClient);
    15491596
    1550     /* Make sure to send a quit message to the guest so that it can terminate gracefully. */
    1551     if (pClient->Pending.uType)
    1552     {
    1553         if (pClient->Pending.cParms >= 2)
    1554         {
    1555             HGCMSvcSetU32(&pClient->Pending.paParms[0], VBOX_SHCL_HOST_MSG_QUIT);
    1556             HGCMSvcSetU32(&pClient->Pending.paParms[1], 0);
    1557         }
    1558         g_pHelpers->pfnCallComplete(pClient->Pending.hHandle, VINF_SUCCESS);
    1559         pClient->Pending.uType = 0;
    1560     }
    1561 
    1562     shclSvcClientStateDestroy(&pClient->State);
    1563     ShClEventSourceDestroy(&pClient->Events);
    1564 
    1565     ClipboardClientMap::iterator itClient = g_mapClients.find(u32ClientID);
    1566     if (itClient != g_mapClients.end())
    1567     {
    1568         g_mapClients.erase(itClient);
    1569     }
    1570     else
    1571         AssertFailed();
     1597    shClSvcClientDestroy(pClient);
    15721598
    15731599    return VINF_SUCCESS;
     
    15811607    AssertPtr(pvClient);
    15821608
    1583     int rc = shclSvcClientInit(pClient, u32ClientID);
     1609    int rc = shClSvcClientInit(pClient, u32ClientID);
    15841610    if (RT_SUCCESS(rc))
    15851611    {
     
    16391665        case VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD:
    16401666        {
    1641             rc = shclSvcMsgGetOld(pClient, callHandle, cParms, paParms);
     1667            rc = shClSvcMsgGetOld(pClient, callHandle, cParms, paParms);
    16421668            break;
    16431669        }
     
    16721698        case VBOX_SHCL_GUEST_FN_REPORT_FEATURES:
    16731699        {
    1674             rc = shclSvcClientReportFeatures(pClient, callHandle, cParms, paParms);
     1700            rc = shClSvcClientReportFeatures(pClient, callHandle, cParms, paParms);
    16751701            break;
    16761702        }
     
    16781704        case VBOX_SHCL_GUEST_FN_QUERY_FEATURES:
    16791705        {
    1680             rc = shclSvcClientQueryFeatures(callHandle, cParms, paParms);
     1706            rc = shClSvcClientQueryFeatures(callHandle, cParms, paParms);
    16811707            break;
    16821708        }
     
    16841710        case VBOX_SHCL_GUEST_FN_MSG_PEEK_NOWAIT:
    16851711        {
    1686             rc = shclSvcMsgPeek(pClient, callHandle, cParms, paParms, false /*fWait*/);
     1712            rc = shClSvcMsgPeek(pClient, callHandle, cParms, paParms, false /*fWait*/);
    16871713            break;
    16881714        }
     
    16901716        case VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT:
    16911717        {
    1692             rc = shclSvcMsgPeek(pClient, callHandle, cParms, paParms, true /*fWait*/);
     1718            rc = shClSvcMsgPeek(pClient, callHandle, cParms, paParms, true /*fWait*/);
    16931719            break;
    16941720        }
     
    16961722        case VBOX_SHCL_GUEST_FN_MSG_GET:
    16971723        {
    1698             rc = shclSvcMsgGet(pClient, callHandle, cParms, paParms);
     1724            rc = shClSvcMsgGet(pClient, callHandle, cParms, paParms);
    16991725            break;
    17001726        }
     
    18021828            shclSvcClientStateReset(&pClient->State);
    18031829#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1804             shclSvcClientTransfersReset(pClient);
     1830            shClSvcClientTransfersReset(pClient);
    18051831#endif
    18061832            /** @todo Do we need to do anything else here? */
     
    18111837        {
    18121838            int rcGuest;
    1813             rc = shclSvcGetError(cParms,paParms, &rcGuest);
     1839            rc = shClSvcGetError(cParms,paParms, &rcGuest);
    18141840            if (RT_SUCCESS(rc))
    18151841            {
     
    18191845                shclSvcClientStateReset(&pClient->State);
    18201846#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1821                 shclSvcClientTransfersReset(pClient);
     1847                shClSvcClientTransfersReset(pClient);
    18221848#endif
    18231849            }
     
    18571883 * @param   uClientID           Client ID (HGCM) to use for this client state.
    18581884 */
    1859 int shclSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID)
     1885int shClSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID)
    18601886{
    18611887    LogFlowFuncEnter();
     
    18751901 * @param   pClientState        Client state to destroy.
    18761902 */
    1877 int shclSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState)
     1903int shClSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState)
    18781904{
    18791905    RT_NOREF(pClientState);
     
    22302256            }
    22312257
    2232             rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     2258            rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    22332259            AssertRCReturn(rc, rc);
    22342260        }
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp

    r81451 r81820  
    129129static void testMsgAddOld(PSHCLCLIENT pClient, uint32_t uMsg, uint32_t uParm1)
    130130{
    131     PSHCLCLIENTMSG pMsg = shclSvcMsgAlloc(uMsg, 2 /* cParms */); /* The old protocol (v0) has a fixed parameter count of 2. */
     131    PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(uMsg, 2 /* cParms */); /* The old protocol (v0) has a fixed parameter count of 2. */
    132132    RTTESTI_CHECK_RETV(pMsg != NULL);
    133133
     
    135135    HGCMSvcSetU32(&pMsg->paParms[1], uParm1);
    136136
    137     int rc = shclSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    138     RTTESTI_CHECK_RC_OK(rc);
    139     rc = shclSvcClientWakeup(pClient);
     137    int rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     138    RTTESTI_CHECK_RC_OK(rc);
     139    rc = shClSvcClientWakeup(pClient);
    140140    RTTESTI_CHECK_RC_OK(rc);
    141141}
     
    157157    RTTESTI_CHECK_RC_OK(rc);
    158158
    159     rc = shclSvcClientInit(&g_Client, 1 /* clientId */);
     159    rc = shClSvcClientInit(&g_Client, 1 /* clientId */);
    160160    RTTESTI_CHECK_RC_OK(rc);
    161161
     
    176176
    177177    RTTestISub("Testing one format, no waiting guest calls.");
    178     shclSvcClientReset(&g_Client);
     178    shClSvcClientReset(&g_Client);
    179179    testMsgAddOld(&g_Client, VBOX_SHCL_HOST_MSG_READ_DATA, VBOX_SHCL_FMT_HTML);
    180180    HGCMSvcSetU32(&parms[0], 0);
     
    190190
    191191    RTTestISub("Testing two formats, waiting guest call.");
    192     shclSvcClientReset(&g_Client);
     192    shClSvcClientReset(&g_Client);
    193193    HGCMSvcSetU32(&parms[0], 0);
    194194    HGCMSvcSetU32(&parms[1], 0);
     
    210210
    211211    RTTestISub("Testing two formats, no waiting guest calls.");
    212     shclSvcClientReset(&g_Client);
     212    shClSvcClientReset(&g_Client);
    213213    testMsgAddOld(&g_Client, VBOX_SHCL_HOST_MSG_READ_DATA, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
    214214    HGCMSvcSetU32(&parms[0], 0);
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