Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41275
A version of this patch has been in Wine Staging since March 2020.
-- v5: winemenubuilder: Skip desktop integration for certain associations.
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41275 --- programs/winemenubuilder/winemenubuilder.c | 56 ++++++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-)
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 1579ca8dafa..ca4f8070888 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1974,6 +1974,48 @@ static BOOL is_extension_banned(LPCWSTR extension) return FALSE; }
+static BOOL on_exclude_list(const WCHAR *command) +{ + static const WCHAR default_exclude_list[] = L"ieframe.dll\0iexplore.exe\0notepad.exe\0" + L"winebrowser.exe\0wordpad.exe\0"; + WCHAR *exclude_list = (WCHAR *)default_exclude_list; + const WCHAR *pattern; + HKEY key; + DWORD size; + LSTATUS status; + BOOL found = FALSE; + + if ((key = open_associations_reg_key())) + { + status = RegGetValueW(key, NULL, L"Exclude", RRF_RT_REG_MULTI_SZ, NULL, NULL, &size); + if (status == ERROR_SUCCESS) + { + exclude_list = xmalloc(size); + status = RegGetValueW(key, NULL, L"Exclude", RRF_RT_REG_MULTI_SZ, NULL, exclude_list, &size); + if (status != ERROR_SUCCESS) + { + heap_free(exclude_list); + exclude_list = (WCHAR *)default_exclude_list; + } + } + RegCloseKey(key); + } + + for (pattern = exclude_list; *pattern; pattern = wcschr(pattern, 0) + 1) + { + if (wcsstr(command, pattern)) + { + found = TRUE; + break; + } + } + + if (exclude_list != default_exclude_list) + heap_free(exclude_list); + + return found; +} + static WCHAR *get_special_mime_type(LPCWSTR extension) { if (!wcsicmp(extension, L".lnk")) @@ -2054,6 +2096,15 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic WCHAR *mimeProgId = NULL; struct rb_string_entry *entry;
+ commandW = assoc_query(ASSOCSTR_COMMAND, extensionW, L"open"); + if (commandW == NULL) + /* no command => no application is associated */ + goto end; + + if (on_exclude_list(commandW)) + /* command is on the exclude list => desktop integration is not desirable */ + goto end; + wcslwr(extensionW); friendlyDocNameW = assoc_query(ASSOCSTR_FRIENDLYDOCNAME, extensionW, NULL);
@@ -2093,11 +2144,6 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic hasChanged = TRUE; }
- commandW = assoc_query(ASSOCSTR_COMMAND, extensionW, L"open"); - if (commandW == NULL) - /* no command => no application is associated */ - goto end; - executableW = assoc_query(ASSOCSTR_EXECUTABLE, extensionW, L"open"); if (executableW) openWithIcon = compute_native_identifier(0, executableW, NULL);
On Thu Apr 6 01:27:47 2023 +0000, Alexandre Julliard wrote:
The new patch has winemenubuilder create the registry value if it does
not exist. Again, we should not be creating config keys, this will prevent changing the defaults or removing the key.
That you for clarifying that you don't want the value populated from either wine.inf or winemenubuilder. I have pushed a new version that does not automatically populate the value at all.