Author: cgutman
Date: Tue Mar 6 22:50:13 2012
New Revision: 56069
URL:
http://svn.reactos.org/svn/reactos?rev=56069&view=rev
Log:
[NTOSKRNL]
- Fix the unload path
- This does expose some bugs: 2 cont-able assertions in ARM3 after unplugging a USB
storage device (during usbstor unload), HID unload doesn't seem to work correctly
(somebody still has references to the devices), other issues may pop up too
Modified:
trunk/reactos/ntoskrnl/io/iomgr/device.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/device.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/device.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/device.c [iso-8859-1] Tue Mar 6 22:50:13 2012
@@ -377,8 +377,6 @@
/* Check if deletion is pending */
if (ThisExtension->ExtensionFlags & DOE_DELETE_PENDING)
{
- if (!(ThisExtension->ExtensionFlags & DOE_UNLOAD_PENDING)) return;
-
if (DeviceObject->AttachedDevice)
{
DPRINT("Device object is in the middle of a device stack\n");
@@ -415,7 +413,7 @@
*/
if (DeviceObject->ReferenceCount)
{
- DPRINT("Device object still has %d references\n",
DeviceObject->ReferenceCount);
+ DPRINT("Device object still has %d references\n",
DeviceObject->ReferenceCount);
return;
}
@@ -432,6 +430,17 @@
}
/* Check the next device */
+ DeviceObject = DeviceObject->NextDevice;
+ }
+
+ /* Loop all the device objects */
+ DeviceObject = DriverObject->DeviceObject;
+ while (DeviceObject)
+ {
+ /* Set the unload pending flag */
+ IoGetDevObjExtension(DeviceObject)->ExtensionFlags |= DOE_UNLOAD_PENDING;
+
+ /* Go to the next device */
DeviceObject = DeviceObject->NextDevice;
}