Commit 2e5e7dbe authored by Jay Yang's avatar Jay Yang Committed by Alexandre Julliard

shell32: Have the system context menus respect idCmdFirst.

parent b56dc9a6
......@@ -46,6 +46,7 @@ typedef struct
IShellFolder* pSFParent;
LONG ref;
BOOL bDesktop;
UINT verb_offset;
} BgCmImpl;
......@@ -157,6 +158,7 @@ static HRESULT WINAPI ISVBgCm_fnQueryContextMenu(
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)
......@@ -175,7 +177,7 @@ static HRESULT WINAPI ISVBgCm_fnQueryContextMenu(
{
idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu,
idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS);
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, idMax-idCmdFirst+1);
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, idMax-idCmdFirst);
}
DestroyMenu(hMyMenu);
......@@ -358,7 +360,7 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCommand(
}
else
{
switch(LOWORD(lpcmi->lpVerb))
switch(LOWORD(lpcmi->lpVerb)-This->verb_offset)
{
case FCIDM_SHVIEW_REFRESH:
if (lpSV) IShellView_Refresh(lpSV);
......
......@@ -54,6 +54,7 @@ typedef struct
LPITEMIDLIST *apidl; /* array of child pidls */
UINT cidl;
BOOL bAllValues;
UINT verb_offset;
} ItemCmImpl;
static inline ItemCmImpl *impl_from_IContextMenu2(IContextMenu2 *iface)
......@@ -228,8 +229,7 @@ static HRESULT WINAPI ISvItemCm_fnQueryContextMenu(
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
if (idCmdFirst != 0)
FIXME("We should use idCmdFirst=%d and idCmdLast=%d for command ids\n", idCmdFirst, idCmdLast);
This->verb_offset=idCmdFirst;
if(!(CMF_DEFAULTONLY & uFlags) && This->cidl>0)
{
......@@ -262,7 +262,7 @@ static HRESULT WINAPI ISvItemCm_fnQueryContextMenu(
else
EnableMenuItem(hmenu, FCIDM_SHVIEW_RENAME, MF_BYCOMMAND | ISvItemCm_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED);
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, uIDMax);
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, uIDMax-idCmdFirst);
}
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
}
......@@ -520,7 +520,7 @@ static HRESULT WINAPI ISvItemCm_fnInvokeCommand(
if (HIWORD(lpcmi->lpVerb) == 0)
{
switch(LOWORD(lpcmi->lpVerb))
switch(LOWORD(lpcmi->lpVerb-This->verb_offset))
{
case FCIDM_SHVIEW_EXPLORE:
TRACE("Verb FCIDM_SHVIEW_EXPLORE\n");
......@@ -551,7 +551,7 @@ static HRESULT WINAPI ISvItemCm_fnInvokeCommand(
DoOpenProperties(This, lpcmi->hwnd);
break;
default:
FIXME("Unhandled Verb %xl\n",LOWORD(lpcmi->lpVerb));
FIXME("Unhandled Verb %xl\n",LOWORD(lpcmi->lpVerb)-This->verb_offset);
return E_INVALIDARG;
}
}
......@@ -595,7 +595,7 @@ static HRESULT WINAPI ISvItemCm_fnGetCommandString(
break;
case GCS_VERBA:
switch(idCommand)
switch(idCommand-This->verb_offset)
{
case FCIDM_SHVIEW_RENAME:
strcpy(lpszName, "rename");
......@@ -607,8 +607,9 @@ static HRESULT WINAPI ISvItemCm_fnGetCommandString(
/* 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)
{ case FCIDM_SHVIEW_RENAME:
switch(idCommand-This->verb_offset)
{
case FCIDM_SHVIEW_RENAME:
MultiByteToWideChar( CP_ACP, 0, "rename", -1, (LPWSTR)lpszName, uMaxNameLen );
hr = NOERROR;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment