[PATCH 5/5] regedit: Do not import DWORD values beginning with "0x"

Hugh McMaster hugh.mcmaster at outlook.com
Mon Apr 10 04:51:06 CDT 2017


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/regedit/regproc.c       | 4 +++-
 programs/regedit/tests/regedit.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 932bc15..42a2858 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -152,11 +152,13 @@ static BOOL convertHexToDWord(WCHAR* str, DWORD *dw)
     buf = GetMultiByteString(str);
     if (!buf) return FALSE;
 
+    while (*buf == ' ' || *buf == '\t') buf++;
+
     *dw = strtoul(buf, &end, 16);
 
     while (*end == ' ' || *end == '\t') end++;
 
-    if (buf == end || (*dw == ~0u && errno == ERANGE) || (*end && *end != ';'))
+    if (buf == end || (*dw == ~0u && errno == ERANGE) || (*end && *end != ';') || tolower(buf[1]) == 'x')
     {
         output_message(STRING_INVALID_HEX);
         HeapFree(GetProcessHeap(), 0, buf);
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index e32489d..c8e7b9b 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -528,7 +528,7 @@ static void test_invalid_import(void)
                     "\"Test14a\"=dword:0x123\n"
                     "\"Test14b\"=dword:123 456\n"
                     "\"Test14c\"=dword:1234 5678\n\n");
-    todo_wine verify_reg_nonexist(hkey, "Test14a");
+    verify_reg_nonexist(hkey, "Test14a");
     verify_reg_nonexist(hkey, "Test14b");
     verify_reg_nonexist(hkey, "Test14c");
 
-- 
2.7.4




More information about the wine-patches mailing list