https://git.reactos.org/?p=reactos.git;a=commitdiff;h=17ec81eab85d403b64428…
commit 17ec81eab85d403b64428dac35a3e863fd070289
Author: Doug Lyons <douglyons(a)douglyons.com>
AuthorDate: Tue Nov 2 19:16:47 2021 -0500
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Nov 3 03:16:47 2021 +0300
[SHELL32] Enable OpenWith to handle "NoOpenWith" and "NoStartPage"
registry keys (#4043)
- Add registry handling of two keys to COpenWithMenu.cpp
- Add code to stop OpenWith from using registry entries that should be excluded
- Stop logspam when right-click menu testing for OpenWith is done
CORE-17816
---
dll/win32/shell32/COpenWithMenu.cpp | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/dll/win32/shell32/COpenWithMenu.cpp b/dll/win32/shell32/COpenWithMenu.cpp
index 903d66f5d53..335236d96ae 100644
--- a/dll/win32/shell32/COpenWithMenu.cpp
+++ b/dll/win32/shell32/COpenWithMenu.cpp
@@ -110,7 +110,7 @@ COpenWithList::~COpenWithList()
BOOL COpenWithList::Load()
{
- HKEY hKey;
+ HKEY hKey, hKeyApp;
WCHAR wszName[256], wszBuf[100];
DWORD i = 0, cchName, dwSize;
SApp *pApp;
@@ -131,18 +131,38 @@ BOOL COpenWithList::Load()
if (pApp)
{
- StringCbPrintfW(wszBuf, sizeof(wszBuf),
L"%s\\shell\\open\\command", wszName);
- dwSize = sizeof(pApp->wszCmd);
- if (RegGetValueW(hKey, wszBuf, L"", RRF_RT_REG_SZ, NULL,
pApp->wszCmd, &dwSize) != ERROR_SUCCESS)
+ if (RegOpenKeyW(hKey, wszName, &hKeyApp) == ERROR_SUCCESS)
{
- ERR("Failed to add app %ls\n", wszName);
- pApp->bHidden = TRUE;
+ if ((RegQueryValueExW(hKeyApp, L"NoOpenWith", NULL, NULL,
NULL, NULL) != ERROR_SUCCESS) &&
+ (RegQueryValueExW(hKeyApp, L"NoStartPage", NULL, NULL,
NULL, NULL) != ERROR_SUCCESS))
+ {
+ StringCbPrintfW(wszBuf, sizeof(wszBuf),
L"%s\\shell\\open\\command", wszName);
+ dwSize = sizeof(pApp->wszCmd);
+ if (RegGetValueW(hKey, wszBuf, L"", RRF_RT_REG_SZ, NULL,
pApp->wszCmd, &dwSize) != ERROR_SUCCESS)
+ {
+ ERR("Failed to add app %ls\n", wszName);
+ pApp->bHidden = TRUE;
+ }
+ else
+ {
+ TRACE("App added %ls\n", pApp->wszCmd);
+ }
+ }
+ else
+ {
+ pApp->bHidden = TRUE;
+ }
+ RegCloseKey(hKeyApp);
}
else
- TRACE("App added %ls\n", pApp->wszCmd);
+ {
+ pApp->bHidden = TRUE;
+ }
}
else
+ {
ERR("AddInternal failed\n");
+ }
}
RegCloseKey(hKey);