Skip to content

Commit b0965ff

Browse files
committed
[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
1 parent 177a18b commit b0965ff

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

reactos/ntoskrnl/io/iomgr/device.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
364364
PDEVICE_NODE DeviceNode;
365365
BOOLEAN SafeToUnload = TRUE;
366366

367+
/* We can't unload unless there's an unload handler */
368+
if (!DriverObject->DriverUnload)
369+
{
370+
DPRINT1("No DriverUnload function! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
371+
return;
372+
}
373+
367374
/* Check if removal is pending */
368375
ThisExtension = IoGetDevObjExtension(DeviceObject);
369376
if (ThisExtension->ExtensionFlags & DOE_REMOVE_PENDING)
@@ -463,11 +470,13 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
463470
DeviceObject = DeviceObject->NextDevice;
464471
}
465472

473+
DPRINT1("Unloading driver '%wZ' (automatic)\n", &DriverObject->DriverName);
474+
466475
/* Set the unload invoked flag */
467476
DriverObject->Flags |= DRVO_UNLOAD_INVOKED;
468477

469478
/* Unload it */
470-
if (DriverObject->DriverUnload) DriverObject->DriverUnload(DriverObject);
479+
DriverObject->DriverUnload(DriverObject);
471480

472481
/* Make object temporary so it can be deleted */
473482
ObMakeTemporaryObject(DriverObject);

reactos/ntoskrnl/io/iomgr/driver.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ IopDeleteDriver(IN PVOID ObjectBody)
5858
PIO_CLIENT_EXTENSION DriverExtension, NextDriverExtension;
5959
PAGED_CODE();
6060

61+
DPRINT1("Deleting driver object '%wZ'\n", &DriverObject->DriverName);
62+
6163
/* Get the extension and loop them */
6264
DriverExtension = IoGetDrvObjExtension(DriverObject)->
6365
ClientDriverExtension;
@@ -1284,6 +1286,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
12841286
return STATUS_SUCCESS;
12851287
}
12861288

1289+
DPRINT1("Unloading driver '%wZ' (manual)\n", &DriverObject->DriverName);
1290+
12871291
/* Set the unload invoked flag */
12881292
DriverObject->Flags |= DRVO_UNLOAD_INVOKED;
12891293

@@ -1323,6 +1327,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
13231327
}
13241328
else
13251329
{
1330+
DPRINT1("No DriverUnload function! '%wZ' will not be unloaded!\n", &DriverObject->DriverName);
1331+
13261332
/* Dereference one time (refd inside this function) */
13271333
ObDereferenceObject(DriverObject);
13281334

0 commit comments

Comments
 (0)