[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.
This commit is contained in:
Kyle Katarn 2020-04-30 23:03:10 +02:00 committed by GitHub
parent 5cd5598ea9
commit cd6e1c73c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}