reg: Support use of registry views when deleting registry keys.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8d42cb9c1c
commit
31f070f7d3
|
@ -59,25 +59,29 @@ static int run_delete(HKEY root, WCHAR *path, REGSAM sam, WCHAR *key_name, WCHAR
|
|||
}
|
||||
}
|
||||
|
||||
/* Delete registry key if no /v* option is given */
|
||||
if (!value_name && !value_empty && !value_all)
|
||||
{
|
||||
if ((rc = RegDeleteTreeW(root, path)))
|
||||
{
|
||||
output_error(rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
output_message(STRING_SUCCESS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE|sam, &hkey)))
|
||||
{
|
||||
output_error(rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Delete registry key if no /v* option is given */
|
||||
if (!value_name && !value_empty && !value_all)
|
||||
{
|
||||
if ((rc = RegDeleteTreeW(hkey, NULL)))
|
||||
{
|
||||
RegCloseKey(hkey);
|
||||
output_error(rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
RegDeleteKeyW(hkey, L"");
|
||||
RegCloseKey(hkey);
|
||||
|
||||
output_message(STRING_SUCCESS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
op_delete_key = FALSE;
|
||||
|
||||
if (value_all)
|
||||
|
|
|
@ -284,19 +284,19 @@ static void test_registry_view_win64(void)
|
|||
verify_key(hkey, "Subkey", KEY_WOW64_32KEY);
|
||||
|
||||
run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:32", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
todo_wine verify_key_nonexist(hkey, "Subkey", KEY_WOW64_32KEY);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
verify_key_nonexist(hkey, "Subkey", KEY_WOW64_32KEY);
|
||||
|
||||
close_key(hkey);
|
||||
|
||||
run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:32", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
|
||||
|
||||
/* Test deletion from the 64-bit registry view (64-bit Windows) */
|
||||
create_test_key(KEY_WOW64_64KEY);
|
||||
|
||||
todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
|
||||
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
|
||||
|
||||
open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
|
||||
|
||||
|
@ -394,14 +394,14 @@ static void test_registry_view_wow64(void)
|
|||
verify_key(hkey, "Subkey", KEY_WOW64_64KEY);
|
||||
|
||||
run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:64", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
todo_wine verify_key_nonexist(hkey, "Subkey", KEY_WOW64_64KEY);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
verify_key_nonexist(hkey, "Subkey", KEY_WOW64_64KEY);
|
||||
|
||||
close_key(hkey);
|
||||
|
||||
run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:64", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
|
||||
}
|
||||
|
||||
START_TEST(delete)
|
||||
|
|
Loading…
Reference in New Issue