https://git.reactos.org/?p=reactos.git;a=commitdiff;h=67f99833cdb861a11720a…
commit 67f99833cdb861a11720ad03685b439b599e3233
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Thu Feb 15 00:58:22 2018 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Thu Feb 15 00:58:22 2018 +0200
[SHELL32] CNewMenu: Don't use CWM_GETISHELLBROWSER.
CDefaultContextMenu: Set the site for context menu extensions
CNewMenu: Get SID_IFolderView service of the site to get the IShellView
---
dll/win32/shell32/CDefaultContextMenu.cpp | 3 +++
dll/win32/shell32/CNewMenu.cpp | 21 +++++++++------------
dll/win32/shell32/CNewMenu.h | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dll/win32/shell32/CDefaultContextMenu.cpp
b/dll/win32/shell32/CDefaultContextMenu.cpp
index dcb754bd96..0834995abd 100644
--- a/dll/win32/shell32/CDefaultContextMenu.cpp
+++ b/dll/win32/shell32/CDefaultContextMenu.cpp
@@ -376,6 +376,9 @@ CDefaultContextMenu::LoadDynamicContextMenuHandler(HKEY hKey, const
CLSID *pclsi
return hr;
}
+ if (m_site)
+ IUnknown_SetSite(pcm, m_site);
+
PDynamicShellEntry pEntry = (DynamicShellEntry *)HeapAlloc(GetProcessHeap(), 0,
sizeof(DynamicShellEntry));
if (!pEntry)
return E_OUTOFMEMORY;
diff --git a/dll/win32/shell32/CNewMenu.cpp b/dll/win32/shell32/CNewMenu.cpp
index 8dd1d86f74..4a17e9b58b 100644
--- a/dll/win32/shell32/CNewMenu.cpp
+++ b/dll/win32/shell32/CNewMenu.cpp
@@ -404,7 +404,7 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::FindItemFromIdOffset(UINT
IdOffset)
return pItem;
}
-HRESULT CNewMenu::SelectNewItem(LPCMINVOKECOMMANDINFO lpici, LONG wEventId, UINT uFlags,
LPWSTR pszName)
+HRESULT CNewMenu::SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName)
{
CComPtr<IShellBrowser> lpSB;
CComPtr<IShellView> lpSV;
@@ -415,16 +415,13 @@ HRESULT CNewMenu::SelectNewItem(LPCMINVOKECOMMANDINFO lpici, LONG
wEventId, UINT
/* Notify the view object about the new item */
SHChangeNotify(wEventId, uFlags, (LPCVOID) pszName, NULL);
- /* FIXME: I think that this can be implemented using callbacks to the shell folder
*/
+ if (!m_pSite)
+ return S_OK;
- /* Note: CWM_GETISHELLBROWSER returns shell browser without adding reference */
- lpSB = (LPSHELLBROWSER)SendMessageA(lpici->hwnd, CWM_GETISHELLBROWSER, 0, 0);
- if (!lpSB)
- return E_FAIL;
-
- hr = lpSB->QueryActiveShellView(&lpSV);
- if (FAILED(hr))
- return hr;
+ /* Get a pointer to the shell view */
+ hr = IUnknown_QueryService(m_pSite, SID_IFolderView, IID_PPV_ARG(IShellView,
&lpSV));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return S_OK;
/* Attempt to get the pidl of the new item */
hr = SHILCreateFromPathW(pszName, &pidl, NULL);
@@ -466,7 +463,7 @@ HRESULT CNewMenu::CreateNewFolder(LPCMINVOKECOMMANDINFO lpici)
return E_FAIL;
/* Show and select the new item in the def view */
- SelectNewItem(lpici, SHCNE_MKDIR, SHCNF_PATHW, wszName);
+ SelectNewItem(SHCNE_MKDIR, SHCNF_PATHW, wszName);
return S_OK;
}
@@ -572,7 +569,7 @@ HRESULT CNewMenu::CreateNewItem(SHELLNEW_ITEM *pItem,
LPCMINVOKECOMMANDINFO lpcm
if (bSuccess)
{
TRACE("Notifying fs %s\n", debugstr_w(wszName));
- SelectNewItem(lpcmi, SHCNE_CREATE, SHCNF_PATHW, wszName);
+ SelectNewItem(SHCNE_CREATE, SHCNF_PATHW, wszName);
}
else
{
diff --git a/dll/win32/shell32/CNewMenu.h b/dll/win32/shell32/CNewMenu.h
index 2d2c52a355..2475e725a9 100644
--- a/dll/win32/shell32/CNewMenu.h
+++ b/dll/win32/shell32/CNewMenu.h
@@ -71,7 +71,7 @@ private:
SHELLNEW_ITEM *FindItemFromIdOffset(UINT IdOffset);
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici);
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi);
- HRESULT SelectNewItem(LPCMINVOKECOMMANDINFO lpici, LONG wEventId, UINT uFlags, LPWSTR
pszName);
+ HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName);
public:
CNewMenu();