Author: gadamopoulos
Date: Thu Nov 10 08:05:13 2016
New Revision: 73187
URL:
http://svn.reactos.org/svn/reactos?rev=73187&view=rev
Log:
[SHELL32]
- Make some checks for failure in CDefView and CDefaultContextMenu noisy.
Modified:
trunk/reactos/dll/win32/shell32/CDefView.cpp
trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp
trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp
Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefView…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CDefView.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDefView.cpp [iso-8859-1] Thu Nov 10 08:05:13 2016
@@ -1212,7 +1212,11 @@
if (GetKeyState(VK_CONTROL) & 0x8000)
cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
- return m_pCM->InvokeCommand(&cmi);
+ HRESULT hr = m_pCM->InvokeCommand(&cmi);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
}
/**********************************************************
@@ -1237,13 +1241,13 @@
return E_FAIL;
hResult = GetItemObject(SVGIO_SELECTION, IID_PPV_ARG(IContextMenu, &m_pCM));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
goto cleanup;
IUnknown_SetSite(m_pCM, (IShellView *)this);
hResult = m_pCM->QueryContextMenu(hMenu, 0, 0x20, 0x7fff, CMF_DEFAULTONLY);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
goto cleanup;
uCommand = GetMenuDefaultItem(hMenu, FALSE, 0);
@@ -1290,13 +1294,13 @@
m_cidl = m_ListView.GetSelectedCount();
hResult = GetItemObject( m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND,
IID_PPV_ARG(IContextMenu, &m_pCM));
- if (FAILED( hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
goto cleanup;
IUnknown_SetSite(m_pCM, (IShellView *)this);
hResult = m_pCM->QueryContextMenu(m_hContextMenu, 0, FCIDM_SHVIEWFIRST,
FCIDM_SHVIEWLAST, CMF_NORMAL);
- if (FAILED( hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
goto cleanup;
uCommand = TrackPopupMenu(m_hContextMenu,
@@ -1336,13 +1340,13 @@
return 0;
hResult = GetItemObject( bUseSelection ? SVGIO_SELECTION : SVGIO_BACKGROUND,
IID_PPV_ARG(IContextMenu, &m_pCM));
- if (FAILED( hResult))
+ if (FAILED_UNEXPECTEDLY( hResult))
goto cleanup;
IUnknown_SetSite(m_pCM, (IShellView *)this);
hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST,
CMF_NORMAL);
- if (FAILED( hResult))
+ if (FAILED_UNEXPECTEDLY( hResult))
goto cleanup;
InvokeContextMenuCommand(uCommand);
@@ -1688,11 +1692,8 @@
if (m_pSF2Parent)
{
SHELLDETAILS sd;
- if (FAILED(m_pSF2Parent->GetDetailsOf(pidl,
lpdi->item.iSubItem, &sd)))
- {
- FIXME("failed to get details\n");
+ if (FAILED_UNEXPECTEDLY(m_pSF2Parent->GetDetailsOf(pidl,
lpdi->item.iSubItem, &sd)))
break;
- }
if (lpnmh->code == LVN_GETDISPINFOA)
{
@@ -2228,7 +2229,7 @@
IContextMenu* pcm;
hr = CDefFolderMenu_Create2(NULL, NULL, 0, NULL, m_pSFParent, NULL, 0,
NULL, &pcm);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
*ppvOut = pcm;
}
@@ -2238,9 +2239,7 @@
{
hr = CDefViewDual_Constructor(riid,
(LPVOID*)&m_pShellFolderViewDual);
if (FAILED_UNEXPECTEDLY(hr))
- {
return hr;
- }
}
hr = m_pShellFolderViewDual->QueryInterface(riid, ppvOut);
}
@@ -2249,6 +2248,8 @@
case SVGIO_SELECTION:
GetSelections();
hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, riid, 0,
ppvOut);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
break;
}
Modified: trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefault…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp [iso-8859-1] Thu Nov 10
08:05:13 2016
@@ -360,9 +360,7 @@
PDynamicShellEntry pEntry = (DynamicShellEntry *)HeapAlloc(GetProcessHeap(), 0,
sizeof(DynamicShellEntry));
if (!pEntry)
- {
return E_OUTOFMEMORY;
- }
pEntry->iIdCmdFirst = 0;
pEntry->pNext = NULL;
@@ -829,7 +827,11 @@
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- return psv->Refresh();
+ hr = psv->Refresh();
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
}
HRESULT CDefaultContextMenu::DoPaste(LPCMINVOKECOMMANDINFO lpcmi, BOOL bLink)
@@ -932,7 +934,11 @@
m_pDataObj->SetData(&formatetc, &medium, TRUE);
}
- return OleSetClipboard(m_pDataObj);
+ HRESULT hr = OleSetClipboard(m_pDataObj);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
}
HRESULT CDefaultContextMenu::DoRename(LPCMINVOKECOMMANDINFO lpcmi)
@@ -954,7 +960,10 @@
return hr;
SVSIF selFlags = SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED
| SVSI_SELECT;
- lpSV->SelectItem(m_apidl[0], selFlags);
+ hr = lpSV->SelectItem(m_apidl[0], selFlags);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
return S_OK;
}
@@ -1115,10 +1124,12 @@
hr = psv->SelectItem(pidlNewItem, SVSI_DESELECTOTHERS | SVSI_EDIT |
SVSI_ENSUREVISIBLE |
SVSI_FOCUSED | SVSI_SELECT);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
SHFree(pidl);
- return hr;
+ return S_OK;
}
PDynamicShellEntry CDefaultContextMenu::GetDynamicEntry(UINT idCmd)
@@ -1216,7 +1227,7 @@
/* Try to get the flag from the verb */
hr = StringCbPrintfW(wszKey, sizeof(wszKey), L"shell\\%s",
pEntry->szVerb);
- if (!SUCCEEDED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return 0;
cbVerb = sizeof(wFlags);
@@ -1650,7 +1661,11 @@
if (!pdcm->aKeys && pdcm->cidl)
HackFillKeys((DEFCONTEXTMENU *)pdcm, hkeyHack);
- return CDefaultContextMenu_CreateInstance(pdcm, riid, ppv);
+ HRESULT hr = CDefaultContextMenu_CreateInstance(pdcm, riid, ppv);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
}
/*************************************************************************
@@ -1683,6 +1698,8 @@
pdcm.aKeys = ahkeyClsKeys;
HRESULT hr = SHCreateDefaultContextMenu(&pdcm, IID_PPV_ARG(IContextMenu, ppcm));
- return hr;
-}
-
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
+}
Modified: trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp [iso-8859-1] Thu Nov 10
08:05:13 2016
@@ -54,8 +54,8 @@
{
CComPtr<IDefaultExtractIconInit> initIcon;
HRESULT hr =
SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit,&initIcon));
- if (FAILED(hr))
- return NULL;
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
/* FIXME: other icons for default, network, print to file */
initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_PRINTER);