reg: Fail if REG_DWORD is passed with no data argument.

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-02-15 23:15:30 +11:00 committed by Alexandre Julliard
parent e0492b27ac
commit 5061899c46
2 changed files with 7 additions and 1 deletions

View File

@ -366,6 +366,12 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
output_message(STRING_UNSUPPORTED_TYPE, type);
return 1;
}
if (reg_type == REG_DWORD && !data)
{
RegCloseKey(subkey);
output_message(STRING_INVALID_CMDLINE);
return 1;
}
if (data)
reg_data = get_regdata(data,reg_type,separator,&reg_count);

View File

@ -257,7 +257,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword0 /t REG_DWORD /f /d", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r);
todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r);
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);