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

commit cd6e1c73c040d73308b3aeb7b06b33614d40ecf4
Author:     Kyle Katarn <cont...@kcsoftwares.com>
AuthorDate: Thu Apr 30 23:03:10 2020 +0200
Commit:     GitHub <nore...@github.com>
CommitDate: Thu Apr 30 23:03:10 2020 +0200

    [SHELL32] Fix "Open With..." spamming registry MRU keys. (#2685)
    
    CORE-16981
    
    The problem:
    ============
    
    - When opening "Open With..." dialog for a given file format, multiple MRU 
items are appended to registry : 2 items written, even if dialog is closed 
"cancel".
    - Expected behavior : 1 MRU item if execute is selected and 0 MRU if cancel 
is selected.
    
    Fix:
    ====
    
    - MRU item to be added when "Execute" is selected only.
    - Once added, set the presence flag to avoid multiple MRU items being added 
later.
---
 dll/win32/shell32/COpenWithMenu.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dll/win32/shell32/COpenWithMenu.cpp 
b/dll/win32/shell32/COpenWithMenu.cpp
index e9dd8018e35..2ad593bc559 100644
--- a/dll/win32/shell32/COpenWithMenu.cpp
+++ b/dll/win32/shell32/COpenWithMenu.cpp
@@ -534,8 +534,6 @@ VOID COpenWithList::LoadFromProgIdKey(HKEY hKey, LPCWSTR 
pwszExt)
         {
             StringCbCopyW(pApp->wszCmd, sizeof(pApp->wszCmd), wszCmd);
             SetRecommended(pApp);
-            if (!pApp->bMRUList)
-                AddAppToMRUList(pApp, pwszExt);
         }
     }
 }
@@ -653,6 +651,9 @@ BOOL COpenWithList::AddAppToMRUList(SApp *pApp, LPCWSTR 
pwszFilename)
         /* Insert the entry */
         AddMRUStringW(hList, pApp->wszFilename);
 
+        /* Set MRU presence */
+        pApp->bMRUList = TRUE;
+
         /* Close MRU list */
         FreeMRUList(hList);
     }

Reply via email to