From e2b06d2a10a7f869073388c2f57b888a6b0e4c28 Mon Sep 17 00:00:00 2001
From: Rolf Kalbermatter <rolf.kalbermatter@citeng.com>
Date: Sat, 30 Nov 2002 02:22:24 +0000
Subject: [PATCH] Added stub implementation with correct prototypes for
 ExtractAssociatedIconExA/W.

---
 dlls/shell32/iconcache.c  | 22 +++++++++++++++-------
 dlls/shell32/shell32.spec |  4 ++--
 include/shellapi.h        |  3 +++
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 4c7362acb45..905a5b6e7fe 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -498,25 +498,33 @@ HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lp
 }
 
 /*************************************************************************
- *				ExtractAssociatedIconExA (SHELL32.@)
+ *				ExtractAssociatedIconExW (SHELL32.@)
  *
  * Return icon for given file (either from file itself or from associated
  * executable) and patch parameters if needed.
  */
-HICON WINAPI ExtractAssociatedIconExA(DWORD d1, DWORD d2, DWORD d3, DWORD d4)
+HICON WINAPI ExtractAssociatedIconExW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIconIdx, LPWORD lpiIconId)
 {
-  FIXME("(%lx %lx %lx %lx): stub\n", d1, d2, d3, d4);
+  FIXME("%p %s %p %p): stub\n", hInst, debugstr_w(lpIconPath), lpiIconIdx, lpiIconId);
   return 0;
 }
 
 /*************************************************************************
- *				ExtractAssociatedIconExW (SHELL32.@)
+ *				ExtractAssociatedIconExA (SHELL32.@)
  *
  * Return icon for given file (either from file itself or from associated
  * executable) and patch parameters if needed.
  */
-HICON WINAPI ExtractAssociatedIconExW(DWORD d1, DWORD d2, DWORD d3, DWORD d4)
+HICON WINAPI ExtractAssociatedIconExA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIconIdx, LPWORD lpiIconId)
 {
-  FIXME("(%lx %lx %lx %lx): stub\n", d1, d2, d3, d4);
-  return 0;
+  HICON ret;
+  INT len = MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, NULL, 0 );
+  LPWSTR lpwstrFile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+
+  TRACE("%p %s %p %p)\n", hInst, lpIconPath, lpiIconIdx, lpiIconId);
+
+  MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, lpwstrFile, len );
+  ret = ExtractAssociatedIconExW(hInst, lpwstrFile, lpiIconIdx, lpiIconId);
+  HeapFree(GetProcessHeap(), 0, lpwstrFile);
+  return ret;
 }
diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index b78f347b777..77b73bf41fc 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -321,8 +321,8 @@
 @ stub DragQueryFileAorW
 @ stdcall DuplicateIcon(long long) DuplicateIcon
 @ stdcall ExtractAssociatedIconA(long ptr long)ExtractAssociatedIconA
-@ stdcall ExtractAssociatedIconExA(long long long long)ExtractAssociatedIconExA
-@ stdcall ExtractAssociatedIconExW(long long long long)ExtractAssociatedIconExW
+@ stdcall ExtractAssociatedIconExA(long str long long) ExtractAssociatedIconExA
+@ stdcall ExtractAssociatedIconExW(long wstr long long) ExtractAssociatedIconExW
 @ stub ExtractAssociatedIconW
 @ stdcall ExtractIconA(long str long)ExtractIconA
 @ stdcall ExtractIconEx(ptr long ptr ptr long)ExtractIconExAW
diff --git a/include/shellapi.h b/include/shellapi.h
index 708c81f54d7..e22bbc11ad9 100644
--- a/include/shellapi.h
+++ b/include/shellapi.h
@@ -270,6 +270,9 @@ HICON       WINAPI ExtractIconW(HINSTANCE,LPCWSTR,UINT);
 HICON       WINAPI ExtractAssociatedIconA(HINSTANCE,LPSTR,LPWORD);
 HICON       WINAPI ExtractAssociatedIconW(HINSTANCE,LPWSTR,LPWORD);
 #define     ExtractAssociatedIcon WINELIB_NAME_AW(ExtractAssociatedIcon)
+HICON       WINAPI ExtractAssociatedIconExA(HINSTANCE,LPSTR,LPWORD,LPWORD);
+HICON       WINAPI ExtractAssociatedIconExW(HINSTANCE,LPWSTR,LPWORD,LPWORD);
+#define     ExtractAssociatedIconEx WINELIB_NAME_AW(ExtractAssociatedIconEx)
 HICON       WINAPI ExtractIconExA( LPCSTR, INT, HICON *, HICON *, UINT );
 HICON       WINAPI ExtractIconExW( LPCWSTR, INT, HICON *, HICON *, UINT );
 #define     ExtractIconEx WINELIB_NAME_AW(ExtractIconEx)
-- 
GitLab