[SHELL32] Get PerceivedType default icon (#8627)

Related to #8626. Display the correct icon.
JIRA issue: CORE-19355
- Modify CFSExtractIcon_CreateInstance function to load
  PerceivedType default icon.
This commit is contained in:
Katayama Hirofumi MZ
2026-01-24 10:08:02 +09:00
committed by GitHub
parent 69f10f6d38
commit efca5040cb

View File

@@ -346,7 +346,17 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
LPCWSTR pExtension = ExtensionFromPidl(pidl, extbuf, _countof(extbuf));
HKEY hkey = pExtension ? OpenKeyFromFileType(pExtension, L"DefaultIcon") : NULL;
if (!hkey)
WARN("Could not open DefaultIcon key!\n");
{
DWORD dwSize = sizeof(wTemp);
if (RegGetValueW(HKEY_CLASSES_ROOT, pExtension, L"PerceivedType", RRF_RT_REG_SZ, NULL,
wTemp, &dwSize) == ERROR_SUCCESS)
{
WCHAR szSubKey[MAX_PATH];
StringCchPrintfW(szSubKey, _countof(szSubKey),
L"SystemFileAssociations\\%s\\DefaultIcon", wTemp);
RegOpenKeyExW(HKEY_CLASSES_ROOT, szSubKey, 0, KEY_READ, &hkey);
}
}
DWORD dwSize = sizeof(wTemp);
if (hkey && !SHQueryValueExW(hkey, NULL, NULL, NULL, wTemp, &dwSize))