https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8e036fe74d953faf8305d…
commit 8e036fe74d953faf8305d6db1143840038b971af
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Jan 29 22:40:40 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Jan 29 22:40:40 2023 +0900
[SHELL32] Improve StartButton context menu (#5008)
- Add uFlags argument to CDefaultContextMenu::AddShellExtensionsToMenu- CCopyToMenu,
CMoveToMenu, and CSendToMenu check the uFlags against (CMF_NOVERBS | CMF_VERBSONLY).
CORE-16544
---
dll/win32/shell32/CCopyToMenu.cpp | 3 +++
dll/win32/shell32/CDefaultContextMenu.cpp | 8 ++++----
dll/win32/shell32/CMoveToMenu.cpp | 3 +++
dll/win32/shell32/CSendToMenu.cpp | 3 +++
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dll/win32/shell32/CCopyToMenu.cpp b/dll/win32/shell32/CCopyToMenu.cpp
index e72b217945b..2206f968f7a 100644
--- a/dll/win32/shell32/CCopyToMenu.cpp
+++ b/dll/win32/shell32/CCopyToMenu.cpp
@@ -271,6 +271,9 @@ CCopyToMenu::QueryContextMenu(HMENU hMenu,
TRACE("CCopyToMenu::QueryContextMenu(%p, %u, %u, %u, %u)\n",
hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
+ if (uFlags & (CMF_NOVERBS | CMF_VERBSONLY))
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
+
m_idCmdFirst = m_idCmdLast = idCmdFirst;
// insert separator if necessary
diff --git a/dll/win32/shell32/CDefaultContextMenu.cpp
b/dll/win32/shell32/CDefaultContextMenu.cpp
index ecb456661ae..2559e6e0438 100644
--- a/dll/win32/shell32/CDefaultContextMenu.cpp
+++ b/dll/win32/shell32/CDefaultContextMenu.cpp
@@ -84,7 +84,7 @@ class CDefaultContextMenu :
BOOL IsShellExtensionAlreadyLoaded(REFCLSID clsid);
HRESULT LoadDynamicContextMenuHandler(HKEY hKey, REFCLSID clsid);
BOOL EnumerateDynamicContextHandlerForKey(HKEY hRootKey);
- UINT AddShellExtensionsToMenu(HMENU hMenu, UINT* pIndexMenu, UINT idCmdFirst,
UINT idCmdLast);
+ UINT AddShellExtensionsToMenu(HMENU hMenu, UINT* pIndexMenu, UINT idCmdFirst,
UINT idCmdLast, UINT uFlags);
UINT AddStaticContextMenusToMenu(HMENU hMenu, UINT* IndexMenu, UINT iIdCmdFirst,
UINT iIdCmdLast);
HRESULT DoPaste(LPCMINVOKECOMMANDINFOEX lpcmi, BOOL bLink);
HRESULT DoOpenOrExplore(LPCMINVOKECOMMANDINFOEX lpcmi);
@@ -417,7 +417,7 @@ CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(HKEY
hRootKey)
}
UINT
-CDefaultContextMenu::AddShellExtensionsToMenu(HMENU hMenu, UINT* pIndexMenu, UINT
idCmdFirst, UINT idCmdLast)
+CDefaultContextMenu::AddShellExtensionsToMenu(HMENU hMenu, UINT* pIndexMenu, UINT
idCmdFirst, UINT idCmdLast, UINT uFlags)
{
UINT cIds = 0;
@@ -429,7 +429,7 @@ CDefaultContextMenu::AddShellExtensionsToMenu(HMENU hMenu, UINT*
pIndexMenu, UIN
{
DynamicShellEntry& info = m_DynamicEntries.GetNext(it);
- HRESULT hr = info.pCM->QueryContextMenu(hMenu, *pIndexMenu, idCmdFirst + cIds,
idCmdLast, CMF_NORMAL);
+ HRESULT hr = info.pCM->QueryContextMenu(hMenu, *pIndexMenu, idCmdFirst + cIds,
idCmdLast, uFlags);
if (SUCCEEDED(hr))
{
info.iIdCmdFirst = cIds;
@@ -636,7 +636,7 @@ CDefaultContextMenu::QueryContextMenu(
idCmdNext = idCmdFirst + cIds;
/* Add dynamic context menu handlers */
- cIds += AddShellExtensionsToMenu(hMenu, &IndexMenu, idCmdNext, idCmdLast);
+ cIds += AddShellExtensionsToMenu(hMenu, &IndexMenu, idCmdNext, idCmdLast,
uFlags);
m_iIdSHEFirst = m_iIdSCMLast;
m_iIdSHELast = cIds;
idCmdNext = idCmdFirst + cIds;
diff --git a/dll/win32/shell32/CMoveToMenu.cpp b/dll/win32/shell32/CMoveToMenu.cpp
index c0e1c83a54d..2bcb360439b 100644
--- a/dll/win32/shell32/CMoveToMenu.cpp
+++ b/dll/win32/shell32/CMoveToMenu.cpp
@@ -270,6 +270,9 @@ CMoveToMenu::QueryContextMenu(HMENU hMenu,
TRACE("CMoveToMenu::QueryContextMenu(%p, %u, %u, %u, %u)\n",
hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
+ if (uFlags & (CMF_NOVERBS | CMF_VERBSONLY))
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
+
m_idCmdFirst = m_idCmdLast = idCmdFirst;
// insert separator if necessary
diff --git a/dll/win32/shell32/CSendToMenu.cpp b/dll/win32/shell32/CSendToMenu.cpp
index 1f8c42ef144..41db2e13d1f 100644
--- a/dll/win32/shell32/CSendToMenu.cpp
+++ b/dll/win32/shell32/CSendToMenu.cpp
@@ -295,6 +295,9 @@ CSendToMenu::QueryContextMenu(HMENU hMenu,
TRACE("%p %p %u %u %u %u\n", this,
hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
+ if (uFlags & (CMF_NOVERBS | CMF_VERBSONLY))
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
+
HMENU hSubMenu = CreateMenu();
if (!hSubMenu)
{