Commit 968161e1 authored by Alexandre Julliard's avatar Alexandre Julliard

mountmgr: Set the drive letter at creation time.

parent 6880b4d1
...@@ -337,13 +337,14 @@ static void delete_volume( struct volume *volume ) ...@@ -337,13 +337,14 @@ static void delete_volume( struct volume *volume )
} }
/* create the disk device for a given volume */ /* create the disk device for a given volume */
static NTSTATUS create_dos_device( const char *udi, enum device_type type, struct dos_drive **drive_ret ) static NTSTATUS create_dos_device( const char *udi, int letter, enum device_type type,
struct dos_drive **drive_ret )
{ {
struct dos_drive *drive; struct dos_drive *drive;
NTSTATUS status; NTSTATUS status;
if (!(drive = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*drive) ))) return STATUS_NO_MEMORY; if (!(drive = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*drive) ))) return STATUS_NO_MEMORY;
drive->drive = -1; drive->drive = letter;
drive->mount = NULL; drive->mount = NULL;
if (!(status = create_volume( udi, type, &drive->volume ))) if (!(status = create_volume( udi, type, &drive->volume )))
...@@ -562,9 +563,8 @@ static void create_drive_devices(void) ...@@ -562,9 +563,8 @@ static void create_drive_devices(void)
} }
} }
if (!create_dos_device( NULL, drive_type, &drive )) if (!create_dos_device( NULL, i, drive_type, &drive ))
{ {
drive->drive = i;
set_volume_info( drive->volume, drive, device, link, drive_type, get_default_uuid(i) ); set_volume_info( drive->volume, drive, device, link, drive_type, get_default_uuid(i) );
} }
else else
...@@ -616,6 +616,7 @@ NTSTATUS add_dos_device( int letter, const char *udi, const char *device, ...@@ -616,6 +616,7 @@ NTSTATUS add_dos_device( int letter, const char *udi, const char *device,
const char *mount_point, enum device_type type, const GUID *guid ) const char *mount_point, enum device_type type, const GUID *guid )
{ {
char *path, *p; char *path, *p;
HKEY hkey;
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
struct dos_drive *drive, *next; struct dos_drive *drive, *next;
...@@ -647,7 +648,7 @@ NTSTATUS add_dos_device( int letter, const char *udi, const char *device, ...@@ -647,7 +648,7 @@ NTSTATUS add_dos_device( int letter, const char *udi, const char *device,
if (drive->drive == letter) delete_dos_device( drive ); if (drive->drive == letter) delete_dos_device( drive );
} }
if ((status = create_dos_device( udi, type, &drive ))) goto done; if ((status = create_dos_device( udi, letter, type, &drive ))) goto done;
found: found:
if (!guid) guid = get_default_uuid( letter ); if (!guid) guid = get_default_uuid( letter );
...@@ -657,10 +658,6 @@ found: ...@@ -657,10 +658,6 @@ found:
set_drive_letter( drive, letter ); set_drive_letter( drive, letter );
set_volume_info( drive->volume, drive, device, mount_point, type, guid ); set_volume_info( drive->volume, drive, device, mount_point, type, guid );
if (drive->drive != -1)
{
HKEY hkey;
TRACE( "added device %c: udi %s for %s on %s type %u\n", TRACE( "added device %c: udi %s for %s on %s type %u\n",
'a' + drive->drive, wine_dbgstr_a(udi), wine_dbgstr_a(device), 'a' + drive->drive, wine_dbgstr_a(udi), wine_dbgstr_a(device),
wine_dbgstr_a(mount_point), type ); wine_dbgstr_a(mount_point), type );
...@@ -682,7 +679,7 @@ found: ...@@ -682,7 +679,7 @@ found:
} }
if (udi) send_notify( drive->drive, DBT_DEVICEARRIVAL ); if (udi) send_notify( drive->drive, DBT_DEVICEARRIVAL );
}
done: done:
RtlFreeHeap( GetProcessHeap(), 0, path ); RtlFreeHeap( GetProcessHeap(), 0, path );
return status; return status;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment