mountmgr: Always set the mount point id as a separate step from the mount point creation.
This commit is contained in:
parent
81cfeaf531
commit
053eccf910
|
@ -360,14 +360,15 @@ static void set_drive_letter( struct dos_drive *drive, int letter )
|
||||||
if (drive->dosdev) delete_mount_point( drive->dosdev );
|
if (drive->dosdev) delete_mount_point( drive->dosdev );
|
||||||
if (volume->mount) delete_mount_point( volume->mount );
|
if (volume->mount) delete_mount_point( volume->mount );
|
||||||
drive->drive = letter;
|
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)
|
if (device->unix_mount)
|
||||||
{
|
{
|
||||||
id = device->unix_mount;
|
id = device->unix_mount;
|
||||||
id_len = strlen( device->unix_mount ) + 1;
|
id_len = strlen( device->unix_mount ) + 1;
|
||||||
}
|
}
|
||||||
drive->dosdev = add_dosdev_mount_point( device->dev_obj, &device->name, letter, id, id_len );
|
if (drive->dosdev) set_mount_point_id( drive->dosdev, id, id_len );
|
||||||
volume->mount = add_volume_mount_point( device->dev_obj, &device->name, &volume->guid, id, id_len );
|
if (volume->mount) set_mount_point_id( volume->mount, id, id_len );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is_valid_device( struct stat *st )
|
static inline int is_valid_device( struct stat *st )
|
||||||
|
|
|
@ -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,
|
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;
|
struct mount_point *mount;
|
||||||
WCHAR *str;
|
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 );
|
list_add_tail( &mount_points_list, &mount->entry );
|
||||||
|
|
||||||
IoCreateSymbolicLink( &mount->link, device_name );
|
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),
|
TRACE( "created %s id %s for %s\n", debugstr_w(mount->link.Buffer),
|
||||||
debugstr_a(mount->id), debugstr_w(mount->name.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 */
|
/* create the DosDevices mount point symlink for a new device */
|
||||||
struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name,
|
struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name, int drive )
|
||||||
int drive, const void *id, unsigned int id_len )
|
|
||||||
{
|
{
|
||||||
static const WCHAR driveW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','%','c',':',0};
|
static const WCHAR driveW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','%','c',':',0};
|
||||||
WCHAR link[sizeof(driveW)];
|
WCHAR link[sizeof(driveW)];
|
||||||
|
|
||||||
sprintfW( link, driveW, 'A' + drive );
|
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 */
|
/* create the Volume mount point symlink for a new device */
|
||||||
struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name,
|
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','{',
|
static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{',
|
||||||
'%','0','8','x','-','%','0','4','x','-','%','0','4','x','-',
|
'%','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,
|
sprintfW( link, volumeW, guid->Data1, guid->Data2, guid->Data3,
|
||||||
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
||||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
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 */
|
/* delete the mount point symlinks when a device goes away */
|
||||||
|
|
|
@ -63,8 +63,8 @@ extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STR
|
||||||
struct mount_point;
|
struct mount_point;
|
||||||
|
|
||||||
extern struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name,
|
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,
|
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 delete_mount_point( struct mount_point *mount );
|
||||||
extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len );
|
extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len );
|
||||||
|
|
Loading…
Reference in New Issue