~ubuntu-branches/ubuntu/precise/wine1.2/precise

« back to all changes in this revision

Viewing changes to dlls/kernel32/volume.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-12-06 00:21:37 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20101206002137-ywazcomhqf97iw3c
Tags: 1.2.2-0ubuntu1
* New upstream release (LP: #685474)
  - Support for animated cursors. 
  - Translation updates.
  - Various bug fixes. (LP: #665270)
* Add Japanese font aliases to workaround lack of fontconfig substitution
* Recommend requisite umefont as a default (same as Crossover)
* Conflict with "wine" << 1.2.1 to prevent upgrade failures from very old
  ppa packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
        reasonable = num_boot_sectors < total_sectors &&
337
337
                     num_fats < 16 &&
338
338
                     bytes_per_sector >= 512 && bytes_per_sector % 512 == 0 &&
339
 
                     sectors_per_cluster > 1;
 
339
                     sectors_per_cluster >= 1;
340
340
        if (!reasonable) return FS_UNKNOWN;
341
341
        sectors =  total_sectors - num_boot_sectors - num_fats * sect_per_fat -
342
342
            (num_root_dir_ents * 32 + bytes_per_sector - 1) / bytes_per_sector;
513
513
    static const WCHAR fat32W[] = {'F','A','T','3','2',0};
514
514
    static const WCHAR ntfsW[] = {'N','T','F','S',0};
515
515
    static const WCHAR cdfsW[] = {'C','D','F','S',0};
 
516
    static const WCHAR default_rootW[] = {'\\',0};
516
517
 
517
518
    WCHAR device[] = {'\\','\\','.','\\','A',':',0};
518
519
    HANDLE handle;
 
520
    UNICODE_STRING nt_name;
 
521
    WCHAR *p;
519
522
    enum fs_type type = FS_UNKNOWN;
 
523
    BOOL ret = FALSE;
520
524
 
521
 
    if (!root)
522
 
    {
523
 
        WCHAR path[MAX_PATH];
524
 
        GetCurrentDirectoryW( MAX_PATH, path );
525
 
        device[4] = path[0];
526
 
    }
527
 
    else
528
 
    {
529
 
        if (!root[0] || root[1] != ':' || root[lstrlenW(root)-1] != '\\' )
530
 
        {
531
 
            SetLastError( ERROR_INVALID_NAME );
532
 
            return FALSE;
533
 
        }
534
 
        device[4] = root[0];
535
 
    }
 
525
    if (!root) root = default_rootW;
 
526
    if (!RtlDosPathNameToNtPathName_U( root, &nt_name, NULL, NULL ))
 
527
    {
 
528
        SetLastError( ERROR_PATH_NOT_FOUND );
 
529
        return FALSE;
 
530
    }
 
531
    /* there must be exactly one backslash in the name, at the end */
 
532
    p = memchrW( nt_name.Buffer + 4, '\\', (nt_name.Length - 4) / sizeof(WCHAR) );
 
533
    if (p != nt_name.Buffer + nt_name.Length / sizeof(WCHAR) - 1)
 
534
    {
 
535
        SetLastError( ERROR_INVALID_NAME );
 
536
        goto done;
 
537
    }
 
538
    device[4] = nt_name.Buffer[4];
536
539
 
537
540
    /* try to open the device */
538
541
 
566
569
        }
567
570
        CloseHandle( handle );
568
571
        TRACE( "%s: found fs type %d\n", debugstr_w(device), type );
569
 
        if (type == FS_ERROR) return FALSE;
 
572
        if (type == FS_ERROR) goto done;
570
573
 
571
574
        if (label && label_len) VOLUME_GetSuperblockLabel( device, type, superblock, label, label_len );
572
575
        if (serial) *serial = VOLUME_GetSuperblockSerial( device, type, superblock );
581
584
    case DRIVE_UNKNOWN:
582
585
    case DRIVE_NO_ROOT_DIR:
583
586
        SetLastError( ERROR_NOT_READY );
584
 
        return FALSE;
 
587
        goto done;
585
588
    case DRIVE_REMOVABLE:
586
589
    case DRIVE_FIXED:
587
590
    case DRIVE_REMOTE:
618
621
        if (flags) *flags = FILE_CASE_PRESERVED_NAMES;
619
622
        break;
620
623
    }
621
 
    return TRUE;
 
624
    ret = TRUE;
 
625
 
 
626
done:
 
627
    RtlFreeUnicodeString( &nt_name );
 
628
    return ret;
622
629
}
623
630
 
624
631