Changeset 31025 in vbox
- Timestamp:
- Jul 22, 2010 11:43:25 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63945
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLib.h
r31002 r31025 514 514 * Structure containing mapping information for a shared folder. 515 515 */ 516 struct VBGLR3SHAREDFOLDERMAPPING516 typedef struct VBGLR3SHAREDFOLDERMAPPING 517 517 { 518 518 /** Mapping status. */ … … 520 520 /** Root handle. */ 521 521 uint32_t u32Root; 522 }; 522 } VBGLR3SHAREDFOLDERMAPPING; 523 /** Pointer to a shared folder mapping information struct. */ 523 524 typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING; 524 /** @todo Docs. */ 525 525 526 VBGLR3DECL(int) VbglR3SharedFolderConnect(uint32_t *pu32ClientId); 526 527 VBGLR3DECL(int) VbglR3SharedFolderDisconnect(uint32_t u32ClientId); 527 VBGLR3DECL(int) VbglR3SharedFolderGetMappings(uint32_t u32ClientId, bool bAutoMountOnly, 528 VBGLR3SHAREDFOLDERMAPPING paMappings[], uint32_t cbMappings, 529 uint32_t *pcMapCount); 530 VBGLR3DECL(int) VbglR3SharedFolderGetName(uint32_t u32ClientId,uint32_t u32Root, 531 char **ppszName, uint32_t *pcbLen); 528 VBGLR3DECL(int) VbglR3SharedFolderGetMappings(uint32_t u32ClientId, bool fAutoMountOnly, 529 PVBGLR3SHAREDFOLDERMAPPING paMappings, uint32_t cbMappings, 530 uint32_t *pcMappings); 531 VBGLR3DECL(int) VbglR3SharedFolderGetName(uint32_t u32ClientId,uint32_t u32Root, char **ppszName); 532 532 /** @} */ 533 533 # endif /* VBOX_WITH_SHARED_FOLDERS defined */ -
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r31002 r31025 1298 1298 uint32_t cMappings = 64; /* See shflsvc.h for define; should be used later. */ 1299 1299 uint32_t cbMappings = cMappings * sizeof(VBGLR3SHAREDFOLDERMAPPING); 1300 VBGLR3SHAREDFOLDERMAPPING *p Mappings = (VBGLR3SHAREDFOLDERMAPPING*)RTMemAlloc(cbMappings);1301 1302 if (p Mappings)1300 VBGLR3SHAREDFOLDERMAPPING *paMappings = (PVBGLR3SHAREDFOLDERMAPPING)RTMemAlloc(cbMappings); 1301 1302 if (paMappings) 1303 1303 { 1304 1304 rc = VbglR3SharedFolderGetMappings(u32ClientId, fOnlyShowAutoMount, 1305 p Mappings, cbMappings,1305 paMappings, cbMappings, 1306 1306 &cMappings); 1307 1307 if (RT_SUCCESS(rc)) … … 1311 1311 for (uint32_t i = 0; i < cMappings; i++) 1312 1312 { 1313 char *ppszName = NULL; 1314 uint32_t pcbLen = 0; 1315 rc = VbglR3SharedFolderGetName(u32ClientId, pMappings[i].u32Root, 1316 &ppszName, &pcbLen); 1313 char *pszName; 1314 rc = VbglR3SharedFolderGetName(u32ClientId, paMappings[i].u32Root, &pszName); 1317 1315 if (RT_SUCCESS(rc)) 1318 1316 { 1319 RTPrintf("%02u - %s\n", i + 1, p pszName);1320 RTStrFree(p pszName);1317 RTPrintf("%02u - %s\n", i + 1, pszName); 1318 RTStrFree(pszName); 1321 1319 } 1322 1320 else 1323 1321 VBoxControlError("Error while getting the shared folder name for root node = %u, rc = %Rrc\n", 1324 p Mappings[i].u32Root, rc);1322 paMappings[i].u32Root, rc); 1325 1323 } 1326 1324 if (cMappings == 0) … … 1329 1327 else 1330 1328 VBoxControlError("Error while getting the shared folder mappings, rc = %Rrc\n", rc); 1331 RTMemFree(p Mappings);1329 RTMemFree(paMappings); 1332 1330 } 1333 1331 else -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSharedFolders.cpp
r31013 r31025 38 38 39 39 #include "VBGLR3Internal.h" 40 40 41 41 42 /** … … 90 91 * @returns VBox status code. 91 92 * @param u32ClientId The client id returned by VbglR3InvsSvcConnect(). 92 * @param bAutoMountOnly Flag whether only auto-mounted shared folders should be reported. 93 * @param fAutoMountOnly Flag whether only auto-mounted shared folders 94 * should be reported. 93 95 * @param paMappings Pointer to a preallocated array which will retrieve the mapping info. 94 96 * @param cbMappings Size (in bytes) of the provided array. 95 * @param pcMapCount Number of mappings returned. 97 * @param pcMappings On input, the size of @a paMappings gives as an 98 * item count. On output, the number of mappings 99 * returned in @a paMappings. 100 * 101 * @todo r=bird: cbMappings and @a *pcMappings overlap. The better API 102 * would be to change cbMappings to cMappings (the entries are fixed 103 * sized) and move the move the input aspect of @a *pcMappings to it. 104 * 105 * However, it would be better if this function would do the array 106 * allocation. This way you could deal with too-much-data conditions 107 * here (or hide the max-number-of-shared-folders-per-vm-define). 108 * Then paMappings would become ppaMappings and cbMappings could be 109 * removed altogether. *pcMappings would only be output. A 110 * corresponding VbglR3SharedFolderFreeMappings would be required for 111 * a 100% clean API (this is an (/going to be) offical API for C/C++ 112 * programs). 96 113 */ 97 VBGLR3DECL(int) VbglR3SharedFolderGetMappings(uint32_t u32ClientId, bool bAutoMountOnly,98 VBGLR3SHAREDFOLDERMAPPING paMappings[], uint32_tcbMappings,99 uint32_t *pcMapCount)114 VBGLR3DECL(int) VbglR3SharedFolderGetMappings(uint32_t u32ClientId, bool fAutoMountOnly, 115 PVBGLR3SHAREDFOLDERMAPPING paMappings, uint32_t cbMappings, 116 uint32_t *pcMappings) 100 117 { 101 int rc; 102 103 AssertPtr(pcMapCount); 118 AssertPtr(pcMappings); 104 119 105 120 VBoxSFQueryMappings Msg; … … 111 126 112 127 /* Set the mapping flags. */ 113 uint32_t u32Flags = 0; /* @todo SHFL_MF_UTF8 is not implemented yet. */114 if ( bAutoMountOnly) /* We only want the mappings which get auto-mounted. */128 uint32_t u32Flags = 0; /** @todo SHFL_MF_UTF8 is not implemented yet. */ 129 if (fAutoMountOnly) /* We only want the mappings which get auto-mounted. */ 115 130 u32Flags |= SHFL_MF_AUTOMOUNT; 116 131 VbglHGCMParmUInt32Set(&Msg.flags, u32Flags); 117 132 118 133 /* Init the rest of the message. */ 119 VbglHGCMParmUInt32Set(&Msg.numberOfMappings, *pcMap Count);134 VbglHGCMParmUInt32Set(&Msg.numberOfMappings, *pcMappings); 120 135 VbglHGCMParmPtrSet(&Msg.mappings, &paMappings[0], cbMappings); 121 136 122 rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));137 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); 123 138 if (RT_SUCCESS(rc)) 124 139 { 125 VbglHGCMParmUInt32Get(&Msg.numberOfMappings, pcMap Count);140 VbglHGCMParmUInt32Get(&Msg.numberOfMappings, pcMappings); 126 141 rc = Msg.callInfo.result; 127 142 } … … 136 151 * @param u32ClientId The client id returned by VbglR3InvsSvcConnect(). 137 152 * @param u32Root Root ID of shared folder to get the name for. 138 * @param ppszName Name of the shared folder.139 * @param pcbLen Length (in bytes) of shared folder name.153 * @param ppszName Where to return the name string. This shall be 154 * freed by calling RTStrFree. 140 155 */ 141 VBGLR3DECL(int) VbglR3SharedFolderGetName(uint32_t u32ClientId, uint32_t u32Root, 142 char **ppszName, uint32_t *pcbLen) 156 VBGLR3DECL(int) VbglR3SharedFolderGetName(uint32_t u32ClientId, uint32_t u32Root, char **ppszName) 143 157 { 144 int rc;145 146 158 AssertPtr(ppszName); 147 AssertPtr(pcbLen);148 159 149 160 VBoxSFQueryMapName Msg; … … 154 165 Msg.callInfo.cParms = 2; 155 166 156 uint32_t cbString = sizeof(SHFLSTRING) + SHFL_MAX_LEN; 167 int rc; 168 uint32_t cbString = sizeof(SHFLSTRING) + SHFL_MAX_LEN; 157 169 PSHFLSTRING pString = (PSHFLSTRING)RTMemAlloc(cbString); 158 170 if (pString) … … 168 180 { 169 181 *ppszName = NULL; 170 rc = RTUtf16ToUtf8Ex((PCRTUTF16)&pString->String.ucs2, RTSTR_MAX, 171 ppszName, (size_t)pcbLen, NULL); 182 rc = RTUtf16ToUtf8(&pString->String.ucs2[0], ppszName); 172 183 if (RT_SUCCESS(rc)) 173 rc = Msg.callInfo.result; 184 rc = Msg.callInfo.result; /** @todo r=bird: Shouldn't you check this *before* doing the conversion? */ 174 185 } 175 186 RTMemFree(pString);
Note:
See TracChangeset
for help on using the changeset viewer.