shell32: Use the imagelist to determine the icon size.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2017-04-19 13:13:40 +01:00 committed by Alexandre Julliard
parent 524e316a14
commit 734dc8f200
1 changed files with 16 additions and 4 deletions

View File

@ -298,6 +298,17 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
LeaveCriticalSection(&SHELL32_SicCS);
return ret;
}
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 );
}
/****************************************************************************
* SIC_LoadIcon [internal]
*
@ -311,11 +322,12 @@ static INT SIC_LoadIcon (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
HICON hiconLargeShortcut;
HICON hiconSmallShortcut;
int ret;
SIZE size;
PrivateExtractIconsW( sSourceFile, dwSourceIndex, GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), &hiconLarge, 0, 1, 0 );
PrivateExtractIconsW( sSourceFile, dwSourceIndex, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), &hiconSmall, 0, 1, 0 );
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 );
if ( !hiconLarge || !hiconSmall)
{