Author: dquintana
Date: Mon Mar 3 16:11:47 2014
New Revision: 62414
URL:
http://svn.reactos.org/svn/reactos?rev=62414&view=rev
Log:
[RSHELL]
* Improve logging in case of unexpected failures, and trace the creation of toolbar (menu)
items.
CORE-7586
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
branches/shell-experiments/base/shell/rshell/CStartMenu.cpp
branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp
branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp
branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp
branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/base/shell/rshell/wraplog.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] Mon Mar 3
16:11:47 2014
@@ -40,7 +40,7 @@
HRESULT hr = site->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
site->Release();
return hr;
@@ -126,7 +126,7 @@
m_menuOwner;
HRESULT hr = m_staticToolbar->SetMenu(hmenu, hwnd, dwFlags);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_site)
@@ -134,11 +134,11 @@
HWND hwndParent;
hr = m_site->GetWindow(&hwndParent);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_staticToolbar->FillToolbar();
@@ -170,11 +170,11 @@
hwndParent = NULL;
hr = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_site));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_site->GetWindow(&hwndParent);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (!::IsWindow(hwndParent))
@@ -183,32 +183,32 @@
if (m_staticToolbar != NULL)
{
hr = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_staticToolbar->FillToolbar();
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
if (m_SFToolbar != NULL)
{
hr = m_SFToolbar->CreateToolbar(hwndParent, m_dwFlags);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_SFToolbar->FillToolbar();
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
hr = IUnknown_QueryService(m_site, SID_SMenuPopup, IID_PPV_ARG(IMenuPopup,
&m_subMenuParent));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
CComPtr<IOleWindow> pTopLevelWindow;
hr = IUnknown_QueryService(m_site, SID_STopLevelBrowser, IID_PPV_ARG(IOleWindow,
&pTopLevelWindow));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return pTopLevelWindow->GetWindow(&m_topLevelWindow);
@@ -242,12 +242,12 @@
if (m_staticToolbar != NULL)
hr = m_staticToolbar->GetIdealSize(sizeStatic);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_SFToolbar != NULL)
hr = m_SFToolbar->GetIdealSize(sizeShlFld);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_staticToolbar == NULL && m_SFToolbar == NULL)
@@ -289,12 +289,12 @@
if (m_staticToolbar != NULL)
hr = m_staticToolbar->GetIdealSize(sizeStatic);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_SFToolbar != NULL)
hr = m_SFToolbar->GetIdealSize(sizeShlFld);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_staticToolbar == NULL && m_SFToolbar == NULL)
@@ -312,17 +312,17 @@
if (m_staticToolbar != NULL)
hr = m_staticToolbar->ShowWindow(fShow);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_SFToolbar != NULL)
hr = m_SFToolbar->ShowWindow(fShow);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (fShow)
{
hr = _CallCB(SMC_INITMENU, 0, 0);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
@@ -363,18 +363,18 @@
HRESULT hr;
hr = m_subMenuParent->SetSubMenu(this, fActivate);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (fActivate)
{
CComPtr<IOleWindow> pTopLevelWindow;
hr = IUnknown_QueryService(m_site, SID_SMenuPopup, IID_PPV_ARG(IOleWindow,
&pTopLevelWindow));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = pTopLevelWindow->GetWindow(&m_topLevelWindow);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
else
@@ -497,7 +497,7 @@
}
HRESULT hr = m_SFToolbar->SetShellFolder(psf, pidlFolder, hKey, dwFlags);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (m_site)
@@ -505,11 +505,11 @@
HWND hwndParent;
hr = m_site->GetWindow(&hwndParent);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_SFToolbar->CreateToolbar(hwndParent, m_dwFlags);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_SFToolbar->FillToolbar();
@@ -719,7 +719,7 @@
if (m_subMenuChild)
{
HRESULT hr = m_subMenuChild->OnSelect(MPOS_CANCELLEVEL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
if (m_staticToolbar) m_staticToolbar->OnPopupItemChanged(toolbar, item);
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] Mon Mar 3
16:11:47 2014
@@ -39,7 +39,7 @@
HRESULT hr = deskbar->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
deskbar->Release();
return hr;
@@ -79,7 +79,7 @@
CComPtr<IInputObjectSite> ios;
HRESULT hr = m_Client->QueryInterface(IID_PPV_ARG(IInputObjectSite, &ios));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return ios->OnFocusChangeIS(punkObj, fSetFocus);
@@ -150,7 +150,7 @@
CComPtr<IInputObject> io;
HRESULT hr = m_Client->QueryInterface(IID_PPV_ARG(IInputObject, &io));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return io->HasFocusIO();
@@ -161,7 +161,7 @@
CComPtr<IInputObject> io;
HRESULT hr = m_Client->QueryInterface(IID_PPV_ARG(IInputObject, &io));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return io->TranslateAcceleratorIO(lpMsg);
@@ -183,15 +183,15 @@
}
hr = punkClient->QueryInterface(IID_PPV_ARG(IUnknown, &m_Client));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDeskBandClient));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = pDeskBandClient->SetDeskBarSite(static_cast<IDeskBar*>(this));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return IUnknown_GetWindow(m_Client, &m_ClientWindow);
@@ -250,11 +250,11 @@
return E_FAIL;
hr = IUnknown_QueryService(m_Client, SID_SMenuBandChild,
IID_PPV_ARG(IOleCommandTarget, &oct));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
// Windows calls this, but it appears to be unimplemented?
@@ -263,12 +263,12 @@
// No clue about the arg, using anything != 0
hr = dbc->UIActivateDBC(TRUE);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
RECT rc = { 0 };
hr = dbc->GetSize(0, &rc);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
// Unknown meaning
@@ -276,7 +276,7 @@
const int CMD_EXEC_OPT = 0;
hr = IUnknown_QueryServiceExec(m_Client, SID_SMenuBandChild, &CLSID_MenuBand,
CMD, CMD_EXEC_OPT, NULL, NULL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
::AdjustWindowRect(&rc, ::GetWindowLong(m_hWnd, GWL_STYLE), FALSE);
@@ -372,7 +372,7 @@
const int CMD_EXEC_OPT = iIcon ? 0 : 2; // seems to work
hr = IUnknown_QueryServiceExec(m_Client, SID_SMenuBandChild, &CLSID_MenuBand,
CMD, CMD_EXEC_OPT, NULL, NULL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
BOOL bHandled;
@@ -479,16 +479,16 @@
if (m_SubMenuChild)
{
hr = m_SubMenuChild->OnSelect(MPOS_CANCELLEVEL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = dbc->UIActivateDBC(FALSE);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE |
SWP_NOZORDER);
@@ -506,7 +506,7 @@
CComPtr<IOleWindow> window;
hr = popup->QueryInterface(IID_PPV_ARG(IOleWindow, &window));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return FALSE;
HWND parent;
@@ -517,7 +517,7 @@
popup = NULL;
hr = IUnknown_GetSite(window, IID_PPV_ARG(IMenuPopup, &popup));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return FALSE;
}
@@ -552,14 +552,14 @@
CComPtr<IWinEventHandler> winEventHandler;
HRESULT hr = m_Client->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&winEventHandler));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return 0;
if (winEventHandler)
{
LRESULT result;
hr = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return 0;
return result;
}
@@ -615,13 +615,13 @@
// HACK! I just want it to work !!!
CComPtr<IDeskBar> db;
HRESULT hr = IUnknown_QueryService(m_Client, SID_SMenuBandChild,
IID_PPV_ARG(IDeskBar, &db));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return 0;
CComPtr<IUnknown> punk;
hr = db->GetClient(&punk);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return 0;
if (!punk && m_Shown)
Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] Mon
Mar 3 16:11:47 2014
@@ -207,13 +207,13 @@
}
hr = newBand->_GetTopLevelWindow(&newFocus);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (!m_currentBand)
{
hr = PlaceHooks(newFocus);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
@@ -228,7 +228,7 @@
HRESULT hr;
hr = PushToArray(mb);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return UpdateFocus(mb);
@@ -240,7 +240,7 @@
HRESULT hr;
hr = PopFromArray(&mbc);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (mb != mbc)
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] Mon Mar 3
16:11:47 2014
@@ -37,7 +37,7 @@
HRESULT hr = site->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
site->Release();
return hr;
@@ -109,7 +109,7 @@
if (m_BandObject)
{
hr = IUnknown_SetSite(m_BandObject, NULL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
@@ -122,19 +122,19 @@
return TO_HRESULT(0);
hr = punk->QueryInterface(IID_PPV_ARG(IDeskBand, &m_DeskBand));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_WinEventHandler));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = IUnknown_SetSite(punk, this->ToIUnknown());
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = IUnknown_GetWindow(punk, &m_hWndBand);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
m_BandObject = punk;
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Mon Mar 3
16:11:47 2014
@@ -457,11 +457,11 @@
#else
hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUSITE
hr = CMenuSite_Wrapper(pBandSite, IID_PPV_ARG(IBandSite, &pBandSite));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
@@ -473,25 +473,25 @@
#else
hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUDESKBAR
hr = CMenuDeskBar_Wrapper(pDeskBar, IID_PPV_ARG(IDeskBar, &pDeskBar));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
hr = pDeskBar->SetClient(pBandSite);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = pBandSite->AddBand(childShellMenu);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
CComPtr<IMenuPopup> popup;
hr = pDeskBar->QueryInterface(IID_PPV_ARG(IMenuPopup, &popup));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
m_menuBand->_OnPopupSubMenu(popup, &pt, &rcl, this, m_popupItem);
@@ -526,7 +526,7 @@
return E_FAIL;
hr = contextMenu->QueryContextMenu(hPopup, 0, 0, UINT_MAX, CMF_NORMAL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
DestroyMenu(hPopup);
return hr;
@@ -667,7 +667,10 @@
tbb.iBitmap = iconId;
tbb.dwData = buttonData;
- SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb));
+ DbgPrint("Trying to add a new button with id %d and caption
'%S'...\n", commandId, caption);
+
+ if (!SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb)))
+ return HRESULT_FROM_WIN32(GetLastError());
return S_OK;
}
@@ -684,7 +687,10 @@
tbb.fsStyle = BTNS_SEP;
tbb.iBitmap = 0;
- SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb));
+ DbgPrint("Trying to add a new separator...\n");
+
+ if (!SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb)))
+ return HRESULT_FROM_WIN32(GetLastError());
return S_OK;
}
@@ -699,7 +705,10 @@
tbb.iString = (INT_PTR) MenuString;
tbb.iBitmap = -1;
- SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb));
+ DbgPrint("Trying to add a new placeholder...\n");
+
+ if (!SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb)))
+ return HRESULT_FROM_WIN32(GetLastError());
return S_OK;
}
@@ -790,12 +799,23 @@
info.cbSize = sizeof(info);
info.dwTypeData = NULL;
- info.fMask = MIIM_FTYPE | MIIM_STRING;
-
- GetMenuItemInfoW(m_hmenu, i, TRUE, &info);
-
- if (info.fType == MFT_STRING)
- {
+ info.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
+
+ if (!GetMenuItemInfoW(m_hmenu, i, TRUE, &info))
+ {
+ DbgPrint("Error obtaining info for menu item at pos=%d\n", i);
+ continue;
+ }
+
+ DbgPrint("Found item with fType=%x, cmdId=%d\n", info.fType,
info.wID);
+
+ if (info.fType & MFT_SEPARATOR)
+ {
+ AddSeparator(last);
+ }
+ else // if (info.fType == MFT_STRING)
+ {
+
info.cch++;
info.dwTypeData = (PWSTR) HeapAlloc(GetProcessHeap(), 0, (info.cch + 1) *
sizeof(WCHAR));
@@ -807,16 +827,12 @@
// FIXME: remove before deleting the toolbar or it will leak
HRESULT hr = m_menuBand->_CallCBWithItemId(info.wID, SMC_GETINFO, 0,
reinterpret_cast<LPARAM>(sminfo));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon,
reinterpret_cast<DWORD_PTR>(sminfo), last);
HeapFree(GetProcessHeap(), 0, info.dwTypeData);
- }
- else
- {
- AddSeparator(last);
}
}
@@ -837,7 +853,7 @@
{
HRESULT hr;
hr = CMenuToolbarBase::OnCommand(wParam, lParam, theResult);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
// in case the clicked item has a submenu, we do not need to execute the item
@@ -861,7 +877,7 @@
{
CComPtr<IShellMenu> shellMenu;
HRESULT hr = m_menuBand->_CallCBWithItemId(uItem, SMC_GETOBJECT,
reinterpret_cast<WPARAM>(&IID_IShellMenu),
reinterpret_cast<LPARAM>(&shellMenu));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return PopupSubMenu(uItem, index, shellMenu);
@@ -903,7 +919,7 @@
STRRET sr = { STRRET_CSTR, { 0 } };
hr = m_shellFolder->GetDisplayNameOf(item, SIGDN_NORMALDISPLAY, &sr);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
StrRetToStr(&sr, NULL, &MenuString);
@@ -950,7 +966,7 @@
HRESULT hr;
hr = m_shellFolder->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (pdwFlags)
@@ -993,7 +1009,7 @@
{
HRESULT hr;
hr = CMenuToolbarBase::OnCommand(wParam, lParam, theResult);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
// in case the clicked item has a submenu, we do not need to execute the item
@@ -1028,11 +1044,11 @@
#else
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &shellMenu));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUBAND
hr = CMenuBand_Wrapper(shellMenu, IID_PPV_ARG(IShellMenu, &shellMenu));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
@@ -1040,16 +1056,16 @@
// FIXME: not sure what to use as uId/uIdAncestor here
hr = shellMenu->Initialize(psmc, 0, uId, SMINIT_VERTICAL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
CComPtr<IShellFolder> childFolder;
hr = m_shellFolder->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder,
&childFolder));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = shellMenu->SetShellFolder(childFolder, NULL, NULL, 0);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return PopupSubMenu(uItem, index, shellMenu);
@@ -1062,7 +1078,7 @@
SFGAOF attrs = SFGAO_FOLDER;
hr = m_shellFolder->GetAttributesOf(1, &pidl, &attrs);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return (attrs & SFGAO_FOLDER) ? S_OK : S_FALSE;
Modified: branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1] Mon Mar 3
16:11:47 2014
@@ -49,10 +49,10 @@
{
HRESULT hr;
hr = userLocal->EnumObjects(hwndOwner, flags, &m_UserLocal);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = userLocal->EnumObjects(hwndOwner, flags, &m_AllUSers);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
m_UserLocal = NULL;
return hr;
@@ -73,7 +73,7 @@
if (!m_FirstDone)
{
hr = m_UserLocal->Next(celt, rgelt, pceltFetched);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
if (hr == S_FALSE)
m_FirstDone = true;
@@ -89,7 +89,7 @@
*pceltFetched = 0;
hr = m_AllUSers->Next(celt, rgelt, pceltFetched);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
*pceltFetched += offset;
@@ -138,7 +138,7 @@
hr = fld->_SetSources(userLocal, allUsers);
hr = fld->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
fld->Release();
return hr;
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] Mon Mar 3
16:11:47 2014
@@ -156,11 +156,11 @@
#else
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUBAND
hr = CMenuBand_Wrapper(pShellMenu, IID_PPV_ARG(IShellMenu, &pShellMenu));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
@@ -304,11 +304,11 @@
#else
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUBAND
hr = CMenuBand_Wrapper(pShellMenu, IID_PPV_ARG(IShellMenu, &pShellMenu));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
@@ -320,11 +320,11 @@
#else
hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUSITE
hr = CMenuSite_Wrapper(pBandSite, IID_PPV_ARG(IBandSite, &pBandSite));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
@@ -336,23 +336,23 @@
#else
hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
#endif
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#if WRAP_MENUDESKBAR
hr = CMenuDeskBar_Wrapper(pDeskBar, IID_PPV_ARG(IDeskBar, &pDeskBar));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
CComObject<CShellMenuCallback> *pCallback;
hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
pCallback->AddRef(); // CreateInstance returns object with 0 ref count */
pCallback->Initialize(pShellMenu, pBandSite, pDeskBar);
pShellMenu->Initialize(pCallback, (UINT)-1, 0, SMINIT_TOPLEVEL |
SMINIT_VERTICAL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = SHGetDesktopFolder(&shellFolder);
@@ -369,24 +369,24 @@
IShellFolder * psfMerged;
hr = CMergedFolder_Constructor(psfStartMenuUser, psfStartMenuAll,
IID_PPV_ARG(IShellFolder, &psfMerged));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = pShellMenu->SetShellFolder(psfMerged, NULL, NULL, 0);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#else
hr = pShellMenu->SetShellFolder(psfStartMenuUser, NULL, NULL, 0);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
#endif
hr = pDeskBar->SetClient(pBandSite);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = pBandSite->AddBand(pShellMenu);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return pDeskBar->QueryInterface(riid, ppv);
Modified: branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/logging/CMenuBandWrap.cpp [iso-8859-1]
Mon Mar 3 16:11:47 2014
@@ -182,7 +182,7 @@
return E_OUTOFMEMORY;
hr = site->InitWrap(shellMenu);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
site->Release();
return hr;
@@ -190,7 +190,7 @@
hr = site->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
site->Release();
return hr;
@@ -205,33 +205,33 @@
m_IShellMenu = shellMenu;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IDeskBand, &m_IDeskBand));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IDockingWindow,
&m_IDockingWindow));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite,
&m_IObjectWithSite));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IPersistStream,
&m_IPersistStream));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IPersist, &m_IPersist));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&m_IOleCommandTarget));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IServiceProvider,
&m_IServiceProvider));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IMenuBand, &m_IMenuBand));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenu2, &m_IShellMenu2));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = shellMenu->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&m_IWinEventHandler));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
//hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenuAcc,
&m_IShellMenuAcc));
m_IShellMenuAcc = NULL;
return hr;
Modified: branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/logging/CMenuDeskBarWrap.cpp [iso-8859-1]
Mon Mar 3 16:11:47 2014
@@ -121,7 +121,7 @@
return E_OUTOFMEMORY;
hr = bar->InitWrap(deskBar);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
bar->Release();
return hr;
@@ -129,7 +129,7 @@
hr = bar->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
bar->Release();
return hr;
@@ -144,21 +144,21 @@
m_IDeskBar = deskBar;
hr = deskBar->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&m_IOleCommandTarget));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IServiceProvider,
&m_IServiceProvider));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IInputObjectSite,
&m_IInputObjectSite));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IObjectWithSite,
&m_IObjectWithSite));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IBanneredBar, &m_IBanneredBar));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = deskBar->QueryInterface(IID_PPV_ARG(IInitializeObject,
&m_IInitializeObject));
return hr;
}
Modified: branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/logging/CMenuSiteWrap.cpp [iso-8859-1]
Mon Mar 3 16:11:47 2014
@@ -116,7 +116,7 @@
return E_OUTOFMEMORY;
hr = site->InitWrap(bandSite);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
site->Release();
return hr;
@@ -124,7 +124,7 @@
hr = site->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
site->Release();
return hr;
@@ -139,17 +139,17 @@
m_IBandSite = bandSite;
hr = bandSite->QueryInterface(IID_PPV_ARG(IDeskBarClient,
&m_IDeskBarClient));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&m_IOleCommandTarget));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IInputObjectSite,
&m_IInputObjectSite));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&m_IWinEventHandler));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IServiceProvider,
&m_IServiceProvider));
return hr;
}
Modified: branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
---
branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp [iso-8859-1]
(original)
+++
branches/shell-experiments/base/shell/rshell/logging/CStartMenuSiteWrap.cpp [iso-8859-1]
Mon Mar 3 16:11:47 2014
@@ -82,7 +82,7 @@
return E_OUTOFMEMORY;
hr = site->InitWrap(trayPriv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
site->Release();
return hr;
@@ -90,7 +90,7 @@
hr = site->QueryInterface(riid, ppv);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
site->Release();
return hr;
@@ -105,9 +105,9 @@
m_ITrayPriv = bandSite;
hr = bandSite->QueryInterface(IID_PPV_ARG(IServiceProvider,
&m_IServiceProvider));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
- if (FAILED(hr)) return hr;
+ if (FAILED_UNEXPECTEDLY(hr)) return hr;
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&m_IOleCommandTarget));
return hr;
}
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] Mon Mar 3
16:11:47 2014
@@ -87,3 +87,9 @@
#define DbgPrint(fmt, ...) \
Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
+
+#if 1
+#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (DbgPrint("Unexpected failure
%08x.\n", hr), TRUE))
+#else
+#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
+#endif
Modified: branches/shell-experiments/base/shell/rshell/wraplog.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/wraplog.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/wraplog.cpp [iso-8859-1] Mon Mar 3
16:11:47 2014
@@ -13,7 +13,7 @@
{
if (openCount == 0)
{
- log = fopen("G:\\RShellWrap.log", "w");
+ log = fopen("C:\\RShellWrap.log", "w");
nTemps = 0;
callLevel = 0;
}