Author: gadamopoulos
Date: Thu Nov 10 09:34:14 2016
New Revision: 73189
URL:
http://svn.reactos.org/svn/reactos?rev=73189&view=rev
Log:
[SHELL32] - CStartMenu: Add missing checks for failure and make some checks noisy.
CORE-12300
Modified:
trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp [iso-8859-1] Thu Nov 10
09:34:14 2016
@@ -167,6 +167,8 @@
return hr;
hr = pShellMenu->Initialize(this, 0, ANCESTORDEFAULT, SMINIT_VERTICAL);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
switch (psmd->uId)
{
@@ -188,11 +190,22 @@
LPITEMIDLIST pidlStartMenu;
IShellFolder *psfDestop;
hr = SHGetFolderLocation(NULL, csidl, 0, 0, &pidlStartMenu);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
hr = SHGetDesktopFolder(&psfDestop);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
hr = psfDestop->BindToObject(pidlStartMenu, NULL,
IID_PPV_ARG(IShellFolder, &psfStartMenu));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
}
hr = pShellMenu->SetShellFolder(psfStartMenu, NULL, NULL, 0);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
}
else
{
@@ -202,6 +215,8 @@
if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii))
{
hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
}
}
return pShellMenu->QueryInterface(iid, pv);
@@ -475,7 +490,7 @@
/* psf is a merged folder, so now we want to get the pidl of the programs item from
the merged folder */
{
hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS,
&pidlProgramsAbsolute);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
{
WARN("USER Programs folder not found.");
hr = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_PROGRAMS,
&pidlProgramsAbsolute);
@@ -489,11 +504,11 @@
TCHAR szDisplayName[MAX_PATH];
hr = SHBindToParent(pidlProgramsAbsolute, IID_PPV_ARG(IShellFolder,
&psfParent), &pcidlPrograms);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = psfParent->GetDisplayNameOf(pcidlPrograms, SHGDN_FORPARSING |
SHGDN_INFOLDER, &str);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
StrRetToBuf(&str, pcidlPrograms, szDisplayName, _countof(szDisplayName));
@@ -501,7 +516,7 @@
/* We got the display name from the fs folder and we parse it with the merged
folder here */
hr = psf->ParseDisplayName(NULL, NULL, szDisplayName, NULL, &pidlPrograms,
NULL);
- if (FAILED(hr))
+ if (FAILED_UNEXPECTEDLY(hr))
return hr;
}