kernel32: Try to get the drive type from the mountmgr first
Alexandre Goujon
ale.goujon at gmail.com
Sun Jul 22 08:36:53 CDT 2012
Should fix bug #17037
---
dlls/kernel32/tests/volume.c | 2 ++
dlls/kernel32/volume.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index 8152ae1..175095f 100644
--- a/dlls/kernel32/tests/volume.c
+++ b/dlls/kernel32/tests/volume.c
@@ -908,6 +908,8 @@ static void test_cdrom_ioctl(void)
handle = CreateFileA(drive_full_path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
if(handle == INVALID_HANDLE_VALUE)
{
+ /* GetDriveType also reports DRIVE_CDROM even if there is no disc in is the drive.
+ In this case, the last error is ERROR_ACCESS_DENIED */
trace("Failed to open the device : %u\n", GetLastError());
continue;
}
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 8377e41..cdd4e46 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -1538,6 +1538,7 @@ UINT WINAPI GetDriveTypeW(LPCWSTR root) /* [in] String describing drive */
HANDLE handle;
UINT ret;
+ if ((ret = get_mountmgr_drive_type( root )) != DRIVE_UNKNOWN) return ret;
if (!open_device_root( root, &handle )) return DRIVE_NO_ROOT_DIR;
status = NtQueryVolumeInformationFile( handle, &io, &info, sizeof(info), FileFsDeviceInformation );
@@ -1557,7 +1558,7 @@ UINT WINAPI GetDriveTypeW(LPCWSTR root) /* [in] String describing drive */
case FILE_DEVICE_DISK_FILE_SYSTEM:
if (info.Characteristics & FILE_REMOTE_DEVICE) ret = DRIVE_REMOTE;
else if (info.Characteristics & FILE_REMOVABLE_MEDIA) ret = DRIVE_REMOVABLE;
- else if ((ret = get_mountmgr_drive_type( root )) == DRIVE_UNKNOWN) ret = DRIVE_FIXED;
+ else ret = DRIVE_FIXED;
break;
default:
ret = DRIVE_UNKNOWN;
--
1.7.9.5
More information about the wine-patches
mailing list