ntoskrnl: Forbid unloading a driver with running root PnP devices.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-04-14 09:39:58 -05:00 committed by Alexandre Julliard
parent 5bf72a75e3
commit 364df14842
1 changed files with 8 additions and 0 deletions

View File

@ -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 );