Commit 08976b3e authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Fail if duplicate command-line switches are passed to 'reg add'.

parent 9138f589
......@@ -227,6 +227,7 @@ int reg_add(int argc, WCHAR *argvW[])
if (!lstrcmpiW(str, L"ve"))
{
if (value_empty) goto invalid;
value_empty = TRUE;
continue;
}
......@@ -249,11 +250,12 @@ int reg_add(int argc, WCHAR *argvW[])
break;
case 's':
str = argvW[++i];
if (!str || lstrlenW(str) != 1)
if (separator || !str || lstrlenW(str) != 1)
goto invalid;
separator = str[0];
break;
case 'f':
if (force) goto invalid;
force = TRUE;
break;
default:
......
......@@ -234,7 +234,7 @@ static void test_add(void)
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /f /f", &r);
todo_wine 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);
open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
......@@ -295,7 +295,7 @@ static void test_add(void)
verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /f /ve", &r);
todo_wine 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 HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\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