Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: No changes.
dlls/ntoskrnl.exe/ntoskrnl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index bb9f4bf5259..0580231d8e3 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3842,6 +3842,7 @@ error: NTSTATUS WINAPI ZwUnloadDriver( const UNICODE_STRING *service_name ) { struct wine_rb_entry *entry; + struct wine_driver *driver; UNICODE_STRING drv_name;
TRACE( "(%s)\n", debugstr_us(service_name) ); @@ -3856,6 +3857,13 @@ NTSTATUS WINAPI ZwUnloadDriver( const UNICODE_STRING *service_name ) ERR( "failed to locate driver %s\n", debugstr_us(service_name) ); return STATUS_OBJECT_NAME_NOT_FOUND; } + driver = WINE_RB_ENTRY_VALUE( entry, struct wine_driver, entry ); + + if (!list_empty( &driver->root_pnp_devices )) + { + ERR( "cannot unload driver %s which still has running PnP devices\n", debugstr_us(service_name) ); + return STATUS_UNSUCCESSFUL; + }
unload_driver( entry, NULL );