Commit 5061899c authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

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

parent e0492b27
...@@ -366,6 +366,12 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -366,6 +366,12 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
output_message(STRING_UNSUPPORTED_TYPE, type); output_message(STRING_UNSUPPORTED_TYPE, type);
return 1; return 1;
} }
if (reg_type == REG_DWORD && !data)
{
RegCloseKey(subkey);
output_message(STRING_INVALID_CMDLINE);
return 1;
}
if (data) if (data)
reg_data = get_regdata(data,reg_type,separator,&reg_count); reg_data = get_regdata(data,reg_type,separator,&reg_count);
......
...@@ -257,7 +257,7 @@ static void test_add(void) ...@@ -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); 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); 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); 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); "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); 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); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment