mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 23:40:13 +00:00
windows-afscreds-vista-uac-20080211
LICENSE MIT FIXES 82701 Modifying the registry and the startup shortcuts is not permitted under Vista UAC. Generate an error dialog and notify the end user.
This commit is contained in:
parent
61bb3b7f09
commit
7a8d8da95f
@ -295,18 +295,28 @@ void Advanced_OnOpenCPL (HWND hDlg)
|
||||
|
||||
void Advanced_OnStartup (HWND hDlg)
|
||||
{
|
||||
g.fStartup = IsDlgButtonChecked (hDlg, IDC_STARTUP);
|
||||
BOOL bSuccess = FALSE;
|
||||
g.fStartup = IsDlgButtonChecked (hDlg, IDC_STARTUP);
|
||||
|
||||
HKEY hk;
|
||||
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), 0, NULL, 0,
|
||||
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
|
||||
{
|
||||
DWORD dwSize = sizeof(g.fStartup);
|
||||
DWORD dwType = REG_DWORD;
|
||||
RegSetValueEx (hk, TEXT("ShowTrayIcon"), NULL, dwType, (PBYTE)&g.fStartup, dwSize);
|
||||
RegCloseKey (hk);
|
||||
}
|
||||
HKEY hk;
|
||||
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), 0, NULL, 0,
|
||||
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
|
||||
{
|
||||
DWORD dwSize = sizeof(g.fStartup);
|
||||
DWORD dwType = REG_DWORD;
|
||||
RegSetValueEx (hk, TEXT("ShowTrayIcon"), NULL, dwType, (PBYTE)&g.fStartup, dwSize);
|
||||
RegCloseKey (hk);
|
||||
|
||||
Shortcut_FixStartup (cszSHORTCUT_NAME, g.fStartup);
|
||||
bSuccess = Shortcut_FixStartup (cszSHORTCUT_NAME, g.fStartup);
|
||||
}
|
||||
|
||||
if (!bSuccess) {
|
||||
// Reset the state
|
||||
g.fStartup = !g.fStartup;
|
||||
CheckDlgButton(hDlg, IDC_STARTUP, g.fStartup);
|
||||
|
||||
// Report error to user
|
||||
Message (MB_OK | MB_ICONHAND, IDS_STARTUP_CHANGE_TITLE, IDS_STARTUP_CHANGE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,6 +561,8 @@ BEGIN
|
||||
IDS_BADSUB_DESC "The drive letter description you entered cannot be used.\n\nA drive letter description may have no more than 12 characters, and may not contain spaces or tabs."
|
||||
IDS_TITLE_95 "AFS Light"
|
||||
IDS_CREDS_EXPIRED "%1 (expired)"
|
||||
IDS_STARTUP_CHANGE_TITLE "Error - Startup Setting"
|
||||
IDS_STARTUP_CHANGE_ERROR "Unable to change startup state.\nPermission denied."
|
||||
END
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -151,7 +151,7 @@ BOOL InitApp (LPSTR pszCmdLineA)
|
||||
fUninstall = TRUE;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
case ':':
|
||||
CopyAnsiToString(g.SmbName,pszCmdLineA);
|
||||
MapShareName(pszCmdLineA);
|
||||
break;
|
||||
@ -178,7 +178,7 @@ BOOL InitApp (LPSTR pszCmdLineA)
|
||||
else if (fUninstall)
|
||||
Shortcut_FixStartup (cszSHORTCUT_NAME, g.fStartup = FALSE);
|
||||
|
||||
if (fInstall)
|
||||
if (fInstall || fUninstall)
|
||||
{
|
||||
HKEY hk;
|
||||
if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0, NULL, 0,
|
||||
|
@ -59,6 +59,8 @@
|
||||
#define IDS_BADSUB_DESC 49
|
||||
#define IDS_TITLE_95 50
|
||||
#define IDS_CREDS_EXPIRED 51
|
||||
#define IDS_STARTUP_CHANGE_TITLE 52
|
||||
#define IDS_STARTUP_CHANGE_ERROR 53
|
||||
|
||||
#define IDI_MAIN 100
|
||||
#define IDD_MAIN 101
|
||||
|
@ -82,9 +82,10 @@ BOOL Shortcut_Create (LPTSTR pszTarget, LPCTSTR pszSource, LPTSTR pszDesc, LPTST
|
||||
}
|
||||
|
||||
|
||||
void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
|
||||
BOOL Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
|
||||
{
|
||||
TCHAR szShortcut[ MAX_PATH + 10 ] = TEXT("");
|
||||
BOOL bSuccess;
|
||||
|
||||
HKEY hk;
|
||||
if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), &hk) == 0)
|
||||
@ -136,11 +137,13 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
|
||||
RegCloseKey (hk);
|
||||
}
|
||||
}
|
||||
Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", szParams);
|
||||
bSuccess = Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", szParams);
|
||||
}
|
||||
else // (!g.fAutoStart)
|
||||
{
|
||||
DeleteFile (szShortcut);
|
||||
bSuccess = DeleteFile (szShortcut);
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
void Shortcut_Init (void);
|
||||
void Shortcut_Exit (void);
|
||||
BOOL Shortcut_Create (LPTSTR pszTarget, LPCTSTR pszSource, LPTSTR pszDesc = NULL, LPTSTR pszArgs = NULL);
|
||||
void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart);
|
||||
BOOL Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart);
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user