From e7a738711bab8c8e4568fb08acd587f5b753c5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Tue, 15 Dec 2020 07:55:28 +0000 Subject: [PATCH] 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). --- gio/gwin32appinfo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c index 9544719b8..bcabad71a 100644 --- a/gio/gwin32appinfo.c +++ b/gio/gwin32appinfo.c @@ -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,