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 <afs/param.h>
22 #include "afscfg.h" // Main header for this application
24 #include "get_pw_dlg.h"
28 * DEFINITIONS _________________________________________________________________
31 static HWND hDlg = 0; // HWND for this page's dialog
35 * PROTOTYPES _________________________________________________________________
38 static void OnInitDialog(HWND hwndDlg);
39 static void CheckEnableButtons();
40 static void SaveDlgInfo();
41 static void ShowPageInfo();
43 BOOL CALLBACK GetPwDlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
47 * EXPORTED FUNCTIONS _________________________________________________________
50 BOOL GetAfsPrincipalPassword(HWND hParent, TCHAR *&pszServerPW)
52 int nResult = ModalDialog(IDD_GET_PW, hParent, (DLGPROC)GetPwDlgProc);
53 if (nResult == IDOK) {
54 pszServerPW = g_CfgData.szServerPW;
65 * Dialog Proc _________________________________________________________________
68 BOOL CALLBACK GetPwDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
70 if (AfsAppLib_HandleHelp(IDD_GET_PW, hwndDlg, msg, wp, lp))
75 OnInitDialog(hwndDlg);
81 if (HIWORD(wp) == EN_CHANGE)
86 EndDialog(hDlg, IDCANCEL);
92 EndDialog(hDlg, IDOK);
103 * STATIC FUNCTIONS _________________________________________________________________
108 * Event Handler Functions _________________________________________________________________
111 static void OnInitDialog(HWND hwndDlg)
118 * Utility Functions _________________________________________________________________
121 static void CheckEnableButtons()
123 BOOL bDisable = FALSE;
125 TCHAR szDummy[cchRESOURCE];
127 bDisable |= lstrlen(GetWndText(hDlg, IDC_PW, szDummy)) == 0;
129 SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
132 static void SaveDlgInfo()
134 TCHAR szText[cchRESOURCE];
136 lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_PW, szText), MAX_SERVER_PW_LEN);
139 static void ShowPageInfo()
141 SetWndText(hDlg, IDC_PW, g_CfgData.szServerPW);