Changeset 30371 in vbox
- Timestamp:
- Jun 22, 2010 12:29:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/fs-win.cpp
r30365 r30371 338 338 * Internal helper for comparing a WCHAR string with a char string. 339 339 * 340 * @returns 0 if equal, -1 if @a psz1 < @a psz2, 1 if @a psz1 < @a psz2. 341 * @param pwsz1 The first string. 342 * @param psz2 The second string. 343 */ 344 static int rtFsWinCmpUtf16(WCHAR const *pwsz1, const char *psz2) 345 { 346 for (;;) 340 * @returns @c true if equal, @c false if not. 341 * @param pwsz1 The first string. 342 * @param cb1 The length of the first string, in bytes. 343 * @param psz2 The second string. 344 * @param cch2 The length of the second string. 345 */ 346 static bool rtFsWinAreEqual(WCHAR const *pwsz1, size_t cch1, const char *psz2, size_t cch2) 347 { 348 if (cch1 != cch2 * 2) 349 return false; 350 while (cch2-- > 0) 347 351 { 348 352 unsigned ch1 = *pwsz1++; 349 353 unsigned ch2 = (unsigned char)*psz2++; 350 354 if (ch1 != ch2) 351 return ch1 < ch2 ? -1 : 1; 352 if (!ch1) 353 return 0; 354 } 355 return false; 356 } 357 return true; 355 358 } 356 359 … … 390 393 { 391 394 PFILE_FS_ATTRIBUTE_INFORMATION pFsAttrInfo = (PFILE_FS_ATTRIBUTE_INFORMATION)abBuf; 392 393 if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "NTFS")) 395 if (pFsAttrInfo->FIleSystemNameLength) 396 { 397 } 398 #define IS_FS(szName) \ 399 rtFsWinAreEqual(pFsAttrInfo->FileSystemName, pFsAttrInfo->FIleSystemNameLength, szName, sizeof(szName) - 1) 400 if (IS_FS("NTFS")) 394 401 *penmType = RTFSTYPE_NTFS; 395 else if ( !rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName,"FAT"))402 else if (IS_FS("FAT")) 396 403 *penmType = RTFSTYPE_FAT; 397 else if ( !rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName,"FAT32"))404 else if (IS_FS("FAT32")) 398 405 *penmType = RTFSTYPE_FAT; 399 else if ( !rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName,"VBoxSharedFolderFS"))406 else if (IS_FS("VBoxSharedFolderFS")) 400 407 *penmType = RTFSTYPE_VBOXSHF; 408 #undef IS_FS 401 409 } 402 410 else
Note:
See TracChangeset
for help on using the changeset viewer.