fix shgetfileinfoW

Jürgen Schmied j.schmied at t-online.de
Wed Jan 8 14:34:50 CST 2003


- fixed crash in winamp reported by andreas mohr



-------------- next part --------------
--- wine-20021219/dlls/shell32/shell32_main.c	Sat Dec 14 00:45:36 2002
+++ wine/dlls/shell32/shell32_main.c	Wed Jan  8 19:28:02 2003
@@ -476,9 +476,14 @@
 	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,9 +501,9 @@
        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);
 
 }
 
 /*************************************************************************


More information about the wine-patches mailing list