shell32: Avoid pointer casts when background menu is created.
This commit is contained in:
parent
9fe57a8acf
commit
3efda60ef6
|
@ -79,7 +79,7 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []) DECLSPEC_HI
|
|||
|
||||
LPCLASSFACTORY IClassFactory_Constructor(REFCLSID) DECLSPEC_HIDDEN;
|
||||
IContextMenu2 * ItemMenu_Constructor(IShellFolder*, LPCITEMIDLIST, const LPCITEMIDLIST*, UINT) DECLSPEC_HIDDEN;
|
||||
IContextMenu2 * BackgroundMenu_Constructor(IShellFolder*, BOOL) DECLSPEC_HIDDEN;
|
||||
HRESULT BackgroundMenu_Constructor(IShellFolder*, BOOL, REFIID, void**) DECLSPEC_HIDDEN;
|
||||
LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -530,11 +530,13 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
|
|||
if (IsEqualIID (riid, &IID_IContextMenu))
|
||||
{
|
||||
if (cidl > 0)
|
||||
{
|
||||
pObj = (LPUNKNOWN) ItemMenu_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
|
||||
else
|
||||
pObj = (LPUNKNOWN) BackgroundMenu_Constructor( (IShellFolder *) iface, TRUE);
|
||||
hr = S_OK;
|
||||
}
|
||||
else
|
||||
return BackgroundMenu_Constructor((IShellFolder*)iface, TRUE, riid, ppvOut);
|
||||
}
|
||||
else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
|
||||
{
|
||||
pObj = (LPUNKNOWN) IDataObject_Constructor( hwndOwner,
|
||||
|
|
|
@ -1018,7 +1018,6 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
|
|||
BOOL fExplore = FALSE;
|
||||
HWND hwndTree = 0;
|
||||
LPCONTEXTMENU pContextMenu = NULL;
|
||||
IContextMenu2 *pCM = NULL;
|
||||
CMINVOKECOMMANDINFO cmi;
|
||||
|
||||
TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
|
||||
|
@ -1093,9 +1092,11 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
|
|||
}
|
||||
else /* background context menu */
|
||||
{
|
||||
IContextMenu2 *pCM;
|
||||
|
||||
hMenu = CreatePopupMenu();
|
||||
|
||||
pCM = BackgroundMenu_Constructor(This->pSFParent, FALSE);
|
||||
BackgroundMenu_Constructor(This->pSFParent, FALSE, &IID_IContextMenu2, (void**)&pCM);
|
||||
IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
|
||||
|
||||
uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
|
||||
|
@ -2049,10 +2050,7 @@ static HRESULT WINAPI IShellView_fnGetItemObject(IShellView2 *iface, UINT uItem,
|
|||
case SVGIO_BACKGROUND:
|
||||
|
||||
if (IsEqualIID(&IID_IContextMenu, riid))
|
||||
{
|
||||
*ppvOut = BackgroundMenu_Constructor(This->pSFParent, FALSE);
|
||||
hr = S_OK;
|
||||
}
|
||||
return BackgroundMenu_Constructor(This->pSFParent, FALSE, riid, ppvOut);
|
||||
else
|
||||
FIXME("unsupported interface requested %s\n", debugstr_guid(riid));
|
||||
|
||||
|
|
|
@ -877,11 +877,14 @@ static const IContextMenu3Vtbl BackgroundContextMenuVtbl =
|
|||
ContextMenu_HandleMenuMsg2
|
||||
};
|
||||
|
||||
IContextMenu2 *BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop)
|
||||
HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID riid, void **pObj)
|
||||
{
|
||||
ContextMenu *This;
|
||||
HRESULT hr;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
|
||||
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl;
|
||||
This->ref = 1;
|
||||
This->parent = parent;
|
||||
|
@ -895,6 +898,8 @@ IContextMenu2 *BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop)
|
|||
This->desktop = desktop;
|
||||
if (parent) IShellFolder_AddRef(parent);
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
return (IContextMenu2*)&This->IContextMenu3_iface;
|
||||
hr = IContextMenu3_QueryInterface(&This->IContextMenu3_iface, riid, pObj);
|
||||
IContextMenu3_Release(&This->IContextMenu3_iface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue