ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
464 discussions
Start a n
N
ew thread
[dquintana] 62252: [RSHELL] * Separate logger wrappers from the actual implementations. * Fix some warnings. CORE-7586
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Feb 19 00:20:45 2014 New Revision: 62252 URL:
http://svn.reactos.org/svn/reactos?rev=62252&view=rev
Log: [RSHELL] * Separate logger wrappers from the actual implementations. * Fix some warnings. CORE-7586 Added: branches/shell-experiments/base/shell/rshell/logging/ (with props) branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp (with props) branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp (with props) Modified: branches/shell-experiments/base/shell/rshell/CMakeLists.txt branches/shell-experiments/base/shell/rshell/CMenuBand.cpp branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp branches/shell-experiments/base/shell/rshell/CStartMenu.cpp branches/shell-experiments/base/shell/rshell/precomp.h 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 19 00:20:45 2014 @@ -14,6 +14,8 @@ CStartMenu.cpp misc.cpp wraplog.cpp + logging/CMenuBandWrap.cpp + logging/CMenuDeskBarWrap.cpp ${CMAKE_CURRENT_BINARY_DIR}/rshell.def) add_library(rshell SHARED ${SOURCE}) Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Wed Feb 19 00:20:45 2014 @@ -18,12 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "precomp.h" -#include "wraplog.h" #include <windowsx.h> WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand); - -#define WRAP_LOG 0 #define TBSTYLE_EX_VERTICAL 4 @@ -135,25 +132,6 @@ ~CMenuBand(); private: -#if WRAP_LOG - IUnknown * m_IUnknown; - IDeskBand * m_IDeskBand; - IDockingWindow * m_IDockingWindow; - IOleWindow * m_IOleWindow; - IObjectWithSite * m_IObjectWithSite; - IInputObject * m_IInputObject; - IPersistStream * m_IPersistStream; - IPersist * m_IPersist; - IOleCommandTarget * m_IOleCommandTarget; - IServiceProvider * m_IServiceProvider; - IMenuPopup * m_IMenuPopup; - IDeskBar * m_IDeskBar; - IMenuBand * m_IMenuBand; - IShellMenu2 * m_IShellMenu2; - IShellMenu * m_IShellMenu; - IWinEventHandler * m_IWinEventHandler; - IShellMenuAcc * m_IShellMenuAcc; -#else IOleWindow *m_site; IShellMenuCallback *m_psmc; @@ -166,7 +144,6 @@ PVOID m_UserData; HMENU m_hmenu; HWND m_menuOwner; -#endif BOOL m_useBigIcons; @@ -256,7 +233,7 @@ HRESULT CallCBWithId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam); HRESULT CallCBWithPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM lParam); - HRESULT TrackPopup(HMENU popup, INT x, INT y, RECT& rc); + HRESULT TrackPopup(HMENU popup, INT x, INT y); BOOL UseBigIcons() { return m_useBigIcons; @@ -306,555 +283,6 @@ return hr; } - -#if WRAP_LOG -CMenuBand::CMenuBand() -{ - HRESULT hr; - WrapLogOpen(); - - hr = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IShellMenu, &m_IShellMenu)); - hr = m_IShellMenu->QueryInterface(IID_PPV_ARG(IUnknown, &m_IUnknown)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBand, &m_IDeskBand)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IDockingWindow, &m_IDockingWindow)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IPersistStream, &m_IPersistStream)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IPersist, &m_IPersist)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IMenuBand, &m_IMenuBand)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IShellMenu2, &m_IShellMenu2)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_IWinEventHandler)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IShellMenuAcc, &m_IShellMenuAcc)); -} - -CMenuBand::~CMenuBand() -{ - m_IUnknown->Release(); - m_IDeskBand->Release(); - m_IDockingWindow->Release(); - m_IOleWindow->Release(); - m_IObjectWithSite->Release(); - m_IInputObject->Release(); - m_IPersistStream->Release(); - m_IPersist->Release(); - m_IOleCommandTarget->Release(); - m_IServiceProvider->Release(); - m_IMenuPopup->Release(); - m_IDeskBar->Release(); - m_IMenuBand->Release(); - m_IShellMenu2->Release(); - m_IShellMenu->Release(); - m_IWinEventHandler->Release(); - m_IShellMenuAcc->Release(); - WrapLogClose(); -} - - -// *** IShellMenu2 methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::GetSubMenu(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetSubMenu()\n", this); - HRESULT hr = m_IShellMenu2->GetSubMenu(); - WrapLogExit("CMenuBand::GetSubMenu() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetToolbar(THIS) -{ - WrapLogEnter("CMenuBand<%p>::SetToolbar()\n", this); - HRESULT hr = m_IShellMenu2->SetToolbar(); - WrapLogExit("CMenuBand::SetToolbar() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetMinWidth(THIS) -{ - WrapLogEnter("CMenuBand<%p>::SetMinWidth()\n", this); - HRESULT hr = m_IShellMenu2->SetMinWidth(); - WrapLogExit("CMenuBand::SetMinWidth() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetNoBorder(THIS) -{ - WrapLogEnter("CMenuBand<%p>::SetNoBorder()\n", this); - HRESULT hr = m_IShellMenu2->SetNoBorder(); - WrapLogExit("CMenuBand::SetNoBorder() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetTheme(THIS) -{ - WrapLogEnter("CMenuBand<%p>::SetTheme()\n", this); - HRESULT hr = m_IShellMenu2->SetTheme(); - WrapLogExit("CMenuBand::SetTheme() = %08x\n", hr); - return hr; -} - - -// *** IShellMenuAcc methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::GetTop(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetTop()\n", this); - HRESULT hr = m_IShellMenuAcc->GetTop(); - WrapLogExit("CMenuBand::GetTop() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetBottom(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetBottom()\n", this); - HRESULT hr = m_IShellMenuAcc->GetBottom(); - WrapLogExit("CMenuBand::GetBottom() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetTracked(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetBottom()\n", this); - HRESULT hr = m_IShellMenuAcc->GetBottom(); - WrapLogExit("CMenuBand::GetBottom() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetParentSite(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetBottom()\n", this); - HRESULT hr = m_IShellMenuAcc->GetBottom(); - WrapLogExit("CMenuBand::GetBottom() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetState(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetBottom()\n", this); - HRESULT hr = m_IShellMenuAcc->GetBottom(); - WrapLogExit("CMenuBand::GetBottom() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::DoDefaultAction(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetBottom()\n", this); - HRESULT hr = m_IShellMenuAcc->GetBottom(); - WrapLogExit("CMenuBand::GetBottom() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::IsEmpty(THIS) -{ - WrapLogEnter("CMenuBand<%p>::GetBottom()\n", this); - HRESULT hr = m_IShellMenuAcc->GetBottom(); - WrapLogExit("CMenuBand::GetBottom() = %08x\n", hr); - return hr; -} - -// *** IDeskBand methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) -{ - WrapLogEnter("CMenuBand<%p>::GetBandInfo(DWORD dwBandID=%d, DWORD dwViewMode=%d, DESKBANDINFO *pdbi=%p)\n", this, dwBandID, dwViewMode, pdbi); - HRESULT hr = m_IDeskBand->GetBandInfo(dwBandID, dwViewMode, pdbi); - WrapLogExit("CMenuBand::GetBandInfo() = %08x\n", hr); - return hr; -} - -// *** IDockingWindow methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::ShowDW(BOOL fShow) -{ - WrapLogEnter("CMenuBand<%p>::ShowDW(BOOL fShow=%d)\n", this, fShow); - HRESULT hr = m_IDockingWindow->ShowDW(fShow); - WrapLogExit("CMenuBand::ShowDW() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::CloseDW(DWORD dwReserved) -{ - WrapLogEnter("CMenuBand<%p>::CloseDW(DWORD dwReserved=%d)\n", this, dwReserved); - HRESULT hr = m_IDockingWindow->CloseDW(dwReserved); - WrapLogExit("CMenuBand::CloseDW() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) -{ - WrapLogEnter("CMenuBand<%p>::ResizeBorderDW(LPCRECT prcBorder=%p, IUnknown *punkToolbarSite=%p, BOOL fReserved=%d)\n", this, prcBorder, punkToolbarSite, fReserved); - if (prcBorder) WrapLogMsg("*prcBorder=%s\n", Wrap(*prcBorder)); - HRESULT hr = m_IDockingWindow->ResizeBorderDW(prcBorder, punkToolbarSite, fReserved); - if (prcBorder) WrapLogMsg("*prcBorder=%s\n", Wrap(*prcBorder)); - WrapLogExit("CMenuBand::ResizeBorderDW() = %08x\n", hr); - return hr; -} - -// *** IOleWindow methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::GetWindow(HWND *phwnd) -{ - WrapLogEnter("CMenuBand<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd); - HRESULT hr = m_IOleWindow->GetWindow(phwnd); - if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd); - WrapLogExit("CMenuBand::GetWindow() = %08x\n", hr); - return hr; -} -HRESULT STDMETHODCALLTYPE CMenuBand::ContextSensitiveHelp(BOOL fEnterMode) -{ - WrapLogEnter("CMenuBand<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode); - HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode); - WrapLogExit("CMenuBand::ContextSensitiveHelp() = %08x\n", hr); - return hr; -} - -// *** IWinEventHandler methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) -{ - //WrapLogEnter("CMenuBand<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult); - HRESULT hr = m_IWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult); - //WrapLogExit("CMenuBand::OnWinEvent() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::IsWindowOwner(HWND hWnd) -{ - //WrapLogEnter("CMenuBand<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd); - HRESULT hr = m_IWinEventHandler->IsWindowOwner(hWnd); - //WrapLogExit("CMenuBand::IsWindowOwner() = %08x\n", hr); - return hr; -} - -// *** IObjectWithSite methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::SetSite(IUnknown *pUnkSite) -{ - WrapLogEnter("CMenuBand<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite); - HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite); - WrapLogExit("CMenuBand::SetSite() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetSite(REFIID riid, PVOID *ppvSite) -{ - WrapLogEnter("CMenuBand<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite); - HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite); - if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite); - WrapLogExit("CMenuBand::GetSite() = %08x\n", hr); - return hr; -} - -// *** IInputObject methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg) -{ - WrapLogEnter("CMenuBand<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate, lpMsg); - HRESULT hr = m_IInputObject->UIActivateIO(fActivate, lpMsg); - WrapLogExit("CMenuBand::UIActivateIO() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::HasFocusIO() -{ - WrapLogEnter("CMenuBand<%p>::HasFocusIO()\n", this); - HRESULT hr = m_IInputObject->HasFocusIO(); - WrapLogExit("CMenuBand::HasFocusIO() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::TranslateAcceleratorIO(LPMSG lpMsg) -{ - WrapLogEnter("CMenuBand<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg); - if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg)); - HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg); - WrapLogExit("CMenuBand::TranslateAcceleratorIO() = %08x\n", hr); - return hr; -} - -// *** IPersistStream methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::IsDirty() -{ - WrapLogEnter("CMenuBand<%p>::IsDirty()\n", this); - HRESULT hr = m_IPersistStream->IsDirty(); - WrapLogExit("CMenuBand::IsDirty() = %08x\n", hr); - return hr; -} -HRESULT STDMETHODCALLTYPE CMenuBand::Load(IStream *pStm) -{ - WrapLogEnter("CMenuBand<%p>::Load(IStream *pStm=%p)\n", this, pStm); - HRESULT hr = m_IPersistStream->Load(pStm); - WrapLogExit("CMenuBand::Load() = %08x\n", hr); - return hr; -} -HRESULT STDMETHODCALLTYPE CMenuBand::Save(IStream *pStm, BOOL fClearDirty) -{ - WrapLogEnter("CMenuBand<%p>::Save(IStream *pStm=%p, BOOL fClearDirty=%d)\n", this, pStm, fClearDirty); - HRESULT hr = m_IPersistStream->Save(pStm, fClearDirty); - WrapLogExit("CMenuBand::Save() = %08x\n", hr); - return hr; -} -HRESULT STDMETHODCALLTYPE CMenuBand::GetSizeMax(ULARGE_INTEGER *pcbSize) -{ - WrapLogEnter("CMenuBand<%p>::GetSizeMax(ULARGE_INTEGER *pcbSize=%p)\n", this, pcbSize); - HRESULT hr = m_IPersistStream->GetSizeMax(pcbSize); - WrapLogExit("CMenuBand::GetSizeMax() = %08x\n", hr); - return hr; -} - -// *** IPersist methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::GetClassID(CLSID *pClassID) -{ - WrapLogEnter("CMenuBand<%p>::GetClassID(CLSID *pClassID=%p)\n", this, pClassID); - HRESULT hr = m_IPersist->GetClassID(pClassID); - if (pClassID) WrapLogMsg("*pClassID=%s\n", Wrap(*pClassID)); - WrapLogExit("CMenuBand::GetClassID() = %08x\n", hr); - return hr; -} - -// *** IOleCommandTarget methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) -{ - WrapLogEnter("CMenuBand<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); - WrapLogExit("CMenuBand::QueryStatus() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - bool b; - - WrapLogEnter("CMenuBand<%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 && IsEqualGUID(*pguidCmdGroup, CLSID_MenuBand)) - { - if (nCmdID == 19) // popup - { - b = true; - } - } - - - if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); - HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); - WrapLogExit("CMenuBand::Exec() = %08x\n", hr); - return hr; -} - -// *** IServiceProvider methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - WrapLogEnter("CMenuBand<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject); - - if (IsEqualIID(guidService, SID_SMenuBandChild)) - { - WrapLogMsg("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n"); - HRESULT hr = this->QueryInterface(riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - if (SUCCEEDED(hr)) - { - WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); - return hr; - } - else - { - WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); - } - } - else if (IsEqualIID(guidService, SID_SMenuBandBottom)) - { - WrapLogMsg("SID is SID_SMenuBandBottom. Using QueryInterface of self instead of wrapped object.\n"); - HRESULT hr = this->QueryInterface(riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - if (SUCCEEDED(hr)) - { - WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); - return hr; - } - else - { - WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); - } - } - else if (IsEqualIID(guidService, SID_SMenuBandBottomSelected)) - { - WrapLogMsg("SID is SID_SMenuBandBottomSelected. Using QueryInterface of self instead of wrapped object.\n"); - HRESULT hr = this->QueryInterface(riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - if (SUCCEEDED(hr)) - { - WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); - return hr; - } - else - { - WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); - } - } - else - { - WrapLogMsg("SID not identified.\n"); - } - HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); - return hr; -} - - -// *** IMenuPopup methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) -{ - WrapLogEnter("CMenuBand<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags); - HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags); - WrapLogExit("CMenuBand::Popup() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::OnSelect(DWORD dwSelectType) -{ - WrapLogEnter("CMenuBand<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType); - HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType); - WrapLogExit("CMenuBand::OnSelect() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetSubMenu(IMenuPopup *pmp, BOOL fSet) -{ - WrapLogEnter("CMenuBand<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet); - HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet); - WrapLogExit("CMenuBand::SetSubMenu() = %08x\n", hr); - return hr; -} - - -// *** IDeskBar methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient) -{ - WrapLogEnter("CMenuBand<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient); - HRESULT hr = m_IDeskBar->SetClient(punkClient); - WrapLogExit("CMenuBand::SetClient() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetClient(IUnknown **ppunkClient) -{ - WrapLogEnter("CMenuBand<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient); - HRESULT hr = m_IDeskBar->GetClient(ppunkClient); - if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient); - WrapLogExit("CMenuBand::GetClient() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::OnPosRectChangeDB(RECT *prc) -{ - WrapLogEnter("CMenuBand<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc); - HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc); - if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc)); - WrapLogExit("CMenuBand::OnPosRectChangeDB() = %08x\n", hr); - return hr; -} - - -// *** IMenuBand methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::IsMenuMessage(MSG *pmsg) -{ - //WrapLogEnter("CMenuBand<%p>::IsMenuMessage(MSG *pmsg=%p)\n", this, pmsg); - HRESULT hr = m_IMenuBand->IsMenuMessage(pmsg); - //WrapLogExit("CMenuBand::IsMenuMessage() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet) -{ - //WrapLogEnter("CMenuBand<%p>::TranslateMenuMessage(MSG *pmsg=%p, LRESULT *plRet=%p)\n", this, pmsg, plRet); - HRESULT hr = m_IMenuBand->TranslateMenuMessage(pmsg, plRet); - //WrapLogExit("CMenuBand::TranslateMenuMessage(*plRet=%d) = %08x\n", *plRet, hr); - return hr; -} - -// *** IShellMenu methods *** -HRESULT STDMETHODCALLTYPE CMenuBand::Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags) -{ - WrapLogEnter("CMenuBand<%p>::Initialize(IShellMenuCallback *psmc=%p, UINT uId=%u, UINT uIdAncestor=%u, DWORD dwFlags=%08x)\n", this, psmc, uId, uIdAncestor, dwFlags); - HRESULT hr = m_IShellMenu->Initialize(psmc, uId, uIdAncestor, dwFlags); - WrapLogExit("CMenuBand::Initialize() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags) -{ - WrapLogEnter("CMenuBand<%p>::GetMenuInfo(IShellMenuCallback **ppsmc=%p, UINT *puId=%p, UINT *puIdAncestor=%p, DWORD *pdwFlags=%p)\n", this, ppsmc, puId, puIdAncestor, pdwFlags); - HRESULT hr = m_IShellMenu->GetMenuInfo(ppsmc, puId, puIdAncestor, pdwFlags); - if (ppsmc) WrapLogMsg("*ppsmc=%p\n", *ppsmc); - if (puId) WrapLogMsg("*puId=%u\n", *puId); - if (puIdAncestor) WrapLogMsg("*puIdAncestor=%u\n", *puIdAncestor); - if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags); - WrapLogExit("CMenuBand::GetMenuInfo() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags) -{ - WrapLogEnter("CMenuBand<%p>::SetShellFolder(IShellFolder *psf=%p, LPCITEMIDLIST pidlFolder=%p, HKEY hKey=%p, DWORD dwFlags=%08x)\n", this, psf, pidlFolder, hKey, dwFlags); - HRESULT hr = m_IShellMenu->SetShellFolder(psf, pidlFolder, hKey, dwFlags); - WrapLogExit("CMenuBand::SetShellFolder() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv) -{ - WrapLogEnter("CMenuBand<%p>::GetShellFolder(DWORD *pdwFlags=%p, LPITEMIDLIST *ppidl=%p, REFIID riid=%s, void **ppv=%p)\n", this, pdwFlags, ppidl, Wrap(riid), ppv); - HRESULT hr = m_IShellMenu->GetShellFolder(pdwFlags, ppidl, riid, ppv); - if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags); - if (ppidl) WrapLogMsg("*ppidl=%p\n", *ppidl); - if (ppv) WrapLogMsg("*ppv=%p\n", *ppv); - WrapLogExit("CMenuBand::GetShellFolder() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags) -{ - WrapLogEnter("CMenuBand<%p>::SetMenu(HMENU hmenu=%p, HWND hwnd=%p, DWORD dwFlags=%08x)\n", this, hmenu, hwnd, dwFlags); - HRESULT hr = m_IShellMenu->SetMenu(hmenu, hwnd, dwFlags); - WrapLogExit("CMenuBand::SetMenu() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags) -{ - WrapLogEnter("CMenuBand<%p>::GetMenu(HMENU *phmenu=%p, HWND *phwnd=%p, DWORD *pdwFlags=%p)\n", this, phmenu, phwnd, pdwFlags); - HRESULT hr = m_IShellMenu->GetMenu(phmenu, phwnd, pdwFlags); - if (phmenu) WrapLogMsg("*phmenu=%p\n", *phmenu); - if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd); - if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags); - WrapLogExit("CMenuBand::GetMenu() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::InvalidateItem(LPSMDATA psmd, DWORD dwFlags) -{ - WrapLogEnter("CMenuBand<%p>::InvalidateItem(LPSMDATA psmd=%p, DWORD dwFlags=%08x)\n", this, psmd, dwFlags); - HRESULT hr = m_IShellMenu->InvalidateItem(psmd, dwFlags); - WrapLogExit("CMenuBand::InvalidateItem() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetState(LPSMDATA psmd) -{ - WrapLogEnter("CMenuBand<%p>::GetState(LPSMDATA psmd=%p)\n", this, psmd); - HRESULT hr = m_IShellMenu->GetState(psmd); - WrapLogExit("CMenuBand::GetState() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetMenuToolbar(IUnknown *punk, DWORD dwFlags) -{ - WrapLogEnter("CMenuBand<%p>::SetMenuToolbar(IUnknown *punk=%p, DWORD dwFlags=%08x)\n", this, punk, dwFlags); - HRESULT hr = m_IShellMenu->SetMenuToolbar(punk, dwFlags); - WrapLogExit("CMenuBand::SetMenuToolbar() = %08x\n", hr); - return hr; -} -#else - CMenuToolbarBase::CMenuToolbarBase(CMenuBand *menuBand) : m_menuBand(menuBand), m_hwnd(NULL), @@ -991,7 +419,7 @@ { if (HasSubMenu(hot->idNew) == S_OK) { - DWORD elapsed; + DWORD elapsed = 0; SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0); m_hotItem = hot->idNew; @@ -1009,9 +437,9 @@ IBandSite* pBandSite; IDeskBar* pDeskBar; - HRESULT hr; - - RECT rc; + HRESULT hr = 0; + RECT rc = { 0 }; + if (!SendMessage(m_hwnd, TB_GETITEMRECT, index, reinterpret_cast<LPARAM>(&rc))) return E_FAIL; @@ -1025,7 +453,7 @@ RECTL rcl = { a.x, a.y, b.x, b.y }; // maybe-TODO: fetch client area of deskbar? -#ifndef USE_BUILTIN_MENUSITE +#if USE_SYSTEM_MENUSITE hr = CoCreateInstance(CLSID_MenuBandSite, NULL, CLSCTX_INPROC_SERVER, @@ -1036,11 +464,13 @@ if (FAILED(hr)) return hr; -#ifndef USE_BUILTIN_MENUDESKBAR +#if USE_SYSTEM_MENUDESKBAR hr = CoCreateInstance(CLSID_MenuDeskBar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IDeskBar, &pDeskBar)); +#elif WRAP_MENUDESKBAR + hr = CMenuDeskBar_Wrapper(IID_PPV_ARG(IDeskBar, &pDeskBar)); #else hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar)); #endif @@ -1067,21 +497,18 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT index, HMENU menu) { - RECT rc; + RECT rc = { 0 }; + if (!SendMessage(m_hwnd, TB_GETITEMRECT, index, reinterpret_cast<LPARAM>(&rc))) return E_FAIL; - POINT a = { rc.left, rc.top }; POINT b = { rc.right, rc.bottom }; - ClientToScreen(m_hwnd, &a); ClientToScreen(m_hwnd, &b); - SetRect(&rc, a.x, a.y, b.x, b.y); // maybe-TODO: fetch client area of deskbar? - HMENU popup = GetSubMenu(menu, index); - m_menuBand->TrackPopup(popup, rc.right, rc.bottom, rc); + m_menuBand->TrackPopup(popup, b.x, b.y); return S_OK; } @@ -1200,7 +627,7 @@ SMINFO * sminfo = new SMINFO(); sminfo->dwMask = SMIM_ICON | SMIM_FLAGS; - if (info.wID >= 0 && SUCCEEDED(m_menuBand->CallCBWithId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo)))) + if (SUCCEEDED(m_menuBand->CallCBWithId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo)))) { tbb.iBitmap = sminfo->iIcon; tbb.dwData = reinterpret_cast<DWORD_PTR>(sminfo); @@ -1253,6 +680,9 @@ SendMessage(m_hwnd, TB_GETBUTTON, index, reinterpret_cast<LPARAM>(&btn)); SMINFO * nfo = reinterpret_cast<SMINFO*>(btn.dwData); + if (!nfo) + return E_FAIL; + if (nfo->dwFlags&SMIF_TRACKPOPUP) { return PopupSubMenu(index, m_hmenu); @@ -1433,11 +863,13 @@ if (!pidl) return E_FAIL; -#ifndef USE_BUILTIN_MENUBAND +#if USE_SYSTEM_MENUBAND hr = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellMenu, &pShellMenu)); + IID_PPV_ARG(IShellMenu, &shellMenu)); +#elif WRAP_MENUBAND + hr = CMenuBand_Wrapper(IID_PPV_ARG(IShellMenu, &shellMenu)); #else hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &shellMenu)); #endif @@ -1471,6 +903,8 @@ SFGAOF attrs; hr = psi->GetAttributes(SFGAO_FOLDER, &attrs); + if (FAILED(hr)) + return hr; return (attrs != 0) ? S_OK : S_FALSE; } @@ -2236,9 +1670,8 @@ return hr; } -HRESULT CMenuBand::TrackPopup(HMENU popup, INT x, INT y, RECT& rc) -{ - ::TrackPopupMenu(popup, 0, x, y, 0, m_menuOwner, &rc); - return S_OK; -} -#endif +HRESULT CMenuBand::TrackPopup(HMENU popup, INT x, INT y) +{ + ::TrackPopupMenu(popup, 0, x, y, 0, m_menuOwner, NULL); + return S_OK; +} Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Wed Feb 19 00:20:45 2014 @@ -18,13 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "precomp.h" -#include "wraplog.h" #include <atlwin.h> #include <shlwapi_undoc.h> WINE_DEFAULT_DEBUG_CHANNEL(CMenuDeskBar); - -#define WRAP_LOG 0 typedef CWinTraits< WS_POPUP | WS_DLGFRAME | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, @@ -32,9 +29,7 @@ > CMenuWinTraits; class CMenuDeskBar : -#if !WRAP_LOG public CWindowImpl<CMenuDeskBar, CWindow, CMenuWinTraits>, -#endif public CComCoClass<CMenuDeskBar>, public CComObjectRootEx<CComMultiThreadModelNoCS>, public IOleCommandTarget, @@ -51,28 +46,12 @@ ~CMenuDeskBar(); private: -#if WRAP_LOG - IUnknown * m_IUnknown; - IMenuPopup * m_IMenuPopup; - IOleCommandTarget * m_IOleCommandTarget; - IServiceProvider * m_IServiceProvider; - IDeskBar * m_IDeskBar; - IOleWindow * m_IOleWindow; - IInputObjectSite * m_IInputObjectSite; - IInputObject * m_IInputObject; - IObjectWithSite * m_IObjectWithSite; - IBanneredBar * m_IBanneredBar; - IInitializeObject * m_IInitializeObject; -#else - CComPtr<IUnknown> m_Site; CComPtr<IUnknown> m_Client; CComPtr<IMenuPopup> m_SubMenuParent; DWORD m_IconSize; HBITMAP m_Banner; - -#endif public: // *** IMenuPopup methods *** @@ -120,7 +99,6 @@ DECLARE_NOT_AGGREGATABLE(CMenuDeskBar) DECLARE_PROTECT_FINAL_CONSTRUCT() -#if !WRAP_LOG DECLARE_WND_CLASS_EX(_T("BaseBar"), CS_SAVEBITS | CS_DROPSHADOW, COLOR_3DFACE) BEGIN_MSG_MAP(CMenuDeskBar) @@ -129,14 +107,6 @@ MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged) MESSAGE_HANDLER(WM_PAINT, OnPaint) END_MSG_MAP() - - // message handlers - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnWindowPosChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - -#endif BEGIN_COM_MAP(CMenuDeskBar) COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup) @@ -150,6 +120,14 @@ COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar) COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject) END_COM_MAP() + +private: + + // message handlers + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnWindowPosChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); }; extern "C" @@ -169,296 +147,6 @@ return hr; } - -#if WRAP_LOG -CMenuDeskBar::CMenuDeskBar() -{ - HRESULT hr; - WrapLogOpen(); - - hr = CoCreateInstance(CLSID_MenuDeskBar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IMenuPopup, &m_IMenuPopup)); - hr = m_IMenuPopup->QueryInterface(IID_PPV_ARG(IUnknown, &m_IUnknown)); - - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IBanneredBar, &m_IBanneredBar)); - hr = m_IUnknown->QueryInterface(IID_PPV_ARG(IInitializeObject, &m_IInitializeObject)); -} - -CMenuDeskBar::~CMenuDeskBar() -{ - m_IUnknown->Release(); - m_IMenuPopup->Release(); - m_IOleCommandTarget->Release(); - m_IServiceProvider->Release(); - m_IDeskBar->Release(); - m_IOleWindow->Release(); - m_IInputObjectSite->Release(); - m_IInputObject->Release(); - m_IObjectWithSite->Release(); - m_IBanneredBar->Release(); - m_IInitializeObject->Release(); - - WrapLogClose(); -} - -// *** IMenuPopup methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) -{ - WrapLogEnter("CMenuDeskBar<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags); - HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags); - WrapLogExit("CMenuDeskBar::Popup() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnSelect(DWORD dwSelectType) -{ - WrapLogEnter("CMenuDeskBar<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType); - HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType); - WrapLogExit("CMenuDeskBar::OnSelect() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSubMenu(IMenuPopup *pmp, BOOL fSet) -{ - WrapLogEnter("CMenuDeskBar<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet); - HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet); - WrapLogExit("CMenuDeskBar::SetSubMenu() = %08x\n", hr); - return hr; -} - -// *** IOleWindow methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetWindow(HWND *phwnd) -{ - WrapLogEnter("CMenuDeskBar<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd); - HRESULT hr = m_IOleWindow->GetWindow(phwnd); - if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd); - WrapLogExit("CMenuDeskBar::GetWindow() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::ContextSensitiveHelp(BOOL fEnterMode) -{ - WrapLogEnter("CMenuDeskBar<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode); - HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode); - WrapLogExit("CMenuDeskBar::ContextSensitiveHelp() = %08x\n", hr); - return hr; -} - -// *** IObjectWithSite methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSite(IUnknown *pUnkSite) -{ - WrapLogEnter("CMenuDeskBar<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite); - HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite); - WrapLogExit("CMenuDeskBar::SetSite() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetSite(REFIID riid, PVOID *ppvSite) -{ - WrapLogEnter("CMenuDeskBar<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite); - HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite); - if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite); - WrapLogExit("CMenuDeskBar::GetSite() = %08x\n", hr); - return hr; -} - -// *** IBanneredBar methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetIconSize(DWORD iIcon) -{ - WrapLogEnter("CMenuDeskBar<%p>::SetIconSize(DWORD iIcon=%d)\n", this, iIcon); - HRESULT hr = m_IBanneredBar->SetIconSize(iIcon); - WrapLogExit("CMenuDeskBar::SetIconSize() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetIconSize(DWORD* piIcon) -{ - WrapLogEnter("CMenuDeskBar<%p>::GetIconSize(DWORD* piIcon=%p)\n", this, piIcon); - HRESULT hr = m_IBanneredBar->GetIconSize(piIcon); - if (piIcon) WrapLogMsg("*piIcon=%d\n", *piIcon); - WrapLogExit("CMenuDeskBar::GetIconSize() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetBitmap(HBITMAP hBitmap) -{ - WrapLogEnter("CMenuDeskBar<%p>::SetBitmap(HBITMAP hBitmap=%p)\n", this, hBitmap); - HRESULT hr = m_IBanneredBar->SetBitmap(hBitmap); - WrapLogExit("CMenuDeskBar::SetBitmap() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetBitmap(HBITMAP* phBitmap) -{ - WrapLogEnter("CMenuDeskBar<%p>::GetBitmap(HBITMAP* phBitmap=%p)\n", this, phBitmap); - HRESULT hr = m_IBanneredBar->GetBitmap(phBitmap); - if (phBitmap) WrapLogMsg("*phBitmap=%p\n", *phBitmap); - WrapLogExit("CMenuDeskBar::GetBitmap() = %08x\n", hr); - return hr; -} - - -// *** IInitializeObject methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::Initialize(THIS) -{ - WrapLogEnter("CMenuDeskBar<%p>::Initialize()\n", this); - HRESULT hr = m_IInitializeObject->Initialize(); - WrapLogExit("CMenuDeskBar::Initialize() = %08x\n", hr); - return hr; -} - -// *** IOleCommandTarget methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) -{ - WrapLogEnter("CMenuDeskBar<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); - WrapLogExit("CMenuDeskBar::QueryStatus() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - WrapLogEnter("CMenuDeskBar<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); - HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); - WrapLogExit("CMenuDeskBar::Exec() = %08x\n", hr); - return hr; -} - -// *** IServiceProvider methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - WrapLogEnter("CMenuDeskBar<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject); - - if (IsEqualIID(guidService, SID_SMenuPopup)) - { - WrapLogMsg("SID is SID_SMenuPopup. Using QueryInterface of self instead of wrapped object.\n"); - HRESULT hr = this->QueryInterface(riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - if (SUCCEEDED(hr)) - { - WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); - return hr; - } - else - { - WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); - } - } - else if (IsEqualIID(guidService, SID_SMenuBandParent)) - { - WrapLogMsg("SID is SID_SMenuBandParent. Using QueryInterface of self instead of wrapped object.\n"); - HRESULT hr = this->QueryInterface(riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - if (SUCCEEDED(hr)) - { - WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); - return hr; - } - else - { - WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); - } - } - else if (IsEqualIID(guidService, SID_STopLevelBrowser)) - { - WrapLogMsg("SID is SID_STopLevelBrowser. Using QueryInterface of self instead of wrapped object.\n"); - HRESULT hr = this->QueryInterface(riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - if (SUCCEEDED(hr)) - { - WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); - return hr; - } - else - { - WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); - } - } - else - { - WrapLogMsg("SID not identified. Calling wrapped object's QueryService.\n"); - } - HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject); - if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); - return hr; -} - -// *** IInputObjectSite methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus) -{ - WrapLogEnter("CMenuDeskBar<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus); - HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus); - WrapLogExit("CMenuDeskBar::OnFocusChangeIS() = %08x\n", hr); - return hr; -} - -// *** IInputObject methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::UIActivateIO(BOOL bActivating, LPMSG lpMsg) -{ - WrapLogEnter("CMenuDeskBar<%p>::UIActivateIO(BOOL bActivating=%d, LPMSG lpMsg=%p)\n", this, bActivating, lpMsg); - HRESULT hr = m_IInputObject->UIActivateIO(bActivating, lpMsg); - WrapLogExit("CMenuDeskBar::UIActivateIO() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::HasFocusIO(THIS) -{ - WrapLogEnter("CMenuDeskBar<%p>::HasFocusIO()\n", this); - HRESULT hr = m_IInputObject->HasFocusIO(); - WrapLogExit("CMenuDeskBar::HasFocusIO() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::TranslateAcceleratorIO(LPMSG lpMsg) -{ - WrapLogEnter("CMenuDeskBar<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg); - if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg)); - HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg); - WrapLogExit("CMenuDeskBar::TranslateAcceleratorIO() = %08x\n", hr); - return hr; -} - -// *** IDeskBar methods *** -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetClient(IUnknown *punkClient) -{ - WrapLogEnter("CMenuDeskBar<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient); - HRESULT hr = m_IDeskBar->SetClient(punkClient); - WrapLogExit("CMenuDeskBar::SetClient() = %08x\n", hr); - - CComPtr<IDeskBarClient> dbc; - punkClient->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc)); - dbc->SetDeskBarSite(static_cast<IDeskBar*>(this)); - - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetClient(IUnknown **ppunkClient) -{ - WrapLogEnter("CMenuDeskBar<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient); - HRESULT hr = m_IDeskBar->GetClient(ppunkClient); - if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient); - WrapLogExit("CMenuDeskBar::GetClient() = %08x\n", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnPosRectChangeDB(LPRECT prc) -{ - WrapLogEnter("CMenuDeskBar<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc); - HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc); - if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc)); - WrapLogExit("CMenuDeskBar::OnPosRectChangeDB() = %08x\n", hr); - return hr; -} -#else CMenuDeskBar::CMenuDeskBar() : m_Client(NULL), @@ -699,7 +387,6 @@ const int bx = bm.bmWidth; const int by = bm.bmHeight; - const int cx = rc.right; const int cy = rc.bottom; TRACE("Painting banner: %d by %d\n", bm.bmWidth, bm.bmHeight); @@ -915,5 +602,3 @@ { return S_OK; } - -#endif Modified: branches/shell-experiments/base/shell/rshell/CStartMenu.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] Wed Feb 19 00:20:45 2014 @@ -17,10 +17,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "precomp.h" //#define TEST_TRACKPOPUPMENU_SUBMENUS -#include "precomp.h" /* NOTE: The following constants *MUST NOT* be changed because they're hardcoded and need to be the exact values @@ -136,7 +136,7 @@ case IDM_DOCUMENTS: csidl = CSIDL_RECENT; break; } -#ifndef USE_BUILTIN_MENUBAND +#if USE_SYSTEM_MENUBAND hr = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, @@ -271,18 +271,20 @@ IShellFolder *shellFolder; IShellFolder *psfStartMenu; -#ifndef USE_BUILTIN_MENUBAND +#if USE_SYSTEM_MENUBAND hr = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IShellMenu, &pShellMenu)); +#elif WRAP_MENUBAND + hr = CMenuBand_Wrapper(IID_PPV_ARG(IShellMenu, &pShellMenu)); #else hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu)); #endif if (FAILED(hr)) return hr; -#ifndef USE_BUILTIN_MENUSITE +#if USE_SYSTEM_MENUSITE hr = CoCreateInstance(CLSID_MenuBandSite, NULL, CLSCTX_INPROC_SERVER, @@ -293,11 +295,13 @@ if (FAILED(hr)) return hr; -#ifndef USE_BUILTIN_MENUDESKBAR +#if USE_SYSTEM_MENUDESKBAR hr = CoCreateInstance(CLSID_MenuDeskBar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IDeskBar, &pDeskBar)); +#elif WRAP_MENUDESKBAR + hr = CMenuDeskBar_Wrapper(IID_PPV_ARG(IDeskBar, &pDeskBar)); #else hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar)); #endif @@ -311,7 +315,7 @@ pCallback->AddRef(); // CreateInstance returns object with 0 ref count */ pCallback->Initialize(pShellMenu, pBandSite, pDeskBar); - pShellMenu->Initialize(pCallback, -1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL); + pShellMenu->Initialize(pCallback, (UINT)-1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL); if (FAILED(hr)) return hr; Propchange: branches/shell-experiments/base/shell/rshell/logging/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Feb 19 00:20:45 2014 @@ -0,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: branches/shell-experiments/base/shell/rshell/logging/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: branches/shell-experiments/base/shell/rshell/logging/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/shell-experiments/base/shell/rshell/logging/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Added: 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 (added) +++ branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp [iso-8859-1] Wed Feb 19 00:20:45 2014 @@ -0,0 +1,721 @@ +/* +* Shell Menu Band +* +* 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(CMenuBandWrap); + +class CMenuBandWrap : + public CComCoClass<CMenuBandWrap>, + public CComObjectRootEx<CComMultiThreadModelNoCS>, + public IDeskBand, + public IObjectWithSite, + public IInputObject, + public IPersistStream, + public IOleCommandTarget, + public IServiceProvider, + public IMenuPopup, + public IMenuBand, + public IShellMenu2, + public IWinEventHandler, + public IShellMenuAcc +{ +public: + CMenuBandWrap(); + ~CMenuBandWrap(); + +private: + IUnknown * m_IUnknown; + IDeskBand * m_IDeskBand; + IDockingWindow * m_IDockingWindow; + IOleWindow * m_IOleWindow; + IObjectWithSite * m_IObjectWithSite; + IInputObject * m_IInputObject; + IPersistStream * m_IPersistStream; + IPersist * m_IPersist; + IOleCommandTarget * m_IOleCommandTarget; + IServiceProvider * m_IServiceProvider; + IMenuPopup * m_IMenuPopup; + IDeskBar * m_IDeskBar; + IMenuBand * m_IMenuBand; + IShellMenu2 * m_IShellMenu2; + IShellMenu * m_IShellMenu; + IWinEventHandler * m_IWinEventHandler; + IShellMenuAcc * m_IShellMenuAcc; + + BOOL m_useBigIcons; + +public: + + // *** IDeskBand methods *** + virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi); + + // *** IDockingWindow methods *** + virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow); + virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved); + virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved); + + // *** IOleWindow methods *** + virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); + virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); + + // *** IObjectWithSite methods *** + virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); + virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite); + + // *** IInputObject methods *** + virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); + virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); + virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); + + // *** IPersistStream methods *** + virtual HRESULT STDMETHODCALLTYPE IsDirty(); + virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); + virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); + virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); + + // *** IPersist methods *** + virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); + + // *** IOleCommandTarget methods *** + 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); + + // *** IServiceProvider methods *** + virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); + + // *** IMenuPopup methods *** + virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags); + virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType); + virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet); + + // *** IDeskBar methods *** + virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient); + virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient); + virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc); + + // *** IMenuBand methods *** + virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg); + virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet); + + // *** IShellMenu methods *** + virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags); + virtual HRESULT STDMETHODCALLTYPE SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv); + virtual HRESULT STDMETHODCALLTYPE SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags); + virtual HRESULT STDMETHODCALLTYPE InvalidateItem(LPSMDATA psmd, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE GetState(LPSMDATA psmd); + virtual HRESULT STDMETHODCALLTYPE SetMenuToolbar(IUnknown *punk, DWORD dwFlags); + + // *** IWinEventHandler methods *** + virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); + virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); + + // *** IShellMenu2 methods *** + virtual HRESULT STDMETHODCALLTYPE GetSubMenu(THIS); + virtual HRESULT STDMETHODCALLTYPE SetToolbar(THIS); + virtual HRESULT STDMETHODCALLTYPE SetMinWidth(THIS); + virtual HRESULT STDMETHODCALLTYPE SetNoBorder(THIS); + virtual HRESULT STDMETHODCALLTYPE SetTheme(THIS); + + // *** IShellMenuAcc methods *** + virtual HRESULT STDMETHODCALLTYPE GetTop(THIS); + virtual HRESULT STDMETHODCALLTYPE GetBottom(THIS); + virtual HRESULT STDMETHODCALLTYPE GetTracked(THIS); + virtual HRESULT STDMETHODCALLTYPE GetParentSite(THIS); + virtual HRESULT STDMETHODCALLTYPE GetState(THIS); + virtual HRESULT STDMETHODCALLTYPE DoDefaultAction(THIS); + virtual HRESULT STDMETHODCALLTYPE IsEmpty(THIS); + + DECLARE_NOT_AGGREGATABLE(CMenuBandWrap) + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CMenuBandWrap) + COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup) + COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu) + COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) + COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IDeskBand) + COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow) + COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand) + COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) + COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) + COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) + COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistStream) + COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) + COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup) + COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand) + COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2) + COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) + COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc) + END_COM_MAP() +}; + +extern "C" +HRESULT CMenuBand_Wrapper(REFIID riid, LPVOID *ppv) +{ + *ppv = NULL; + + CMenuBandWrap * site = new CComObject<CMenuBandWrap>(); + + if (!site) + return E_OUTOFMEMORY; + + HRESULT hr = site->QueryInterface(riid, ppv); + + if (FAILED(hr)) + site->Release(); + + return hr; +} + +CMenuBandWrap::CMenuBandWrap() +{ + WrapLogOpen(); + + CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IShellMenu, &m_IShellMenu)); + m_IShellMenu->QueryInterface(IID_PPV_ARG(IUnknown, &m_IUnknown)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBand, &m_IDeskBand)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IDockingWindow, &m_IDockingWindow)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IPersistStream, &m_IPersistStream)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IPersist, &m_IPersist)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IMenuBand, &m_IMenuBand)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IShellMenu2, &m_IShellMenu2)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_IWinEventHandler)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IShellMenuAcc, &m_IShellMenuAcc)); +} + +CMenuBandWrap::~CMenuBandWrap() +{ + m_IUnknown->Release(); + m_IDeskBand->Release(); + m_IDockingWindow->Release(); + m_IOleWindow->Release(); + m_IObjectWithSite->Release(); + m_IInputObject->Release(); + m_IPersistStream->Release(); + m_IPersist->Release(); + m_IOleCommandTarget->Release(); + m_IServiceProvider->Release(); + m_IMenuPopup->Release(); + m_IDeskBar->Release(); + m_IMenuBand->Release(); + m_IShellMenu2->Release(); + m_IShellMenu->Release(); + m_IWinEventHandler->Release(); + m_IShellMenuAcc->Release(); + WrapLogClose(); +} + + +// *** IShellMenu2 methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSubMenu(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetSubMenu()\n", this); + HRESULT hr = m_IShellMenu2->GetSubMenu(); + WrapLogExit("CMenuBandWrap::GetSubMenu() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetToolbar(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetToolbar()\n", this); + HRESULT hr = m_IShellMenu2->SetToolbar(); + WrapLogExit("CMenuBandWrap::SetToolbar() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMinWidth(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetMinWidth()\n", this); + HRESULT hr = m_IShellMenu2->SetMinWidth(); + WrapLogExit("CMenuBandWrap::SetMinWidth() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetNoBorder(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetNoBorder()\n", this); + HRESULT hr = m_IShellMenu2->SetNoBorder(); + WrapLogExit("CMenuBandWrap::SetNoBorder() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetTheme(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetTheme()\n", this); + HRESULT hr = m_IShellMenu2->SetTheme(); + WrapLogExit("CMenuBandWrap::SetTheme() = %08x\n", hr); + return hr; +} + + +// *** IShellMenuAcc methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetTop(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetTop()\n", this); + HRESULT hr = m_IShellMenuAcc->GetTop(); + WrapLogExit("CMenuBandWrap::GetTop() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetBottom(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this); + HRESULT hr = m_IShellMenuAcc->GetBottom(); + WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetTracked(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this); + HRESULT hr = m_IShellMenuAcc->GetBottom(); + WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetParentSite(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this); + HRESULT hr = m_IShellMenuAcc->GetBottom(); + WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetState(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this); + HRESULT hr = m_IShellMenuAcc->GetBottom(); + WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::DoDefaultAction(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this); + HRESULT hr = m_IShellMenuAcc->GetBottom(); + WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsEmpty(THIS) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this); + HRESULT hr = m_IShellMenuAcc->GetBottom(); + WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr); + return hr; +} + +// *** IDeskBand methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetBandInfo(DWORD dwBandID=%d, DWORD dwViewMode=%d, DESKBANDINFO *pdbi=%p)\n", this, dwBandID, dwViewMode, pdbi); + HRESULT hr = m_IDeskBand->GetBandInfo(dwBandID, dwViewMode, pdbi); + WrapLogExit("CMenuBandWrap::GetBandInfo() = %08x\n", hr); + return hr; +} + +// *** IDockingWindow methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::ShowDW(BOOL fShow) +{ + WrapLogEnter("CMenuBandWrap<%p>::ShowDW(BOOL fShow=%d)\n", this, fShow); + HRESULT hr = m_IDockingWindow->ShowDW(fShow); + WrapLogExit("CMenuBandWrap::ShowDW() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::CloseDW(DWORD dwReserved) +{ + WrapLogEnter("CMenuBandWrap<%p>::CloseDW(DWORD dwReserved=%d)\n", this, dwReserved); + HRESULT hr = m_IDockingWindow->CloseDW(dwReserved); + WrapLogExit("CMenuBandWrap::CloseDW() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) +{ + WrapLogEnter("CMenuBandWrap<%p>::ResizeBorderDW(LPCRECT prcBorder=%p, IUnknown *punkToolbarSite=%p, BOOL fReserved=%d)\n", this, prcBorder, punkToolbarSite, fReserved); + if (prcBorder) WrapLogMsg("*prcBorder=%s\n", Wrap(*prcBorder)); + HRESULT hr = m_IDockingWindow->ResizeBorderDW(prcBorder, punkToolbarSite, fReserved); + if (prcBorder) WrapLogMsg("*prcBorder=%s\n", Wrap(*prcBorder)); + WrapLogExit("CMenuBandWrap::ResizeBorderDW() = %08x\n", hr); + return hr; +} + +// *** IOleWindow methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetWindow(HWND *phwnd) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd); + HRESULT hr = m_IOleWindow->GetWindow(phwnd); + if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd); + WrapLogExit("CMenuBandWrap::GetWindow() = %08x\n", hr); + return hr; +} +HRESULT STDMETHODCALLTYPE CMenuBandWrap::ContextSensitiveHelp(BOOL fEnterMode) +{ + WrapLogEnter("CMenuBandWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode); + HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode); + WrapLogExit("CMenuBandWrap::ContextSensitiveHelp() = %08x\n", hr); + return hr; +} + +// *** IWinEventHandler methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) +{ + //WrapLogEnter("CMenuBandWrap<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult); + HRESULT hr = m_IWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult); + //WrapLogExit("CMenuBandWrap::OnWinEvent() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsWindowOwner(HWND hWnd) +{ + //WrapLogEnter("CMenuBandWrap<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd); + HRESULT hr = m_IWinEventHandler->IsWindowOwner(hWnd); + //WrapLogExit("CMenuBandWrap::IsWindowOwner() = %08x\n", hr); + return hr; +} + +// *** IObjectWithSite methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetSite(IUnknown *pUnkSite) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite); + HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite); + WrapLogExit("CMenuBandWrap::SetSite() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSite(REFIID riid, PVOID *ppvSite) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite); + HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite); + if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite); + WrapLogExit("CMenuBandWrap::GetSite() = %08x\n", hr); + return hr; +} + +// *** IInputObject methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::UIActivateIO(BOOL fActivate, LPMSG lpMsg) +{ + WrapLogEnter("CMenuBandWrap<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate, lpMsg); + HRESULT hr = m_IInputObject->UIActivateIO(fActivate, lpMsg); + WrapLogExit("CMenuBandWrap::UIActivateIO() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::HasFocusIO() +{ + WrapLogEnter("CMenuBandWrap<%p>::HasFocusIO()\n", this); + HRESULT hr = m_IInputObject->HasFocusIO(); + WrapLogExit("CMenuBandWrap::HasFocusIO() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::TranslateAcceleratorIO(LPMSG lpMsg) +{ + WrapLogEnter("CMenuBandWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg); + if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg)); + HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg); + WrapLogExit("CMenuBandWrap::TranslateAcceleratorIO() = %08x\n", hr); + return hr; +} + +// *** IPersistStream methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsDirty() +{ + WrapLogEnter("CMenuBandWrap<%p>::IsDirty()\n", this); + HRESULT hr = m_IPersistStream->IsDirty(); + WrapLogExit("CMenuBandWrap::IsDirty() = %08x\n", hr); + return hr; +} +HRESULT STDMETHODCALLTYPE CMenuBandWrap::Load(IStream *pStm) +{ + WrapLogEnter("CMenuBandWrap<%p>::Load(IStream *pStm=%p)\n", this, pStm); + HRESULT hr = m_IPersistStream->Load(pStm); + WrapLogExit("CMenuBandWrap::Load() = %08x\n", hr); + return hr; +} +HRESULT STDMETHODCALLTYPE CMenuBandWrap::Save(IStream *pStm, BOOL fClearDirty) +{ + WrapLogEnter("CMenuBandWrap<%p>::Save(IStream *pStm=%p, BOOL fClearDirty=%d)\n", this, pStm, fClearDirty); + HRESULT hr = m_IPersistStream->Save(pStm, fClearDirty); + WrapLogExit("CMenuBandWrap::Save() = %08x\n", hr); + return hr; +} +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSizeMax(ULARGE_INTEGER *pcbSize) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetSizeMax(ULARGE_INTEGER *pcbSize=%p)\n", this, pcbSize); + HRESULT hr = m_IPersistStream->GetSizeMax(pcbSize); + WrapLogExit("CMenuBandWrap::GetSizeMax() = %08x\n", hr); + return hr; +} + +// *** IPersist methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetClassID(CLSID *pClassID) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetClassID(CLSID *pClassID=%p)\n", this, pClassID); + HRESULT hr = m_IPersist->GetClassID(pClassID); + if (pClassID) WrapLogMsg("*pClassID=%s\n", Wrap(*pClassID)); + WrapLogExit("CMenuBandWrap::GetClassID() = %08x\n", hr); + return hr; +} + +// *** IOleCommandTarget methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) +{ + WrapLogEnter("CMenuBandWrap<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); + WrapLogExit("CMenuBandWrap::QueryStatus() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + WrapLogEnter("CMenuBandWrap<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); + HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); + WrapLogExit("CMenuBandWrap::Exec() = %08x\n", hr); + return hr; +} + +// *** IServiceProvider methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) +{ + WrapLogEnter("CMenuBandWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject); + + if (IsEqualIID(guidService, SID_SMenuBandChild)) + { + WrapLogMsg("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_SMenuBandBottom)) + { + WrapLogMsg("SID is SID_SMenuBandBottom. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_SMenuBandBottomSelected)) + { + WrapLogMsg("SID is SID_SMenuBandBottomSelected. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else + { + WrapLogMsg("SID not identified.\n"); + } + HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr); + return hr; +} + + +// *** IMenuPopup methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags); + HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags); + WrapLogExit("CMenuBandWrap::Popup() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnSelect(DWORD dwSelectType) +{ + WrapLogEnter("CMenuBandWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType); + HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType); + WrapLogExit("CMenuBandWrap::OnSelect() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet); + HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet); + WrapLogExit("CMenuBandWrap::SetSubMenu() = %08x\n", hr); + return hr; +} + + +// *** IDeskBar methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetClient(IUnknown *punkClient) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient); + HRESULT hr = m_IDeskBar->SetClient(punkClient); + WrapLogExit("CMenuBandWrap::SetClient() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetClient(IUnknown **ppunkClient) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient); + HRESULT hr = m_IDeskBar->GetClient(ppunkClient); + if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient); + WrapLogExit("CMenuBandWrap::GetClient() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnPosRectChangeDB(RECT *prc) +{ + WrapLogEnter("CMenuBandWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc); + HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc); + if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc)); + WrapLogExit("CMenuBandWrap::OnPosRectChangeDB() = %08x\n", hr); + return hr; +} + + +// *** IMenuBand methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsMenuMessage(MSG *pmsg) +{ + //WrapLogEnter("CMenuBandWrap<%p>::IsMenuMessage(MSG *pmsg=%p)\n", this, pmsg); + HRESULT hr = m_IMenuBand->IsMenuMessage(pmsg); + //WrapLogExit("CMenuBandWrap::IsMenuMessage() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet) +{ + //WrapLogEnter("CMenuBandWrap<%p>::TranslateMenuMessage(MSG *pmsg=%p, LRESULT *plRet=%p)\n", this, pmsg, plRet); + HRESULT hr = m_IMenuBand->TranslateMenuMessage(pmsg, plRet); + //WrapLogExit("CMenuBandWrap::TranslateMenuMessage(*plRet=%d) = %08x\n", *plRet, hr); + return hr; +} + +// *** IShellMenu methods *** +HRESULT STDMETHODCALLTYPE CMenuBandWrap::Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::Initialize(IShellMenuCallback *psmc=%p, UINT uId=%u, UINT uIdAncestor=%u, DWORD dwFlags=%08x)\n", this, psmc, uId, uIdAncestor, dwFlags); + HRESULT hr = m_IShellMenu->Initialize(psmc, uId, uIdAncestor, dwFlags); + WrapLogExit("CMenuBandWrap::Initialize() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetMenuInfo(IShellMenuCallback **ppsmc=%p, UINT *puId=%p, UINT *puIdAncestor=%p, DWORD *pdwFlags=%p)\n", this, ppsmc, puId, puIdAncestor, pdwFlags); + HRESULT hr = m_IShellMenu->GetMenuInfo(ppsmc, puId, puIdAncestor, pdwFlags); + if (ppsmc) WrapLogMsg("*ppsmc=%p\n", *ppsmc); + if (puId) WrapLogMsg("*puId=%u\n", *puId); + if (puIdAncestor) WrapLogMsg("*puIdAncestor=%u\n", *puIdAncestor); + if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags); + WrapLogExit("CMenuBandWrap::GetMenuInfo() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetShellFolder(IShellFolder *psf=%p, LPCITEMIDLIST pidlFolder=%p, HKEY hKey=%p, DWORD dwFlags=%08x)\n", this, psf, pidlFolder, hKey, dwFlags); + HRESULT hr = m_IShellMenu->SetShellFolder(psf, pidlFolder, hKey, dwFlags); + WrapLogExit("CMenuBandWrap::SetShellFolder() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetShellFolder(DWORD *pdwFlags=%p, LPITEMIDLIST *ppidl=%p, REFIID riid=%s, void **ppv=%p)\n", this, pdwFlags, ppidl, Wrap(riid), ppv); + HRESULT hr = m_IShellMenu->GetShellFolder(pdwFlags, ppidl, riid, ppv); + if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags); + if (ppidl) WrapLogMsg("*ppidl=%p\n", *ppidl); + if (ppv) WrapLogMsg("*ppv=%p\n", *ppv); + WrapLogExit("CMenuBandWrap::GetShellFolder() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetMenu(HMENU hmenu=%p, HWND hwnd=%p, DWORD dwFlags=%08x)\n", this, hmenu, hwnd, dwFlags); + HRESULT hr = m_IShellMenu->SetMenu(hmenu, hwnd, dwFlags); + WrapLogExit("CMenuBandWrap::SetMenu() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetMenu(HMENU *phmenu=%p, HWND *phwnd=%p, DWORD *pdwFlags=%p)\n", this, phmenu, phwnd, pdwFlags); + HRESULT hr = m_IShellMenu->GetMenu(phmenu, phwnd, pdwFlags); + if (phmenu) WrapLogMsg("*phmenu=%p\n", *phmenu); + if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd); + if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags); + WrapLogExit("CMenuBandWrap::GetMenu() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::InvalidateItem(LPSMDATA psmd, DWORD dwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::InvalidateItem(LPSMDATA psmd=%p, DWORD dwFlags=%08x)\n", this, psmd, dwFlags); + HRESULT hr = m_IShellMenu->InvalidateItem(psmd, dwFlags); + WrapLogExit("CMenuBandWrap::InvalidateItem() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetState(LPSMDATA psmd) +{ + WrapLogEnter("CMenuBandWrap<%p>::GetState(LPSMDATA psmd=%p)\n", this, psmd); + HRESULT hr = m_IShellMenu->GetState(psmd); + WrapLogExit("CMenuBandWrap::GetState() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMenuToolbar(IUnknown *punk, DWORD dwFlags) +{ + WrapLogEnter("CMenuBandWrap<%p>::SetMenuToolbar(IUnknown *punk=%p, DWORD dwFlags=%08x)\n", this, punk, dwFlags); + HRESULT hr = m_IShellMenu->SetMenuToolbar(punk, dwFlags); + WrapLogExit("CMenuBandWrap::SetMenuToolbar() = %08x\n", hr); + return hr; +} Propchange: branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp ------------------------------------------------------------------------------ svn:eol-style = CRLF Added: 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 (added) +++ branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp [iso-8859-1] Wed Feb 19 00:20:45 2014 @@ -0,0 +1,414 @@ +/* +* Shell Menu Desk Bar +* +* 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" + +class CMenuDeskBarWrap : + public CComCoClass<CMenuDeskBarWrap>, + public CComObjectRootEx<CComMultiThreadModelNoCS>, + public IOleCommandTarget, + public IServiceProvider, + public IInputObjectSite, + public IInputObject, + public IMenuPopup, + public IObjectWithSite, + public IBanneredBar, + public IInitializeObject +{ +public: + CMenuDeskBarWrap(); + ~CMenuDeskBarWrap(); + +private: + IUnknown * m_IUnknown; + IMenuPopup * m_IMenuPopup; + IOleCommandTarget * m_IOleCommandTarget; + IServiceProvider * m_IServiceProvider; + IDeskBar * m_IDeskBar; + IOleWindow * m_IOleWindow; + IInputObjectSite * m_IInputObjectSite; + IInputObject * m_IInputObject; + IObjectWithSite * m_IObjectWithSite; + IBanneredBar * m_IBanneredBar; + IInitializeObject * m_IInitializeObject; + +public: + // *** IMenuPopup methods *** + virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags); + virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType); + virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet); + + // *** IOleWindow methods *** + virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); + virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); + + // *** IObjectWithSite methods *** + virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); + virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite); + + // *** IBanneredBar methods *** + virtual HRESULT STDMETHODCALLTYPE SetIconSize(DWORD iIcon); + virtual HRESULT STDMETHODCALLTYPE GetIconSize(DWORD* piIcon); + virtual HRESULT STDMETHODCALLTYPE SetBitmap(HBITMAP hBitmap); + virtual HRESULT STDMETHODCALLTYPE GetBitmap(HBITMAP* phBitmap); + + // *** IInitializeObject methods *** + virtual HRESULT STDMETHODCALLTYPE Initialize(THIS); + + // *** IOleCommandTarget methods *** + 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); + + // *** IServiceProvider methods *** + virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); + + // *** IInputObjectSite methods *** + virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus); + + // *** IInputObject methods *** + virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg); + virtual HRESULT STDMETHODCALLTYPE HasFocusIO(THIS); + virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); + + // *** IDeskBar methods *** + virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient); + virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient); + virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc); + + DECLARE_NOT_AGGREGATABLE(CMenuDeskBarWrap) + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CMenuDeskBarWrap) + COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup) + COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) + COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) + COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) + COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) + COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup) + COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IMenuPopup) + COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) + COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar) + COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject) + END_COM_MAP() +}; + +extern "C" +HRESULT CMenuDeskBar_Wrapper(REFIID riid, LPVOID *ppv) +{ + *ppv = NULL; + + CMenuDeskBarWrap * deskbar = new CComObject<CMenuDeskBarWrap>(); + + if (!deskbar) + return E_OUTOFMEMORY; + + HRESULT hr = deskbar->QueryInterface(riid, ppv); + + if (FAILED(hr)) + deskbar->Release(); + + return hr; +} + +CMenuDeskBarWrap::CMenuDeskBarWrap() +{ + WrapLogOpen(); + + CoCreateInstance(CLSID_MenuDeskBar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IMenuPopup, &m_IMenuPopup)); + m_IMenuPopup->QueryInterface(IID_PPV_ARG(IUnknown, &m_IUnknown)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IBanneredBar, &m_IBanneredBar)); + m_IUnknown->QueryInterface(IID_PPV_ARG(IInitializeObject, &m_IInitializeObject)); +} + +CMenuDeskBarWrap::~CMenuDeskBarWrap() +{ + m_IUnknown->Release(); + m_IMenuPopup->Release(); + m_IOleCommandTarget->Release(); + m_IServiceProvider->Release(); + m_IDeskBar->Release(); + m_IOleWindow->Release(); + m_IInputObjectSite->Release(); + m_IInputObject->Release(); + m_IObjectWithSite->Release(); + m_IBanneredBar->Release(); + m_IInitializeObject->Release(); + + WrapLogClose(); +} + +// *** IMenuPopup methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags); + HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags); + WrapLogExit("CMenuDeskBarWrap::Popup() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnSelect(DWORD dwSelectType) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType); + HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType); + WrapLogExit("CMenuDeskBarWrap::OnSelect() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet); + HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet); + WrapLogExit("CMenuDeskBarWrap::SetSubMenu() = %08x\n", hr); + return hr; +} + +// *** IOleWindow methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetWindow(HWND *phwnd) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd); + HRESULT hr = m_IOleWindow->GetWindow(phwnd); + if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd); + WrapLogExit("CMenuDeskBarWrap::GetWindow() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::ContextSensitiveHelp(BOOL fEnterMode) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode); + HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode); + WrapLogExit("CMenuDeskBarWrap::ContextSensitiveHelp() = %08x\n", hr); + return hr; +} + +// *** IObjectWithSite methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSite(IUnknown *pUnkSite) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite); + HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite); + WrapLogExit("CMenuDeskBarWrap::SetSite() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetSite(REFIID riid, PVOID *ppvSite) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite); + HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite); + if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite); + WrapLogExit("CMenuDeskBarWrap::GetSite() = %08x\n", hr); + return hr; +} + +// *** IBanneredBar methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetIconSize(DWORD iIcon) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::SetIconSize(DWORD iIcon=%d)\n", this, iIcon); + HRESULT hr = m_IBanneredBar->SetIconSize(iIcon); + WrapLogExit("CMenuDeskBarWrap::SetIconSize() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetIconSize(DWORD* piIcon) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::GetIconSize(DWORD* piIcon=%p)\n", this, piIcon); + HRESULT hr = m_IBanneredBar->GetIconSize(piIcon); + if (piIcon) WrapLogMsg("*piIcon=%d\n", *piIcon); + WrapLogExit("CMenuDeskBarWrap::GetIconSize() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetBitmap(HBITMAP hBitmap) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::SetBitmap(HBITMAP hBitmap=%p)\n", this, hBitmap); + HRESULT hr = m_IBanneredBar->SetBitmap(hBitmap); + WrapLogExit("CMenuDeskBarWrap::SetBitmap() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetBitmap(HBITMAP* phBitmap) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::GetBitmap(HBITMAP* phBitmap=%p)\n", this, phBitmap); + HRESULT hr = m_IBanneredBar->GetBitmap(phBitmap); + if (phBitmap) WrapLogMsg("*phBitmap=%p\n", *phBitmap); + WrapLogExit("CMenuDeskBarWrap::GetBitmap() = %08x\n", hr); + return hr; +} + + +// *** IInitializeObject methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Initialize(THIS) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::Initialize()\n", this); + HRESULT hr = m_IInitializeObject->Initialize(); + WrapLogExit("CMenuDeskBarWrap::Initialize() = %08x\n", hr); + return hr; +} + +// *** IOleCommandTarget methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) +{ + WrapLogEnter("CMenuDeskBarWrap<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); + WrapLogExit("CMenuDeskBarWrap::QueryStatus() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + WrapLogEnter("CMenuDeskBarWrap<%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) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); + HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); + WrapLogExit("CMenuDeskBarWrap::Exec() = %08x\n", hr); + return hr; +} + +// *** IServiceProvider methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject); + + if (IsEqualIID(guidService, SID_SMenuPopup)) + { + WrapLogMsg("SID is SID_SMenuPopup. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_SMenuBandParent)) + { + WrapLogMsg("SID is SID_SMenuBandParent. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_STopLevelBrowser)) + { + WrapLogMsg("SID is SID_STopLevelBrowser. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else + { + WrapLogMsg("SID not identified. Calling wrapped object's QueryService.\n"); + } + HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr); + return hr; +} + +// *** IInputObjectSite methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus); + HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus); + WrapLogExit("CMenuDeskBarWrap::OnFocusChangeIS() = %08x\n", hr); + return hr; +} + +// *** IInputObject methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::UIActivateIO(BOOL bActivating, LPMSG lpMsg) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::UIActivateIO(BOOL bActivating=%d, LPMSG lpMsg=%p)\n", this, bActivating, lpMsg); + HRESULT hr = m_IInputObject->UIActivateIO(bActivating, lpMsg); + WrapLogExit("CMenuDeskBarWrap::UIActivateIO() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::HasFocusIO(THIS) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::HasFocusIO()\n", this); + HRESULT hr = m_IInputObject->HasFocusIO(); + WrapLogExit("CMenuDeskBarWrap::HasFocusIO() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::TranslateAcceleratorIO(LPMSG lpMsg) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg); + if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg)); + HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg); + WrapLogExit("CMenuDeskBarWrap::TranslateAcceleratorIO() = %08x\n", hr); + return hr; +} + +// *** IDeskBar methods *** +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetClient(IUnknown *punkClient) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient); + HRESULT hr = m_IDeskBar->SetClient(punkClient); + WrapLogExit("CMenuDeskBarWrap::SetClient() = %08x\n", hr); + + CComPtr<IDeskBarClient> dbc; + punkClient->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc)); + dbc->SetDeskBarSite(static_cast<IDeskBar*>(this)); + + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetClient(IUnknown **ppunkClient) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient); + HRESULT hr = m_IDeskBar->GetClient(ppunkClient); + if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient); + WrapLogExit("CMenuDeskBarWrap::GetClient() = %08x\n", hr); + return hr; +} + +HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnPosRectChangeDB(LPRECT prc) +{ + WrapLogEnter("CMenuDeskBarWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc); + HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc); + if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc)); + WrapLogExit("CMenuDeskBarWrap::OnPosRectChangeDB() = %08x\n", hr); + return hr; +} Propchange: branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp ------------------------------------------------------------------------------ svn:eol-style = CRLF 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 19 00:20:45 2014 @@ -1,7 +1,11 @@ -#define USE_BUILTIN_MENUDESKBAR -#define USE_BUILTIN_MENUSITE -#define USE_BUILTIN_MENUBAND +#define USE_SYSTEM_MENUDESKBAR 0 +#define USE_SYSTEM_MENUSITE 0 +#define USE_SYSTEM_MENUBAND 0 + +// if not using system above +#define WRAP_MENUDESKBAR 0 +#define WRAP_MENUBAND 0 #include <stdio.h> #include <tchar.h> @@ -34,6 +38,8 @@ #define SMC_EXEC 4 extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc); -extern "C" HRESULT CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); extern "C" HRESULT CMenuSite_Constructor(REFIID riid, LPVOID *ppv); extern "C" HRESULT CMenuBand_Constructor(REFIID riid, LPVOID *ppv); +extern "C" HRESULT CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); +extern "C" HRESULT CMenuBand_Wrapper(REFIID riid, LPVOID *ppv); +extern "C" HRESULT CMenuDeskBar_Wrapper(REFIID riid, LPVOID *ppv);
10 years, 10 months
1
0
0
0
[jgardou] 62251: [HIVECLS] - Add default application (iexplore) for html files.
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Feb 18 20:11:10 2014 New Revision: 62251 URL:
http://svn.reactos.org/svn/reactos?rev=62251&view=rev
Log: [HIVECLS] - Add default application (iexplore) for html files. Modified: trunk/reactos/boot/bootdata/hivecls.inf Modified: trunk/reactos/boot/bootdata/hivecls.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivecls.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivecls.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivecls.inf [iso-8859-1] Tue Feb 18 20:11:10 2014 @@ -127,11 +127,11 @@ HKCR,"chm.file\shell\open\command","",0x00020000,"%SystemRoot%\hh.exe %1" ; set MIME type for .html and .htm because Tiny webserver needs it -HKCR,".htm","",0x00000000,"html" +HKCR,".htm","",0x00000000,"htmlfile" HKCR,".htm","Content Type",0x00000000,"text/html" - -HKCR,".html","",0x00000000,"html" +HKCR,".html","",0x00000000,"htmlfile" HKCR,".html","Content Type",0x00000000,"text/html" +HKCR,"htmlfile\shell\open\command","",0x00020000,"""%programfiles%\Internet Explorer\iexplore.exe"" %1" ; Icons HKCR,".ico","",0x00000000,"icofile"
10 years, 10 months
1
0
0
0
[tkreuzer] 62250: [SPEC2DEF] Don't make exports by ordinal NONAME automatically. Fixes a bunch of tests. Thanks to Amine for finding the problem in the first place.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 18 20:06:50 2014 New Revision: 62250 URL:
http://svn.reactos.org/svn/reactos?rev=62250&view=rev
Log: [SPEC2DEF] Don't make exports by ordinal NONAME automatically. Fixes a bunch of tests. Thanks to Amine for finding the problem in the first place. Modified: trunk/reactos/tools/spec2def/spec2def.c Modified: trunk/reactos/tools/spec2def/spec2def.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
============================================================================== --- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original) +++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Tue Feb 18 20:06:50 2014 @@ -51,6 +51,7 @@ FL_PRIVATE = 1, FL_STUB = 2, FL_NONAME = 4, + FL_ORDINAL = 8, }; enum @@ -476,7 +477,7 @@ else OutputLine_def_GCC(fileDest, pexp); - if (pexp->nOrdinal != -1) + if (pexp->uFlags & FL_ORDINAL) { fprintf(fileDest, " @%d", pexp->nOrdinal); } @@ -541,8 +542,13 @@ // nLine, TokenLength(pc), pc); /* Now we should get either an ordinal or @ */ - if (*pc == '@') exp.nOrdinal = -1; - else exp.nOrdinal = atol(pc); + if (*pc == '@') + exp.nOrdinal = -1; + else + { + exp.nOrdinal = atol(pc); + exp.uFlags |= FL_ORDINAL; + } /* Go to next token (type) */ if (!(pc = NextToken(pc))) @@ -627,10 +633,13 @@ { exp.uFlags |= FL_PRIVATE; } - else if (CompareToken(pc, "-noname") || - CompareToken(pc, "-ordinal")) - { - exp.uFlags |= FL_NONAME; + else if (CompareToken(pc, "-noname")) + { + exp.uFlags |= FL_ORDINAL | FL_NONAME; + } + else if (CompareToken(pc, "-ordinal")) + { + exp.uFlags |= FL_ORDINAL; } else if (CompareToken(pc, "-stub")) { @@ -667,7 +676,7 @@ sprintf(namebuffer, "ordinal%d", exp.nOrdinal); exp.strName.len = strlen(namebuffer); exp.strName.buf = namebuffer; - exp.uFlags |= FL_NONAME; + exp.uFlags |= FL_ORDINAL | FL_NONAME; } /* Handle parameters */ @@ -804,9 +813,10 @@ } /* Check for no-name without ordinal */ - if ((exp.uFlags & FL_NONAME) && (exp.nOrdinal == -1)) - { - fprintf(stderr, "error: line %d, noname export without ordinal!\n", nLine); + if ((exp.uFlags & FL_ORDINAL) && (exp.nOrdinal == -1)) + { + fprintf(stderr, "error: line %d, ordinal export without ordinal!\n", nLine); + return -1; } OutputLine(fileDest, &exp);
10 years, 10 months
1
0
0
0
[tkreuzer] 62249: [NTOSKRNL] Fix returned symbolic links in IoGetDeviceInterfaces.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 18 19:53:48 2014 New Revision: 62249 URL:
http://svn.reactos.org/svn/reactos?rev=62249&view=rev
Log: [NTOSKRNL] Fix returned symbolic links in IoGetDeviceInterfaces. Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/deviface…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] Tue Feb 18 19:53:48 2014 @@ -466,7 +466,7 @@ goto cleanup; } - /* Enumerate subkeys (ie the different device objets) */ + /* Enumerate subkeys (i.e. the different device objects) */ while (TRUE) { Status = ZwEnumerateKey( @@ -729,14 +729,17 @@ Status = STATUS_UNSUCCESSFUL; goto cleanup; } - KeyName.Length = KeyName.MaximumLength = (USHORT)bip->DataLength - 4 * sizeof(WCHAR); - KeyName.Buffer = &((PWSTR)bip->Data)[4]; + KeyName.Length = KeyName.MaximumLength = (USHORT)bip->DataLength; + KeyName.Buffer = (PWSTR)bip->Data; + + /* Fixup the prefix (from "\\?\") */ + RtlCopyMemory(KeyName.Buffer, L"\\??\\", 4 * sizeof(WCHAR)); /* Add new symbolic link to symbolic link list */ if (ReturnBuffer.Length + KeyName.Length + sizeof(WCHAR) > ReturnBuffer.MaximumLength) { PWSTR NewBuffer; - ReturnBuffer.MaximumLength = (USHORT)max(ReturnBuffer.MaximumLength * 2, + ReturnBuffer.MaximumLength = (USHORT)max(ReturnBuffer.MaximumLength * sizeof(WCHAR), (USHORT)(ReturnBuffer.Length + KeyName.Length + 2 * sizeof(WCHAR)));
10 years, 10 months
1
0
0
0
[dquintana] 62248: [RSHELL] * Fix some more C-style casts, and misc coding style changes. * CMenuBand: Create a skeleton of the functions that would handle SMIF_TRACKPOPUP submenus. * CMenuDeskBar:...
by dquintana@svn.reactos.org
Author: dquintana Date: Tue Feb 18 18:18:08 2014 New Revision: 62248 URL:
http://svn.reactos.org/svn/reactos?rev=62248&view=rev
Log: [RSHELL] * Fix some more C-style casts, and misc coding style changes. * CMenuBand: Create a skeleton of the functions that would handle SMIF_TRACKPOPUP submenus. * CMenuDeskBar: Fix the redraw issue that prevented submenus from working as expected. CORE-7886 Modified: branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp branches/shell-experiments/base/shell/rshell/CMenuBand.cpp branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp branches/shell-experiments/base/shell/rshell/CMenuSite.cpp branches/shell-experiments/base/shell/rshell/CStartMenu.cpp Modified: branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp [iso-8859-1] Tue Feb 18 18:18:08 2014 @@ -402,7 +402,7 @@ switch (uMsg) { case WM_ERASEBKGND: - return (LRESULT) PaintDesktop((HDC) wParam); + return (LRESULT) PaintDesktop(reinterpret_cast<HDC>(wParam)); case WM_GETISHELLBROWSER: Ret = reinterpret_cast<LRESULT>(static_cast<IShellBrowser *>(pThis)); @@ -456,7 +456,7 @@ case WM_NCCREATE: { - LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT) lParam; + LPCREATESTRUCT CreateStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); pThis = SHDESK_Create(hwnd, CreateStruct); if (pThis == NULL) { @@ -466,7 +466,7 @@ SetWindowLongPtrW(hwnd, 0, - (LONG_PTR) pThis); + reinterpret_cast<LONG_PTR>(pThis)); Ret = TRUE; break; } @@ -543,7 +543,7 @@ hWndDesk = CreateWindowExW(0, szProgmanClassName, szProgmanWindowName, WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, rcDesk.left, rcDesk.top, rcDesk.right, rcDesk.bottom, - NULL, NULL, shell32_hInstance, (LPVOID) ShellDesk); + NULL, NULL, shell32_hInstance, reinterpret_cast<LPVOID>(ShellDesk)); if (hWndDesk != NULL) return (HANDLE) GetWindowLongPtrW(hWndDesk, 0); Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Tue Feb 18 18:18:08 2014 @@ -23,7 +23,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand); -#define WRAP_LOG 1 +#define WRAP_LOG 0 #define TBSTYLE_EX_VERTICAL 4 @@ -56,6 +56,7 @@ HRESULT OnHotItemChange(const NMTBHOTITEM * hot); HRESULT PopupSubMenu(UINT index, IShellMenu* childShellMenu); + HRESULT PopupSubMenu(UINT index, HMENU menu); HRESULT DoContextMenu(IContextMenu* contextMenu); static LRESULT CALLBACK s_SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -68,7 +69,7 @@ CMenuBand *m_menuBand; HWND m_hwnd; DWORD m_dwMenuFlags; - UINT m_hotItem; + INT m_hotItem; WNDPROC m_SubclassOld; }; @@ -164,6 +165,7 @@ DWORD m_dwFlags; PVOID m_UserData; HMENU m_hmenu; + HWND m_menuOwner; #endif BOOL m_useBigIcons; @@ -254,6 +256,7 @@ HRESULT CallCBWithId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam); HRESULT CallCBWithPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM lParam); + HRESULT TrackPopup(HMENU popup, INT x, INT y, RECT& rc); BOOL UseBigIcons() { return m_useBigIcons; @@ -868,11 +871,11 @@ if (m_menuBand->UseBigIcons()) { - SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, (LPARAM) ilBig); + SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(ilBig)); } else { - SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, (LPARAM) ilSmall); + SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(ilSmall)); } return S_OK; @@ -934,15 +937,15 @@ //else if (m_menuBand->UseBigIcons()) { - SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, (LPARAM) ilBig); + SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(ilBig)); } else { - SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, (LPARAM) ilSmall); - } - - SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); - m_SubclassOld = (WNDPROC) SetWindowLongPtr(m_hwnd, GWLP_WNDPROC, (LONG_PTR) CMenuToolbarBase::s_SubclassProc); + SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(ilSmall)); + } + + SetWindowLongPtr(m_hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); + m_SubclassOld = (WNDPROC) SetWindowLongPtr(m_hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(CMenuToolbarBase::s_SubclassProc)); return S_OK; } @@ -1009,7 +1012,7 @@ HRESULT hr; RECT rc; - if (!SendMessage(m_hwnd, TB_GETITEMRECT, index, (LPARAM) &rc)) + if (!SendMessage(m_hwnd, TB_GETITEMRECT, index, reinterpret_cast<LPARAM>(&rc))) return E_FAIL; POINT a = { rc.left, rc.top }; @@ -1062,6 +1065,27 @@ return S_OK; } +HRESULT CMenuToolbarBase::PopupSubMenu(UINT index, HMENU menu) +{ + RECT rc; + if (!SendMessage(m_hwnd, TB_GETITEMRECT, index, reinterpret_cast<LPARAM>(&rc))) + return E_FAIL; + + POINT a = { rc.left, rc.top }; + POINT b = { rc.right, rc.bottom }; + + ClientToScreen(m_hwnd, &a); + ClientToScreen(m_hwnd, &b); + + SetRect(&rc, a.x, a.y, b.x, b.y); // maybe-TODO: fetch client area of deskbar? + + HMENU popup = GetSubMenu(menu, index); + + m_menuBand->TrackPopup(popup, rc.right, rc.bottom, rc); + + return S_OK; +} + HRESULT CMenuToolbarBase::DoContextMenu(IContextMenu* contextMenu) { HRESULT hr; @@ -1174,11 +1198,13 @@ tbb.iString = (INT_PTR) MenuString; tbb.idCommand = info.wID; - SMINFO sminfo = { 0 }; - sminfo.dwMask = SMIM_ICON; - if (info.wID >= 0 && SUCCEEDED(m_menuBand->CallCBWithId(info.wID, SMC_GETINFO, 0, (LPARAM) &sminfo))) + SMINFO * sminfo = new SMINFO(); + sminfo->dwMask = SMIM_ICON | SMIM_FLAGS; + if (info.wID >= 0 && SUCCEEDED(m_menuBand->CallCBWithId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo)))) { - tbb.iBitmap = sminfo.iIcon; + tbb.iBitmap = sminfo->iIcon; + tbb.dwData = reinterpret_cast<DWORD_PTR>(sminfo); + // FIXME: remove before deleting the toolbar or it will leak } } else @@ -1186,7 +1212,7 @@ tbb.fsStyle |= BTNS_SEP; } - SendMessageW(m_hwnd, TB_ADDBUTTONS, 1, (LPARAM) (LPTBBUTTON) &tbb); + SendMessageW(m_hwnd, TB_ADDBUTTONS, 1, reinterpret_cast<LPARAM>(&tbb)); if (MenuString) HeapFree(GetProcessHeap(), 0, MenuString); @@ -1198,7 +1224,7 @@ HRESULT CMenuStaticToolbar::OnContextMenu(NMMOUSE * rclick) { CComPtr<IContextMenu> contextMenu; - HRESULT hr = m_menuBand->CallCBWithId(rclick->dwItemSpec, SMC_GETOBJECT, (WPARAM) &IID_IContextMenu, (LPARAM) &contextMenu); + HRESULT hr = m_menuBand->CallCBWithId(rclick->dwItemSpec, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IContextMenu), reinterpret_cast<LPARAM>(&contextMenu)); if (hr != S_OK) return hr; @@ -1216,19 +1242,30 @@ HRESULT CMenuStaticToolbar::PopupItem(UINT uItem) { - CComPtr<IShellMenu> shellMenu; - HRESULT hr = m_menuBand->CallCBWithId(uItem, SMC_GETOBJECT, (WPARAM) &IID_IShellMenu, (LPARAM) &shellMenu); - if (FAILED(hr)) - return hr; - TBBUTTONINFO info = { 0 }; info.cbSize = sizeof(TBBUTTONINFO); info.dwMask = 0; - int index = SendMessage(m_hwnd, TB_GETBUTTONINFO, uItem, (LPARAM) &info); + int index = SendMessage(m_hwnd, TB_GETBUTTONINFO, uItem, reinterpret_cast<LPARAM>(&info)); if (index < 0) return E_FAIL; - - return PopupSubMenu(index, shellMenu); + + TBBUTTON btn = { 0 }; + SendMessage(m_hwnd, TB_GETBUTTON, index, reinterpret_cast<LPARAM>(&btn)); + + SMINFO * nfo = reinterpret_cast<SMINFO*>(btn.dwData); + if (nfo->dwFlags&SMIF_TRACKPOPUP) + { + return PopupSubMenu(index, m_hmenu); + } + else + { + CComPtr<IShellMenu> shellMenu; + HRESULT hr = m_menuBand->CallCBWithId(uItem, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IShellMenu), reinterpret_cast<LPARAM>(&shellMenu)); + if (FAILED(hr)) + return hr; + + return PopupSubMenu(index, shellMenu); + } } HRESULT CMenuStaticToolbar::HasSubMenu(UINT uItem) @@ -1236,7 +1273,7 @@ TBBUTTONINFO info = { 0 }; info.cbSize = sizeof(TBBUTTONINFO); info.dwMask = 0; - int index = SendMessage(m_hwnd, TB_GETBUTTONINFO, uItem, (LPARAM) &info); + int index = SendMessage(m_hwnd, TB_GETBUTTONINFO, uItem, reinterpret_cast<LPARAM>(&info)); if (index < 0) return E_FAIL; return ::GetSubMenu(m_hmenu, index) ? S_OK : S_FALSE; @@ -1265,7 +1302,7 @@ IEnumIDList * eidl; m_shellFolder->EnumObjects(m_hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &eidl); - LPITEMIDLIST item = (LPITEMIDLIST) CoTaskMemAlloc(sizeof(ITEMIDLIST)); + LPITEMIDLIST item = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(sizeof(ITEMIDLIST))); ULONG fetched; while ((hr = eidl->Next(1, &item, &fetched)) == S_OK) { @@ -1292,9 +1329,10 @@ tbb.idCommand = i++; tbb.iString = (INT_PTR) MenuString; tbb.iBitmap = index; - tbb.dwData = (DWORD_PTR) ILClone(item); - - SendMessageW(m_hwnd, TB_ADDBUTTONS, 1, (LPARAM) (LPTBBUTTON) &tbb); + tbb.dwData = reinterpret_cast<DWORD_PTR>(ILClone(item)); + // FIXME: remove before deleting the toolbar or it will leak + + SendMessageW(m_hwnd, TB_ADDBUTTONS, 1, reinterpret_cast<LPARAM>(&tbb)); HeapFree(GetProcessHeap(), 0, MenuString); } @@ -1348,7 +1386,7 @@ TBBUTTONINFO info = { 0 }; info.cbSize = sizeof(TBBUTTONINFO); info.dwMask = 0; - int index = SendMessage(m_hwnd, TB_GETBUTTONINFO, uItem, (LPARAM) &info); + int index = SendMessage(m_hwnd, TB_GETBUTTONINFO, uItem, reinterpret_cast<LPARAM>(&info)); if (index < 0) return NULL; @@ -1356,10 +1394,10 @@ *pIndex = index; TBBUTTON btn = { 0 }; - if (!SendMessage(m_hwnd, TB_GETBUTTON, index, (LPARAM) &btn)) + if (!SendMessage(m_hwnd, TB_GETBUTTON, index, reinterpret_cast<LPARAM>(&btn))) return NULL; - return (LPITEMIDLIST) btn.dwData; + return reinterpret_cast<LPITEMIDLIST>(btn.dwData); } HRESULT CMenuSFToolbar::OnContextMenu(NMMOUSE * rclick) @@ -1479,7 +1517,7 @@ { m_psmc->AddRef(); - _CallCB(SMC_CREATE, 0, (LPARAM) &m_UserData); + _CallCB(SMC_CREATE, 0, reinterpret_cast<LPARAM>(&m_UserData)); } return S_OK; @@ -1518,6 +1556,7 @@ m_staticToolbar = new CMenuStaticToolbar(this); } m_hmenu = hmenu; + m_menuOwner; HRESULT hResult = m_staticToolbar->SetMenu(hmenu, hwnd, dwFlags); if (FAILED(hResult)) @@ -1635,8 +1674,8 @@ if (hwndStatic == NULL && hwndShlFld == NULL) return E_FAIL; - if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, (LPARAM) &sizeStaticY); - if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, (LPARAM) &sizeShlFldY); + if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, reinterpret_cast<LPARAM>(&sizeStaticY)); + if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, reinterpret_cast<LPARAM>(&sizeShlFldY)); int sy = max(prc->bottom - prc->top, sizeStaticY.cy + sizeShlFldY.cy); @@ -1699,8 +1738,8 @@ SIZE sizeStatic = { 0 }; SIZE sizeShlFld = { 0 }; - if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, (LPARAM) &sizeStatic); - if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, (LPARAM) &sizeShlFld); + if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, reinterpret_cast<LPARAM>(&sizeStatic)); + if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, reinterpret_cast<LPARAM>(&sizeShlFld)); pdbi->ptMinSize.x = 0; pdbi->ptMinSize.y = sizeStatic.cy + sizeShlFld.cy; @@ -1710,8 +1749,8 @@ SIZE sizeStatic = { 0 }; SIZE sizeShlFld = { 0 }; - if (hwndStatic) SendMessageW(hwndStatic, TB_GETMAXSIZE, 0, (LPARAM) &sizeStatic); - if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETMAXSIZE, 0, (LPARAM) &sizeShlFld); + if (hwndStatic) SendMessageW(hwndStatic, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&sizeStatic)); + if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&sizeShlFld)); pdbi->ptMaxSize.x = max(sizeStatic.cx, sizeShlFld.cx); // ignored pdbi->ptMaxSize.y = sizeStatic.cy + sizeShlFld.cy; @@ -1726,12 +1765,12 @@ SIZE sizeStatic = { 0 }; SIZE sizeShlFld = { 0 }; - if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, FALSE, (LPARAM) &sizeStatic); - if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, FALSE, (LPARAM) &sizeShlFld); + if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&sizeStatic)); + if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&sizeShlFld)); pdbi->ptActual.x = max(sizeStatic.cx, sizeShlFld.cx); - if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, (LPARAM) &sizeStatic); - if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, (LPARAM) &sizeShlFld); + if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, reinterpret_cast<LPARAM>(&sizeStatic)); + if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, reinterpret_cast<LPARAM>(&sizeShlFld)); pdbi->ptActual.y = sizeStatic.cy + sizeShlFld.cy; } if (pdbi->dwMask & DBIM_TITLE) @@ -2196,4 +2235,10 @@ smData.psf->Release(); return hr; } + +HRESULT CMenuBand::TrackPopup(HMENU popup, INT x, INT y, RECT& rc) +{ + ::TrackPopupMenu(popup, 0, x, y, 0, m_menuOwner, &rc); + return S_OK; +} #endif Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Tue Feb 18 18:18:08 2014 @@ -24,7 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuDeskBar); -#define WRAP_LOG 1 +#define WRAP_LOG 0 typedef CWinTraits< WS_POPUP | WS_DLGFRAME | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, @@ -680,7 +680,7 @@ LRESULT CMenuDeskBar::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { - TRACE("OnPaint\n"); + bHandled = FALSE; if (m_Banner && !m_IconSize) { @@ -716,7 +716,7 @@ EndPaint(&ps); } - return 0; + return TRUE; } HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) @@ -849,7 +849,7 @@ case MPOS_EXECUTE: bubbleUp = true; cancel = true; - // fall through + break; case MPOS_CANCELLEVEL: cancel = true; break; @@ -857,9 +857,9 @@ case MPOS_SELECTRIGHT: // if unhandled, spread upwards? bubbleUp = true; - return S_OK; + break; case MPOS_CHILDTRACKING: - return S_OK; + break; } if (cancel) 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] Tue Feb 18 18:18:08 2014 @@ -24,6 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(menusite); +#if 0 bool _assert(bool cond, LPCSTR expr, LPCSTR file, DWORD line, LPCSTR func) { #if DBG @@ -36,6 +37,9 @@ return cond; } #define DBGASSERT(x) _assert(!!(x), #x, __FILE__, __LINE__, __FUNCSIG__) +#else +#define DBGASSERT(x) (!!(x)) +#endif class CMenuSite : public CComObjectRootEx<CComMultiThreadModelNoCS>, Modified: branches/shell-experiments/base/shell/rshell/CStartMenu.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] Tue Feb 18 18:18:08 2014 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define TEST_TRACKPOPUPMENU_SUBMENUS +//#define TEST_TRACKPOPUPMENU_SUBMENUS #include "precomp.h"
10 years, 10 months
1
0
0
0
[tkreuzer] 62247: [NTOSKRNL] Implement PspSetQuotaLimits and use it in NtSetInformationProcess
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 18 18:12:30 2014 New Revision: 62247 URL:
http://svn.reactos.org/svn/reactos?rev=62247&view=rev
Log: [NTOSKRNL] Implement PspSetQuotaLimits and use it in NtSetInformationProcess Modified: trunk/reactos/ntoskrnl/include/internal/mm.h trunk/reactos/ntoskrnl/include/internal/ps.h trunk/reactos/ntoskrnl/ps/query.c trunk/reactos/ntoskrnl/ps/quota.c Modified: trunk/reactos/ntoskrnl/include/internal/mm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Tue Feb 18 18:12:30 2014 @@ -1767,6 +1767,17 @@ ULONG Tag); +/* mmsup.c *****************************************************************/ + +NTSTATUS +NTAPI +MmAdjustWorkingSetSize( + IN SIZE_T WorkingSetMinimumInBytes, + IN SIZE_T WorkingSetMaximumInBytes, + IN ULONG SystemCache, + IN BOOLEAN IncreaseOkay); + + /* session.c *****************************************************************/ _IRQL_requires_max_(APC_LEVEL) Modified: trunk/reactos/ntoskrnl/include/internal/ps.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ps.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ps.h [iso-8859-1] Tue Feb 18 18:12:30 2014 @@ -299,6 +299,15 @@ PspDestroyQuotaBlock( IN PEPROCESS Process ); + +NTSTATUS +NTAPI +PspSetQuotaLimits( + _In_ HANDLE ProcessHandle, + _In_ ULONG Unused, + _In_ PVOID QuotaLimits, + _In_ ULONG QuotaLimitsLength, + _In_ KPROCESSOR_MODE PreviousMode); #if defined(_X86_) // Modified: trunk/reactos/ntoskrnl/ps/query.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=62…
============================================================================== --- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Tue Feb 18 18:12:30 2014 @@ -1917,9 +1917,12 @@ break; case ProcessQuotaLimits: - DPRINT1("Quota Limits not implemented\n"); - Status = STATUS_NOT_IMPLEMENTED; - break; + + return PspSetQuotaLimits(ProcessHandle, + 1, + ProcessInformation, + ProcessInformationLength, + PreviousMode); case ProcessWorkingSetWatch: DPRINT1("WS watch not implemented\n"); Modified: trunk/reactos/ntoskrnl/ps/quota.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/quota.c?rev=62…
============================================================================== --- trunk/reactos/ntoskrnl/ps/quota.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/quota.c [iso-8859-1] Tue Feb 18 18:12:30 2014 @@ -11,10 +11,19 @@ /* INCLUDES **************************************************************/ #include <ntoskrnl.h> +#include <ntintsafe.h> #define NDEBUG #include <debug.h> EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock; +static LIST_ENTRY PspQuotaBlockList = {&PspQuotaBlockList, &PspQuotaBlockList}; +static KSPIN_LOCK PspQuotaLock; + +#define TAG_QUOTA_BLOCK 'bQsP' +#define VALID_QUOTA_FLAGS (QUOTA_LIMITS_HARDWS_MIN_ENABLE | \ + QUOTA_LIMITS_HARDWS_MIN_DISABLE | \ + QUOTA_LIMITS_HARDWS_MAX_ENABLE | \ + QUOTA_LIMITS_HARDWS_MAX_DISABLE) /* PRIVATE FUNCTIONS *******************************************************/ @@ -118,13 +127,29 @@ VOID NTAPI +PspInsertQuotaBlock( + PEPROCESS_QUOTA_BLOCK QuotaBlock) +{ + KIRQL OldIrql; + + OldIrql = KfAcquireSpinLock(&PspQuotaLock); + InsertTailList(&PspQuotaBlockList, &QuotaBlock->QuotaList); + KfReleaseSpinLock(&PspQuotaLock, OldIrql); +} + +VOID +NTAPI PspDestroyQuotaBlock(PEPROCESS Process) { PEPROCESS_QUOTA_BLOCK QuotaBlock = Process->QuotaBlock; + KIRQL OldIrql; if (QuotaBlock != &PspDefaultQuotaBlock && InterlockedDecrementUL(&QuotaBlock->ReferenceCount) == 0) { + OldIrql = KfAcquireSpinLock(&PspQuotaLock); + RemoveEntryList(&QuotaBlock->QuotaList); + KfReleaseSpinLock(&PspQuotaLock, OldIrql); ExFreePool(QuotaBlock); } } @@ -264,4 +289,181 @@ return STATUS_SUCCESS; } +NTSTATUS +NTAPI +PspSetQuotaLimits( + _In_ HANDLE ProcessHandle, + _In_ ULONG Unused, + _In_ PVOID QuotaLimits, + _In_ ULONG QuotaLimitsLength, + _In_ KPROCESSOR_MODE PreviousMode) +{ + QUOTA_LIMITS_EX CapturedQuotaLimits; + PEPROCESS Process; + PEPROCESS_QUOTA_BLOCK QuotaBlock, OldQuotaBlock; + BOOLEAN IncreaseOkay; + KAPC_STATE SavedApcState; + NTSTATUS Status; + + UNREFERENCED_PARAMETER(Unused); + + _SEH2_TRY + { + ProbeForRead(QuotaLimits, QuotaLimitsLength, sizeof(ULONG)); + + /* Check if we have the basic or extended structure */ + if (QuotaLimitsLength == sizeof(QUOTA_LIMITS)) + { + /* Copy the basic structure, zero init the remaining fields */ + RtlCopyMemory(&CapturedQuotaLimits, QuotaLimits, sizeof(QUOTA_LIMITS)); + CapturedQuotaLimits.WorkingSetLimit = 0; + CapturedQuotaLimits.Reserved2 = 0; + CapturedQuotaLimits.Reserved3 = 0; + CapturedQuotaLimits.Reserved4 = 0; + CapturedQuotaLimits.CpuRateLimit.RateData = 0; + CapturedQuotaLimits.Flags = 0; + } + else if (QuotaLimitsLength == sizeof(QUOTA_LIMITS_EX)) + { + /* Copy the full structure */ + RtlCopyMemory(&CapturedQuotaLimits, QuotaLimits, sizeof(QUOTA_LIMITS_EX)); + + /* Verify that the caller passed valid flags */ + if ((CapturedQuotaLimits.Flags & ~VALID_QUOTA_FLAGS) || + ((CapturedQuotaLimits.Flags & QUOTA_LIMITS_HARDWS_MIN_ENABLE) && + (CapturedQuotaLimits.Flags & QUOTA_LIMITS_HARDWS_MIN_DISABLE)) || + ((CapturedQuotaLimits.Flags & QUOTA_LIMITS_HARDWS_MAX_ENABLE) && + (CapturedQuotaLimits.Flags & QUOTA_LIMITS_HARDWS_MAX_DISABLE))) + { + DPRINT1("Invalid quota flags: 0x%lx\n", CapturedQuotaLimits.Flags); + return STATUS_INVALID_PARAMETER; + } + + /* Verify that the caller didn't pass reserved values */ + if ((CapturedQuotaLimits.WorkingSetLimit != 0) || + (CapturedQuotaLimits.Reserved2 != 0) || + (CapturedQuotaLimits.Reserved3 != 0) || + (CapturedQuotaLimits.Reserved4 != 0) || + (CapturedQuotaLimits.CpuRateLimit.RateData != 0)) + { + DPRINT1("Invalid value: (%lx,%lx,%lx,%lx,%lx)\n", + CapturedQuotaLimits.WorkingSetLimit, + CapturedQuotaLimits.Reserved2, + CapturedQuotaLimits.Reserved3, + CapturedQuotaLimits.Reserved4, + CapturedQuotaLimits.CpuRateLimit.RateData); + return STATUS_INVALID_PARAMETER; + } + } + else + { + DPRINT1("Invalid quota size: 0x%lx\n", QuotaLimitsLength); + return STATUS_INFO_LENGTH_MISMATCH; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + DPRINT1("Exception while copying data\n"); + return _SEH2_GetExceptionCode(); + } + _SEH2_END; + + /* Reference the process */ + Status = ObReferenceObjectByHandle(ProcessHandle, + PROCESS_SET_QUOTA, + PsProcessType, + PreviousMode, + (PVOID*)&Process, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to reference process handle: 0x%lx\n", Status); + return Status; + } + + /* Check the caller changes the working set size limits */ + if ((CapturedQuotaLimits.MinimumWorkingSetSize != 0) && + (CapturedQuotaLimits.MaximumWorkingSetSize != 0)) + { + /* Check for special case: trimming the WS */ + if ((CapturedQuotaLimits.MinimumWorkingSetSize == SIZE_T_MAX) && + (CapturedQuotaLimits.MaximumWorkingSetSize == SIZE_T_MAX)) + { + /* No increase allowed */ + IncreaseOkay = FALSE; + } + else + { + /* Check if the caller has the required privilege */ + IncreaseOkay = SeSinglePrivilegeCheck(SeIncreaseQuotaPrivilege, + PreviousMode); + } + + /* Attach to the target process and disable APCs */ + KeStackAttachProcess(&Process->Pcb, &SavedApcState); + KeEnterGuardedRegion(); + + /* Call Mm to adjust the process' working set size */ + Status = MmAdjustWorkingSetSize(CapturedQuotaLimits.MinimumWorkingSetSize, + CapturedQuotaLimits.MaximumWorkingSetSize, + 0, + IncreaseOkay); + + /* Bring back APCs and detach from the process */ + KeLeaveGuardedRegion(); + KeUnstackDetachProcess(&SavedApcState); + } + else if (Process->QuotaBlock == &PspDefaultQuotaBlock) + { + /* Check if the caller has the required privilege */ + if (!SeSinglePrivilegeCheck(SeIncreaseQuotaPrivilege, PreviousMode)) + { + ObDereferenceObject(Process); + return STATUS_PRIVILEGE_NOT_HELD; + } + + /* Allocate a new quota block */ + QuotaBlock = ExAllocatePoolWithTag(NonPagedPool, + sizeof(EPROCESS_QUOTA_BLOCK), + TAG_QUOTA_BLOCK); + if (QuotaBlock == NULL) + { + ObDereferenceObject(Process); + return STATUS_NO_MEMORY; + } + + /* Initialize the quota block */ + QuotaBlock->ReferenceCount = 1; + QuotaBlock->ProcessCount = 1; + QuotaBlock->QuotaEntry[0].Peak = Process->QuotaPeak[0]; + QuotaBlock->QuotaEntry[1].Peak = Process->QuotaPeak[1]; + QuotaBlock->QuotaEntry[2].Peak = Process->QuotaPeak[2]; + QuotaBlock->QuotaEntry[0].Limit = PspDefaultQuotaBlock.QuotaEntry[0].Limit; + QuotaBlock->QuotaEntry[1].Limit = PspDefaultQuotaBlock.QuotaEntry[1].Limit; + QuotaBlock->QuotaEntry[2].Limit = PspDefaultQuotaBlock.QuotaEntry[2].Limit; + + /* Try to exchange the quota block, if that failed, just drop it */ + OldQuotaBlock = InterlockedCompareExchangePointer(&Process->QuotaBlock, + QuotaBlock, + &PspDefaultQuotaBlock); + if (OldQuotaBlock == &PspDefaultQuotaBlock) + { + /* Success, insert the new quota block */ + PspInsertQuotaBlock(QuotaBlock); + } + else + { + /* Failed, free the quota block and ignore it */ + ExFreePoolWithTag(QuotaBlock, TAG_QUOTA_BLOCK); + } + + Status = STATUS_SUCCESS; + } + + /* Dereference the process and return the status */ + ObDereferenceObject(Process); + return Status; +} + + /* EOF */
10 years, 10 months
1
0
0
0
[tkreuzer] 62246: [NTOSKRNL] Implement TokenOrigin case in NtSetInformationToken
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 18 17:57:47 2014 New Revision: 62246 URL:
http://svn.reactos.org/svn/reactos?rev=62246&view=rev
Log: [NTOSKRNL] Implement TokenOrigin case in NtSetInformationToken Modified: trunk/reactos/ntoskrnl/se/token.c Modified: trunk/reactos/ntoskrnl/se/token.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/token.c?rev=62…
============================================================================== --- trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] Tue Feb 18 17:57:47 2014 @@ -2042,13 +2042,44 @@ break; } - - case TokenOrigin: { - DPRINT1("Unhandled TokenInformationClass: 0x%lx\n", - TokenInformationClass); - Status = STATUS_NOT_IMPLEMENTED; + TOKEN_ORIGIN TokenOrigin; + + _SEH2_TRY + { + /* Copy the token origin */ + TokenOrigin = *(PTOKEN_ORIGIN)TokenInformation; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + goto Cleanup; + } + _SEH2_END; + + /* Check for TCB privilege */ + if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode)) + { + Status = STATUS_PRIVILEGE_NOT_HELD; + break; + } + + /* Lock the token */ + SepAcquireTokenLockExclusive(Token); + + /* Check if there is no token origin set yet */ + if ((Token->OriginatingLogonSession.LowPart == 0) && + (Token->OriginatingLogonSession.HighPart == 0)) + { + /* Set the token origin */ + Token->OriginatingLogonSession = + TokenOrigin.OriginatingLogonSession; + } + + /* Unlock the token */ + SepReleaseTokenLock(Token); + break; } @@ -2062,6 +2093,11 @@ } Cleanup: ObDereferenceObject(Token); + } + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtSetInformationToken failed with Status 0x%lx\n", Status); } return Status;
10 years, 10 months
1
0
0
0
[tkreuzer] 62245: [NTOSKRNL] - Implement SeCheckAuditPrivilege and use it instead of SeSinglePrivilegeCheck, because the latter uses the effective token and we want the primary token - Implement Se...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 18 17:51:45 2014 New Revision: 62245 URL:
http://svn.reactos.org/svn/reactos?rev=62245&view=rev
Log: [NTOSKRNL] - Implement SeCheckAuditPrivilege and use it instead of SeSinglePrivilegeCheck, because the latter uses the effective token and we want the primary token - Implement SePrivilegedServiceAuditAlarm - Add and initialize missing SeLocalServiceSid and SeNetworkServiceSid Modified: trunk/reactos/ntoskrnl/include/internal/se.h trunk/reactos/ntoskrnl/se/audit.c trunk/reactos/ntoskrnl/se/priv.c trunk/reactos/ntoskrnl/se/semgr.c trunk/reactos/ntoskrnl/se/sid.c Modified: trunk/reactos/ntoskrnl/include/internal/se.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/se.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/se.h [iso-8859-1] Tue Feb 18 17:51:45 2014 @@ -143,6 +143,8 @@ extern PSID SeAuthenticatedUsersSid; extern PSID SeRestrictedSid; extern PSID SeAnonymousLogonSid; +extern PSID SeLocalServiceSid; +extern PSID SeNetworkServiceSid; /* Privileges */ extern const LUID SeCreateTokenPrivilege; @@ -531,6 +533,20 @@ IN ACCESS_MASK DesiredAccess, IN KPROCESSOR_MODE AccessMode); +BOOLEAN +NTAPI +SeCheckAuditPrivilege( + _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, + _In_ KPROCESSOR_MODE PreviousMode); + +VOID +NTAPI +SePrivilegedServiceAuditAlarm( + _In_opt_ PUNICODE_STRING ServiceName, + _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, + _In_ PPRIVILEGE_SET PrivilegeSet, + _In_ BOOLEAN AccessGranted); + #endif /* EOF */ Modified: trunk/reactos/ntoskrnl/se/audit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/audit.c?rev=62…
============================================================================== --- trunk/reactos/ntoskrnl/se/audit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/audit.c [iso-8859-1] Tue Feb 18 17:51:45 2014 @@ -15,6 +15,8 @@ #include <debug.h> #define SEP_PRIVILEGE_SET_MAX_COUNT 60 + +UNICODE_STRING SeSubsystemName = RTL_CONSTANT_STRING(L"Security"); /* PRIVATE FUNCTIONS***********************************************************/ @@ -202,10 +204,58 @@ _In_ PTOKEN Token, _In_ PTOKEN PrimaryToken, _In_ PPRIVILEGE_SET Privileges, - _In_ BOOLEAN AccessGranted ) + _In_ BOOLEAN AccessGranted) { UNIMPLEMENTED; } + +VOID +NTAPI +SePrivilegedServiceAuditAlarm( + _In_opt_ PUNICODE_STRING ServiceName, + _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, + _In_ PPRIVILEGE_SET PrivilegeSet, + _In_ BOOLEAN AccessGranted) +{ + PTOKEN EffectiveToken; + PSID UserSid; + PAGED_CODE(); + + /* Get the effective token */ + if (SubjectContext->ClientToken != NULL) + EffectiveToken = SubjectContext->ClientToken; + else + EffectiveToken = SubjectContext->PrimaryToken; + + /* Get the user SID */ + UserSid = EffectiveToken->UserAndGroups->Sid; + + /* Check if this is the local system SID */ + if (RtlEqualSid(UserSid, SeLocalSystemSid)) + { + /* Nothing to do */ + return; + } + + /* Check if this is the network service or local service SID */ + if (RtlEqualSid(UserSid, SeExports->SeNetworkServiceSid) || + RtlEqualSid(UserSid, SeExports->SeLocalServiceSid)) + { + // FIXME: should continue for a certain set of privileges + return; + } + + /* Call the worker function */ + SepAdtPrivilegedServiceAuditAlarm(SubjectContext, + &SeSubsystemName, + ServiceName, + SubjectContext->ClientToken, + SubjectContext->PrimaryToken, + PrivilegeSet, + AccessGranted); + +} + static NTSTATUS @@ -477,7 +527,7 @@ } /* Check for audit privilege */ - HaveAuditPrivilege = SeSinglePrivilegeCheck(SeAuditPrivilege, UserMode); + HaveAuditPrivilege = SeCheckAuditPrivilege(&SubjectContext, UserMode); if (!HaveAuditPrivilege && !(Flags & AUDIT_ALLOW_NO_PRIVILEGE)) { DPRINT1("Caller does not have SeAuditPrivilege\n"); @@ -811,6 +861,7 @@ PVOID HandleId, BOOLEAN GenerateOnClose) { + SECURITY_SUBJECT_CONTEXT SubjectContext; UNICODE_STRING CapturedSubsystemName; KPROCESSOR_MODE PreviousMode; BOOLEAN UseImpersonationToken; @@ -832,11 +883,15 @@ return STATUS_SUCCESS; } - /* Validate privilege */ - if (!SeSinglePrivilegeCheck(SeAuditPrivilege, PreviousMode)) + /* Capture the security subject context */ + SeCaptureSubjectContext(&SubjectContext); + + /* Check for audit privilege */ + if (!SeCheckAuditPrivilege(&SubjectContext, PreviousMode)) { DPRINT1("Caller does not have SeAuditPrivilege\n"); - return STATUS_PRIVILEGE_NOT_HELD; + Status = STATUS_PRIVILEGE_NOT_HELD; + goto Cleanup; } /* Probe and capture the subsystem name */ @@ -846,7 +901,7 @@ if (!NT_SUCCESS(Status)) { DPRINT1("Failed to capture subsystem name!\n"); - return Status; + goto Cleanup; } /* Get the current thread and check if it's impersonating */ @@ -887,7 +942,14 @@ PsDereferencePrimaryToken(Token); } - return STATUS_SUCCESS; + Status = STATUS_SUCCESS; + +Cleanup: + + /* Release the security subject context */ + SeReleaseSubjectContext(&SubjectContext); + + return Status; } @@ -986,6 +1048,9 @@ return Status; } + /* Capture the security subject context */ + SeCaptureSubjectContext(&SubjectContext); + /* Validate the token's impersonation level */ if ((ClientToken->TokenType == TokenImpersonation) && (ClientToken->ImpersonationLevel < SecurityIdentification)) @@ -996,7 +1061,7 @@ } /* Check for audit privilege */ - if (!SeSinglePrivilegeCheck(SeAuditPrivilege, UserMode)) + if (!SeCheckAuditPrivilege(&SubjectContext, UserMode)) { DPRINT1("Caller does not have SeAuditPrivilege\n"); Status = STATUS_PRIVILEGE_NOT_HELD; @@ -1105,9 +1170,6 @@ DPRINT1("Failed to capture object name!\n"); goto Cleanup; } - - /* Capture the security subject context */ - SeCaptureSubjectContext(&SubjectContext); /* Call the internal function */ SepOpenObjectAuditAlarm(&SubjectContext, @@ -1124,39 +1186,39 @@ AccessGranted, &LocalGenerateOnClose); + Status = STATUS_SUCCESS; + + /* Enter SEH to copy the data back to user mode */ + _SEH2_TRY + { + *GenerateOnClose = LocalGenerateOnClose; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + DPRINT1("Exception while copying back data: 0x%lx\n", Status); + } + _SEH2_END; + +Cleanup: + + if (CapturedObjectName.Buffer != NULL) + ReleaseCapturedUnicodeString(&CapturedObjectName, UserMode); + + if (CapturedObjectTypeName.Buffer != NULL) + ReleaseCapturedUnicodeString(&CapturedObjectTypeName, UserMode); + + if (CapturedSubsystemName.Buffer != NULL) + ReleaseCapturedUnicodeString(&CapturedSubsystemName, UserMode); + + if (CapturedSecurityDescriptor != NULL) + SeReleaseSecurityDescriptor(CapturedSecurityDescriptor, UserMode, FALSE); + + if (CapturedPrivilegeSet != NULL) + ExFreePoolWithTag(CapturedPrivilegeSet, 'rPeS'); + /* Release the security subject context */ SeReleaseSubjectContext(&SubjectContext); - - Status = STATUS_SUCCESS; - - /* Enter SEH to copy the data back to user mode */ - _SEH2_TRY - { - *GenerateOnClose = LocalGenerateOnClose; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - DPRINT1("Exception while copying back data: 0x%lx\n", Status); - } - _SEH2_END; - -Cleanup: - - if (CapturedObjectName.Buffer != NULL) - ReleaseCapturedUnicodeString(&CapturedObjectName, UserMode); - - if (CapturedObjectTypeName.Buffer != NULL) - ReleaseCapturedUnicodeString(&CapturedObjectTypeName, UserMode); - - if (CapturedSubsystemName.Buffer != NULL) - ReleaseCapturedUnicodeString(&CapturedSubsystemName, UserMode); - - if (CapturedSecurityDescriptor != NULL) - SeReleaseSecurityDescriptor(CapturedSecurityDescriptor, UserMode, FALSE); - - if (CapturedPrivilegeSet != NULL) - ExFreePoolWithTag(CapturedPrivilegeSet, 'rPeS'); ObDereferenceObject(ClientToken); @@ -1213,12 +1275,15 @@ return STATUS_BAD_IMPERSONATION_LEVEL; } - /* Validate privilege */ - if (!SeSinglePrivilegeCheck(SeAuditPrivilege, PreviousMode)) + /* Capture the security subject context */ + SeCaptureSubjectContext(&SubjectContext); + + /* Check for audit privilege */ + if (!SeCheckAuditPrivilege(&SubjectContext, PreviousMode)) { DPRINT1("Caller does not have SeAuditPrivilege\n"); - ObDereferenceObject(ClientToken); - return STATUS_PRIVILEGE_NOT_HELD; + Status = STATUS_PRIVILEGE_NOT_HELD; + goto Cleanup; } /* Do we have a subsystem name? */ @@ -1290,9 +1355,6 @@ } _SEH2_END; - /* Capture the security subject context */ - SeCaptureSubjectContext(&SubjectContext); - /* Call the internal function */ SepAdtPrivilegedServiceAuditAlarm(&SubjectContext, SubsystemName ? &CapturedSubsystemName : NULL, @@ -1302,9 +1364,6 @@ CapturedPrivileges, AccessGranted); - /* Release the security subject context */ - SeReleaseSubjectContext(&SubjectContext); - Status = STATUS_SUCCESS; Cleanup: @@ -1317,6 +1376,9 @@ if (CapturedPrivileges != NULL) ExFreePoolWithTag(CapturedPrivileges, 'rPeS'); + + /* Release the security subject context */ + SeReleaseSubjectContext(&SubjectContext); ObDereferenceObject(ClientToken); Modified: trunk/reactos/ntoskrnl/se/priv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/priv.c?rev=622…
============================================================================== --- trunk/reactos/ntoskrnl/se/priv.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/priv.c [iso-8859-1] Tue Feb 18 17:51:45 2014 @@ -252,6 +252,40 @@ return STATUS_SUCCESS; } +BOOLEAN +NTAPI +SeCheckAuditPrivilege( + _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, + _In_ KPROCESSOR_MODE PreviousMode) +{ + PRIVILEGE_SET PrivilegeSet; + BOOLEAN Result; + PAGED_CODE(); + + /* Initialize the privilege set with the single privilege */ + PrivilegeSet.PrivilegeCount = 1; + PrivilegeSet.Control = PRIVILEGE_SET_ALL_NECESSARY; + PrivilegeSet.Privilege[0].Luid = SeAuditPrivilege; + PrivilegeSet.Privilege[0].Attributes = 0; + + /* Check against the primary token! */ + Result = SepPrivilegeCheck(SubjectContext->PrimaryToken, + &PrivilegeSet.Privilege[0], + 1, + PRIVILEGE_SET_ALL_NECESSARY, + PreviousMode); + + if (PreviousMode != KernelMode) + { + SePrivilegedServiceAuditAlarm(NULL, + SubjectContext, + &PrivilegeSet, + Result); + } + + return Result; +} + NTSTATUS NTAPI SeCaptureLuidAndAttributesArray(PLUID_AND_ATTRIBUTES Src, @@ -506,11 +540,11 @@ if (PreviousMode != KernelMode) { -#if 0 - SePrivilegedServiceAuditAlarm(0, + SePrivilegedServiceAuditAlarm(NULL, &SubjectContext, - &PrivilegeValue); -#endif + &Priv, + Result); + } SeReleaseSubjectContext(&SubjectContext); Modified: trunk/reactos/ntoskrnl/se/semgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/semgr.c?rev=62…
============================================================================== --- trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] Tue Feb 18 17:51:45 2014 @@ -74,10 +74,15 @@ SepExports.SeAuthenticatedUsersSid = SeAuthenticatedUsersSid; SepExports.SeRestrictedSid = SeRestrictedSid; SepExports.SeAnonymousLogonSid = SeAnonymousLogonSid; + SepExports.SeLocalServiceSid = SeLocalServiceSid; + SepExports.SeNetworkServiceSid = SeNetworkServiceSid; SepExports.SeUndockPrivilege = SeUndockPrivilege; SepExports.SeSyncAgentPrivilege = SeSyncAgentPrivilege; SepExports.SeEnableDelegationPrivilege = SeEnableDelegationPrivilege; + SepExports.SeManageVolumePrivilege = SeManageVolumePrivilege; + SepExports.SeImpersonatePrivilege = SeImpersonatePrivilege; + SepExports.SeCreateGlobalPrivilege = SeCreateGlobalPrivilege; SeExports = &SepExports; return TRUE; Modified: trunk/reactos/ntoskrnl/se/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sid.c?rev=6224…
============================================================================== --- trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] Tue Feb 18 17:51:45 2014 @@ -55,6 +55,8 @@ PSID SeAuthenticatedUsersSid = NULL; PSID SeRestrictedSid = NULL; PSID SeAnonymousLogonSid = NULL; +PSID SeLocalServiceSid = NULL; +PSID SeNetworkServiceSid = NULL; /* FUNCTIONS ******************************************************************/ @@ -135,6 +137,8 @@ SeAuthenticatedUsersSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); SeRestrictedSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); SeAnonymousLogonSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); + SeLocalServiceSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); + SeNetworkServiceSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeNullSid == NULL || SeWorldSid == NULL || SeLocalSid == NULL || SeCreatorOwnerSid == NULL || @@ -149,7 +153,8 @@ SeAliasAccountOpsSid == NULL || SeAliasSystemOpsSid == NULL || SeAliasPrintOpsSid == NULL || SeAliasBackupOpsSid == NULL || SeAuthenticatedUsersSid == NULL || SeRestrictedSid == NULL || - SeAnonymousLogonSid == NULL) + SeAnonymousLogonSid == NULL || SeLocalServiceSid == NULL || + SeNetworkServiceSid == NULL) { FreeInitializedSids(); return FALSE; @@ -183,6 +188,8 @@ RtlInitializeSid(SeAuthenticatedUsersSid, &SeNtSidAuthority, 1); RtlInitializeSid(SeRestrictedSid, &SeNtSidAuthority, 1); RtlInitializeSid(SeAnonymousLogonSid, &SeNtSidAuthority, 1); + RtlInitializeSid(SeLocalServiceSid, &SeNtSidAuthority, 1); + RtlInitializeSid(SeNetworkServiceSid, &SeNtSidAuthority, 1); SubAuthority = RtlSubAuthoritySid(SeNullSid, 0); *SubAuthority = SECURITY_NULL_RID; @@ -254,6 +261,10 @@ *SubAuthority = SECURITY_RESTRICTED_CODE_RID; SubAuthority = RtlSubAuthoritySid(SeAnonymousLogonSid, 0); *SubAuthority = SECURITY_ANONYMOUS_LOGON_RID; + SubAuthority = RtlSubAuthoritySid(SeLocalServiceSid, 0); + *SubAuthority = SECURITY_LOCAL_SERVICE_RID; + SubAuthority = RtlSubAuthoritySid(SeNetworkServiceSid, 0); + *SubAuthority = SECURITY_NETWORK_SERVICE_RID; return TRUE; }
10 years, 10 months
1
0
0
0
[tkreuzer] 62244: [INTSAFE] Fix a typo.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 18 16:58:18 2014 New Revision: 62244 URL:
http://svn.reactos.org/svn/reactos?rev=62244&view=rev
Log: [INTSAFE] Fix a typo. Modified: trunk/reactos/include/psdk/intsafe.h Modified: trunk/reactos/include/psdk/intsafe.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/intsafe.h?rev…
============================================================================== --- trunk/reactos/include/psdk/intsafe.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/intsafe.h [iso-8859-1] Tue Feb 18 16:58:18 2014 @@ -328,7 +328,7 @@ DEFINE_SAFE_CONVERT_UTOX(ULongToIntPtr, ULONG, INT_PTR) DEFINE_SAFE_CONVERT_UTOX(ULongToUIntPtr, ULONG, UINT_PTR) DEFINE_SAFE_CONVERT_UTOX(ULongToLongPtr, ULONG, LONG_PTR) -DEFINE_SAFE_CONVERT_UTOX(ULongPtrToULong, ULONG_PTR, ULONGLONG) +DEFINE_SAFE_CONVERT_UTOX(ULongPtrToULong, ULONG_PTR, ULONG) DEFINE_SAFE_CONVERT_UTOX(ULongLongToUInt, ULONGLONG, UINT) DEFINE_SAFE_CONVERT_UTOX(ULongLongToULong, ULONGLONG, ULONG) DEFINE_SAFE_CONVERT_UTOX(ULongLongToULongPtr, ULONGLONG, ULONG_PTR)
10 years, 10 months
1
0
0
0
[dquintana] 62243: [RSHELL] * CMenuBand: Improve wrapper logging to get a better picture. Handle more SIDs on QueryService. Send selection messages on hot item changed and on execute. * CMenuDeskBa...
by dquintana@svn.reactos.org
Author: dquintana Date: Tue Feb 18 13:55:57 2014 New Revision: 62243 URL:
http://svn.reactos.org/svn/reactos?rev=62243&view=rev
Log: [RSHELL] * CMenuBand: Improve wrapper logging to get a better picture. Handle more SIDs on QueryService. Send selection messages on hot item changed and on execute. * CMenuDeskBar: Improve wrapper logging to get a better picture. Handle more SIDs on QueryService. Begin handling more cases in OnSelect. CORE-7881 Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Tue Feb 18 13:55:57 2014 @@ -23,7 +23,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand); -#define WRAP_LOG 0 +#define WRAP_LOG 1 #define TBSTYLE_EX_VERTICAL 4 @@ -50,7 +50,7 @@ virtual HRESULT FillToolbar() = 0; virtual HRESULT PopupItem(UINT uItem) = 0; virtual HRESULT HasSubMenu(UINT uItem) = 0; - virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult) = 0; + virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult); virtual HRESULT OnContextMenu(NMMOUSE * rclick) = 0; HRESULT OnHotItemChange(const NMTBHOTITEM * hot); @@ -646,8 +646,45 @@ WrapLogMsg("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n"); HRESULT hr = this->QueryInterface(riid, ppvObject); if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); - return hr; + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_SMenuBandBottom)) + { + WrapLogMsg("SID is SID_SMenuBandBottom. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_SMenuBandBottomSelected)) + { + WrapLogMsg("SID is SID_SMenuBandBottomSelected. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuBand::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } } else { @@ -960,6 +997,7 @@ } } + m_menuBand->OnSelect(MPOS_CHILDTRACKING); return S_OK; } @@ -1052,6 +1090,12 @@ DestroyMenu(hPopup); return hr; +} + +HRESULT CMenuToolbarBase::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult) +{ + m_menuBand->OnSelect(MPOS_EXECUTE); + return S_OK; } BOOL @@ -1163,7 +1207,11 @@ HRESULT CMenuStaticToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult) { - return m_menuBand->CallCBWithId(wParam, SMC_EXEC, 0, 0); + HRESULT hr = m_menuBand->CallCBWithId(wParam, SMC_EXEC, 0, 0); + if (FAILED(hr)) + return hr; + + return CMenuToolbarBase::OnCommand(wParam, lParam, theResult); } HRESULT CMenuStaticToolbar::PopupItem(UINT uItem) @@ -1817,7 +1865,9 @@ HRESULT STDMETHODCALLTYPE CMenuBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) { - if (IsEqualIID(guidService, SID_SMenuBandChild)) + if (IsEqualIID(guidService, SID_SMenuBandChild) || + IsEqualIID(guidService, SID_SMenuBandBottom) || + IsEqualIID(guidService, SID_SMenuBandBottomSelected)) return this->QueryInterface(riid, ppvObject); WARN("Unknown service requested %s\n", wine_dbgstr_guid(&guidService)); return E_NOINTERFACE; @@ -1831,7 +1881,11 @@ HRESULT STDMETHODCALLTYPE CMenuBand::OnSelect(DWORD dwSelectType) { - UNIMPLEMENTED; + CComPtr<IMenuPopup> pmp; + HRESULT hr = IUnknown_QueryService(m_site, SID_SMenuPopup, IID_PPV_ARG(IMenuPopup, &pmp)); + if (FAILED(hr)) + return hr; + pmp->OnSelect(dwSelectType); return S_OK; } Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Tue Feb 18 13:55:57 2014 @@ -24,7 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuDeskBar); -#define WRAP_LOG 0 +#define WRAP_LOG 1 typedef CWinTraits< WS_POPUP | WS_DLGFRAME | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, @@ -65,19 +65,13 @@ IInitializeObject * m_IInitializeObject; #else - CComPtr<IUnknown> m_Site; - CComPtr<IUnknown> m_Client; - HWND m_ClientWindow; - bool m_Vertical; - bool m_Visible; - int m_NeededSize; // width or height + CComPtr<IUnknown> m_Site; + CComPtr<IUnknown> m_Client; + CComPtr<IMenuPopup> m_SubMenuParent; DWORD m_IconSize; HBITMAP m_Banner; - // used by resize tracking loop - bool m_Tracking; - POINT m_LastLocation; #endif public: @@ -132,7 +126,6 @@ BEGIN_MSG_MAP(CMenuDeskBar) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode) MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged) MESSAGE_HANDLER(WM_PAINT, OnPaint) END_MSG_MAP() @@ -140,7 +133,6 @@ // message handlers LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnCancelMode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnWindowPosChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); @@ -333,19 +325,7 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) { - //bool b; - WrapLogEnter("CMenuDeskBar<%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 && IsEqualGUID(*pguidCmdGroup, CLSID_MenuBand)) - //{ - // if (nCmdID == 19) // popup - // { - // b = true; - // } - //} - - if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup)); HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); WrapLogExit("CMenuDeskBar::Exec() = %08x\n", hr); @@ -357,17 +337,54 @@ { WrapLogEnter("CMenuDeskBar<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject); - //if (IsEqualIID(guidService, SID_SMenuBandChild)) - //{ - // WrapLogMsg("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n"); - // HRESULT hr = this->QueryInterface(riid, ppvObject); - // if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); - // WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); - // return hr; - //} - //else - { - WrapLogMsg("SID not identified.\n"); + if (IsEqualIID(guidService, SID_SMenuPopup)) + { + WrapLogMsg("SID is SID_SMenuPopup. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_SMenuBandParent)) + { + WrapLogMsg("SID is SID_SMenuBandParent. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else if (IsEqualIID(guidService, SID_STopLevelBrowser)) + { + WrapLogMsg("SID is SID_STopLevelBrowser. Using QueryInterface of self instead of wrapped object.\n"); + HRESULT hr = this->QueryInterface(riid, ppvObject); + if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); + if (SUCCEEDED(hr)) + { + WrapLogExit("CMenuDeskBar::QueryService() = %08x\n", hr); + return hr; + } + else + { + WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n"); + } + } + else + { + WrapLogMsg("SID not identified. Calling wrapped object's QueryService.\n"); } HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject); if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject); @@ -416,6 +433,11 @@ WrapLogEnter("CMenuDeskBar<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient); HRESULT hr = m_IDeskBar->SetClient(punkClient); WrapLogExit("CMenuDeskBar::SetClient() = %08x\n", hr); + + CComPtr<IDeskBarClient> dbc; + punkClient->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc)); + dbc->SetDeskBarSite(static_cast<IDeskBar*>(this)); + return hr; } @@ -440,11 +462,6 @@ CMenuDeskBar::CMenuDeskBar() : m_Client(NULL), - m_ClientWindow(NULL), - m_Vertical(true), - m_Visible(false), - m_NeededSize(200), - m_Tracking(false), m_Banner(NULL) { } @@ -510,7 +527,9 @@ if (m_Site == NULL) return E_FAIL; - if (IsEqualGUID(guidService, SID_SMenuPopup)) + if (IsEqualGUID(guidService, SID_SMenuPopup) || + IsEqualGUID(guidService, SID_SMenuBandParent) || + IsEqualGUID(guidService, SID_STopLevelBrowser)) { return this->QueryInterface(riid, ppvObject); } @@ -654,12 +673,6 @@ return result; } -LRESULT CMenuDeskBar::OnCancelMode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - m_Tracking = false; - return 0; -} - LRESULT CMenuDeskBar::OnWindowPosChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { return 0; @@ -824,11 +837,34 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnSelect( DWORD dwSelectType) { - if (dwSelectType == MPOS_FULLCANCEL) - { - CComPtr<IDeskBarClient> dbc; - - HRESULT hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc)); + CComPtr<IDeskBarClient> dbc; + HRESULT hr; + + bool bubbleUp = false; + bool cancel = false; + + switch (dwSelectType) + { + case MPOS_FULLCANCEL: + case MPOS_EXECUTE: + bubbleUp = true; + cancel = true; + // fall through + case MPOS_CANCELLEVEL: + cancel = true; + break; + case MPOS_SELECTLEFT: + case MPOS_SELECTRIGHT: + // if unhandled, spread upwards? + bubbleUp = true; + return S_OK; + case MPOS_CHILDTRACKING: + return S_OK; + } + + if (cancel) + { + hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc)); if (FAILED(hr)) return hr; @@ -841,6 +877,15 @@ UIActivateIO(FALSE, NULL); } + //if (bubbleUp && m_Site) + //{ + // CComPtr<IMenuPopup> pmp; + // HRESULT hr = IUnknown_QueryService(m_Site, SID_SMenuPopup, IID_PPV_ARG(IMenuPopup, &pmp)); + // if (FAILED(hr)) + // return hr; + // pmp->OnSelect(dwSelectType); + //} + return S_OK; } @@ -848,9 +893,24 @@ IMenuPopup *pmp, BOOL fSet) { + if (fSet) + { + m_SubMenuParent = pmp; + } + else + { + if (m_SubMenuParent) + { + if (SHIsSameObject(pmp, m_SubMenuParent)) + { + m_SubMenuParent = NULL; + } + } + } return S_OK; } + HRESULT STDMETHODCALLTYPE CMenuDeskBar::Initialize(THIS) { return S_OK;
10 years, 10 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
47
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Results per page:
10
25
50
100
200