reg: Use strtoulW during conversion so we can set any value in the DWORD range.

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-16 17:12:07 +11:00 committed by Alexandre Julliard
parent 2fd010110a
commit 948888b950
2 changed files with 3 additions and 5 deletions

View File

@ -243,7 +243,7 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r
{ {
LPWSTR rest; LPWSTR rest;
DWORD val; DWORD val;
val = strtolW(data, &rest, 0); val = strtoulW(data, &rest, 0);
if (*rest) { if (*rest) {
output_message(STRING_MISSING_INTEGER); output_message(STRING_MISSING_INTEGER);
break; break;

View File

@ -281,8 +281,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /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);
dword = 0xdeadbeef; dword = 0xdeadbeef;
verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0);
(sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r);
todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
@ -295,8 +294,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword12 /t REG_DWORD /d 0xffffffff /f", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword12 /t REG_DWORD /d 0xffffffff /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);
dword = ~0u; dword = ~0u;
verify_reg(hkey, "dword12", REG_DWORD, &dword, sizeof(dword), verify_reg(hkey, "dword12", REG_DWORD, &dword, sizeof(dword), 0);
(sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword13 /t REG_DWORD /d 00x123 /f", &r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword13 /t REG_DWORD /d 00x123 /f", &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);