Changeset 55459 in vbox for trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
- Timestamp:
- Apr 27, 2015 5:17:07 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r55427 r55459 530 530 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 531 531 532 HRESULT hr ;532 HRESULT hr = S_OK; 533 533 int vrc; 534 534 … … 682 682 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 683 683 684 RTCString strPath = aFile.GetDestPath();685 if (strPath .isEmpty())684 RTCString strPathSrc = aFile.GetSourcePath(); 685 if (strPathSrc.isEmpty()) 686 686 return VERR_INVALID_PARAMETER; 687 687 … … 689 689 690 690 LogFlowFunc(("Sending \"%s\" (%RU32 bytes buffer) using protocol v%RU32 ...\n", 691 aFile.GetDestPath().c_str(), m_cbBlockSize, mData.mProtocolVersion)); 691 strPathSrc.c_str(), m_cbBlockSize, mData.mProtocolVersion)); 692 693 bool fOpen = aFile.IsOpen(); 694 if (!fOpen) 695 { 696 LogFlowFunc(("Opening \"%s\" ...\n", strPathSrc.c_str())); 697 rc = aFile.OpenEx(strPathSrc, DnDURIObject::File, DnDURIObject::Source, 698 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */); 699 } 692 700 693 701 bool fSendFileData = false; 694 if (mData.mProtocolVersion >= 2) 695 { 696 if (!aFile.IsOpen()) 697 { 698 rc = aFile.OpenEx(aFile.GetSourcePath(), DnDURIObject::File, DnDURIObject::Source, 699 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */); 700 if (RT_SUCCESS(rc)) 702 if (RT_SUCCESS(rc)) 703 { 704 if (mData.mProtocolVersion >= 2) 705 { 706 if (!fOpen) 701 707 { 702 708 /* … … 706 712 */ 707 713 pMsg->setType(DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR); 708 pMsg->setNextUInt32(0); /* context ID */ 709 pMsg->setNextString(strPath.c_str()); /* pvName */ 710 pMsg->setNextUInt32((uint32_t)(strPath.length() + 1)); /* cbName */ 711 pMsg->setNextUInt32(0); /* uFlags */ 712 pMsg->setNextUInt32(aFile.GetMode()); /* fMode */ 713 pMsg->setNextUInt64(aFile.GetSize()); /* uSize */ 714 pMsg->setNextUInt32(0); /* context ID */ 715 rc = pMsg->setNextString(aFile.GetDestPath().c_str()); /* pvName */ 716 AssertRC(rc); 717 pMsg->setNextUInt32((uint32_t)(aFile.GetDestPath().length() + 1)); /* cbName */ 718 pMsg->setNextUInt32(0); /* uFlags */ 719 pMsg->setNextUInt32(aFile.GetMode()); /* fMode */ 720 pMsg->setNextUInt64(aFile.GetSize()); /* uSize */ 714 721 715 722 LogFlowFunc(("Sending file header ...\n")); 716 723 } 717 } 718 else 719 { 720 /* File header was sent, so only send the actual file data. */ 724 else 725 { 726 /* File header was sent, so only send the actual file data. */ 727 fSendFileData = true; 728 } 729 } 730 else /* Protocol v1. */ 731 { 732 /* Always send the file data, every time. */ 721 733 fSendFileData = true; 722 734 } 723 }724 else /* Protocol v1. */725 {726 /* Always send the file data, every time. */727 fSendFileData = true;728 735 } 729 736 … … 766 773 if (mData.mProtocolVersion <= 1) 767 774 { 768 pMsg->setNextUInt32(0); /* context ID */769 775 pMsg->setNextString(aFile.GetSourcePath().c_str()); /* pvName */ 770 776 pMsg->setNextUInt32((uint32_t)(aFile.GetSourcePath().length() + 1)); /* cbName */ 777 } 778 else 779 { 780 /* Protocol version 2 also sends the context ID. Currently unused. */ 781 pMsg->setNextUInt32(0); /* context ID */ 771 782 } 772 783 … … 869 880 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER); 870 881 882 LogFlowFunc(("pCBData->uMsg=%RU32, paParms=%p, cParms=%RU32\n", pCBData->uMsg, pCBData->paParms, pCBData->cParms)); 883 871 884 GuestDnDMsg *pMsg = pThis->nextMsg(); 872 885 if (pMsg) … … 884 897 if (RT_SUCCESS(rc)) 885 898 { 886 LogFlowFunc((" Sending uMsg=%RU32, cParms=%RU32 ...\n", uMsg, pCBData->cParms));899 LogFlowFunc(("Returning uMsg=%RU32\n", uMsg)); 887 900 rc = HGCM::Message::copyParms(pMsg->getCount(), pMsg->getParms(), pCBData->paParms); 888 901 if (RT_SUCCESS(rc)) … … 891 904 pThis->removeNext(); 892 905 } 906 else 907 LogFlowFunc(("Copying parameters failed with rc=%Rrc\n", rc)); 893 908 } 894 909 } … … 896 911 rc = VERR_NO_DATA; 897 912 898 LogFlowFunc((" Returning msg %RU32, rc=%Rrc\n", uMsg, rc));913 LogFlowFunc(("Processing next message ended with rc=%Rrc\n", rc)); 899 914 break; 900 915 } … … 992 1007 break; 993 1008 1009 pCtx->mURI.cbProcessed = 0; 1010 pCtx->mURI.cProcessed = 0; 1011 pCtx->mURI.cbToProcess = lstURI.TotalBytes(); 1012 994 1013 /* 995 1014 * The first message always is the meta info for the data. The meta … … 1044 1063 #undef UNREGISTER_CALLBACK 1045 1064 1065 /* Destroy temporary scratch buffer. */ 1046 1066 if (pvBuf) 1047 1067 RTMemFree(pvBuf); … … 1055 1075 int GuestDnDTarget::i_sendURIDataLoop(PSENDDATACTX pCtx, GuestDnDMsg *pMsg) 1056 1076 { 1057 AssertPtrReturn(pCtx, 1077 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1058 1078 1059 1079 DnDURIList &lstURI = pCtx->mURI.lstURI; … … 1061 1081 int rc; 1062 1082 1063 uint64_t cbTotal = pCtx->mURI. lstURI.TotalBytes();1083 uint64_t cbTotal = pCtx->mURI.cbToProcess; 1064 1084 uint8_t uPercent = pCtx->mURI.cbProcessed * 100 / (cbTotal ? cbTotal : 1); 1065 Assert(uPercent <= 100);1066 1085 1067 1086 LogFlowFunc(("%RU64 / %RU64 -- %RU8%%\n", pCtx->mURI.cbProcessed, cbTotal, uPercent));
Note:
See TracChangeset
for help on using the changeset viewer.