[1/2] [try 2] Use DRIVE_REMOVABLE_DISK for removable devices which are not floppies.

Alexander Morozov amorozov at etersoft.ru
Mon Nov 10 07:39:01 CST 2008


Please use [2/2] [try 2] instead of previous version of [2/2].

Changelog:
Use DRIVE_REMOVABLE_DISK for removable devices which are not floppies.

This patch solves problem with creating A: disk for USB flash drive. Also 
\Device\Harddisk* device is created for such drive.
-------------- next part --------------
From e2737623bfc29f1b8f37e55910bd8ecb0ff27a5f Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Fri, 7 Nov 2008 18:18:24 +0300
Subject: [PATCH] Use DRIVE_REMOVABLE_DISK for removable devices which are not floppies.

---
 dlls/kernel32/volume.c     |    8 ++++++--
 dlls/mountmgr.sys/device.c |    3 ++-
 dlls/mountmgr.sys/hal.c    |    3 ++-
 include/ddk/mountmgr.h     |    2 ++
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 7dc046f..18749a4 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -73,7 +73,8 @@ static const WCHAR drive_types[][8] =
     {'h','d',0}, /* DRIVE_FIXED */
     {'n','e','t','w','o','r','k',0}, /* DRIVE_REMOTE */
     {'c','d','r','o','m',0}, /* DRIVE_CDROM */
-    {'r','a','m','d','i','s','k',0} /* DRIVE_RAMDISK */
+    {'r','a','m','d','i','s','k',0}, /* DRIVE_RAMDISK */
+    {'r','e','m',0} /* DRIVE_REMOVABLE_DISK */
 };
 
 /* read a Unix symlink; returned buffer must be freed by caller */
@@ -280,7 +281,10 @@ static UINT get_registry_drive_type( const WCHAR *root )
         {
             if (!strcmpiW( data, drive_types[i] ))
             {
-                ret = i;
+                if (i <= DRIVE_RAMDISK)
+                    ret = i;
+                else
+                    ret = DRIVE_REMOVABLE;
                 break;
             }
         }
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 00b59ed..3e513ad 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -49,7 +49,8 @@ static const WCHAR drive_types[][8] =
     {'h','d',0}, /* DRIVE_FIXED */
     {'n','e','t','w','o','r','k',0}, /* DRIVE_REMOTE */
     {'c','d','r','o','m',0}, /* DRIVE_CDROM */
-    {'r','a','m','d','i','s','k',0} /* DRIVE_RAMDISK */
+    {'r','a','m','d','i','s','k',0}, /* DRIVE_RAMDISK */
+    {'r','e','m',0} /* DRIVE_REMOVABLE_DISK */
 };
 
 static const WCHAR drives_keyW[] = {'S','o','f','t','w','a','r','e','\\',
diff --git a/dlls/mountmgr.sys/hal.c b/dlls/mountmgr.sys/hal.c
index e1d3da1..d26f52d 100644
--- a/dlls/mountmgr.sys/hal.c
+++ b/dlls/mountmgr.sys/hal.c
@@ -133,7 +133,8 @@ static void new_device( LibHalContext *ctx, const char *udi )
         p_dbus_error_free( &error );  /* ignore error */
 
     if (type && !strcmp( type, "cdrom" )) drive_type = DRIVE_CDROM;
-    else drive_type = DRIVE_REMOVABLE;  /* FIXME: default to removable */
+    else if (!strcmp( type, "floppy" )) drive_type = DRIVE_REMOVABLE;
+    else drive_type = DRIVE_REMOVABLE_DISK;  /* FIXME: default to removable */
 
     add_dos_device( -1, udi, device, mount_point, drive_type );
 
diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h
index f0e836f..b9eaaec 100644
--- a/include/ddk/mountmgr.h
+++ b/include/ddk/mountmgr.h
@@ -52,6 +52,8 @@ static const WCHAR MOUNTMGR_DOS_DEVICE_NAME[] = {'\\','\\','.','\\','M','o','u',
 /* Wine extensions */
 #ifdef WINE_MOUNTMGR_EXTENSIONS
 
+#define DRIVE_REMOVABLE_DISK 7
+
 #define IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 32, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
 #define IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE  CTL_CODE(MOUNTMGRCONTROLTYPE, 33, METHOD_BUFFERED, FILE_READ_ACCESS)
 
-- 
1.5.6.5.GIT



More information about the wine-patches mailing list