Commit 0f3d8bf5 authored by Martin Fuchs's avatar Martin Fuchs Committed by Alexandre Julliard

Use full paths instead of only filenames in icon cache to distinguish

between different files with the same name.
parent 74bcd4e4
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
...@@ -147,7 +150,8 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface) ...@@ -147,7 +150,8 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface)
return This->ref; 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 * IExtractIconW_GetIconLocation
......
...@@ -97,12 +97,12 @@ static INT CALLBACK SIC_CompareEntries( LPVOID p1, LPVOID p2, LPARAM lparam) ...@@ -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) static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon)
{ LPSIC_ENTRY lpsice; { LPSIC_ENTRY lpsice;
INT ret, index, index1; INT ret, index, index1;
char *path; char path[MAX_PATH];
TRACE("%s %i %p %p\n", sSourceFile, dwSourceIndex, hSmallIcon ,hBigIcon); TRACE("%s %i %p %p\n", sSourceFile, dwSourceIndex, hSmallIcon ,hBigIcon);
lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY)); lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY));
path = PathFindFileNameA(sSourceFile); GetFullPathNameA(sSourceFile, MAX_PATH, path, NULL);
lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 ); lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 );
strcpy( lpsice->sSourceFile, path ); strcpy( lpsice->sSourceFile, path );
...@@ -167,10 +167,12 @@ static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex) ...@@ -167,10 +167,12 @@ static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex)
INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex ) INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex )
{ SIC_ENTRY sice; { SIC_ENTRY sice;
INT ret, index = INVALID_INDEX; INT ret, index = INVALID_INDEX;
char path[MAX_PATH];
TRACE("%s %i\n", sSourceFile, dwSourceIndex); TRACE("%s %i\n", sSourceFile, dwSourceIndex);
sice.sSourceFile = PathFindFileNameA(sSourceFile); GetFullPathNameA(sSourceFile, MAX_PATH, path, NULL);
sice.sSourceFile = path;
sice.dwSourceIndex = dwSourceIndex; sice.dwSourceIndex = dwSourceIndex;
EnterCriticalSection(&SHELL32_SicCS); EnterCriticalSection(&SHELL32_SicCS);
...@@ -257,7 +259,7 @@ BOOL SIC_Initialize(void) ...@@ -257,7 +259,7 @@ BOOL SIC_Initialize(void)
hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 16, 16,LR_SHARED); hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 16, 16,LR_SHARED);
hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 32, 32,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); TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);
......
...@@ -904,6 +904,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) ...@@ -904,6 +904,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
shell32_hInstance = hinstDLL; 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"); hComctl32 = GetModuleHandleA("COMCTL32.DLL");
DisableThreadLibraryCalls(shell32_hInstance); DisableThreadLibraryCalls(shell32_hInstance);
......
...@@ -236,4 +236,7 @@ inline static WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source) ...@@ -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); typedef UINT (*SHELL_ExecuteW32)(WCHAR *lpCmd, void *env, LPSHELLEXECUTEINFOW sei, BOOL shWait);
BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc); BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc);
extern WCHAR swShell32Name[MAX_PATH];
extern char sShell32Name[MAX_PATH];
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment