3 * Copyright (C) 2004 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 /* $Id: wizard.c,v 1.2 2004/04/19 10:54:23 ekohl Exp $
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS system libraries
23 * PURPOSE: System setup
24 * FILE: lib/syssetup/wizard.c
25 * PROGRAMER: Eric Kohl (ekohl@rz-online.de)
28 /* INCLUDES *****************************************************************/
42 /* GLOBALS ******************************************************************/
44 static SETUPDATA SetupData
;
47 /* FUNCTIONS ****************************************************************/
51 WelcomeDlgProc(HWND hwndDlg
,
63 /* Hide the system menu */
64 hwndControl
= GetParent(hwndDlg
);
65 dwStyle
= GetWindowLong(hwndControl
, GWL_STYLE
);
66 SetWindowLong(hwndControl
, GWL_STYLE
, dwStyle
& ~WS_SYSMENU
);
68 /* Hide and disable the 'Cancel' button */
69 hwndControl
= GetDlgItem(GetParent(hwndDlg
), IDCANCEL
);
70 ShowWindow (hwndControl
, SW_HIDE
);
71 EnableWindow (hwndControl
, FALSE
);
78 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
83 /* Enable the Next button */
84 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
101 OwnerPageDlgProc(HWND hwndDlg
,
106 PSETUPDATA SetupData
;
108 /* Retrieve pointer to the global setup data */
109 SetupData
= (PSETUPDATA
)GetWindowLong (hwndDlg
, GWL_USERDATA
);
115 /* Save pointer to the global setup data */
116 SetupData
= (PSETUPDATA
)((LPPROPSHEETPAGE
)lParam
)->lParam
;
117 SetWindowLong(hwndDlg
, GWL_USERDATA
, (LONG
)SetupData
);
119 SendDlgItemMessage(hwndDlg
, IDC_OWNERNAME
, EM_LIMITTEXT
, 50, 0);
120 SendDlgItemMessage(hwndDlg
, IDC_OWNERORGANIZATION
, EM_LIMITTEXT
, 50, 0);
127 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
132 /* Enable the Back and Next buttons */
133 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
137 if (GetDlgItemText(hwndDlg
, IDC_OWNERNAME
, SetupData
->OwnerName
, 50) == 0)
140 _T("Setup cannot continue until you enter your name."),
142 MB_ICONERROR
| MB_OK
);
145 GetDlgItemText(hwndDlg
, IDC_OWNERORGANIZATION
, SetupData
->OwnerOrganization
, 50);
163 ComputerPageDlgProc(HWND hwndDlg
,
168 PSETUPDATA SetupData
;
172 /* Retrieve pointer to the global setup data */
173 SetupData
= (PSETUPDATA
)GetWindowLong (hwndDlg
, GWL_USERDATA
);
181 /* Save pointer to the global setup data */
182 SetupData
= (PSETUPDATA
)((LPPROPSHEETPAGE
)lParam
)->lParam
;
183 SetWindowLong(hwndDlg
, GWL_USERDATA
, (LONG
)SetupData
);
185 /* Retrieve current computer name */
186 Length
= MAX_COMPUTERNAME_LENGTH
+ 1;
187 GetComputerNameA(SetupData
->ComputerName
, &Length
);
189 /* Display current computer name */
190 SetDlgItemTextA(hwndDlg
, IDC_COMPUTERNAME
, SetupData
->ComputerName
);
192 /* Set text limits */
193 SendDlgItemMessage(hwndDlg
, IDC_COMPUTERNAME
, EM_LIMITTEXT
, 64, 0);
194 SendDlgItemMessage(hwndDlg
, IDC_ADMINPASSWORD1
, EM_LIMITTEXT
, 14, 0);
195 SendDlgItemMessage(hwndDlg
, IDC_ADMINPASSWORD2
, EM_LIMITTEXT
, 14, 0);
202 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
207 /* Enable the Back and Next buttons */
208 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
212 if (GetDlgItemText(hwndDlg
, IDC_COMPUTERNAME
, SetupData
->ComputerName
, 64) == 0)
215 _T("Setup cannot continue until you enter the name of your computer."),
217 MB_ICONERROR
| MB_OK
);
221 /* FIXME: check computer name for invalid characters */
223 /* Check admin passwords */
224 GetDlgItemText(hwndDlg
, IDC_ADMINPASSWORD1
, Password1
, 15);
225 GetDlgItemText(hwndDlg
, IDC_ADMINPASSWORD2
, Password2
, 15);
226 if (_tcscmp (Password1
, Password2
))
229 _T("The passwords you entered do not match. Please enter "\
230 "the desired password again."),
232 MB_ICONERROR
| MB_OK
);
236 /* FIXME: check password for invalid characters */
238 _tcscpy (SetupData
->AdminPassword
, Password1
);
255 FinishDlgProc(HWND hwndDlg
,
268 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
273 /* Enable the correct buttons on for the active page */
274 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
278 /* Handle a Back button click, if necessary */
282 /* Handle a Finish button click, if necessary */
303 HPROPSHEETPAGE ahpsp
[4];
305 // SHAREDWIZDATA wizdata;
307 /* Clear setup data */
308 ZeroMemory (&SetupData
, sizeof(SETUPDATA
));
310 /* Create the Welcome page */
311 ZeroMemory (&psp
, sizeof(PROPSHEETPAGE
));
312 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
313 psp
.dwFlags
= PSP_DEFAULT
; // | PSP_HIDEHEADER;
314 psp
.hInstance
= hDllInstance
;
315 psp
.lParam
= (LPARAM
)&SetupData
;
316 psp
.pfnDlgProc
= WelcomeDlgProc
;
317 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_WELCOMEPAGE
);
318 ahpsp
[0] = CreatePropertySheetPage(&psp
);
320 /* Create the Owner page */
321 psp
.dwFlags
= PSP_DEFAULT
; // | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
322 // psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_TITLE2);
323 // psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUBTITLE2);
324 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_OWNERPAGE
);
325 psp
.pfnDlgProc
= OwnerPageDlgProc
;
326 ahpsp
[1] = CreatePropertySheetPage(&psp
);
328 /* Create the Computer page */
329 psp
.dwFlags
= PSP_DEFAULT
; // | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
330 // psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_TITLE1);
331 // psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUBTITLE1);
332 psp
.pfnDlgProc
= ComputerPageDlgProc
;
333 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_COMPUTERPAGE
);
334 ahpsp
[2] = CreatePropertySheetPage(&psp
);
338 /* Create the Finish page */
339 psp
.dwFlags
= PSP_DEFAULT
; // | PSP_HIDEHEADER;
340 psp
.pfnDlgProc
= FinishDlgProc
;
341 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_FINISHPAGE
);
342 ahpsp
[3] = CreatePropertySheetPage(&psp
);
344 /* Create the property sheet */
345 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
346 psh
.dwFlags
= PSH_WIZARD
; //PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
347 psh
.hInstance
= hDllInstance
;
348 psh
.hwndParent
= NULL
;
352 // psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
353 // psh.pszbmHeader = MAKEINTRESOURCE(IDB_BANNER);
355 /* Display the wizard */
356 PropertySheet (&psh
);