mountmgr: Reuse create_disk_device to create the initial harddisk0 device.
This commit is contained in:
parent
bb13bbe13d
commit
b4b49a7d75
|
@ -579,38 +579,15 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp )
|
||||||
/* driver entry point for the harddisk driver */
|
/* driver entry point for the harddisk driver */
|
||||||
NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
|
NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
|
||||||
{
|
{
|
||||||
static const WCHAR harddisk0W[] = {'\\','D','e','v','i','c','e',
|
|
||||||
'\\','H','a','r','d','d','i','s','k','0',0};
|
|
||||||
static const WCHAR physdrive0W[] = {'\\','?','?','\\','P','h','y','s','i','c','a','l','D','r','i','v','e','0',0};
|
|
||||||
|
|
||||||
UNICODE_STRING nameW, linkW;
|
|
||||||
DEVICE_OBJECT *device;
|
|
||||||
NTSTATUS status;
|
|
||||||
struct dos_drive *drive;
|
struct dos_drive *drive;
|
||||||
|
|
||||||
harddisk_driver = driver;
|
harddisk_driver = driver;
|
||||||
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = harddisk_ioctl;
|
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = harddisk_ioctl;
|
||||||
|
|
||||||
RtlInitUnicodeString( &nameW, harddisk0W );
|
/* create a harddisk0 device that isn't assigned to any drive */
|
||||||
RtlInitUnicodeString( &linkW, physdrive0W );
|
create_disk_device( "harddisk0 placeholder", DRIVE_FIXED, &drive );
|
||||||
if (!(status = IoCreateDevice( driver, sizeof(*drive), &nameW, 0, 0, FALSE, &device )))
|
|
||||||
status = IoCreateSymbolicLink( &linkW, &nameW );
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
FIXME( "failed to create device error %x\n", status );
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
drive = device->DeviceExtension;
|
|
||||||
drive->drive = -1;
|
|
||||||
drive->udi = NULL;
|
|
||||||
drive->type = DRIVE_FIXED;
|
|
||||||
drive->name = nameW;
|
|
||||||
drive->device = device;
|
|
||||||
drive->devnum.DeviceType = FILE_DEVICE_DISK;
|
|
||||||
drive->devnum.DeviceNumber = 0;
|
|
||||||
drive->devnum.PartitionNumber = 0;
|
|
||||||
|
|
||||||
create_drive_devices();
|
create_drive_devices();
|
||||||
|
|
||||||
return status;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue