- Timestamp:
- Aug 1, 2007 9:09:18 AM (17 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c
r3944 r3954 217 217 rc = data.callInfo.result; 218 218 } 219 else 220 if (rc == VERR_NOT_IMPLEMENTED) 221 { 222 /* try the legacy interface too; temporary to assure backwards compatibility */ 223 VBoxSFMapFolder_Old data; 224 225 VBOX_INIT_CALL(&data.callInfo, MAP_FOLDER_OLD, pClient); 226 227 data.path.type = VMMDevHGCMParmType_LinAddr; 228 data.path.u.Pointer.size = ShflStringSizeOfBuffer (szFolderName); 229 data.path.u.Pointer.u.linearAddr = (VBOXGCPTR)szFolderName; 230 231 data.root.type = VMMDevHGCMParmType_32bit; 232 data.root.u.value32 = 0; 233 234 data.delimiter.type = VMMDevHGCMParmType_32bit; 235 data.delimiter.u.value32 = RTPATH_DELIMITER; 236 237 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data)); 238 239 if (VBOX_SUCCESS (rc)) 240 { 241 pMap->root = data.root.u.value32; 242 rc = data.callInfo.result; 243 } 244 } 219 245 return rc; 220 246 } -
trunk/src/VBox/HostServices/SharedFolders/service.cpp
r3944 r3954 1032 1032 { 1033 1033 rc = VERR_NOT_IMPLEMENTED; 1034 break; 1034 1035 } 1035 1036 } -
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r3944 r3954 95 95 } 96 96 97 static int vbsfCorrectCasing(char *pszFullPath, char *pszStartComponent) 98 { 99 PRTDIRENTRYEX pDirEntry = 0, pDirEntryOrg; 100 uint32_t cbDirEntry, cbBufferOrg; 101 int rc = VERR_FILE_NOT_FOUND; 102 RTDIR hSearch; 103 104 cbDirEntry = 4096; 105 pDirEntryOrg = pDirEntry = (PRTDIRENTRYEX)RTMemAlloc(cbDirEntry); 106 if (pDirEntry == 0) 107 { 108 AssertFailed(); 109 return VERR_NO_MEMORY; 110 } 111 112 /** @todo this is quite inefficient, especially for directories with many files */ 113 rc = RTDirOpenFiltered (&hSearch, pszFullPath, RTDIRFILTER_WINNT); 114 if (VBOX_FAILURE(rc)) 115 goto end; 116 117 for(;;) 118 { 119 uint32_t cbDirEntrySize = cbDirEntry; 120 uint32_t cbNeeded; 121 122 pDirEntry = pDirEntryOrg; 123 124 rc = RTDirReadEx(DirHandle, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING); 125 if (rc == VERR_NO_MORE_FILES) 126 { 127 *pIndex = 0; /* listing completed */ 128 break; 129 } 130 131 if (VINF_SUCCESS != rc && rc != VWRN_NO_DIRENT_INFO) 132 { 133 AssertFailed(); 134 if (rc != VERR_NO_TRANSLATION) 135 break; 136 else 137 continue; 138 } 139 140 } 141 Assert(rc != VINF_SUCCESS); 142 143 end: 144 if (pDirEntry) 145 RTMemFree(pDirEntry); 146 147 RTDirClose(hSearch); 148 return rc; 149 } 150 97 151 static int vbsfBuildFullPath (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pPath, 98 152 uint32_t cbPath, char **ppszFullPath, uint32_t *pcbFullPathRoot) … … 247 301 RTFSOBJINFO info; 248 302 rc = RTPathQueryInfo (pszFullPath, &info, RTFSOBJATTRADD_NOTHING); 249 if (rc != VINF_SUCCESS) 250 { 251 char *src = pszFullPath; 303 if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND) 304 { 305 uint32_t len = strlen(pszFullPath); 306 char *src = pszFullPath + len - 1; 252 307 253 Assert(rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND); 254 Log(("Handle case insenstive guest fs on top of host case sensitive fs for %ws\n", pszFullPath)); 255 while(*src) 308 Log(("Handle case insenstive guest fs on top of host case sensitive fs for %s\n", pszFullPath)); 309 310 /* Find partial path that's valid */ 311 while(src > pszFullPath) 256 312 { 257 313 if (*src == RTPATH_DELIMITER) 258 break; 259 src++; 314 { 315 *src = 0; 316 rc = RTPathQueryInfo (pszFullPath, &info, RTFSOBJATTRADD_NOTHING); 317 *src = RTPATH_DELIMITER; 318 if (rc == VINF_SUCCESS) 319 { 320 #ifdef DEBUG 321 *src = 0; 322 Log(("Found valid partial path %s\n", pszFullPath)); 323 *src = RTPATH_DELIMITER; 324 #endif 325 break; 326 } 327 } 328 329 src--; 260 330 } 261 Assert(*src); 262 if (*src) 331 Assert(*src == RTPATH_DELIMITER && VBOX_SUCCESS(rc)); 332 if ( *src == RTPATH_DELIMITER 333 && VBOX_SUCCESS(rc)) 263 334 { 264 335 src++; … … 279 350 280 351 rc = RTPathQueryInfo(src, &info, RTFSOBJATTRADD_NOTHING); 281 if (rc != VINF_SUCCESS) 352 Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND); 353 if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND) 282 354 { 283 Assert(rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND); 355 /* path component is invalid; try to correct the casing */ 356 rc = vbsfCorrectCasing(pszFullPath, src); 357 if (VBOX_FAILURE(rc)) 358 break; 284 359 } 285 360 … … 287 362 src = end + 1; 288 363 } 364 Assert(rc == VINF_SUCCESS); 289 365 } 290 291 } 292 rc = VINF_SUCCESS; 366 else 367 rc = VERR_FILE_NOT_FOUND; 368 369 } 293 370 } 294 371 #endif
Note:
See TracChangeset
for help on using the changeset viewer.