GWin32AppInfo: be more permissive about verbs in capable apps

MSDN doesn't say much on this subject, but i've seen apps in the wild
that have the "shell" subkey with verbs *either* in the root app key *or*
in the "Capabilities" subkey of the root key. Accommodate either case by trying both
(root key gets a priority, since this is how MS Address Book is registered -
assume that MS knows how to do this the right way).
This commit is contained in:
Руслан Ижбулатов 2020-12-15 07:55:28 +00:00
parent 10def41dc5
commit e7a738711b

View File

@ -2255,6 +2255,7 @@ read_capable_app (const gunichar2 *app_key_path,
GWin32RegistryKey *associations;
const reg_verb *preferred_verb;
GList *verbs = NULL;
gboolean verbs_in_root_key = TRUE;
appkey = NULL;
capabilities = NULL;
@ -2269,7 +2270,9 @@ read_capable_app (const gunichar2 *app_key_path,
&app_key_path_u8_folded) ||
(appkey = g_win32_registry_key_new_w (app_key_path, NULL)) == NULL ||
(capabilities = g_win32_registry_key_get_child_w (appkey, L"Capabilities", NULL)) == NULL ||
!get_verbs (capabilities, &preferred_verb, &verbs, L"", L"Shell", NULL))
!(get_verbs (appkey, &preferred_verb, &verbs, L"", L"Shell", NULL) ||
(verbs_in_root_key = FALSE) ||
get_verbs (capabilities, &preferred_verb, &verbs, L"", L"Shell", NULL)))
{
g_clear_pointer (&canonical_name_u8, g_free);
g_clear_pointer (&canonical_name_folded, g_free);
@ -2291,7 +2294,7 @@ read_capable_app (const gunichar2 *app_key_path,
process_verbs_commands (g_steal_pointer (&verbs),
preferred_verb,
L"", /* [ab]use the fact that two strings are simply concatenated */
g_win32_registry_key_get_path_w (capabilities),
verbs_in_root_key ? app_key_path : g_win32_registry_key_get_path_w (capabilities),
FALSE,
app_add_verb,
app,