Changeset 75407 in vbox for trunk/include
- Timestamp:
- Nov 12, 2018 8:06:57 PM (6 years ago)
- Location:
- trunk/include/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLib.h
r74535 r75407 682 682 PVBGLR3SHAREDFOLDERMAPPING *ppaMappings, uint32_t *pcMappings); 683 683 VBGLR3DECL(void) VbglR3SharedFolderFreeMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings); 684 VBGLR3DECL(int) VbglR3SharedFolderGetName(HGCMCLIENTID idClient,uint32_t u32Root, char **ppszName); 685 VBGLR3DECL(int) VbglR3SharedFolderGetMountPrefix(char **ppszPrefix); 686 VBGLR3DECL(int) VbglR3SharedFolderGetMountDir(char **ppszDir); 684 VBGLR3DECL(int) VbglR3SharedFolderGetName(HGCMCLIENTID idClient,uint32_t u32Root, char **ppszName); /**< @todo r=bird: GET functions return the value, not a status code!*/ 685 VBGLR3DECL(int) VbglR3SharedFolderQueryFolderInfo(HGCMCLIENTID idClient, uint32_t idRoot, uint64_t fQueryFlags, 686 char **ppszName, char **ppszMountPoint, 687 uint64_t *pfFlags, uint32_t *puRootIdVersion); 688 VBGLR3DECL(int) VbglR3SharedFolderWaitForMappingsChanges(HGCMCLIENTID idClient, uint32_t uPrevVersion, uint32_t *puCurVersion); 689 VBGLR3DECL(int) VbglR3SharedFolderCancelMappingsChangesWaits(HGCMCLIENTID idClient); 690 691 VBGLR3DECL(int) VbglR3SharedFolderGetMountPrefix(char **ppszPrefix); /**< @todo r=bird: GET functions return the value, not a status code! */ 692 VBGLR3DECL(int) VbglR3SharedFolderGetMountDir(char **ppszDir); /**< @todo r=bird: GET functions return the value, not a status code! */ 687 693 /** @} */ 688 694 # endif /* VBOX_WITH_SHARED_FOLDERS defined */ -
trunk/include/VBox/shflsvc.h
r75384 r75407 77 77 * @{ 78 78 */ 79 /** Query mappings changes. */ 79 /** Query mappings changes. 80 * @note Description is currently misleading, it will always return all 81 * current mappings with SHFL_MS_NEW status. Only modification is the 82 * SHFL_MF_AUTOMOUNT flag that causes filtering out non-auto mounts. */ 80 83 #define SHFL_FN_QUERY_MAPPINGS (1) 81 /** Query mappings changes. */84 /** Query the name of a map. */ 82 85 #define SHFL_FN_QUERY_MAP_NAME (2) 83 86 /** Open/create object. */ … … 118 121 * @since VBox 4.0 */ 119 122 #define SHFL_FN_SET_SYMLINKS (20) 123 /** Query information about a map. 124 * @since VBox 6.0 */ 125 #define SHFL_FN_QUERY_MAP_INFO (21) 126 /** Wait for changes to the mappings. 127 * @since VBox 6.0 */ 128 #define SHFL_FN_WAIT_FOR_MAPPINGS_CHANGES (22) 129 /** Cancel all waits for changes to the mappings for the calling client. 130 * The wait calls will return VERR_CANCELLED. 131 * @since VBox 6.0 */ 132 #define SHFL_FN_CANCEL_MAPPINGS_CHANGES_WAITS (23) 120 133 /** @} */ 121 134 … … 240 253 * Helper for copying one string into another. 241 254 * 242 * @returns pDst243 * @ param pDst The destination string. Assumed to be the same size as244 * the source.255 * @returns IPRT status code. 256 * @retval VERR_BUFFER_OVERFLOW and pDst->u16Length set to source length. 257 * @param pDst The destination string. 245 258 * @param pSrc The source string. 246 */ 247 DECLINLINE(PSHFLSTRING) ShflStringCopy(PSHFLSTRING pDst, PCSHFLSTRING pSrc) 248 { 259 * @param cbTerm The size of the string terminator. 260 */ 261 DECLINLINE(int) ShflStringCopy(PSHFLSTRING pDst, PCSHFLSTRING pSrc, size_t cbTerm) 262 { 263 int rc = VINF_SUCCESS; 264 if (pDst->u16Size >= pSrc->u16Length + cbTerm) 265 { 266 memcpy(&pDst->String, &pSrc->String, pSrc->u16Length); 267 switch (cbTerm) 268 { 269 default: 270 case 2: pDst->String.ach[pSrc->u16Length + 1] = '\0'; RT_FALL_THROUGH(); 271 case 1: pDst->String.ach[pSrc->u16Length + 0] = '\0'; break; 272 case 0: break; 273 } 274 } 275 else 276 rc = VERR_BUFFER_OVERFLOW; 249 277 pDst->u16Length = pSrc->u16Length; 250 pDst->u16Size = pSrc->u16Size; 251 memcpy(&pDst->String, &pSrc->String, pSrc->u16Size); 252 return pDst; 278 return rc; 253 279 } 254 280 … … 265 291 PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + pSrc->u16Size); 266 292 if (pDst) 267 return ShflStringCopy(pDst, pSrc); 293 { 294 pDst->u16Length = pSrc->u16Length; 295 pDst->u16Size = pSrc->u16Size; 296 memcpy(&pDst->String, &pSrc->String, pSrc->u16Size); 297 } 268 298 return pDst; 269 299 } … … 355 385 AssertMsgFailed(("rc=%Rrc cwcConversion=%#x\n", rc, cwcConversion)); 356 386 return NULL; 387 } 388 389 /** 390 * Copies a UTF-8 string to a buffer as UTF-16. 391 * 392 * @returns IPRT status code. 393 * @param pDst The destination buffer. 394 * @param pszSrc The source string. 395 * @param cchSrc The source string length, or RTSTR_MAX. 396 */ 397 DECLINLINE(int) ShflStringCopyUtf8AsUtf16(PSHFLSTRING pDst, const char *pszSrc, size_t cchSrc) 398 { 399 int rc; 400 size_t cwcDst = 0; 401 if (pDst->u16Size >= sizeof(RTUTF16)) 402 { 403 PRTUTF16 pwszDst = pDst->String.utf16; 404 rc = RTStrToUtf16Ex(pszSrc, cchSrc, &pwszDst, pDst->u16Size / sizeof(RTUTF16), &cwcDst); 405 } 406 else 407 { 408 RTStrCalcUtf16LenEx(pszSrc, cchSrc, &cwcDst); 409 rc = VERR_BUFFER_OVERFLOW; 410 } 411 pDst->u16Length = (uint16_t)(cwcDst * sizeof(RTUTF16)); 412 return rc != VERR_BUFFER_OVERFLOW || cwcDst < UINT16_MAX / sizeof(RTUTF16) ? rc : VERR_TOO_MUCH_DATA; 413 } 414 415 /** 416 * Copies a UTF-8 string buffer to another buffer as UTF-16 417 * 418 * @returns IPRT status code. 419 * @param pDst The destination buffer (UTF-16). 420 * @param pSrc The source buffer (UTF-8). 421 */ 422 DECLINLINE(int) ShflStringCopyUtf8BufAsUtf16(PSHFLSTRING pDst, PCSHFLSTRING pSrc) 423 { 424 return ShflStringCopyUtf8AsUtf16(pDst, pSrc->String.ach, pSrc->u16Length); 425 } 426 427 /** 428 * Copies a UTF-16 string to a buffer as UTF-8 429 * 430 * @returns IPRT status code. 431 * @param pDst The destination buffer. 432 * @param pwszSrc The source string. 433 * @param cwcSrc The source string length, or RTSTR_MAX. 434 */ 435 DECLINLINE(int) ShflStringCopyUtf16AsUtf8(PSHFLSTRING pDst, PCRTUTF16 pwszSrc, size_t cwcSrc) 436 { 437 int rc; 438 size_t cchDst = 0; 439 if (pDst->u16Size > 0) 440 { 441 char *pszDst = pDst->String.ach; 442 rc = RTUtf16ToUtf8Ex(pwszSrc, cwcSrc, &pszDst, pDst->u16Size, &cchDst); 443 } 444 else 445 { 446 RTUtf16CalcUtf8LenEx(pwszSrc, cwcSrc, &cchDst); 447 rc = VERR_BUFFER_OVERFLOW; 448 } 449 pDst->u16Length = (uint16_t)cchDst; 450 return rc != VERR_BUFFER_OVERFLOW || cchDst < UINT16_MAX ? rc : VERR_TOO_MUCH_DATA; 451 } 452 453 /** 454 * Copies a UTF-16 string buffer to another buffer as UTF-8 455 * 456 * @returns IPRT status code. 457 * @param pDst The destination buffer (UTF-8). 458 * @param pSrc The source buffer (UTF-16). 459 */ 460 DECLINLINE(int) ShflStringCopyUtf16BufAsUtf8(PSHFLSTRING pDst, PCSHFLSTRING pSrc) 461 { 462 return ShflStringCopyUtf16AsUtf8(pDst, pSrc->String.utf16, pSrc->u16Length / sizeof(RTUTF16)); 357 463 } 358 464 … … 802 908 typedef struct _SHFLMAPPING 803 909 { 804 /** Mapping status. */ 910 /** Mapping status. 911 * @note Currently always set to SHFL_MS_NEW. */ 805 912 uint32_t u32Status; 806 913 /** Root handle. */ … … 1558 1665 1559 1666 1667 /** @name SHFL_FN_QUERY_MAP_INFO 1668 * @{ 1669 */ 1670 /** Query flag: Guest prefers drive letters as mount points. */ 1671 #define SHFL_MIQF_DRIVE_LETTER RT_BIT_64(0) 1672 /** Query flag: Guest prefers paths as mount points. */ 1673 #define SHFL_MIQF_PATH RT_BIT_64(1) 1674 1675 /** Set if writable. */ 1676 #define SHFL_MIF_WRITABLE RT_BIT_64(0) 1677 /** Indicates that the mapping should be auto-mounted. */ 1678 #define SHFL_MIF_AUTO_MOUNT RT_BIT_64(1) 1679 /** Set if host is case insensitive. */ 1680 #define SHFL_MIF_HOST_ICASE RT_BIT_64(2) 1681 /** Set if guest is case insensitive. */ 1682 #define SHFL_MIF_GUEST_ICASE RT_BIT_64(3) 1683 /** Symbolic link creation is allowed. */ 1684 #define SHFL_MIF_SYMLINK_CREATION RT_BIT_64(4) 1685 1686 /** Parameters structure. */ 1687 typedef struct VBoxSFQueryMapInfo 1688 { 1689 /** Common header. */ 1690 VBGLIOCHGCMCALL callInfo; 1691 /** 32-bit, in: SHFLROOT - root handle of the mapping to query. */ 1692 HGCMFunctionParameter root; 1693 /** pointer, in/out: SHFLSTRING buffer for the name. */ 1694 HGCMFunctionParameter name; 1695 /** pointer, in/out: SHFLSTRING buffer for the auto mount point. */ 1696 HGCMFunctionParameter mountPoint; 1697 /** 64-bit, in: SHFL_MIQF_XXX; out: SHFL_MIF_XXX. */ 1698 HGCMFunctionParameter flags; 1699 /** 32-bit, out: Root ID version number - root handle reuse guard. */ 1700 HGCMFunctionParameter rootIdVersion; 1701 } VBoxSFQueryMapInfo; 1702 /** Number of parameters */ 1703 #define SHFL_CPARMS_QUERY_MAP_INFO (5) 1704 /** @} */ 1705 1706 1707 /** @name SHFL_FN_WAIT_FOR_MAPPINGS_CHANGES 1708 * 1709 * Returns VINF_SUCCESS on change and VINF_TRY_AGAIN when restored from saved 1710 * state. If the guest makes too many calls (max 64) VERR_OUT_OF_RESOURCES will 1711 * be returned. 1712 * 1713 * @{ 1714 */ 1715 /** Parameters structure. */ 1716 typedef struct VBoxSFWaitForMappingsChanges 1717 { 1718 /** Common header. */ 1719 VBGLIOCHGCMCALL callInfo; 1720 /** 32-bit, in/out: The mappings configuration version. 1721 * On input the client sets it to the last config it knows about, on return 1722 * it holds the current version. */ 1723 HGCMFunctionParameter version; 1724 } VBoxSFWaitForMappingsChanges; 1725 /** Number of parameters */ 1726 #define SHFL_CPARMS_WAIT_FOR_MAPPINGS_CHANGES (1) 1727 /** @} */ 1728 1729 1730 /** @name SHFL_FN_CANCEL_MAPPINGS_CHANGES_WAITS 1731 * @{ 1732 */ 1733 /** Number of parameters */ 1734 #define SHFL_CPARMS_CANCEL_MAPPINGS_CHANGES_WAITS (0) 1735 /** @} */ 1736 1560 1737 1561 1738 /** @name SHFL_FN_ADD_MAPPING
Note:
See TracChangeset
for help on using the changeset viewer.