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>
24
* DEFINITIONS _________________________________________________________________
27
static HWND hDlg = 0; // HWND for this page's dialog
29
#define FIRST_SERVER_STEP sidSTEP_THREE
30
#define NOT_FIRST_SERVER_STEP sidSTEP_FOUR
33
#define MAX_AFS_UID UD_MAXVAL
37
* PROTOTYPES _________________________________________________________________
40
static void OnInitDialog(HWND hwndDlg);
41
static void CheckEnableButtons();
42
static void SavePageInfo();
43
static void ShowPageInfo();
44
static void UseNextUid(BOOL bUseNext);
48
* EXPORTED FUNCTIONS _________________________________________________________________
53
* Dialog Procs _________________________________________________________________
56
BOOL CALLBACK InfoPage2DlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp)
58
if (WizStep_Common_DlgProc (hRHS, msg, wp, lp))
69
if (HIWORD(wp) == wcIS_STATE_DISABLED) {
70
int nState = g_pWiz->GetState();
72
// Disable step 3 if we are not the first server
73
if (nState == sidSTEP_THREE)
74
return !g_CfgData.bFirstServer;
76
// Disable step 4 if we are the first server
77
if (nState == sidSTEP_FOUR)
78
return g_CfgData.bFirstServer;
84
g_pWiz->SetState (sidSTEP_FIVE);
89
g_pWiz->SetState (sidSTEP_TWO);
92
case IDC_USE_NEXT_UID:
97
case IDC_USE_THIS_UID:
104
case IDC_VERIFY_ADMIN_PW:
106
if (HIWORD(wp) == EN_CHANGE)
107
CheckEnableButtons();
118
* STATIC FUNCTIONS _________________________________________________________________
123
* Event Handler Functions _________________________________________________________________
126
static void OnInitDialog(HWND hwndDlg)
130
g_pWiz->EnableButtons(BACK_BUTTON);
132
SetUpDownRange(hDlg, IDC_AFS_UID_SPINNER, MIN_AFS_UID, MAX_AFS_UID);
136
g_pWiz->SetDefaultControl(IDC_ADMIN_NAME);
141
* Utility Functions _________________________________________________________________
144
static void CheckEnableButtons()
146
BOOL bDisable = FALSE;
148
TCHAR szDummy[cchRESOURCE];
149
TCHAR szPW[cchRESOURCE];
150
TCHAR szVerifyPW[cchRESOURCE];
152
bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0;
154
bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szPW)) == 0;
156
if (IsWindowEnabled(GetDlgItem(hDlg, IDC_VERIFY_ADMIN_PW))) {
157
GetWndText(hDlg, IDC_VERIFY_ADMIN_PW, szVerifyPW);
158
bDisable |= !lstrlen(szVerifyPW) || lstrcmp(szPW, szVerifyPW);
161
if (IsWindowEnabled(GetDlgItem(hDlg, IDC_ADMIN_UID)))
162
bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_UID, szDummy)) == 0;
164
if (IsWindowEnabled(GetDlgItem(hDlg, IDC_HOSTNAME)))
165
bDisable |= lstrlen(GetWndText(hDlg, IDC_HOSTNAME, szDummy)) == 0;
168
g_pWiz->EnableButtons(BACK_BUTTON);
170
g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
173
static void SavePageInfo()
175
TCHAR szText[cchRESOURCE];
177
lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN);
178
lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN);
180
if (g_pWiz->GetState() == FIRST_SERVER_STEP) {
181
g_CfgData.bUseNextUid = IsButtonChecked(hDlg, IDC_USE_NEXT_UID);
182
if (!g_CfgData.bUseNextUid)
183
lstrncpy(g_CfgData.szAdminUID, GetWndText(hDlg, IDC_ADMIN_UID, szText), MAX_UID_LEN);
186
if (g_pWiz->GetState() == NOT_FIRST_SERVER_STEP)
187
lstrncpy(g_CfgData.szCellServDbHostname, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN);
190
static void ShowPageInfo()
192
SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName);
193
SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW);
194
SetWndText(hDlg, IDC_VERIFY_ADMIN_PW, g_CfgData.szAdminPW);
195
SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szCellServDbHostname);
197
if (g_pWiz->GetState() == FIRST_SERVER_STEP) {
198
if (g_CfgData.bUseNextUid)
199
SetCheck(hDlg, IDC_USE_NEXT_UID);
201
SetCheck(hDlg, IDC_USE_THIS_UID);
202
UseNextUid(g_CfgData.bUseNextUid);
203
SetWndText(hDlg, IDC_ADMIN_UID, g_CfgData.szAdminUID);
207
static void UseNextUid(BOOL bUseNext)
209
ENABLE_STATE es = bUseNext ? ES_DISABLE : ES_ENABLE;
211
SetEnable(hDlg, IDC_ADMIN_UID, es);
212
SetEnable(hDlg, IDC_AFS_UID_SPINNER, es);