1998-11-15 13:25:18 +00:00
|
|
|
/*
|
|
|
|
* shell icon cache (SIC)
|
|
|
|
*
|
2002-03-09 23:29:33 +00:00
|
|
|
* Copyright 1998, 1999 Juergen Schmied
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1998-11-15 13:25:18 +00:00
|
|
|
*/
|
2002-03-09 23:29:33 +00:00
|
|
|
|
2002-08-17 00:43:16 +00:00
|
|
|
#include "config.h"
|
2003-12-15 19:48:52 +00:00
|
|
|
#include "wine/port.h"
|
2002-08-17 00:43:16 +00:00
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
1998-11-15 13:25:18 +00:00
|
|
|
#include <string.h>
|
2000-02-10 19:03:02 +00:00
|
|
|
#include <sys/types.h>
|
2002-08-17 00:43:16 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2004-10-07 03:06:48 +00:00
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
2000-02-10 19:03:02 +00:00
|
|
|
#include "windef.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "winbase.h"
|
2000-02-10 19:03:02 +00:00
|
|
|
#include "wingdi.h"
|
1999-05-22 11:33:23 +00:00
|
|
|
#include "winuser.h"
|
2001-11-06 22:31:19 +00:00
|
|
|
#include "winreg.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
1999-04-22 10:11:04 +00:00
|
|
|
|
|
|
|
#include "shellapi.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "objbase.h"
|
1998-11-15 13:25:18 +00:00
|
|
|
#include "pidl.h"
|
|
|
|
#include "shell32_main.h"
|
2001-08-16 18:49:56 +00:00
|
|
|
#include "undocshell.h"
|
2005-05-13 17:48:33 +00:00
|
|
|
#include "shresdef.h"
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
|
|
|
/********************** THE ICON CACHE ********************************/
|
|
|
|
|
1998-12-14 17:37:38 +00:00
|
|
|
#define INVALID_INDEX -1
|
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
typedef struct
|
2001-07-24 21:45:22 +00:00
|
|
|
{
|
2004-03-22 20:43:07 +00:00
|
|
|
LPWSTR sSourceFile; /* file (not path!) containing the icon */
|
2008-01-16 11:20:50 +00:00
|
|
|
DWORD dwSourceIndex; /* index within the file, if it is a resource ID it will be negated */
|
1998-11-15 13:25:18 +00:00
|
|
|
DWORD dwListIndex; /* index within the iconlist */
|
1999-04-11 11:50:41 +00:00
|
|
|
DWORD dwFlags; /* GIL_* flags */
|
|
|
|
DWORD dwAccessTime;
|
1998-11-15 13:25:18 +00:00
|
|
|
} SIC_ENTRY, * LPSIC_ENTRY;
|
|
|
|
|
2013-10-17 16:01:04 +00:00
|
|
|
static HDPA sic_hdpa;
|
|
|
|
static INIT_ONCE sic_init_once = INIT_ONCE_STATIC_INIT;
|
2014-01-02 10:56:11 +00:00
|
|
|
static HIMAGELIST ShellSmallIconList;
|
|
|
|
static HIMAGELIST ShellBigIconList;
|
2003-08-12 23:50:54 +00:00
|
|
|
|
|
|
|
static CRITICAL_SECTION SHELL32_SicCS;
|
|
|
|
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &SHELL32_SicCS,
|
|
|
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
2005-09-09 10:19:44 +00:00
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": SHELL32_SicCS") }
|
2003-08-12 23:50:54 +00:00
|
|
|
};
|
|
|
|
static CRITICAL_SECTION SHELL32_SicCS = { &critsect_debug, -1, 0, 0, 0, 0 };
|
1999-08-15 14:26:30 +00:00
|
|
|
|
2017-05-02 15:12:34 +00:00
|
|
|
|
|
|
|
static const WCHAR WindowMetrics[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
|
|
|
|
'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
|
|
|
|
static const WCHAR ShellIconSize[] = {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
|
|
|
|
|
2017-05-02 15:12:36 +00:00
|
|
|
#define SIC_COMPARE_LISTINDEX 1
|
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
/*****************************************************************************
|
2001-11-06 00:45:32 +00:00
|
|
|
* SIC_CompareEntries
|
1999-03-13 17:10:36 +00:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Callback for DPA_Search
|
|
|
|
*/
|
2001-11-06 00:45:32 +00:00
|
|
|
static INT CALLBACK SIC_CompareEntries( LPVOID p1, LPVOID p2, LPARAM lparam)
|
2009-02-18 21:46:39 +00:00
|
|
|
{
|
|
|
|
LPSIC_ENTRY e1 = p1, e2 = p2;
|
|
|
|
|
2005-05-20 18:58:35 +00:00
|
|
|
TRACE("%p %p %8lx\n", p1, p2, lparam);
|
|
|
|
|
|
|
|
/* Icons in the cache are keyed by the name of the file they are
|
|
|
|
* loaded from, their resource index and the fact if they have a shortcut
|
|
|
|
* icon overlay or not.
|
|
|
|
*/
|
2017-05-02 15:12:36 +00:00
|
|
|
|
|
|
|
if (lparam & SIC_COMPARE_LISTINDEX)
|
|
|
|
return e1->dwListIndex != e2->dwListIndex;
|
|
|
|
|
2005-05-20 18:58:35 +00:00
|
|
|
if (e1->dwSourceIndex != e2->dwSourceIndex || /* first the faster one */
|
|
|
|
(e1->dwFlags & GIL_FORSHORTCUT) != (e2->dwFlags & GIL_FORSHORTCUT))
|
1998-11-15 13:25:18 +00:00
|
|
|
return 1;
|
|
|
|
|
2005-05-20 18:58:35 +00:00
|
|
|
if (strcmpiW(e1->sSourceFile,e2->sSourceFile))
|
1998-11-15 13:25:18 +00:00
|
|
|
return 1;
|
|
|
|
|
2002-05-31 23:06:46 +00:00
|
|
|
return 0;
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
2005-05-13 17:48:33 +00:00
|
|
|
|
2017-05-02 15:12:36 +00:00
|
|
|
/**************************************************************************************
|
|
|
|
* SIC_get_location
|
|
|
|
*
|
|
|
|
* Returns the source file and resource index of an icon with the given imagelist index
|
|
|
|
*/
|
|
|
|
HRESULT SIC_get_location( int list_idx, WCHAR *file, DWORD *size, int *res_idx )
|
|
|
|
{
|
|
|
|
SIC_ENTRY seek, *found;
|
|
|
|
DWORD needed;
|
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
int dpa_idx;
|
|
|
|
|
|
|
|
seek.dwListIndex = list_idx;
|
|
|
|
|
|
|
|
EnterCriticalSection( &SHELL32_SicCS );
|
|
|
|
|
|
|
|
dpa_idx = DPA_Search( sic_hdpa, &seek, 0, SIC_CompareEntries, SIC_COMPARE_LISTINDEX, 0 );
|
|
|
|
if (dpa_idx != -1)
|
|
|
|
{
|
|
|
|
found = (SIC_ENTRY *)DPA_GetPtr( sic_hdpa, dpa_idx );
|
|
|
|
needed = (strlenW( found->sSourceFile ) + 1) * sizeof(WCHAR);
|
|
|
|
if (needed <= *size)
|
|
|
|
{
|
|
|
|
memcpy( file, found->sSourceFile, needed );
|
|
|
|
*res_idx = found->dwSourceIndex;
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*size = needed;
|
|
|
|
hr = E_NOT_SUFFICIENT_BUFFER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection( &SHELL32_SicCS );
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2005-11-21 13:35:06 +00:00
|
|
|
/* declare SIC_LoadOverlayIcon() */
|
2006-01-11 11:33:24 +00:00
|
|
|
static int SIC_LoadOverlayIcon(int icon_idx);
|
2005-11-21 13:35:06 +00:00
|
|
|
|
2005-05-13 17:48:33 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* SIC_OverlayShortcutImage [internal]
|
|
|
|
*
|
|
|
|
* NOTES
|
2016-05-29 10:41:31 +00:00
|
|
|
* Creates a new icon as a copy of the passed-in icon, overlaid with a
|
2005-05-13 17:48:33 +00:00
|
|
|
* shortcut image.
|
|
|
|
*/
|
2005-11-21 13:35:06 +00:00
|
|
|
static HICON SIC_OverlayShortcutImage(HICON SourceIcon, BOOL large)
|
2005-05-13 17:48:33 +00:00
|
|
|
{ ICONINFO SourceIconInfo, ShortcutIconInfo, TargetIconInfo;
|
|
|
|
HICON ShortcutIcon, TargetIcon;
|
|
|
|
BITMAP SourceBitmapInfo, ShortcutBitmapInfo;
|
|
|
|
HDC SourceDC = NULL,
|
|
|
|
ShortcutDC = NULL,
|
|
|
|
TargetDC = NULL,
|
|
|
|
ScreenDC = NULL;
|
|
|
|
HBITMAP OldSourceBitmap = NULL,
|
|
|
|
OldShortcutBitmap = NULL,
|
|
|
|
OldTargetBitmap = NULL;
|
|
|
|
|
2005-11-21 13:35:06 +00:00
|
|
|
static int s_imgListIdx = -1;
|
|
|
|
|
2005-05-13 17:48:33 +00:00
|
|
|
/* Get information about the source icon and shortcut overlay */
|
|
|
|
if (! GetIconInfo(SourceIcon, &SourceIconInfo)
|
|
|
|
|| 0 == GetObjectW(SourceIconInfo.hbmColor, sizeof(BITMAP), &SourceBitmapInfo))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-11-21 13:35:06 +00:00
|
|
|
|
|
|
|
/* search for the shortcut icon only once */
|
|
|
|
if (s_imgListIdx == -1)
|
2005-11-28 09:59:06 +00:00
|
|
|
s_imgListIdx = SIC_LoadOverlayIcon(- IDI_SHELL_SHORTCUT);
|
|
|
|
/* FIXME should use icon index 29 instead of the
|
|
|
|
resource id, but not all icons are present yet
|
|
|
|
so we can't use icon indices */
|
2005-11-21 13:35:06 +00:00
|
|
|
|
|
|
|
if (s_imgListIdx != -1)
|
|
|
|
{
|
|
|
|
if (large)
|
|
|
|
ShortcutIcon = ImageList_GetIcon(ShellBigIconList, s_imgListIdx, ILD_TRANSPARENT);
|
|
|
|
else
|
|
|
|
ShortcutIcon = ImageList_GetIcon(ShellSmallIconList, s_imgListIdx, ILD_TRANSPARENT);
|
|
|
|
} else
|
|
|
|
ShortcutIcon = NULL;
|
|
|
|
|
2005-05-13 17:48:33 +00:00
|
|
|
if (NULL == ShortcutIcon
|
|
|
|
|| ! GetIconInfo(ShortcutIcon, &ShortcutIconInfo)
|
|
|
|
|| 0 == GetObjectW(ShortcutIconInfo.hbmColor, sizeof(BITMAP), &ShortcutBitmapInfo))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
TargetIconInfo = SourceIconInfo;
|
|
|
|
TargetIconInfo.hbmMask = NULL;
|
|
|
|
TargetIconInfo.hbmColor = NULL;
|
|
|
|
|
|
|
|
/* Setup the source, shortcut and target masks */
|
|
|
|
SourceDC = CreateCompatibleDC(NULL);
|
|
|
|
if (NULL == SourceDC) goto fail;
|
|
|
|
OldSourceBitmap = SelectObject(SourceDC, SourceIconInfo.hbmMask);
|
|
|
|
if (NULL == OldSourceBitmap) goto fail;
|
|
|
|
|
|
|
|
ShortcutDC = CreateCompatibleDC(NULL);
|
|
|
|
if (NULL == ShortcutDC) goto fail;
|
|
|
|
OldShortcutBitmap = SelectObject(ShortcutDC, ShortcutIconInfo.hbmMask);
|
|
|
|
if (NULL == OldShortcutBitmap) goto fail;
|
|
|
|
|
|
|
|
TargetDC = CreateCompatibleDC(NULL);
|
|
|
|
if (NULL == TargetDC) goto fail;
|
|
|
|
TargetIconInfo.hbmMask = CreateCompatibleBitmap(TargetDC, SourceBitmapInfo.bmWidth,
|
|
|
|
SourceBitmapInfo.bmHeight);
|
|
|
|
if (NULL == TargetIconInfo.hbmMask) goto fail;
|
|
|
|
ScreenDC = GetDC(NULL);
|
|
|
|
if (NULL == ScreenDC) goto fail;
|
|
|
|
TargetIconInfo.hbmColor = CreateCompatibleBitmap(ScreenDC, SourceBitmapInfo.bmWidth,
|
|
|
|
SourceBitmapInfo.bmHeight);
|
|
|
|
ReleaseDC(NULL, ScreenDC);
|
|
|
|
if (NULL == TargetIconInfo.hbmColor) goto fail;
|
|
|
|
OldTargetBitmap = SelectObject(TargetDC, TargetIconInfo.hbmMask);
|
|
|
|
if (NULL == OldTargetBitmap) goto fail;
|
|
|
|
|
|
|
|
/* Create the target mask by ANDing the source and shortcut masks */
|
|
|
|
if (! BitBlt(TargetDC, 0, 0, SourceBitmapInfo.bmWidth, SourceBitmapInfo.bmHeight,
|
|
|
|
SourceDC, 0, 0, SRCCOPY) ||
|
|
|
|
! BitBlt(TargetDC, 0, SourceBitmapInfo.bmHeight - ShortcutBitmapInfo.bmHeight,
|
|
|
|
ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
|
|
|
|
ShortcutDC, 0, 0, SRCAND))
|
|
|
|
{
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the source and target xor bitmap */
|
|
|
|
if (NULL == SelectObject(SourceDC, SourceIconInfo.hbmColor) ||
|
|
|
|
NULL == SelectObject(TargetDC, TargetIconInfo.hbmColor))
|
|
|
|
{
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the source xor bitmap to the target and clear out part of it by using
|
|
|
|
the shortcut mask */
|
|
|
|
if (! BitBlt(TargetDC, 0, 0, SourceBitmapInfo.bmWidth, SourceBitmapInfo.bmHeight,
|
|
|
|
SourceDC, 0, 0, SRCCOPY) ||
|
|
|
|
! BitBlt(TargetDC, 0, SourceBitmapInfo.bmHeight - ShortcutBitmapInfo.bmHeight,
|
|
|
|
ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
|
|
|
|
ShortcutDC, 0, 0, SRCAND))
|
|
|
|
{
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL == SelectObject(ShortcutDC, ShortcutIconInfo.hbmColor)) goto fail;
|
|
|
|
|
|
|
|
/* Now put in the shortcut xor mask */
|
|
|
|
if (! BitBlt(TargetDC, 0, SourceBitmapInfo.bmHeight - ShortcutBitmapInfo.bmHeight,
|
|
|
|
ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
|
|
|
|
ShortcutDC, 0, 0, SRCINVERT))
|
|
|
|
{
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clean up, we're not goto'ing to 'fail' after this so we can be lazy and not set
|
|
|
|
handles to NULL */
|
|
|
|
SelectObject(TargetDC, OldTargetBitmap);
|
|
|
|
DeleteObject(TargetDC);
|
|
|
|
SelectObject(ShortcutDC, OldShortcutBitmap);
|
|
|
|
DeleteObject(ShortcutDC);
|
|
|
|
SelectObject(SourceDC, OldSourceBitmap);
|
|
|
|
DeleteObject(SourceDC);
|
|
|
|
|
|
|
|
/* Create the icon using the bitmaps prepared earlier */
|
|
|
|
TargetIcon = CreateIconIndirect(&TargetIconInfo);
|
|
|
|
|
|
|
|
/* CreateIconIndirect copies the bitmaps, so we can release our bitmaps now */
|
|
|
|
DeleteObject(TargetIconInfo.hbmColor);
|
|
|
|
DeleteObject(TargetIconInfo.hbmMask);
|
|
|
|
|
|
|
|
return TargetIcon;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
/* Clean up scratch resources we created */
|
|
|
|
if (NULL != OldTargetBitmap) SelectObject(TargetDC, OldTargetBitmap);
|
|
|
|
if (NULL != TargetIconInfo.hbmColor) DeleteObject(TargetIconInfo.hbmColor);
|
|
|
|
if (NULL != TargetIconInfo.hbmMask) DeleteObject(TargetIconInfo.hbmMask);
|
|
|
|
if (NULL != TargetDC) DeleteObject(TargetDC);
|
|
|
|
if (NULL != OldShortcutBitmap) SelectObject(ShortcutDC, OldShortcutBitmap);
|
|
|
|
if (NULL != ShortcutDC) DeleteObject(ShortcutDC);
|
|
|
|
if (NULL != OldSourceBitmap) SelectObject(SourceDC, OldSourceBitmap);
|
|
|
|
if (NULL != SourceDC) DeleteObject(SourceDC);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
/*****************************************************************************
|
1999-03-13 17:10:36 +00:00
|
|
|
* SIC_IconAppend [internal]
|
|
|
|
*
|
|
|
|
* NOTES
|
2003-11-28 23:10:19 +00:00
|
|
|
* appends an icon pair to the end of the cache
|
1999-03-13 17:10:36 +00:00
|
|
|
*/
|
2005-05-13 17:48:33 +00:00
|
|
|
static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon, DWORD dwFlags)
|
1998-11-15 13:25:18 +00:00
|
|
|
{ LPSIC_ENTRY lpsice;
|
1999-08-15 14:26:30 +00:00
|
|
|
INT ret, index, index1;
|
2004-03-22 20:43:07 +00:00
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
TRACE("%s %i %p %p\n", debugstr_w(sSourceFile), dwSourceIndex, hSmallIcon ,hBigIcon);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2008-11-05 22:00:50 +00:00
|
|
|
lpsice = SHAlloc(sizeof(SIC_ENTRY));
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2005-05-13 17:48:33 +00:00
|
|
|
GetFullPathNameW(sSourceFile, MAX_PATH, path, NULL);
|
2004-03-22 20:43:07 +00:00
|
|
|
lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, (strlenW(path)+1)*sizeof(WCHAR) );
|
|
|
|
strcpyW( lpsice->sSourceFile, path );
|
2001-07-24 21:45:22 +00:00
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
lpsice->dwSourceIndex = dwSourceIndex;
|
2005-05-13 17:48:33 +00:00
|
|
|
lpsice->dwFlags = dwFlags;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-08-15 14:26:30 +00:00
|
|
|
EnterCriticalSection(&SHELL32_SicCS);
|
|
|
|
|
2002-07-29 00:24:58 +00:00
|
|
|
index = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice);
|
1998-12-14 17:37:38 +00:00
|
|
|
if ( INVALID_INDEX == index )
|
1999-08-15 14:26:30 +00:00
|
|
|
{
|
2003-11-28 23:10:19 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpsice->sSourceFile);
|
1999-08-15 14:26:30 +00:00
|
|
|
SHFree(lpsice);
|
|
|
|
ret = INVALID_INDEX;
|
1999-03-13 17:10:36 +00:00
|
|
|
}
|
1999-08-15 14:26:30 +00:00
|
|
|
else
|
|
|
|
{
|
2001-01-17 22:05:24 +00:00
|
|
|
index = ImageList_AddIcon (ShellSmallIconList, hSmallIcon);
|
|
|
|
index1= ImageList_AddIcon (ShellBigIconList, hBigIcon);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
1999-08-15 14:26:30 +00:00
|
|
|
if (index!=index1)
|
|
|
|
{
|
|
|
|
FIXME("iconlists out of sync 0x%x 0x%x\n", index, index1);
|
|
|
|
}
|
|
|
|
lpsice->dwListIndex = index;
|
|
|
|
ret = lpsice->dwListIndex;
|
1998-12-14 17:37:38 +00:00
|
|
|
}
|
1999-08-15 14:26:30 +00:00
|
|
|
|
|
|
|
LeaveCriticalSection(&SHELL32_SicCS);
|
2002-05-31 23:06:46 +00:00
|
|
|
return ret;
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
2017-04-19 12:13:40 +00:00
|
|
|
|
|
|
|
static BOOL get_imagelist_icon_size(int list, SIZE *size)
|
|
|
|
{
|
|
|
|
HIMAGELIST image_list;
|
|
|
|
|
|
|
|
if (list < SHIL_LARGE || list > SHIL_SMALL) return FALSE;
|
|
|
|
image_list = (list == SHIL_LARGE) ? ShellBigIconList : ShellSmallIconList;
|
|
|
|
|
|
|
|
return ImageList_GetIconSize( image_list, &size->cx, &size->cy );
|
|
|
|
}
|
|
|
|
|
1998-12-14 17:37:38 +00:00
|
|
|
/****************************************************************************
|
1999-03-13 17:10:36 +00:00
|
|
|
* SIC_LoadIcon [internal]
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* gets small/big icon by number from a file
|
|
|
|
*/
|
2005-05-13 17:48:33 +00:00
|
|
|
static INT SIC_LoadIcon (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
|
2017-04-19 12:13:39 +00:00
|
|
|
{
|
|
|
|
HICON hiconLarge=0;
|
1999-02-26 11:11:13 +00:00
|
|
|
HICON hiconSmall=0;
|
2005-05-13 17:48:33 +00:00
|
|
|
HICON hiconLargeShortcut;
|
|
|
|
HICON hiconSmallShortcut;
|
2017-04-19 12:13:39 +00:00
|
|
|
int ret;
|
2017-04-19 12:13:40 +00:00
|
|
|
SIZE size;
|
1998-12-14 17:37:38 +00:00
|
|
|
|
2017-04-19 12:13:40 +00:00
|
|
|
get_imagelist_icon_size( SHIL_LARGE, &size );
|
|
|
|
PrivateExtractIconsW( sSourceFile, dwSourceIndex, size.cx, size.cy, &hiconLarge, 0, 1, 0 );
|
|
|
|
get_imagelist_icon_size( SHIL_SMALL, &size );
|
|
|
|
PrivateExtractIconsW( sSourceFile, dwSourceIndex, size.cx, size.cy, &hiconSmall, 0, 1, 0 );
|
1998-12-14 17:37:38 +00:00
|
|
|
|
|
|
|
if ( !hiconLarge || !hiconSmall)
|
1999-08-15 14:26:30 +00:00
|
|
|
{
|
2004-03-22 20:43:07 +00:00
|
|
|
WARN("failure loading icon %i from %s (%p %p)\n", dwSourceIndex, debugstr_w(sSourceFile), hiconLarge, hiconSmall);
|
1998-12-14 17:37:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2005-05-13 17:48:33 +00:00
|
|
|
|
|
|
|
if (0 != (dwFlags & GIL_FORSHORTCUT))
|
|
|
|
{
|
2005-11-21 13:35:06 +00:00
|
|
|
hiconLargeShortcut = SIC_OverlayShortcutImage(hiconLarge, TRUE);
|
|
|
|
hiconSmallShortcut = SIC_OverlayShortcutImage(hiconSmall, FALSE);
|
2005-05-13 17:48:33 +00:00
|
|
|
if (NULL != hiconLargeShortcut && NULL != hiconSmallShortcut)
|
|
|
|
{
|
2017-04-19 12:13:39 +00:00
|
|
|
DestroyIcon( hiconLarge );
|
|
|
|
DestroyIcon( hiconSmall );
|
2005-05-13 17:48:33 +00:00
|
|
|
hiconLarge = hiconLargeShortcut;
|
|
|
|
hiconSmall = hiconSmallShortcut;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-05-29 10:41:31 +00:00
|
|
|
WARN("Failed to create shortcut overlaid icons\n");
|
2005-05-13 17:48:33 +00:00
|
|
|
if (NULL != hiconLargeShortcut) DestroyIcon(hiconLargeShortcut);
|
|
|
|
if (NULL != hiconSmallShortcut) DestroyIcon(hiconSmallShortcut);
|
|
|
|
dwFlags &= ~ GIL_FORSHORTCUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 12:13:39 +00:00
|
|
|
ret = SIC_IconAppend( sSourceFile, dwSourceIndex, hiconSmall, hiconLarge, dwFlags );
|
|
|
|
DestroyIcon( hiconLarge );
|
|
|
|
DestroyIcon( hiconSmall );
|
|
|
|
return ret;
|
1998-12-14 17:37:38 +00:00
|
|
|
}
|
2017-04-19 12:13:39 +00:00
|
|
|
|
2017-05-02 15:12:34 +00:00
|
|
|
static int get_shell_icon_size(void)
|
|
|
|
{
|
|
|
|
WCHAR buf[32];
|
|
|
|
DWORD value = 32, size = sizeof(buf), type;
|
|
|
|
HKEY key;
|
|
|
|
|
|
|
|
if (!RegOpenKeyW( HKEY_CURRENT_USER, WindowMetrics, &key ))
|
|
|
|
{
|
|
|
|
if (!RegQueryValueExW( key, ShellIconSize, NULL, &type, (BYTE *)buf, &size ) && type == REG_SZ)
|
|
|
|
{
|
|
|
|
if (size == sizeof(buf)) buf[size / sizeof(WCHAR) - 1] = 0;
|
|
|
|
value = atoiW( buf );
|
|
|
|
}
|
|
|
|
RegCloseKey( key );
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
/*****************************************************************************
|
1999-03-13 17:10:36 +00:00
|
|
|
* SIC_Initialize [internal]
|
|
|
|
*/
|
2013-10-17 16:01:04 +00:00
|
|
|
static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context )
|
1999-08-15 14:26:30 +00:00
|
|
|
{
|
|
|
|
HICON hSm, hLg;
|
2004-09-24 01:10:31 +00:00
|
|
|
int cx_small, cy_small;
|
|
|
|
int cx_large, cy_large;
|
|
|
|
|
2017-05-02 15:12:34 +00:00
|
|
|
if (!IsProcessDPIAware())
|
|
|
|
{
|
|
|
|
cx_large = cy_large = get_shell_icon_size();
|
|
|
|
cx_small = GetSystemMetrics( SM_CXSMICON );
|
|
|
|
cy_small = GetSystemMetrics( SM_CYSMICON );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cx_large = GetSystemMetrics( SM_CXICON );
|
|
|
|
cy_large = GetSystemMetrics( SM_CYICON );
|
|
|
|
cx_small = cx_large / 2;
|
|
|
|
cy_small = cy_large / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("large %dx%d small %dx%d\n", cx_large, cy_large, cx_small, cx_small);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2002-07-29 00:24:58 +00:00
|
|
|
sic_hdpa = DPA_Create(16);
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-07-10 11:50:54 +00:00
|
|
|
if (!sic_hdpa)
|
1999-08-15 14:26:30 +00:00
|
|
|
{
|
|
|
|
return(FALSE);
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
|
|
|
|
2005-10-27 12:08:44 +00:00
|
|
|
ShellSmallIconList = ImageList_Create(cx_small,cy_small,ILC_COLOR32|ILC_MASK,0,0x20);
|
|
|
|
ShellBigIconList = ImageList_Create(cx_large,cy_large,ILC_COLOR32|ILC_MASK,0,0x20);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2005-10-27 12:08:44 +00:00
|
|
|
ImageList_SetBkColor(ShellSmallIconList, CLR_NONE);
|
|
|
|
ImageList_SetBkColor(ShellBigIconList, CLR_NONE);
|
1999-07-25 12:21:24 +00:00
|
|
|
|
2005-10-27 12:08:44 +00:00
|
|
|
/* Load the document icon, which is used as the default if an icon isn't found. */
|
2008-11-05 22:00:50 +00:00
|
|
|
hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT),
|
2005-10-27 12:08:44 +00:00
|
|
|
IMAGE_ICON, cx_small, cy_small, LR_SHARED);
|
2008-11-05 22:00:50 +00:00
|
|
|
hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT),
|
2005-10-27 12:08:44 +00:00
|
|
|
IMAGE_ICON, cx_large, cy_large, LR_SHARED);
|
1999-08-15 14:26:30 +00:00
|
|
|
|
2005-10-27 12:08:44 +00:00
|
|
|
if (!hSm || !hLg)
|
|
|
|
{
|
|
|
|
FIXME("Failed to load IDI_SHELL_DOCUMENT icon!\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2005-10-27 12:08:44 +00:00
|
|
|
SIC_IconAppend (swShell32Name, IDI_SHELL_DOCUMENT-1, hSm, hLg, 0);
|
|
|
|
SIC_IconAppend (swShell32Name, -IDI_SHELL_DOCUMENT, hSm, hLg, 0);
|
|
|
|
|
1999-06-12 15:45:58 +00:00
|
|
|
TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-03-28 12:35:24 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SIC_Destroy
|
|
|
|
*
|
|
|
|
* frees the cache
|
|
|
|
*/
|
2003-09-17 20:15:21 +00:00
|
|
|
static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam )
|
1999-03-28 12:35:24 +00:00
|
|
|
{
|
2003-11-28 23:10:19 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, ((LPSIC_ENTRY)ptr)->sSourceFile);
|
|
|
|
SHFree(ptr);
|
|
|
|
return TRUE;
|
2003-09-17 20:15:21 +00:00
|
|
|
}
|
1998-11-15 13:25:18 +00:00
|
|
|
|
2003-09-17 20:15:21 +00:00
|
|
|
void SIC_Destroy(void)
|
|
|
|
{
|
1999-07-10 11:50:54 +00:00
|
|
|
TRACE("\n");
|
|
|
|
|
1999-08-15 14:26:30 +00:00
|
|
|
EnterCriticalSection(&SHELL32_SicCS);
|
|
|
|
|
2003-09-17 20:15:21 +00:00
|
|
|
if (sic_hdpa) DPA_DestroyCallback(sic_hdpa, sic_free, NULL );
|
1999-07-10 11:50:54 +00:00
|
|
|
|
2013-12-11 04:36:59 +00:00
|
|
|
if (ShellSmallIconList)
|
|
|
|
ImageList_Destroy(ShellSmallIconList);
|
|
|
|
if (ShellBigIconList)
|
|
|
|
ImageList_Destroy(ShellBigIconList);
|
1999-08-15 14:26:30 +00:00
|
|
|
|
|
|
|
LeaveCriticalSection(&SHELL32_SicCS);
|
2000-02-26 18:47:23 +00:00
|
|
|
DeleteCriticalSection(&SHELL32_SicCS);
|
1999-03-28 12:35:24 +00:00
|
|
|
}
|
2004-08-06 18:58:18 +00:00
|
|
|
|
2013-10-17 16:01:04 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* SIC_GetIconIndex [internal]
|
|
|
|
*
|
|
|
|
* Parameters
|
|
|
|
* sSourceFile [IN] filename of file containing the icon
|
|
|
|
* index [IN] index/resID (negated) in this file
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* look in the cache for a proper icon. if not available the icon is taken
|
|
|
|
* from the file and cached
|
|
|
|
*/
|
|
|
|
INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags )
|
|
|
|
{
|
|
|
|
SIC_ENTRY sice;
|
|
|
|
INT ret, index = INVALID_INDEX;
|
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
|
|
|
|
TRACE("%s %i\n", debugstr_w(sSourceFile), dwSourceIndex);
|
|
|
|
|
|
|
|
GetFullPathNameW(sSourceFile, MAX_PATH, path, NULL);
|
|
|
|
sice.sSourceFile = path;
|
|
|
|
sice.dwSourceIndex = dwSourceIndex;
|
|
|
|
sice.dwFlags = dwFlags;
|
|
|
|
|
|
|
|
InitOnceExecuteOnce( &sic_init_once, SIC_Initialize, NULL, NULL );
|
|
|
|
|
|
|
|
EnterCriticalSection(&SHELL32_SicCS);
|
|
|
|
|
|
|
|
if (NULL != DPA_GetPtr (sic_hdpa, 0))
|
|
|
|
{
|
|
|
|
/* search linear from position 0*/
|
|
|
|
index = DPA_Search (sic_hdpa, &sice, 0, SIC_CompareEntries, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( INVALID_INDEX == index )
|
|
|
|
{
|
|
|
|
ret = SIC_LoadIcon (sSourceFile, dwSourceIndex, dwFlags);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TRACE("-- found\n");
|
|
|
|
ret = ((LPSIC_ENTRY)DPA_GetPtr(sic_hdpa, index))->dwListIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&SHELL32_SicCS);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-21 13:35:06 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* SIC_LoadOverlayIcon [internal]
|
|
|
|
*
|
|
|
|
* Load a shell overlay icon and return its icon cache index.
|
|
|
|
*/
|
2006-01-11 11:33:24 +00:00
|
|
|
static int SIC_LoadOverlayIcon(int icon_idx)
|
2005-11-21 13:35:06 +00:00
|
|
|
{
|
|
|
|
WCHAR buffer[1024], wszIdx[8];
|
|
|
|
HKEY hKeyShellIcons;
|
|
|
|
LPCWSTR iconPath;
|
|
|
|
int iconIdx;
|
|
|
|
|
|
|
|
static const WCHAR wszShellIcons[] = {
|
|
|
|
'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'E','x','p','l','o','r','e','r','\\','S','h','e','l','l',' ','I','c','o','n','s',0
|
|
|
|
};
|
|
|
|
static const WCHAR wszNumFmt[] = {'%','d',0};
|
|
|
|
|
|
|
|
iconPath = swShell32Name; /* default: load icon from shell32.dll */
|
2006-01-11 11:33:24 +00:00
|
|
|
iconIdx = icon_idx;
|
2005-11-21 13:35:06 +00:00
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszShellIcons, 0, KEY_READ, &hKeyShellIcons) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DWORD count = sizeof(buffer);
|
|
|
|
|
2006-01-11 11:33:24 +00:00
|
|
|
sprintfW(wszIdx, wszNumFmt, icon_idx);
|
2005-11-21 13:35:06 +00:00
|
|
|
|
|
|
|
/* read icon path and index */
|
|
|
|
if (RegQueryValueExW(hKeyShellIcons, wszIdx, NULL, NULL, (LPBYTE)buffer, &count) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
LPWSTR p = strchrW(buffer, ',');
|
|
|
|
|
2009-12-03 22:47:31 +00:00
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
ERR("Icon index in %s/%s corrupted, no comma.\n", debugstr_w(wszShellIcons),debugstr_w(wszIdx));
|
|
|
|
RegCloseKey(hKeyShellIcons);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*p++ = 0;
|
2005-11-21 13:35:06 +00:00
|
|
|
iconPath = buffer;
|
|
|
|
iconIdx = atoiW(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKeyShellIcons);
|
|
|
|
}
|
|
|
|
|
2013-10-17 16:01:04 +00:00
|
|
|
InitOnceExecuteOnce( &sic_init_once, SIC_Initialize, NULL, NULL );
|
|
|
|
|
2005-11-21 13:35:06 +00:00
|
|
|
return SIC_LoadIcon(iconPath, iconIdx, 0);
|
|
|
|
}
|
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
/*************************************************************************
|
2010-07-20 08:11:49 +00:00
|
|
|
* Shell_GetImageLists [SHELL32.71]
|
1998-11-15 13:25:18 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS
|
2004-03-23 23:20:16 +00:00
|
|
|
* imglist[1|2] [OUT] pointer which receives imagelist handles
|
1998-11-15 13:25:18 +00:00
|
|
|
*
|
|
|
|
*/
|
2010-07-20 08:11:49 +00:00
|
|
|
BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList)
|
2013-10-17 16:01:04 +00:00
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n",lpBigList,lpSmallList);
|
|
|
|
InitOnceExecuteOnce( &sic_init_once, SIC_Initialize, NULL, NULL );
|
|
|
|
if (lpBigList) *lpBigList = ShellBigIconList;
|
|
|
|
if (lpSmallList) *lpSmallList = ShellSmallIconList;
|
|
|
|
return TRUE;
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
1999-04-11 11:50:41 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* PidlToSicIndex [INTERNAL]
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* sh [IN] IShellFolder
|
|
|
|
* pidl [IN]
|
|
|
|
* bBigIcon [IN]
|
2000-02-26 18:47:23 +00:00
|
|
|
* uFlags [IN] GIL_*
|
1999-04-11 11:50:41 +00:00
|
|
|
* pIndex [OUT] index within the SIC
|
|
|
|
*
|
|
|
|
*/
|
2000-02-26 18:47:23 +00:00
|
|
|
BOOL PidlToSicIndex (
|
|
|
|
IShellFolder * sh,
|
2003-09-02 01:01:06 +00:00
|
|
|
LPCITEMIDLIST pidl,
|
2000-02-26 18:47:23 +00:00
|
|
|
BOOL bBigIcon,
|
|
|
|
UINT uFlags,
|
2004-02-11 06:21:45 +00:00
|
|
|
int * pIndex)
|
2002-05-31 23:06:46 +00:00
|
|
|
{
|
2004-03-22 20:43:07 +00:00
|
|
|
IExtractIconW *ei;
|
|
|
|
WCHAR szIconFile[MAX_PATH]; /* file containing the icon */
|
1999-04-11 11:50:41 +00:00
|
|
|
INT iSourceIndex; /* index or resID(negated) in this file */
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
UINT dwFlags = 0;
|
2005-05-13 17:48:33 +00:00
|
|
|
int iShortcutDefaultIndex = INVALID_INDEX;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2000-02-26 18:47:23 +00:00
|
|
|
TRACE("sf=%p pidl=%p %s\n", sh, pidl, bBigIcon?"Big":"Small");
|
1999-04-22 09:20:01 +00:00
|
|
|
|
2013-10-17 16:01:04 +00:00
|
|
|
InitOnceExecuteOnce( &sic_init_once, SIC_Initialize, NULL, NULL );
|
|
|
|
|
2004-03-22 22:57:13 +00:00
|
|
|
if (SUCCEEDED (IShellFolder_GetUIObjectOf(sh, 0, 1, &pidl, &IID_IExtractIconW, 0, (void **)&ei)))
|
1999-04-11 11:50:41 +00:00
|
|
|
{
|
2004-03-22 20:43:07 +00:00
|
|
|
if (SUCCEEDED(IExtractIconW_GetIconLocation(ei, uFlags, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags)))
|
2000-02-26 18:47:23 +00:00
|
|
|
{
|
2005-05-13 17:48:33 +00:00
|
|
|
*pIndex = SIC_GetIconIndex(szIconFile, iSourceIndex, uFlags);
|
1999-04-22 09:20:01 +00:00
|
|
|
ret = TRUE;
|
1999-04-11 11:50:41 +00:00
|
|
|
}
|
2004-03-22 20:43:07 +00:00
|
|
|
IExtractIconW_Release(ei);
|
1999-04-11 11:50:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (INVALID_INDEX == *pIndex) /* default icon when failed */
|
2005-05-13 17:48:33 +00:00
|
|
|
{
|
|
|
|
if (0 == (uFlags & GIL_FORSHORTCUT))
|
|
|
|
{
|
|
|
|
*pIndex = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (INVALID_INDEX == iShortcutDefaultIndex)
|
|
|
|
{
|
|
|
|
iShortcutDefaultIndex = SIC_LoadIcon(swShell32Name, 0, GIL_FORSHORTCUT);
|
|
|
|
}
|
|
|
|
*pIndex = (INVALID_INDEX != iShortcutDefaultIndex ? iShortcutDefaultIndex : 0);
|
|
|
|
}
|
|
|
|
}
|
1999-04-11 11:50:41 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
1998-11-15 13:25:18 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
1999-03-13 17:10:36 +00:00
|
|
|
* SHMapPIDLToSystemImageListIndex [SHELL32.77]
|
1998-11-15 13:25:18 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS
|
2002-05-31 23:06:46 +00:00
|
|
|
* sh [IN] pointer to an instance of IShellFolder
|
1999-04-11 11:50:41 +00:00
|
|
|
* pidl [IN]
|
|
|
|
* pIndex [OUT][OPTIONAL] SIC index for big icon
|
1998-11-15 13:25:18 +00:00
|
|
|
*
|
|
|
|
*/
|
2000-04-28 20:18:15 +00:00
|
|
|
int WINAPI SHMapPIDLToSystemImageListIndex(
|
2004-02-11 06:21:45 +00:00
|
|
|
IShellFolder *sh,
|
2000-04-28 20:18:15 +00:00
|
|
|
LPCITEMIDLIST pidl,
|
2004-02-11 06:21:45 +00:00
|
|
|
int *pIndex)
|
1999-04-11 11:50:41 +00:00
|
|
|
{
|
2004-02-11 06:21:45 +00:00
|
|
|
int Index;
|
2005-11-21 13:35:06 +00:00
|
|
|
UINT uGilFlags = 0;
|
1998-11-15 13:25:18 +00:00
|
|
|
|
1999-08-15 14:26:30 +00:00
|
|
|
TRACE("(SF=%p,pidl=%p,%p)\n",sh,pidl,pIndex);
|
1998-12-14 17:37:38 +00:00
|
|
|
pdump(pidl);
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2005-11-21 13:35:06 +00:00
|
|
|
if (SHELL_IsShortcut(pidl))
|
|
|
|
uGilFlags |= GIL_FORSHORTCUT;
|
|
|
|
|
1999-04-11 11:50:41 +00:00
|
|
|
if (pIndex)
|
2005-11-21 13:35:06 +00:00
|
|
|
if (!PidlToSicIndex ( sh, pidl, 1, uGilFlags, pIndex))
|
|
|
|
*pIndex = -1;
|
|
|
|
|
|
|
|
if (!PidlToSicIndex ( sh, pidl, 0, uGilFlags, &Index))
|
|
|
|
return -1;
|
|
|
|
|
1999-04-11 11:50:41 +00:00
|
|
|
return Index;
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
|
|
|
|
2007-04-25 18:49:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHMapIDListToImageListIndexAsync [SHELL32.148]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHMapIDListToImageListIndexAsync(IUnknown *pts, IShellFolder *psf,
|
|
|
|
LPCITEMIDLIST pidl, UINT flags,
|
|
|
|
void *pfn, void *pvData, void *pvHint,
|
|
|
|
int *piIndex, int *piIndexSel)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p, 0x%08x, %p, %p, %p, %p, %p)\n",
|
|
|
|
pts, psf, pidl, flags, pfn, pvData, pvHint, piIndex, piIndexSel);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-01-03 12:33:08 +00:00
|
|
|
/*************************************************************************
|
1999-03-13 17:10:36 +00:00
|
|
|
* Shell_GetCachedImageIndex [SHELL32.72]
|
1999-01-03 12:33:08 +00:00
|
|
|
*
|
|
|
|
*/
|
2008-12-03 11:09:38 +00:00
|
|
|
static INT Shell_GetCachedImageIndexA(LPCSTR szPath, INT nIndex, BOOL bSimulateDoc)
|
1999-04-11 11:50:41 +00:00
|
|
|
{
|
2004-03-22 20:43:07 +00:00
|
|
|
INT ret, len;
|
|
|
|
LPWSTR szTemp;
|
|
|
|
|
1999-06-12 15:45:58 +00:00
|
|
|
WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_a(szPath), nIndex, bSimulateDoc);
|
2004-03-22 20:43:07 +00:00
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, szPath, -1, NULL, 0 );
|
|
|
|
szTemp = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, szPath, -1, szTemp, len );
|
|
|
|
|
2005-05-13 17:48:33 +00:00
|
|
|
ret = SIC_GetIconIndex( szTemp, nIndex, 0 );
|
2004-03-22 20:43:07 +00:00
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, szTemp );
|
|
|
|
|
|
|
|
return ret;
|
1999-01-03 12:33:08 +00:00
|
|
|
}
|
|
|
|
|
2008-12-03 11:09:38 +00:00
|
|
|
static INT Shell_GetCachedImageIndexW(LPCWSTR szPath, INT nIndex, BOOL bSimulateDoc)
|
2004-03-22 20:43:07 +00:00
|
|
|
{
|
1999-06-12 15:45:58 +00:00
|
|
|
WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_w(szPath), nIndex, bSimulateDoc);
|
1999-01-03 12:33:08 +00:00
|
|
|
|
2005-05-13 17:48:33 +00:00
|
|
|
return SIC_GetIconIndex(szPath, nIndex, 0);
|
1999-01-03 12:33:08 +00:00
|
|
|
}
|
|
|
|
|
1999-04-11 11:50:41 +00:00
|
|
|
INT WINAPI Shell_GetCachedImageIndexAW(LPCVOID szPath, INT nIndex, BOOL bSimulateDoc)
|
2000-08-14 14:35:01 +00:00
|
|
|
{ if( SHELL_OsIsUnicode())
|
1999-04-11 11:50:41 +00:00
|
|
|
return Shell_GetCachedImageIndexW(szPath, nIndex, bSimulateDoc);
|
|
|
|
return Shell_GetCachedImageIndexA(szPath, nIndex, bSimulateDoc);
|
1999-01-03 12:33:08 +00:00
|
|
|
}
|
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
/*************************************************************************
|
2002-12-03 21:35:43 +00:00
|
|
|
* ExtractIconExW [SHELL32.@]
|
2004-08-06 18:58:18 +00:00
|
|
|
* RETURNS
|
2002-05-31 23:06:46 +00:00
|
|
|
* 0 no icon found
|
2002-12-10 19:10:11 +00:00
|
|
|
* -1 file is not valid
|
|
|
|
* or number of icons extracted
|
1999-03-13 17:10:36 +00:00
|
|
|
*/
|
2002-12-10 19:10:11 +00:00
|
|
|
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons)
|
2002-12-03 21:35:43 +00:00
|
|
|
{
|
2002-12-10 19:10:11 +00:00
|
|
|
TRACE("%s %i %p %p %i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons);
|
|
|
|
|
|
|
|
return PrivateExtractIconExW(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
2002-12-03 21:35:43 +00:00
|
|
|
|
1998-11-15 13:25:18 +00:00
|
|
|
/*************************************************************************
|
2002-12-03 21:35:43 +00:00
|
|
|
* ExtractIconExA [SHELL32.@]
|
1999-03-13 17:10:36 +00:00
|
|
|
*/
|
2002-12-10 19:10:11 +00:00
|
|
|
UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons)
|
2002-12-03 21:35:43 +00:00
|
|
|
{
|
Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
2005-01-03 20:26:06 +00:00
|
|
|
UINT ret = 0;
|
2002-12-03 21:35:43 +00:00
|
|
|
INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
|
|
|
|
LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-12-03 21:35:43 +00:00
|
|
|
TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
|
1998-11-15 13:25:18 +00:00
|
|
|
|
Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
2005-01-03 20:26:06 +00:00
|
|
|
if (lpwstrFile)
|
|
|
|
{
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
|
|
|
|
ret = ExtractIconExW(lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwstrFile);
|
|
|
|
}
|
2002-12-03 21:35:43 +00:00
|
|
|
return ret;
|
1998-11-15 13:25:18 +00:00
|
|
|
}
|
2002-06-21 20:08:50 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* ExtractAssociatedIconA (SHELL32.@)
|
|
|
|
*
|
|
|
|
* Return icon for given file (either from file itself or from associated
|
|
|
|
* executable) and patch parameters if needed.
|
|
|
|
*/
|
|
|
|
HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon)
|
2002-10-10 21:22:09 +00:00
|
|
|
{
|
Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
2005-01-03 20:26:06 +00:00
|
|
|
HICON hIcon = NULL;
|
|
|
|
INT len = MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, NULL, 0);
|
2005-06-17 09:52:33 +00:00
|
|
|
/* Note that we need to allocate MAX_PATH, since we are supposed to fill
|
|
|
|
* the correct executable if there is no icon in lpIconPath directly.
|
|
|
|
* lpIconPath itself is supposed to be large enough, so make sure lpIconPathW
|
|
|
|
* is large enough too. Yes, I am puking too.
|
|
|
|
*/
|
|
|
|
LPWSTR lpIconPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
|
Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
2005-01-03 20:26:06 +00:00
|
|
|
|
|
|
|
TRACE("%p %s %p\n", hInst, debugstr_a(lpIconPath), lpiIcon);
|
|
|
|
|
|
|
|
if (lpIconPathW)
|
|
|
|
{
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, lpIconPathW, len);
|
|
|
|
hIcon = ExtractAssociatedIconW(hInst, lpIconPathW, lpiIcon);
|
2005-06-17 09:52:33 +00:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, lpIconPathW, -1, lpIconPath, MAX_PATH , NULL, NULL);
|
Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
2005-01-03 20:26:06 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpIconPathW);
|
|
|
|
}
|
|
|
|
return hIcon;
|
|
|
|
}
|
2002-10-10 21:22:09 +00:00
|
|
|
|
2005-06-17 20:58:33 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* ExtractAssociatedIconW (SHELL32.@)
|
|
|
|
*
|
|
|
|
* Return icon for given file (either from file itself or from associated
|
|
|
|
* executable) and patch parameters if needed.
|
|
|
|
*/
|
Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
2005-01-03 20:26:06 +00:00
|
|
|
HICON WINAPI ExtractAssociatedIconW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIcon)
|
|
|
|
{
|
|
|
|
HICON hIcon = NULL;
|
|
|
|
WORD wDummyIcon = 0;
|
|
|
|
|
|
|
|
TRACE("%p %s %p\n", hInst, debugstr_w(lpIconPath), lpiIcon);
|
|
|
|
|
|
|
|
if(lpiIcon == NULL)
|
|
|
|
lpiIcon = &wDummyIcon;
|
|
|
|
|
|
|
|
hIcon = ExtractIconW(hInst, lpIconPath, *lpiIcon);
|
|
|
|
|
|
|
|
if( hIcon < (HICON)2 )
|
|
|
|
{ if( hIcon == (HICON)1 ) /* no icons found in given file */
|
|
|
|
{ WCHAR tempPath[MAX_PATH];
|
|
|
|
HINSTANCE uRet = FindExecutableW(lpIconPath,NULL,tempPath);
|
|
|
|
|
|
|
|
if( uRet > (HINSTANCE)32 && tempPath[0] )
|
|
|
|
{ lstrcpyW(lpIconPath,tempPath);
|
|
|
|
hIcon = ExtractIconW(hInst, lpIconPath, *lpiIcon);
|
|
|
|
if( hIcon > (HICON)2 )
|
|
|
|
return hIcon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( hIcon == (HICON)1 )
|
|
|
|
*lpiIcon = 2; /* MSDOS icon - we found .exe but no icons in it */
|
|
|
|
else
|
|
|
|
*lpiIcon = 6; /* generic icon - found nothing */
|
|
|
|
|
|
|
|
if (GetModuleFileNameW(hInst, lpIconPath, MAX_PATH))
|
|
|
|
hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(*lpiIcon));
|
|
|
|
}
|
|
|
|
return hIcon;
|
2002-06-21 20:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2002-11-30 02:22:24 +00:00
|
|
|
* ExtractAssociatedIconExW (SHELL32.@)
|
2002-06-21 20:08:50 +00:00
|
|
|
*
|
|
|
|
* Return icon for given file (either from file itself or from associated
|
|
|
|
* executable) and patch parameters if needed.
|
|
|
|
*/
|
2002-11-30 02:22:24 +00:00
|
|
|
HICON WINAPI ExtractAssociatedIconExW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIconIdx, LPWORD lpiIconId)
|
2002-06-21 20:08:50 +00:00
|
|
|
{
|
2002-11-30 02:22:24 +00:00
|
|
|
FIXME("%p %s %p %p): stub\n", hInst, debugstr_w(lpIconPath), lpiIconIdx, lpiIconId);
|
2002-06-21 20:08:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2002-11-30 02:22:24 +00:00
|
|
|
* ExtractAssociatedIconExA (SHELL32.@)
|
2002-06-21 20:08:50 +00:00
|
|
|
*
|
|
|
|
* Return icon for given file (either from file itself or from associated
|
|
|
|
* executable) and patch parameters if needed.
|
|
|
|
*/
|
2002-11-30 02:22:24 +00:00
|
|
|
HICON WINAPI ExtractAssociatedIconExA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIconIdx, LPWORD lpiIconId)
|
2002-06-21 20:08:50 +00:00
|
|
|
{
|
2002-11-30 02:22:24 +00:00
|
|
|
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;
|
2002-06-21 20:08:50 +00:00
|
|
|
}
|
2002-12-07 23:49:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* SHDefExtractIconW [SHELL32.@]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI 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) {
|
2009-05-15 20:16:35 +00:00
|
|
|
if (phiconLarge)
|
|
|
|
*phiconLarge = hIcons[0];
|
|
|
|
else
|
|
|
|
DestroyIcon(hIcons[0]);
|
|
|
|
if (phiconSmall)
|
|
|
|
*phiconSmall = hIcons[1];
|
|
|
|
else
|
|
|
|
DestroyIcon(hIcons[1]);
|
2002-12-07 23:49:24 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* SHDefExtractIconA [SHELL32.@]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI 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;
|
|
|
|
}
|
2008-06-26 05:58:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* SHGetIconOverlayIndexA [SHELL32.@]
|
|
|
|
*
|
|
|
|
* Returns the index of the overlay icon in the system image list.
|
|
|
|
*/
|
|
|
|
INT WINAPI SHGetIconOverlayIndexA(LPCSTR pszIconPath, INT iIconIndex)
|
|
|
|
{
|
|
|
|
FIXME("%s, %d\n", debugstr_a(pszIconPath), iIconIndex);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* SHGetIconOverlayIndexW [SHELL32.@]
|
|
|
|
*
|
|
|
|
* Returns the index of the overlay icon in the system image list.
|
|
|
|
*/
|
|
|
|
INT WINAPI SHGetIconOverlayIndexW(LPCWSTR pszIconPath, INT iIconIndex)
|
|
|
|
{
|
|
|
|
FIXME("%s, %d\n", debugstr_w(pszIconPath), iIconIndex);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2013-04-25 18:22:05 +00:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* SHGetStockIconInfo [SHELL32.@]
|
|
|
|
*
|
2013-07-03 10:11:13 +00:00
|
|
|
* Receive information for builtin icons
|
2013-04-25 18:22:05 +00:00
|
|
|
*
|
|
|
|
* PARAMS
|
2013-07-03 10:11:13 +00:00
|
|
|
* id [I] selected icon-id to get information for
|
|
|
|
* flags [I] selects the information to receive
|
2013-04-25 18:22:05 +00:00
|
|
|
* sii [IO] SHSTOCKICONINFO structure to fill
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: S_OK
|
|
|
|
* Failure: A HRESULT failure code
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO *sii)
|
|
|
|
{
|
|
|
|
static const WCHAR shell32dll[] = {'\\','s','h','e','l','l','3','2','.','d','l','l',0};
|
|
|
|
|
|
|
|
FIXME("(%d, 0x%x, %p) semi-stub\n", id, flags, sii);
|
|
|
|
if ((id < 0) || (id >= SIID_MAX_ICONS) || !sii || (sii->cbSize != sizeof(SHSTOCKICONINFO))) {
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetSystemDirectoryW(sii->szPath, MAX_PATH);
|
|
|
|
|
|
|
|
/* no icons defined: use default */
|
2013-04-26 20:12:57 +00:00
|
|
|
sii->iIcon = -IDI_SHELL_DOCUMENT;
|
2013-04-25 18:22:05 +00:00
|
|
|
lstrcatW(sii->szPath, shell32dll);
|
|
|
|
|
|
|
|
if (flags)
|
|
|
|
FIXME("flags 0x%x not implemented\n", flags);
|
|
|
|
|
|
|
|
sii->hIcon = NULL;
|
|
|
|
sii->iSysImageIndex = -1;
|
|
|
|
|
|
|
|
TRACE("%3d: returning %s (%d)\n", id, debugstr_w(sii->szPath), sii->iIcon);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|