https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cee171f5d20c0d3c268372085ca4f32bc44d6740

commit cee171f5d20c0d3c268372085ca4f32bc44d6740
Author:     Doug Lyons <[email protected]>
AuthorDate: Thu Oct 14 16:03:53 2021 -0500
Commit:     GitHub <[email protected]>
CommitDate: Thu Oct 14 23:03:53 2021 +0200

    [SHELL32] Bypass OpenWith for Delete and F2 (Rename) Keys (#4032) CORE-17810
    
    
    Logspam started during 0.4.9-dev'ing when zipfldr got committed, logspam 
became much worse by
    0.4.10-dev-599-g 932df378bf35146a56c796bec36c5c689109fbd6
    But the actual bug of 'calling those functions when not needed' is much 
older than that.
    
    I do intend to port this improvement back into older rls-branches.
---
 dll/win32/shell32/CDefView.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp
index 00e310397f4..1a15523491d 100644
--- a/dll/win32/shell32/CDefView.cpp
+++ b/dll/win32/shell32/CDefView.cpp
@@ -1573,19 +1573,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;
+    }
 
     if (bUseSelection)
     {

Reply via email to