From 05abf4495a1eccf718a5a4010f74c936f08eb3df Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 26 Mar 2012 22:57:01 +0000 Subject: [PATCH] [NTOSKRNL] - Flag the device node if it fails post-start - Remove the device's children when responding to PNP_DEVICE_REMOVED svn path=/trunk/; revision=56240 --- reactos/ntoskrnl/io/pnpmgr/pnpmgr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index be67148a32a..e1bd6a85c6f 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -4044,8 +4044,13 @@ IoInvalidateDeviceState(IN PDEVICE_OBJECT PhysicalDeviceObject) if ((PnPFlags & PNP_DEVICE_REMOVED) || ((PnPFlags & PNP_DEVICE_FAILED) && !(PnPFlags & PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED))) { - /* Surprise removal */ - + /* Flag it if it's failed */ + if (PnPFlags & PNP_DEVICE_FAILED) DeviceNode->Problem = CM_PROB_FAILED_POST_START; + + /* Send removal IRPs to all of its children */ + IopPrepareDeviceForRemoval(PhysicalDeviceObject, TRUE); + + /* Send surprise removal */ IopSendSurpriseRemoval(PhysicalDeviceObject); /* Tell the user-mode PnP manager that a device was removed */ @@ -4057,7 +4062,6 @@ IoInvalidateDeviceState(IN PDEVICE_OBJECT PhysicalDeviceObject) else if ((PnPFlags & PNP_DEVICE_FAILED) && (PnPFlags & PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED)) { /* Stop for resource rebalance */ - Status = IopStopDevice(DeviceNode); if (!NT_SUCCESS(Status)) {