Author: gadamopoulos Date: Sun Oct 2 13:22:01 2016 New Revision: 72891
URL: http://svn.reactos.org/svn/reactos?rev=72891&view=rev Log: [SHELL32] - CNetFolder: Use the Folder class for the items shown. The same is done in shell extensions (in windows) that use the CDefaultContextMenu and want the Open and Explore verbs to be shown. This behaviour was first discovered by gigaherz when ntobjshex was tested in windows. CORE-12086
Modified: trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp trunk/reactos/dll/win32/shell32/shfldr.h trunk/reactos/dll/win32/shell32/shlfolder.cpp
Modified: trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/C... ============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp [iso-8859-1] Sun Oct 2 13:22:01 2016 @@ -417,8 +417,11 @@
if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1)) { - IContextMenu * pCm = NULL; - hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), NULL, 0, NULL, &pCm); + IContextMenu * pCm = NULL; + HKEY hkey; + UINT cKeys = 0; + AddClassKeyToArray(L"Folder", &hkey, &cKeys); + hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), NULL, cKeys, &hkey, &pCm); pObj = pCm; } else if (IsEqualIID(riid, IID_IDataObject) && (cidl >= 1))
Modified: trunk/reactos/dll/win32/shell32/shfldr.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr.h?... ============================================================================== --- trunk/reactos/dll/win32/shell32/shfldr.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shfldr.h [iso-8859-1] Sun Oct 2 13:22:01 2016 @@ -83,6 +83,8 @@ void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags); BOOL SHELL_FS_HideExtension(LPWSTR pwszPath);
+void AddClassKeyToArray(const WCHAR * szClass, HKEY* array, UINT* cKeys); + #ifdef __cplusplus
HRESULT inline SHSetStrRet(LPSTRRET pStrRet, DWORD resId)
Modified: trunk/reactos/dll/win32/shell32/shlfolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolder... ============================================================================== --- trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] Sun Oct 2 13:22:01 2016 @@ -462,6 +462,20 @@ return MAKE_COMPARE_HRESULT(ret); }
+void AddClassKeyToArray(const WCHAR * szClass, HKEY* array, UINT* cKeys) +{ + if (*cKeys >= 16) + return; + + HKEY hkey; + LSTATUS result = RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ | KEY_QUERY_VALUE, &hkey); + if (result != ERROR_SUCCESS) + return; + + array[*cKeys] = hkey; + *cKeys += 1; +} + /*********************************************************************** * SHCreateLinks *