Alexandre Julliard : mountmgr: Create a symlink in DosDevices for cdroms.
Alexandre Julliard
julliard at winehq.org
Tue Jan 17 13:45:24 CST 2012
Module: wine
Branch: master
Commit: a6b6c0ebe58a425fe0e81b6780debf425f032cc3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a6b6c0ebe58a425fe0e81b6780debf425f032cc3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jan 17 11:41:15 2012 +0100
mountmgr: Create a symlink in DosDevices for cdroms.
---
dlls/mountmgr.sys/device.c | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index c6ba0b9..8367cba 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -195,11 +195,13 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
static const WCHAR cdromW[] = {'\\','D','e','v','i','c','e','\\','C','d','R','o','m','%','u',0};
static const WCHAR floppyW[] = {'\\','D','e','v','i','c','e','\\','F','l','o','p','p','y','%','u',0};
static const WCHAR ramdiskW[] = {'\\','D','e','v','i','c','e','\\','R','a','m','d','i','s','k','%','u',0};
+ static const WCHAR cdromlinkW[] = {'\\','?','?','\\','C','d','R','o','m','%','u',0};
static const WCHAR physdriveW[] = {'\\','?','?','\\','P','h','y','s','i','c','a','l','D','r','i','v','e','%','u',0};
UINT i, first = 0;
NTSTATUS status = 0;
const WCHAR *format = NULL;
+ const WCHAR *link_format = NULL;
UNICODE_STRING name;
DEVICE_OBJECT *dev_obj;
struct disk_device *device;
@@ -210,6 +212,7 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
case DEVICE_HARDDISK:
case DEVICE_NETWORK: /* FIXME */
format = harddiskW;
+ link_format = physdriveW;
break;
case DEVICE_HARDDISK_VOL:
format = harddiskvolW;
@@ -221,6 +224,7 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
case DEVICE_CDROM:
case DEVICE_DVD:
format = cdromW;
+ link_format = cdromlinkW;
break;
case DEVICE_RAMDISK:
format = ramdiskW;
@@ -246,6 +250,19 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
device->unix_mount = NULL;
device->symlink.Buffer = NULL;
+ if (link_format)
+ {
+ UNICODE_STRING symlink;
+
+ symlink.MaximumLength = (strlenW(link_format) + 10) * sizeof(WCHAR);
+ if ((symlink.Buffer = RtlAllocateHeap( GetProcessHeap(), 0, symlink.MaximumLength)))
+ {
+ sprintfW( symlink.Buffer, link_format, i );
+ symlink.Length = strlenW(symlink.Buffer) * sizeof(WCHAR);
+ if (!IoCreateSymbolicLink( &symlink, &name )) device->symlink = symlink;
+ }
+ }
+
switch (type)
{
case DEVICE_FLOPPY:
@@ -267,20 +284,9 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
case DEVICE_UNKNOWN:
case DEVICE_HARDDISK:
case DEVICE_NETWORK: /* FIXME */
- {
- UNICODE_STRING symlink;
-
- symlink.MaximumLength = sizeof(physdriveW) + 10 * sizeof(WCHAR);
- if ((symlink.Buffer = RtlAllocateHeap( GetProcessHeap(), 0, symlink.MaximumLength)))
- {
- sprintfW( symlink.Buffer, physdriveW, i );
- symlink.Length = strlenW(symlink.Buffer) * sizeof(WCHAR);
- if (!IoCreateSymbolicLink( &symlink, &name )) device->symlink = symlink;
- }
- device->devnum.DeviceType = FILE_DEVICE_DISK;
- device->devnum.DeviceNumber = i;
- device->devnum.PartitionNumber = 0;
- }
+ device->devnum.DeviceType = FILE_DEVICE_DISK;
+ device->devnum.DeviceNumber = i;
+ device->devnum.PartitionNumber = 0;
break;
case DEVICE_HARDDISK_VOL:
device->devnum.DeviceType = FILE_DEVICE_DISK;
More information about the wine-cvs
mailing list