From 0f3d8bf50042a40d81b6f475dea2d6cf54dac779 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Wed, 21 Jan 2004 22:15:09 +0000 Subject: [PATCH] Use full paths instead of only filenames in icon cache to distinguish between different files with the same name. --- dlls/shell32/folders.c | 6 +++++- dlls/shell32/iconcache.c | 10 ++++++---- dlls/shell32/shell32_main.c | 5 +++++ dlls/shell32/shell32_main.h | 3 +++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index 296ce9de8c..837fd1302c 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -17,6 +17,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" +#include "wine/port.h" + #include #include #include @@ -147,7 +150,8 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface) return This->ref; } -static WCHAR swShell32Name[] = {'s','h','e','l','l','3','2','.','d','l','l',0}; +WCHAR swShell32Name[MAX_PATH]; +char sShell32Name[MAX_PATH]; /************************************************************************** * IExtractIconW_GetIconLocation diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index 922b664c5b..4c1737e93c 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -97,12 +97,12 @@ static INT CALLBACK SIC_CompareEntries( LPVOID p1, LPVOID p2, LPARAM lparam) static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon) { LPSIC_ENTRY lpsice; INT ret, index, index1; - char *path; + char path[MAX_PATH]; TRACE("%s %i %p %p\n", sSourceFile, dwSourceIndex, hSmallIcon ,hBigIcon); lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY)); - path = PathFindFileNameA(sSourceFile); + GetFullPathNameA(sSourceFile, MAX_PATH, path, NULL); lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 ); strcpy( lpsice->sSourceFile, path ); @@ -167,10 +167,12 @@ static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex) INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex ) { SIC_ENTRY sice; INT ret, index = INVALID_INDEX; + char path[MAX_PATH]; TRACE("%s %i\n", sSourceFile, dwSourceIndex); - sice.sSourceFile = PathFindFileNameA(sSourceFile); + GetFullPathNameA(sSourceFile, MAX_PATH, path, NULL); + sice.sSourceFile = path; sice.dwSourceIndex = dwSourceIndex; EnterCriticalSection(&SHELL32_SicCS); @@ -257,7 +259,7 @@ BOOL SIC_Initialize(void) hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 16, 16,LR_SHARED); hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 32, 32,LR_SHARED); } - SIC_IconAppend ("shell32.dll", index, hSm, hLg); + SIC_IconAppend (sShell32Name, index, hSm, hLg); } TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList); diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 336955227e..8123123804 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -904,6 +904,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) { case DLL_PROCESS_ATTACH: shell32_hInstance = hinstDLL; + + /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */ + GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH); + WideCharToMultiByte(CP_ACP, 0, swShell32Name, -1, sShell32Name, MAX_PATH, NULL, NULL); + hComctl32 = GetModuleHandleA("COMCTL32.DLL"); DisableThreadLibraryCalls(shell32_hInstance); diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 27f0840435..f8bbafb1da 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -236,4 +236,7 @@ inline static WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source) typedef UINT (*SHELL_ExecuteW32)(WCHAR *lpCmd, void *env, LPSHELLEXECUTEINFOW sei, BOOL shWait); BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc); +extern WCHAR swShell32Name[MAX_PATH]; +extern char sShell32Name[MAX_PATH]; + #endif