server: Prevent unloading a registry hive while the key is in use.

Otherwise, RegUnLoadKey(HKEY_USERS, "S-1-5-21-0-0-0-1000") erases all
HKCU registry. The call is actually done by a certain installer.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2021-02-12 20:30:14 +09:00 committed by Alexandre Julliard
parent d6d99e59e3
commit 70c77cdfee
1 changed files with 4 additions and 1 deletions

View File

@ -2261,7 +2261,10 @@ DECL_HANDLER(unload_registry)
get_req_path( &name, !req->parent );
if ((key = open_key( parent, &name, access, req->attributes )))
{
delete_key( key, 1 ); /* FIXME */
if (key->obj.handle_count)
set_error( STATUS_CANNOT_DELETE );
else
delete_key( key, 1 ); /* FIXME */
release_object( key );
}
release_object( parent );