shortcut-params-20040804
authorJeffrey Altman <jaltman@mit.edu>
Wed, 4 Aug 2004 16:54:42 +0000 (16:54 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 4 Aug 2004 16:54:42 +0000 (16:54 +0000)
Fix the retrieval of the shortcut params from the registry when the
HKCU\Software\Openafs\Client key exists but the AfscredsShortcutParams
is missing.

src/WINNT/client_creds/shortcut.cpp

index 6bce0c7..da0f392 100644 (file)
@@ -115,9 +115,6 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
 
        code = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_OPENAFS_CLIENT,
                             0, KEY_QUERY_VALUE, &hk);
-       if (code != ERROR_SUCCESS)
-           code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_OPENAFS_CLIENT,
-                                0, KEY_QUERY_VALUE, &hk);
        if (code == ERROR_SUCCESS) {
            len = sizeof(szParams);
            type = REG_SZ;
@@ -125,6 +122,17 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
                                    (BYTE *) &szParams, &len);
            RegCloseKey (hk);
        }
+       if (code != ERROR_SUCCESS) {
+           code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_OPENAFS_CLIENT,
+                                0, KEY_QUERY_VALUE, &hk);
+           if (code == ERROR_SUCCESS) {
+               len = sizeof(szParams);
+               type = REG_SZ;
+               code = RegQueryValueEx(hk, "AfscredsShortcutParams", NULL, &type,
+                                       (BYTE *) &szParams, &len);
+               RegCloseKey (hk);
+           }
+       }
        Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", szParams);
    }
    else // (!g.fAutoStart)