kernel32: Return correct drive type for empty drives

Alexandre Goujon ale.goujon at gmail.com
Tue Aug 28 09:43:33 CDT 2012


Should fix bug #17037
I followed your advice and now, I only ask the mountmgr when needed.
---
 dlls/kernel32/volume.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 238dd9c..7dc975c 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -1546,7 +1546,15 @@ UINT WINAPI GetDriveTypeW(LPCWSTR root) /* [in] String describing drive */
     HANDLE handle;
     UINT ret;
 
-    if (!open_device_root( root, &handle )) return DRIVE_NO_ROOT_DIR;
+    if (!open_device_root( root, &handle ))
+    {
+        /* Getting empty drive handle fails because there's not mount point
+             So in this case, get the drive type from the mountmgr */
+        if (GetLastError() == ERROR_PATH_NOT_FOUND
+        && ((ret = get_mountmgr_drive_type(root)) != DRIVE_UNKNOWN))
+            return ret;
+        return DRIVE_NO_ROOT_DIR;
+    }
 
     status = NtQueryVolumeInformationFile( handle, &io, &info, sizeof(info), FileFsDeviceInformation );
     NtClose( handle );
-- 
1.7.9.5




More information about the wine-patches mailing list