diff --git a/reactos/dll/win32/shell32/shv_bg_cmenu.c b/reactos/dll/win32/shell32/shv_bg_cmenu.c index a6881fff31c..d5a4ff8afd7 100644 --- a/reactos/dll/win32/shell32/shv_bg_cmenu.c +++ b/reactos/dll/win32/shell32/shv_bg_cmenu.c @@ -170,6 +170,8 @@ static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface) * ISVBgCm_fnQueryContextMenu() */ +VOID INewItem_SetParent(LPSHELLFOLDER pSFParent); /* FIXME: remove that, shouldn't be needed */ + static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( IContextMenu2 *iface, HMENU hMenu, @@ -225,8 +227,7 @@ static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( * FIXME * load other shell extensions */ -#if 0 - if (SUCCEEDED(INewItem_Constructor(This->pSFParent, &IID_IContextMenu2, (LPVOID*)&icm))) + if (SUCCEEDED(INewItem_Constructor(NULL, &IID_IContextMenu2, (LPVOID*)&icm))) { if (SUCCEEDED(IContextMenu_QueryContextMenu(icm, hMenu, 10, idCmdFirst, idCmdLast, uFlags))) { @@ -238,7 +239,10 @@ static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( This->icm_new = NULL; } } -#endif + + /* Prepare 'New item' shell extension */ + /* FIXME: shouldn't be needed... */ + INewItem_SetParent(This->pSFParent); if (This->bDesktop) { diff --git a/reactos/dll/win32/shell32/shv_item_new.c b/reactos/dll/win32/shell32/shv_item_new.c index cf0eecb1c0e..c49c8ac4468 100644 --- a/reactos/dll/win32/shell32/shv_item_new.c +++ b/reactos/dll/win32/shell32/shv_item_new.c @@ -756,8 +756,8 @@ INewItem_IContextMenu_fnHandleMenuMsg(IContextMenu2 *iface, LPARAM lParam) { INewMenuImpl *This = impl_from_IContextMenu(iface); - DRAWITEMSTRUCT * lpids = (DRAWITEMSTRUCT*) lParam; - MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*) lParam; + //DRAWITEMSTRUCT * lpids = (DRAWITEMSTRUCT*) lParam; + //MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*) lParam; TRACE("INewItem_IContextMenu_fnHandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n",This, uMsg, wParam, lParam); @@ -789,11 +789,11 @@ static const IContextMenu2Vtbl cmvt = INewItem_IContextMenu_fnHandleMenuMsg }; +static INewMenuImpl *cached_ow; HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv) { INewMenuImpl * ow; HRESULT res; - static INewMenuImpl *cached_ow; if (!cached_ow) { @@ -814,13 +814,17 @@ HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *p } TRACE("(%p)->()\n",cached_ow); - if (cached_ow->pSFParent) - { - IShellFolder_Release(cached_ow->pSFParent); - } - // cached_ow->pSFParent = pSFParent; - // IShellFolder_AddRef(pSFParent); res = INewItem_fnQueryInterface( cached_ow, riid, ppv ); return res; } + +VOID INewItem_SetParent(LPSHELLFOLDER pSFParent) +{ + if (cached_ow->pSFParent) + { + IShellFolder_Release(cached_ow->pSFParent); + } + cached_ow->pSFParent = pSFParent; + IShellFolder_AddRef(pSFParent); +}