From f0f49b80b0f4c5b400874dbe1fdeb6993bf20bee Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 28 Feb 2004 06:26:05 +0000 Subject: [PATCH] afscreds-shortcut-params-20040227 Obtain Shortcut Parameters from Registry Key {HKLM, HKCU}\SOFTWARE\OpenAFS\Client (REG_SZ) AfscredsShortcutParams Default value is "-A -M -N -Q" if not found --- src/WINNT/client_creds/afskfw.c | 2 +- src/WINNT/client_creds/shortcut.cpp | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/WINNT/client_creds/afskfw.c b/src/WINNT/client_creds/afskfw.c index e4f1df193..3e5c3ca45 100644 --- a/src/WINNT/client_creds/afskfw.c +++ b/src/WINNT/client_creds/afskfw.c @@ -457,7 +457,7 @@ KFW_cleanup(void) FreeLibrary(hCCAPI); } -char OpenAFSConfigKeyName[] = "SOFTWARE\\OpenAFS\\Client"; +static char OpenAFSConfigKeyName[] = "SOFTWARE\\OpenAFS\\Client"; int KFW_is_available(void) diff --git a/src/WINNT/client_creds/shortcut.cpp b/src/WINNT/client_creds/shortcut.cpp index 811c901df..9508dd265 100644 --- a/src/WINNT/client_creds/shortcut.cpp +++ b/src/WINNT/client_creds/shortcut.cpp @@ -41,6 +41,7 @@ void Shortcut_Exit (void) CoUninitialize(); } +static char OpenAFSConfigKeyName[] = "SOFTWARE\\OpenAFS\\Client"; BOOL Shortcut_Create (LPTSTR pszTarget, LPCTSTR pszSource, LPTSTR pszDesc, LPTSTR pszArgs) { @@ -110,12 +111,27 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart) GetModuleFileName (GetModuleHandle(NULL), szSource, MAX_PATH); if (fAutoStart) - { - Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", AFSCREDS_SHORTCUT_OPTIONS); - } + { + DWORD code, len, type; + TCHAR szParams[ 64 ] = TEXT(AFSCREDS_SHORTCUT_OPTIONS); + + code = RegOpenKeyEx(HKEY_CURRENT_USER, OpenAFSConfigKeyName, + 0, KEY_QUERY_VALUE, &hk); + if (code != ERROR_SUCCESS) + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, OpenAFSConfigKeyName, + 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) - { + { DeleteFile (szShortcut); - } + } } -- 2.39.5