reg: Fail when /d is used without an accompanying 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-11 23:34:22 +11:00 committed by Alexandre Julliard
parent 2c0359fb3c
commit 3c340fda68
2 changed files with 11 additions and 5 deletions

View File

@ -562,7 +562,13 @@ int wmain(int argc, WCHAR *argvW[])
else if (!lstrcmpiW(argvW[i], slashSW)) else if (!lstrcmpiW(argvW[i], slashSW))
separator = argvW[++i][0]; separator = argvW[++i][0];
else if (!lstrcmpiW(argvW[i], slashDW)) else if (!lstrcmpiW(argvW[i], slashDW))
data = argvW[++i]; {
if (!(data = argvW[++i]))
{
output_message(STRING_INVALID_CMDLINE);
return 1;
}
}
else if (!lstrcmpiW(argvW[i], slashFW)) else if (!lstrcmpiW(argvW[i], slashFW))
force = TRUE; force = TRUE;
} }

View File

@ -169,7 +169,7 @@ static void test_add(void)
verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE); verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v test1 /t REG_SZ /f /d", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v test1 /t REG_SZ /f /d", &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); 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); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
@ -242,7 +242,7 @@ static void test_add(void)
verify_reg(hkey, "bin5", REG_BINARY, buffer, 0, 0); verify_reg(hkey, "bin5", REG_BINARY, buffer, 0, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v bin6 /t REG_BINARY /f /d", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v bin6 /t REG_BINARY /f /d", &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);
/* REG_DWORD */ /* REG_DWORD */
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r);
@ -255,7 +255,7 @@ static void test_add(void)
win_skip("broken reg.exe detected\n"); win_skip("broken reg.exe detected\n");
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);
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 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 */), todo_wine 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);
@ -353,7 +353,7 @@ static void test_add(void)
verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, TODO_REG_SIZE); verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, TODO_REG_SIZE);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi12 /t REG_MULTI_SZ /f /d", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi12 /t REG_MULTI_SZ /f /d", &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);
RegCloseKey(hkey); RegCloseKey(hkey);