Nikolay Sivov : shell32: Respect SFGAO_NONENUMERATED attribute for registered shell extensions.
Alexandre Julliard
julliard at winehq.org
Wed Nov 30 16:56:57 CST 2016
Module: wine
Branch: master
Commit: 252051cb1b3f0fc4aade128370fb3e38d90244d2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=252051cb1b3f0fc4aade128370fb3e38d90244d2
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Nov 30 02:39:38 2016 +0300
shell32: Respect SFGAO_NONENUMERATED attribute for registered shell extensions.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shell32/shfldr_desktop.c | 75 +++++++++++++++++++++----------------------
1 file changed, 37 insertions(+), 38 deletions(-)
diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c
index 8721a9a..e4cdeb1 100644
--- a/dlls/shell32/shfldr_desktop.c
+++ b/dlls/shell32/shfldr_desktop.c
@@ -278,15 +278,44 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
return hr;
}
+static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root)
+{
+ static const WCHAR Desktop_NameSpaceW[] = { 'S','O','F','T','W','A','R','E','\\',
+ 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
+ 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
+ 'E','x','p','l','o','r','e','r','\\','D','e','s','k','t','o','p','\\',
+ 'N','a','m','e','s','p','a','c','e','\0' };
+ static const WCHAR clsidfmtW[] = {'C','L','S','I','D','\\','%','s','\\',
+ 'S','h','e','l','l','F','o','l','d','e','r',0};
+ static const WCHAR attributesW[] = {'A','t','t','r','i','b','u','t','e','s',0};
+ WCHAR guid[39], clsidkeyW[sizeof(clsidfmtW)/sizeof(*clsidfmtW) + 39];
+ DWORD size, i = 0;
+ HKEY hkey;
+
+ if (RegOpenKeyExW(root, Desktop_NameSpaceW, 0, KEY_READ, &hkey))
+ return;
+
+ size = sizeof(guid)/sizeof(guid[0]);
+ while (!RegEnumKeyExW(hkey, i++, guid, &size, 0, NULL, NULL, NULL))
+ {
+ DWORD attributes, value_size = sizeof(attributes);
+
+ /* Check if extension is configured as nonenumerable */
+ sprintfW(clsidkeyW, clsidfmtW, guid);
+ RegGetValueW(HKEY_CLASSES_ROOT, clsidkeyW, attributesW, RRF_RT_REG_DWORD | RRF_ZEROONFAILURE,
+ NULL, &attributes, &value_size);
+
+ if (!(attributes & SFGAO_NONENUMERATED))
+ AddToEnumList(list, _ILCreateGuidFromStrW(guid));
+ size = sizeof(guid)/sizeof(guid[0]);
+ }
+
+ RegCloseKey(hkey);
+}
+
/**************************************************************************
* CreateDesktopEnumList()
*/
-static const WCHAR Desktop_NameSpaceW[] = { 'S','O','F','T','W','A','R','E',
- '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
- 'o','r','e','r','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
- 'a','c','e','\0' };
-
static BOOL CreateDesktopEnumList(IEnumIDListImpl *list, DWORD dwFlags)
{
BOOL ret = TRUE;
@@ -297,39 +326,9 @@ static BOOL CreateDesktopEnumList(IEnumIDListImpl *list, DWORD dwFlags)
/* enumerate the root folders */
if (dwFlags & SHCONTF_FOLDERS)
{
- HKEY hkey;
- UINT i;
-
- /* create the pidl for This item */
ret = AddToEnumList(list, _ILCreateMyComputer());
-
- for (i=0; i<2; i++) {
- if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
- Desktop_NameSpaceW, 0, KEY_READ, &hkey))
- {
- WCHAR iid[50];
- int i=0;
-
- while (ret)
- {
- DWORD size;
- LONG r;
-
- size = sizeof (iid) / sizeof (iid[0]);
- r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
- if (ERROR_SUCCESS == r)
- {
- ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
- i++;
- }
- else if (ERROR_NO_MORE_ITEMS == r)
- break;
- else
- ret = FALSE;
- }
- RegCloseKey(hkey);
- }
- }
+ add_shell_namespace_extensions(list, HKEY_LOCAL_MACHINE);
+ add_shell_namespace_extensions(list, HKEY_CURRENT_USER);
}
/* enumerate the elements in %windir%\desktop */
More information about the wine-cvs
mailing list