Fix bad memory allocation for unicode buffer.

This commit is contained in:
Rolf Kalbermatter 2004-10-27 21:18:35 +00:00 committed by Alexandre Julliard
parent 4408b91174
commit 87fb440e71
1 changed files with 4 additions and 4 deletions

View File

@ -131,14 +131,14 @@ BOOL SHELL_ConfirmDialogW(int nKindOfDialog, LPCWSTR szDir)
return (IDOK == MessageBoxW(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION));
}
static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minlen)
static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChars)
{
DWORD len = MultiByteToWideChar(CP_ACP, 0, aPath, -1, NULL, 0);
if (len < minlen)
len = minlen;
if (len < minChars)
len = minChars;
*wPath = HeapAlloc(GetProcessHeap(), 0, len);
*wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (*wPath)
{
MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);