From 9342ed43d9a083efb9008118bc12d9fb9bc98d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 19 May 2026 22:31:45 +0200 Subject: [PATCH] [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). --- dll/win32/shell32/folders/CDrivesFolder.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dll/win32/shell32/folders/CDrivesFolder.cpp b/dll/win32/shell32/folders/CDrivesFolder.cpp index 6d7345f928f..7d288b730c4 100644 --- a/dll/win32/shell32/folders/CDrivesFolder.cpp +++ b/dll/win32/shell32/folders/CDrivesFolder.cpp @@ -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); } /***********************************************************************