Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/delete.c | 18 +++++++++++------- programs/reg/tests/delete.c | 18 +++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/programs/reg/delete.c b/programs/reg/delete.c index f6965493faa..cf0108664fd 100644 --- a/programs/reg/delete.c +++ b/programs/reg/delete.c @@ -59,25 +59,29 @@ static int run_delete(HKEY root, WCHAR *path, REGSAM sam, WCHAR *key_name, WCHAR } }
+ 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(root, path))) + if ((rc = RegDeleteTreeW(hkey, NULL))) { + RegCloseKey(hkey); output_error(rc); return 1; }
+ RegDeleteKeyW(hkey, L""); + RegCloseKey(hkey); + output_message(STRING_SUCCESS); return 0; }
- if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE|sam, &hkey))) - { - output_error(rc); - return 1; - } - op_delete_key = FALSE;
if (value_all) diff --git a/programs/reg/tests/delete.c b/programs/reg/tests/delete.c index 102fc0d788a..0c313c12a31 100644 --- a/programs/reg/tests/delete.c +++ b/programs/reg/tests/delete.c @@ -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)