Fixed crash in winamp reported by Andreas Mohr.

This commit is contained in:
Juergen Schmied 2003-01-10 01:46:15 +00:00 committed by Alexandre Julliard
parent 799e6ce629
commit 7cf87c521e
1 changed files with 9 additions and 5 deletions

View File

@ -476,9 +476,14 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
DWORD ret;
SHFILEINFOA temppsfi;
len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
temppath = HeapAlloc(GetProcessHeap(), 0, len);
WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
if (flags & SHGFI_PIDL) {
/* path contains a pidl */
temppath = (LPSTR) path;
} else {
len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
temppath = HeapAlloc(GetProcessHeap(), 0, len);
WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
}
if(flags & SHGFI_ATTR_SPECIFIED)
temppsfi.dwAttributes=psfi->dwAttributes;
@ -496,8 +501,7 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
if(flags & SHGFI_TYPENAME)
MultiByteToWideChar(CP_ACP, 0, temppsfi.szTypeName, -1, psfi->szTypeName, sizeof(psfi->szTypeName));
HeapFree(GetProcessHeap(), 0, temppath);
if(!(flags & SHGFI_PIDL)) HeapFree(GetProcessHeap(), 0, temppath);
return ret;
}