mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 23:22:40 +00:00
[NTOS:RAWFS] Delete the previously-created devices in case the IoCreateDevice() calls fail.
This commit is contained in:
parent
38ce67162f
commit
5ccd45ea58
1 changed files with 18 additions and 4 deletions
|
@ -1193,8 +1193,10 @@ NTAPI
|
|||
RawFsDriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
UNICODE_STRING DeviceName;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName;
|
||||
|
||||
UNREFERENCED_PARAMETER(RegistryPath);
|
||||
|
||||
/* Create the raw disk device */
|
||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\RawDisk");
|
||||
|
@ -1205,7 +1207,10 @@ RawFsDriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
0,
|
||||
FALSE,
|
||||
&RawDiskDeviceObject);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Create the raw CDROM device */
|
||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\RawCdRom");
|
||||
|
@ -1216,7 +1221,11 @@ RawFsDriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
0,
|
||||
FALSE,
|
||||
&RawCdromDeviceObject);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(RawDiskDeviceObject);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Create the raw tape device */
|
||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\RawTape");
|
||||
|
@ -1227,7 +1236,12 @@ RawFsDriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
0,
|
||||
FALSE,
|
||||
&RawTapeDeviceObject);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(RawDiskDeviceObject);
|
||||
IoDeleteDevice(RawCdromDeviceObject);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Set Direct I/O for all devices */
|
||||
RawDiskDeviceObject->Flags |= DO_DIRECT_IO;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue