mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 21:56:06 +00:00
[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 svn path=/trunk/; revision=56069
This commit is contained in:
parent
ca8ba290ce
commit
092d67d890
1 changed files with 12 additions and 3 deletions
|
@ -377,8 +377,6 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
|
|||
/* 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 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
|
|||
*/
|
||||
if (DeviceObject->ReferenceCount)
|
||||
{
|
||||
DPRINT("Device object still has %d references\n", DeviceObject->ReferenceCount);
|
||||
DPRINT("Device object still has %d references\n", DeviceObject->ReferenceCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -435,6 +433,17 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
|
|||
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;
|
||||
}
|
||||
|
||||
DPRINT1("Unloading driver '%wZ' (automatic)\n", &DriverObject->DriverName);
|
||||
|
||||
/* Set the unload invoked flag */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue