[EXPLORER] Fix Start Menu context menu actions (#4643)
authorKyle Katarn <contact@kcsoftwares.com>
Fri, 9 Sep 2022 18:23:11 +0000 (20:23 +0200)
committerGitHub <noreply@github.com>
Fri, 9 Sep 2022 18:23:11 +0000 (20:23 +0200)
CORE-18336

The current design was not processing actions verbs correctly for some
Start Menu context menu actions (Properties, Open all users, Explore all users),
despite associated code being implemented.
This was due by incorrectly filtering command IDs, not routing to the appropriate processing.

base/shell/explorer/startctxmnu.cpp

index a404cb4..935c8d7 100644 (file)
@@ -32,6 +32,7 @@ class CStartMenuBtnCtxMenu :
     CComPtr<ITrayWindow>  m_TrayWnd;
     CComPtr<IContextMenu> m_Inner;
     CComPtr<IShellFolder> m_Folder;
+    UINT m_idCmdCmLast;
 
     HWND m_Owner;
     LPITEMIDLIST m_FolderPidl;
@@ -167,7 +168,8 @@ public:
                     hRet = psfDesktop->BindToObject(pidlStart, NULL, IID_PPV_ARG(IShellFolder, &m_Folder));
                     if (SUCCEEDED(hRet))
                     {
-                        CreateContextMenuFromShellFolderPidl(hPopup);
+                        hRet = CreateContextMenuFromShellFolderPidl(hPopup);
+                        m_idCmdCmLast = (SUCCEEDED(hRet)) ? HRESULT_CODE(hRet) : ID_SHELL_CMD_LAST;
                         AddStartContextMenuItems(hPopup);
                     }
                 }
@@ -185,7 +187,7 @@ public:
         UINT uiCmdId = PtrToUlong(lpici->lpVerb);
         if (uiCmdId != 0)
         {
-            if ((uiCmdId >= ID_SHELL_CMD_FIRST) && (uiCmdId <= ID_SHELL_CMD_LAST))
+            if ((uiCmdId >= ID_SHELL_CMD_FIRST) && (uiCmdId < m_idCmdCmLast))
             {
                 CMINVOKECOMMANDINFO cmici = { 0 };
                 CHAR szDir[MAX_PATH];
@@ -224,6 +226,7 @@ public:
 
     CStartMenuBtnCtxMenu()
     {
+        m_idCmdCmLast = ID_SHELL_CMD_LAST;
     }
 
     virtual ~CStartMenuBtnCtxMenu()