mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[PARTMGR] Few code enhancements.
- PartMgrAddDevice(): If IoAttachDeviceToDeviceStack() fails, bail out immediately, instead of continuing initializing the device extension then deciding to fail. - PartitionCreateDevice(): Initialize the fields pertaining to parent device linking in the partition device extension, before the other fields (following in a similar way what's done in PartMgrAddDevice).
This commit is contained in:
parent
e1b835bdbf
commit
8653bb1b32
2 changed files with 9 additions and 10 deletions
|
@ -52,6 +52,9 @@ PartitionCreateDevice(
|
|||
PPARTITION_EXTENSION partExt = partitionDevice->DeviceExtension;
|
||||
RtlZeroMemory(partExt, sizeof(*partExt));
|
||||
|
||||
partExt->DeviceObject = partitionDevice;
|
||||
partExt->LowerDevice = FDObject;
|
||||
|
||||
partitionDevice->StackSize = FDObject->StackSize;
|
||||
partitionDevice->Flags |= DO_DIRECT_IO;
|
||||
|
||||
|
@ -77,9 +80,6 @@ PartitionCreateDevice(
|
|||
partExt->DetectedNumber = PdoNumber; // counts only partitions with PDO created
|
||||
partExt->VolumeNumber = volumeNum;
|
||||
|
||||
partExt->DeviceObject = partitionDevice;
|
||||
partExt->LowerDevice = FDObject;
|
||||
|
||||
// The device is initialized
|
||||
partitionDevice->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
|
|
@ -1201,16 +1201,15 @@ PartMgrAddDevice(
|
|||
deviceExtension->IsFDO = TRUE;
|
||||
deviceExtension->DeviceObject = deviceObject;
|
||||
deviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject);
|
||||
if (!deviceExtension->LowerDevice)
|
||||
{
|
||||
// The attachment failed
|
||||
IoDeleteDevice(deviceObject);
|
||||
return STATUS_DEVICE_REMOVED;
|
||||
}
|
||||
deviceExtension->PhysicalDiskDO = PhysicalDeviceObject;
|
||||
KeInitializeEvent(&deviceExtension->SyncEvent, SynchronizationEvent, TRUE);
|
||||
|
||||
// the the attaching failed
|
||||
if (!deviceExtension->LowerDevice)
|
||||
{
|
||||
IoDeleteDevice(deviceObject);
|
||||
|
||||
return STATUS_DEVICE_REMOVED;
|
||||
}
|
||||
deviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE;
|
||||
|
||||
// The device is initialized
|
||||
|
|
Loading…
Reference in a new issue