mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 18:55:37 +00:00
mountmgr: Create a symlink in DosDevices for cdroms.
This commit is contained in:
parent
5e5cbcc841
commit
a6b6c0ebe5
|
@ -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 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 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 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};
|
static const WCHAR physdriveW[] = {'\\','?','?','\\','P','h','y','s','i','c','a','l','D','r','i','v','e','%','u',0};
|
||||||
|
|
||||||
UINT i, first = 0;
|
UINT i, first = 0;
|
||||||
NTSTATUS status = 0;
|
NTSTATUS status = 0;
|
||||||
const WCHAR *format = NULL;
|
const WCHAR *format = NULL;
|
||||||
|
const WCHAR *link_format = NULL;
|
||||||
UNICODE_STRING name;
|
UNICODE_STRING name;
|
||||||
DEVICE_OBJECT *dev_obj;
|
DEVICE_OBJECT *dev_obj;
|
||||||
struct disk_device *device;
|
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_HARDDISK:
|
||||||
case DEVICE_NETWORK: /* FIXME */
|
case DEVICE_NETWORK: /* FIXME */
|
||||||
format = harddiskW;
|
format = harddiskW;
|
||||||
|
link_format = physdriveW;
|
||||||
break;
|
break;
|
||||||
case DEVICE_HARDDISK_VOL:
|
case DEVICE_HARDDISK_VOL:
|
||||||
format = harddiskvolW;
|
format = harddiskvolW;
|
||||||
|
@ -221,6 +224,7 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
|
||||||
case DEVICE_CDROM:
|
case DEVICE_CDROM:
|
||||||
case DEVICE_DVD:
|
case DEVICE_DVD:
|
||||||
format = cdromW;
|
format = cdromW;
|
||||||
|
link_format = cdromlinkW;
|
||||||
break;
|
break;
|
||||||
case DEVICE_RAMDISK:
|
case DEVICE_RAMDISK:
|
||||||
format = ramdiskW;
|
format = ramdiskW;
|
||||||
|
@ -246,6 +250,19 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
|
||||||
device->unix_mount = NULL;
|
device->unix_mount = NULL;
|
||||||
device->symlink.Buffer = 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)
|
switch (type)
|
||||||
{
|
{
|
||||||
case DEVICE_FLOPPY:
|
case DEVICE_FLOPPY:
|
||||||
|
@ -267,20 +284,9 @@ static NTSTATUS create_disk_device( enum device_type type, struct disk_device **
|
||||||
case DEVICE_UNKNOWN:
|
case DEVICE_UNKNOWN:
|
||||||
case DEVICE_HARDDISK:
|
case DEVICE_HARDDISK:
|
||||||
case DEVICE_NETWORK: /* FIXME */
|
case DEVICE_NETWORK: /* FIXME */
|
||||||
{
|
device->devnum.DeviceType = FILE_DEVICE_DISK;
|
||||||
UNICODE_STRING symlink;
|
device->devnum.DeviceNumber = i;
|
||||||
|
device->devnum.PartitionNumber = 0;
|
||||||
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;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case DEVICE_HARDDISK_VOL:
|
case DEVICE_HARDDISK_VOL:
|
||||||
device->devnum.DeviceType = FILE_DEVICE_DISK;
|
device->devnum.DeviceType = FILE_DEVICE_DISK;
|
||||||
|
|
Loading…
Reference in a new issue