reg: Explicitly use base 10 or base 16 with strtoulW.

All Windows versions, except XP, parse the number 0123 as decimal.
(XP parses 0123 as octal).

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:09 +11:00 committed by Alexandre Julliard
parent 474361ecb4
commit acb4e3f63a
2 changed files with 2 additions and 3 deletions

View File

@ -243,7 +243,7 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r
{
LPWSTR rest;
DWORD val;
val = strtoulW(data, &rest, 0);
val = strtoulW(data, &rest, (data[1] == 'x') ? 16 : 10);
if (*rest || data[0] == '-') {
output_message(STRING_MISSING_INTEGER);
break;

View File

@ -272,8 +272,7 @@ static void test_add(void)
ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD);
ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD));
todo_wine ok(dword == 123 || broken(dword == 0123 /* WinXP */),
"got wrong data %d, expected %d\n", dword, 123);
ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected 123\n", dword);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);