* Make failure codes print themselves. Helps debug.
svn path=/branches/shell-experiments/; revision=63541
CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * (fObjectCount + 1)));
fObjects[fObjectCount].punk = punk;
punk->AddRef();
- if (FAILED(punk->QueryInterface(IID_PPV_ARG(IEnumString, &fObjects[fObjectCount].pEnum))))
+ if (FAILED_UNEXPECTEDLY(punk->QueryInterface(IID_PPV_ARG(IEnumString, &fObjects[fObjectCount].pEnum))))
fObjects[fObjectCount].pEnum = NULL;
- if (FAILED(punk->QueryInterface(IID_PPV_ARG(IACList, &fObjects[fObjectCount].pACL))))
+ if (FAILED_UNEXPECTEDLY(punk->QueryInterface(IID_PPV_ARG(IACList, &fObjects[fObjectCount].pACL))))
fObjects[fObjectCount].pACL = NULL;
fObjectCount++;
return S_OK;
fSite.Release();
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// get window handle of parent
#else
hResult = E_FAIL;
#endif
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
// instantiate new version
hResult = CreateAddressEditBox(IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &shellService));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
- hResult = fAddressEditBox->Init(combobox, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/);
- if (FAILED(hResult))
+ hResult = fAddressEditBox->Init(combobox, fEditControl, 8, fSite /*(IAddressBand *)this*/);
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
- hResult = shellService->SetOwner(pUnkSite);
- if (FAILED(hResult))
+ hResult = shellService->SetOwner(fSite);
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// TODO: properly initialize this from registry
HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return oleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
}
if (fActivate)
{
hResult = fSite->QueryInterface(IID_PPV_ARG(IInputObjectSite, &inputObjectSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = inputObjectSite->OnFocusChangeIS(static_cast<IDeskBand *>(this), fActivate);
SetFocus();
break;
}
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
}
if (fAddressEditBox)
{
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return winEventHandler->IsWindowOwner(hWnd);
}
HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IAddressBand, &addressBand));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return addressBand->FileSysChange(param8, paramC);
}
HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IAddressBand, &addressBand));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return addressBand->Refresh(param8);
}
}
hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &isb));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
isb->GetPidl(&absolutePIDL);
if (theMenuBar == NULL)
return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theMenuBar;
return hResult;
if (SUCCEEDED(hr))
{
hr = pisb->BrowseObject(pidlLastParsed, 0);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
HWND topLevelWindow;
LPCITEMIDLIST pidlChild;
if (theMenuBar == NULL)
return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theMenuBar;
return hResult;
if (browser == NULL)
return E_POINTER;
hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = serviceProvider->QueryService(
SID_IWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &webBrowser));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
*browser = webBrowser.Detach();
return S_OK;
HRESULT hResult;
hResult = FindBrowserWindow(&webBrowser);
- if (FAILED(hResult) || webBrowser.p == NULL)
+ if (FAILED_UNEXPECTEDLY(hResult) || webBrowser.p == NULL)
return S_FALSE;
return S_OK;
}
HRESULT hResult;
hResult = FindBrowserWindow(&webBrowserUnknown);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = webBrowserUnknown->QueryInterface(IID_PPV_ARG(IWebBrowser2, &webBrowser));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = webBrowser->put_Visible(TRUE);
hResult = webBrowser->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
return E_OUTOFMEMORY;
memcpy(V_ARRAY(&args)->pvData, pidl, arraySize);
hResult = webBrowser->Navigate2(&args, &emptyVariant, &emptyVariant, &emptyVariant, &emptyVariant);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
if (theBandProxy == NULL)
return E_OUTOFMEMORY;
hResult = theBandProxy->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theBandProxy;
return hResult;
if (fBands[i].DeskBand != NULL)
{
hRet = UpdateSingleBand(&fBands[i]);
- if (FAILED(hRet))
+ if (FAILED_UNEXPECTEDLY(hRet))
return hRet;
}
}
fOleWindow.Release();
hRet = pUnk->QueryInterface(IID_PPV_ARG(IOleWindow, &fOleWindow));
- if (FAILED(hRet))
+ if (FAILED_UNEXPECTEDLY(hRet))
return E_FAIL;
hRet = fOleWindow->GetWindow(&hWndParent);
- if (FAILED(hRet))
+ if (FAILED_UNEXPECTEDLY(hRet))
return E_FAIL;
style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT |
HRESULT hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = dockingWindowSite->GetBorderDW(static_cast<IDeskBar *>(this), &availableBorderSpace);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
memset(&neededBorderSpace, 0, sizeof(neededBorderSpace));
if (fVisible)
neededBorderSpace.bottom = fNeededSize + GetSystemMetrics(SM_CXFRAME);
}
hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDeskBar *>(this), &neededBorderSpace);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
if (fSite == NULL)
return E_FAIL;
hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
// called for SID_IWebBrowserApp, IID_IConnectionPointContainer
else
{
hResult = punkClient->QueryInterface(IID_PPV_ARG(IUnknown, &fClient));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
Create(ownerWindow, 0, NULL,
WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW);
if (theBaseBar == NULL)
return E_OUTOFMEMORY;
hResult = theBaseBar->QueryInterface (riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theBaseBar;
return hResult;
HRESULT hResult;
hResult = newBar->QueryInterface(IID_PPV_ARG(IPersist, &persist));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &site));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = site->SetSite(static_cast<IOleWindow *>(this));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
ATLTRY(newInfo = new CBarInfo);
if (newInfo == NULL)
// this call is what makes the tree fill with contents
hResult = dockingWindow->ShowDW(TRUE);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// for now
fCurrentActiveBar = newInfo;
if (fDeskBarSite == NULL)
return E_FAIL;
hResult = fDeskBarSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
// called for SID_IWebBrowserApp, IID_IConnectionPointContainer
else
{
hResult = punkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = punkSite->QueryInterface(IID_PPV_ARG(IUnknown, &fDeskBarSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
m_hWnd = CreateWindow(REBARCLASSNAMEW, NULL, WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN |
if (theBaseBarSite == NULL)
return E_OUTOFMEMORY;
hResult = theBaseBarSite->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theBaseBarSite;
return hResult;
// get window handle of parent
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
if (IsEqualIID(guidService, SID_SBrandBand))
return this->QueryInterface(riid, ppvObject);
hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return serviceProvider->QueryService(guidService, riid, ppvObject);
}
if (theMenuBar == NULL)
return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theMenuBar;
return hResult;
CComPtr<IInputObject> pio;
HRESULT hr;
hr = punk->QueryInterface(IID_PPV_ARG(IInputObject, &pio));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return pio->HasFocusIO();
}
if (!punk)
return E_FAIL;
hr = punk->QueryInterface(IID_PPV_ARG(IInputObject, &pio));
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
return pio->TranslateAcceleratorIO(pmsg);
}
fBandID = bandID;
fFlags = flags;
hResult = IUnknown_SetSite(containedBand, static_cast<IOleWindow *>(this));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = IUnknown_GetWindow(containedBand, &fChildWindow);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
memset(&bandInfo, 0, sizeof(bandInfo));
HRESULT hResult;
hResult = fContainedBand->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
fDeskBandInfo.dwMask = DBIM_BKCOLOR | DBIM_MODEFLAGS | DBIM_TITLE | DBIM_ACTUAL |
bandInfo.lpText = textBuffer;
bandInfo.cch = sizeof(textBuffer) / sizeof(TCHAR);
hResult = GetRBBandInfo(bandInfo);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
index = (int)SendMessage(fRebarWindow, RB_IDTOINDEX, fBandID, 0);
SendMessage(fRebarWindow, RB_SETBANDINFOW, index, (LPARAM)&bandInfo);
{
// create favorites menu
hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
favoritesHMenu = GetSubMenu(parentHMenu, 3);
if (favoritesHMenu == NULL)
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IShellMenu, &newMenu));
#endif
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = newMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = SHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &favoritesPIDL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = SHBindToFolder(favoritesPIDL, &favoritesFolder);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
RECT availableBorderSpace;
HRESULT hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (availableBorderSpace.top > maxHeight)
hResult = E_FAIL;
}
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IShellMenu, menuBar));
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IShellMenu, menuBar));
#endif
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = fMenuCallback.QueryInterface(IID_PPV_ARG(IShellMenuCallback, &callback));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = (*menuBar)->Initialize(callback, -1, ANCESTORDEFAULT, SMINIT_HORIZONTAL | SMINIT_TOPLEVEL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &siteCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = siteCommandTarget->Exec(&CGID_Explorer, 0x35, 0, NULL, &menuOut);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (V_VT(&menuOut) != VT_INT_PTR || V_INTREF(&menuOut) == NULL)
return E_FAIL;
hResult = (*menuBar)->SetMenu((HMENU)V_INTREF(&menuOut), ownerWindow, SMSET_DONTOWN);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = IUnknown_Exec(*menuBar, CGID_MenuBand, 3, 1, NULL, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
HRESULT hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = serviceProvider->QueryService(SID_IBandProxy, IID_PPV_ARG(IBandProxy, &fBandProxy));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
hResult = CreateBandProxy(IID_PPV_ARG(IBandProxy, &fBandProxy));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = fBandProxy->SetSite(fSite);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
return S_OK;
CComPtr<IDockingWindowSite> dockingWindowSite;
HRESULT hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = dockingWindowSite->RequestBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
/* Create and attach the menubar to the rebar */
hResult = CreateMenuBar(&menuBar);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
AddDockItem(menuBar, ITBBID_MENUBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
#if 0
/* Create and attach the brand/logo to the rebar */
hResult = CreateBrandBand(&logoBar);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
AddDockItem(logoBar, ITBBID_BRANDBAND, CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE);
fLogoBar.Attach(logoBar.Detach()); // transfer the ref count
/* Create and attach the standard toolbar to the rebar */
hResult = CreateToolsBar(&toolsBar);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
fControlsBar.Attach(toolsBar.Detach()); // transfer the ref count
hResult = IUnknown_GetWindow(fControlsBar, &fToolbarWindow);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
/* Create and attach the address/navigation toolbar to the rebar */
hResult = CreateAddressBand(&navigationBar);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
fNavigationBar.Attach(navigationBar.Detach());
fCommandTarget.Release();
hResult = theTarget->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &fCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
fCommandCategory = *category;
return S_OK;
{
// get window handle of owner
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (ownerWindow == NULL)
return E_FAIL;
if (fBandProxy.p == NULL)
{
hResult = CreateAndInitBandProxy();
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
return fBandProxy->QueryInterface(riid, ppvObject);
HRESULT STDMETHODCALLTYPE CInternetToolbar::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::RemoveBand(DWORD dwBandID)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::GetBandObject(DWORD dwBandID, REFIID riid, void **ppv)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = serviceProvider->QueryService(SID_SShellBrowser,
IID_PPV_ARG(IWebBrowser, &webBrowser));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = webBrowser->GoBack();
return 1;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = serviceProvider->QueryService(
SID_SShellBrowser, IID_PPV_ARG(IWebBrowser, &webBrowser));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = webBrowser->GoForward();
return 1;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = oleCommandTarget->Exec(&CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL);
return 1;
hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IContextMenu, &contextMenu));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = objectWithSite->SetSite(fSite);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = contextMenu->InvokeCommand(&commandInfo);
hResult = objectWithSite->SetSite(NULL);
HRESULT hResult;
hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = oleCommandTarget->Exec(&CGID_Explorer, 0x23, 0, NULL, NULL);
return 1;
hResult = travelLog->GetToolTipText(browserService,
(nID == (UINT)IDM_GOTO_BACK) ? TLOG_BACK : TLOG_FORE,
0, tempString, 299);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
bHandled = FALSE;
return 0;
if (theToolbar == NULL)
return E_OUTOFMEMORY;
hResult = theToolbar->QueryInterface (riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theToolbar;
return hResult;
CComPtr<IShellFolder> desktop;
HRESULT hr = ::SHGetDesktopFolder(&desktop);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return E_FAIL;
if (path == NULL || path->mkid.cb == 0)
{
#if 0
hResult = CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &fClientBars[BIInternetToolbar].clientBar));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
#else
hResult = CreateInternetToolbar(IID_PPV_ARG(IUnknown, &clientBar));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
#endif
return hResult;
hResult = IUnknown_SetSite(clientBar, static_cast<IShellBrowser *>(this));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = IUnknown_Exec(clientBar, CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// TODO: create settingsStream from registry entry
//else
{
hResult = persistStreamInit->InitNew();
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
// browse
hResult = BrowseToPIDL(pidl, BTP_UPDATE_NEXT_HISTORY);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
ShowWindow(SW_SHOWNORMAL);
// called by shell view to browse to new folder
// also called by explorer band to navigate to new folder
hResult = SHBindToFolder(pidl, &newFolder);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
newFolderSettings.ViewMode = FVM_ICON;
newFolderSettings.fFlags = 0;
hResult = BrowseToPath(newFolder, pidl, &newFolderSettings, flags);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
return E_INVALIDARG;
hResult = GetTravelLog(&travelLog);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// update history
// create view object
hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
previousView = fCurrentShellViewWindow;
// create view window
hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
this, &shellViewWindowBounds, &newShellViewWindow);
- if (FAILED(hResult) || newShellViewWindow == NULL)
+ if (FAILED_UNEXPECTEDLY(hResult) || newShellViewWindow == NULL)
{
fCurrentShellView = saveCurrentShellView;
fCurrentShellFolder = saveCurrentShellFolder;
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return deskBand->QueryInterface(riid, shellMenu);
}
if (*cache == NULL)
{
hResult = CreateBaseBar(IID_PPV_ARG(IUnknown, &newBaseBar));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = CreateBaseBarSite(IID_PPV_ARG(IUnknown, &newBaseBarSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// tell the new base bar about the shell browser
hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// tell the new base bar about the new base bar site
hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = deskBar->SetClient(newBaseBarSite);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
// tell the new base bar site about the new base bar
hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = deskBarClient->SetDeskBarSite(newBaseBar);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
*cache = newBaseBar.Detach();
__debugbreak();
hResult = GetBaseBar(vertical, (IUnknown **)&theBaseBar);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = deskBar->GetClient(&baseBarSite);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
V_VT(&vaIn) = VT_UNKNOWN;
V_UNKNOWN(&vaIn) = newBand.p;
hResult = oleCommandTarget->Exec(&CGID_IDeskBand, 1, 1, &vaIn, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = dockingWindow->ShowDW(TRUE);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
ILRemoveLastID(newDirectory);
hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
ILFree(newDirectory);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
// create sheet object
hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return E_FAIL;
// must set site in order for Apply to all Folders on Advanced page to be enabled
#if 0
hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return E_FAIL;
hResult = globalSettings->Get(&shellState, sizeof(shellState));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return E_FAIL;
#endif
// add pages
hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return E_FAIL;
if (fCurrentShellView != NULL)
{
hResult = fCurrentShellView->AddPropertySheetPages(
0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return E_FAIL;
}
canGoBack = false;
canGoForward = false;
hResult = GetTravelLog(&travelLog);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
if (SUCCEEDED(hResult))
position = GetMenuItemCount(theMenu);
hResult = GetTravelLog(&travelLog);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return;
hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, TLMENUF_BACKANDFORTH | TLMENUF_CHECKCURRENT);
IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
if (SUCCEEDED(hResult))
hResult = oleCommandTarget->QueryStatus(&CGID_PrivCITCommands, 5, commandList, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
DeleteMenu(theMenu, IDM_VIEW_TOOLBARS, MF_BYCOMMAND);
else
{
if (int1 == NULL || int2 == NULL)
return false;
hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return false;
hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return false;
if (int1Retry == int2Retry)
return true;
if (hmenuShared && IsMenu(hmenuShared) == FALSE)
return E_FAIL;
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = shellMenu->SetMenu(hmenuShared, NULL, SMSET_DONTOWN);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
fCurrentMenuBar = hmenuShared;
return S_OK;
if (fTravelLog.p == NULL)
{
hResult = CreateTravelLog(IID_PPV_ARG(ITravelLog, &fTravelLog));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
*pptl = fTravelLog.p;
HRESULT hResult;
hResult = GetTravelLog(&travelLog);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
}
HRESULT hResult;
hResult = GetTravelLog(&travelLog);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
}
HRESULT hResult;
hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
}
return E_INVALIDARG;
pidl = (LPITEMIDLIST)V_ARRAY(URL)->pvData;
hResult = BrowseToPIDL((LPITEMIDLIST)pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
HRESULT hResult;
hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
return E_FAIL;
if (pidl == NULL)
return E_OUTOFMEMORY;
hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
ILFree(pidl);
return hResult;
fHistoryStream = NULL;
fHistoryBindContext = NULL;
ILFree(pidl);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
if (viewPersistHistory.p != NULL)
{
hResult = viewPersistHistory->GetClassID(&newState.persistClass);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
newState.pidlSize = ILGetSize(fCurrentDirectoryPIDL);
hResult = pStream->Write(&newState, sizeof(newState), NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (viewPersistHistory.p != NULL)
{
hResult = viewPersistHistory->SaveHistory(pStream);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
return S_OK;
hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
IID_PPV_ARG(IOleCommandTarget, &commandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_TOOLBARLOCKED, 0, NULL, NULL);
return 0;
hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
IID_PPV_ARG(IOleCommandTarget, &commandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_TOOLBARBANDSHOWN, 0, NULL, NULL);
return 0;
hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
IID_PPV_ARG(IOleCommandTarget, &commandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
return 0;
hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
IID_PPV_ARG(IOleCommandTarget, &commandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_LINKSBANDSHOWN, 0, NULL, NULL);
return 0;
hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
IID_PPV_ARG(IOleCommandTarget, &commandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_TEXTLABELS, 0, NULL, NULL);
return 0;
hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
IID_PPV_ARG(IOleCommandTarget, &commandTarget));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return 0;
hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_CUSTOMIZEENABLED, 0, NULL, NULL);
return 0;
}
hResult = theCabinet->Initialize(parameters->directoryPIDL, 0, 0, 0);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return E_OUTOFMEMORY;
while ((Ret = GetMessage(&Msg, NULL, 0, 0)) != 0)
if (pUnkSite == NULL)
return S_OK;
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fDockSite));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
if (theToolbar == NULL)
return E_OUTOFMEMORY;
hResult = theToolbar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theToolbar;
return hResult;