[glib: 13/19] GWin32AppInfo: be more permissive about verbs in capable apps




commit e7a738711bab8c8e4568fb08acd587f5b753c5c0
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Tue Dec 15 07:55:28 2020 +0000

    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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]