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

between different files with the same name.
This commit is contained in:
Martin Fuchs 2004-01-21 22:15:09 +00:00 committed by Alexandre Julliard
parent 74bcd4e43f
commit 0f3d8bf500
4 changed files with 19 additions and 5 deletions

View File

@ -17,6 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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