[SHELL32]
[reactos.git] / reactos / dll / win32 / shell32 / CDefView.cpp
index 220aea3..d208057 100644 (file)
@@ -1212,7 +1212,11 @@ HRESULT CDefView::InvokeContextMenuCommand(UINT uCommand)
     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 @@ HRESULT CDefView::OpenSelectedItems()
         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 @@ LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
     m_cidl = m_ListView.GetSelectedCount();
 
     hResult = GetItemObject( m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
-    if (FAILEDhResult))
+    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 (FAILEDhResult))
+    if (FAILED_UNEXPECTEDLY(hResult))
         goto cleanup;
 
     uCommand = TrackPopupMenu(m_hContextMenu,
@@ -1336,13 +1340,13 @@ LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL bUseSelection)
         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 @@ LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
                 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 @@ HRESULT WINAPI CDefView::GetItemObject(UINT uItem, REFIID riid, LPVOID *ppvOut)
 
                 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 @@ HRESULT WINAPI CDefView::GetItemObject(UINT uItem, REFIID riid, LPVOID *ppvOut)
                 {
                     hr = CDefViewDual_Constructor(riid, (LPVOID*)&m_pShellFolderViewDual);
                     if (FAILED_UNEXPECTEDLY(hr))
-                    {
                         return hr;
-                    }
                 }
                 hr = m_pShellFolderViewDual->QueryInterface(riid, ppvOut);
             }
@@ -2249,6 +2248,8 @@ HRESULT WINAPI CDefView::GetItemObject(UINT uItem, REFIID riid, LPVOID *ppvOut)
         case SVGIO_SELECTION:
             GetSelections();
             hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, riid, 0, ppvOut);
+            if (FAILED_UNEXPECTEDLY(hr))
+                return hr;
             break;
     }