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>
27 * DEFINITIONS _________________________________________________________________
30 static HWND hDlg
= 0; // HWND for this page's dialog
34 * PROTOTYPES _________________________________________________________________
37 static void OnInitDialog(HWND hwndDlg
);
38 static void CheckEnableButtons();
39 static BOOL
SavePageInfo();
40 static void ShowPageInfo();
41 static void IsFirstServer(BOOL bIs
= TRUE
);
45 * EXPORTED FUNCTIONS _________________________________________________________________
50 * Dialog Procs _________________________________________________________________
53 BOOL CALLBACK
InfoPageDlgProc(HWND hRHS
, UINT msg
, WPARAM wp
, LPARAM lp
)
55 if (WizStep_Common_DlgProc (hRHS
, msg
, wp
, lp
))
67 g_pWiz
->SetState (sidSTEP_THREE
);
72 g_pWiz
->SetState (sidSTEP_ONE
);
75 case IDC_FIRST_SERVER
:
79 case IDC_JOIN_EXISTING_CELL
:
86 if (HIWORD(wp
) == EN_CHANGE
)
98 * STATIC FUNCTIONS ________________________________________________________________________
103 * Event Handler Functions _________________________________________________________________
106 static void OnInitDialog(HWND hwndDlg
)
110 g_pWiz
->EnableButtons(BACK_BUTTON
);
114 if (g_CfgData
.bFirstServer
)
117 g_pWiz
->SetDefaultControl(IDC_CELL_NAME
);
122 * Utility Functions _________________________________________________________________
125 static void CheckEnableButtons()
127 BOOL bDisable
= FALSE
;
129 TCHAR szCellName
[cchRESOURCE
];
130 TCHAR szPW
[cchRESOURCE
];
131 TCHAR szVerifyPW
[cchRESOURCE
];
133 bDisable
= lstrlen(GetWndText(hDlg
, IDC_CELL_NAME
, szCellName
)) == 0;
135 GetWndText(hDlg
, IDC_SERVER_PW
, szPW
);
136 GetWndText(hDlg
, IDC_VERIFY_PW
, szVerifyPW
);
138 if (IsButtonChecked(hDlg
, IDC_FIRST_SERVER
))
139 bDisable
|= !lstrlen(szPW
) || !lstrlen(szVerifyPW
) || lstrcmp(szPW
, szVerifyPW
);
142 g_pWiz
->EnableButtons(BACK_BUTTON
);
144 g_pWiz
->EnableButtons(BACK_BUTTON
| NEXT_BUTTON
);
147 static BOOL
SavePageInfo()
149 TCHAR szText
[cchRESOURCE
];
151 GetWndText(hDlg
, IDC_CELL_NAME
, szText
);
152 if (lstrlen(szText
) > MAX_CELL_NAME_LEN
) {
153 MsgBox(hDlg
, IDS_CELL_NAME_LEN_ERROR
, GetAppTitleID(), MB_ICONSTOP
| MB_OK
);
157 lstrcpy(g_CfgData
.szCellName
, szText
);
158 lstrncpy(g_CfgData
.szServerPW
, GetWndText(hDlg
, IDC_SERVER_PW
, szText
), MAX_SERVER_PW_LEN
);
159 g_CfgData
.bFirstServer
= IsButtonChecked(hDlg
, IDC_FIRST_SERVER
);
164 static void ShowPageInfo()
166 SetWndText(hDlg
, IDC_CELL_NAME
, g_CfgData
.szCellName
);
167 SetWndText(hDlg
, IDC_SERVER_PW
, g_CfgData
.szServerPW
);
168 SetWndText(hDlg
, IDC_VERIFY_PW
, g_CfgData
.szServerPW
);
170 if (g_CfgData
.bFirstServer
)
171 SetCheck(hDlg
, IDC_FIRST_SERVER
);
173 SetCheck(hDlg
, IDC_JOIN_EXISTING_CELL
);
176 static void IsFirstServer(BOOL bIs
)
185 SetEnable(hDlg
, IDC_PRINCIPAL_LABEL
, es
);
186 SetEnable(hDlg
, IDC_PRINCIPAL
, es
);
188 SetEnable(hDlg
, IDC_SERVER_PW_FRAME
, es
);
189 SetEnable(hDlg
, IDC_SERVER_PW_LABEL
, es
);
190 SetEnable(hDlg
, IDC_SERVER_PW_PROMPT
, es
);
191 SetEnable(hDlg
, IDC_SERVER_PW
, es
);
192 SetEnable(hDlg
, IDC_VERIFY_PW_LABEL
, es
);
193 SetEnable(hDlg
, IDC_VERIFY_PW
, es
);
195 CheckEnableButtons();