[PATCH 1/7] reg: Allow either lowercase or uppercase 'x' when used with REG_DWORD
Hugh McMaster
hugh.mcmaster at outlook.com
Mon Feb 22 03:29:14 CST 2016
Fixes a regression limiting the data to lowercase 'x'.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/reg/reg.c | 2 +-
programs/reg/tests/reg.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index 7dc624a..933341c 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -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, (data[1] == 'x') ? 16 : 10);
+ val = strtoulW(data, &rest, (tolowerW(data[1]) == 'x') ? 16 : 10);
if (*rest || data[0] == '-') {
output_message(STRING_MISSING_INTEGER);
break;
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c
index a813de1..eb75ac9 100644
--- a/programs/reg/tests/reg.c
+++ b/programs/reg/tests/reg.c
@@ -298,6 +298,11 @@ static void test_add(void)
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);
+ run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword14 /t REG_DWORD /d 0X123 /f", &r);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ dword = 0x123;
+ verify_reg(hkey, "dword14", REG_DWORD, &dword, sizeof(dword), 0);
+
/* REG_DWORD_LITTLE_ENDIAN */
run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
--
1.9.1
More information about the wine-patches
mailing list