https://git.reactos.org/?p=reactos.git;a=commitdiff;h=399854ce31ef8fe42b723…
commit 399854ce31ef8fe42b72319e8cbae0e75989cfa3
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Nov 24 19:26:32 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Nov 24 19:26:32 2019 +0900
[SHELL32] Set default exe icon (#2076)
The default icon of an exe file was empty if no icon available from exe.
CORE-10480
---
dll/win32/shell32/CExtractIcon.cpp | 15 +++++++++++++++
dll/win32/shell32/folders/CFSFolder.cpp | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dll/win32/shell32/CExtractIcon.cpp b/dll/win32/shell32/CExtractIcon.cpp
index 26bdb4e9307..e24f6c12800 100644
--- a/dll/win32/shell32/CExtractIcon.cpp
+++ b/dll/win32/shell32/CExtractIcon.cpp
@@ -138,6 +138,21 @@ HRESULT STDMETHODCALLTYPE CExtractIcon::SetNormalIcon(
{
TRACE("(%p, %s, %d)\n", this, debugstr_w(pszFile), iIcon);
+ if (lstrcmpiW(PathFindExtensionW(pszFile), L".exe") == 0)
+ {
+ if (!PrivateExtractIconExW(pszFile, 0, NULL, NULL, 1))
+ {
+ WCHAR szPath[MAX_PATH];
+ GetModuleFileNameW(shell32_hInstance, szPath, _countof(szPath));
+ DuplicateString(szPath, &normalIcon.file);
+ if (!normalIcon.file)
+ return E_OUTOFMEMORY;
+
+ normalIcon.index = -IDI_SHELL_EXE;
+ return S_OK;
+ }
+ }
+
DuplicateString(pszFile, &normalIcon.file);
if (!normalIcon.file)
return E_OUTOFMEMORY;
diff --git a/dll/win32/shell32/folders/CFSFolder.cpp
b/dll/win32/shell32/folders/CFSFolder.cpp
index a356bb927a3..6acf3013e43 100644
--- a/dll/win32/shell32/folders/CFSFolder.cpp
+++ b/dll/win32/shell32/folders/CFSFolder.cpp
@@ -310,7 +310,7 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf,
LPCITEMIDLIST pidl, RE
if (!wcscmp(L"%1", wTemp)) /* icon is in the file */
{
- ILGetDisplayNameExW(psf, pidl, wTemp, 0);
+ ILGetDisplayNameExW(psf, pidl, wTemp, ILGDN_FORPARSING);
icon_idx = 0;
}