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 ___________________________________________________________________
15 #include <afs/param.h>
19 #include "afscfg.h" // Main header for this application
21 #include "get_pw_dlg.h"
25 * DEFINITIONS _________________________________________________________________
28 static HWND hDlg = 0; // HWND for this page's dialog
32 * PROTOTYPES _________________________________________________________________
35 static void OnInitDialog(HWND hwndDlg);
36 static void CheckEnableButtons();
37 static void SaveDlgInfo();
38 static void ShowPageInfo();
40 BOOL CALLBACK GetPwDlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
44 * EXPORTED FUNCTIONS _________________________________________________________
47 BOOL GetAfsPrincipalPassword(HWND hParent, TCHAR *&pszServerPW)
49 int nResult = ModalDialog(IDD_GET_PW, hParent, (DLGPROC)GetPwDlgProc);
50 if (nResult == IDOK) {
51 pszServerPW = g_CfgData.szServerPW;
62 * Dialog Proc _________________________________________________________________
65 BOOL CALLBACK GetPwDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
67 if (AfsAppLib_HandleHelp(IDD_GET_PW, hwndDlg, msg, wp, lp))
72 OnInitDialog(hwndDlg);
78 if (HIWORD(wp) == EN_CHANGE)
83 EndDialog(hDlg, IDCANCEL);
89 EndDialog(hDlg, IDOK);
100 * STATIC FUNCTIONS _________________________________________________________________
105 * Event Handler Functions _________________________________________________________________
108 static void OnInitDialog(HWND hwndDlg)
115 * Utility Functions _________________________________________________________________
118 static void CheckEnableButtons()
120 BOOL bDisable = FALSE;
122 TCHAR szDummy[cchRESOURCE];
124 bDisable |= lstrlen(GetWndText(hDlg, IDC_PW, szDummy)) == 0;
126 SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
129 static void SaveDlgInfo()
131 TCHAR szText[cchRESOURCE];
133 lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_PW, szText), MAX_SERVER_PW_LEN);
136 static void ShowPageInfo()
138 SetWndText(hDlg, IDC_PW, g_CfgData.szServerPW);