kernel32: Try to get the drive type from the mountmgr first [resend]
Alexandre Goujon
ale.goujon at gmail.com
Sat Aug 25 08:43:33 CDT 2012
Should fix bug #17037
Now that my patch disappeared from source.winehq.org/patches, I'm resending it.
Before commenting, please read the e-mail I sent in July (winehq.org/pipermail/wine-devel/2012-July/096587.html)
---
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 238dd9c..ef547c9 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -1546,6 +1546,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 );
@@ -1565,7 +1566,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