[SHELL32] Set default exe icon (#2076)

The default icon of an exe file was empty if no icon available from exe.
CORE-10480
This commit is contained in:
Katayama Hirofumi MZ
2019-11-24 19:26:32 +09:00
committed by GitHub
parent db5a2fff5d
commit 399854ce31
2 changed files with 16 additions and 1 deletions

View File

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