Alexandre Julliard : mountmgr.sys: Fix values returned for IOCTL_STORAGE_GET_DEVICE_NUMBER on emulated disks.

Alexandre Julliard julliard at winehq.org
Wed Jan 16 13:19:34 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jan 16 15:23:10 2008 +0100

mountmgr.sys: Fix values returned for IOCTL_STORAGE_GET_DEVICE_NUMBER on emulated disks.

---

 dlls/mountmgr.sys/mountmgr.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 98bed94..ee819a5 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -142,17 +142,17 @@ static NTSTATUS create_disk_device( DRIVER_OBJECT *driver, DWORD type, DEVICE_OB
         case DRIVE_REMOVABLE:
             info->devnum.DeviceType = FILE_DEVICE_DISK;
             info->devnum.DeviceNumber = i;
-            info->devnum.PartitionNumber = 0;
+            info->devnum.PartitionNumber = ~0u;
             break;
         case DRIVE_CDROM:
             info->devnum.DeviceType = FILE_DEVICE_CD_ROM;
             info->devnum.DeviceNumber = i;
-            info->devnum.PartitionNumber = 0;
+            info->devnum.PartitionNumber = ~0u;
             break;
         case DRIVE_FIXED:
         default:  /* FIXME */
             info->devnum.DeviceType = FILE_DEVICE_DISK;
-            info->devnum.DeviceNumber = 1;
+            info->devnum.DeviceNumber = 0;
             info->devnum.PartitionNumber = i;
             break;
         }
@@ -441,6 +441,7 @@ static NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STR
     UNICODE_STRING nameW, linkW;
     DEVICE_OBJECT *device;
     NTSTATUS status;
+    struct disk_device_info *info;
 
     driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = harddisk_ioctl;
 
@@ -449,13 +450,18 @@ static NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STR
 
     RtlInitUnicodeString( &nameW, harddisk0W );
     RtlInitUnicodeString( &linkW, physdrive0W );
-    if (!(status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device )))
+    if (!(status = IoCreateDevice( driver, sizeof(*info), &nameW, 0, 0, FALSE, &device )))
         status = IoCreateSymbolicLink( &linkW, &nameW );
     if (status)
     {
         FIXME( "failed to create device error %x\n", status );
         return status;
     }
+    info = device->DeviceExtension;
+    info->name = nameW;
+    info->devnum.DeviceType = FILE_DEVICE_DISK;
+    info->devnum.DeviceNumber = 0;
+    info->devnum.PartitionNumber = 0;
 
     create_drive_mount_points( driver );
 




More information about the wine-cvs mailing list