[NTOSKRNL]

- Add prints to unloading functions because things seem very wonky here
- This exposes some previously unknown behavior of fastfat actually being unloaded in early boot (with uniata and buslogic failing unload due to missing DriverUnload)

svn path=/trunk/; revision=55773
This commit is contained in:
Cameron Gutman 2012-02-21 01:26:29 +00:00
parent 177a18b44b
commit b0965ffa70
2 changed files with 16 additions and 1 deletions

View file

@ -364,6 +364,13 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
PDEVICE_NODE DeviceNode;
BOOLEAN SafeToUnload = TRUE;
/* We can't unload unless there's an unload handler */
if (!DriverObject->DriverUnload)
{
DPRINT1("No DriverUnload function! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
return;
}
/* Check if removal is pending */
ThisExtension = IoGetDevObjExtension(DeviceObject);
if (ThisExtension->ExtensionFlags & DOE_REMOVE_PENDING)
@ -463,11 +470,13 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
DeviceObject = DeviceObject->NextDevice;
}
DPRINT1("Unloading driver '%wZ' (automatic)\n", &DriverObject->DriverName);
/* Set the unload invoked flag */
DriverObject->Flags |= DRVO_UNLOAD_INVOKED;
/* Unload it */
if (DriverObject->DriverUnload) DriverObject->DriverUnload(DriverObject);
DriverObject->DriverUnload(DriverObject);
/* Make object temporary so it can be deleted */
ObMakeTemporaryObject(DriverObject);

View file

@ -58,6 +58,8 @@ IopDeleteDriver(IN PVOID ObjectBody)
PIO_CLIENT_EXTENSION DriverExtension, NextDriverExtension;
PAGED_CODE();
DPRINT1("Deleting driver object '%wZ'\n", &DriverObject->DriverName);
/* Get the extension and loop them */
DriverExtension = IoGetDrvObjExtension(DriverObject)->
ClientDriverExtension;
@ -1284,6 +1286,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
return STATUS_SUCCESS;
}
DPRINT1("Unloading driver '%wZ' (manual)\n", &DriverObject->DriverName);
/* Set the unload invoked flag */
DriverObject->Flags |= DRVO_UNLOAD_INVOKED;
@ -1323,6 +1327,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
}
else
{
DPRINT1("No DriverUnload function! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
/* Dereference one time (refd inside this function) */
ObDereferenceObject(DriverObject);