[SHELL32] Better determine whether to hide or show shell-folder namespace items (#9046)

In `SHELL32_IsShellFolderNamespaceItemHidden()`, use `SHRegGetBoolUSValue()`
to look at both `HKEY_CURRENT_USER` with fallback to `HKEY_LOCAL_MACHINE`,
when searching for the registry value that determines whether a shell-folder
namespace item is to be hidden or shown.

Behaviour confirmed on Windows 2003.

Addendum to commit 6ae11ba09d (PR #7189).
This commit is contained in:
Hermès Bélusca-Maïto
2026-05-19 22:31:45 +02:00
parent 242937b122
commit 9342ed43d9

View File

@@ -186,14 +186,17 @@ bool SHELL_CanInvokeAutoRunOnDrive(PCWSTR DrvPath)
}
#endif
/**
* @brief
* Returns true if the item should be hidden in DefView but not in the Explorer folder tree.
**/
BOOL SHELL32_IsShellFolderNamespaceItemHidden(LPCWSTR SubKey, REFCLSID Clsid)
{
// If this function returns true, the item should be hidden in DefView but not in the Explorer folder tree.
WCHAR path[MAX_PATH], name[CHARS_IN_GUID];
wsprintfW(path, L"%s\\%s", REGSTR_PATH_EXPLORER, SubKey);
SHELL32_GUIDToStringW(Clsid, name);
DWORD data = 0, size = sizeof(data);
return !RegGetValueW(HKEY_CURRENT_USER, path, name, RRF_RT_DWORD, NULL, &data, &size) && data;
// Check the value in both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE
return SHRegGetBoolUSValue(path, name, FALSE, FALSE);
}
/***********************************************************************