winecfg: Fix a crash when inputting non-ASCII dll override name.
Signed-off-by: Zhiyi Zhang <yi.gd.cn@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1ca988d4f4
commit
eee8131d3b
|
@ -571,7 +571,7 @@ char **enumerate_values(HKEY root, char *path)
|
||||||
WCHAR *wpath;
|
WCHAR *wpath;
|
||||||
WCHAR **wret;
|
WCHAR **wret;
|
||||||
char **ret=NULL;
|
char **ret=NULL;
|
||||||
int i=0, len=0;
|
int i=0, len=0, size;
|
||||||
|
|
||||||
wpath = HeapAlloc(GetProcessHeap(), 0, (strlen(path)+1)*sizeof(WCHAR));
|
wpath = HeapAlloc(GetProcessHeap(), 0, (strlen(path)+1)*sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, strlen(path)+1);
|
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, strlen(path)+1);
|
||||||
|
@ -586,11 +586,13 @@ char **enumerate_values(HKEY root, char *path)
|
||||||
/* convert WCHAR ** to char ** and HeapFree each WCHAR * element on our way */
|
/* convert WCHAR ** to char ** and HeapFree each WCHAR * element on our way */
|
||||||
for (i=0; i<len; i++)
|
for (i=0; i<len; i++)
|
||||||
{
|
{
|
||||||
ret[i] = HeapAlloc(GetProcessHeap(), 0,
|
size = WideCharToMultiByte(CP_ACP, 0, wret[i], -1, NULL, 0, NULL, NULL);
|
||||||
(lstrlenW(wret[i]) + 1) * sizeof(char));
|
if(size)
|
||||||
WideCharToMultiByte(CP_ACP, 0, wret[i], -1, ret[i],
|
{
|
||||||
lstrlenW(wret[i]) + 1, NULL, NULL);
|
ret[i] = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
HeapFree(GetProcessHeap(), 0, wret[i]);
|
WideCharToMultiByte(CP_ACP, 0, wret[i], -1, ret[i], size, NULL, NULL);
|
||||||
|
HeapFree(GetProcessHeap(), 0, wret[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ret[len] = NULL;
|
ret[len] = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue