Changeset 2522 in vbox
- Timestamp:
- May 7, 2007 12:02:12 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vrdpapi.h
r2436 r2522 555 555 * - (0) guest announces available clipboard formats; 556 556 * - (1) guest requests clipboard data; 557 * - (2) host responds to the client's request for clipboard data.557 * - (2) guest responds to the client's request for clipboard data. 558 558 * 559 559 * @param hserver The VRDP server handle. 560 560 * @param u32Function The cause of the call. 561 561 * @param u32Format Bitmask of announced formats or the format of data. 562 * @param pvData Points to data from the host, as reply to (2). 563 * @param cbData Size of the data in bytes. 562 * @param pvData Points to: (1) buffer to be filled with clients data; 563 * (2) data from the host. 564 * @param cbData Size of 'pvData' buffer in bytes. 565 * @param pcbActualRead Size of the copied data in bytes. 564 566 * 565 567 */ … … 567 569 uint32_t u32Function, 568 570 uint32_t u32Format, 569 const void *pvData, 570 uint32_t cbData); 571 void *pvData, 572 uint32_t cbData, 573 uint32_t *pcbActualRead); 571 574 572 575 #ifdef VRDP_MC … … 610 613 * Called by the server when (VRDP_CLIPBOARD_FUNCTION_*): 611 614 * - (0) client announces available clipboard formats; 612 * - (1) client requests clipboard data; 613 * - (2) client responds to the guest's request for clipboard data. 614 * 615 * - client announces available clipboard formats; 616 * - clipboard data is received from the client. 615 * - (1) client requests clipboard data. 617 616 * 618 617 * @param pvCallback Callback specific value returned by VRDPSERVERCALLBACK::pfnInterceptClipboard. 619 618 * @param u32ClientId Identifies the RDP client that sent the reply. 620 * @param u32Function The cause if the callback.619 * @param u32Function The cause of the callback. 621 620 * @param u32Format Bitmask of reported formats or the format of received data. 622 * @param pvData Points to data received from the client.623 * @param cbData Size of the data in bytes.621 * @param pvData Reserved. 622 * @param cbData Reserved. 624 623 * 625 624 * @return VBox error code. -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r2393 r2522 34 34 // ConsoleVRDPServer 35 35 //////////////////////////////////////////////////////////////////////////////// 36 37 #define VBOX_CLIPBOARD_NO_DATA 038 #define VBOX_CLIPBOARD_DATA_WAITING 139 #define VBOX_CLIPBOARD_DATA_ARRIVED 240 36 41 37 #ifdef VBOX_VRDP … … 56 52 void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSendUpdate) (HVRDPSERVER hServer, void *pvUpdate, uint32_t cbUpdate); 57 53 void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPQueryInfo) (HVRDPSERVER hserver, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut); 58 void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPClipboard) (HVRDPSERVER hserver, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData );59 #endif 54 void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPClipboard) (HVRDPSERVER hserver, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData, uint32_t *pcbActualRead); 55 #endif /* VBOX_VRDP */ 60 56 61 57 ConsoleVRDPServer::ConsoleVRDPServer (Console *console) … … 70 66 mpfnClipboardCallback = NULL; 71 67 72 rc = RTSemEventMultiCreate(&mEventClipboardData);73 AssertRC (rc);74 mpvClipboardData = NULL;75 mcbClipboardData = 0;76 mfu32ClipboardWaitData = VBOX_CLIPBOARD_NO_DATA;77 78 68 #ifdef VBOX_WITH_USB 79 69 mUSBBackends.pHead = NULL; … … 101 91 #ifdef VRDP_MC 102 92 Stop (); 103 104 RTSemEventMultiDestroy (mEventClipboardData);105 93 106 94 if (RTCritSectIsInitialized (&mCritSect)) … … 461 449 cbData); 462 450 } 463 464 /* Discard current data. */465 ASMAtomicCmpXchgU32(&pServer->mfu32ClipboardWaitData, VBOX_CLIPBOARD_NO_DATA, VBOX_CLIPBOARD_DATA_ARRIVED);466 451 } break; 467 452 … … 477 462 } break; 478 463 479 case VRDP_CLIPBOARD_FUNCTION_DATA_WRITE:480 {481 if (ASMAtomicCmpXchgU32(&pServer->mfu32ClipboardWaitData, VBOX_CLIPBOARD_DATA_ARRIVED, VBOX_CLIPBOARD_DATA_WAITING))482 {483 LogFlowFunc(("Got clipboard data\n"));484 485 if (pServer->mpvClipboardData)486 {487 RTMemFree (pServer->mpvClipboardData);488 pServer->mpvClipboardData = NULL;489 }490 491 if (cbData)492 {493 void *pv = RTMemAlloc (cbData);494 495 memcpy (pv, pvData, cbData);496 497 pServer->mpvClipboardData = pv;498 pServer->mcbClipboardData = cbData;499 }500 else501 {502 pServer->mpvClipboardData = NULL;503 pServer->mcbClipboardData = 0;504 }505 506 RTSemEventMultiSignal (pServer->mEventClipboardData);507 }508 } break;509 510 464 default: 511 465 rc = VERR_NOT_SUPPORTED; … … 539 493 case VBOX_CLIPBOARD_EXT_FN_FORMAT_ANNOUNCE: 540 494 { 495 /* The guest announces clipboard formats. This must be delivered to all clients. */ 541 496 if (mpfnVRDPClipboard) 542 497 { … … 545 500 pParms->u32Format, 546 501 NULL, 547 0); 502 0, 503 NULL); 548 504 } 549 505 } break; … … 551 507 case VBOX_CLIPBOARD_EXT_FN_DATA_READ: 552 508 { 509 /* The clipboard service expects that the pvData buffer will be filled 510 * with clipboard data. The server returns the data from the client that 511 * announced the requested format most recently. 512 */ 553 513 if (mpfnVRDPClipboard) 554 514 { 555 if (ASMAtomicCmpXchgU32(&pServer->mfu32ClipboardWaitData, VBOX_CLIPBOARD_DATA_WAITING, VBOX_CLIPBOARD_NO_DATA)) 556 { 557 LogFlowFunc(("Wait for clipboard data\n")); 558 RTSemEventMultiReset(pServer->mEventClipboardData); 559 560 mpfnVRDPClipboard (pServer->mhServer, 561 VRDP_CLIPBOARD_FUNCTION_DATA_READ, 562 pParms->u32Format, 563 NULL, 564 0); 565 566 /* Wait for the client. 10 seconds should be enough. */ 567 int rc = RTSemEventMultiWait(pServer->mEventClipboardData, 10*1000); 568 LogFlowFunc (("Wait completed rc = %d.\n", rc)); NOREF(rc); 569 } 570 571 if (pServer->mfu32ClipboardWaitData == VBOX_CLIPBOARD_DATA_ARRIVED) 572 { 573 LogFlowFunc(("Return clipboard data: pParms->cbData = %d, mcbClipboardData = %d\n", pParms->cbData, pServer->mcbClipboardData)); 574 if (pParms->cbData >= pServer->mcbClipboardData) 575 { 576 if (pServer->mcbClipboardData) 577 { 578 memcpy (pParms->pvData, pServer->mpvClipboardData, pServer->mcbClipboardData); 579 } 580 581 RTMemFree (pServer->mpvClipboardData); 582 pServer->mpvClipboardData = NULL; 583 584 pServer->mfu32ClipboardWaitData = VBOX_CLIPBOARD_NO_DATA; 585 } 586 587 pParms->cbData = pServer->mcbClipboardData; 588 } 589 else 590 { 591 pParms->pvData = NULL; 592 pParms->cbData = 0; 593 } 515 mpfnVRDPClipboard (pServer->mhServer, 516 VRDP_CLIPBOARD_FUNCTION_DATA_READ, 517 pParms->u32Format, 518 pParms->pvData, 519 pParms->cbData, 520 &pParms->cbData); 594 521 } 595 522 } break; … … 603 530 pParms->u32Format, 604 531 pParms->pvData, 605 pParms->cbData); 532 pParms->cbData, 533 NULL); 606 534 } 607 535 } break; -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r2389 r2522 121 121 static void (VBOXCALL *mpfnVRDPSendUpdate) (HVRDPSERVER hServer, void *pvUpdate, uint32_t cbUpdate); 122 122 static void (VBOXCALL *mpfnVRDPQueryInfo) (HVRDPSERVER hserver, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut); 123 static void (VBOXCALL *mpfnVRDPClipboard) (HVRDPSERVER hserver, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData );124 #endif 123 static void (VBOXCALL *mpfnVRDPClipboard) (HVRDPSERVER hserver, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData, uint32_t *pcbActualRead); 124 #endif /* VBOX_VRDP */ 125 125 126 126 #ifdef VRDP_MC … … 133 133 HGCMSVCEXTHANDLE mhClipboard; 134 134 PFNVRDPCLIPBOARDEXTCALLBACK mpfnClipboardCallback; 135 136 RTSEMEVENTMULTI mEventClipboardData;137 void *mpvClipboardData;138 uint32_t mcbClipboardData;139 volatile uint32_t mfu32ClipboardWaitData;140 135 141 136 static DECLCALLBACK(int) ClipboardCallback (void *pvCallback, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData);
Note:
See TracChangeset
for help on using the changeset viewer.