[0.4.14][SHELL32] Bypass OpenWith for Delete and F2 (Rename) Keys (#4032) CORE-17810
authorJoachim Henze <Joachim.Henze@reactos.org>
Sat, 16 Oct 2021 23:03:35 +0000 (01:03 +0200)
committerJoachim Henze <Joachim.Henze@reactos.org>
Sat, 16 Oct 2021 23:03:35 +0000 (01:03 +0200)
Logspam started during 0.4.9-dev'ing when zipfldr got committed,
logspam became much worse by 0.4.10-dev-599-g 932df37
But the actual bug of 'calling those functions when not needed' is much older than that.

Fix picked from 0.4.15-dev-3275-g cee171f5d20c0d3c268372085ca4f32bc44d6740

dll/win32/shell32/CDefView.cpp

index b6756c1..8b14cb0 100644 (file)
@@ -1570,19 +1570,21 @@ cleanup:
 LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL bUseSelection)
 {
     HRESULT hResult;
-    HMENU hMenu;
-
-    hMenu = CreatePopupMenu();
-    if (!hMenu) 
-        return 0;
+    HMENU hMenu = NULL;
 
     hResult = GetItemObject( bUseSelection ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
     if (FAILED_UNEXPECTEDLY( hResult))
         goto cleanup;
+    if ((uCommand != FCIDM_SHVIEW_DELETE) && (uCommand != FCIDM_SHVIEW_RENAME))
+    {
+        hMenu = CreatePopupMenu();
+        if (!hMenu)
+            return 0;
 
-    hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
-    if (FAILED_UNEXPECTEDLY( hResult))
-        goto cleanup;
+        hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
+        if (FAILED_UNEXPECTEDLY(hResult))
+            goto cleanup;
+    }
 
     InvokeContextMenuCommand(uCommand);