PrivateExtractIcon - search path for icon files

Robert Shearman R.J.Shearman at warwick.ac.uk
Tue May 13 13:55:35 CDT 2003


Previous to this patch, PrivateExtractIcon* did not search the path for the
specified file. This patch fixes this as confirmed on Windows 2000.

ChangeLog:
- PrivateExtractIcon* should search the path for the icon file

Rob
-------------- next part --------------
Index: wine/dlls/user/exticon.c
===================================================================
RCS file: /home/wine/wine/dlls/user/exticon.c,v
retrieving revision 1.27
diff -u -r1.27 exticon.c
--- wine/dlls/user/exticon.c	10 Mar 2003 19:04:39 -0000	1.27
+++ wine/dlls/user/exticon.c	13 May 2003 18:41:27 -0000
@@ -266,10 +266,19 @@
 	HANDLE		fmapping;
 	ULONG		uSize;
 	DWORD		fsizeh,fsizel;
+        WCHAR		szExePath[MAX_PATH];
+        DWORD		dwSearchReturn;
 
 	TRACE("%s, %d, %d %p 0x%08x\n", debugstr_w(lpszExeFileName), nIconIndex, nIcons, pIconId, flags);
 
-	hFile = CreateFileW(lpszExeFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+        dwSearchReturn = SearchPathW(NULL, lpszExeFileName, NULL, sizeof(szExePath) / sizeof(szExePath[0]), szExePath, NULL);
+        if ((dwSearchReturn == 0) || (dwSearchReturn > sizeof(szExePath) / sizeof(szExePath[0])))
+        {
+            WARN("File %s not found or path too long\n", debugstr_w(lpszExeFileName));
+            return -1;
+        }
+
+	hFile = CreateFileW(szExePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
 	if (hFile == INVALID_HANDLE_VALUE) return ret;
 	fsizel = GetFileSize(hFile,&fsizeh);
 


More information about the wine-patches mailing list