Author: dquintana
Date: Wed Mar 5 13:14:51 2014
New Revision: 62432
URL:
http://svn.reactos.org/svn/reactos?rev=62432&view=rev
Log:
[RSHELL]
* CMenuSite: Reworked the code to avoid SHIsSameObject, since newer versions of windows do
not implement that function. The code should be equivalent, and does less unnecessary
calls to QueryInterface.
CORE-7879
Modified:
branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] Wed Mar 5
13:14:51 2014
@@ -103,7 +103,11 @@
#define TO_HRESULT(x) ((HRESULT)(S_OK+(x)))
- if (SHIsSameObject(punk, m_BandObject))
+ CComPtr<IUnknown> pUnknown;
+
+ punk->QueryInterface(IID_PPV_ARG(IUnknown, &pUnknown));
+
+ if (pUnknown == m_BandObject)
return TO_HRESULT(0);
if (m_BandObject)
@@ -118,28 +122,26 @@
m_WinEventHandler = NULL;
m_hWndBand = NULL;
- if (!punk)
+ if (!pUnknown)
return TO_HRESULT(0);
- hr = punk->QueryInterface(IID_PPV_ARG(IDeskBand, &m_DeskBand));
+ hr = pUnknown->QueryInterface(IID_PPV_ARG(IDeskBand, &m_DeskBand));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- hr = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_WinEventHandler));
+ hr = pUnknown->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&m_WinEventHandler));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- hr = IUnknown_SetSite(punk, this->ToIUnknown());
+ hr = IUnknown_SetSite(pUnknown, this->ToIUnknown());
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- hr = IUnknown_GetWindow(punk, &m_hWndBand);
+ hr = IUnknown_GetWindow(pUnknown, &m_hWndBand);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- m_BandObject = punk;
-
- punk->AddRef();
+ m_BandObject = pUnknown;
return TO_HRESULT(0);
}