FW: shell32.SHDefExtractIcon implementation take

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Fri Dec 6 14:29:44 CST 2002


Please disregard the previous patch as there where errors in.

ChangeLog:
 * include/shlobj.h
   - Add SHDefExtractIcon{AW} function

 * dlls/shell32/iconcache.c
   - Add SHDefExtractIcon{AW} function

 * dlls/shell32/shell32.spec
   - Add SHDefExtractIcon{AW} function

Rolf Kalbermatter

Index: include/shlobj.h
===================================================================
RCS file: /home/wine/wine/include/shlobj.h,v
retrieving revision 1.54
diff -u -r1.54 shlobj.h
--- include/shlobj.h	5 Dec 2002 20:33:07 -0000	1.54
+++ include/shlobj.h	6 Dec 2002 17:20:58 -0000
@@ -580,6 +580,16 @@
   BOOL  fWide;
 } DROPFILES;
 
+
+/****************************************************************************
+* SHDefExtractIcon API
+*/
+HRESULT SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags,
+                          HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize);
+HRESULT SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags,
+                          HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize);
+HRESULT SHDefExtractIconAW(LPCVOID pszIconFile, int iIndex, UINT uFlags,
+                           HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize);
 #include "poppack.h" 
 
 #ifdef __cplusplus

Index: dlls/shell32/iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.63
diff -u -r1.63 iconcache.c
--- dlls/shell32/iconcache.c	3 Dec 2002 21:35:43 -0000	1.63
+++ dlls/shell32/iconcache.c	6 Dec 2002 20:27:53 -0000
@@ -534,3 +534,53 @@
   HeapFree(GetProcessHeap(), 0, lpwstrFile);
   return ret;
 }
+
+/*************************************************************************
+ * SHDefExtractIcon			[SHELL32.@]
+ */
+HRESULT SHDefExtractIconAW(LPCVOID pszIconFile, int iIndex, UINT uFlags,
+                           HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize)
+{	if (SHELL_OsIsUnicode())
+	  return SHDefExtractIconW(pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
+	return SHDefExtractIconA(pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
+};
+
+/****************************************************************************
+ * SHDefExtractIconW		[SHELL32.@]
+ */
+HRESULT SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags,
+                          HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize)
+{
+	UINT ret;
+	HICON hIcons[2];
+	WARN("%s %d 0x%08x %p %p %d, semi-stub\n", debugstr_w(pszIconFile), iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
+
+	ret = PrivateExtractIconsW(pszIconFile, iIndex, nIconSize, nIconSize, hIcons, NULL, 2, LR_DEFAULTCOLOR);
+	/* FIXME: deal with uFlags parameter which contains GIL_ flags */
+	if (ret == 0xFFFFFFFF)
+	  return E_FAIL;
+	if (ret > 0) {
+	  *phiconLarge = hIcons[0];
+	  *phiconSmall = hIcons[1];
+	  return S_OK;
+	}
+	return S_FALSE;
+};
+
+/****************************************************************************
+ * SHDefExtractIconA		[SHELL32.@]
+ */
+HRESULT SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags,
+                          HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize)
+{
+  HRESULT ret;
+  INT len = MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, NULL, 0);
+  LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+
+  TRACE("%s %d 0x%08x %p %p %d\n", pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
+
+  MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, lpwstrFile, len);
+  ret = SHDefExtractIconW(lpwstrFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
+  HeapFree(GetProcessHeap(), 0, lpwstrFile);
+  return ret;
+};

Index: dlls/shell32/shell32.spec
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32.spec,v
retrieving revision 1.59
diff -u -r1.59 shell32.spec
--- dlls/shell32/shell32.spec	3 Dec 2002 21:36:22 -0000	1.59
+++ dlls/shell32/shell32.spec	6 Dec 2002 19:37:36 -0000
@@ -411,3 +411,9 @@
 @ stdcall SHGetFolderPathA(long long long long ptr)SHGetFolderPathA
 @ stdcall SHGetFolderPathW(long long long long ptr)SHGetFolderPathW
 @ stdcall SHGetFolderLocation(long long long long ptr)SHGetFolderLocation
+
+# version 6.0 (WinXP)
+# _WIN32_IE >= 0x600
+@ stdcall SHDefExtractIconA(str long long ptr ptr long)SHDefExtractIconA
+@ stdcall SHDefExtractIconW(wstr long long ptr ptr long)SHDefExtractIconW
+@ stdcall SHDefExtractIcon(ptr long long ptr ptr long)SHDefExtractIconAW




More information about the wine-patches mailing list