shlwapi: Fix pointer and size in AssocQueryStringA.

This commit is contained in:
Detlef Riekenberg 2008-10-17 16:36:59 +02:00 committed by Alexandre Julliard
parent 03282df13d
commit 78c75e20ae
1 changed files with 5 additions and 2 deletions

View File

@ -303,6 +303,8 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc,
if (dwLenOut >= MAX_PATH) if (dwLenOut >= MAX_PATH)
lpszReturnW = HeapAlloc(GetProcessHeap(), 0, lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
(dwLenOut + 1) * sizeof(WCHAR)); (dwLenOut + 1) * sizeof(WCHAR));
else
dwLenOut = sizeof(szReturnW) / sizeof(szReturnW[0]);
if (!lpszReturnW) if (!lpszReturnW)
hRet = E_OUTOFMEMORY; hRet = E_OUTOFMEMORY;
@ -312,9 +314,10 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc,
lpszReturnW, &dwLenOut); lpszReturnW, &dwLenOut);
if (SUCCEEDED(hRet)) if (SUCCEEDED(hRet))
WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0); dwLenOut = WideCharToMultiByte(CP_ACP, 0, lpszReturnW, -1,
*pcchOut = dwLenOut; pszOut, *pcchOut, NULL, NULL);
*pcchOut = dwLenOut;
if (lpszReturnW != szReturnW) if (lpszReturnW != szReturnW)
HeapFree(GetProcessHeap(), 0, lpszReturnW); HeapFree(GetProcessHeap(), 0, lpszReturnW);
} }