Skip to content

Commit efca504

Browse files
authored
[SHELL32] Get PerceivedType default icon (reactos#8627)
Related to reactos#8626. Display the correct icon. JIRA issue: CORE-19355 - Modify CFSExtractIcon_CreateInstance function to load PerceivedType default icon.
1 parent 69f10f6 commit efca504

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dll/win32/shell32/folders/CFSFolder.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,17 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
346346
LPCWSTR pExtension = ExtensionFromPidl(pidl, extbuf, _countof(extbuf));
347347
HKEY hkey = pExtension ? OpenKeyFromFileType(pExtension, L"DefaultIcon") : NULL;
348348
if (!hkey)
349-
WARN("Could not open DefaultIcon key!\n");
349+
{
350+
DWORD dwSize = sizeof(wTemp);
351+
if (RegGetValueW(HKEY_CLASSES_ROOT, pExtension, L"PerceivedType", RRF_RT_REG_SZ, NULL,
352+
wTemp, &dwSize) == ERROR_SUCCESS)
353+
{
354+
WCHAR szSubKey[MAX_PATH];
355+
StringCchPrintfW(szSubKey, _countof(szSubKey),
356+
L"SystemFileAssociations\\%s\\DefaultIcon", wTemp);
357+
RegOpenKeyExW(HKEY_CLASSES_ROOT, szSubKey, 0, KEY_READ, &hkey);
358+
}
359+
}
350360

351361
DWORD dwSize = sizeof(wTemp);
352362
if (hkey && !SHQueryValueExW(hkey, NULL, NULL, NULL, wTemp, &dwSize))

0 commit comments

Comments
 (0)