Alexander Nicolaysen Sørnes : regedit: Avoid conversion to ANSI when importing hex values.
Alexandre Julliard
julliard at winehq.org
Thu Aug 28 07:00:40 CDT 2008
Module: wine
Branch: master
Commit: f7ff9e76f9b32759d8d1f79ce440762debfad4a6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f7ff9e76f9b32759d8d1f79ce440762debfad4a6
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Wed Aug 27 23:29:08 2008 +0200
regedit: Avoid conversion to ANSI when importing hex values.
---
programs/regedit/regproc.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index b65595e..eb724be 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -113,28 +113,28 @@ static BOOL convertHexToDWord(WCHAR* str, DWORD *dw)
/******************************************************************************
* Converts a hex comma separated values list into a binary string.
*/
-static BYTE* convertHexCSVToHex(WCHAR *strW, DWORD *size)
+static BYTE* convertHexCSVToHex(WCHAR *str, DWORD *size)
{
- char *s;
+ WCHAR *s;
BYTE *d, *data;
- char* strA = GetMultiByteString(strW);
/* The worst case is 1 digit + 1 comma per byte */
- *size=(strlen(strA)+1)/2;
+ *size=(lstrlenW(str)+1)/2;
data=HeapAlloc(GetProcessHeap(), 0, *size);
CHECK_ENOUGH_MEMORY(data);
- s = strA;
+ s = str;
d = data;
*size=0;
while (*s != '\0') {
UINT wc;
- char *end;
+ WCHAR *end;
- wc = strtoul(s,&end,16);
+ wc = strtoulW(s,&end,16);
if (end == s || wc > 0xff || (*end && *end != ',')) {
+ char* strA = GetMultiByteString(s);
fprintf(stderr,"%s: ERROR converting CSV hex stream. Invalid value at '%s'\n",
- getAppName(), s);
+ getAppName(), strA);
HeapFree(GetProcessHeap(), 0, data);
HeapFree(GetProcessHeap(), 0, strA);
return NULL;
@@ -145,8 +145,6 @@ static BYTE* convertHexCSVToHex(WCHAR *strW, DWORD *size)
s = end;
}
- HeapFree(GetProcessHeap(), 0, strA);
-
return data;
}
More information about the wine-cvs
mailing list