Changeset 103480 in vbox
- Timestamp:
- Feb 20, 2024 3:21:35 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard-transfers.h
r103442 r103480 345 345 typedef struct _SHCLOBJOPENCREATEPARMS 346 346 { 347 /** Path to object to open / create. */ 347 /** Path to object to open / create. 348 * Always stored as UNIX-style paths ('/'). 349 * Backslashes ('\') can be part of a UNIX path though. */ 348 350 char *pszPath; 349 351 /** Size (in bytes) of path to to object. */ … … 421 423 /** Size (in bytes) of the listing path. */ 422 424 uint32_t cbPath; 423 /** Listing path (absolute). If empty or NULL the listing's root path will be opened. */ 425 /** Listing path (absolute). If empty or NULL the listing's root path will be opened. 426 * We always use UNIX-style paths. */ 424 427 char *pszPath; 425 428 } SHCLLISTOPENPARMS; … … 1266 1269 int ShClPathSanitize(char *pszPath, size_t cbPath); 1267 1270 const char *ShClTransferStatusToStr(SHCLTRANSFERSTATUS enmStatus); 1271 int ShClTransferTransformPath(char *pszPath, size_t cbPath); 1268 1272 int ShClTransferValidatePath(const char *pcszPath, bool fMustExist); 1269 1273 int ShClTransferResolvePathAbs(PSHCLTRANSFER pTransfer, const char *pszPath, uint32_t fFlags, char **ppszResolved); -
trunk/include/VBox/HostServices/VBoxClipboardSvc.h
r100367 r103480 990 990 /** pointer, in: Filter string. */ 991 991 HGCMFunctionParameter pvFilter; 992 /** pointer, in: Listing poth. If empty or NULL the listing's root path will be opened. */ 992 /** pointer, in: Listing path. If empty or NULL the listing's root path will be opened. 993 * We always use UNIX-style paths. */ 993 994 HGCMFunctionParameter pvPath; 994 995 /** uint64_t, out: List handle. */ … … 1110 1111 /** uint64_t, out: Object handle. */ 1111 1112 HGCMFunctionParameter uHandle; 1112 /** pointer, in: Absoulte path of object to open/create. */ 1113 /** pointer, in: Absoulte path of object to open/create. 1114 * We always use UNIX-style paths. */ 1113 1115 HGCMFunctionParameter szPath; 1114 1116 /** uint32_t in: Open / Create flags of type SHCL_OBJ_CF_. */ -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r103442 r103480 1196 1196 AssertPtrReturn(phList, VERR_INVALID_POINTER); 1197 1197 1198 int rc = ShClTransferTransformPath(pOpenParms->pszPath, pOpenParms->cbPath); 1199 AssertRCReturn(rc, rc); 1200 1198 1201 VBoxShClListOpenMsg Msg; 1199 1202 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, … … 1206 1209 Msg.uHandle.SetUInt64(0); 1207 1210 1208 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1209 if (RT_SUCCESS(rc)) 1210 { 1211 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1212 if (RT_SUCCESS(rc)) 1211 1213 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 1212 }1213 1214 1214 1215 LogFlowFuncLeaveRC(rc); … … 1701 1702 AssertPtrReturn(phObj, VERR_INVALID_POINTER); 1702 1703 1704 int rc = ShClTransferTransformPath(pCreateParms->pszPath, pCreateParms->cbPath); 1705 AssertRCReturn(rc, rc); 1706 1703 1707 VBoxShClObjOpenMsg Msg; 1704 1708 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, … … 1710 1714 Msg.fCreate.SetUInt32(pCreateParms->fCreate); 1711 1715 1712 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1713 if (RT_SUCCESS(rc)) 1714 { 1716 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1717 if (RT_SUCCESS(rc)) 1715 1718 Msg.uHandle.GetUInt64(phObj); 1716 }1717 1719 1718 1720 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp
r100665 r103480 38 38 39 39 #include <VBox/GuestHost/SharedClipboard.h> 40 #include <VBox/GuestHost/SharedClipboard-transfers.h> 40 41 #include <VBox/GuestHost/SharedClipboard-win.h> 41 42 … … 211 212 rc = RTStrCopy(openParms.pszPath, openParms.cbPath, m_strPath.c_str()); 212 213 if (RT_SUCCESS(rc)) 213 rc = ShClTransferObjOpen(m_pTransfer, &openParms, &m_hObj); 214 { 215 rc = ShClTransferTransformPath(openParms.pszPath, openParms.cbPath); 216 if (RT_SUCCESS(rc)) 217 rc = ShClTransferObjOpen(m_pTransfer, &openParms, &m_hObj); 218 } 214 219 215 220 ShClTransferObjOpenParmsDestroy(&openParms); -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp
r103477 r103480 3368 3368 } 3369 3369 return "Unknown"; 3370 } 3371 3372 /** 3373 * Transforms a path so that it can be sent over to the other party. 3374 * 3375 * @returns VBox status code. 3376 * @param pszPath Path to transform. Will be modified in place. 3377 * @param cbPath Size (in bytes) of \a pszPath. 3378 * 3379 * @note Shared Clipboard file paths always are sent over as UNIX-style paths. 3380 * Sending over back slashes ('\') could happen on non-Windows OSes as part of a path or file name. 3381 */ 3382 int ShClTransferTransformPath(char *pszPath, size_t cbPath) 3383 { 3384 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 3385 RT_NOREF(cbPath); 3386 RTPathChangeToUnixSlashes(pszPath, true /* fForce */); 3387 #else 3388 RT_NOREF(pszPath, cbPath); 3389 #endif 3390 return VINF_SUCCESS; 3370 3391 } 3371 3392 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r103442 r103480 43 43 #include <iprt/file.h> 44 44 #include <iprt/path.h> 45 46 #include <VBox/GuestHost/SharedClipboard-transfers.h> 45 47 46 48 #include "VBoxSharedClipboardSvc-internal.h" … … 326 328 pEvent->idEvent); 327 329 328 rc = shClSvcTransferSetListOpen(pMsg->cParms, pMsg->aParms, pMsg->idCtx, pOpenParms); 330 rc = ShClTransferTransformPath(pOpenParms->pszPath, pOpenParms->cbPath); 331 if (RT_SUCCESS(rc)) 332 rc = shClSvcTransferSetListOpen(pMsg->cParms, pMsg->aParms, pMsg->idCtx, pOpenParms); 329 333 if (RT_SUCCESS(rc)) 330 334 { … … 604 608 LogFlowFunc(("pszPath=%s, fCreate=0x%x\n", pCreateParms->pszPath, pCreateParms->fCreate)); 605 609 606 const uint32_t cbPath = (uint32_t)strlen(pCreateParms->pszPath) + 1; /* Include terminating zero */ 607 608 HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, 609 pCtx->pTransfer->State.uID, pEvent->idEvent)); 610 HGCMSvcSetU64(&pMsg->aParms[1], 0); /* uHandle */ 611 HGCMSvcSetPv (&pMsg->aParms[2], pCreateParms->pszPath, cbPath); 612 HGCMSvcSetU32(&pMsg->aParms[3], pCreateParms->fCreate); 613 614 shClSvcClientLock(pClient); 615 616 shClSvcMsgAdd(pClient, pMsg, true /* fAppend */); 617 rc = shClSvcClientWakeup(pClient); 618 619 shClSvcClientUnlock(pClient); 620 610 rc = ShClTransferTransformPath(pCreateParms->pszPath, pCreateParms->cbPath); 621 611 if (RT_SUCCESS(rc)) 622 612 { 623 int rcEvent; 624 PSHCLEVENTPAYLOAD pPayload; 625 rc = ShClEventWaitEx(pEvent, pCtx->pTransfer->uTimeoutMs, &rcEvent, &pPayload); 613 const uint32_t cbPath = (uint32_t)strlen(pCreateParms->pszPath) + 1; /* Include terminating zero */ 614 615 HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, 616 pCtx->pTransfer->State.uID, pEvent->idEvent)); 617 HGCMSvcSetU64(&pMsg->aParms[1], 0); /* uHandle */ 618 HGCMSvcSetPv (&pMsg->aParms[2], pCreateParms->pszPath, cbPath); 619 HGCMSvcSetU32(&pMsg->aParms[3], pCreateParms->fCreate); 620 621 shClSvcClientLock(pClient); 622 623 shClSvcMsgAdd(pClient, pMsg, true /* fAppend */); 624 rc = shClSvcClientWakeup(pClient); 625 626 shClSvcClientUnlock(pClient); 627 626 628 if (RT_SUCCESS(rc)) 627 629 { 628 Assert(pPayload->cbData == sizeof(SHCLREPLY)); 629 630 PSHCLREPLY pReply = (PSHCLREPLY)pPayload->pvData; 631 AssertPtr(pReply); 632 633 Assert(pReply->uType == VBOX_SHCL_TX_REPLYMSGTYPE_OBJ_OPEN); 634 635 LogFlowFunc(("hObj=%RU64\n", pReply->u.ObjOpen.uHandle)); 636 637 *phObj = pReply->u.ObjOpen.uHandle; 638 639 ShClPayloadFree(pPayload); 630 int rcEvent; 631 PSHCLEVENTPAYLOAD pPayload; 632 rc = ShClEventWaitEx(pEvent, pCtx->pTransfer->uTimeoutMs, &rcEvent, &pPayload); 633 if (RT_SUCCESS(rc)) 634 { 635 Assert(pPayload->cbData == sizeof(SHCLREPLY)); 636 637 PSHCLREPLY pReply = (PSHCLREPLY)pPayload->pvData; 638 AssertPtr(pReply); 639 640 Assert(pReply->uType == VBOX_SHCL_TX_REPLYMSGTYPE_OBJ_OPEN); 641 642 LogFlowFunc(("hObj=%RU64\n", pReply->u.ObjOpen.uHandle)); 643 644 *phObj = pReply->u.ObjOpen.uHandle; 645 646 ShClPayloadFree(pPayload); 647 } 648 else 649 rc = rcEvent; 640 650 } 641 else642 rc = rcEvent;643 651 } 644 652
Note:
See TracChangeset
for help on using the changeset viewer.