2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * INCLUDES ___________________________________________________________________
18 #include <afsconfig.h>
19 #include <afs/param.h>
24 #include "afscfg.h" // Main header for this application
26 #include "get_pw_dlg.h"
30 * DEFINITIONS _________________________________________________________________
33 static HWND hDlg = 0; // HWND for this page's dialog
37 * PROTOTYPES _________________________________________________________________
40 static void OnInitDialog(HWND hwndDlg);
41 static void CheckEnableButtons();
42 static void SaveDlgInfo();
43 static void ShowPageInfo();
45 BOOL CALLBACK GetPwDlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
49 * EXPORTED FUNCTIONS _________________________________________________________
52 BOOL GetAfsPrincipalPassword(HWND hParent, TCHAR *&pszServerPW)
54 int nResult = ModalDialog(IDD_GET_PW, hParent, (DLGPROC)GetPwDlgProc);
55 if (nResult == IDOK) {
56 pszServerPW = g_CfgData.szServerPW;
67 * Dialog Proc _________________________________________________________________
70 BOOL CALLBACK GetPwDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
72 if (AfsAppLib_HandleHelp(IDD_GET_PW, hwndDlg, msg, wp, lp))
77 OnInitDialog(hwndDlg);
83 if (HIWORD(wp) == EN_CHANGE)
88 EndDialog(hDlg, IDCANCEL);
93 EndDialog(hDlg, IDOK);
104 * STATIC FUNCTIONS _________________________________________________________________
109 * Event Handler Functions _________________________________________________________________
112 static void OnInitDialog(HWND hwndDlg)
119 * Utility Functions _________________________________________________________________
122 static void CheckEnableButtons()
124 BOOL bDisable = FALSE;
126 TCHAR szDummy[cchRESOURCE];
128 bDisable |= lstrlen(GetWndText(hDlg, IDC_PW, szDummy)) == 0;
130 SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
133 static void SaveDlgInfo()
135 TCHAR szText[cchRESOURCE];
137 lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_PW, szText), MAX_SERVER_PW_LEN);
140 static void ShowPageInfo()
142 SetWndText(hDlg, IDC_PW, g_CfgData.szServerPW);