reg: Delete the default registry value instead of overwriting it.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2016-03-02 21:31:18 +11:00 committed by Alexandre Julliard
parent bf74c6a5dd
commit 81a030b934
2 changed files with 3 additions and 7 deletions

View File

@ -525,19 +525,15 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
/* FIXME delete failed */
}
}
else if (value_name)
else if (value_name || value_empty)
{
if (RegDeleteValueW(subkey,value_name) != ERROR_SUCCESS)
if (RegDeleteValueW(subkey, value_empty ? NULL : value_name) != ERROR_SUCCESS)
{
RegCloseKey(subkey);
output_message(STRING_CANNOT_FIND);
return 1;
}
}
else if (value_empty)
{
RegSetValueExW(subkey,NULL,0,REG_SZ,NULL,0);
}
RegCloseKey(subkey);
output_message(STRING_SUCCESS);

View File

@ -441,7 +441,7 @@ static void test_delete(void)
run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
todo_wine ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
ok(err == ERROR_FILE_NOT_FOUND, "got %d, expected 2\n", err);
run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);