Commit 31efcc63 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Do not allow duplicate /d or /t switches.

parent 078f192c
......@@ -941,10 +941,16 @@ int wmain(int argc, WCHAR *argvW[])
else if (!lstrcmpiW(argvW[i], slashVAW))
value_all = TRUE;
else if (!lstrcmpiW(argvW[i], slashTW))
type = argvW[++i];
{
if (type || !(type = argvW[++i]))
{
output_message(STRING_INVALID_CMDLINE);
return 1;
}
}
else if (!lstrcmpiW(argvW[i], slashDW))
{
if (!(data = argvW[++i]))
if (data || !(data = argvW[++i]))
{
output_message(STRING_INVALID_CMDLINE);
return 1;
......
......@@ -442,6 +442,14 @@ static void test_add(void)
RegCloseKey(hkey);
/* Test duplicate switches */
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r);
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %u, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup2 /t REG_DWORD /d 123 /f /d 456", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS, "got %d\n", err);
}
......
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