Author: dquintana
Date: Wed Feb 26 14:05:55 2014
New Revision: 62335
URL:
http://svn.reactos.org/svn/reactos?rev=62335&view=rev
Log:
[RSHELL]
* Add a new logging wrapper to record calls from the start menu back to the explorer
site.
CORE-7586
Added:
branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp (with
props)
Modified:
branches/shell-experiments/base/shell/rshell/CMakeLists.txt
branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp
branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp
branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/base/shell/rshell/wraplog.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMakeLists.txt [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMakeLists.txt [iso-8859-1] Wed Feb 26
14:05:55 2014
@@ -20,6 +20,7 @@
logging/CMenuBandWrap.cpp
logging/CMenuDeskBarWrap.cpp
logging/CMenuSiteWrap.cpp
+ logging/CStartMenuSiteWrap.cpp
${CMAKE_CURRENT_BINARY_DIR}/rshell.def)
add_library(rshell SHARED ${SOURCE})
Modified: branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp [iso-8859-1]
Wed Feb 26 14:05:55 2014
@@ -23,7 +23,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(CMenuBandWrap);
class CMenuBandWrap :
- public CComCoClass<CMenuBandWrap>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IDeskBand,
public IObjectWithSite,
Modified: branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp [iso-8859-1]
Wed Feb 26 14:05:55 2014
@@ -21,7 +21,6 @@
#include "wraplog.h"
class CMenuDeskBarWrap :
- public CComCoClass<CMenuDeskBarWrap>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IOleCommandTarget,
public IServiceProvider,
@@ -216,6 +215,24 @@
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSite(IUnknown *pUnkSite)
{
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSite(IUnknown
*pUnkSite=%p)\n", this, pUnkSite);
+
+#if WRAP_TRAYPRIV
+ CComPtr<ITrayPriv> inTp;
+ HRESULT hr2 = pUnkSite->QueryInterface(IID_PPV_ARG(ITrayPriv, &inTp));
+ if (SUCCEEDED(hr2))
+ {
+ ITrayPriv * outTp;
+ hr2 = CStartMenuSite_Wrapper(inTp, IID_PPV_ARG(ITrayPriv, &outTp));
+ if (SUCCEEDED(hr2))
+ {
+ pUnkSite = outTp;
+ }
+ else
+ {
+ outTp->Release();
+ }
+ }
+#endif
HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite);
WrapLogExit("CMenuDeskBarWrap::SetSite()", hr);
return hr;
Modified: branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp [iso-8859-1]
Wed Feb 26 14:05:55 2014
@@ -24,7 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(menusite);
class CMenuSiteWrap :
- public CComCoClass<CMenuSiteWrap>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IBandSite,
public IDeskBarClient,
Added: branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp (added)
+++
branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp [iso-8859-1]
Wed Feb 26 14:05:55 2014
@@ -0,0 +1,190 @@
+/*
+ * Shell Menu Site
+ *
+ * Copyright 2014 David Quintana
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "precomp.h"
+#include "wraplog.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(menusite);
+
+class CStartMenuSiteWrap :
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IServiceProvider,
+ public ITrayPriv,
+ public IOleWindow,
+ public IOleCommandTarget
+{
+public:
+ CStartMenuSiteWrap() {}
+ ~CStartMenuSiteWrap();
+
+ HRESULT InitWrap(ITrayPriv * bandSite);
+
+private:
+ CComPtr<IServiceProvider > m_IServiceProvider;
+ CComPtr<ITrayPriv > m_ITrayPriv;
+ CComPtr<IOleWindow > m_IOleWindow;
+ CComPtr<IOleCommandTarget> m_IOleCommandTarget;
+
+public:
+ // IServiceProvider
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void
**ppvObject);
+
+ // ITrayPriv
+ virtual HRESULT STDMETHODCALLTYPE Execute(THIS_ IShellFolder*, LPCITEMIDLIST);
+ virtual HRESULT STDMETHODCALLTYPE Unknown(THIS_ PVOID, PVOID, PVOID, PVOID);
+ virtual HRESULT STDMETHODCALLTYPE AppendMenu(THIS_ HMENU*);
+
+ // IOleWindow
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // IOleCommandTarget
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID * pguidCmdGroup, ULONG
cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID * pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ DECLARE_NOT_AGGREGATABLE(CStartMenuSiteWrap)
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
+ BEGIN_COM_MAP(CStartMenuSiteWrap)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_ITrayPriv, ITrayPriv)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ END_COM_MAP()
+};
+
+extern "C"
+HRESULT CStartMenuSite_Wrapper(ITrayPriv * trayPriv, REFIID riid, LPVOID *ppv)
+{
+ HRESULT hr;
+
+ *ppv = NULL;
+
+ CStartMenuSiteWrap * site = new CComObject<CStartMenuSiteWrap>();
+
+ if (!site)
+ return E_OUTOFMEMORY;
+
+ hr = site->InitWrap(trayPriv);
+ if (FAILED(hr))
+ {
+ site->Release();
+ return hr;
+ }
+
+ hr = site->QueryInterface(riid, ppv);
+
+ if (FAILED(hr))
+ site->Release();
+
+ return hr;
+}
+
+HRESULT CStartMenuSiteWrap::InitWrap(ITrayPriv * bandSite)
+{
+ HRESULT hr;
+
+ WrapLogOpen();
+
+ m_ITrayPriv = bandSite;
+
+ hr = bandSite->QueryInterface(IID_PPV_ARG(IServiceProvider,
&m_IServiceProvider));
+ if (FAILED(hr)) return hr;
+ hr = bandSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
+ if (FAILED(hr)) return hr;
+ hr = bandSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&m_IOleCommandTarget));
+ return hr;
+}
+
+CStartMenuSiteWrap::~CStartMenuSiteWrap()
+{
+ WrapLogClose();
+}
+
+// *** IServiceProvider methods ***
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::QueryService(REFGUID guidService, REFIID
riid, void **ppvObject)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::QueryService(REFGUID guidService=%s,
REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid),
ppvObject);
+ HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
+ if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
+ WrapLogExit("CStartMenuSiteWrap::QueryService()", hr);
+ return hr;
+}
+
+// *** ITrayPriv methods ***
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::Execute(IShellFolder* psf, LPCITEMIDLIST
pidl)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::Execute(IShellFolder* psf=%p,
LPCITEMIDLIST pidl=%p)\n", this, psf, pidl);
+ HRESULT hr = m_ITrayPriv->Execute(psf, pidl);
+ WrapLogExit("CStartMenuSiteWrap::Execute()", hr);
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::Unknown(PVOID unk1, PVOID unk2, PVOID unk3,
PVOID unk4)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::Unknown(PVOID unk1=%p, PVOID
unk2=%p, PVOID unk3=%p, PVOID unk4=%p)\n", this, unk1, unk2, unk3, unk4);
+ HRESULT hr = m_ITrayPriv->Unknown(unk1, unk2, unk3, unk4);
+ WrapLogExit("CStartMenuSiteWrap::Unknown()", hr);
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::AppendMenu(HMENU * phmenu)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::AppendMenu(HMENU *
phmenu=%p)\n", this, phmenu);
+ HRESULT hr = m_ITrayPriv->AppendMenu(phmenu);
+ WrapLogExit("CStartMenuSiteWrap::AppendMenu()", hr);
+ return hr;
+}
+
+// *** IOleWindow methods ***
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::GetWindow(HWND *phwnd)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::GetWindow(HWND *phwnd=%p)\n",
this, phwnd);
+ HRESULT hr = m_IOleWindow->GetWindow(phwnd);
+ if (phwnd) WrapLogPost("*phwnd=%p\n", *phwnd);
+ WrapLogExit("CStartMenuSiteWrap::GetWindow()", hr);
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::ContextSensitiveHelp(BOOL
fEnterMode=%d)\n", this, fEnterMode);
+ HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
+ WrapLogExit("CStartMenuSiteWrap::ContextSensitiveHelp()", hr);
+ return hr;
+}
+
+// *** IOleCommandTarget methods ***
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::QueryStatus(const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::QueryStatus(const GUID
*pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup,
cCmds, prgCmds, pCmdText);
+ HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds,
pCmdText);
+ if (pguidCmdGroup) WrapLogPost("*pguidCmdGroup=%s\n",
Wrap(*pguidCmdGroup));
+ WrapLogExit("CStartMenuSiteWrap::QueryStatus()", hr);
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::Exec(const GUID *pguidCmdGroup, DWORD
nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ WrapLogEnter("CStartMenuSiteWrap<%p>::Exec(const GUID *pguidCmdGroup=%p,
DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n",
this, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
+ if (pguidCmdGroup) WrapLogPre("*pguidCmdGroup=%s\n",
Wrap(*pguidCmdGroup));
+ HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn,
pvaOut);
+ WrapLogExit("CStartMenuSiteWrap::Exec()", hr);
+ return hr;
+}
Propchange: branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/shell-experiments/base/shell/rshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] Wed Feb 26
14:05:55 2014
@@ -6,6 +6,7 @@
#define WRAP_MENUDESKBAR 0
#define WRAP_MENUSITE 0
#define WRAP_MENUBAND 0
+#define WRAP_TRAYPRIV 0
#define MERGE_FOLDERS 0
@@ -47,6 +48,7 @@
extern "C" HRESULT CMenuSite_Wrapper(IBandSite * bs, REFIID riid, LPVOID
*ppv);
extern "C" HRESULT CMenuBand_Wrapper(IShellMenu * sm, REFIID riid, LPVOID
*ppv);
extern "C" HRESULT CMergedFolder_Constructor(IShellFolder* userLocal,
IShellFolder* allUsers, REFIID riid, LPVOID *ppv);
+extern "C" HRESULT CStartMenuSite_Wrapper(ITrayPriv * trayPriv, REFIID riid,
LPVOID *ppv);
static __inline ULONG
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
Modified: branches/shell-experiments/base/shell/rshell/wraplog.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/wraplog.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/wraplog.cpp [iso-8859-1] Wed Feb 26
14:05:55 2014
@@ -13,7 +13,7 @@
{
if (openCount == 0)
{
- log = fopen("\\RShellWrap.log", "w");
+ log = fopen("G:\\RShellWrap.log", "w");
nTemps = 0;
callLevel = 0;
}