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