[PATCH] shell32: Use IS_INTRESOURCE() to test context menu verb kind

Nikolay Sivov nsivov at codeweavers.com
Thu Jun 8 18:36:16 CDT 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/shell32/shlmenu.c       | 25 ++++++++++++++-----------
 dlls/shell32/shlview_cmenu.c |  6 +++---
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c
index 7a960ad5c8..39ab4c618c 100644
--- a/dlls/shell32/shlmenu.c
+++ b/dlls/shell32/shlmenu.c
@@ -1114,25 +1114,28 @@ static HRESULT WINAPI CompositeCMenu_GetCommandString(IContextMenu3* iface, UINT
 static HRESULT WINAPI CompositeCMenu_InvokeCommand(IContextMenu3* iface,LPCMINVOKECOMMANDINFO pici)
 {
     CompositeCMenu *This = impl_from_IContextMenu3(iface);
-    TRACE("(%p)->(%p)\n",iface,pici);
-    if(HIWORD(pici->lpVerb))
+
+    TRACE("(%p)->(%p)\n", iface, pici);
+
+    if (IS_INTRESOURCE(pici->lpVerb))
+    {
+        UINT id = (UINT_PTR)pici->lpVerb;
+        UINT index = CompositeCMenu_GetIndexForCommandId(This, id);
+        return IContextMenu_InvokeCommand(This->menus[index], pici);
+    }
+    else
     {
         /*call each handler until one of them succeeds*/
-        UINT i=0;
-        for(;i<This->menu_count;i++)
+        UINT i;
+
+        for (i = 0; i < This->menu_count; i++)
         {
             HRESULT hres;
-            if(SUCCEEDED(hres=IContextMenu_InvokeCommand(This->menus[i],pici)))
+            if (SUCCEEDED(hres = IContextMenu_InvokeCommand(This->menus[i], pici)))
                 return hres;
         }
         return E_FAIL;
     }
-    else
-    {
-        UINT id = (UINT_PTR)pici->lpVerb;
-        UINT index = CompositeCMenu_GetIndexForCommandId(This,id);
-        return IContextMenu_InvokeCommand(This->menus[index],pici);
-    }
 }
 
 static HRESULT WINAPI CompositeCMenu_QueryContextMenu(IContextMenu3 *iface, HMENU hmenu,UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 099f5bc4ad..5c5ba1b002 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -397,13 +397,13 @@ static HRESULT WINAPI ItemMenu_InvokeCommand(
 
     TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd);
 
-    if( HIWORD(lpcmi->lpVerb)==0 && LOWORD(lpcmi->lpVerb) > FCIDM_SHVIEWLAST)
+    if (IS_INTRESOURCE(lpcmi->lpVerb) && LOWORD(lpcmi->lpVerb) > FCIDM_SHVIEWLAST)
     {
-        TRACE("Invalid Verb %x\n",LOWORD(lpcmi->lpVerb));
+        TRACE("Invalid Verb %x\n", LOWORD(lpcmi->lpVerb));
         return E_INVALIDARG;
     }
 
-    if (HIWORD(lpcmi->lpVerb) == 0)
+    if (IS_INTRESOURCE(lpcmi->lpVerb))
     {
         switch(LOWORD(lpcmi->lpVerb))
         {
-- 
2.11.0




More information about the wine-patches mailing list