[NTOSKRNL]
authorCameron Gutman <aicommander@gmail.com>
Wed, 1 Jun 2011 01:06:35 +0000 (01:06 +0000)
committerCameron Gutman <aicommander@gmail.com>
Wed, 1 Jun 2011 01:06:35 +0000 (01:06 +0000)
- Fix a bug in device removal and ejection which caused the request to fail when EjectionRelations or RemovalRelations was not handled by a driver in the stack

svn path=/trunk/; revision=52033

reactos/ntoskrnl/io/pnpmgr/pnpmgr.c

index b3f34e2..90d24be 100644 (file)
@@ -3917,13 +3917,15 @@ IopPrepareDeviceForRemoval(IN PDEVICE_OBJECT DeviceObject)
                                &IoStatusBlock,
                                IRP_MN_QUERY_DEVICE_RELATIONS,
                                &Stack);
-    if (!NT_SUCCESS(Status) || Status == STATUS_PENDING)
+    if (!NT_SUCCESS(Status))
     {
         DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status);
-        return Status;
+        DeviceRelations = NULL;
+    }
+    else
+    {
+        DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
     }
-    
-    DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
     
     if (DeviceRelations)
     {
@@ -4030,15 +4032,15 @@ IoRequestDeviceEject(IN PDEVICE_OBJECT PhysicalDeviceObject)
                                &IoStatusBlock,
                                IRP_MN_QUERY_DEVICE_RELATIONS,
                                &Stack);
-    if (!NT_SUCCESS(Status) || Status == STATUS_PENDING)
+    if (!NT_SUCCESS(Status))
     {
         DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status);
-        IopQueueTargetDeviceEvent(&GUID_DEVICE_EJECT_VETOED,
-                                  &DeviceNode->InstancePath);
-        return;
+        DeviceRelations = NULL;
+    }
+    else
+    {
+        DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
     }
-    
-    DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
     
     if (DeviceRelations)
     {