Commit e3ad1cff authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntoskrnl.exe: Avoid loading a driver multiple times in ZwLoadDriver().

parent d209055e
......@@ -3519,6 +3519,13 @@ NTSTATUS WINAPI ZwLoadDriver( const UNICODE_STRING *service_name )
return STATUS_NO_MEMORY;
}
if (wine_rb_get( &wine_drivers, &drv_name ))
{
TRACE( "driver %s already loaded\n", debugstr_us(&drv_name) );
RtlFreeUnicodeString( &drv_name );
return STATUS_IMAGE_ALREADY_LOADED;
}
set_service_status( service_handle, SERVICE_START_PENDING, 0 );
status = IoCreateDriver( &drv_name, init_driver );
......
......@@ -206,6 +206,9 @@ static void test_load_driver(void)
ret = ZwLoadDriver(&name);
ok(!ret, "got %#x\n", ret);
ret = ZwLoadDriver(&name);
ok(ret == STATUS_IMAGE_ALREADY_LOADED, "got %#x\n", ret);
ret = ZwUnloadDriver(&name);
ok(!ret, "got %#x\n", ret);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment