Changeset 85681 in vbox for trunk/src/VBox
- Timestamp:
- Aug 11, 2020 9:36:37 AM (4 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.h
r85371 r85681 29 29 class VBoxDnDWnd; 30 30 31 /** 32 * Class for implementing IDataObject for VBoxTray's DnD support. 33 */ 31 34 class VBoxDnDDataObject : public IDataObject 32 35 { … … 80 83 LONG lindex = -1, DWORD dwAspect = DVASPECT_CONTENT, DVTARGETDEVICE *pTargetDevice = NULL); 81 84 85 /** Current drag and drop status. */ 82 86 Status mStatus; 87 /** Internal reference count of this object. */ 83 88 LONG mRefCount; 89 /** Number of native formats registered. This can be a different number than supplied with m_lstFormats. */ 84 90 ULONG mcFormats; 91 /** Array of registered FORMATETC structs. Matches m_cFormats. */ 85 92 LPFORMATETC mpFormatEtc; 93 /** Array of registered STGMEDIUM structs. Matches m_cFormats. */ 86 94 LPSTGMEDIUM mpStgMedium; 95 /** Event semaphore used for waiting on status changes. */ 87 96 RTSEMEVENT mEventDropped; 97 /** Format of currently retrieved data. */ 88 98 RTCString mstrFormat; 99 /** The retrieved data as a raw buffer. */ 89 100 void *mpvData; 101 /** Raw buffer size (in bytes). */ 90 102 size_t mcbData; 91 103 }; 92 104 105 /** 106 * Class for implementing IDropSource for VBoxTray's DnD support. 107 */ 93 108 class VBoxDnDDropSource : public IDropSource 94 109 { … … 125 140 }; 126 141 142 /** 143 * Class for implementing IDropTarget for VBoxTray's DnD support. 144 */ 127 145 class VBoxDnDDropTarget : public IDropTarget 128 146 { … … 153 171 public: 154 172 173 /** Returns the data as mutable raw. Use with caution! */ 155 174 void *DataMutableRaw(void) const { return mpvData; } 175 176 /** Returns the data size (in bytes). */ 156 177 size_t DataSize(void) const { return mcbData; } 178 157 179 RTCString Formats(void) const; 158 180 int WaitForDrop(RTMSINTERVAL msTimeout); … … 181 203 }; 182 204 205 /** 206 * Class for implementing IEnumFORMATETC for VBoxTray's DnD support. 207 */ 183 208 class VBoxDnDEnumFormatEtc : public IEnumFORMATETC 184 209 { … … 206 231 private: 207 232 233 /** Reference count of this object. */ 208 234 LONG m_lRefCount; 235 /** Current index for format iteration. */ 209 236 ULONG m_nIndex; 237 /** Number of format this object contains. */ 210 238 ULONG m_nNumFormats; 239 /** Array of FORMATETC formats this object contains. Matches m_nNumFormats. */ 211 240 LPFORMATETC m_pFormatEtc; 212 241 }; … … 215 244 class VBoxDnDWnd; 216 245 217 /* 246 /** 218 247 * A drag'n drop event from the host. 219 248 */ … … 371 400 * window messages. */ 372 401 RTTHREAD hThread; 402 /** Critical section to serialize access. */ 373 403 RTCRITSECT mCritSect; 404 /** Event semaphore to wait for new DnD events. */ 374 405 RTSEMEVENT mEventSem; 375 406 #ifdef RT_OS_WINDOWS … … 393 424 bool mfMouseButtonDown; 394 425 # ifdef VBOX_WITH_DRAG_AND_DROP_GH 395 /** IDropTarget implementation for guest -> host396 * support. */426 /** Pointer to IDropTarget implementation for 427 * guest -> host support. */ 397 428 VBoxDnDDropTarget *pDropTarget; 398 429 # endif /* VBOX_WITH_DRAG_AND_DROP_GH */ -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDataObject.cpp
r85371 r85681 173 173 } 174 174 175 /**176 * Retrieves the data stored in this object and store the result in177 * pMedium.178 *179 * @return IPRT status code.180 * @return HRESULT181 * @param pFormatEtc182 * @param pMedium183 */184 175 STDMETHODIMP VBoxDnDDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) 185 176 { … … 416 407 } 417 408 418 /**419 * Only required for IStream / IStorage interfaces.420 *421 * @return IPRT status code.422 * @return HRESULT423 * @param pFormatEtc424 * @param pMedium425 */426 409 STDMETHODIMP VBoxDnDDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) 427 410 { … … 431 414 } 432 415 433 /**434 * Query if this objects supports a specific format.435 *436 * @return IPRT status code.437 * @return HRESULT438 * @param pFormatEtc439 */440 416 STDMETHODIMP VBoxDnDDataObject::QueryGetData(LPFORMATETC pFormatEtc) 441 417 { … … 496 472 */ 497 473 474 /** 475 * Aborts waiting for data being "dropped". 476 * 477 * @returns VBox status code. 478 */ 498 479 int VBoxDnDDataObject::Abort(void) 499 480 { … … 503 484 } 504 485 486 /** 487 * Static helper function to convert a CLIPFORMAT to a string and return it. 488 * 489 * @returns Pointer to converted stringified CLIPFORMAT, or "unknown" if not found / invalid. 490 * @param fmt CLIPFORMAT to return string for. 491 */ 505 492 /* static */ 506 493 const char* VBoxDnDDataObject::ClipboardFormatToString(CLIPFORMAT fmt) … … 586 573 } 587 574 575 /** 576 * Checks whether a given FORMATETC is supported by this data object and returns its index. 577 * 578 * @returns \c true if format is supported, \c false if not. 579 * @param pFormatEtc Pointer to FORMATETC to check for. 580 * @param puIndex Where to store the index if format is supported. 581 */ 588 582 bool VBoxDnDDataObject::LookupFormatEtc(LPFORMATETC pFormatEtc, ULONG *puIndex) 589 583 { … … 632 626 } 633 627 628 /** 629 * Registers a new format with this data object. 630 * 631 * @param pFormatEtc Where to store the new format into. 632 * @param clipFormat Clipboard format to register. 633 * @param tyMed Format medium type to register. 634 * @param lIndex Format index to register. 635 * @param dwAspect Format aspect to register. 636 * @param pTargetDevice Format target device to register. 637 */ 634 638 void VBoxDnDDataObject::RegisterFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat, 635 639 TYMED tyMed, LONG lIndex, DWORD dwAspect, … … 648 652 } 649 653 654 /** 655 * Sets the current status of this data object. 656 * 657 * @param status New status to set. 658 */ 650 659 void VBoxDnDDataObject::SetStatus(Status status) 651 660 { … … 654 663 } 655 664 665 /** 666 * Signals that data has been "dropped". 667 * 668 * @returns VBox status code. 669 * @param strFormat Format of data (MIME string). 670 * @param pvData Pointer to data. 671 * @param cbData Size (in bytes) of data. 672 */ 656 673 int VBoxDnDDataObject::Signal(const RTCString &strFormat, 657 674 const void *pvData, size_t cbData) -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDropTarget.cpp
r85520 r85681 94 94 } 95 95 96 /** 97 * Static helper function to dump supported formats of a data object. 98 * 99 * @param pDataObject Pointer to data object to dump formats for. 100 */ 96 101 /* static */ 97 102 void VBoxDnDDropTarget::DumpFormats(IDataObject *pDataObject) … … 559 564 } 560 565 566 /** 567 * Static helper function to return a drop effect for a given key state and allowed effects. 568 * 569 * @returns Resolved drop effect. 570 * @param grfKeyState Key state to determine drop effect for. 571 * @param dwAllowedEffects Allowed drop effects to determine drop effect for. 572 */ 561 573 /* static */ 562 574 DWORD VBoxDnDDropTarget::GetDropEffect(DWORD grfKeyState, DWORD dwAllowedEffects) … … 588 600 } 589 601 602 /** 603 * Resets a drop target object. 604 */ 590 605 void VBoxDnDDropTarget::reset(void) 591 606 { … … 604 619 } 605 620 621 /** 622 * Returns the currently supported formats of a drop target. 623 * 624 * @returns Supported formats. 625 */ 606 626 RTCString VBoxDnDDropTarget::Formats(void) const 607 627 { … … 609 629 } 610 630 631 /** 632 * Waits for a drop event to happen. 633 * 634 * @returns VBox status code. 635 * @param msTimeout Timeout (in ms) to wait for drop event. 636 */ 611 637 int VBoxDnDDropTarget::WaitForDrop(RTMSINTERVAL msTimeout) 612 638 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.cpp
r85455 r85681 188 188 } 189 189 190 /**191 * Retrieves the data stored in this object and store the result in192 * pMedium.193 *194 * @return IPRT status code.195 * @return HRESULT196 * @param pFormatEtc197 * @param pMedium198 */199 190 STDMETHODIMP UIDnDDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) 200 191 { … … 512 503 } 513 504 514 /**515 * Only required for IStream / IStorage interfaces.516 *517 * @return IPRT status code.518 * @return HRESULT519 * @param pFormatEtc520 * @param pMedium521 */522 505 STDMETHODIMP UIDnDDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) 523 506 { … … 527 510 } 528 511 529 /**530 * Query if this objects supports a specific format.531 *532 * @return IPRT status code.533 * @return HRESULT534 * @param pFormatEtc535 */536 512 STDMETHODIMP UIDnDDataObject::QueryGetData(LPFORMATETC pFormatEtc) 537 513 { … … 594 570 */ 595 571 572 /** 573 * Aborts waiting for data being "dropped". 574 * 575 * @returns VBox status code. 576 */ 596 577 int UIDnDDataObject::Abort(void) 597 578 { … … 601 582 } 602 583 584 /** 585 * Static helper function to convert a CLIPFORMAT to a string and return it. 586 * 587 * @returns Pointer to converted stringified CLIPFORMAT, or "unknown" if not found / invalid. 588 * @param fmt CLIPFORMAT to return string for. 589 */ 603 590 /* static */ 604 591 const char* UIDnDDataObject::ClipboardFormatToString(CLIPFORMAT fmt) … … 682 669 } 683 670 671 /** 672 * Checks whether a given FORMATETC is supported by this data object and returns its index. 673 * 674 * @returns \c true if format is supported, \c false if not. 675 * @param pFormatEtc Pointer to FORMATETC to check for. 676 * @param puIndex Where to store the index if format is supported. 677 */ 684 678 bool UIDnDDataObject::LookupFormatEtc(LPFORMATETC pFormatEtc, ULONG *puIndex) 685 679 { … … 712 706 } 713 707 708 /** 709 * Registers a new format with this data object. 710 * 711 * @param pFormatEtc Where to store the new format into. 712 * @param clipFormat Clipboard format to register. 713 * @param tyMed Format medium type to register. 714 * @param lIndex Format index to register. 715 * @param dwAspect Format aspect to register. 716 * @param pTargetDevice Format target device to register. 717 */ 714 718 void UIDnDDataObject::RegisterFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat, 715 719 TYMED tyMed, LONG lIndex, DWORD dwAspect, … … 728 732 } 729 733 734 /** 735 * Sets the current status of this data object. 736 * 737 * @param enmStatus New status to set. 738 */ 730 739 void UIDnDDataObject::SetStatus(DnDDataObjectStatus enmStatus) 731 740 { … … 734 743 } 735 744 745 /** 746 * Signals that data has been "dropped". 747 * 748 ** @todo r=andy Remove? 749 */ 736 750 void UIDnDDataObject::Signal(void) 737 751 { … … 739 753 } 740 754 755 /** 756 * Signals that data has been "dropped". 757 * 758 * @returns VBox status code. 759 * @param strFormat Format of data (MIME string). 760 * @param pvData Pointer to data. 761 * @param cbData Size (in bytes) of data. 762 */ 741 763 int UIDnDDataObject::Signal(const QString &strFormat, 742 764 const void *pvData, uint32_t cbData) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.h
r82968 r85681 95 95 /** Internal reference count of this object. */ 96 96 LONG m_cRefs; 97 /** Number of native formats registered. This can be a different number than supplied with m lstFormats. */97 /** Number of native formats registered. This can be a different number than supplied with m_lstFormats. */ 98 98 ULONG m_cFormats; 99 /** Array of registered FORMATETC structs. Matches m_cFormats. */ 99 100 FORMATETC *m_pFormatEtc; 101 /** Array of registered STGMEDIUM structs. Matches m_cFormats. */ 100 102 STGMEDIUM *m_pStgMedium; 103 /** Event semaphore used for waiting on status changes. */ 101 104 RTSEMEVENT m_SemEvent; 105 /** List of supported formats. */ 102 106 QStringList m_lstFormats; 107 /** Format of currently retrieved data. */ 103 108 QString m_strFormat; 104 109 /** The retrieved data as a QVariant. Needed for buffering in case a second format needs the same data, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.h
r82968 r85681 56 56 /** Pointer to parent widget. */ 57 57 QWidget *m_pParent; 58 /** Pointer to current data object. */ 58 59 UIDnDDataObject *m_pDataObject; 59 60 /** The current reference count. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
r85475 r85681 601 601 QVector<uint8_t> &vecData) 602 602 { 603 /** @todo r=andy Locking required? */ 604 603 605 if (!strMIMEType.compare("application/x-qt-mime-type-name", Qt::CaseInsensitive)) 604 606 return VINF_SUCCESS; … … 713 715 } 714 716 717 /** 718 * Sets the current DnD operation mode. 719 * 720 * Note: Only one mode (guest->host *or* host->guest) can be active at the same time. 721 * 722 * @param enmMode Current operation mode to set. 723 */ 715 724 void UIDnDHandler::setOpMode(DNDOPMODE enmMode) 716 725 { 717 726 QMutexLocker AutoWriteLock(&m_WriteLock); 727 728 /** @todo r=andy Check for old (current) mode and refuse new mode? */ 729 718 730 m_enmOpMode = enmMode; 719 731 LogFunc(("Operation mode is now: %RU32\n", m_enmOpMode)); … … 734 746 */ 735 747 748 /** 749 * Static helper function to convert a Qt drop action to an internal DnD drop action. 750 * 751 * @returns Converted internal drop action. 752 * @param action Qt drop action to convert. 753 */ 736 754 /* static */ 737 755 KDnDAction UIDnDHandler::toVBoxDnDAction(Qt::DropAction action) … … 747 765 } 748 766 767 /** 768 * Static helper function to convert Qt drop actions to internal DnD drop actions. 769 * 770 * @returns Vector of converted internal drop actions. 771 * @param actions Qt drop actions to convert. 772 */ 749 773 /* static */ 750 774 QVector<KDnDAction> UIDnDHandler::toVBoxDnDActions(Qt::DropActions actions) … … 763 787 } 764 788 789 /** 790 * Static helper function to convert an internal drop action to a Qt drop action. 791 * 792 * @returns Converted Qt drop action. 793 * @param actions Internal drop action to convert. 794 */ 765 795 /* static */ 766 796 Qt::DropAction UIDnDHandler::toQtDnDAction(KDnDAction action) … … 778 808 } 779 809 810 /** 811 * Static helper function to convert a vector of internal drop actions to Qt drop actions. 812 * 813 * @returns Converted Qt drop actions. 814 * @param vecActions Internal drop actions to convert. 815 */ 780 816 /* static */ 781 817 Qt::DropActions UIDnDHandler::toQtDnDActions(const QVector<KDnDAction> &vecActions) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.h
r82968 r85681 38 38 class UISession; 39 39 40 /** 41 * Main class for implementing Drag'n'Drop in the frontend. 42 */ 40 43 class UIDnDHandler: public QObject 41 44 { -
trunk/src/VBox/GuestHost/DragAndDrop/DnDDroppedFiles.cpp
r85456 r85681 40 40 41 41 42 /** 43 * Initializes a DnD Dropped Files struct, internal version. 44 * 45 * @returns VBox status code. 46 * @param pDF DnD Dropped Files to initialize. 47 */ 42 48 static int dndDroppedFilesInitInternal(PDNDDROPPEDFILES pDF) 43 49 { … … 52 58 } 53 59 60 /** 61 * Initializes a DnD Dropped Files struct, extended version. 62 * 63 * @returns VBox status code. 64 * @param pDF DnD Dropped Files to initialize. 65 * @param fFlags Dropped Files flags to use for initialization. 66 */ 54 67 int DnDDroppedFilesInitEx(PDNDDROPPEDFILES pDF, 55 68 const char *pszPath, DNDURIDROPPEDFILEFLAGS fFlags /* = DNDURIDROPPEDFILE_FLAGS_NONE */) … … 62 75 } 63 76 77 /** 78 * Initializes a DnD Dropped Files struct. 79 * 80 * @returns VBox status code. 81 * @param pDF DnD Dropped Files to initialize. 82 */ 64 83 int DnDDroppedFilesInit(PDNDDROPPEDFILES pDF) 65 84 { … … 67 86 } 68 87 88 /** 89 * Destroys a DnD Dropped Files struct. 90 * 91 * Note: This does *not* (physically) delete any added content. 92 * Make sure to call DnDDroppedFilesReset() then. 93 * 94 * @param pDF DnD Dropped Files to destroy. 95 */ 69 96 void DnDDroppedFilesDestroy(PDNDDROPPEDFILES pDF) 70 97 { … … 78 105 79 106 /** 80 * Adds a file reference to a dropped files directory. 81 * 82 * @returns VBox status code. 107 * Adds a file reference to a Dropped Files directory. 108 * 109 * @returns VBox status code. 110 * @param pDF DnD Dropped Files to add file to. 83 111 * @param pszFile Path of file entry to add. 84 112 */ … … 103 131 104 132 /** 105 * Adds a directory reference to a dropped files directory. 133 * Adds a directory reference to a Dropped Files directory. 134 * 106 135 * Note: This does *not* (recursively) add sub entries. 107 136 * 108 137 * @returns VBox status code. 138 * @param pDF DnD Dropped Files to add directory to. 109 139 * @param pszDir Path of directory entry to add. 110 140 */ … … 132 162 * 133 163 * @returns VBox status code. 164 * @param pDF DnD Dropped Files to close. 134 165 */ 135 166 static int dndDroppedFilesCloseInternal(PDNDDROPPEDFILES pDF) … … 153 184 * 154 185 * @returns VBox status code. 186 * @param pDF DnD Dropped Files to close. 155 187 */ 156 188 int DnDDroppedFilesClose(PDNDDROPPEDFILES pDF) … … 163 195 * 164 196 * @returns Pointer to absolute path of the dropped files directory. 197 * @param pDF DnD Dropped Files return absolute path of the dropped files directory for. 165 198 */ 166 199 const char *DnDDroppedFilesGetDirAbs(PDNDDROPPEDFILES pDF) … … 173 206 * 174 207 * @returns \c true if open, \c false if not. 208 * @param pDF DnD Dropped Files to return open status for. 175 209 */ 176 210 bool DnDDroppedFilesIsOpen(PDNDDROPPEDFILES pDF) … … 183 217 * 184 218 * @returns VBox status code. 219 * @param pDF DnD Dropped Files to open. 185 220 * @param pszPath Absolute path where to create the dropped files directory. 186 221 * @param fFlags Dropped files flags to use for this directory. … … 259 294 * 260 295 * @returns VBox status code. 296 * @param pDF DnD Dropped Files to open. 261 297 * @param fFlags Dropped files flags to use for this directory. 262 298 */ … … 278 314 } 279 315 316 /** 317 * Free's an internal DnD Dropped Files entry. 318 * 319 * @param pEntry Pointer to entry to free. The pointer will be invalid after calling. 320 */ 280 321 static void dndDroppedFilesEntryFree(PDNDDROPPEDFILESENTRY pEntry) 281 322 { … … 287 328 } 288 329 330 /** 331 * Resets an internal DnD Dropped Files list. 332 * 333 * @param pListAnchor Pointer to list (anchor) to reset. 334 */ 289 335 static void dndDroppedFilesResetList(PRTLISTANCHOR pListAnchor) 290 336 { … … 299 345 * 300 346 * @returns VBox status code. 347 * @param pDF DnD Dropped Files to reset. 301 348 * @param fDelete Whether to physically delete the directory and its content 302 349 * or just clear the internal references. … … 326 373 * 327 374 * @returns VBox status code, or VERR_NOT_FOUND if the dropped files directory has not been opened before. 375 * @param pDF DnD Dropped Files to re-open. 328 376 */ 329 377 int DnDDroppedFilesReopen(PDNDDROPPEDFILES pDF) … … 340 388 * 341 389 * @returns VBox status code. 390 * @param pDF DnD Dropped Files to roll back. 342 391 */ 343 392 int DnDDroppedFilesRollback(PDNDDROPPEDFILES pDF) -
trunk/src/VBox/GuestHost/DragAndDrop/DnDMIME.cpp
r85371 r85681 26 26 27 27 28 /** 29 * Returns whether a given MIME format contains file URLs we can work with or not. 30 * 31 * @returns \c true if the format contains file URLs, \c false if not. 32 * @param pcszFormat MIME format to check. 33 * @param cchFormatMax Maximum characters of MIME format to check. 34 */ 28 35 bool DnDMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax) 29 36 { … … 33 40 } 34 41 42 /** 43 * Returns whether a given MIME format needs an own "Dropped Files" directory or not. 44 * 45 * @returns \c true if the format needs an own "Dropped Files" directory, \c false if not. 46 * @param pcszFormat MIME format to check. 47 * @param cchFormatMax Maximum characters of MIME format to check. 48 */ 35 49 bool DnDMIMENeedsDropDir(const char *pcszFormat, size_t cchFormatMax) 36 50 { -
trunk/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.cpp
r85407 r85681 18 18 /** @page pg_svc_dnd Drag and drop HGCM Service 19 19 * 20 * TODO20 * @sa See src/VBox/Main/src-client/GuestDnDPrivate.cpp for more information. 21 21 */ 22 22 -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r85561 r85681 55 55 * 56 56 * 1. GUI: Uses the Qt classes for Drag and Drop and mainly forward the content 57 * of it to the Main IGuest interface (see UIDnDHandler.cpp).57 * of it to the Main IGuest / IGuestDnDSource / IGuestDnDTarget interfaces. 58 58 * 2. Main: Public interface for doing Drag and Drop. Also manage the IProgress 59 59 * interfaces for blocking the caller by showing a progress dialog (see … … 62 62 * encapsulate the internal communication details (see dndmanager.cpp and 63 63 * friends). 64 * 4. Guest additions: Split into the platform neutral part (see64 * 4. Guest Additions: Split into the platform neutral part (see 65 65 * VBoxGuestR3LibDragAndDrop.cpp) and the guest OS specific parts. 66 66 * Receive/send message from/to the HGCM service and does all guest specific 67 * operations. Currently only X11 is supported (see draganddrop.cpp within 68 * VBoxClient). 67 * operations. For Windows guests VBoxTray is in charge, whereas on UNIX-y guests 68 * VBoxClient will be used. 69 * 70 * Terminology: 71 * 72 * All transfers contain a MIME format and according meta data. This meta data then can 73 * be interpreted either as raw meta data or something else. When raw meta data is 74 * being handled, this gets passed through to the destination (guest / host) without 75 * modification. Other meta data (like URI lists) can and will be modified by the 76 * receiving side before passing to OS. How and when modifications will be applied 77 * depends on the MIME format. 69 78 * 70 79 * Host -> Guest: 71 80 * 1. There are DnD Enter, Move, Leave events which are send exactly like this 72 * to the guest. The info includes the pos , mimetypes and allowed actions.81 * to the guest. The info includes the position, MIME types and allowed actions. 73 82 * The guest has to respond with an action it would accept, so the GUI could 74 * change the cursor .83 * change the cursor accordingly. 75 84 * 2. On drop, first a drop event is sent. If this is accepted a drop data 76 85 * event follows. This blocks the GUI and shows some progress indicator. … … 85 94 * shows some progress indicator. 86 95 * 87 * Somehints:96 * Implementation hints: 88 97 * m_strSupportedFormats here in this file defines the allowed mime-types. 89 98 * This is necessary because we need special handling for some of the … … 104 113 * same has to be done in the G->H direction when it is implemented. 105 114 * 106 * Of course only regularly files are supported. Symlinks are resolved and 107 * transfered as regularly files. First we don't know if the other side support 108 * symlinks at all and second they could point to somewhere in a directory tree 109 * which not exists on the other side. 110 * 111 * The code tries to preserve the file modes of the transfered dirs/files. This 112 * is useful (and maybe necessary) for two things: 115 * Only regular files are supported; symlinks are not allowed. 116 * 117 * Transfers currently are an all-succeed or all-fail operation (see todos). 118 * 119 * On MacOS hosts we had to implement own DnD "promises" support for file transfers, 120 * as Qt does not support this out-of-the-box. 121 * 122 * The code tries to preserve the file modes of the transfered directories / files. 123 * This is useful (and maybe necessary) for two things: 113 124 * 1. If a file is executable, it should be also after the transfer, so the 114 125 * user can just execute it, without manually tweaking the modes first. … … 118 129 * ourself, in e.g. for a cleanup case after cancel). 119 130 * 120 * Cancel is supported in both directions and cleans up all previous steps 121 * (thats is: deleting already transfered dirs/files). 122 * 123 * In general I propose the following changes in the VBox HGCM infrastructure 124 * for the future: 125 * - Currently it isn't really possible to send messages to the guest from the 126 * host. The host informs the guest just that there is something, the guest 127 * than has to ask which message and depending on that send the appropriate 128 * message to the host, which is filled with the right data. 129 * - There is no generic interface for sending bigger memory blocks to/from the 130 * guest. This is now done here, but I guess was also necessary for e.g. 131 * guest execution. So something generic which brake this up into smaller 132 * blocks and send it would be nice (with all the error handling and such 133 * ofc). 134 * - I developed a "protocol" for the DnD communication here. So the host and 135 * the guest have always to match in the revision. This is ofc bad, because 136 * the additions could be outdated easily. So some generic protocol number 137 * support in HGCM for asking the host and the guest of the support version, 138 * would be nice. Ofc at least the host should be able to talk to the guest, 139 * even when the version is below the host one. 140 * All this stuff would be useful for the current services, but also for future 141 * onces. 131 * ACEs / ACLs currently are not supported. 132 * 133 * Cancelling ongoing transfers is supported in both directions by the guest 134 * and/or host side and cleans up all previous steps. This also involves 135 * removing partially transferred directories / files in the temporary directory. 142 136 * 143 137 ** @todo 144 138 * - ESC doesn't really work (on Windows guests it's already implemented) 145 * ... in any case it seems a little bit difficult to handle from the Qt 146 * side. Maybe also a host specific implementation becomes necessary ...147 * this would be really worst ofc.148 * - Add support for more mime-types (especially images, csv)139 * ... in any case it seems a little bit difficult to handle from the Qt side. 140 * - Transfers currently do not have any interactive (UI) callbacks / hooks which 141 * e.g. would allow to skip / replace / rename and entry, or abort the operation on failure. 142 * - Add support for more MIME types (especially images, csv) 149 143 * - Test unusual behavior: 150 144 * - DnD service crash in the guest during a DnD op (e.g. crash of VBoxClient or X11) … … 152 146 * - Security considerations: We transfer a lot of memory between the guest and 153 147 * the host and even allow the creation of dirs/files. Maybe there should be 154 * limits introduced to preventing D OS attacks or filling up all the memory148 * limits introduced to preventing DoS attacks or filling up all the memory 155 149 * (both in the host and the guest). 156 150 */ -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r85564 r85681 57 57 virtual ~GuestDnDSourceTask(void) { } 58 58 59 /** Returns the overall result of the task. */ 59 60 int getRC(void) const { return mRC; } 61 /** Returns if the overall result of the task is ok (succeeded) or not. */ 60 62 bool isOk(void) const { return RT_SUCCESS(mRC); } 61 63 62 64 protected: 63 65 66 /** COM object pointer to the parent (source). */ 64 67 const ComObjPtr<GuestDnDSource> mSource; 68 /** Overall result of the task. */ 65 69 int mRC; 66 70 }; … … 507 511 ///////////////////////////////////////////////////////////////////////////// 508 512 513 /** 514 * Returns an error string from a guest DnD error. 515 * 516 * @returns Error string. 517 * @param guestRc Guest error to return error string for. 518 */ 509 519 /* static */ 510 520 Utf8Str GuestDnDSource::i_guestErrorToString(int guestRc) … … 545 555 } 546 556 557 /** 558 * Returns an error string from a host DnD error. 559 * 560 * @returns Error string. 561 * @param hostRc Host error to return error string for. 562 */ 547 563 /* static */ 548 564 Utf8Str GuestDnDSource::i_hostErrorToString(int hostRc) … … 583 599 } 584 600 601 /** 602 * Resets all internal data and state. 603 */ 585 604 void GuestDnDSource::i_reset(void) 586 605 { … … 632 651 633 652 /** 634 * Handles receiving a send data blockfrom the guest.653 * Main function for receiving data from the guest. 635 654 * 636 655 * @returns VBox status code. … … 762 781 return rc; 763 782 } 783 764 784 765 785 int GuestDnDSource::i_onReceiveDir(GuestDnDRecvCtx *pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode) … … 904 924 } 905 925 926 /** 927 * Receives file data from the guest. 928 * 929 * @returns VBox status code. 930 * @param pCtx Receive context to use. 931 * @param pvData Pointer to file data received from the guest. 932 * @param pCtx Size (in bytes) of file data received from the guest. 933 */ 906 934 int GuestDnDSource::i_onReceiveFileData(GuestDnDRecvCtx *pCtx, const void *pvData, uint32_t cbData) 907 935 { … … 971 999 972 1000 /** 973 * @returns VBox status code that the caller ignores. Not sure if that's 974 * intentional or not. 1001 * Main function to receive DnD data from the guest. 1002 * 1003 * @returns VBox status code. 1004 * @param pCtx Receive context to use. 1005 * @param msTimeout Timeout (in ms) to wait for receiving data. 975 1006 */ 976 1007 int GuestDnDSource::i_receiveData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout) … … 1066 1097 } 1067 1098 1099 /** 1100 * Receives raw (meta) data from the guest. 1101 * 1102 * @returns VBox status code. 1103 * @param pCtx Receive context to use. 1104 * @param msTimeout Timeout (in ms) to wait for receiving data. 1105 */ 1068 1106 int GuestDnDSource::i_receiveRawData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout) 1069 1107 { … … 1171 1209 } 1172 1210 1211 /** 1212 * Receives transfer data (files / directories / ...) from the guest. 1213 * 1214 * @returns VBox status code. 1215 * @param pCtx Receive context to use. 1216 * @param msTimeout Timeout (in ms) to wait for receiving data. 1217 */ 1173 1218 int GuestDnDSource::i_receiveTransferData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout) 1174 1219 { … … 1305 1350 } 1306 1351 1352 /** 1353 * Static HGCM service callback which handles receiving raw data. 1354 * 1355 * @returns VBox status code. Will get sent back to the host service. 1356 * @param uMsg HGCM message ID (function number). 1357 * @param pvParms Pointer to additional message data. Optional and can be NULL. 1358 * @param cbParms Size (in bytes) additional message data. Optional and can be 0. 1359 * @param pvUser User-supplied pointer on callback registration. 1360 */ 1307 1361 /* static */ 1308 1362 DECLCALLBACK(int) GuestDnDSource::i_receiveRawDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser) … … 1434 1488 } 1435 1489 1490 /** 1491 * Static HGCM service callback which handles receiving transfer data from the guest. 1492 * 1493 * @returns VBox status code. Will get sent back to the host service. 1494 * @param uMsg HGCM message ID (function number). 1495 * @param pvParms Pointer to additional message data. Optional and can be NULL. 1496 * @param cbParms Size (in bytes) additional message data. Optional and can be 0. 1497 * @param pvUser User-supplied pointer on callback registration. 1498 */ 1436 1499 /* static */ 1437 1500 DECLCALLBACK(int) GuestDnDSource::i_receiveTransferDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser) -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r85564 r85681 60 60 virtual ~GuestDnDTargetTask(void) { } 61 61 62 /** Returns the overall result of the task. */ 62 63 int getRC(void) const { return mRC; } 64 /** Returns if the overall result of the task is ok (succeeded) or not. */ 63 65 bool isOk(void) const { return RT_SUCCESS(mRC); } 64 66 65 67 protected: 66 68 69 /** COM object pointer to the parent (source). */ 67 70 const ComObjPtr<GuestDnDTarget> mTarget; 71 /** Overall result of the task. */ 68 72 int mRC; 69 73 }; … … 670 674 } 671 675 676 /** 677 * Returns an error string from a guest DnD error. 678 * 679 * @returns Error string. 680 * @param guestRc Guest error to return error string for. 681 */ 672 682 /* static */ 673 683 Utf8Str GuestDnDTarget::i_guestErrorToString(int guestRc) … … 708 718 } 709 719 720 /** 721 * Returns an error string from a host DnD error. 722 * 723 * @returns Error string. 724 * @param hostRc Host error to return error string for. 725 */ 710 726 /* static */ 711 727 Utf8Str GuestDnDTarget::i_hostErrorToString(int hostRc) … … 742 758 } 743 759 760 /** 761 * Resets all internal data and state. 762 */ 744 763 void GuestDnDTarget::i_reset(void) 745 764 { … … 919 938 } 920 939 940 /** 941 * Sends a directory entry to the guest. 942 * 943 * @returns VBox status code. 944 * @param pCtx Send context to use. 945 * @param pObj Transfer object to send. Must be a directory. 946 * @param pMsg Where to store the message to send. 947 */ 921 948 int GuestDnDTarget::i_sendDirectory(GuestDnDSendCtx *pCtx, PDNDTRANSFEROBJECT pObj, GuestDnDMsg *pMsg) 922 949 { … … 942 969 943 970 /** 944 * Sends a transferfile to the guest.971 * Sends a file to the guest. 945 972 * 946 973 * @returns VBox status code. 947 * @param pCtx 948 * @param pObj 949 * @param pMsg 974 * @param pCtx Send context to use. 975 * @param pObj Transfer object to send. Must be a file. 976 * @param pMsg Where to store the message to send. 950 977 */ 951 978 int GuestDnDTarget::i_sendFile(GuestDnDSendCtx *pCtx, … … 1034 1061 } 1035 1062 1063 /** 1064 * Helper function to send actual file data to the guest. 1065 * 1066 * @returns VBox status code. 1067 * @param pCtx Send context to use. 1068 * @param pObj Transfer object to send. Must be a file. 1069 * @param pMsg Where to store the message to send. 1070 */ 1036 1071 int GuestDnDTarget::i_sendFileData(GuestDnDSendCtx *pCtx, 1037 1072 PDNDTRANSFEROBJECT pObj, GuestDnDMsg *pMsg) … … 1113 1148 } 1114 1149 1150 /** 1151 * Static HGCM service callback which handles sending transfer data to the guest. 1152 * 1153 * @returns VBox status code. Will get sent back to the host service. 1154 * @param uMsg HGCM message ID (function number). 1155 * @param pvParms Pointer to additional message data. Optional and can be NULL. 1156 * @param cbParms Size (in bytes) additional message data. Optional and can be 0. 1157 * @param pvUser User-supplied pointer on callback registration. 1158 */ 1115 1159 /* static */ 1116 1160 DECLCALLBACK(int) GuestDnDTarget::i_sendTransferDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser)
Note:
See TracChangeset
for help on using the changeset viewer.