儲存庫 vbox 的更動 79366
- 時間撮記:
- 2019-6-26 下午03:59:30 (5 年 以前)
- 位置:
- trunk
- 檔案:
-
- 修改 10 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/VBox/GuestHost/SharedClipboard-uri.h
r79350 r79366 536 536 SHAREDCLIPBOARDURITRANSFERDIR_WRITE, 537 537 /** The usual 32-bit hack. */ 538 SHAREDCLIPBOARDURITRANSFERDIR_ _32BIT_HACK = 0x7fffffff538 SHAREDCLIPBOARDURITRANSFERDIR_32BIT_HACK = 0x7fffffff 539 539 } SHAREDCLIPBOARDURITRANSFERDIR; 540 540 … … 560 560 SHAREDCLIPBOARDURITRANSFERSTATUS_NONE = 0, 561 561 /** The transfer has been announced but is not running yet. */ 562 SHAREDCLIPBOARDURITRANSFERSTATUS_ ANNOUNCED,562 SHAREDCLIPBOARDURITRANSFERSTATUS_READY, 563 563 /** The transfer is active and running. */ 564 SHAREDCLIPBOARDURITRANSFERSTATUS_RUNNING 564 SHAREDCLIPBOARDURITRANSFERSTATUS_RUNNING, 565 /** The usual 32-bit hack. */ 566 SHAREDCLIPBOARDURITRANSFERSTATUS_32BIT_HACK = 0x7fffffff 565 567 } SHAREDCLIPBOARDURITRANSFERSTATUS; 568 569 typedef struct _SHAREDCLIPBOARDURITRANSFERPAYLOAD 570 { 571 uint32_t uID; 572 void *pvData; 573 uint32_t cbData; 574 } SHAREDCLIPBOARDURITRANSFERPAYLOAD, *PSHAREDCLIPBOARDURITRANSFERPAYLOAD; 575 576 typedef struct _SHAREDCLIPBOARDURITRANSFEREVENT 577 { 578 RTSEMEVENT hEventSem; 579 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload; 580 } SHAREDCLIPBOARDURITRANSFEREVENT, *PSHAREDCLIPBOARDURITRANSFEREVENT; 581 582 typedef enum _SHAREDCLIPBOARDURITRANSFEREVENTTYPE 583 { 584 SHAREDCLIPBOARDURITRANSFEREVENTTYPE_UNKNOWN, 585 SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_HDR, 586 SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_CHUNK, 587 /** Marks the end of the event list. */ 588 SHAREDCLIPBOARDURITRANSFEREVENTTYPE_LAST, 589 /** The usual 32-bit hack. */ 590 SHAREDCLIPBOARDURITRANSFEREVENTTYPE_32BIT_HACK = 0x7fffffff 591 } SHAREDCLIPBOARDURITRANSFEREVENTTYPE; 592 593 typedef std::map<uint32_t, SHAREDCLIPBOARDURITRANSFEREVENT *> SharedClipboardURITransferEventMap; 594 595 typedef struct _SHAREDCLIPBOARDURITRANSFEREVENTS 596 { 597 SharedClipboardURITransferEventMap *pMap; 598 } SHAREDCLIPBOARDURITRANSFEREVENTS, *PSHAREDCLIPBOARDURITRANSFEREVENTS; 566 599 567 600 /** … … 593 626 typedef struct _SHAREDCLIPBOARDURITRANSFER *PSHAREDCLIPBOARDURITRANSFER; 594 627 628 /** 629 * Structure maintaining URI clipboard provider context data. 630 * This is handed in to the provider implementation callbacks. 631 */ 595 632 typedef struct _SHAREDCLIPBOARDPROVIDERCTX 596 633 { 634 /** Pointer to the related URI transfer. */ 597 635 PSHAREDCLIPBOARDURITRANSFER pTransfer; 636 /** User-defined data pointer. Can be NULL if not needed. */ 598 637 void *pvUser; 599 638 } SHAREDCLIPBOARDPROVIDERCTX, *PSHAREDCLIPBOARDPROVIDERCTX; 600 639 640 /** Defines an URI clipboard provider function declaration with additional parameters. */ 601 641 #define SHAREDCLIPBOARDPROVIDERFUNCDECL(a_Name, ...) \ 602 642 typedef DECLCALLBACK(int) RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name)(PSHAREDCLIPBOARDPROVIDERCTX, __VA_ARGS__); \ 603 643 typedef RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name) RT_CONCAT(*PFNSHAREDCLIPBOARDPROVIDER, a_Name); 604 644 645 /** Defines an URI clipboard provider function declaration (no additional parameters). */ 605 646 #define SHAREDCLIPBOARDPROVIDERFUNCDECLVOID(a_Name) \ 606 647 typedef DECLCALLBACK(int) RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name)(PSHAREDCLIPBOARDPROVIDERCTX); \ 607 648 typedef RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name) RT_CONCAT(*PFNSHAREDCLIPBOARDPROVIDER, a_Name); 608 649 650 /** Declares a URI clipboard provider function member. */ 609 651 #define SHAREDCLIPBOARDPROVIDERFUNCMEMBER(a_Name, a_Member) \ 610 652 RT_CONCAT(PFNSHAREDCLIPBOARDPROVIDER, a_Name) a_Member; … … 624 666 SHAREDCLIPBOARDPROVIDERFUNCDECLVOID(RESET) 625 667 668 /** 669 * Shared Clipboard URI provider interface table. 670 */ 626 671 typedef struct _SHAREDCLIPBOARDPROVIDERINTERFACE 627 672 { … … 648 693 /** Specifies what the source of the provider is. */ 649 694 SHAREDCLIPBOARDSOURCE enmSource; 695 /** The provider interface table. */ 650 696 SHAREDCLIPBOARDPROVIDERINTERFACE Interface; 697 /** Provider callback data. */ 651 698 void *pvUser; 652 union653 {654 struct655 {656 /** HGCM client ID to use. */657 uint32_t uClientID;658 } VbglR3;659 struct660 {661 SharedClipboardArea *pArea;662 } HostService;663 } u;664 699 } SHAREDCLIPBOARDPROVIDERCREATIONCTX, *PSHAREDCLIPBOARDPROVIDERCREATIONCTX; 665 700 … … 693 728 } SHAREDCLIPBOARDPROVIDERWRITEPARMS, *PSHAREDCLIPBOARDPROVIDERWRITEPARMS; 694 729 695 #if 0696 /**697 * Interface class acting as a lightweight proxy for abstracting reading / writing clipboard data.698 *699 * This is needed because various implementations can run on the host *or* on the guest side,700 * requiring different methods for handling the actual data.701 */702 class SharedClipboardProvider703 {704 705 public:706 707 static SharedClipboardProvider *Create(PSHAREDCLIPBOARDPROVIDERCREATIONCTX pCtx);708 709 virtual ~SharedClipboardProvider(void);710 711 public:712 713 uint32_t AddRef(void);714 uint32_t Release(void);715 716 public:717 718 void SetCallbacks(PSHAREDCLIPBOARDPROVIDERCALLBACKS pCallbacks);719 720 public: /* Interface to be implemented. */721 722 virtual int Prepare(void);723 724 virtual int ReadDataHdr(PVBOXCLIPBOARDDATAHDR *ppDataHdr);725 virtual int WriteDataHdr(const PVBOXCLIPBOARDDATAHDR pDataHdr);726 727 virtual int ReadDataChunk(const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags = 0,728 uint32_t *pcbRead = NULL);729 virtual int WriteDataChunk(const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags = 0,730 uint32_t *pcbWritten = NULL);731 732 virtual int ReadDirectory(PVBOXCLIPBOARDDIRDATA *ppDirData);733 virtual int WriteDirectory(const PVBOXCLIPBOARDDIRDATA pDirData);734 735 virtual int ReadFileHdr(PVBOXCLIPBOARDFILEHDR *ppFileHdr);736 virtual int WriteFileHdr(const PVBOXCLIPBOARDFILEHDR pFileHdr);737 738 virtual int ReadFileData(void *pvData, uint32_t cbData, uint32_t fFlags = 0, uint32_t *pcbRead = NULL);739 virtual int WriteFileData(void *pvData, uint32_t cbData, uint32_t fFlags = 0, uint32_t *pcbWritten = NULL);740 741 virtual void Reset(void);742 743 public: /* Optional callback handling. */744 745 /*virtual int SetCallbacks();*/746 747 virtual int OnRead(PSHAREDCLIPBOARDPROVIDERREADPARMS pParms);748 virtual int OnWrite(PSHAREDCLIPBOARDPROVIDERWRITEPARMS pParms);749 750 protected:751 752 SharedClipboardProvider(void);753 754 protected:755 756 /**757 * Structure for maintaining an internal event.758 */759 struct Event760 {761 Event(uint32_t uMsg);762 virtual ~Event();763 764 void *DataAdopt(void);765 uint32_t DataSize(void);766 void *DataRaw(void);767 void Reset(void);768 int SetData(const void *pvData, uint32_t cbData);769 int Wait(RTMSINTERVAL uTimeoutMs);770 771 /** The event's associated message ID (guest function number). */772 uint32_t mMsg;773 /** The event's own event semaphore. */774 RTSEMEVENT mEvent;775 /** User-provided data buffer associated to this event. Optional. */776 void *mpvData;777 /** Size (in bytes) of user-provided data buffer associated to this event. */778 uint32_t mcbData;779 };780 781 /** Map of events; the key is the guest function number (VBOX_SHARED_CLIPBOARD_GUEST_FN_XXX). */782 typedef std::map<uint32_t, Event *> EventMap;783 784 int eventRegister(uint32_t uMsg);785 int eventUnregister(uint32_t uMsg);786 int eventUnregisterAll(void);787 int eventSignal(uint32_t uMsg);788 int eventWait(uint32_t uMsg, PFNSSHAREDCLIPBOARDPROVIDERCALLBACK pfnCallback, RTMSINTERVAL uTimeoutMs,789 void **ppvData, uint32_t *pcbData = NULL);790 SharedClipboardProvider::Event *eventGet(uint32_t uMsg);791 792 protected:793 794 /** Number of references to this instance. */795 volatile uint32_t m_cRefs;796 /** The provider's transfer direction. */797 SHAREDCLIPBOARDURITRANSFERDIR m_enmDir;798 /** The provider's callback table. */799 SHAREDCLIPBOARDPROVIDERCALLBACKS m_Callbacks;800 /** Default timeout (in ms) for waiting for events. */801 RTMSINTERVAL m_uTimeoutMs;802 /** Map of (internal) events to provide asynchronous reads / writes. */803 EventMap m_mapEvents;804 };805 806 /**807 * Shared Clipboard provider implementation for VbglR3 (guest side).808 */809 class SharedClipboardProviderVbglR3 : protected SharedClipboardProvider810 {811 friend class SharedClipboardProvider;812 813 public:814 815 virtual ~SharedClipboardProviderVbglR3(void);816 817 public:818 819 int ReadDataHdr(PVBOXCLIPBOARDDATAHDR *ppDataHdr);820 int WriteDataHdr(const PVBOXCLIPBOARDDATAHDR pDataHdr);821 822 int ReadDataChunk(const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags = 0,823 uint32_t *pcbRead = NULL);824 int WriteDataChunk(const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags = 0,825 uint32_t *pcbWritten = NULL);826 827 int ReadDirectory(PVBOXCLIPBOARDDIRDATA *ppDirData);828 int WriteDirectory(const PVBOXCLIPBOARDDIRDATA pDirData);829 830 int ReadFileHdr(PVBOXCLIPBOARDFILEHDR *ppFileHdr);831 int WriteFileHdr(const PVBOXCLIPBOARDFILEHDR pFileHdr);832 833 int ReadFileData(void *pvData, uint32_t cbData, uint32_t fFlags = 0, uint32_t *pcbRead = NULL);834 int WriteFileData(void *pvData, uint32_t cbData, uint32_t fFlags = 0, uint32_t *pcbWritten = NULL);835 836 void Reset(void);837 838 protected:839 840 SharedClipboardProviderVbglR3(uint32_t uClientID);841 842 /** HGCM client ID to use. */843 uint32_t m_uClientID;844 };845 846 #ifdef VBOX_WITH_SHARED_CLIPBOARD_HOST847 /**848 * Shared Clipboard provider implementation for host service (host side).849 */850 class SharedClipboardProviderHostService : protected SharedClipboardProvider851 {852 friend class SharedClipboardProvider;853 854 public:855 856 virtual ~SharedClipboardProviderHostService();857 858 public:859 860 int Prepare(void);861 862 int ReadDataHdr(PVBOXCLIPBOARDDATAHDR *ppDataHdr);863 int WriteDataHdr(const PVBOXCLIPBOARDDATAHDR pDataHdr);864 865 int ReadDataChunk(const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags = 0,866 uint32_t *pcbRead = NULL);867 int WriteDataChunk(const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags = 0,868 uint32_t *pcbWritten = NULL);869 870 int ReadDirectory(PVBOXCLIPBOARDDIRDATA *ppDirData);871 int WriteDirectory(const PVBOXCLIPBOARDDIRDATA pDirData);872 873 int ReadFileHdr(PVBOXCLIPBOARDFILEHDR *ppFileHdr);874 int WriteFileHdr(const PVBOXCLIPBOARDFILEHDR pFileHdr);875 876 int ReadFileData(void *pvData, uint32_t cbData, uint32_t fFlags = 0, uint32_t *pcbRead = NULL);877 int WriteFileData(void *pvData, uint32_t cbData, uint32_t fFlags = 0, uint32_t *pcbWritten = NULL);878 879 void Reset(void);880 881 public:882 883 int OnWrite(PSHAREDCLIPBOARDPROVIDERWRITEPARMS pParms);884 885 protected:886 887 SharedClipboardProviderHostService(SharedClipboardArea *pArea);888 889 protected:890 891 /** Pointer to associated clipboard area. */892 SharedClipboardArea *m_pArea;893 };894 #endif /* VBOX_WITH_SHARED_CLIPBOARD_HOST */895 #endif896 897 730 struct _SHAREDCLIPBOARDURITRANSFER; 898 731 typedef _SHAREDCLIPBOARDURITRANSFER *PSHAREDCLIPBOARDURITRANSFER; … … 922 755 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(TRANSFERPREPARE) 923 756 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(TRANSFERSTARTED) 924 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(DATAH DRCOMPLETE)757 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(DATAHEADERCOMPLETE) 925 758 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(DATACHUNKCOMPLETE) 759 SHAREDCLIPBOARDTRANSFERCALLBACKDECL (TRANSFERCOMPLETE, int rc) 926 760 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(TRANSFERCANCELED) 927 SHAREDCLIPBOARDTRANSFERCALLBACKDECL (TRANSFERCOMPLETE, int rc)928 761 SHAREDCLIPBOARDTRANSFERCALLBACKDECL (TRANSFERERROR, int rc) 929 762 … … 941 774 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(TRANSFERSTARTED, pfnTransferStarted); 942 775 /** Function pointer, called when reading / writing the meta data header is complete. */ 943 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(DATAH DRCOMPLETE, pfnDataHeaderComplete);776 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(DATAHEADERCOMPLETE, pfnDataHeaderComplete); 944 777 /** Function pointer, called when reading / writing the meta data is complete. */ 945 778 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(DATACHUNKCOMPLETE, pfnDataComplete); … … 979 812 /** The transfer's state (for SSM, later). */ 980 813 SHAREDCLIPBOARDURITRANSFERSTATE State; 814 SHAREDCLIPBOARDURITRANSFEREVENTS Events; 981 815 /** The transfer's own (local) area, if any (can be NULL if not needed). 982 816 * The area itself has a clipboard area ID assigned. … … 1005 839 /** Critical section for serializing access. */ 1006 840 RTCRITSECT CritSect; 1007 /** List of active transfers. 1008 * Use a list or something lateron. */ 1009 RTLISTANCHOR List; 841 /** List of transfers. */ 842 RTLISTANCHOR List; 1010 843 /** Number of running (concurrent) transfers. 1011 844 * At the moment we only support only one transfer per client at a time. */ … … 1014 847 * At the moment we only support only one transfer per client at a time. */ 1015 848 uint32_t cMaxRunning; 1016 #ifdef DEBUG 1017 uint32_t cTransfer; 1018 #endif 849 /** Number of total transfers (in list). */ 850 uint32_t cTransfers; 1019 851 } SHAREDCLIPBOARDURICTX, *PSHAREDCLIPBOARDURICTX; 1020 852 … … 1040 872 void SharedClipboardURITransferSetCallbacks(PSHAREDCLIPBOARDURITRANSFER pTransfer, 1041 873 PSHAREDCLIPBOARDURITRANSFERCALLBACKS pCallbacks); 1042 int SharedClipboardURITransferSetDataHeader(PSHAREDCLIPBOARDURITRANSFER pTransfer, PVBOXCLIPBOARDDATAHDR pDataHdr); 1043 int SharedClipboardURITransferSetDataChunk(PSHAREDCLIPBOARDURITRANSFER pTransfer, PVBOXCLIPBOARDDATACHUNK pDataChunk); 874 875 int SharedClipboardURITransferPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData, 876 PSHAREDCLIPBOARDURITRANSFERPAYLOAD *ppPayload); 877 void SharedClipboardURITransferPayloadFree(PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload); 878 879 int SharedClipboardURITransferEventRegister(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID); 880 int SharedClipboardURITransferEventUnregister(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID); 881 int SharedClipboardURITransferEventWait(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID, RTMSINTERVAL uTimeoutMs, 882 PSHAREDCLIPBOARDURITRANSFERPAYLOAD *ppPayload); 883 int SharedClipboardURITransferEventSignal(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID, PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload); 1044 884 1045 885 int SharedClipboardURITransferMetaDataAdd(PSHAREDCLIPBOARDURITRANSFER pTransfer, const void *pvMeta, uint32_t cbMeta); … … 1059 899 PSHAREDCLIPBOARDURITRANSFER SharedClipboardURICtxGetTransfer(PSHAREDCLIPBOARDURICTX pURI, uint32_t uIdx); 1060 900 uint32_t SharedClipboardURICtxGetRunningTransfers(PSHAREDCLIPBOARDURICTX pURI); 901 uint32_t SharedClipboardURICtxGetTotalTransfers(PSHAREDCLIPBOARDURICTX pURI); 1061 902 void SharedClipboardURICtxTransfersCleanup(PSHAREDCLIPBOARDURICTX pURI); 1062 903 bool SharedClipboardURICtxTransfersMaximumReached(PSHAREDCLIPBOARDURICTX pURI); -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r79347 r79366 596 596 597 597 PSHAREDCLIPBOARDURITRANSFER pTransfer; 598 rc = SharedClipboardURITransferCreate(SHAREDCLIPBOARDURITRANSFERDIR_READ, &pTransfer); 598 rc = SharedClipboardURITransferCreate(SHAREDCLIPBOARDURITRANSFERDIR_READ, 599 SHAREDCLIPBOARDSOURCE_REMOTE, 600 &pTransfer); 599 601 if (RT_SUCCESS(rc)) 600 602 { … … 620 622 621 623 creationCtx.pvUser = pCtx; 622 623 creationCtx.u.VbglR3.uClientID = pCtx->u32ClientID;624 624 625 625 rc = SharedClipboardURITransferProviderCreate(pTransfer, &creationCtx); … … 728 728 729 729 PSHAREDCLIPBOARDURITRANSFER pTransfer; 730 rc = SharedClipboardURITransferCreate(SHAREDCLIPBOARDURITRANSFERDIR_WRITE, &pTransfer); 730 rc = SharedClipboardURITransferCreate(SHAREDCLIPBOARDURITRANSFERDIR_WRITE, 731 SHAREDCLIPBOARDSOURCE_LOCAL, 732 &pTransfer); 731 733 if (RT_SUCCESS(rc)) 732 734 { … … 743 745 RT_ZERO(creationCtx); 744 746 creationCtx.enmSource = SHAREDCLIPBOARDSOURCE_LOCAL; 745 creationCtx.u.VbglR3.uClientID = pCtx->u32ClientID; 747 748 RT_ZERO(creationCtx.Interface); 749 creationCtx.Interface.pfnWriteDataHdr = vboxClipboardURIWriteDataHdr; 750 creationCtx.Interface.pfnWriteDataChunk = vboxClipboardURIWriteDataChunk; 751 creationCtx.Interface.pfnWriteDirectory = vboxClipboardURIWriteDir; 752 creationCtx.Interface.pfnWriteFileHdr = vboxClipboardURIWriteFileHdr; 753 creationCtx.Interface.pfnWriteFileData = vboxClipboardURIWriteFileData; 754 755 creationCtx.pvUser = pCtx; 746 756 747 757 rc = SharedClipboardURITransferProviderCreate(pTransfer, &creationCtx); -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp
r79347 r79366 421 421 } 422 422 } 423 424 if (RT_FAILURE(rc)) 425 LogRel(("Shared Clipboard: Data object unable to receive meta data, rc=%Rrc\n", rc)); 423 426 } 424 427 break; -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardURIList.cpp
r79276 r79366 487 487 AssertReturn(!(fFlags & ~SHAREDCLIPBOARDURILIST_FLAGS_VALID_MASK), VERR_INVALID_FLAGS); 488 488 489 if (!RTStrIsValidEncoding(static_cast<const char *>(pvData)))490 return VERR_INVALID_PARAMETER;491 492 489 RTCList<RTCString> lstURI = 493 490 RTCString(static_cast<const char *>(pvData), cbData - 1).split("\r\n"); -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-uri.cpp
r79347 r79366 20 20 21 21 #include <iprt/path.h> 22 #include <iprt/semaphore.h> 22 23 23 24 #include <VBox/err.h> … … 36 37 37 38 39 /** 40 * Allocates a VBOXCLIPBOARDDATAHDR structure. 41 * 42 * @returns VBox status code. 43 * @param ppDataChunk Where to store the allocated VBOXCLIPBOARDDATAHDR structure on success. 44 */ 38 45 int SharedClipboardURIDataHdrAlloc(PVBOXCLIPBOARDDATAHDR *ppDataHdr) 39 46 { … … 48 55 { 49 56 char *pszFmt = NULL; 50 rc = RTStrAAppend(&pszFmt, "VBoxShClURIList"); 57 rc = RTStrAAppend(&pszFmt, "VBoxShClURIList"); /** @todo Make this more flexible. Later. */ 51 58 if (RT_SUCCESS(rc)) 52 59 { … … 245 252 246 253 /** 254 * Duplicates (allocates) a VBOXCLIPBOARDDATACHUNK structure. 255 * 256 * @returns Duplicated VBOXCLIPBOARDDATACHUNK structure on success. 257 * @param pDataChunk VBOXCLIPBOARDDATACHUNK to duplicate. 258 */ 259 PVBOXCLIPBOARDDATACHUNK SharedClipboardURIDataChunkDup(PVBOXCLIPBOARDDATACHUNK pDataChunk) 260 { 261 AssertPtrReturn(pDataChunk, NULL); 262 263 PVBOXCLIPBOARDDATACHUNK pDataChunkDup = (PVBOXCLIPBOARDDATACHUNK)RTMemAlloc(sizeof(VBOXCLIPBOARDDATACHUNK)); 264 if (pDataChunkDup) 265 { 266 *pDataChunkDup = *pDataChunk; 267 268 if (pDataChunk->pvData) 269 { 270 pDataChunkDup->pvData = RTMemDup(pDataChunk->pvData, pDataChunk->cbData); 271 pDataChunkDup->cbData = pDataChunk->cbData; 272 } 273 274 if (pDataChunk->pvChecksum) 275 { 276 pDataChunkDup->pvChecksum = RTMemDup(pDataChunk->pvChecksum, pDataChunk->cbChecksum); 277 pDataChunkDup->cbChecksum = pDataChunk->cbChecksum; 278 } 279 } 280 281 return pDataChunkDup; 282 } 283 284 /** 247 285 * Initializes a VBOXCLIPBOARDDATACHUNK structure. 248 286 * … … 662 700 663 701 pTransfer->pURIList = new SharedClipboardURIList(); 664 if (!pTransfer->pURIList) 702 if (pTransfer->pURIList) 703 { 704 pTransfer->Events.pMap = new SharedClipboardURITransferEventMap(); 705 if (pTransfer->Events.pMap) 706 { 707 rc = SharedClipboardURIObjCtxInit(&pTransfer->State.ObjCtx); 708 if (RT_SUCCESS(rc)) 709 { 710 *ppTransfer = pTransfer; 711 } 712 } 713 else 714 rc = VERR_NO_MEMORY; 715 } 716 else 717 rc = VERR_NO_MEMORY; 718 719 if (RT_FAILURE(rc)) 665 720 { 666 721 RTMemFree(pTransfer); 667 return VERR_NO_MEMORY;668 }669 670 rc = SharedClipboardURIObjCtxInit(&pTransfer->State.ObjCtx);671 if (RT_SUCCESS(rc))672 {673 *ppTransfer = pTransfer;674 722 } 675 723 … … 704 752 } 705 753 754 if (pTransfer->Events.pMap) 755 { 756 delete pTransfer->Events.pMap; 757 pTransfer->Events.pMap = NULL; 758 } 759 706 760 SharedClipboardURIObjCtxDestroy(&pTransfer->State.ObjCtx); 707 761 … … 727 781 728 782 int rc = VINF_SUCCESS; 783 784 AssertMsgReturn(pTransfer->State.enmStatus == SHAREDCLIPBOARDURITRANSFERSTATUS_NONE, 785 ("Transfer has wrong state (%RU32)\n", pTransfer->State.enmStatus), VERR_WRONG_ORDER); 729 786 730 787 LogFlowFunc(("pTransfer=%p, enmDir=%RU32\n", pTransfer, pTransfer->State.enmDir)); … … 798 855 if (RT_SUCCESS(rc)) 799 856 { 857 pTransfer->State.enmStatus = SHAREDCLIPBOARDURITRANSFERSTATUS_READY; 858 800 859 /** @todo Add checksum support. */ 801 860 } … … 1005 1064 } 1006 1065 1007 int SharedClipboardURITransferSetDataHeader(PSHAREDCLIPBOARDURITRANSFER pTransfer, PVBOXCLIPBOARDDATAHDR pDataHdr) 1008 { 1009 AssertReturn(pTransfer->State.pHeader == NULL, VERR_WRONG_ORDER); 1010 1011 LogFlowFuncEnter(); 1012 1066 int SharedClipboardURITransferPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData, 1067 PSHAREDCLIPBOARDURITRANSFERPAYLOAD *ppPayload) 1068 { 1069 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload = 1070 (PSHAREDCLIPBOARDURITRANSFERPAYLOAD)RTMemAlloc(sizeof(SHAREDCLIPBOARDURITRANSFERPAYLOAD)); 1071 if (!pPayload) 1072 return VERR_NO_MEMORY; 1073 1074 pPayload->pvData = RTMemAlloc(cbData); 1075 if (pPayload->pvData) 1076 { 1077 memcpy(pPayload->pvData, pvData, cbData); 1078 1079 pPayload->cbData = cbData; 1080 pPayload->uID = uID; 1081 1082 *ppPayload = pPayload; 1083 1084 return VINF_SUCCESS; 1085 } 1086 1087 RTMemFree(pPayload); 1088 return VERR_NO_MEMORY; 1089 } 1090 1091 void SharedClipboardURITransferPayloadFree(PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload) 1092 { 1093 if (!pPayload) 1094 return; 1095 1096 if (pPayload->pvData) 1097 { 1098 Assert(pPayload->cbData); 1099 RTMemFree(pPayload->pvData); 1100 pPayload->pvData = NULL; 1101 } 1102 1103 pPayload->cbData = 0; 1104 1105 RTMemFree(pPayload); 1106 pPayload = NULL; 1107 } 1108 1109 int SharedClipboardURITransferEventRegister(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID) 1110 { 1013 1111 int rc; 1014 1112 1015 pTransfer->State.pHeader = SharedClipboardURIDataHdrDup(pDataHdr); 1016 if (pTransfer->State.pHeader) 1017 { 1018 LogFlowFunc(("Meta data size is %RU32, total size is %RU64, %RU64 objects\n", 1019 pTransfer->State.pHeader->cbMeta, pTransfer->State.pHeader->cbTotal, 1020 pTransfer->State.pHeader->cObjects)); 1113 SharedClipboardURITransferEventMap::iterator itEvent = pTransfer->Events.pMap->find(uID); 1114 if (itEvent == pTransfer->Events.pMap->end()) 1115 { 1116 PSHAREDCLIPBOARDURITRANSFEREVENT pEvent 1117 = (PSHAREDCLIPBOARDURITRANSFEREVENT)RTMemAllocZ(sizeof(SHAREDCLIPBOARDURITRANSFEREVENT)); 1118 if (pEvent) 1119 { 1120 rc = RTSemEventCreate(&pEvent->hEventSem); 1121 if (RT_SUCCESS(rc)) 1122 { 1123 pTransfer->Events.pMap->insert(std::pair<uint32_t, PSHAREDCLIPBOARDURITRANSFEREVENT>(uID, pEvent)); /** @todo Can this throw? */ 1124 } 1125 } 1126 else 1127 rc = VERR_NO_MEMORY; 1128 } 1129 else 1130 rc = VERR_ALREADY_EXISTS; 1131 1132 LogFlowFuncLeaveRC(rc); 1133 return rc; 1134 } 1135 1136 int SharedClipboardURITransferEventUnregister(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID) 1137 { 1138 int rc; 1139 1140 SharedClipboardURITransferEventMap::const_iterator itEvent = pTransfer->Events.pMap->find(uID); 1141 if (itEvent != pTransfer->Events.pMap->end()) 1142 { 1143 SharedClipboardURITransferPayloadFree(itEvent->second->pPayload); 1144 1145 RTSemEventDestroy(itEvent->second->hEventSem); 1146 1147 RTMemFree(itEvent->second); 1148 1149 pTransfer->Events.pMap->erase(itEvent); 1021 1150 1022 1151 rc = VINF_SUCCESS; 1023 1024 if (pTransfer->Callbacks.pfnDataHeaderComplete)1025 {1026 SHAREDCLIPBOARDURITRANSFERCALLBACKDATA callbackData = { pTransfer, pTransfer->Callbacks.pvUser };1027 pTransfer->Callbacks.pfnDataHeaderComplete(&callbackData);1028 }1029 1152 } 1030 1153 else 1031 rc = VERR_NO_MEMORY; 1032 1033 LogFlowFuncLeaveRC(rc); 1034 return rc; 1035 } 1036 1037 int SharedClipboardURITransferSetDataChunk(PSHAREDCLIPBOARDURITRANSFER pTransfer, PVBOXCLIPBOARDDATACHUNK pDataChunk) 1038 { 1039 LogFlowFuncEnter(); 1040 1041 AssertPtrReturn(pTransfer->State.pHeader, VERR_WRONG_ORDER); 1042 1043 int rc = SharedClipboardURITransferMetaDataAdd(pTransfer, pDataChunk->pvData, pDataChunk->cbData); 1154 rc = VERR_NOT_FOUND; 1155 1156 LogFlowFuncLeaveRC(rc); 1157 return rc; 1158 } 1159 1160 int SharedClipboardURITransferEventWait(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID, RTMSINTERVAL uTimeoutMs, 1161 PSHAREDCLIPBOARDURITRANSFERPAYLOAD *ppPayload) 1162 { 1163 LogFlowFuncEnter(); 1164 1165 int rc; 1166 1167 SharedClipboardURITransferEventMap::const_iterator itEvent = pTransfer->Events.pMap->find(uID); 1168 if (itEvent != pTransfer->Events.pMap->end()) 1169 { 1170 rc = RTSemEventWait(itEvent->second->hEventSem, uTimeoutMs); 1171 if (RT_SUCCESS(rc)) 1172 { 1173 *ppPayload = itEvent->second->pPayload; 1174 1175 itEvent->second->pPayload = NULL; 1176 } 1177 } 1178 else 1179 rc = VERR_NOT_FOUND; 1180 1181 LogFlowFuncLeaveRC(rc); 1182 return rc; 1183 } 1184 1185 int SharedClipboardURITransferEventSignal(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uID, 1186 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload) 1187 { 1188 int rc; 1189 1190 SharedClipboardURITransferEventMap::const_iterator itEvent = pTransfer->Events.pMap->find(uID); 1191 if (itEvent != pTransfer->Events.pMap->end()) 1192 { 1193 Assert(itEvent->second->pPayload == NULL); 1194 1195 itEvent->second->pPayload = pPayload; 1196 1197 rc = RTSemEventSignal(itEvent->second->hEventSem); 1198 } 1199 else 1200 rc = VERR_NOT_FOUND; 1044 1201 1045 1202 LogFlowFuncLeaveRC(rc); … … 1117 1274 LogFlowFuncEnter(); 1118 1275 1119 AssertMsgReturn(pTransfer->State.enmStatus == SHAREDCLIPBOARDURITRANSFERSTATUS_R UNNING,1120 (" Transfer already is running\n"), VERR_WRONG_ORDER);1276 AssertMsgReturn(pTransfer->State.enmStatus == SHAREDCLIPBOARDURITRANSFERSTATUS_READY, 1277 ("Read transfer has wrong state (%RU32)\n", pTransfer->State.enmStatus), VERR_WRONG_ORDER); 1121 1278 1122 1279 pTransfer->State.enmStatus = SHAREDCLIPBOARDURITRANSFERSTATUS_RUNNING; … … 1166 1323 1167 1324 PVBOXCLIPBOARDDIRDATA pDirData; 1325 AssertPtr(pTransfer->ProviderIface.pfnReadDirectory); 1168 1326 int rc = pTransfer->ProviderIface.pfnReadDirectory(&pTransfer->ProviderCtx, &pDirData); 1169 1327 if (RT_SUCCESS(rc)) … … 1185 1343 1186 1344 PVBOXCLIPBOARDFILEHDR pFileHdr; 1345 AssertPtr(pTransfer->ProviderIface.pfnReadFileHdr); 1187 1346 int rc = pTransfer->ProviderIface.pfnReadFileHdr(&pTransfer->ProviderCtx, &pFileHdr); 1188 1347 if (RT_SUCCESS(rc)) … … 1196 1355 while (cbToRead) 1197 1356 { 1357 AssertPtr(pTransfer->ProviderIface.pfnReadFileData); 1198 1358 rc = pTransfer->ProviderIface.pfnReadFileData(&pTransfer->ProviderCtx, 1199 1359 pvBuf, cbBuf, 0 /* fFlags */, &cbRead); … … 1223 1383 1224 1384 PVBOXCLIPBOARDOBJHDR pObjHdr; 1385 AssertPtr(pTransfer->ProviderIface.pfnReadObjHdr); 1225 1386 int rc = pTransfer->ProviderIface.pfnReadObjHdr(&pTransfer->ProviderCtx, &pObjHdr); 1226 1387 if (RT_SUCCESS(rc)) … … 1385 1546 LogFlowFunc(("pvMeta=%p, cbMeta=%RU32\n", pvMeta, cbMeta)); 1386 1547 1548 AssertPtrReturn(pTransfer->State.pHeader, VERR_WRONG_ORDER); /* Header must be present. */ 1549 AssertReturn(SharedClipboardMetaDataGetUsed(pTransfer->State.pMeta) + cbMeta <= pTransfer->State.pHeader->cbMeta, 1550 VERR_BUFFER_OVERFLOW); 1551 1387 1552 int rc = SharedClipboardMetaDataAdd(pTransfer->State.pMeta, pvMeta, cbMeta); 1388 1553 … … 1446 1611 uint32_t cbReadTotal = 0; 1447 1612 1613 AssertPtr(pTransfer->ProviderIface.pfnReadDataHdr); 1448 1614 int rc = pTransfer->ProviderIface.pfnReadDataHdr(&pTransfer->ProviderCtx, &pTransfer->State.pHeader); 1449 1615 if (RT_SUCCESS(rc)) 1450 1616 { 1451 uint32_t cbMeta = _4K; /** @todo Improve. */ 1452 void *pvMeta = RTMemAlloc(cbMeta); 1617 if (pTransfer->Callbacks.pfnDataHeaderComplete) 1618 { 1619 SHAREDCLIPBOARDURITRANSFERCALLBACKDATA callbackData = { pTransfer, pTransfer->Callbacks.pvUser }; 1620 pTransfer->Callbacks.pfnDataHeaderComplete(&callbackData); 1621 } 1622 1623 uint32_t cbMetaToRead = pTransfer->State.pHeader->cbMeta; 1624 1625 uint32_t cbMeta = cbMetaToRead; 1626 void *pvMeta = RTMemAlloc(cbMetaToRead); 1453 1627 1454 1628 if (pvMeta) 1455 1629 { 1456 1630 AssertPtr(pTransfer->State.pHeader); 1457 uint32_t cbMetaToRead = pTransfer->State.pHeader->cbMeta;1458 1631 while (cbMetaToRead) 1459 1632 { 1633 const uint32_t cbToRead = RT_MIN(cbMetaToRead, cbMeta); 1634 1460 1635 uint32_t cbMetaRead; 1636 AssertPtr(pTransfer->ProviderIface.pfnReadDataChunk); 1461 1637 rc = pTransfer->ProviderIface.pfnReadDataChunk(&pTransfer->ProviderCtx, 1462 pTransfer->State.pHeader, pvMeta, cb Meta, 0 /* fFlags */,1463 &cbMetaRead);1638 pTransfer->State.pHeader, pvMeta, cbToRead, 1639 0 /* fFlags */, &cbMetaRead); 1464 1640 if (RT_SUCCESS(rc)) 1465 rc = sharedClipboardURITransferMetaDataAddInternal(pTransfer, pvMeta, cbMeta);1641 rc = SharedClipboardURITransferMetaDataAdd(pTransfer, pvMeta, cbMetaRead); 1466 1642 1467 1643 if (RT_FAILURE(rc)) … … 1471 1647 cbMetaToRead -= cbMetaRead; 1472 1648 1473 cbReadTotal += cb ReadTotal;1649 cbReadTotal += cbMetaRead; 1474 1650 } 1475 1651 … … 1478 1654 if (RT_SUCCESS(rc)) 1479 1655 { 1656 rc = pTransfer->pURIList->SetFromURIData(SharedClipboardMetaDataMutableRaw(pTransfer->State.pMeta), 1657 SharedClipboardMetaDataGetUsed(pTransfer->State.pMeta), 1658 SHAREDCLIPBOARDURILIST_FLAGS_NONE); 1659 if ( RT_SUCCESS(rc) 1660 && pTransfer->Callbacks.pfnDataComplete) 1661 { 1662 SHAREDCLIPBOARDURITRANSFERCALLBACKDATA callbackData = { pTransfer, pTransfer->Callbacks.pvUser }; 1663 pTransfer->Callbacks.pfnDataComplete(&callbackData); 1664 } 1665 1480 1666 if (pcbRead) 1481 1667 *pcbRead = cbReadTotal; … … 1509 1695 uint32_t cbWrittenTotal = 0; 1510 1696 1697 AssertPtr(pTransfer->ProviderIface.pfnWriteDataHdr); 1511 1698 int rc = pTransfer->ProviderIface.pfnWriteDataHdr(&pTransfer->ProviderCtx, pTransfer->State.pHeader); 1512 1699 if (RT_SUCCESS(rc)) … … 1519 1706 { 1520 1707 uint32_t cbMetaWritten; 1708 AssertPtr(pTransfer->ProviderIface.pfnWriteDataChunk); 1521 1709 rc = pTransfer->ProviderIface.pfnWriteDataChunk(&pTransfer->ProviderCtx, pTransfer->State.pHeader, 1522 1710 (uint8_t *)pTransfer->State.pMeta->pvMeta + cbWrittenTotal, … … 1584 1772 dirData.cbPath = (uint32_t)strlen(dirData.pszPath); 1585 1773 1774 AssertPtr(pTransfer->ProviderIface.pfnWriteDirectory); 1586 1775 rc = pTransfer->ProviderIface.pfnWriteDirectory(&pTransfer->ProviderCtx, &dirData); 1587 1776 … … 1608 1797 fileHdr.fMode = pObj->GetMode(); 1609 1798 1799 AssertPtr(pTransfer->ProviderIface.pfnWriteFileHdr); 1610 1800 rc = pTransfer->ProviderIface.pfnWriteFileHdr(&pTransfer->ProviderCtx, &fileHdr); 1611 1801 SharedClipboardURIFileHdrDestroy(&fileHdr); … … 1626 1816 { 1627 1817 uint32_t cbToRead = cbRead; 1818 AssertPtr(pTransfer->ProviderIface.pfnWriteFileData); 1628 1819 rc = pTransfer->ProviderIface.pfnWriteFileData(&pTransfer->ProviderCtx, 1629 1820 pvData, cbToRead, 0 /* fFlags */, &cbRead); … … 1705 1896 LogFlowFuncEnter(); 1706 1897 1707 AssertMsgReturn(pTransfer->State.enmStatus == SHAREDCLIPBOARDURITRANSFERSTATUS_R UNNING,1708 (" Transfer already is running\n"), VERR_WRONG_ORDER);1898 AssertMsgReturn(pTransfer->State.enmStatus == SHAREDCLIPBOARDURITRANSFERSTATUS_READY, 1899 ("Write transfer has wrong state (%RU32)\n", pTransfer->State.enmStatus), VERR_WRONG_ORDER); 1709 1900 1710 1901 pTransfer->State.enmStatus = SHAREDCLIPBOARDURITRANSFERSTATUS_RUNNING; … … 1794 1985 } 1795 1986 1796 pURI->cRunning = 0; 1797 #ifdef DEBUG 1798 pURI->cTransfer = 0; 1799 #endif 1987 pURI->cRunning = 0; 1988 pURI->cTransfers = 0; 1800 1989 } 1801 1990 … … 1835 2024 RTListAppend(&pURI->List, &pTransfer->Node); 1836 2025 1837 #ifdef DEBUG 1838 pURI->cTransfer++; 1839 LogFlowFunc(("cTransfers=%RU32, cRunning=%RU32\n", pURI->cTransfer, pURI->cRunning)); 1840 #endif 2026 pURI->cTransfers++; 2027 LogFlowFunc(("cTransfers=%RU32, cRunning=%RU32\n", pURI->cTransfers, pURI->cRunning)); 1841 2028 1842 2029 return VINF_SUCCESS; … … 1896 2083 * Returns the number of running URI transfers. 1897 2084 * 1898 * @returns VBox status code.2085 * @returns Number of running transfers. 1899 2086 * @param pURI URI clipboard context to return number for. 1900 2087 */ … … 1903 2090 AssertPtrReturn(pURI, 0); 1904 2091 return pURI->cRunning; 2092 } 2093 2094 /** 2095 * Returns the number of total URI transfers. 2096 * 2097 * @returns Number of total transfers. 2098 * @param pURI URI clipboard context to return number for. 2099 */ 2100 uint32_t SharedClipboardURICtxGetTotalTransfers(PSHAREDCLIPBOARDURICTX pURI) 2101 { 2102 AssertPtrReturn(pURI, 0); 2103 return pURI->cTransfers; 1905 2104 } 1906 2105 … … 1926 2125 RTListNodeRemove(&pTransfer->Node); 1927 2126 1928 #ifdef DEBUG 1929 Assert(pURI->cTransfer); 1930 pURI->cTransfer--; 1931 1932 LogFlowFunc(("cTransfers=%RU32\n", pURI->cTransfer)); 1933 #endif 2127 Assert(pURI->cTransfers); 2128 pURI->cTransfers--; 2129 2130 LogFlowFunc(("cTransfers=%RU32\n", pURI->cTransfers)); 1934 2131 } 1935 2132 } -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp
r79351 r79366 852 852 int rc; 853 853 854 if (pTransfer->pvUser) 855 { 856 Assert(pTransfer->cbUser == sizeof(SharedClipboardWinURITransferCtx)); 857 SharedClipboardWinURITransferCtx *pWinURITransferCtx = (SharedClipboardWinURITransferCtx *)pTransfer->pvUser; 858 Assert(pWinURITransferCtx); 859 860 if (pWinURITransferCtx->pDataObj) 861 delete pWinURITransferCtx->pDataObj; 862 } 854 AssertReturn(pTransfer->pvUser == NULL, VERR_WRONG_ORDER); 863 855 864 856 SharedClipboardWinURITransferCtx *pWinURITransferCtx = new SharedClipboardWinURITransferCtx(); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r79347 r79366 29 29 #include <VBox/GuestHost/SharedClipboard.h> 30 30 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 31 # include <iprt/semaphore.h> 31 32 # include <VBox/GuestHost/SharedClipboard-uri.h> 32 33 #endif … … 43 44 44 45 struct VBOXCLIPBOARDCLIENTSTATE; 45 46 /**47 * Structure for maintaining a single URI transfer.48 * A transfer can contain one or multiple files / directories.49 */50 typedef struct _VBOXCLIPBOARDCLIENTURITRANSFER51 {52 /** Node for keeping this transfer in a RTList. */53 RTLISTNODE Node;54 /** Pointer to the client state (parent). */55 VBOXCLIPBOARDCLIENTSTATE *pState;56 /** The transfer's own (local) area.57 * The area itself has a clipboard area ID assigned, which gets shared (maintained / locked) across all58 * VMs via VBoxSVC. */59 SharedClipboardArea Area;60 /** The transfer's URI list, containing the fs object root entries. */61 SharedClipboardURIList List;62 /** Current object being handled. */63 VBOXCLIPBOARDCLIENTURIOBJCTX ObjCtx;64 /** The transfer header, needed for verification and accounting. */65 VBOXCLIPBOARDDATAHDR Hdr;66 /** Intermediate meta data object. */67 SHAREDCLIPBOARDMETADATA Meta;68 } VBOXCLIPBOARDCLIENTURITRANSFER, *PVBOXCLIPBOARDCLIENTURITRANSFER;69 46 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */ 70 47 … … 162 139 163 140 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 141 int VBoxSvcClipboardProviderImplURIReadDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDATAHDR *ppDataHdr); 142 int VBoxSvcClipboardProviderImplURIWriteDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr); 143 int VBoxSvcClipboardProviderImplURIReadDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbRead); 144 int VBoxSvcClipboardProviderImplURIWriteDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbWritten); 145 int VBoxSvcClipboardProviderImplURIReadDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDIRDATA *ppDirData); 146 int VBoxSvcClipboardProviderImplURIWriteDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDIRDATA pDirData); 147 int VBoxSvcClipboardProviderImplURIReadFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDFILEHDR *ppFileHdr); 148 int VBoxSvcClipboardProviderImplURIWriteFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDFILEHDR pFileHdr); 149 int VBoxSvcClipboardProviderImplURIReadFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead); 150 int VBoxSvcClipboardProviderImplURIWriteFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten); 151 152 DECLCALLBACK(void) VBoxSvcClipboardURITransferPrepareCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 153 DECLCALLBACK(void) VBoxSvcClipboardURIDataHeaderCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 154 DECLCALLBACK(void) VBoxSvcClipboardURIDataCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 155 DECLCALLBACK(void) VBoxSvcClipboardURITransferCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc); 156 DECLCALLBACK(void) VBoxSvcClipboardURITransferCanceledCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 157 DECLCALLBACK(void) VBoxSvcClipboardURITransferErrorCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc); 158 164 159 int VBoxClipboardSvcImplURITransferCreate(PVBOXCLIPBOARDCLIENTDATA pClientData, PSHAREDCLIPBOARDURITRANSFER pTransfer); 165 160 int VBoxClipboardSvcImplURITransferDestroy(PVBOXCLIPBOARDCLIENTDATA pClientData, PSHAREDCLIPBOARDURITRANSFER pTransfer); 166 161 167 int VBoxClipboardSvcImplURIReadDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDATAHDR *ppDataHdr); 168 int VBoxClipboardSvcImplURIWriteDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr); 169 int VBoxClipboardSvcImplURIReadDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbRead); 170 int VBoxClipboardSvcImplURIWriteDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbWritten); 171 172 int VBoxClipboardSvcImplURIReadDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDIRDATA *ppDirData); 173 int VBoxClipboardSvcImplURIWriteDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDIRDATA pDirData); 174 175 int VBoxClipboardSvcImplURIReadFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDFILEHDR *ppFileHdr); 176 int VBoxClipboardSvcImplURIWriteFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDFILEHDR pFileHdr); 177 int VBoxClipboardSvcImplURIReadFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead); 178 int VBoxClipboardSvcImplURIWriteFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten); 162 void VBoxClipboardSvcImplURIOnDataHeaderComplete(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 179 163 #endif 180 164 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-uri.cpp
r79347 r79366 43 43 44 44 45 static DECLCALLBACK(int) vboxSvcClipboardURIProviderImplReadDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, 46 PVBOXCLIPBOARDDATAHDR *ppDataHdr) 47 { 48 RT_NOREF(pCtx, ppDataHdr); 45 /********************************************************************************************************************************* 46 * Provider implementation * 47 *********************************************************************************************************************************/ 48 49 int VBoxSvcClipboardProviderImplURIReadDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDATAHDR *ppDataHdr) 50 { 51 LogFlowFuncEnter(); 52 53 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pCtx->pvUser; 54 AssertPtr(pClientData); 55 56 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload; 57 int rc = SharedClipboardURITransferEventWait(pCtx->pTransfer, SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_HDR, 58 30 * 1000 /* Timeout in ms */, &pPayload); 59 if (RT_SUCCESS(rc)) 60 { 61 Assert(pPayload->cbData == sizeof(VBOXCLIPBOARDDATAHDR)); 62 *ppDataHdr = (PVBOXCLIPBOARDDATAHDR)pPayload->pvData; 63 64 RTMemFree(pPayload); 65 } 66 67 LogFlowFuncLeaveRC(rc); 68 return rc; 69 } 70 71 int VBoxSvcClipboardProviderImplURIWriteDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr) 72 { 73 RT_NOREF(pCtx, pDataHdr); 74 75 LogFlowFuncEnter(); 76 49 77 return VERR_NOT_IMPLEMENTED; 50 78 } 51 79 52 static DECLCALLBACK(int) vboxSvcClipboardURIProviderImplReadObjHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, 53 PVBOXCLIPBOARDDATAHDR *ppDataHdr) 54 { 55 RT_NOREF(pCtx, ppDataHdr); 80 int VBoxSvcClipboardProviderImplURIReadDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, 81 void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbRead) 82 { 83 RT_NOREF(pDataHdr, fFlags); 84 85 LogFlowFuncEnter(); 86 87 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pCtx->pvUser; 88 AssertPtr(pClientData); 89 90 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload; 91 int rc = SharedClipboardURITransferEventWait(pCtx->pTransfer, SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_CHUNK, 92 30 * 1000 /* Timeout in ms */, &pPayload); 93 if (RT_SUCCESS(rc)) 94 { 95 Assert(pPayload->cbData == sizeof(VBOXCLIPBOARDDATACHUNK)); 96 97 const uint32_t cbToRead = RT_MIN(cbChunk, pPayload->cbData); 98 99 memcpy(pvChunk, pPayload->pvData, cbToRead); 100 101 SharedClipboardURITransferPayloadFree(pPayload); 102 103 if (pcbRead) 104 *pcbRead = cbToRead; 105 } 106 107 LogFlowFuncLeaveRC(rc); 108 return rc; 109 } 110 111 int VBoxSvcClipboardProviderImplURIWriteDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, 112 const void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbWritten) 113 { 114 RT_NOREF(pCtx, pDataHdr, pvChunk, cbChunk, fFlags, pcbWritten); 115 116 LogFlowFuncEnter(); 117 56 118 return VERR_NOT_IMPLEMENTED; 57 119 } 58 120 59 static DECLCALLBACK(int) vboxSvcClipboardURIProviderImplReadDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, 60 PVBOXCLIPBOARDDIRDATA *ppDirData) 121 int VBoxSvcClipboardProviderImplURIReadDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDIRDATA *ppDirData) 61 122 { 62 123 RT_NOREF(pCtx, ppDirData); 124 125 LogFlowFuncEnter(); 126 63 127 return VERR_NOT_IMPLEMENTED; 64 128 } 65 129 66 static DECLCALLBACK(int) vboxSvcClipboardURIProviderImplReadFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, 67 PVBOXCLIPBOARDFILEHDR *ppFileHdr) 130 int VBoxSvcClipboardProviderImplURIWriteDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDIRDATA pDirData) 131 { 132 RT_NOREF(pCtx, pDirData); 133 134 LogFlowFuncEnter(); 135 136 return VERR_NOT_IMPLEMENTED; 137 } 138 139 int VBoxSvcClipboardProviderImplURIReadFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDFILEHDR *ppFileHdr) 68 140 { 69 141 RT_NOREF(pCtx, ppFileHdr); 142 143 LogFlowFuncEnter(); 144 70 145 return VERR_NOT_IMPLEMENTED; 71 146 } 72 147 73 static DECLCALLBACK(int) vboxSvcClipboardURIProviderImplReadFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtX, 74 void *pvData, uint32_t cbData, uint32_t fFlags, 75 uint32_t *pcbRead) 76 { 77 #if 0 78 const PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pCtx->pvUser; 79 80 return pObjCtx->pObj->Read(pvBuf, cbBuf, pcbWritten); 81 #endif 82 83 RT_NOREF(pCtX, pvData, cbData, fFlags, pcbRead); 148 int VBoxSvcClipboardProviderImplURIWriteFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDFILEHDR pFileHdr) 149 { 150 RT_NOREF(pCtx, pFileHdr); 151 152 LogFlowFuncEnter(); 153 84 154 return VERR_NOT_IMPLEMENTED; 85 155 } 86 156 87 #if 0 88 int vboxSvcClipboardURIAnnounce(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 89 { 90 Provider.pfnReadDataHdr = vboxSvcClipboardURIProviderImplReadDataHdr; 91 Provider.pfnReadDataChunk = vboxSvcClipboardURIProviderImplReadDataChunk; 92 Provider.pfnReadDir = vboxSvcClipboardURIProviderImplReadDir; 93 Provider.pfnReadFileHdr = vboxSvcClipboardURIProviderImplReadFileHdr; 94 Provider.pfnReadFileData = vboxSvcClipboardURIProviderImplReadFileData; 95 96 Provider.pvUser = 97 98 SharedClipboardURITransferSetProvider(&Provider); 99 100 return rc; 101 } 102 #endif 157 int VBoxSvcClipboardProviderImplURIReadFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, 158 uint32_t *pcbRead) 159 { 160 RT_NOREF(pCtx, pvData, cbData, fFlags, pcbRead); 161 162 LogFlowFuncEnter(); 163 164 return VERR_NOT_IMPLEMENTED; 165 } 166 167 int VBoxSvcClipboardProviderImplURIWriteFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, 168 uint32_t *pcbWritten) 169 { 170 RT_NOREF(pCtx, pvData, cbData, fFlags, pcbWritten); 171 172 LogFlowFuncEnter(); 173 174 return VERR_NOT_IMPLEMENTED; 175 } 176 177 /********************************************************************************************************************************* 178 * URI callbacks * 179 *********************************************************************************************************************************/ 180 181 DECLCALLBACK(void) VBoxSvcClipboardURITransferPrepareCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 182 { 183 LogFlowFuncEnter(); 184 185 LogFlowFuncEnter(); 186 187 AssertPtrReturnVoid(pData); 188 189 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pData->pvUser; 190 AssertPtrReturnVoid(pClientData); 191 192 /* Tell the guest that it can start sending URI data. */ 193 int rc2 = vboxSvcClipboardReportMsg(pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, 194 VBOX_SHARED_CLIPBOARD_FMT_URI_LIST); 195 AssertRC(rc2); 196 197 rc2 = SharedClipboardURITransferEventRegister(pData->pTransfer, SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_HDR); 198 AssertRC(rc2); 199 rc2 = SharedClipboardURITransferEventRegister(pData->pTransfer, SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_CHUNK); 200 AssertRC(rc2); 201 } 202 203 DECLCALLBACK(void) VBoxSvcClipboardURIDataHeaderCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 204 { 205 LogFlowFuncEnter(); 206 207 RT_NOREF(pData); 208 } 209 210 DECLCALLBACK(void) VBoxSvcClipboardURIDataCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 211 { 212 LogFlowFuncEnter(); 213 214 VBoxClipboardSvcImplURIOnDataHeaderComplete(pData); 215 } 216 217 DECLCALLBACK(void) VBoxSvcClipboardURITransferCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc) 218 { 219 LogFlowFuncEnter(); 220 221 RT_NOREF(pData, rc); 222 223 LogRel2(("Shared Clipboard: Transfer complete\n")); 224 } 225 226 DECLCALLBACK(void) VBoxSvcClipboardURITransferCanceledCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 227 { 228 LogFlowFuncEnter(); 229 230 RT_NOREF(pData); 231 232 LogRel2(("Shared Clipboard: Transfer canceled\n")); 233 } 234 235 DECLCALLBACK(void) VBoxSvcClipboardURITransferErrorCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc) 236 { 237 LogFlowFuncEnter(); 238 239 RT_NOREF(pData, rc); 240 241 LogRel(("Shared Clipboard: Transfer failed with %Rrc\n", rc)); 242 } 103 243 104 244 /** … … 497 637 } 498 638 499 if (!SharedClipboardURICtxGet RunningTransfers(&pClientData->URI))500 { 501 LogFunc(("No runningtransfers found\n"));639 if (!SharedClipboardURICtxGetTotalTransfers(&pClientData->URI)) 640 { 641 LogFunc(("No transfers found\n")); 502 642 return VERR_WRONG_ORDER; 503 643 } … … 534 674 rc = SharedClipboardURIDataHdrInit(&dataHdr); 535 675 if (RT_SUCCESS(rc)) 676 { 536 677 rc = VBoxSvcClipboardURIGetDataHdr(cParms, paParms, &dataHdr); 537 /*if (RT_SUCCESS(rc)) 538 rc = SharedClipboardURITransferSetDataHeader(&dataHdr);*/ 678 if (RT_SUCCESS(rc)) 679 { 680 void *pvData = SharedClipboardURIDataHdrDup(&dataHdr); 681 uint32_t cbData = sizeof(VBOXCLIPBOARDDATAHDR); 682 683 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload; 684 rc = SharedClipboardURITransferPayloadAlloc(SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_HDR, 685 pvData, cbData, &pPayload); 686 if (RT_SUCCESS(rc)) 687 { 688 rc = SharedClipboardURITransferEventSignal(pTransfer, SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_HDR, 689 pPayload); 690 } 691 } 692 } 539 693 break; 540 694 } … … 553 707 rc = SharedClipboardURIDataChunkInit(&dataChunk); 554 708 if (RT_SUCCESS(rc)) 709 { 555 710 rc = VBoxSvcClipboardURIGetDataChunk(cParms, paParms, &dataChunk); 556 #if 0 557 if (RT_SUCCESS(rc)) 558 { 559 VBOXCLIPBOARDTRANSFEREVENT Event = { &dataChunk, sizeof(dataChunk) }; 560 rc = SharedClipboardURITransferSendEvent(WRITE_DATA_CHUNK, &Event); 711 if (RT_SUCCESS(rc)) 712 { 713 void *pvData = SharedClipboardURIDataChunkDup(&dataChunk); 714 uint32_t cbData = sizeof(VBOXCLIPBOARDDATACHUNK); 715 716 PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload; 717 rc = SharedClipboardURITransferPayloadAlloc(SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_CHUNK, 718 pvData, cbData, &pPayload); 719 if (RT_SUCCESS(rc)) 720 { 721 rc = SharedClipboardURITransferEventSignal(pTransfer, SHAREDCLIPBOARDURITRANSFEREVENTTYPE_METADATA_CHUNK, 722 pPayload); 723 } 724 725 } 561 726 } 562 #endif563 727 break; 564 728 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r79347 r79366 138 138 Assert(pCtx->pClientData->State.data.pv == NULL && pCtx->pClientData->State.data.cb == 0 && pCtx->pClientData->State.data.u32Format == 0); 139 139 140 LogFlowFunc(("fFormat=%02X \n", fFormat));140 LogFlowFunc(("fFormat=%02X, uTimeoutMs=%RU32\n", fFormat, uTimeoutMs)); 141 141 142 142 int rc = vboxSvcClipboardReportMsg(pCtx->pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, fFormat); … … 770 770 771 771 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 772 DECLCALLBACK(void) vboxClipboardSvcWinURITransferPrepareCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 773 { 774 LogFlowFuncEnter(); 775 776 AssertPtrReturnVoid(pData); 777 778 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pData->pvUser; 779 AssertPtrReturnVoid(pClientData); 780 781 /* Tell the guest that it can start sending URI data. */ 782 int rc2 = vboxSvcClipboardReportMsg(pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, 783 VBOX_SHARED_CLIPBOARD_FMT_URI_LIST); 784 AssertRC(rc2); 785 } 786 787 DECLCALLBACK(void) vboxClipboardSvcWinURIDataCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 772 void VBoxClipboardSvcImplURIOnDataHeaderComplete(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData) 788 773 { 789 774 LogFlowFuncEnter(); … … 804 789 int VBoxClipboardSvcImplURITransferCreate(PVBOXCLIPBOARDCLIENTDATA pClientData, PSHAREDCLIPBOARDURITRANSFER pTransfer) 805 790 { 791 RT_NOREF(pClientData, pTransfer); 792 806 793 LogFlowFuncEnter(); 807 794 808 /* Register needed callbacks so that we can wait for the meta data to arrive here. */809 SHAREDCLIPBOARDURITRANSFERCALLBACKS Callbacks;810 RT_ZERO(Callbacks);811 812 Callbacks.pvUser = pClientData;813 Callbacks.pfnTransferPrepare = vboxClipboardSvcWinURITransferPrepareCallback;814 815 SharedClipboardURITransferSetCallbacks(pTransfer, &Callbacks);816 817 795 return VINF_SUCCESS; 818 796 } … … 826 804 return VINF_SUCCESS; 827 805 } 828 829 int VBoxClipboardSvcImplURIReadDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDATAHDR *ppDataHdr)830 {831 RT_NOREF(ppDataHdr);832 833 LogFlowFuncEnter();834 835 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pCtx->pvUser;836 AssertPtr(pClientData);837 838 839 return VERR_NOT_IMPLEMENTED;840 }841 842 int VBoxClipboardSvcImplURIWriteDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr)843 {844 RT_NOREF(pCtx, pDataHdr);845 return VERR_NOT_IMPLEMENTED;846 }847 848 int VBoxClipboardSvcImplURIReadDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr,849 void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbRead)850 {851 RT_NOREF(pCtx, pDataHdr, pvChunk, cbChunk, fFlags, pcbRead);852 return VERR_NOT_IMPLEMENTED;853 }854 855 int VBoxClipboardSvcImplURIWriteDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr,856 const void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbWritten)857 {858 RT_NOREF(pCtx, pDataHdr, pvChunk, cbChunk, fFlags, pcbWritten);859 return VERR_NOT_IMPLEMENTED;860 }861 862 int VBoxClipboardSvcImplURIReadDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDIRDATA *ppDirData)863 {864 RT_NOREF(pCtx, ppDirData);865 return VERR_NOT_IMPLEMENTED;866 }867 868 int VBoxClipboardSvcImplURIWriteDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDIRDATA pDirData)869 {870 RT_NOREF(pCtx, pDirData);871 return VERR_NOT_IMPLEMENTED;872 }873 874 int VBoxClipboardSvcImplURIReadFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDFILEHDR *ppFileHdr)875 {876 RT_NOREF(pCtx, ppFileHdr);877 return VERR_NOT_IMPLEMENTED;878 }879 880 int VBoxClipboardSvcImplURIWriteFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDFILEHDR pFileHdr)881 {882 RT_NOREF(pCtx, pFileHdr);883 return VERR_NOT_IMPLEMENTED;884 }885 886 int VBoxClipboardSvcImplURIReadFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags,887 uint32_t *pcbRead)888 {889 RT_NOREF(pCtx, pvData, cbData, fFlags, pcbRead);890 return VERR_NOT_IMPLEMENTED;891 }892 893 int VBoxClipboardSvcImplURIWriteFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags,894 uint32_t *pcbWritten)895 {896 RT_NOREF(pCtx, pvData, cbData, fFlags, pcbWritten);897 return VERR_NOT_IMPLEMENTED;898 }899 806 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */ 900 807 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r79347 r79366 677 677 678 678 RT_ZERO(creationCtx.Interface); 679 creationCtx.Interface.pfnReadDataHdr = VBoxClipboardSvcImplURIReadDataHdr; 680 creationCtx.Interface.pfnReadDataChunk = VBoxClipboardSvcImplURIReadDataChunk; 681 creationCtx.Interface.pfnReadDirectory = VBoxClipboardSvcImplURIReadDir; 682 creationCtx.Interface.pfnReadFileHdr = VBoxClipboardSvcImplURIReadFileHdr; 683 creationCtx.Interface.pfnReadFileData = VBoxClipboardSvcImplURIReadFileData; 684 685 creationCtx.Interface.pfnWriteDataHdr = VBoxClipboardSvcImplURIWriteDataHdr; 686 creationCtx.Interface.pfnWriteDataChunk = VBoxClipboardSvcImplURIWriteDataChunk; 687 creationCtx.Interface.pfnWriteDirectory = VBoxClipboardSvcImplURIWriteDir; 688 creationCtx.Interface.pfnWriteFileHdr = VBoxClipboardSvcImplURIWriteFileHdr; 689 creationCtx.Interface.pfnWriteFileData = VBoxClipboardSvcImplURIWriteFileData; 679 creationCtx.Interface.pfnReadDataHdr = VBoxSvcClipboardProviderImplURIReadDataHdr; 680 creationCtx.Interface.pfnReadDataChunk = VBoxSvcClipboardProviderImplURIReadDataChunk; 681 creationCtx.Interface.pfnReadDirectory = VBoxSvcClipboardProviderImplURIReadDir; 682 creationCtx.Interface.pfnReadFileHdr = VBoxSvcClipboardProviderImplURIReadFileHdr; 683 creationCtx.Interface.pfnReadFileData = VBoxSvcClipboardProviderImplURIReadFileData; 690 684 691 685 creationCtx.pvUser = pClientData; 692 686 693 creationCtx.u.HostService.pArea = pTransfer->pArea; 687 /* Register needed callbacks so that we can wait for the meta data to arrive here. */ 688 SHAREDCLIPBOARDURITRANSFERCALLBACKS Callbacks; 689 RT_ZERO(Callbacks); 690 691 Callbacks.pvUser = pClientData; 692 693 Callbacks.pfnTransferPrepare = VBoxSvcClipboardURITransferPrepareCallback; 694 Callbacks.pfnDataHeaderComplete = VBoxSvcClipboardURIDataHeaderCompleteCallback; 695 Callbacks.pfnDataComplete = VBoxSvcClipboardURIDataCompleteCallback; 696 Callbacks.pfnTransferComplete = VBoxSvcClipboardURITransferCompleteCallback; 697 Callbacks.pfnTransferCanceled = VBoxSvcClipboardURITransferCanceledCallback; 698 Callbacks.pfnTransferError = VBoxSvcClipboardURITransferErrorCallback; 699 700 SharedClipboardURITransferSetCallbacks(pTransfer, &Callbacks); 694 701 695 702 rc = SharedClipboardURITransferProviderCreate(pTransfer, &creationCtx); … … 790 797 RT_ZERO(creationCtx.Interface); 791 798 792 creationCtx.Interface.pfnReadDataHdr = VBoxClipboardSvcImplURIReadDataHdr; 793 creationCtx.Interface.pfnReadDataChunk = VBoxClipboardSvcImplURIReadDataChunk; 794 creationCtx.Interface.pfnReadDirectory = VBoxClipboardSvcImplURIReadDir; 795 creationCtx.Interface.pfnReadFileHdr = VBoxClipboardSvcImplURIReadFileHdr; 796 creationCtx.Interface.pfnReadFileData = VBoxClipboardSvcImplURIReadFileData; 797 798 creationCtx.Interface.pfnWriteDataHdr = VBoxClipboardSvcImplURIWriteDataHdr; 799 creationCtx.Interface.pfnWriteDataChunk = VBoxClipboardSvcImplURIWriteDataChunk; 800 creationCtx.Interface.pfnWriteDirectory = VBoxClipboardSvcImplURIWriteDir; 801 creationCtx.Interface.pfnWriteFileHdr = VBoxClipboardSvcImplURIWriteFileHdr; 802 creationCtx.Interface.pfnWriteFileData = VBoxClipboardSvcImplURIWriteFileData; 799 creationCtx.Interface.pfnWriteDataHdr = VBoxSvcClipboardProviderImplURIWriteDataHdr; 800 creationCtx.Interface.pfnWriteDataChunk = VBoxSvcClipboardProviderImplURIWriteDataChunk; 801 creationCtx.Interface.pfnWriteDirectory = VBoxSvcClipboardProviderImplURIWriteDir; 802 creationCtx.Interface.pfnWriteFileHdr = VBoxSvcClipboardProviderImplURIWriteFileHdr; 803 creationCtx.Interface.pfnWriteFileData = VBoxSvcClipboardProviderImplURIWriteFileData; 803 804 804 805 creationCtx.pvUser = pClientData; 805 806 creationCtx.u.HostService.pArea = pTransfer->pArea;807 806 808 807 rc = SharedClipboardURITransferProviderCreate(pTransfer, &creationCtx);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器