1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-01 07:14:31 +00:00

winemenubuilder: Skip desktop integration for certain associations.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41275
This commit is contained in:
Alex Henrie 2023-04-05 19:26:38 -06:00 committed by Alexandre Julliard
parent fac1aabbef
commit 9d80b367ce

View File

@ -1974,6 +1974,46 @@ 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 = NULL;
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 = NULL;
}
}
RegCloseKey(key);
}
for (pattern = exclude_list ? exclude_list : default_exclude_list; *pattern; pattern += wcslen(pattern) + 1)
{
if (wcsstr(command, pattern))
{
found = TRUE;
break;
}
}
heap_free(exclude_list);
return found;
}
static WCHAR *get_special_mime_type(LPCWSTR extension)
{
if (!wcsicmp(extension, L".lnk"))
@ -2054,6 +2094,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 +2142,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);