reg: Correctly handle /ve commands with no data.

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-04 12:59:27 +11:00 committed by Alexandre Julliard
parent 4a5431192e
commit 9bfddcf76f
2 changed files with 8 additions and 9 deletions

View File

@ -378,7 +378,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
return 1;
}
if (value_name || data)
if (value_name || value_empty || data)
{
DWORD reg_type;
DWORD reg_count = 0;

View File

@ -151,7 +151,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_NONE /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
todo_wine verify_reg(hkey, NULL, REG_NONE, "\0", 2, TODO_REG_SIZE|TODO_REG_TYPE|TODO_REG_DATA);
verify_reg(hkey, NULL, REG_NONE, "\0", 2, TODO_REG_SIZE);
/* REG_SZ */
run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r);
@ -187,11 +187,11 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
verify_reg(hkey, NULL, REG_SZ, "", 1, TODO_REG_SIZE|TODO_REG_DATA);
verify_reg(hkey, NULL, REG_SZ, "", 1, TODO_REG_SIZE);
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_SZ /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
verify_reg(hkey, NULL, REG_SZ, "", 1, TODO_REG_SIZE|TODO_REG_DATA);
verify_reg(hkey, NULL, REG_SZ, "", 1, TODO_REG_SIZE);
/* REG_EXPAND_SZ */
run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r);
@ -216,7 +216,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_EXPAND_SZ /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, TODO_REG_SIZE|TODO_REG_DATA);
verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, TODO_REG_SIZE);
/* REG_BINARY */
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r);
@ -260,7 +260,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_BINARY /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
verify_reg(hkey, NULL, REG_BINARY, buffer, 0, TODO_REG_DATA|TODO_REG_SIZE);
verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0);
/* REG_DWORD */
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r);
@ -331,8 +331,7 @@ static void test_add(void)
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_DWORD /f", &r);
todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %u\n", r);
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
/* REG_DWORD_LITTLE_ENDIAN */
run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r);
@ -438,7 +437,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_MULTI_SZ /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, TODO_REG_SIZE|TODO_REG_DATA|TODO_REG_TYPE);
verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, TODO_REG_SIZE);
RegCloseKey(hkey);