File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
reactos/ntoskrnl/io/iomgr Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -364,6 +364,13 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
364
364
PDEVICE_NODE DeviceNode ;
365
365
BOOLEAN SafeToUnload = TRUE;
366
366
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
+
367
374
/* Check if removal is pending */
368
375
ThisExtension = IoGetDevObjExtension (DeviceObject );
369
376
if (ThisExtension -> ExtensionFlags & DOE_REMOVE_PENDING )
@@ -463,11 +470,13 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
463
470
DeviceObject = DeviceObject -> NextDevice ;
464
471
}
465
472
473
+ DPRINT1 ("Unloading driver '%wZ' (automatic)\n" , & DriverObject -> DriverName );
474
+
466
475
/* Set the unload invoked flag */
467
476
DriverObject -> Flags |= DRVO_UNLOAD_INVOKED ;
468
477
469
478
/* Unload it */
470
- if ( DriverObject -> DriverUnload ) DriverObject -> DriverUnload (DriverObject );
479
+ DriverObject -> DriverUnload (DriverObject );
471
480
472
481
/* Make object temporary so it can be deleted */
473
482
ObMakeTemporaryObject (DriverObject );
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ IopDeleteDriver(IN PVOID ObjectBody)
58
58
PIO_CLIENT_EXTENSION DriverExtension , NextDriverExtension ;
59
59
PAGED_CODE ();
60
60
61
+ DPRINT1 ("Deleting driver object '%wZ'\n" , & DriverObject -> DriverName );
62
+
61
63
/* Get the extension and loop them */
62
64
DriverExtension = IoGetDrvObjExtension (DriverObject )->
63
65
ClientDriverExtension ;
@@ -1284,6 +1286,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
1284
1286
return STATUS_SUCCESS ;
1285
1287
}
1286
1288
1289
+ DPRINT1 ("Unloading driver '%wZ' (manual)\n" , & DriverObject -> DriverName );
1290
+
1287
1291
/* Set the unload invoked flag */
1288
1292
DriverObject -> Flags |= DRVO_UNLOAD_INVOKED ;
1289
1293
@@ -1323,6 +1327,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
1323
1327
}
1324
1328
else
1325
1329
{
1330
+ DPRINT1 ("No DriverUnload function! '%wZ' will not be unloaded!\n" , & DriverObject -> DriverName );
1331
+
1326
1332
/* Dereference one time (refd inside this function) */
1327
1333
ObDereferenceObject (DriverObject );
1328
1334
You can’t perform that action at this time.
0 commit comments