[2/4] shell32: context menu offset is handled by client
Daniel Jeliński
djelinski1 at gmail.com
Sat Aug 10 16:25:13 CDT 2013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130810/2ce91add/attachment.html>
-------------- next part --------------
From 808457f5019149c9638ed2186e4dc71e75a5413b Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 10 Aug 2013 19:06:33 +0200
Subject: shell32: context menu offset is handled by client
showcased by tests (added later). Looks like the author misunderstood MSDN page:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776097%28v=vs.85%29.aspx
command offset there is the difference between idCmdFirst and actual item ID, not value of idCmdFirst.
Should fix bug 8692 according to comment 14 there. I couldn't test because I couldn't find working link to test application.
---
dlls/shell32/shlview_cmenu.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 07c33d0..b7dc994 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -49,7 +49,6 @@ typedef struct
LONG ref;
IShellFolder* parent;
- UINT verb_offset;
/* item menu data */
LPITEMIDLIST pidl; /* root pidl */
@@ -138,8 +137,6 @@ static HRESULT WINAPI ItemMenu_QueryContextMenu(
TRACE("(%p)->(%p %d 0x%x 0x%x 0x%x )\n", This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
- This->verb_offset = idCmdFirst;
-
if(!(CMF_DEFAULTONLY & uFlags) && This->cidl > 0)
{
HMENU hmenures = LoadMenuW(shell32_hInstance, MAKEINTRESOURCEW(MENU_SHV_FILE));
@@ -419,7 +416,7 @@ static HRESULT WINAPI ItemMenu_InvokeCommand(
if (HIWORD(lpcmi->lpVerb) == 0)
{
- switch(LOWORD(lpcmi->lpVerb - This->verb_offset))
+ switch(LOWORD(lpcmi->lpVerb))
{
case FCIDM_SHVIEW_EXPLORE:
TRACE("Verb FCIDM_SHVIEW_EXPLORE\n");
@@ -466,7 +463,7 @@ static HRESULT WINAPI ItemMenu_InvokeCommand(
DoOpenProperties(This, lpcmi->hwnd);
break;
default:
- FIXME("Unhandled Verb %xl\n",LOWORD(lpcmi->lpVerb)-This->verb_offset);
+ FIXME("Unhandled Verb %xl\n",LOWORD(lpcmi->lpVerb));
return E_INVALIDARG;
}
}
@@ -506,7 +503,7 @@ static HRESULT WINAPI ItemMenu_GetCommandString(
break;
case GCS_VERBA:
- switch(idCommand-This->verb_offset)
+ switch(idCommand)
{
case FCIDM_SHVIEW_RENAME:
strcpy(lpszName, "rename");
@@ -518,7 +515,7 @@ static HRESULT WINAPI ItemMenu_GetCommandString(
/* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This
case, you need to do the lstrcpyW to the pointer passed.*/
case GCS_VERBW:
- switch(idCommand-This->verb_offset)
+ switch(idCommand)
{
case FCIDM_SHVIEW_RENAME:
MultiByteToWideChar( CP_ACP, 0, "rename", -1, (LPWSTR)lpszName, uMaxNameLen );
@@ -581,7 +578,6 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl;
This->ref = 1;
- This->verb_offset = 0;
This->parent = parent;
if (parent) IShellFolder_AddRef(parent);
@@ -618,8 +614,6 @@ static HRESULT WINAPI BackgroundMenu_QueryContextMenu(
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",
This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
- This->verb_offset = idCmdFirst;
-
hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002");
if (uFlags & CMF_DEFAULTONLY)
{
@@ -804,7 +798,7 @@ static HRESULT WINAPI BackgroundMenu_InvokeCommand(
}
else
{
- switch (LOWORD(lpcmi->lpVerb) - This->verb_offset)
+ switch (LOWORD(lpcmi->lpVerb))
{
case FCIDM_SHVIEW_REFRESH:
if (view) IShellView_Refresh(view);
@@ -893,7 +887,6 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl;
This->ref = 1;
This->parent = parent;
- This->verb_offset = 0;
This->pidl = NULL;
This->apidl = NULL;
--
1.8.1.2
More information about the wine-patches
mailing list