From d98c36c106077a7b5bc52e36292bac4526530267 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Mon, 5 Apr 2004 21:05:51 +0000 Subject: [PATCH] Get icons for shell link files. --- dlls/shell32/folders.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index 055466677ab..35cdd5e1cbb 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -259,13 +259,36 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation( found = TRUE; } - - if (!found) /* default icon */ + else if (!strcasecmp(sTemp, "lnkfile")) { - lstrcpynW(szIconFile, swShell32Name, cchMax); - *piIndex = 0; + /* extract icon from shell shortcut */ + IShellFolder* dsf; + IShellLinkW* psl; + + if (SUCCEEDED(SHGetDesktopFolder(&dsf))) + { + HRESULT hr = IShellFolder_GetUIObjectOf(dsf, NULL, 1, (LPCITEMIDLIST*)&This->pidl, &IID_IShellLinkW, NULL, (LPVOID*)&psl); + + if (SUCCEEDED(hr)) + { + hr = IShellLinkW_GetIconLocation(psl, szIconFile, MAX_PATH, piIndex); + + if (SUCCEEDED(hr) && *szIconFile) + found = TRUE; + + IShellLinkW_Release(psl); + } + + IShellFolder_Release(dsf); + } } } + + if (!found) /* default icon */ + { + lstrcpynW(szIconFile, swShell32Name, cchMax); + *piIndex = 0; + } } TRACE("-- %s %x\n", debugstr_w(szIconFile), *piIndex);