Alexandre Julliard : mountmgr: Query the drive type from the registry for the initial creation.

Alexandre Julliard julliard at winehq.org
Wed Oct 22 07:59:50 CDT 2008


Module: wine
Branch: master
Commit: 73229f05c259f194f12b81d92adc1b5f169699a3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=73229f05c259f194f12b81d92adc1b5f169699a3

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 21 15:42:21 2008 +0200

mountmgr: Query the drive type from the registry for the initial creation.

---

 dlls/mountmgr.sys/device.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 4328de4..8b68608 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -373,21 +373,46 @@ static void create_drive_devices(void)
     char *path, *p, *link;
     struct dos_drive *drive;
     unsigned int i;
+    HKEY drives_key;
+    DWORD drive_type;
+    WCHAR driveW[] = {'a',':',0};
 
     if (!(path = get_dosdevices_path( &p ))) return;
+    if (RegOpenKeyW( HKEY_LOCAL_MACHINE, drives_keyW, &drives_key )) drives_key = 0;
 
     for (i = 0; i < MAX_DOS_DRIVES; i++)
     {
         p[0] = 'a' + i;
         p[2] = 0;
         if (!(link = read_symlink( path ))) continue;
-        if (!create_disk_device( NULL, i < 2 ? DRIVE_REMOVABLE : DRIVE_FIXED, &drive ))
+
+        drive_type = i < 2 ? DRIVE_REMOVABLE : DRIVE_FIXED;
+        if (drives_key)
+        {
+            WCHAR buffer[32];
+            DWORD j, type, size = sizeof(buffer);
+
+            driveW[0] = 'a' + i;
+            if (!RegQueryValueExW( drives_key, driveW, NULL, &type, (BYTE *)buffer, &size ) &&
+                type == REG_SZ)
+            {
+                for (j = 0; j < sizeof(drive_types)/sizeof(drive_types[0]); j++)
+                    if (drive_types[j][0] && !strcmpiW( buffer, drive_types[j] ))
+                    {
+                        drive_type = j;
+                        break;
+                    }
+            }
+        }
+
+        if (!create_disk_device( NULL, drive_type, &drive ))
         {
             drive->unix_mount = link;
             set_drive_letter( drive, i );
         }
         else RtlFreeHeap( GetProcessHeap(), 0, link );
     }
+    RegCloseKey( drives_key );
     RtlFreeHeap( GetProcessHeap(), 0, path );
 }
 




More information about the wine-cvs mailing list