Changeset 81460 in vbox for trunk/src/VBox/GuestHost/SharedClipboard
- Timestamp:
- Oct 22, 2019 7:36:15 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134181
- Location:
- trunk/src/VBox/GuestHost/SharedClipboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp
r81438 r81460 265 265 { 266 266 SHCLLISTENTRY entryList; 267 rc = ShClTransferList Read(pTransfer, hList,&entryList);267 rc = ShClTransferListEntryInit(&entryList); 268 268 if (RT_SUCCESS(rc)) 269 269 { 270 PSHCLFSOBJINFO pFsObjInfo = (PSHCLFSOBJINFO)entryList.pvInfo; 271 Assert(entryList.cbInfo == sizeof(SHCLFSOBJINFO)); 272 273 Utf8Str strPath = strDir + Utf8Str("\\") + Utf8Str(entryList.pszName); 274 275 LogFlowFunc(("\t%s (%RU64 bytes) -> %s\n", 276 entryList.pszName, pFsObjInfo->cbObject, strPath.c_str())); 277 278 if (RTFS_IS_DIRECTORY(pFsObjInfo->Attr.fMode)) 270 rc = ShClTransferListRead(pTransfer, hList, &entryList); 271 if (RT_SUCCESS(rc)) 279 272 { 280 /* Note: Directories are *not* required to be part of m_lstEntries, as we only 281 * count files to transfer there. */ 282 283 rc = readDir(pTransfer, strPath.c_str()); 273 if (ShClTransferListEntryIsValid(&entryList)) 274 { 275 PSHCLFSOBJINFO pFsObjInfo = (PSHCLFSOBJINFO)entryList.pvInfo; 276 Assert(entryList.cbInfo == sizeof(SHCLFSOBJINFO)); 277 278 Utf8Str strPath = strDir + Utf8Str("\\") + Utf8Str(entryList.pszName); 279 280 LogFlowFunc(("\t%s (%RU64 bytes) -> %s\n", 281 entryList.pszName, pFsObjInfo->cbObject, strPath.c_str())); 282 283 if (RTFS_IS_DIRECTORY(pFsObjInfo->Attr.fMode)) 284 { 285 FSOBJENTRY objEntry = { strPath.c_str(), *pFsObjInfo }; 286 287 m_lstEntries.push_back(objEntry); /** @todo Can this throw? */ 288 289 rc = readDir(pTransfer, strPath.c_str()); 290 } 291 else if (RTFS_IS_FILE(pFsObjInfo->Attr.fMode)) 292 { 293 FSOBJENTRY objEntry = { strPath.c_str(), *pFsObjInfo }; 294 295 m_lstEntries.push_back(objEntry); /** @todo Can this throw? */ 296 } 297 else 298 rc = VERR_NOT_SUPPORTED; 299 300 /** @todo Handle symlinks. */ 301 } 302 else 303 rc = VERR_INVALID_PARAMETER; 284 304 } 285 else if (RTFS_IS_FILE(pFsObjInfo->Attr.fMode)) 286 { 287 FSOBJENTRY objEntry = { strPath.c_str(), *pFsObjInfo }; 288 289 m_lstEntries.push_back(objEntry); /** @todo Can this throw? */ 290 } 291 292 /** @todo Handle symlinks. */ 305 306 ShClTransferListEntryDestroy(&entryList); 293 307 } 294 308 … … 359 373 if (RTFS_IS_DIRECTORY(pFsObjInfo->Attr.fMode)) 360 374 { 361 /* Note: Directories are *not* required to be part of m_lstEntries, as we only 362 * count files to transfer there. */ 375 FSOBJENTRY objEntry = { pRootEntry->pszName, *pFsObjInfo }; 376 377 pThis->m_lstEntries.push_back(objEntry); /** @todo Can this throw? */ 363 378 364 379 rc = pThis->readDir(pTransfer, pRootEntry->pszName); … … 370 385 pThis->m_lstEntries.push_back(objEntry); /** @todo Can this throw? */ 371 386 } 387 else 388 rc = VERR_NOT_SUPPORTED; 372 389 373 390 if (ASMAtomicReadBool(&pTransfer->Thread.fStop)) -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp
r81440 r81460 541 541 int ShClTransferListEntryInit(PSHCLLISTENTRY pListEntry) 542 542 { 543 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER); 544 543 545 RT_BZERO(pListEntry, sizeof(SHCLLISTENTRY)); 544 546 … … 588 590 589 591 /** 590 * Returns whether a given clipboard data chunkis valid or not.592 * Returns whether a given clipboard list entry is valid or not. 591 593 * 592 594 * @returns \c true if valid, \c false if not. 593 * @param pListEntry Clipboard data chunkto validate.595 * @param pListEntry Clipboard list entry to validate. 594 596 */ 595 597 bool ShClTransferListEntryIsValid(PSHCLLISTENTRY pListEntry) 596 598 { 597 RT_NOREF(pListEntry); 598 599 /** @todo Verify checksum. */ 600 601 return true; /** @todo Implement this. */ 599 AssertPtrReturn(pListEntry, false); 600 601 if ( !pListEntry->pszName 602 || !pListEntry->cbName 603 || strlen(pListEntry->pszName) == 0 604 || strlen(pListEntry->pszName) > pListEntry->cbName /* Includes zero termination */ - 1) 605 { 606 return false; 607 } 608 609 if (pListEntry->cbInfo) /* cbInfo / pvInfo is optional. */ 610 { 611 if (!pListEntry->pvInfo) 612 return false; 613 } 614 615 return true; 602 616 } 603 617 … … 1205 1219 pTransfer->pszPathRootAbs = NULL; 1206 1220 1207 pTransfer->uListHandleNext = 1;1208 pTransfer->uObjHandleNext = 1;1209 1210 1221 pTransfer->uTimeoutMs = 30 * 1000; /* 30s timeout by default. */ 1211 1222 pTransfer->cbMaxChunkSize = _64K; /** @todo Make this configurable. */ … … 1260 1271 return rc; 1261 1272 1262 RTStrFree(pTransfer->pszPathRootAbs);1273 ShClTransferReset(pTransfer); 1263 1274 1264 1275 ShClEventSourceDestroy(&pTransfer->Events); 1265 1266 PSHCLLISTHANDLEINFO pItList, pItListNext;1267 RTListForEachSafe(&pTransfer->lstList, pItList, pItListNext, SHCLLISTHANDLEINFO, Node)1268 {1269 ShClTransferListHandleInfoDestroy(pItList);1270 1271 RTListNodeRemove(&pItList->Node);1272 1273 RTMemFree(pItList);1274 }1275 1276 PSHCLOBJHANDLEINFO pItObj, pItObjNext;1277 RTListForEachSafe(&pTransfer->lstObj, pItObj, pItObjNext, SHCLOBJHANDLEINFO, Node)1278 {1279 ShClTransferObjHandleInfoDestroy(pItObj);1280 1281 RTListNodeRemove(&pItObj->Node);1282 1283 RTMemFree(pItObj);1284 }1285 1276 1286 1277 LogFlowFuncLeave(); … … 1289 1280 1290 1281 /** 1291 * Initializes a shared Clipboard transfer object.1282 * Initializes a Shared Clipboard transfer object. 1292 1283 * 1293 1284 * @returns VBox status code. … … 1312 1303 pTransfer->State.enmStatus = SHCLTRANSFERSTATUS_INITIALIZED; /* Now we're ready to run. */ 1313 1304 1305 pTransfer->cListHandles = 0; 1314 1306 pTransfer->cMaxListHandles = _4K; /** @todo Make this dynamic. */ 1307 pTransfer->uListHandleNext = 1; 1308 1309 pTransfer->cObjHandles = 0; 1315 1310 pTransfer->cMaxObjHandles = _4K; /** @todo Ditto. */ 1311 pTransfer->uObjHandleNext = 1; 1316 1312 1317 1313 if (pTransfer->Callbacks.pfnTransferInitialize) … … 1967 1963 if (RT_SUCCESS(rc)) 1968 1964 { 1965 pEntry->cbName = (uint32_t)strlen(pEntry->pszName) + 1; /* Include termination. */ 1966 1969 1967 AssertPtr(pEntry->pvInfo); 1970 1968 Assert (pEntry->cbInfo == sizeof(SHCLFSOBJINFO)); 1971 1969 1972 1970 ShClFsObjFromIPRT(PSHCLFSOBJINFO(pEntry->pvInfo), &pDirEntry->Info); 1971 1972 LogFlowFunc(("Entry pszName=%s, pvInfo=%p, cbInfo=%RU32\n", 1973 pEntry->pszName, pEntry->pvInfo, pEntry->cbInfo)); 1973 1974 } 1974 1975 } … … 2117 2118 2118 2119 /** 2119 * Clears (resets) the root list of a shared Clipboard transfer.2120 * Clears (resets) the root list of a Shared Clipboard transfer. 2120 2121 * 2121 2122 * @param pTransfer Transfer to clear transfer root list for. … … 2146 2147 2147 2148 /** 2148 * Resets a shared Clipboard transfer.2149 * Resets a Shared Clipboard transfer. 2149 2150 * 2150 2151 * @param pTransfer Clipboard transfer to reset. … … 2157 2158 2158 2159 shClTransferListRootsClear(pTransfer); 2160 2161 PSHCLLISTHANDLEINFO pItList, pItListNext; 2162 RTListForEachSafe(&pTransfer->lstList, pItList, pItListNext, SHCLLISTHANDLEINFO, Node) 2163 { 2164 ShClTransferListHandleInfoDestroy(pItList); 2165 2166 RTListNodeRemove(&pItList->Node); 2167 2168 RTMemFree(pItList); 2169 } 2170 2171 PSHCLOBJHANDLEINFO pItObj, pItObjNext; 2172 RTListForEachSafe(&pTransfer->lstObj, pItObj, pItObjNext, SHCLOBJHANDLEINFO, Node) 2173 { 2174 ShClTransferObjHandleInfoDestroy(pItObj); 2175 2176 RTListNodeRemove(&pItObj->Node); 2177 2178 RTMemFree(pItObj); 2179 } 2159 2180 } 2160 2181 … … 2270 2291 2271 2292 /** 2272 * Returns the root entries of a shared Clipboard transfer.2293 * Returns the root entries of a Shared Clipboard transfer. 2273 2294 * 2274 2295 * @returns VBox status code. … … 2696 2717 2697 2718 /** 2698 * Destroys a shared Clipboard transfer context struct.2719 * Destroys a Shared Clipboard transfer context struct. 2699 2720 * 2700 2721 * @param pTransferCtx Transfer context to destroy. … … 2725 2746 2726 2747 /** 2727 * Resets a shared Clipboard transfer.2748 * Resets a Shared Clipboard transfer. 2728 2749 * 2729 2750 * @param pTransferCtx Transfer context to reset. … … 2796 2817 2797 2818 /** 2798 * Registers a shared Clipboard transfer with a transfer context, i.e. allocates a transfer ID.2819 * Registers a Shared Clipboard transfer with a transfer context, i.e. allocates a transfer ID. 2799 2820 * 2800 2821 * @return VBox status code. … … 2849 2870 2850 2871 /** 2851 * Registers a shared Clipboard transfer with a transfer contextby specifying an ID for the transfer.2872 * Registers a Shared Clipboard transfer with a transfer contextby specifying an ID for the transfer. 2852 2873 * 2853 2874 * @return VBox status code.
Note:
See TracChangeset
for help on using the changeset viewer.