Alexandre Julliard : kernel32: Use the NT name to open the root directory in GetVolumeInformationW.
Alexandre Julliard
julliard at winehq.org
Wed Oct 20 13:24:37 CDT 2010
Module: wine
Branch: master
Commit: 5820f408623458c46e86cec37ff202c0614eee69
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5820f408623458c46e86cec37ff202c0614eee69
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Oct 20 12:25:32 2010 +0200
kernel32: Use the NT name to open the root directory in GetVolumeInformationW.
---
dlls/kernel32/volume.c | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index a198add..0a3cc6a 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -521,6 +521,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
UNICODE_STRING nt_name;
IO_STATUS_BLOCK io;
OBJECT_ATTRIBUTES attr;
+ FILE_FS_DEVICE_INFORMATION info;
WCHAR *p;
enum fs_type type = FS_UNKNOWN;
BOOL ret = FALSE;
@@ -592,22 +593,20 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
/* we couldn't open the device, fallback to default strategy */
- switch(GetDriveTypeW( root ))
+ status = NtOpenFile( &handle, 0, &attr, &io, 0, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
+ if (status != STATUS_SUCCESS)
{
- case DRIVE_UNKNOWN:
- case DRIVE_NO_ROOT_DIR:
- SetLastError( ERROR_NOT_READY );
+ SetLastError( RtlNtStatusToDosError(status) );
+ goto done;
+ }
+ status = NtQueryVolumeInformationFile( handle, &io, &info, sizeof(info), FileFsDeviceInformation );
+ NtClose( handle );
+ if (status != STATUS_SUCCESS)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
goto done;
- case DRIVE_REMOVABLE:
- case DRIVE_FIXED:
- case DRIVE_REMOTE:
- case DRIVE_RAMDISK:
- type = FS_UNKNOWN;
- break;
- case DRIVE_CDROM:
- type = FS_ISO9660;
- break;
}
+ if (info.DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) type = FS_ISO9660;
if (label && label_len) get_filesystem_label( device, label, label_len );
if (serial) *serial = get_filesystem_serial( device );
More information about the wine-cvs
mailing list