[PATCH] [bug9037] Regedit importing of .reg hex fails

Jason Edmeades jason.edmeades at googlemail.com
Fri Aug 10 16:28:36 CDT 2007


Currently the code assumes any hex digit less than 0x10 will only
take one character, which the reg file in question doesnt (eg. 01,02,03).

For reference - bug9037 was a Rar self extraction file, which extracts
a batch program, exe and .reg file. The 6 patches which resulted from that
may help with any other similar installer.
---
 programs/regedit/regproc.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 6cc63f2..7b2ca20 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -82,7 +82,8 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size)
     char *s;
     BYTE *d, *data;
 
-    /* The worst case is 1 digit + 1 comma per byte */
+    /* The worst case is 1 digit + 1 comma per byte (although two digits
+       and a comma is normal) */
     *size=(strlen(str)+1)/2;
     data=HeapAlloc(GetProcessHeap(), 0, *size);
     CHECK_ENOUGH_MEMORY(data);
@@ -109,7 +110,9 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size)
         *d++ =(BYTE)wc;
         (*size)++;
 
-        s+=(wc < 0x10 ? 2 : 3);
+        /* Skip one or two digits (note it could be 1,2 or 01,02) and any comma */
+        while (*s && *s!=',') s++;
+        if (*s) s++;
     }
 
     return data;
-- 
1.5.0




More information about the wine-patches mailing list