From 053eccf910736473c90c623d7ad98b8e513cbcf7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 20 Jul 2009 21:00:33 +0200 Subject: [PATCH] mountmgr: Always set the mount point id as a separate step from the mount point creation. --- dlls/mountmgr.sys/device.c | 7 ++++--- dlls/mountmgr.sys/mountmgr.c | 12 +++++------- dlls/mountmgr.sys/mountmgr.h | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 1b23d9781e..56c644667c 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -360,14 +360,15 @@ static void set_drive_letter( struct dos_drive *drive, int letter ) if (drive->dosdev) delete_mount_point( drive->dosdev ); if (volume->mount) delete_mount_point( volume->mount ); drive->drive = letter; - if (letter == -1) return; + drive->dosdev = add_dosdev_mount_point( device->dev_obj, &device->name, letter ); + volume->mount = add_volume_mount_point( device->dev_obj, &device->name, &volume->guid ); if (device->unix_mount) { id = device->unix_mount; id_len = strlen( device->unix_mount ) + 1; } - drive->dosdev = add_dosdev_mount_point( device->dev_obj, &device->name, letter, id, id_len ); - volume->mount = add_volume_mount_point( device->dev_obj, &device->name, &volume->guid, id, id_len ); + if (drive->dosdev) set_mount_point_id( drive->dosdev, id, id_len ); + if (volume->mount) set_mount_point_id( volume->mount, id, id_len ); } static inline int is_valid_device( struct stat *st ) diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 4554de6727..bbf5d64d95 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -61,7 +61,7 @@ void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int } static struct mount_point *add_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, - const WCHAR *link, const void *id, unsigned int id_len ) + const WCHAR *link ) { struct mount_point *mount; WCHAR *str; @@ -83,7 +83,6 @@ static struct mount_point *add_mount_point( DEVICE_OBJECT *device, UNICODE_STRIN list_add_tail( &mount_points_list, &mount->entry ); IoCreateSymbolicLink( &mount->link, device_name ); - set_mount_point_id( mount, id, id_len ); TRACE( "created %s id %s for %s\n", debugstr_w(mount->link.Buffer), debugstr_a(mount->id), debugstr_w(mount->name.Buffer) ); @@ -91,19 +90,18 @@ static struct mount_point *add_mount_point( DEVICE_OBJECT *device, UNICODE_STRIN } /* create the DosDevices mount point symlink for a new device */ -struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, - int drive, const void *id, unsigned int id_len ) +struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, int drive ) { static const WCHAR driveW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','%','c',':',0}; WCHAR link[sizeof(driveW)]; sprintfW( link, driveW, 'A' + drive ); - return add_mount_point( device, device_name, link, id, id_len ); + return add_mount_point( device, device_name, link ); } /* create the Volume mount point symlink for a new device */ struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, - const GUID *guid, const void *id, unsigned int id_len ) + const GUID *guid ) { static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{', '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-', @@ -114,7 +112,7 @@ struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICODE_STRIN sprintfW( link, volumeW, guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); - return add_mount_point( device, device_name, link, id, id_len ); + return add_mount_point( device, device_name, link ); } /* delete the mount point symlinks when a device goes away */ diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index 5ce5886b26..d61bb7ddfe 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -63,8 +63,8 @@ extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STR struct mount_point; extern struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, - int drive, const void *id, unsigned int id_len ); + int drive ); extern struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, - const GUID *guid, const void *id, unsigned int id_len ); + const GUID *guid ); extern void delete_mount_point( struct mount_point *mount ); extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len );