ReactOS 0.4.17-dev-116-ga4b6fe9
wizard.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: System setup
4 * FILE: dll/win32/syssetup/wizard.c
5 * PURPOSE: GUI controls
6 * PROGRAMMERS: Eric Kohl
7 * Pierre Schweitzer <heis_spiter@hotmail.com>
8 * Ismael Ferreras Morezuelas <swyterzone+ros@gmail.com>
9 * Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
10 * Oleg Dubinskiy <oleg.dubinskij30@gmail.com>
11 */
12
13/* INCLUDES *****************************************************************/
14
15#include "precomp.h"
16
17#include <stdlib.h>
18#include <time.h>
19#include <winnls.h>
20#include <windowsx.h>
21#include <wincon.h>
22#include <shlobj.h>
23#include <shlwapi.h>
24#include <tzlib.h>
25#include <strsafe.h>
26
27#define NDEBUG
28#include <debug.h>
29
30typedef struct _REGISTRATIONDATA
31{
38
39typedef struct _TIMEZONE_ENTRY
40{
41 struct _TIMEZONE_ENTRY *Prev;
42 struct _TIMEZONE_ENTRY *Next;
43 WCHAR Description[128]; /* 'Display' */
44 WCHAR StandardName[32]; /* 'Std' */
45 WCHAR DaylightName[32]; /* 'Dlt' */
46 REG_TZI_FORMAT TimezoneInfo; /* 'TZI' */
49
50
51/* FUNCTIONS ****************************************************************/
52
54
55static VOID
57{
59 RECT rcParent;
60 RECT rcWindow;
61
63 if (hWndParent == NULL)
65
66 GetWindowRect(hWndParent, &rcParent);
67 GetWindowRect(hWnd, &rcWindow);
68
71 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
72 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
73 0,
74 0,
76}
77
78
79static HFONT
81{
82 LOGFONTW LogFont = {0};
83 HDC hdc;
84 HFONT hFont;
85
86 LogFont.lfWeight = FW_BOLD;
87 wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
88
89 hdc = GetDC(NULL);
90 LogFont.lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);
91
92 hFont = CreateFontIndirectW(&LogFont);
93
95
96 return hFont;
97}
98
99
100static HFONT
102{
103 LOGFONTW tmpFont = {0};
104 HFONT hBoldFont;
105 HDC hDc;
106
107 /* Grabs the Drawing Context */
108 hDc = GetDC(NULL);
109
110 tmpFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDc, LOGPIXELSY), 72);
111 tmpFont.lfWeight = FW_BOLD;
112 wcscpy(tmpFont.lfFaceName, L"MS Shell Dlg");
113
114 hBoldFont = CreateFontIndirectW(&tmpFont);
115
116 ReleaseDC(NULL, hDc);
117
118 return hBoldFont;
119}
120
121static INT_PTR CALLBACK
123 UINT uMsg,
126{
127 HRSRC GplTextResource;
128 HGLOBAL GplTextMem;
129 PVOID GplTextLocked;
130 PCHAR GplText;
131 DWORD Size;
132
133
134 switch (uMsg)
135 {
136 case WM_INITDIALOG:
137 GplTextResource = FindResourceW(hDllInstance, MAKEINTRESOURCE(IDR_GPL), L"RT_TEXT");
138 if (NULL == GplTextResource)
139 {
140 break;
141 }
142 Size = SizeofResource(hDllInstance, GplTextResource);
143 if (0 == Size)
144 {
145 break;
146 }
147 GplText = HeapAlloc(GetProcessHeap(), 0, Size + 1);
148 if (NULL == GplText)
149 {
150 break;
151 }
152 GplTextMem = LoadResource(hDllInstance, GplTextResource);
153 if (NULL == GplTextMem)
154 {
155 HeapFree(GetProcessHeap(), 0, GplText);
156 break;
157 }
158 GplTextLocked = LockResource(GplTextMem);
159 if (NULL == GplTextLocked)
160 {
161 HeapFree(GetProcessHeap(), 0, GplText);
162 break;
163 }
164 memcpy(GplText, GplTextLocked, Size);
165 GplText[Size] = '\0';
166 SendMessageA(GetDlgItem(hwndDlg, IDC_GPL_TEXT), WM_SETTEXT, 0, (LPARAM) GplText);
167 HeapFree(GetProcessHeap(), 0, GplText);
168 SetFocus(GetDlgItem(hwndDlg, IDOK));
169 return FALSE;
170
171 case WM_CLOSE:
172 EndDialog(hwndDlg, IDCANCEL);
173 break;
174
175 case WM_COMMAND:
176 if (HIWORD(wParam) == BN_CLICKED && IDOK == LOWORD(wParam))
177 {
178 EndDialog(hwndDlg, IDOK);
179 }
180 break;
181
182 default:
183 break;
184 }
185
186 return FALSE;
187}
188
189
190static INT_PTR CALLBACK
192 UINT uMsg,
195{
196 PSETUPDATA pSetupData;
197
198 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
199
200 switch (uMsg)
201 {
202 case WM_INITDIALOG:
203 {
204 HWND hwndControl;
205 DWORD dwStyle;
206
207 /* Get pointer to the global setup data */
208 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
209 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
210
211 hwndControl = GetParent(hwndDlg);
212
213 /* Center the wizard window */
214 CenterWindow(hwndControl);
215
216 /* Hide the system menu */
217 dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
218 SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
219
220 /* Hide and disable the 'Cancel' button */
221 hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
222 ShowWindow(hwndControl, SW_HIDE);
223 EnableWindow(hwndControl, FALSE);
224
225 /* Set title font */
226 SendDlgItemMessage(hwndDlg,
229 (WPARAM)pSetupData->hTitleFont,
230 (LPARAM)TRUE);
231 }
232 break;
233
234 case WM_NOTIFY:
235 {
236 LPNMHDR lpnm = (LPNMHDR)lParam;
237
238 switch (lpnm->code)
239 {
240 case PSN_SETACTIVE:
241 {
242 LogItem(L"BEGIN", L"WelcomePage");
243 /* Only "Next" for the first page and hide "Back" */
245 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
247 if (pSetupData->UnattendSetup)
248 {
250 return TRUE;
251 }
252 break;
253 }
254
255 case PSN_KILLACTIVE:
256 {
257 /* Show "Back" button */
258 // PropSheet_ShowWizButtons(GetParent(hwndDlg), PSWIZB_BACK, PSWIZB_BACK);
260 break;
261 }
262
263 case PSN_WIZNEXT:
264 LogItem(L"END", L"WelcomePage");
265 break;
266
267 case PSN_WIZBACK:
268 pSetupData->UnattendSetup = FALSE;
269 break;
270
271 default:
272 break;
273 }
274 }
275 break;
276
277 default:
278 break;
279 }
280
281 return FALSE;
282}
283
284
285static INT_PTR CALLBACK
287 UINT uMsg,
290{
291 LPNMHDR lpnm;
292 PWCHAR Projects;
293 PWCHAR End, CurrentProject;
294 INT ProjectsSize, ProjectsCount;
295 PSETUPDATA pSetupData;
296
297 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
298
299 switch (uMsg)
300 {
301 case WM_INITDIALOG:
302 {
303 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
304 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
305
306 Projects = NULL;
307 ProjectsSize = 256;
308 while (TRUE)
309 {
310 Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR));
311 if (NULL == Projects)
312 {
313 return FALSE;
314 }
315 ProjectsCount = LoadStringW(hDllInstance, IDS_ACKPROJECTS, Projects, ProjectsSize);
316 if (0 == ProjectsCount)
317 {
318 HeapFree(GetProcessHeap(), 0, Projects);
319 return FALSE;
320 }
321 if (ProjectsCount < ProjectsSize - 1)
322 {
323 break;
324 }
325 HeapFree(GetProcessHeap(), 0, Projects);
326 ProjectsSize *= 2;
327 }
328
329 CurrentProject = Projects;
330 while (*CurrentProject != L'\0')
331 {
332 End = wcschr(CurrentProject, L'\n');
333 if (NULL != End)
334 {
335 *End = L'\0';
336 }
337 (void)ListBox_AddString(GetDlgItem(hwndDlg, IDC_PROJECTS), CurrentProject);
338 if (NULL != End)
339 {
340 CurrentProject = End + 1;
341 }
342 else
343 {
344 CurrentProject += wcslen(CurrentProject);
345 }
346 }
347 HeapFree(GetProcessHeap(), 0, Projects);
348 }
349 break;
350
351 case WM_COMMAND:
353 {
356 }
357 break;
358
359 case WM_NOTIFY:
360 {
361 lpnm = (LPNMHDR)lParam;
362
363 switch (lpnm->code)
364 {
365 case PSN_SETACTIVE:
366 /* Enable the Back and Next buttons */
368 if (pSetupData->UnattendSetup)
369 {
371 return TRUE;
372 }
373 break;
374
375 case PSN_WIZBACK:
376 pSetupData->UnattendSetup = FALSE;
377 break;
378
379 default:
380 break;
381 }
382 }
383 break;
384
385 default:
386 break;
387 }
388
389 return FALSE;
390}
391
392static const WCHAR s_szProductOptions[] = L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions";
393static const WCHAR s_szRosVersion[] = L"SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version";
394static const WCHAR s_szControlWindows[] = L"SYSTEM\\CurrentControlSet\\Control\\Windows";
395static const WCHAR s_szWinlogon[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon";
396static const WCHAR s_szDefaultSoundEvents[] = L"AppEvents\\Schemes\\Apps\\.Default";
397static const WCHAR s_szExplorerSoundEvents[] = L"AppEvents\\Schemes\\Apps\\Explorer";
398
400{
407
409{
410 { L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 },
411 { L"\0", L"WinNT", 1, 0x300, 1 }
412};
413
414static const WCHAR* s_DefaultSoundEvents[][2] =
415{
416 { L".Default", L"%SystemRoot%\\Media\\ReactOS_Default.wav" },
417 { L"AppGPFault", L"" },
418 { L"Close", L"" },
419 { L"CriticalBatteryAlarm", L"%SystemRoot%\\Media\\ReactOS_Battery_Critical.wav" },
420 { L"DeviceConnect", L"%SystemRoot%\\Media\\ReactOS_Hardware_Insert.wav" },
421 { L"DeviceDisconnect", L"%SystemRoot%\\Media\\ReactOS_Hardware_Remove.wav" },
422 { L"DeviceFail", L"%SystemRoot%\\Media\\ReactOS_Hardware_Fail.wav" },
423 { L"LowBatteryAlarm", L"%SystemRoot%\\Media\\ReactOS_Battery_Low.wav" },
424 { L"MailBeep", L"%SystemRoot%\\Media\\ReactOS_Notify.wav" },
425 { L"Maximize", L"%SystemRoot%\\Media\\ReactOS_Restore.wav" },
426 { L"MenuCommand", L"%SystemRoot%\\Media\\ReactOS_Menu_Command.wav" },
427 { L"MenuPopup", L"" },
428 { L"Minimize", L"%SystemRoot%\\Media\\ReactOS_Minimize.wav" },
429 { L"Open", L"" },
430 { L"PrintComplete", L"%SystemRoot%\\Media\\ReactOS_Print_Complete.wav" },
431 { L"RestoreDown", L"" },
432 { L"RestoreUp", L"" },
433 { L"SystemAsterisk", L"%SystemRoot%\\Media\\ReactOS_Ding.wav" },
434 { L"SystemExclamation", L"%SystemRoot%\\Media\\ReactOS_Exclamation.wav" },
435 { L"SystemExit", L"%SystemRoot%\\Media\\ReactOS_Shutdown.wav" },
436 { L"SystemHand", L"%SystemRoot%\\Media\\ReactOS_Critical_Stop.wav" },
437 { L"SystemNotification", L"%SystemRoot%\\Media\\ReactOS_Balloon.wav" },
438 { L"SystemQuestion", L"%SystemRoot%\\Media\\ReactOS_Ding.wav" },
439 { L"SystemStart", L"%SystemRoot%\\Media\\ReactOS_Startup.wav" },
440 { L"WindowsLogoff", L"%SystemRoot%\\Media\\ReactOS_LogOff.wav" }
441/* Logon sound is already set by default for both Server and Workstation */
442};
443
444static const WCHAR* s_ExplorerSoundEvents[][2] =
445{
446 { L"EmptyRecycleBin", L"%SystemRoot%\\Media\\ReactOS_Recycle.wav" },
447 { L"Navigating", L"%SystemRoot%\\Media\\ReactOS_Start.wav" }
448};
449
450static BOOL
452 LPCWSTR lpSubkey,
453 LPCWSTR lpEventsArray[][2],
455{
456 HKEY hRootKey, hEventKey, hDefaultKey;
457 LONG error;
458 ULONG i;
459 WCHAR szDest[MAX_PATH];
460 DWORD dwAttribs;
462
463 /* Open the sound events key */
464 error = RegOpenKeyExW(hKey, lpSubkey, 0, KEY_READ, &hRootKey);
465 if (error)
466 {
467 DPRINT1("RegOpenKeyExW failed\n");
468 goto Error;
469 }
470
471 /* Set each sound event */
472 for (i = 0; i < dwSize; i++)
473 {
474 /*
475 * Verify that the sound file exists and is an actual file.
476 */
477
478 /* Expand the sound file path */
479 if (!ExpandEnvironmentStringsW(lpEventsArray[i][1], szDest, _countof(szDest)))
480 {
481 /* Failed to expand, continue with the next sound event */
482 continue;
483 }
484
485 /* Check if the sound file exists and isn't a directory */
486 dwAttribs = GetFileAttributesW(szDest);
487 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
488 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
489 {
490 /* It does not, just continue with the next sound event */
491 continue;
492 }
493
494 /*
495 * Create the sound event entry.
496 */
497
498 /* Open the sound event subkey */
499 error = RegOpenKeyExW(hRootKey, lpEventsArray[i][0], 0, KEY_READ, &hEventKey);
500 if (error)
501 {
502 /* Failed to open, continue with next sound event */
503 continue;
504 }
505
506 /* Open .Default subkey */
507 error = RegOpenKeyExW(hEventKey, L".Default", 0, KEY_WRITE, &hDefaultKey);
508 RegCloseKey(hEventKey);
509 if (error)
510 {
511 /* Failed to open, continue with next sound event */
512 continue;
513 }
514
515 /* Associate the sound file to this sound event */
516 cbData = (lstrlenW(lpEventsArray[i][1]) + 1) * sizeof(WCHAR);
517 error = RegSetValueExW(hDefaultKey, NULL, 0, REG_EXPAND_SZ, (const BYTE *)lpEventsArray[i][1], cbData);
518 RegCloseKey(hDefaultKey);
519 if (error)
520 {
521 /* Failed to set the value, continue with next sound event */
522 continue;
523 }
524 }
525
526Error:
527 if (hRootKey)
528 RegCloseKey(hRootKey);
529
530 return error == ERROR_SUCCESS;
531}
532
533static BOOL
535{
536 HKEY hKey;
537 LONG error;
538 LPCWSTR pszData;
539 DWORD dwValue, cbData;
541 ASSERT(0 <= nOption && nOption < _countof(s_ProductOptionData));
542
543 /* open ProductOptions key */
545 if (error)
546 {
547 DPRINT1("RegOpenKeyExW failed\n");
548 goto Error;
549 }
550
551 /* write ProductSuite */
552 pszData = pData->ProductSuite;
553 cbData = (lstrlenW(pszData) + 2) * sizeof(WCHAR);
554 error = RegSetValueExW(hKey, L"ProductSuite", 0, REG_MULTI_SZ, (const BYTE *)pszData, cbData);
555 if (error)
556 {
557 DPRINT1("RegSetValueExW failed\n");
558 goto Error;
559 }
560
561 /* write ProductType */
562 pszData = pData->ProductType;
563 cbData = (lstrlenW(pszData) + 1) * sizeof(WCHAR);
564 error = RegSetValueExW(hKey, L"ProductType", 0, REG_SZ, (const BYTE *)pszData, cbData);
565 if (error)
566 {
567 DPRINT1("RegSetValueExW failed\n");
568 goto Error;
569 }
570
572
573 /* open ReactOS version key */
575 if (error)
576 {
577 DPRINT1("RegOpenKeyExW failed\n");
578 goto Error;
579 }
580
581 /* write ReportAsWorkstation */
582 dwValue = pData->ReportAsWorkstation;
583 cbData = sizeof(dwValue);
584 error = RegSetValueExW(hKey, L"ReportAsWorkstation", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
585 if (error)
586 {
587 DPRINT1("RegSetValueExW failed\n");
588 goto Error;
589 }
590
592
593 /* open Control Windows key */
595 if (error)
596 {
597 DPRINT1("RegOpenKeyExW failed\n");
598 goto Error;
599 }
600
601 /* write Control Windows CSDVersion */
602 dwValue = pData->CSDVersion;
603 cbData = sizeof(dwValue);
604 error = RegSetValueExW(hKey, L"CSDVersion", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
605 if (error)
606 {
607 DPRINT1("RegSetValueExW failed\n");
608 goto Error;
609 }
610
612
613 /* open Winlogon key */
615 if (error)
616 {
617 DPRINT1("RegOpenKeyExW failed\n");
618 goto Error;
619 }
620
621 /* write LogonType */
622 dwValue = pData->LogonType;
623 cbData = sizeof(dwValue);
624 error = RegSetValueExW(hKey, L"LogonType", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
625 if (error)
626 {
627 DPRINT1("RegSetValueExW failed\n");
628 goto Error;
629 }
630
631 if (nOption == PRODUCT_OPTION_WORKSTATION)
632 {
633 /* Write system sound events values for Workstation */
636 }
637
638Error:
639 if (hKey)
641
642 return error == ERROR_SUCCESS;
643}
644
645static void
647{
648 WCHAR szText[256];
649 ASSERT(0 <= nOption && nOption < _countof(s_ProductOptionData));
650
651 switch (nOption)
652 {
655 break;
656
659 break;
660
661 default:
662 return;
663 }
664
666}
667
668static INT_PTR CALLBACK
670{
671 LPNMHDR lpnm;
672 PSETUPDATA pSetupData;
673 INT iItem;
674 WCHAR szText[64], szDefault[64];
675 HICON hIcon;
676
677 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
678
679 switch (uMsg)
680 {
681 case WM_INITDIALOG:
682 {
683 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
684 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
685
686 LoadStringW(hDllInstance, IDS_DEFAULT, szDefault, _countof(szDefault));
687
690 {
691 StringCchCatW(szText, _countof(szText), L" ");
692 StringCchCatW(szText, _countof(szText), szDefault);
693 }
695
698 {
699 StringCchCatW(szText, _countof(szText), L" ");
700 StringCchCatW(szText, _countof(szText), szDefault);
701 }
703
706
709 return TRUE;
710 }
711
712 case WM_COMMAND:
714 {
716 OnChooseOption(hwndDlg, (PRODUCT_OPTION)iItem);
717 }
718 break;
719
720 case WM_NOTIFY:
721 {
722 lpnm = (LPNMHDR)lParam;
723
724 switch (lpnm->code)
725 {
726 case PSN_SETACTIVE:
727 /* Enable the Back and Next buttons */
729 if (pSetupData->UnattendSetup)
730 {
731 OnChooseOption(hwndDlg, pSetupData->ProductOption);
734 return TRUE;
735 }
736 break;
737
738 case PSN_WIZNEXT:
740 pSetupData->ProductOption = (PRODUCT_OPTION)iItem;
742 break;
743
744 case PSN_WIZBACK:
745 pSetupData->UnattendSetup = FALSE;
746 break;
747
748 default:
749 break;
750 }
751 }
752 break;
753
754 default:
755 break;
756 }
757
758 return FALSE;
759}
760
761static
762BOOL
764 WCHAR * OwnerOrganization)
765{
766 HKEY hKey;
767 LONG res;
768
770 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
771 0,
773 &hKey);
774
775 if (res != ERROR_SUCCESS)
776 {
777 return FALSE;
778 }
779
781 L"RegisteredOwner",
782 0,
783 REG_SZ,
784 (LPBYTE)OwnerName,
785 (wcslen(OwnerName) + 1) * sizeof(WCHAR));
786
787 if (res != ERROR_SUCCESS)
788 {
790 return FALSE;
791 }
792
794 L"RegisteredOrganization",
795 0,
796 REG_SZ,
797 (LPBYTE)OwnerOrganization,
798 (wcslen(OwnerOrganization) + 1) * sizeof(WCHAR));
799
801 return (res == ERROR_SUCCESS);
802}
803
804static INT_PTR CALLBACK
806 UINT uMsg,
809{
810 WCHAR OwnerName[51];
811 WCHAR OwnerOrganization[51];
812 WCHAR Title[64];
813 WCHAR ErrorName[256];
814 LPNMHDR lpnm;
815 PSETUPDATA pSetupData;
816
817 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
818
819 switch (uMsg)
820 {
821 case WM_INITDIALOG:
822 {
823 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
824 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
825
826 /* set a localized ('Owner') placeholder string as default */
827 if (LoadStringW(hDllInstance, IDS_MACHINE_OWNER_NAME, OwnerName, _countof(OwnerName)))
828 {
829 SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, WM_SETTEXT, 0, (LPARAM)OwnerName);
830 }
831
834
835 /* Set focus to owner name */
837
838 /* Select the default text to quickly overwrite it by typing */
840 }
841 break;
842
843
844 case WM_NOTIFY:
845 {
846 lpnm = (LPNMHDR)lParam;
847
848 switch (lpnm->code)
849 {
850 case PSN_SETACTIVE:
851 /* Enable the Back and Next buttons */
853 if (pSetupData->UnattendSetup)
854 {
855 SendMessage(GetDlgItem(hwndDlg, IDC_OWNERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->OwnerName);
857 if (WriteOwnerSettings(pSetupData->OwnerName, pSetupData->OwnerOrganization))
858 {
860 return TRUE;
861 }
862 }
863 break;
864
865 case PSN_WIZNEXT:
866 OwnerName[0] = 0;
867 if (GetDlgItemTextW(hwndDlg, IDC_OWNERNAME, OwnerName, 50) == 0)
868 {
870 {
871 wcscpy(Title, L"ReactOS Setup");
872 }
873 if (0 == LoadStringW(hDllInstance, IDS_WZD_NAME, ErrorName, ARRAYSIZE(ErrorName)))
874 {
875 wcscpy(ErrorName, L"Setup cannot continue until you enter your name.");
876 }
877 MessageBoxW(hwndDlg, ErrorName, Title, MB_ICONERROR | MB_OK);
878
880 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
881
882 return TRUE;
883 }
884
885 OwnerOrganization[0] = 0;
886 GetDlgItemTextW(hwndDlg, IDC_OWNERORGANIZATION, OwnerOrganization, 50);
887
888 if (!WriteOwnerSettings(OwnerName, OwnerOrganization))
889 {
891 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
892 return TRUE;
893 }
894
895 case PSN_WIZBACK:
896 pSetupData->UnattendSetup = FALSE;
897 break;
898
899 default:
900 break;
901 }
902 }
903 break;
904
905 default:
906 break;
907 }
908
909 return FALSE;
910}
911
912static
913BOOL
914WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
915{
916 WCHAR Title[64];
917 WCHAR ErrorComputerName[256];
918 LONG lError;
919 HKEY hKey = NULL;
920
921 if (!SetComputerNameW(ComputerName))
922 {
923 if (hwndDlg != NULL)
924 {
926 {
927 wcscpy(Title, L"ReactOS Setup");
928 }
929 if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName,
930 ARRAYSIZE(ErrorComputerName)))
931 {
932 wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
933 }
934 MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
935 }
936
937 return FALSE;
938 }
939
940 /* Set the physical DNS domain */
941 SetComputerNameExW(ComputerNamePhysicalDnsDomain, L"");
942
943 /* Set the physical DNS hostname */
944 SetComputerNameExW(ComputerNamePhysicalDnsHostname, ComputerName);
945
946 /* Set the accounts domain name */
947 SetAccountsDomainSid(NULL, ComputerName);
948
949 /* Now we need to set the Hostname */
951 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
952 0,
953 NULL,
955 KEY_WRITE,
956 NULL,
957 &hKey,
958 NULL);
959 if (lError == ERROR_SUCCESS)
960 {
961 lError = RegSetValueEx(hKey,
962 L"Hostname",
963 0,
964 REG_SZ,
965 (LPBYTE)ComputerName,
966 (wcslen(ComputerName) + 1) * sizeof(WCHAR));
967 if (lError != ERROR_SUCCESS)
968 {
969 DPRINT1("RegSetValueEx(\"Hostname\") failed (%08lX)\n", lError);
970 }
971
973 }
974 else
975 {
976 DPRINT1("RegCreateKeyExW for Tcpip\\Parameters failed (%08lX)\n", lError);
977 }
978
979 return TRUE;
980}
981
982
983static
984BOOL
986{
987 WCHAR szAdministratorName[256];
988 HKEY hKey = NULL;
989 LONG lError;
990
993 szAdministratorName,
994 ARRAYSIZE(szAdministratorName)) == 0)
995 {
996 wcscpy(szAdministratorName, L"Administrator");
997 }
998
1000 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1001 0,
1003 &hKey);
1004 if (lError != ERROR_SUCCESS)
1005 return FALSE;
1006
1007 lError = RegSetValueEx(hKey,
1008 L"DefaultDomainName",
1009 0,
1010 REG_SZ,
1011 (LPBYTE)Domain,
1012 (wcslen(Domain)+ 1) * sizeof(WCHAR));
1013 if (lError != ERROR_SUCCESS)
1014 {
1015 DPRINT1("RegSetValueEx(\"DefaultDomainName\") failed!\n");
1016 }
1017
1018 lError = RegSetValueEx(hKey,
1019 L"DefaultUserName",
1020 0,
1021 REG_SZ,
1022 (LPBYTE)szAdministratorName,
1023 (wcslen(szAdministratorName)+ 1) * sizeof(WCHAR));
1024 if (lError != ERROR_SUCCESS)
1025 {
1026 DPRINT1("RegSetValueEx(\"DefaultUserName\") failed!\n");
1027 }
1028
1030
1031 return TRUE;
1032}
1033
1034
1035/* lpBuffer will be filled with a 15-char string (plus the null terminator) */
1036static void
1038{
1039 static const WCHAR Chars[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1040 static const unsigned cChars = sizeof(Chars) / sizeof(WCHAR) - 1;
1041 unsigned i;
1042
1043 wcscpy(lpBuffer, L"REACTOS-");
1044
1046
1047 /* fill in 7 characters */
1048 for (i = 8; i < 15; i++)
1049 lpBuffer[i] = Chars[rand() % cChars];
1050
1051 lpBuffer[15] = UNICODE_NULL; /* NULL-terminate */
1052}
1053
1054static INT_PTR CALLBACK
1056 UINT uMsg,
1057 WPARAM wParam,
1058 LPARAM lParam)
1059{
1060 WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
1061 WCHAR Password1[128];
1062 WCHAR Password2[128];
1064 WCHAR Title[64];
1065 WCHAR EmptyComputerName[256], NotMatchPassword[256], WrongPassword[256];
1066 LPNMHDR lpnm;
1067 PSETUPDATA pSetupData;
1068
1069 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
1070
1072 {
1073 wcscpy(Title, L"ReactOS Setup");
1074 }
1075
1076 switch (uMsg)
1077 {
1078 case WM_INITDIALOG:
1079 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1080 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
1081
1082 /* Generate a new pseudo-random computer name */
1083 GenerateComputerName(ComputerName);
1084
1085 /* Display current computer name */
1086 SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName);
1087
1088 /* Set text limits */
1092
1093 /* Set focus to computer name */
1095 if (pSetupData->UnattendSetup)
1096 {
1097 SendMessage(GetDlgItem(hwndDlg, IDC_COMPUTERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->ComputerName);
1098 SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD1), WM_SETTEXT, 0, (LPARAM)pSetupData->AdminPassword);
1099 SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD2), WM_SETTEXT, 0, (LPARAM)pSetupData->AdminPassword);
1100 WriteComputerSettings(pSetupData->ComputerName, NULL);
1101 SetAdministratorPassword(pSetupData->AdminPassword);
1102 }
1103
1104 /* Store the administrator account name as the default user name */
1105 WriteDefaultLogonData(pSetupData->ComputerName);
1106 break;
1107
1108
1109 case WM_NOTIFY:
1110 {
1111 lpnm = (LPNMHDR)lParam;
1112
1113 switch (lpnm->code)
1114 {
1115 case PSN_SETACTIVE:
1116 /* Enable the Back and Next buttons */
1118 if (pSetupData->UnattendSetup && WriteComputerSettings(pSetupData->ComputerName, hwndDlg))
1119 {
1121 return TRUE;
1122 }
1123 break;
1124
1125 case PSN_WIZNEXT:
1126 if (0 == GetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName, MAX_COMPUTERNAME_LENGTH + 1))
1127 {
1128 if (0 == LoadStringW(hDllInstance, IDS_WZD_COMPUTERNAME, EmptyComputerName,
1129 ARRAYSIZE(EmptyComputerName)))
1130 {
1131 wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer.");
1132 }
1133 MessageBoxW(hwndDlg, EmptyComputerName, Title, MB_ICONERROR | MB_OK);
1135 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1136 return TRUE;
1137 }
1138
1139 /* No need to check computer name for invalid characters,
1140 * SetComputerName() will do it for us */
1141
1142 if (!WriteComputerSettings(ComputerName, hwndDlg))
1143 {
1145 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1146 return TRUE;
1147 }
1148
1149#ifdef PASSWORDS_MANDATORY
1150 /* Check if admin passwords have been entered */
1151 if ((GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128) == 0) ||
1152 (GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128) == 0))
1153 {
1154 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDEMPTY, EmptyPassword,
1155 ARRAYSIZE(EmptyPassword)))
1156 {
1157 wcscpy(EmptyPassword, L"You must enter a password !");
1158 }
1159 MessageBoxW(hwndDlg, EmptyPassword, Title, MB_ICONERROR | MB_OK);
1160 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1161 return TRUE;
1162 }
1163#else
1164 GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128);
1165 GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128);
1166#endif
1167 /* Check if passwords match */
1168 if (wcscmp(Password1, Password2))
1169 {
1170 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDMATCH, NotMatchPassword,
1171 ARRAYSIZE(NotMatchPassword)))
1172 {
1173 wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again.");
1174 }
1175 MessageBoxW(hwndDlg, NotMatchPassword, Title, MB_ICONERROR | MB_OK);
1176 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1177 return TRUE;
1178 }
1179
1180 /* Check password for invalid characters */
1181 Password = (PWCHAR)Password1;
1182 while (*Password)
1183 {
1184 if (!isprint(*Password))
1185 {
1186 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDCHAR, WrongPassword,
1187 ARRAYSIZE(WrongPassword)))
1188 {
1189 wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password.");
1190 }
1191 MessageBoxW(hwndDlg, WrongPassword, Title, MB_ICONERROR | MB_OK);
1192 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1193 return TRUE;
1194 }
1195 Password++;
1196 }
1197
1198 /* Set admin password */
1199 SetAdministratorPassword(Password1);
1200 break;
1201
1202 case PSN_WIZBACK:
1203 pSetupData->UnattendSetup = FALSE;
1204 break;
1205
1206 default:
1207 break;
1208 }
1209 }
1210 break;
1211
1212 default:
1213 break;
1214 }
1215
1216 return FALSE;
1217}
1218
1219
1220static VOID
1222{
1223 WCHAR CurLocale[256] = L"";
1224 WCHAR CurGeo[256] = L"";
1225 WCHAR ResText[256] = L"";
1226 WCHAR LocaleText[256 * 2];
1227
1230
1231 LoadStringW(hDllInstance, IDS_LOCALETEXT, ResText, ARRAYSIZE(ResText));
1232 StringCchPrintfW(LocaleText, ARRAYSIZE(LocaleText), ResText, CurLocale, CurGeo);
1233
1234 SetWindowTextW(hwnd, LocaleText);
1235}
1236
1237static VOID
1239{
1240 HKL hkl;
1241 BOOL LayoutSpecial = FALSE;
1242 WCHAR LayoutPath[256];
1243 WCHAR LocaleName[32];
1244 WCHAR SpecialId[5] = L"";
1245 WCHAR ResText[256] = L"";
1246 DWORD dwValueSize;
1247 HKEY hKey;
1248 UINT i;
1249
1250 /* Get the default input language and method */
1251 if (!SystemParametersInfoW(SPI_GETDEFAULTINPUTLANG, 0, (LPDWORD)&hkl, 0))
1252 {
1254 }
1255
1256 if ((HIWORD(hkl) & 0xF000) == 0xF000)
1257 {
1258 /* Process keyboard layout with special id */
1259 StringCchPrintfW(SpecialId, ARRAYSIZE(SpecialId), L"%04x", (HIWORD(hkl) & 0x0FFF));
1260 LayoutSpecial = TRUE;
1261 }
1262
1263#define MAX_LAYOUTS_PER_LANGID 0x10000
1264 for (i = 0; i < (LayoutSpecial ? MAX_LAYOUTS_PER_LANGID : 1); i++)
1265 {
1266 /* Generate a hexadecimal identifier for keyboard layout registry key */
1268
1269 StringCchCopyW(LayoutPath, ARRAYSIZE(LayoutPath), L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\");
1270 StringCchCatW(LayoutPath, ARRAYSIZE(LayoutPath), LocaleName);
1272
1274 LayoutPath,
1275 0,
1277 &hKey) == ERROR_SUCCESS)
1278 {
1279 /* Make sure the keyboard layout key we opened is the one we need.
1280 * If the layout has no special id, just pass this check. */
1281 dwValueSize = sizeof(LocaleName);
1282 if (!LayoutSpecial ||
1284 L"Layout Id",
1285 NULL,
1286 NULL,
1287 (PVOID)&LocaleName,
1288 &dwValueSize) == ERROR_SUCCESS) &&
1289 (wcscmp(LocaleName, SpecialId) == 0)))
1290 {
1292 dwValueSize = sizeof(LocaleName);
1294 L"Layout Text",
1295 NULL,
1296 NULL,
1297 (PVOID)&LocaleName,
1298 &dwValueSize);
1299 /* Let the loop know where to stop */
1301 }
1303 }
1304 else
1305 {
1306 /* Keyboard layout registry keys are expected to go in order without gaps */
1307 break;
1308 }
1309 }
1310#undef MAX_LAYOUTS_PER_LANGID
1311
1312 LoadStringW(hDllInstance, IDS_LAYOUTTEXT, ResText, ARRAYSIZE(ResText));
1313 StringCchPrintfW(LayoutPath, ARRAYSIZE(LayoutPath), ResText, LocaleName);
1314
1315 SetWindowTextW(hwnd, LayoutPath);
1316}
1317
1318
1319static BOOL
1321{
1322 MSG msg;
1323 HWND MainWindow = GetParent(hwnd);
1324 STARTUPINFOW StartupInfo;
1325 PROCESS_INFORMATION ProcessInformation;
1326 WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
1327
1328 if (!pwszCPLParameters)
1329 {
1330 MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
1331 return FALSE;
1332 }
1333
1334 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
1335 StartupInfo.cb = sizeof(StartupInfo);
1336 ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
1337
1338 ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters));
1339 wcscat(CmdLine, pwszCPLParameters);
1340
1341 if (!CreateProcessW(NULL,
1342 CmdLine,
1343 NULL,
1344 NULL,
1345 FALSE,
1346 0,
1347 NULL,
1348 NULL,
1349 &StartupInfo,
1350 &ProcessInformation))
1351 {
1352 MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
1353 return FALSE;
1354 }
1355
1356 /* Disable the Back and Next buttons and the main window
1357 * while we're interacting with the control panel applet */
1358 PropSheet_SetWizButtons(MainWindow, 0);
1359 EnableWindow(MainWindow, FALSE);
1360
1362 {
1363 /* We still need to process main window messages to avoid freeze */
1364 while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
1365 {
1368 }
1369 }
1370 CloseHandle(ProcessInformation.hThread);
1371 CloseHandle(ProcessInformation.hProcess);
1372
1373 /* Enable the Back and Next buttons and the main window again */
1375 EnableWindow(MainWindow, TRUE);
1376
1377 return TRUE;
1378}
1379
1380
1381VOID
1384 _In_opt_ PCWSTR ThemeFile)
1385{
1386 enum { THEME_FILE, STYLE_FILE, UNKNOWN } fType;
1387 WCHAR szPath[MAX_PATH]; // Expanded path of the file to use.
1388 WCHAR szStyleFile[MAX_PATH];
1389
1390 fType = THEME_FILE; // Default to Classic theme.
1391 if (ThemeFile)
1392 {
1393 /* Expand the path if possible */
1394 if (ExpandEnvironmentStringsW(ThemeFile, szPath, _countof(szPath)) != 0)
1395 ThemeFile = szPath;
1396
1397 /* Determine the file type from its extension */
1398 fType = UNKNOWN; {
1399 PCWSTR pszExt = wcsrchr(ThemeFile, L'.'); // PathFindExtensionW(ThemeFile);
1400 if (pszExt)
1401 {
1402 if (_wcsicmp(pszExt, L".theme") == 0)
1403 fType = THEME_FILE;
1404 else if (_wcsicmp(pszExt, L".msstyles") == 0)
1405 fType = STYLE_FILE;
1406 } }
1407 if (fType == UNKNOWN)
1408 {
1409 DPRINT1("EnableVisualTheme(): Unknown file '%S'\n", ThemeFile);
1410 return;
1411 }
1412 }
1413
1414 DPRINT1("Applying visual %s '%S'\n",
1415 (fType == THEME_FILE) ? "theme" : "style",
1416 ThemeFile ? ThemeFile : L"(Classic)");
1417
1418//
1419// TODO: Use instead uxtheme!SetSystemVisualStyle() once it is implemented,
1420// https://stackoverflow.com/a/1036903
1421// https://pinvoke.net/default.aspx/uxtheme.SetSystemVisualStyle
1422// or ApplyTheme(NULL, 0, NULL) for restoring the classic theme.
1423//
1424// NOTE: The '/Action:ActivateMSTheme' is ReactOS-specific.
1425//
1426
1427 if (ThemeFile && (fType == THEME_FILE))
1428 {
1429 /* Retrieve the visual style specified in the theme file.
1430 * If none, fall back to the classic theme. */
1431 if (GetPrivateProfileStringW(L"VisualStyles", L"Path", NULL,
1432 szStyleFile, _countof(szStyleFile), ThemeFile) && *szStyleFile)
1433 {
1434 /* Expand the path if possible */
1435 ThemeFile = szStyleFile;
1436 if (ExpandEnvironmentStringsW(ThemeFile, szPath, _countof(szPath)) != 0)
1437 ThemeFile = szPath;
1438 }
1439 else
1440 {
1441 ThemeFile = NULL;
1442 }
1443
1444 DPRINT1("--> Applying visual style '%S'\n",
1445 ThemeFile ? ThemeFile : L"(Classic)");
1446 }
1447
1448 if (ThemeFile)
1449 {
1450 WCHAR wszParams[1024];
1451 // FIXME: L"desk.cpl desk,@Appearance" regression, see commit 50d260a7f0
1452 PCWSTR format = L"desk.cpl,,2 /Action:ActivateMSTheme /file:\"%s\"";
1453
1454 StringCchPrintfW(wszParams, _countof(wszParams), format, ThemeFile);
1456 }
1457 else
1458 {
1459 RunControlPanelApplet(hwndParent, L"desk.cpl,,2 /Action:ActivateMSTheme");
1460 }
1461}
1462
1463
1464static VOID
1466{
1467 HKEY hKey;
1468 LCID lcid;
1469 WCHAR Locale[9] = L"0000";
1470
1472
1473 if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, &Locale[4], _countof(Locale) - 4) != 0)
1474 {
1475 if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International",
1478 {
1479 RegSetValueExW(hKey, L"Locale", 0, REG_SZ, (LPBYTE)Locale, (wcslen(Locale) + 1) * sizeof(WCHAR));
1481 }
1482 }
1483}
1484
1485static INT_PTR CALLBACK
1487 UINT uMsg,
1488 WPARAM wParam,
1489 LPARAM lParam)
1490{
1492
1493 /* Retrieve pointer to the global setup data */
1495
1496 switch (uMsg)
1497 {
1498 case WM_INITDIALOG:
1499 {
1500 /* Save pointer to the global setup data */
1504
1507 }
1508 break;
1509
1510 case WM_COMMAND:
1511 if (HIWORD(wParam) == BN_CLICKED)
1512 {
1513 switch (LOWORD(wParam))
1514 {
1515 case IDC_CUSTOMLOCALE:
1516 RunControlPanelApplet(hwndDlg, L"intl.cpl,,5");
1518 break;
1519
1520 case IDC_CUSTOMLAYOUT:
1521 RunControlPanelApplet(hwndDlg, L"input.dll,@1");
1523 break;
1524 }
1525 }
1526 break;
1527
1528 case WM_NOTIFY:
1529 {
1530 LPNMHDR lpnm = (LPNMHDR)lParam;
1531
1532 switch (lpnm->code)
1533 {
1534 case PSN_SETACTIVE:
1535 /* Enable the Back and Next buttons */
1538 {
1539 // if (!*SetupData->SourcePath)
1540 {
1541 RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"$winnt$.inf\""); // Should be in System32
1542 }
1543
1545 return TRUE;
1546 }
1547 break;
1548
1549 case PSN_WIZNEXT:
1550 break;
1551
1552 case PSN_WIZBACK:
1554 break;
1555
1556 default:
1557 break;
1558 }
1559 }
1560 break;
1561
1562 default:
1563 break;
1564 }
1565
1566 return FALSE;
1567}
1568
1569
1570static PTIMEZONE_ENTRY
1572{
1574
1576 while (Entry != NULL)
1577 {
1578 if (Entry->Index >= Index)
1579 return Entry;
1580
1581 Entry = Entry->Next;
1582 }
1583
1584 return NULL;
1585}
1586
1587static LONG
1589 IN HKEY hZoneKey,
1591{
1592 LONG lError;
1595 PTIMEZONE_ENTRY Current;
1596 ULONG DescriptionSize;
1597 ULONG StandardNameSize;
1598 ULONG DaylightNameSize;
1599
1601 if (Entry == NULL)
1602 {
1604 }
1605
1606 DescriptionSize = sizeof(Entry->Description);
1607 StandardNameSize = sizeof(Entry->StandardName);
1608 DaylightNameSize = sizeof(Entry->DaylightName);
1609
1610 lError = QueryTimeZoneData(hZoneKey,
1611 &Entry->Index,
1612 &Entry->TimezoneInfo,
1613 Entry->Description,
1614 &DescriptionSize,
1615 Entry->StandardName,
1616 &StandardNameSize,
1617 Entry->DaylightName,
1618 &DaylightNameSize);
1619 if (lError != ERROR_SUCCESS)
1620 {
1622 return lError;
1623 }
1624
1627 {
1628 Entry->Prev = NULL;
1629 Entry->Next = NULL;
1632 }
1633 else
1634 {
1635 Current = GetLargerTimeZoneEntry(SetupData, Entry->Index);
1636 if (Current != NULL)
1637 {
1638 if (Current == SetupData->TimeZoneListHead)
1639 {
1640 /* Prepend to head */
1641 Entry->Prev = NULL;
1645 }
1646 else
1647 {
1648 /* Insert before current */
1649 Entry->Prev = Current->Prev;
1650 Entry->Next = Current;
1651 Current->Prev->Next = Entry;
1652 Current->Prev = Entry;
1653 }
1654 }
1655 else
1656 {
1657 /* Append to tail */
1659 Entry->Next = NULL;
1662 }
1663 }
1664
1665 return ERROR_SUCCESS;
1666}
1667
1668static VOID
1670{
1672}
1673
1674static VOID
1676{
1678
1679 while (SetupData->TimeZoneListHead != NULL)
1680 {
1682
1685 {
1687 }
1688
1690 }
1691
1693}
1694
1695
1696static BOOL
1698{
1699 /* If StandardDate.wMonth and DaylightDate.wMonth are zero,
1700 * the timezone does not observe daylight saving time */
1701 return (Entry->TimezoneInfo.StandardDate.wMonth != 0 &&
1702 Entry->TimezoneInfo.DaylightDate.wMonth != 0);
1703}
1704
1705static PTIMEZONE_ENTRY
1707{
1709
1710 for (Entry = SetupData->TimeZoneListHead; Entry != NULL; Entry = Entry->Next)
1711 {
1712 if (Entry->Index == dwEntryIndex)
1713 return Entry;
1714 }
1715
1716 return NULL;
1717}
1718
1719static PTIMEZONE_ENTRY
1721{
1723 DWORD i;
1724
1725 for (Entry = SetupData->TimeZoneListHead, i = 0; Entry != NULL && i < dwComboIndex; i++, Entry = Entry->Next);
1726
1727 return Entry;
1728}
1729
1730static VOID
1732{
1733 BOOL bHasDST = (Entry != NULL && HasDaylightSavingTime(Entry));
1734
1735 /* Enable or disable the checkbox based on DST support */
1736 EnableDlgItem(hwndDlg, IDC_AUTODAYLIGHT, bHasDST);
1737
1738 /* Check the checkbox only if DST is supported, otherwise uncheck it */
1740 (WPARAM)(bHasDST ? BST_CHECKED : BST_UNCHECKED), 0);
1741}
1742
1743static VOID
1745{
1747 DWORD dwIndex = 0;
1748 DWORD dwCount;
1749
1750 GetTimeZoneListIndex(&dwEntryIndex);
1751
1753 while (Entry != NULL)
1754 {
1755 dwCount = SendMessage(hwnd,
1757 0,
1758 (LPARAM)Entry->Description);
1759
1760 if (dwEntryIndex != 0 && dwEntryIndex == Entry->Index)
1761 dwIndex = dwCount;
1762
1763 Entry = Entry->Next;
1764 }
1765
1768 (WPARAM)dwIndex,
1769 0);
1770}
1771
1772
1773static VOID
1775{
1776 TIME_ZONE_INFORMATION TimeZoneInformation;
1778 DWORD dwIndex;
1779 DWORD i;
1780
1781 dwIndex = SendMessage(hwnd,
1783 0,
1784 0);
1785
1786 i = 0;
1788 while (i < dwIndex)
1789 {
1790 if (Entry == NULL)
1791 return;
1792
1793 i++;
1794 Entry = Entry->Next;
1795 }
1796
1797 wcscpy(TimeZoneInformation.StandardName,
1798 Entry->StandardName);
1799 wcscpy(TimeZoneInformation.DaylightName,
1800 Entry->DaylightName);
1801
1802 TimeZoneInformation.Bias = Entry->TimezoneInfo.Bias;
1803 TimeZoneInformation.StandardBias = Entry->TimezoneInfo.StandardBias;
1804 TimeZoneInformation.DaylightBias = Entry->TimezoneInfo.DaylightBias;
1805
1806 memcpy(&TimeZoneInformation.StandardDate,
1807 &Entry->TimezoneInfo.StandardDate,
1808 sizeof(SYSTEMTIME));
1809 memcpy(&TimeZoneInformation.DaylightDate,
1810 &Entry->TimezoneInfo.DaylightDate,
1811 sizeof(SYSTEMTIME));
1812
1813 /* Set time zone information */
1814 SetTimeZoneInformation(&TimeZoneInformation);
1815}
1816
1817
1818static BOOL
1820{
1821 SYSTEMTIME Date;
1823
1825 {
1826 return FALSE;
1827 }
1828
1830 {
1831 return FALSE;
1832 }
1833
1837 SetupData->SystemTime.wDay = Date.wDay;
1838 SetupData->SystemTime.wHour = Time.wHour;
1839 SetupData->SystemTime.wMinute = Time.wMinute;
1840 SetupData->SystemTime.wSecond = Time.wSecond;
1841 SetupData->SystemTime.wMilliseconds = Time.wMilliseconds;
1842
1843 return TRUE;
1844}
1845
1846
1847static BOOL
1849{
1850 BOOL Ret = FALSE;
1851
1852 /*
1853 * Call SetLocalTime twice to ensure correct results
1854 */
1857
1858 return Ret;
1859}
1860
1861
1862static VOID
1864{
1867}
1868
1869
1870static BOOL
1872{
1873 WCHAR Title[64];
1874 WCHAR ErrorLocalTime[256];
1875
1876 GetLocalSystemTime(hwndDlg, SetupData);
1878 SetupData);
1879
1881 BM_GETCHECK, 0, 0) != BST_UNCHECKED);
1882 if (!SetSystemLocalTime(hwndDlg, SetupData))
1883 {
1885 {
1886 wcscpy(Title, L"ReactOS Setup");
1887 }
1888 if (0 == LoadStringW(hDllInstance, IDS_WZD_LOCALTIME, ErrorLocalTime,
1889 ARRAYSIZE(ErrorLocalTime)))
1890 {
1891 wcscpy(ErrorLocalTime, L"Setup was unable to set the local time.");
1892 }
1893 MessageBoxW(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK);
1894 return FALSE;
1895 }
1896
1897 return TRUE;
1898}
1899
1900
1901static INT_PTR CALLBACK
1903 UINT uMsg,
1904 WPARAM wParam,
1905 LPARAM lParam)
1906{
1908
1909 /* Retrieve pointer to the global setup data */
1911
1912 switch (uMsg)
1913 {
1914 case WM_INITDIALOG:
1915 {
1916 DWORD dwEntryIndex;
1918
1919 /* Save pointer to the global setup data */
1922
1924
1926 {
1929
1932 {
1935 }
1936 else
1937 {
1940 }
1941 }
1942 else
1943 {
1944 /* Get the default time zone index from the registry */
1945 dwEntryIndex = (DWORD)-1;
1946 GetTimeZoneListIndex(&dwEntryIndex);
1947
1949 SetupData, -1);
1950
1951 /* Set the auto-daylight checkbox based on whether
1952 * the selected timezone observes DST */
1953 Entry = GetSelectedTimeZoneEntry(SetupData, dwEntryIndex);
1955 }
1956 break;
1957 }
1958
1959 case WM_TIMER:
1960 {
1961 SYSTEMTIME LocalTime;
1962
1963 GetLocalTime(&LocalTime);
1964 UpdateLocalSystemTime(hwndDlg, LocalTime);
1965
1966 // Reset timeout.
1967 SetTimer(hwndDlg, 1, 1000 - LocalTime.wMilliseconds, NULL);
1968 break;
1969 }
1970
1971 case WM_COMMAND:
1973 {
1974 /* User changed the timezone selection */
1975 DWORD dwIndex = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TIMEZONELIST, CB_GETCURSEL, 0, 0);
1978 }
1979 break;
1980
1981 case WM_NOTIFY:
1982 switch (((LPNMHDR)lParam)->code)
1983 {
1984 case PSN_SETACTIVE:
1985 {
1986 SYSTEMTIME LocalTime;
1987
1988 GetLocalTime(&LocalTime);
1989 UpdateLocalSystemTime(hwndDlg, LocalTime);
1990
1991 /* Enable the Back and Next buttons */
1993
1995 {
1997 return TRUE;
1998 }
1999
2000 SetTimer(hwndDlg, 1, 1000 - LocalTime.wMilliseconds, NULL);
2001 break;
2002 }
2003
2004 case PSN_KILLACTIVE:
2005 case DTN_DATETIMECHANGE:
2006 // NB: Not re-set until changing page (PSN_SETACTIVE).
2007 KillTimer(hwndDlg, 1);
2008 break;
2009
2010 case PSN_WIZNEXT:
2012 break;
2013
2014 case PSN_WIZBACK:
2016 break;
2017
2018 default:
2019 break;
2020 }
2021 break;
2022
2023 case WM_DESTROY:
2025 break;
2026
2027 default:
2028 break;
2029 }
2030
2031 return FALSE;
2032}
2033
2034static struct ThemeInfo
2035{
2039
2040} Themes[] = {
2042 { MAKEINTRESOURCE(IDB_LAUTUS), IDS_LAUTUS, L"themes\\lautus\\lautus.msstyles" },
2043 { MAKEINTRESOURCE(IDB_LUNAR), IDS_LUNAR, L"themes\\lunar\\lunar.msstyles" },
2044 { MAKEINTRESOURCE(IDB_MIZU), IDS_MIZU, L"themes\\mizu\\mizu.msstyles"},
2046
2047static INT_PTR CALLBACK
2049 UINT uMsg,
2050 WPARAM wParam,
2051 LPARAM lParam)
2052{
2054 LPNMLISTVIEW pnmv;
2055
2056 /* Retrieve pointer to the global setup data */
2058
2059 switch (uMsg)
2060 {
2061 case WM_INITDIALOG:
2062 {
2063 HWND hListView;
2065 DWORD n;
2066 LVITEM lvi = {0};
2067
2068 /* Save pointer to the global setup data */
2071
2072 hListView = GetDlgItem(hwndDlg, IDC_THEMEPICKER);
2073
2074 /* Common */
2076 lvi.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE;
2077
2078 for (n = 0; n < ARRAYSIZE(Themes); ++n)
2079 {
2080 WCHAR DisplayName[100] = {0};
2081 /* Load the bitmap */
2083 ImageList_AddMasked(himl, image, RGB(255,0,255));
2084
2085 /* Load the string */
2086 LoadStringW(hDllInstance, Themes[n].DisplayName, DisplayName, ARRAYSIZE(DisplayName));
2087 DisplayName[ARRAYSIZE(DisplayName)-1] = UNICODE_NULL;
2088
2089 /* Add the listview item */
2090 lvi.iItem = n;
2091 lvi.iImage = n;
2092 lvi.pszText = DisplayName;
2093 ListView_InsertItem(hListView, &lvi);
2094 }
2095
2096 /* Register the imagelist */
2098 /* Transparent background */
2099 ListView_SetBkColor(hListView, CLR_NONE);
2101 /* Reduce the size between the items */
2102 ListView_SetIconSpacing(hListView, 190, 173);
2103 break;
2104 }
2105
2106 case WM_NOTIFY:
2107 switch (((LPNMHDR)lParam)->code)
2108 {
2109 //case LVN_ITEMCHANGING:
2110 case LVN_ITEMCHANGED:
2111 pnmv = (LPNMLISTVIEW)lParam;
2112 if ((pnmv->uChanged & LVIF_STATE) && (pnmv->uNewState & LVIS_SELECTED))
2113 {
2114 int iTheme = pnmv->iItem;
2115 DPRINT1("Selected theme: %u\n", Themes[iTheme].DisplayName);
2116
2117 if (Themes[iTheme].ThemeFile)
2118 {
2119 WCHAR wszTheme[MAX_PATH];
2120 SHGetFolderPathAndSubDirW(0, CSIDL_RESOURCES, NULL, SHGFP_TYPE_DEFAULT, Themes[iTheme].ThemeFile, wszTheme);
2121 EnableVisualTheme(hwndDlg, wszTheme);
2122 }
2123 else
2124 {
2125 EnableVisualTheme(hwndDlg, Themes[iTheme].ThemeFile);
2126 }
2127 }
2128 break;
2129 case PSN_SETACTIVE:
2130 /* Enable the Back and Next buttons */
2133 {
2135 return TRUE;
2136 }
2137 break;
2138
2139 case PSN_WIZNEXT:
2140 break;
2141
2142 case PSN_WIZBACK:
2144 break;
2145
2146 default:
2147 break;
2148 }
2149 break;
2150
2151 default:
2152 break;
2153 }
2154
2155 return FALSE;
2156}
2157
2158static UINT CALLBACK
2161 UINT_PTR Param1,
2162 UINT_PTR Param2)
2163{
2164 PREGISTRATIONDATA RegistrationData;
2167
2168 RegistrationData = (PREGISTRATIONDATA)Context;
2169
2172 {
2173 StatusInfo = (PSP_REGISTER_CONTROL_STATUSW) Param1;
2174 RegistrationData->pNotify->CurrentItem = wcsrchr(StatusInfo->FileName, L'\\');
2175 if (RegistrationData->pNotify->CurrentItem == NULL)
2176 {
2177 RegistrationData->pNotify->CurrentItem = StatusInfo->FileName;
2178 }
2179 else
2180 {
2181 RegistrationData->pNotify->CurrentItem++;
2182 }
2183
2185 {
2186 DPRINT("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n",
2187 StatusInfo->FileName);
2188 RegistrationData->pNotify->Progress = RegistrationData->Registered;
2189
2190 DPRINT("RegisterDll: Start step %ld\n", RegistrationData->pNotify->Progress);
2191 SendMessage(RegistrationData->hwndDlg, PM_STEP_START, 0, (LPARAM)RegistrationData->pNotify);
2192 }
2193 else
2194 {
2195 DPRINT("Received SPFILENOTIFY_ENDREGISTRATION notification for %S\n",
2196 StatusInfo->FileName);
2197 DPRINT("Win32Error %u FailureCode %u\n", StatusInfo->Win32Error,
2198 StatusInfo->FailureCode);
2199 if (StatusInfo->FailureCode != SPREG_SUCCESS)
2200 {
2201 switch (StatusInfo->FailureCode)
2202 {
2203 case SPREG_LOADLIBRARY:
2205 break;
2206 case SPREG_GETPROCADDR:
2208 break;
2209 case SPREG_REGSVR:
2211 break;
2212 case SPREG_DLLINSTALL:
2214 break;
2215 case SPREG_TIMEOUT:
2217 break;
2218 default:
2220 break;
2221 }
2222
2223 RegistrationData->pNotify->MessageID = MessageID;
2224 RegistrationData->pNotify->LastError = StatusInfo->Win32Error;
2225 }
2226 else
2227 {
2228 RegistrationData->pNotify->MessageID = 0;
2229 RegistrationData->pNotify->LastError = ERROR_SUCCESS;
2230 }
2231
2232 if (RegistrationData->Registered < RegistrationData->DllCount)
2233 {
2234 RegistrationData->Registered++;
2235 }
2236
2237 RegistrationData->pNotify->Progress = RegistrationData->Registered;
2238 DPRINT("RegisterDll: End step %ld\n", RegistrationData->pNotify->Progress);
2239 SendMessage(RegistrationData->hwndDlg, PM_STEP_END, 0, (LPARAM)RegistrationData->pNotify);
2240 }
2241
2242 return FILEOP_DOIT;
2243 }
2244 else
2245 {
2246 DPRINT1("Received unexpected notification %u\n", Notification);
2247 return SetupDefaultQueueCallback(RegistrationData->DefaultContext,
2248 Notification, Param1, Param2);
2249 }
2250}
2251
2252
2253static
2254DWORD
2256 _In_ PITEMSDATA pItemsData,
2257 _In_ PREGISTRATIONNOTIFY pNotify)
2258{
2259 REGISTRATIONDATA RegistrationData;
2260 WCHAR SectionName[512];
2262 LONG DllCount = 0;
2264
2265 ZeroMemory(&RegistrationData, sizeof(REGISTRATIONDATA));
2266 RegistrationData.hwndDlg = pItemsData->hwndDlg;
2267 RegistrationData.Registered = 0;
2268
2269 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2270 L"RegisterDlls", &Context))
2271 {
2272 DPRINT1("No RegistrationPhase2 section found\n");
2273 return GetLastError();
2274 }
2275
2276 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2277 ARRAYSIZE(SectionName),
2278 NULL))
2279 {
2280 DPRINT1("Unable to retrieve section name\n");
2281 return GetLastError();
2282 }
2283
2284 DllCount = SetupGetLineCountW(hSysSetupInf, SectionName);
2285 DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount);
2286 if (DllCount < 0)
2287 {
2288 return STATUS_NOT_FOUND;
2289 }
2290
2291 RegistrationData.DllCount = (ULONG)DllCount;
2292 RegistrationData.DefaultContext = SetupInitDefaultQueueCallback(RegistrationData.hwndDlg);
2293 RegistrationData.pNotify = pNotify;
2294
2295 _SEH2_TRY
2296 {
2297 if (!SetupInstallFromInfSectionW(GetParent(RegistrationData.hwndDlg),
2299 L"RegistrationPhase2",
2300 SPINST_REGISTRY | SPINST_REGISTERCALLBACKAWARE | SPINST_REGSVR,
2301 0,
2302 NULL,
2303 0,
2305 &RegistrationData,
2306 NULL,
2307 NULL))
2308 {
2309 Error = GetLastError();
2310 }
2311 }
2313 {
2314 DPRINT("Catching exception\n");
2316 }
2317 _SEH2_END;
2318
2320
2321 return Error;
2322}
2323
2324static
2325VOID
2327 PITEMSDATA pItemsData)
2328{
2329 WCHAR SectionName[512];
2331 LONG Steps = 0;
2334
2335 ZeroMemory(&Notify, sizeof(Notify));
2336
2337 /* Count the 'RegisterDlls' steps */
2338 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2339 L"RegisterDlls", &Context))
2340 {
2341 DPRINT1("No RegistrationPhase2 section found\n");
2342 return;
2343 }
2344
2345 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2346 ARRAYSIZE(SectionName),
2347 NULL))
2348 {
2349 DPRINT1("Unable to retrieve section name\n");
2350 return;
2351 }
2352
2353 Steps += SetupGetLineCountW(hSysSetupInf, SectionName);
2354
2355 /* Count the 'TypeLibratries' steps */
2356 Steps += SetupGetLineCountW(hSysSetupInf, L"TypeLibraries");
2357
2358 /* Start the item */
2359 DPRINT("Register Components: %ld Steps\n", Steps);
2360 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 0, (LPARAM)Steps);
2361
2362 Error = RegisterDlls(pItemsData, &Notify);
2363 if (Error == ERROR_SUCCESS)
2364 RegisterTypeLibraries(pItemsData, &Notify, hSysSetupInf, L"TypeLibraries");
2365
2366 /* End the item */
2367 DPRINT("Register Components: done\n");
2368 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 0, Error);
2369}
2370
2371static
2372VOID
2374 PITEMSDATA pItemsData)
2375{
2376 LONG Steps = 0;
2379
2380 ZeroMemory(&Notify, sizeof(Notify));
2381
2382 /* Count steps */
2383 Steps = CountSecuritySteps();
2384
2385 /* Start the item */
2386 DPRINT("Install security: %ld Steps\n", Steps);
2387 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 2, (LPARAM)Steps);
2388
2389 /* Install steps */
2390 Error = InstallSecurity(pItemsData, &Notify);
2391
2392 /* End the item */
2393 DPRINT("Install security: done\n");
2394 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 2, Error);
2395}
2396
2397static
2398DWORD
2402{
2403 PITEMSDATA pItemsData;
2404 HWND hwndDlg;
2405
2406 pItemsData = (PITEMSDATA)Parameter;
2407 hwndDlg = pItemsData->hwndDlg;
2408
2409 /* Step 0 - Registering components */
2410 RegisterComponents(pItemsData);
2411
2412 /* Step 1 - Installing start menu items */
2413 InstallStartMenuItems(pItemsData);
2414
2415 /* Step 2 - Saving Settings */
2416 SaveSettings(pItemsData);
2417
2418 /* Step 3 - Removing temporary files */
2419// RemoveTempFiles(pItemsData);
2420
2421 // FIXME: Move this call to a separate cleanup page!
2423
2424 /* Free the items data */
2425 HeapFree(GetProcessHeap(), 0, pItemsData);
2426
2427 /* Tell the wizard page that we are done */
2428 PostMessage(hwndDlg, PM_ITEMS_DONE, 0, 0);
2429
2430 return 0;
2431}
2432
2433
2434static
2435BOOL
2437 _In_ HWND hwndDlg)
2438{
2439 HANDLE hCompletionThread;
2440 PITEMSDATA pItemsData;
2441
2442 pItemsData = HeapAlloc(GetProcessHeap(), 0, sizeof(ITEMSDATA));
2443 if (pItemsData == NULL)
2444 return FALSE;
2445
2446 pItemsData->hwndDlg = hwndDlg;
2447
2448 hCompletionThread = CreateThread(NULL,
2449 0,
2451 pItemsData,
2452 0,
2453 NULL);
2454 if (hCompletionThread == NULL)
2455 {
2456 HeapFree(GetProcessHeap(), 0, pItemsData);
2457 }
2458 else
2459 {
2460 CloseHandle(hCompletionThread);
2461 return TRUE;
2462 }
2463
2464 return FALSE;
2465}
2466
2467static
2468VOID
2470 HWND hwndDlg,
2471 DWORD LastError)
2472{
2474 WCHAR UnknownError[84];
2475 WCHAR Title[64];
2476
2478 NULL, LastError, 0, ErrorMessage, 0, NULL) == 0)
2479 {
2481 UnknownError,
2482 ARRAYSIZE(UnknownError) - 20) == 0)
2483 {
2484 wcscpy(UnknownError, L"Unknown error");
2485 }
2486 wcscat(UnknownError, L" ");
2487 _ultow(LastError, UnknownError + wcslen(UnknownError), 10);
2488 ErrorMessage = UnknownError;
2489 }
2490
2491 if (ErrorMessage != NULL)
2492 {
2494 Title, ARRAYSIZE(Title)) == 0)
2495 {
2496 wcscpy(Title, L"ReactOS Setup");
2497 }
2498
2500 }
2501
2502 if (ErrorMessage != NULL &&
2503 ErrorMessage != UnknownError)
2504 {
2506 }
2507}
2508
2509
2510static
2511VOID
2513 HWND hwndDlg,
2514 PREGISTRATIONNOTIFY RegistrationNotify)
2515{
2516 WCHAR ErrorMessage[128];
2517 WCHAR Title[64];
2518
2519 if (LoadStringW(hDllInstance, RegistrationNotify->MessageID,
2521 ARRAYSIZE(ErrorMessage)) == 0)
2522 {
2523 ErrorMessage[0] = L'\0';
2524 }
2525
2526 if (RegistrationNotify->MessageID != IDS_TIMEOUT)
2527 {
2529 RegistrationNotify->LastError, 0,
2532 NULL);
2533 }
2534
2535 if (ErrorMessage[0] != L'\0')
2536 {
2538 Title, ARRAYSIZE(Title)) == 0)
2539 {
2540 wcscpy(Title, L"ReactOS Setup");
2541 }
2542
2543 MessageBoxW(hwndDlg, ErrorMessage,
2545 }
2546}
2547
2548
2549static INT_PTR CALLBACK
2551 UINT uMsg,
2552 WPARAM wParam,
2553 LPARAM lParam)
2554{
2556 PREGISTRATIONNOTIFY RegistrationNotify;
2557 static HICON s_hCheckIcon, s_hArrowIcon, s_hCrossIcon;
2558 static HFONT s_hNormalFont;
2559
2560 /* Retrieve pointer to the global setup data */
2562
2563 switch (uMsg)
2564 {
2565 case WM_INITDIALOG:
2566 {
2567 /* Save pointer to the global setup data */
2571 ShowDlgItem(hwndDlg, IDC_CHECK4, SW_HIDE);
2572 s_hCheckIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CHECKICON), IMAGE_ICON, 16, 16, 0);
2573 s_hArrowIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_ARROWICON), IMAGE_ICON, 16, 16, 0);
2574 s_hCrossIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CROSSICON), IMAGE_ICON, 16, 16, 0);
2575 s_hNormalFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1, WM_GETFONT, 0, 0);
2576 break;
2577 }
2578
2579 case WM_DESTROY:
2580 DestroyIcon(s_hCheckIcon);
2581 DestroyIcon(s_hArrowIcon);
2582 DestroyIcon(s_hCrossIcon);
2583 break;
2584
2585 case WM_NOTIFY:
2586 switch (((LPNMHDR)lParam)->code)
2587 {
2588 case PSN_SETACTIVE:
2589 {
2590 LogItem(L"BEGIN", L"ProcessPage");
2591
2592 /* Disable all buttons during installation; hide "Back" */
2594 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
2596
2597 RunItemCompletionThread(hwndDlg);
2598 break;
2599 }
2600
2601 case PSN_WIZNEXT:
2602 LogItem(L"END", L"ProcessPage");
2603 break;
2604
2605 case PSN_WIZBACK:
2607 break;
2608
2609 default:
2610 break;
2611 }
2612 break;
2613
2614 case PM_ITEM_START:
2615 DPRINT("PM_ITEM_START %lu\n", (ULONG)lParam);
2620 break;
2621
2622 case PM_ITEM_END:
2623 DPRINT("PM_ITEM_END\n");
2624 SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1 + wParam, WM_SETFONT, (WPARAM)s_hNormalFont, (LPARAM)TRUE);
2625 if (lParam == ERROR_SUCCESS)
2626 {
2628 }
2629 else
2630 {
2632 ShowItemError(hwndDlg, (DWORD)lParam);
2633 }
2634 break;
2635
2636 case PM_STEP_START:
2637 DPRINT("PM_STEP_START\n");
2638 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2640 (LPARAM)((RegistrationNotify->CurrentItem != NULL)? RegistrationNotify->CurrentItem : L""));
2641 break;
2642
2643 case PM_STEP_END:
2644 DPRINT("PM_STEP_END\n");
2645 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2646 SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS, RegistrationNotify->Progress, 0);
2647 if (RegistrationNotify->LastError != ERROR_SUCCESS)
2648 {
2649 ShowStepError(hwndDlg, RegistrationNotify);
2650 }
2651 break;
2652
2653 case PM_ITEMS_DONE:
2654 DPRINT("PM_ITEMS_DONE\n");
2655 /* Enable the Back and Next buttons */
2658 break;
2659
2660 default:
2661 break;
2662 }
2663
2664 return FALSE;
2665}
2666
2667
2668static VOID
2670{
2671 HKEY hKey = 0;
2672 DWORD InProgress = 0;
2673 DWORD InstallDate;
2674
2676 L"SYSTEM\\Setup",
2677 0,
2678 KEY_WRITE,
2679 &hKey ) == ERROR_SUCCESS)
2680 {
2681 RegSetValueExW( hKey, L"SystemSetupInProgress", 0, REG_DWORD, (LPBYTE)&InProgress, sizeof(InProgress) );
2682 RegCloseKey( hKey );
2683 }
2684
2686 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
2687 0,
2688 KEY_WRITE,
2689 &hKey ) == ERROR_SUCCESS)
2690 {
2691 InstallDate = (DWORD)time(NULL);
2692 RegSetValueExW( hKey, L"InstallDate", 0, REG_DWORD, (LPBYTE)&InstallDate, sizeof(InstallDate) );
2693 RegCloseKey( hKey );
2694 }
2695}
2696
2697static INT_PTR CALLBACK
2699 UINT uMsg,
2700 WPARAM wParam,
2701 LPARAM lParam)
2702{
2703 switch (uMsg)
2704 {
2705 case WM_INITDIALOG:
2706 {
2707 /* Get pointer to the global setup data */
2709
2711 {
2712 /* Run the Wine Gecko prompt */
2713 Control_RunDLLW(hwndDlg, 0, L"appwiz.cpl,,install_gecko", SW_SHOW);
2714 }
2715
2716 /* Set title font */
2717 SendDlgItemMessage(hwndDlg,
2719 WM_SETFONT,
2721 (LPARAM)TRUE);
2723 {
2724 KillTimer(hwndDlg, 1);
2726 PostQuitMessage(0);
2727 }
2728
2729 /* Ensure that the installer wizard window is made visible and focused */
2730 ShowWindow(GetParent(hwndDlg), SW_SHOW);
2732 break;
2733 }
2734
2735 case WM_DESTROY:
2736 {
2738 PostQuitMessage(0);
2739 return TRUE;
2740 }
2741
2742 case WM_TIMER:
2743 {
2744 HWND hWndProgress;
2745 INT Position;
2746
2747 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
2748 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
2749 if (Position == 300)
2750 {
2751 KillTimer(hwndDlg, 1);
2753 }
2754 else
2755 {
2756 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
2757 }
2758 return TRUE;
2759 }
2760
2761 case WM_NOTIFY:
2762 {
2763 LPNMHDR lpnm = (LPNMHDR)lParam;
2764
2765 switch (lpnm->code)
2766 {
2767 case PSN_SETACTIVE:
2768 {
2769 HWND hWndParent = GetParent(hwndDlg);
2770
2771 /* Only "Finish" for closing the wizard, and hide "Back" and "Next" */
2773 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_CANCEL);
2776
2777 /* Set up the reboot progress bar and countdown timer.
2778 * 300 steps at 50 ms each: 15 seconds */
2781 SetTimer(hwndDlg, 1, 50, NULL);
2782 break;
2783 }
2784
2785 case PSN_WIZFINISH:
2786 DestroyWindow(GetParent(hwndDlg));
2787 break;
2788
2789 default:
2790 break;
2791 }
2792 break;
2793 }
2794
2795 default:
2796 break;
2797 }
2798
2799 return FALSE;
2800}
2801
2802
2803/*
2804 * GetInstallSourceWin32 retrieves the path to the ReactOS installation medium
2805 * in Win32 format, for later use by syssetup and storage in the registry.
2806 */
2807static BOOL
2809 OUT PWSTR pwszPath,
2810 IN DWORD cchPathMax,
2811 IN PCWSTR pwszNTPath)
2812{
2813 WCHAR wszDrives[512];
2814 WCHAR wszNTPath[512]; // MAX_PATH ?
2815 DWORD cchDrives;
2816 PWCHAR pwszDrive;
2817
2818 *pwszPath = UNICODE_NULL;
2819
2820 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2821 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2822 {
2823 /* Buffer too small or failure */
2824 LogItem(NULL, L"GetLogicalDriveStringsW failed");
2825 return FALSE;
2826 }
2827
2828 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2829 {
2830 WCHAR wszBuf[MAX_PATH];
2831
2832 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2833 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2834 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2835 pwszDrive[2] = L'\\'; // Restore the backslash
2836
2837 wcscat(wszNTPath, L"\\"); // Concat a backslash
2838
2839 /* Logging */
2840 wsprintf(wszBuf, L"Testing '%s' --> '%s' %s a CD",
2841 pwszDrive, wszNTPath,
2842 (GetDriveTypeW(pwszDrive) == DRIVE_CDROM) ? L"is" : L"is not");
2843 LogItem(NULL, wszBuf);
2844
2845 /* Check whether the NT path corresponds to the NT installation source path */
2846 if (!_wcsicmp(wszNTPath, pwszNTPath))
2847 {
2848 /* Found it! */
2849 wcscpy(pwszPath, pwszDrive); // cchPathMax
2850
2851 /* Logging */
2852 wsprintf(wszBuf, L"GetInstallSourceWin32: %s", pwszPath);
2853 LogItem(NULL, wszBuf);
2854 wcscat(wszBuf, L"\n");
2855 OutputDebugStringW(wszBuf);
2856
2857 return TRUE;
2858 }
2859 }
2860
2861 return FALSE;
2862}
2863
2864VOID
2866 IN OUT PSETUPDATA pSetupData)
2867{
2868 INFCONTEXT InfContext;
2869 WCHAR szName[256];
2870 WCHAR szValue[MAX_PATH];
2871 DWORD LineLength;
2872 HKEY hKey;
2873
2874 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2875 L"Unattend",
2876 L"UnattendSetupEnabled",
2877 &InfContext))
2878 {
2879 DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError());
2880 return;
2881 }
2882
2883 if (!SetupGetStringFieldW(&InfContext,
2884 1,
2885 szValue,
2886 ARRAYSIZE(szValue),
2887 &LineLength))
2888 {
2889 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2890 return;
2891 }
2892
2893 if (_wcsicmp(szValue, L"yes") != 0)
2894 {
2895 DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n");
2896 return;
2897 }
2898
2899 pSetupData->UnattendSetup = TRUE;
2900
2901 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2902 L"Unattend",
2903 NULL,
2904 &InfContext))
2905 {
2906 DPRINT1("Error: SetupFindFirstLine failed %d\n", GetLastError());
2907 return;
2908 }
2909
2910 do
2911 {
2912 if (!SetupGetStringFieldW(&InfContext,
2913 0,
2914 szName,
2916 &LineLength))
2917 {
2918 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2919 return;
2920 }
2921
2922 if (!SetupGetStringFieldW(&InfContext,
2923 1,
2924 szValue,
2925 ARRAYSIZE(szValue),
2926 &LineLength))
2927 {
2928 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2929 return;
2930 }
2931 DPRINT1("Name %S Value %S\n", szName, szValue);
2932 if (!_wcsicmp(szName, L"FullName"))
2933 {
2934 if (ARRAYSIZE(pSetupData->OwnerName) > LineLength)
2935 {
2936 wcscpy(pSetupData->OwnerName, szValue);
2937 }
2938 }
2939 else if (!_wcsicmp(szName, L"OrgName"))
2940 {
2941 if (ARRAYSIZE(pSetupData->OwnerOrganization) > LineLength)
2942 {
2943 wcscpy(pSetupData->OwnerOrganization, szValue);
2944 }
2945 }
2946 else if (!_wcsicmp(szName, L"ComputerName"))
2947 {
2948 if (ARRAYSIZE(pSetupData->ComputerName) > LineLength)
2949 {
2950 wcscpy(pSetupData->ComputerName, szValue);
2951 }
2952 }
2953 else if (!_wcsicmp(szName, L"AdminPassword"))
2954 {
2955 if (ARRAYSIZE(pSetupData->AdminPassword) > LineLength)
2956 {
2957 wcscpy(pSetupData->AdminPassword, szValue);
2958 }
2959 }
2960 else if (!_wcsicmp(szName, L"TimeZoneIndex"))
2961 {
2962 pSetupData->TimeZoneIndex = _wtoi(szValue);
2963 }
2964 else if (!_wcsicmp(szName, L"DisableAutoDaylightTimeSet"))
2965 {
2966 pSetupData->DisableAutoDaylightTimeSet = _wtoi(szValue);
2967 }
2968 else if (!_wcsicmp(szName, L"DisableGeckoInst"))
2969 {
2970 if (!_wcsicmp(szValue, L"yes"))
2971 pSetupData->DisableGeckoInst = TRUE;
2972 else
2973 pSetupData->DisableGeckoInst = FALSE;
2974 }
2975 else if (!_wcsicmp(szName, L"ProductOption"))
2976 {
2977 pSetupData->ProductOption = (PRODUCT_OPTION)_wtoi(szValue);
2978 }
2979 } while (SetupFindNextLine(&InfContext, &InfContext));
2980
2981 if (SetupFindFirstLineW(pSetupData->hSetupInf,
2982 L"Display",
2983 NULL,
2984 &InfContext))
2985 {
2986 DEVMODEW dm = { { 0 } };
2987 dm.dmSize = sizeof(dm);
2989 {
2990 do
2991 {
2992 int iValue;
2993 if (!SetupGetStringFieldW(&InfContext,
2994 0,
2995 szName,
2997 &LineLength))
2998 {
2999 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3000 return;
3001 }
3002
3003 if (!SetupGetStringFieldW(&InfContext,
3004 1,
3005 szValue,
3006 ARRAYSIZE(szValue),
3007 &LineLength))
3008 {
3009 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3010 return;
3011 }
3012 iValue = _wtoi(szValue);
3013 DPRINT1("Name %S Value %i\n", szName, iValue);
3014
3015 if (!iValue)
3016 continue;
3017
3018 if (!_wcsicmp(szName, L"BitsPerPel"))
3019 {
3020 dm.dmFields |= DM_BITSPERPEL;
3021 dm.dmBitsPerPel = iValue;
3022 }
3023 else if (!_wcsicmp(szName, L"XResolution"))
3024 {
3025 dm.dmFields |= DM_PELSWIDTH;
3026 dm.dmPelsWidth = iValue;
3027 }
3028 else if (!_wcsicmp(szName, L"YResolution"))
3029 {
3030 dm.dmFields |= DM_PELSHEIGHT;
3031 dm.dmPelsHeight = iValue;
3032 }
3033 else if (!_wcsicmp(szName, L"VRefresh"))
3034 {
3036 dm.dmDisplayFrequency = iValue;
3037 }
3038 } while (SetupFindNextLine(&InfContext, &InfContext));
3039
3041 }
3042 }
3043
3045 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
3046 0,
3048 &hKey) != ERROR_SUCCESS)
3049 {
3050 DPRINT1("Error: failed to open HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n");
3051 return;
3052 }
3053
3054 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3055 L"GuiRunOnce",
3056 NULL,
3057 &InfContext))
3058 {
3059 int i = 0;
3060 do
3061 {
3062 if (SetupGetStringFieldW(&InfContext,
3063 0,
3064 szValue,
3065 ARRAYSIZE(szValue),
3066 NULL))
3067 {
3069 _swprintf(szName, L"%d", i);
3070 DPRINT("szName %S szValue %S\n", szName, szValue);
3071
3073 {
3074 DPRINT("value %S\n", szPath);
3075 if (RegSetValueExW(hKey,
3076 szName,
3077 0,
3078 REG_SZ,
3079 (const BYTE*)szPath,
3080 (wcslen(szPath) + 1) * sizeof(WCHAR)) == ERROR_SUCCESS)
3081 {
3082 i++;
3083 }
3084 }
3085 }
3086 } while (SetupFindNextLine(&InfContext, &InfContext));
3087 }
3088
3090
3091 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3092 L"Env",
3093 NULL,
3094 &InfContext))
3095 {
3096 if (RegCreateKeyExW(
3097 HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", 0, NULL,
3099 {
3100 DPRINT1("Error: failed to open HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\n");
3101 return;
3102 }
3103 do
3104 {
3105 if (!SetupGetStringFieldW(&InfContext,
3106 0,
3107 szName,
3109 &LineLength))
3110 {
3111 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3112 return;
3113 }
3114
3115 if (!SetupGetStringFieldW(&InfContext,
3116 1,
3117 szValue,
3118 ARRAYSIZE(szValue),
3119 &LineLength))
3120 {
3121 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3122 return;
3123 }
3124 DPRINT1("[ENV] %S=%S\n", szName, szValue);
3125
3126 DWORD dwType = wcschr(szValue, '%') != NULL ? REG_EXPAND_SZ : REG_SZ;
3127
3128 if (RegSetValueExW(hKey, szName, 0, dwType, (const BYTE*)szValue, (DWORD)(wcslen(szValue) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS)
3129 {
3130 DPRINT1(" - Error %d\n", GetLastError());
3131 }
3132
3133 } while (SetupFindNextLine(&InfContext, &InfContext));
3134
3136 }
3137}
3138
3139static BOOL
3141 IN LPCWSTR lpPath1,
3142 IN LPCWSTR lpPath2)
3143{
3144 WCHAR szPath1[MAX_PATH];
3145 WCHAR szPath2[MAX_PATH];
3146
3147 /* If something goes wrong, better return TRUE,
3148 * so the calling function returns early.
3149 */
3150 if (!PathCanonicalizeW(szPath1, lpPath1))
3151 return TRUE;
3152
3153 if (!PathAddBackslashW(szPath1))
3154 return TRUE;
3155
3156 if (!PathCanonicalizeW(szPath2, lpPath2))
3157 return TRUE;
3158
3159 if (!PathAddBackslashW(szPath2))
3160 return TRUE;
3161
3162 return (_wcsicmp(szPath1, szPath2) == 0);
3163}
3164
3165static VOID
3167 IN HKEY hKey,
3168 IN LPWSTR lpPath)
3169{
3170 LONG res;
3171 DWORD dwRegType;
3172 DWORD dwPathLength = 0;
3173 DWORD dwNewLength = 0;
3174 LPWSTR Buffer = NULL;
3175 LPWSTR Path;
3176
3178 hKey,
3179 L"Installation Sources",
3180 NULL,
3181 &dwRegType,
3182 NULL,
3183 &dwPathLength);
3184
3185 if (res != ERROR_SUCCESS ||
3186 dwRegType != REG_MULTI_SZ ||
3187 dwPathLength == 0 ||
3188 dwPathLength % sizeof(WCHAR) != 0)
3189 {
3190 dwPathLength = 0;
3191 goto set;
3192 }
3193
3194 /* Reserve space for existing data + new string */
3195 dwNewLength = dwPathLength + (wcslen(lpPath) + 1) * sizeof(WCHAR);
3196 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3197 if (!Buffer)
3198 return;
3199
3200 ZeroMemory(Buffer, dwNewLength);
3201
3203 hKey,
3204 L"Installation Sources",
3205 NULL,
3206 NULL,
3207 (LPBYTE)Buffer,
3208 &dwPathLength);
3209
3210 if (res != ERROR_SUCCESS)
3211 {
3213 dwPathLength = 0;
3214 goto set;
3215 }
3216
3217 /* Sanity check, these should already be zeros */
3218 Buffer[dwPathLength / sizeof(WCHAR) - 2] = UNICODE_NULL;
3219 Buffer[dwPathLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3220
3221 for (Path = Buffer; *Path; Path += wcslen(Path) + 1)
3222 {
3223 /* Check if path is already added */
3224 if (PathIsEqual(Path, lpPath))
3225 goto cleanup;
3226 }
3227
3228 Path = Buffer + dwPathLength / sizeof(WCHAR) - 1;
3229
3230set:
3231 if (dwPathLength == 0)
3232 {
3233 dwNewLength = (wcslen(lpPath) + 1 + 1) * sizeof(WCHAR);
3234 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3235 if (!Buffer)
3236 return;
3237
3238 Path = Buffer;
3239 }
3240
3241 StringCbCopyW(Path, dwNewLength - (Path - Buffer) * sizeof(WCHAR), lpPath);
3242 Buffer[dwNewLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3243
3245 hKey,
3246 L"Installation Sources",
3247 0,
3249 (LPBYTE)Buffer,
3250 dwNewLength);
3251
3252cleanup:
3254}
3255
3256VOID
3258 IN OUT PSETUPDATA pSetupData)
3259{
3261 WCHAR szValue[MAX_PATH];
3262 INFCONTEXT InfContext;
3263 DWORD LineLength;
3264 HKEY hKey;
3265 LONG res;
3266
3267 pSetupData->hSetupInf = INVALID_HANDLE_VALUE;
3268
3269 /* Retrieve the path of the setup INF */
3271 wcscat(szPath, L"\\$winnt$.inf");
3272
3273 /* Open the setup INF */
3274 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3275 NULL,
3277 NULL);
3278 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3279 {
3280 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3281 return;
3282 }
3283
3284
3285 /* Retrieve the NT source path from which the 1st-stage installer was run */
3286 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
3287 L"data",
3288 L"sourcepath",
3289 &InfContext))
3290 {
3291 DPRINT1("Error: Cannot find sourcepath Key! %d\n", GetLastError());
3292 return;
3293 }
3294
3295 if (!SetupGetStringFieldW(&InfContext,
3296 1,
3297 szValue,
3298 ARRAYSIZE(szValue),
3299 &LineLength))
3300 {
3301 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3302 return;
3303 }
3304
3305 *pSetupData->SourcePath = UNICODE_NULL;
3306
3307 /* Close the setup INF as we are going to modify it manually */
3308 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3309 SetupCloseInfFile(pSetupData->hSetupInf);
3310
3311
3312 /* Find the installation source path in Win32 format */
3313 if (!GetInstallSourceWin32(pSetupData->SourcePath,
3314 _countof(pSetupData->SourcePath),
3315 szValue))
3316 {
3317 *pSetupData->SourcePath = UNICODE_NULL;
3318 }
3319
3320 /* Save the path in Win32 format in the setup INF */
3321 _swprintf(szValue, L"\"%s\"", pSetupData->SourcePath);
3322 WritePrivateProfileStringW(L"data", L"dospath", szValue, szPath);
3323
3324 /*
3325 * Save it also in the registry, in the following keys:
3326 * - HKLM\Software\Microsoft\Windows\CurrentVersion\Setup ,
3327 * values "SourcePath" and "ServicePackSourcePath" (REG_SZ);
3328 * - HKLM\Software\Microsoft\Windows NT\CurrentVersion ,
3329 * value "SourcePath" (REG_SZ); set to the full path (e.g. D:\I386).
3330 */
3331#if 0
3333 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
3334 0,
3336 &hKey);
3337
3338 if (res != ERROR_SUCCESS)
3339 {
3340 return FALSE;
3341 }
3342#endif
3343
3345 L"Software\\Microsoft\\Windows\\CurrentVersion\\Setup",
3346 0, NULL,
3348 KEY_ALL_ACCESS, // KEY_WRITE
3349 NULL,
3350 &hKey,
3351 NULL);
3352 if (res == ERROR_SUCCESS)
3353 {
3354 AddInstallationSource(hKey, pSetupData->SourcePath);
3355
3357 L"SourcePath",
3358 0,
3359 REG_SZ,
3360 (LPBYTE)pSetupData->SourcePath,
3361 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3362
3364 L"ServicePackSourcePath",
3365 0,
3366 REG_SZ,
3367 (LPBYTE)pSetupData->SourcePath,
3368 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3369
3371 }
3372
3373
3374 /* Now, re-open the setup INF (this must succeed) */
3375 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3376 NULL,
3378 NULL);
3379 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3380 {
3381 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3382 return;
3383 }
3384
3385 /* Process the unattended section of the setup file */
3386 ProcessUnattendSection(pSetupData);
3387}
3388
3390
3391VOID
3393{
3394 PROPSHEETHEADER psh = {0};
3395 HPROPSHEETPAGE *phpage = NULL;
3396 PROPSHEETPAGE psp = {0};
3397 UINT nPages = 0;
3398 HWND hWnd;
3399 MSG msg;
3400 PSETUPDATA pSetupData = NULL;
3401 HMODULE hNetShell = NULL;
3403 DWORD dwPageCount = 10, dwNetworkPageCount = 0;
3404
3405 LogItem(L"BEGIN_SECTION", L"InstallWizard");
3406
3407 /* Allocate setup data */
3408 pSetupData = HeapAlloc(GetProcessHeap(),
3410 sizeof(SETUPDATA));
3411 if (pSetupData == NULL)
3412 {
3413 LogItem(NULL, L"SetupData allocation failed!");
3415 L"Setup failed to allocate global data!",
3416 L"ReactOS Setup",
3418 goto done;
3419 }
3421
3422 hNetShell = LoadLibraryW(L"netshell.dll");
3423 if (hNetShell != NULL)
3424 {
3425 DPRINT("Netshell.dll loaded!\n");
3426
3427 pfn = (PFNREQUESTWIZARDPAGES)GetProcAddress(hNetShell,
3428 "NetSetupRequestWizardPages");
3429 if (pfn != NULL)
3430 {
3431 pfn(&dwNetworkPageCount, NULL, NULL);
3432 dwPageCount += dwNetworkPageCount;
3433 }
3434 }
3435
3436 DPRINT("PageCount: %lu\n", dwPageCount);
3437
3438 phpage = HeapAlloc(GetProcessHeap(),
3440 dwPageCount * sizeof(HPROPSHEETPAGE));
3441 if (phpage == NULL)
3442 {
3443 LogItem(NULL, L"Page array allocation failed!");
3445 L"Setup failed to allocate page array!",
3446 L"ReactOS Setup",
3448 goto done;
3449 }
3450
3451 /* Process the $winnt$.inf setup file */
3452 ProcessSetupInf(pSetupData);
3453
3454 /* Create the Welcome page */
3455 psp.dwSize = sizeof(PROPSHEETPAGE);
3456 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3457 psp.hInstance = hDllInstance;
3458 psp.lParam = (LPARAM)pSetupData;
3459 psp.pfnDlgProc = WelcomeDlgProc;
3460 psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
3461 phpage[nPages++] = CreatePropertySheetPage(&psp);
3462
3463 /* Create the Acknowledgements page */
3464 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3465 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ACKTITLE);
3466 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE);
3467 psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE);
3468 psp.pfnDlgProc = AckPageDlgProc;
3469 phpage[nPages++] = CreatePropertySheetPage(&psp);
3470
3471 /* Create the Product page */
3472 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3473 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PRODUCTTITLE);
3474 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PRODUCTSUBTITLE);
3475 psp.pszTemplate = MAKEINTRESOURCE(IDD_PRODUCT);
3476 psp.pfnDlgProc = ProductPageDlgProc;
3477 phpage[nPages++] = CreatePropertySheetPage(&psp);
3478
3479 /* Create the Locale page */
3480 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3481 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
3482 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
3483 psp.pfnDlgProc = LocalePageDlgProc;
3484 psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
3485 phpage[nPages++] = CreatePropertySheetPage(&psp);
3486
3487 /* Create the Owner page */
3488 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3489 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
3490 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
3491 psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
3492 psp.pfnDlgProc = OwnerPageDlgProc;
3493 phpage[nPages++] = CreatePropertySheetPage(&psp);
3494
3495 /* Create the Computer page */
3496 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3497 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
3498 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
3499 psp.pfnDlgProc = ComputerPageDlgProc;
3500 psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
3501 phpage[nPages++] = CreatePropertySheetPage(&psp);
3502
3503 /* Create the DateTime page */
3504 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3505 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
3506 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
3507 psp.pfnDlgProc = DateTimePageDlgProc;
3508 psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
3509 phpage[nPages++] = CreatePropertySheetPage(&psp);
3510
3511 /* Create the theme selection page */
3512 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3513 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONTITLE);
3514 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONSUBTITLE);
3515 psp.pfnDlgProc = ThemePageDlgProc;
3516 psp.pszTemplate = MAKEINTRESOURCE(IDD_THEMEPAGE);
3517 phpage[nPages++] = CreatePropertySheetPage(&psp);
3518
3521
3522 if (pfn)
3523 {
3524 pfn(&dwNetworkPageCount, &phpage[nPages], pSetupData);
3525 nPages += dwNetworkPageCount;
3526 }
3527
3528 /* Create the Process page */
3529 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3530 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
3531 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
3532 psp.pfnDlgProc = ProcessPageDlgProc;
3533 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
3534 phpage[nPages++] = CreatePropertySheetPage(&psp);
3535
3536 /* Create the Finish page */
3537 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3538 psp.pfnDlgProc = FinishDlgProc;
3539 psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
3540 phpage[nPages++] = CreatePropertySheetPage(&psp);
3541
3542 ASSERT(nPages == dwPageCount);
3543
3544 /* Create the property sheet */
3545 psh.dwSize = sizeof(PROPSHEETHEADER);
3546 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_MODELESS;
3547 psh.hInstance = hDllInstance;
3548 psh.hwndParent = NULL;
3549 psh.nPages = nPages;
3550 psh.nStartPage = 0;
3551 psh.phpage = phpage;
3552 psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
3553 psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
3554
3555 /* Create title font */
3556 pSetupData->hTitleFont = CreateTitleFont();
3557 pSetupData->hBoldFont = CreateBoldFont();
3558
3559 /* Display the wizard */
3560 hWnd = (HWND)PropertySheet(&psh);
3562
3563 while (GetMessage(&msg, NULL, 0, 0))
3564 {
3565 if (!IsDialogMessage(hWnd, &msg))
3566 {
3569 }
3570 }
3571
3572 DeleteObject(pSetupData->hBoldFont);
3573 DeleteObject(pSetupData->hTitleFont);
3574
3575 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3576 SetupCloseInfFile(pSetupData->hSetupInf);
3577
3578done:
3579 if (phpage != NULL)
3580 HeapFree(GetProcessHeap(), 0, phpage);
3581
3582 if (hNetShell != NULL)
3583 FreeLibrary(hNetShell);
3584
3585 if (pSetupData != NULL)
3586 HeapFree(GetProcessHeap(), 0, pSetupData);
3587
3588 LogItem(L"END_SECTION", L"InstallWizard");
3589}
3590
3591/* EOF */
static _In_ LPCWSTR LocaleName
PRTL_UNICODE_STRING_BUFFER Path
#define isprint(c)
Definition: acclib.h:73
#define msg(x)
Definition: auth_time.c:54
void SaveSettings(void)
Definition: settings.c:115
HWND hWnd
Definition: settings.c:17
static VOID ErrorMessage(_In_ DWORD dwErrorCode, _In_opt_ PCWSTR pszMsg,...)
Definition: attrib.c:32
#define IDB_HEADER
Definition: resource.h:30
#define IDS_TIMEOUT
Definition: resource.h:14
#define DPRINT1
Definition: precomp.h:8
HFONT hFont
Definition: main.c:53
SETUPDATA SetupData
Definition: reactos.c:24
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
#define ID_WIZNEXT
Definition: reactos.h:47
struct _SETUPDATA * PSETUPDATA
#define ID_WIZBACK
Definition: reactos.h:46
#define IDS_PROCESSSUBTITLE
Definition: resource.h:109
#define IDS_PROCESSTITLE
Definition: resource.h:108
#define IDC_PROCESSPROGRESS
Definition: resource.h:72
#define IDC_FINISHTITLE
Definition: resource.h:75
#define IDB_WATERMARK
Definition: resource.h:13
#define IDD_PROCESSPAGE
Definition: resource.h:69
#define IDC_ITEM
Definition: resource.h:71
#define IDD_FINISHPAGE
Definition: resource.h:74
#define IDC_RESTART_PROGRESS
Definition: resource.h:77
BOOL Error
Definition: chkdsk.c:66
#define IDD_LOCALEPAGE
Definition: resource.h:13
#define RegCloseKey(hKey)
Definition: registry.h:49
HIMAGELIST himl
Definition: bufpool.h:45
Definition: _set.h:50
static HINSTANCE hDllInstance
Definition: clb.c:9
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI SetComputerNameW(LPCWSTR lpComputerName)
Definition: compname.c:616
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
Definition: compname.c:648
static HWND hwndParent
Definition: cryptui.c:300
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI SHIM_OBJ_NAME() Notify(DWORD fdwReason, PVOID ptr)
#define IDC_TIMEZONELIST
Definition: resource.h:16
#define IDD_DATETIMEPAGE
Definition: resource.h:5
#define IDC_AUTODAYLIGHT
Definition: resource.h:17
#define IDC_TIMEPICKER
Definition: resource.h:11
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IDS_REACTOS_SETUP
Definition: resource.h:140
#define IDC_CHECK1
Definition: resource.h:319
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:573
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
static const WCHAR Title[]
Definition: oid.c:1259
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define wcsrchr
Definition: compat.h:16
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
HANDLE HWND
Definition: compat.h:19
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrlenW
Definition: compat.h:750
static void cleanup(void)
Definition: main.c:1335
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:520
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2232
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4442
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
BOOL WINAPI SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime)
Definition: time.c:328
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:272
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
BOOL WINAPI SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
Definition: timezone.c:316
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
GEOID WINAPI GetUserGeoID(GEOCLASS GeoClass)
Definition: locale.c:4747
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2803
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: locale.c:5401
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1235
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
LCID lcid
Definition: locale.c:5656
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
_ACRTIMP wchar_t *__cdecl _ultow(__msvcrt_ulong, wchar_t *, int)
Definition: string.c:2199
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2773
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP int __cdecl rand(void)
Definition: misc.c:59
_ACRTIMP void __cdecl srand(unsigned int)
Definition: misc.c:50
#define IDC_COMPUTERNAME
Definition: resource.h:15
#define IDC_WELCOMETITLE
Definition: resource.h:16
#define IDD_WELCOMEPAGE
Definition: resource.h:21
static const WCHAR CmdLine[]
Definition: install.c:48
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1330
static const WCHAR RegisterDlls[]
Definition: install.c:118
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
LONG WINAPI SetupGetLineCountW(HINF hinf, PCWSTR section)
Definition: parser.c:1501
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
Definition: queue.c:1656
PVOID WINAPI SetupInitDefaultQueueCallback(HWND owner)
Definition: queue.c:1629
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2781
NTSTATUS SetAdministratorPassword(LPCWSTR Password)
Definition: security.c:1692
struct _ITEMSDATA * PITEMSDATA
#define PM_ITEMS_DONE
Definition: globals.h:64
#define PM_STEP_START
Definition: globals.h:62
LONG CountSecuritySteps(VOID)
Definition: security.c:1607
#define PM_ITEM_START
Definition: globals.h:52
#define PM_ITEM_END
Definition: globals.h:57
struct _REGISTRATIONNOTIFY * PREGISTRATIONNOTIFY
#define PM_STEP_END
Definition: globals.h:63
DWORD InstallSecurity(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify)
Definition: security.c:1648
HINF hSysSetupInf
Definition: install.c:37
BOOL RegisterTypeLibraries(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:539
VOID InstallStartMenuItems(_In_ PITEMSDATA pItemsData)
Definition: install.c:313
#define IDS_THEMESELECTIONTITLE
Definition: resource.h:134
#define IDC_TASKTEXT4
Definition: resource.h:75
#define IDC_OWNERORGANIZATION
Definition: resource.h:50
#define IDS_LOCALESUBTITLE
Definition: resource.h:124
#define IDD_PRODUCT
Definition: resource.h:109
#define IDD_ACKPAGE
Definition: resource.h:44
#define IDR_GPL
Definition: resource.h:181
#define IDC_VIEWGPL
Definition: resource.h:46
#define IDS_ACKTITLE
Definition: resource.h:114
#define IDC_ADMINPASSWORD2
Definition: resource.h:55
#define IDS_PRODUCTWORKSTATIONNAME
Definition: resource.h:176
#define IDS_LAUTUS
Definition: resource.h:169
#define IDC_PRODUCT_ICON
Definition: resource.h:110
#define IDS_PRODUCTTITLE
Definition: resource.h:173
#define IDS_DEFAULT
Definition: resource.h:179
#define IDS_DLLINSTALL_FAILED
Definition: resource.h:144
#define IDS_REGSVR_FAILED
Definition: resource.h:143
#define IDS_WZD_COMPUTERNAME
Definition: resource.h:152
#define IDD_OWNERPAGE
Definition: resource.h:48
#define IDS_LOADLIBRARY_FAILED
Definition: resource.h:141
#define IDB_LUNAR
Definition: resource.h:25
#define IDS_OWNERSUBTITLE
Definition: resource.h:118
#define IDS_GETPROCADDR_FAILED
Definition: resource.h:142
#define IDS_WZD_PASSWORDMATCH
Definition: resource.h:154
#define IDB_MIZU
Definition: resource.h:26
#define IDD_GPL
Definition: resource.h:92
#define IDS_COMPUTERSUBTITLE
Definition: resource.h:121
#define IDS_LAYOUTTEXT
Definition: resource.h:126
#define IDC_DATEPICKER
Definition: resource.h:64
#define IDC_PROJECTS
Definition: resource.h:45
#define IDC_LOCALETEXT
Definition: resource.h:58
#define IDC_TASKTEXT1
Definition: resource.h:72
#define IDS_CLASSIC
Definition: resource.h:168
#define IDS_LUNAR
Definition: resource.h:170
#define IDC_PRODUCT_OPTIONS
Definition: resource.h:111
#define IDS_WZD_PASSWORDCHAR
Definition: resource.h:155
#define IDC_PRODUCT_DESCRIPTION
Definition: resource.h:112
#define IDS_DATETIMESUBTITLE
Definition: resource.h:129
#define IDI_ARROWICON
Definition: resource.h:36
#define IDS_LOCALETITLE
Definition: resource.h:123
#define IDS_PRODUCTWORKSTATIONINFO
Definition: resource.h:178
#define IDS_THEMESELECTIONSUBTITLE
Definition: resource.h:135
#define IDS_REASON_UNKNOWN
Definition: resource.h:146
#define IDS_LOCALETEXT
Definition: resource.h:125
#define IDS_PRODUCTSERVERNAME
Definition: resource.h:175
#define IDC_THEMEPICKER
Definition: resource.h:90
#define IDS_COMPUTERTITLE
Definition: resource.h:120
#define IDS_WZD_LOCALTIME
Definition: resource.h:156
#define IDS_ACKPROJECTS
Definition: resource.h:137
#define IDS_MACHINE_OWNER_NAME
Definition: resource.h:148
#define IDS_WZD_SETCOMPUTERNAME
Definition: resource.h:151
#define IDC_CHECK4
Definition: resource.h:83
#define IDS_MIZU
Definition: resource.h:171
#define IDD_THEMEPAGE
Definition: resource.h:89
#define IDB_LAUTUS
Definition: resource.h:24
#define IDS_WZD_PASSWORDEMPTY
Definition: resource.h:153
#define IDI_CHECKICON
Definition: resource.h:35
#define IDS_WZD_NAME
Definition: resource.h:150
#define IDD_COMPUTERPAGE
Definition: resource.h:52
#define IDC_ADMINPASSWORD1
Definition: resource.h:54
#define IDI_CROSSICON
Definition: resource.h:37
#define IDS_OWNERTITLE
Definition: resource.h:117
#define IDB_CLASSIC
Definition: resource.h:23
#define IDC_LAYOUTTEXT
Definition: resource.h:60
#define IDS_ACKSUBTITLE
Definition: resource.h:115
#define IDS_PRODUCTSUBTITLE
Definition: resource.h:174
#define IDS_PRODUCTSERVERINFO
Definition: resource.h:177
#define IDC_GPL_TEXT
Definition: resource.h:93
#define IDS_UNKNOWN_ERROR
Definition: resource.h:140
#define IDS_DATETIMETITLE
Definition: resource.h:128
#define IDS_ADMINISTRATOR_NAME
Definition: resource.h:147
#define IDC_CUSTOMLOCALE
Definition: resource.h:59
#define IDC_CUSTOMLAYOUT
Definition: resource.h:61
#define IDC_OWNERNAME
Definition: resource.h:49
NTSTATUS WINAPI SetAccountsDomainSid(PSID DomainSid, LPCWSTR DomainName)
Definition: security.c:28
#define RGB(r, g, b)
Definition: precomp.h:67
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
HINSTANCE hInst
Definition: dxdiag.c:13
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
#define FILEOP_DOIT
Definition: fileqsup.h:48
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
pKey DeleteObject()
GLdouble n
Definition: glext.h:7729
GLuint res
Definition: glext.h:9613
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
char TCHAR
Definition: tchar.h:1402
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define INF_STYLE_OLDNT
Definition: infsupp.h:39
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
void * UNKNOWN
Definition: ks.h:2676
#define REG_SZ
Definition: layer.c:22
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
__u16 time
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
static PLARGE_INTEGER Time
Definition: time.c:37
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
HICON hIcon
Definition: msconfig.c:44
HKL hkl
Definition: msctf.idl:632
UINT_PTR HKL
Definition: msctf.idl:125
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
unsigned int UINT
Definition: ndis.h:50
_In_ ULONG Domain
Definition: haltypes.h:1814
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
static HFONT CreateTitleFont(VOID)
Definition: wizard.c:1347
static INT_PTR CALLBACK WelcomeDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:469
static INT_PTR CALLBACK FinishDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1268
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1060
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define KEY_WRITE
Definition: nt_native.h:1034
#define DWORD
Definition: nt_native.h:44
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define KEY_SET_VALUE
Definition: nt_native.h:1020
#define UNICODE_NULL
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define PathCanonicalizeW
Definition: pathcch.h:314
#define PathAddBackslashW
Definition: pathcch.h:302
#define LOWORD(l)
Definition: pedump.c:82
#define WS_SYSMENU
Definition: pedump.c:629
short WCHAR
Definition: pedump.c:58
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_MODELESS
Definition: prsht.h:50
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSWIZB_NEXT
Definition: prsht.h:154
#define PSWIZB_FINISH
Definition: prsht.h:155
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSBTN_FINISH
Definition: prsht.h:148
#define PSWIZB_BACK
Definition: prsht.h:153
#define PSBTN_NEXT
Definition: prsht.h:147
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define PropertySheet
Definition: prsht.h:400
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PSN_WIZFINISH
Definition: prsht.h:122
#define PSN_WIZBACK
Definition: prsht.h:120
#define PSN_SETACTIVE
Definition: prsht.h:115
#define PROPSHEETPAGE
Definition: prsht.h:389
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define ListView_SetIconSpacing(hwndLV, cx, cy)
Definition: commctrl.h:2728
#define PBM_GETPOS
Definition: commctrl.h:2199
#define LVIF_STATE
Definition: commctrl.h:2317
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2309
#define CLR_NONE
Definition: commctrl.h:319
#define ListView_SetBkColor(hwnd, clrBk)
Definition: commctrl.h:2299
#define ILC_COLOR32
Definition: commctrl.h:358
#define DateTime_SetSystemtime(hdp, gd, pst)
Definition: commctrl.h:4337
#define PBM_SETPOS
Definition: commctrl.h:2189
#define PBM_SETRANGE
Definition: commctrl.h:2188
#define DTN_DATETIMECHANGE
Definition: commctrl.h:4371
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVITEM
Definition: commctrl.h:2380
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVIF_TEXT
Definition: commctrl.h:2314
#define ILC_MASK
Definition: commctrl.h:351
#define GDT_VALID
Definition: commctrl.h:4465
#define LVIF_IMAGE
Definition: commctrl.h:2315
#define ListView_SetTextBkColor(hwnd, clrTextBk)
Definition: commctrl.h:2668
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
#define DateTime_GetSystemtime(hdp, pst)
Definition: commctrl.h:4335
#define LVSIL_NORMAL
Definition: commctrl.h:2303
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define WM_NOTIFY
Definition: richedit.h:61
#define REG_DWORD
Definition: sdbapi.c:615
DWORD LCID
Definition: nls.h:13
wcscat
wcscpy
#define LoadStringW
Definition: utils.h:64
NTSTATUS NTAPI RtlCreateBootStatusDataFile(VOID)
Definition: bootdata.c:98
Entry
Definition: section.c:5216
#define SPREG_GETPROCADDR
Definition: setupapi.h:657
#define SPREG_REGSVR
Definition: setupapi.h:658
#define SetupDefaultQueueCallback
Definition: setupapi.h:2593
#define SPFILENOTIFY_STARTREGISTRATION
Definition: setupapi.h:573
#define SPINST_REGSVR
Definition: setupapi.h:597
#define SPREG_SUCCESS
Definition: setupapi.h:655
struct _SP_REGISTER_CONTROL_STATUSW * PSP_REGISTER_CONTROL_STATUSW
#define SPREG_TIMEOUT
Definition: setupapi.h:660
#define SPINST_REGISTRY
Definition: setupapi.h:593
#define SPFILENOTIFY_ENDREGISTRATION
Definition: setupapi.h:574
#define SPREG_DLLINSTALL
Definition: setupapi.h:659
#define SPREG_LOADLIBRARY
Definition: setupapi.h:656
#define STATUS_NOT_FOUND
Definition: shellext.h:72
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2158
#define CSIDL_RESOURCES
Definition: shlobj.h:2233
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
_In_ PVOID Context
Definition: storport.h:2269
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LPCWSTR PreviewBitmap
Definition: wizard.c:2036
UINT DisplayName
Definition: wizard.c:2037
LPCWSTR ThemeFile
Definition: wizard.c:2038
HWND hwndDlg
Definition: globals.h:31
DWORD ReportAsWorkstation
Definition: wizard.c:403
LPCWSTR ProductSuite
Definition: wizard.c:401
LPCWSTR ProductType
Definition: wizard.c:402
PVOID DefaultContext
Definition: wizard.c:35
PREGISTRATIONNOTIFY pNotify
Definition: wizard.c:36
ULONG Registered
Definition: wizard.c:34
ULONG DllCount
Definition: wizard.c:33
LPCWSTR CurrentItem
Definition: globals.h:38
BOOL DisableGeckoInst
Definition: syssetup.h:47
DWORD TimeZoneIndex
Definition: syssetup.h:52
struct _TIMEZONE_ENTRY * TimeZoneListHead
Definition: syssetup.h:50
HFONT hBoldFont
Definition: reactos.h:126
PRODUCT_OPTION ProductOption
Definition: syssetup.h:61
UINT uPostNetworkWizardPage
Definition: syssetup.h:59
HFONT hTitleFont
Definition: reactos.h:125
WCHAR OwnerName[51]
Definition: syssetup.h:42
struct _TIMEZONE_ENTRY * TimeZoneListTail
Definition: syssetup.h:51
UINT uFirstNetworkWizardPage
Definition: syssetup.h:58
HINF hSetupInf
Definition: syssetup.h:56
BOOL UnattendSetup
Definition: syssetup.h:46
WCHAR OwnerOrganization[51]
Definition: syssetup.h:43
DWORD DisableAutoDaylightTimeSet
Definition: syssetup.h:53
SYSTEMTIME SystemTime
Definition: syssetup.h:49
WORD wMilliseconds
Definition: minwinbase.h:263
WORD wSecond
Definition: minwinbase.h:262
WORD wMinute
Definition: minwinbase.h:261
WORD wDayOfWeek
Definition: minwinbase.h:258
Definition: timezone.c:16
REG_TZI_FORMAT TimezoneInfo
Definition: timezone.c:22
WCHAR StandardName[33]
Definition: timezone.c:20
WCHAR DaylightName[33]
Definition: timezone.c:21
struct _TIMEZONE_ENTRY * Prev
Definition: timezone.c:17
struct _TIMEZONE_ENTRY * Next
Definition: timezone.c:18
WCHAR Description[128]
Definition: timezone.c:19
ULONG Index
Definition: wizard.c:47
SYSTEMTIME DaylightDate
Definition: winbase.h:936
WCHAR DaylightName[32]
Definition: winbase.h:935
WCHAR StandardName[32]
Definition: winbase.h:932
SYSTEMTIME StandardDate
Definition: winbase.h:933
DWORD dmBitsPerPel
Definition: wingdi.h:2093
DWORD dmFields
Definition: wingdi.h:2068
DWORD dmPelsWidth
Definition: wingdi.h:2094
DWORD dmPelsHeight
Definition: wingdi.h:2095
DWORD dmDisplayFrequency
Definition: wingdi.h:2100
WORD dmSize
Definition: wingdi.h:2066
Definition: ftp_var.h:139
Definition: inflate.c:139
Definition: format.c:58
UINT code
Definition: winuser.h:3267
UINT uNewState
Definition: commctrl.h:3041
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
static COORD Position
Definition: mouse.c:34
static BOOL WriteOwnerSettings(WCHAR *OwnerName, WCHAR *OwnerOrganization)
Definition: wizard.c:763
static VOID RegisterComponents(PITEMSDATA pItemsData)
Definition: wizard.c:2326
static const WCHAR * s_ExplorerSoundEvents[][2]
Definition: wizard.c:444
static INT_PTR CALLBACK GplDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:122
static const PRODUCT_OPTION_DATA s_ProductOptionData[]
Definition: wizard.c:408
static BOOL DoWriteSoundEvents(HKEY hKey, LPCWSTR lpSubkey, LPCWSTR lpEventsArray[][2], DWORD dwSize)
Definition: wizard.c:451
struct _PRODUCT_OPTION_DATA PRODUCT_OPTION_DATA
static VOID ShowItemError(HWND hwndDlg, DWORD LastError)
Definition: wizard.c:2469
struct _REGISTRATIONDATA REGISTRATIONDATA
static BOOL GetInstallSourceWin32(OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
Definition: wizard.c:2808
static const WCHAR s_szRosVersion[]
Definition: wizard.c:393
static BOOL RunItemCompletionThread(_In_ HWND hwndDlg)
Definition: wizard.c:2436
static UINT CALLBACK RegistrationNotificationProc(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: wizard.c:2159
static VOID CreateTimeZoneList(PSETUPDATA SetupData)
Definition: wizard.c:1669
static VOID SetKeyboardLayoutName(HWND hwnd)
Definition: wizard.c:1238
static BOOL SetSystemLocalTime(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1848
static VOID WriteUserLocale(VOID)
Definition: wizard.c:1465
static BOOL DoWriteProductOption(PRODUCT_OPTION nOption)
Definition: wizard.c:534
static INT_PTR CALLBACK ComputerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1055
static BOOL PathIsEqual(IN LPCWSTR lpPath1, IN LPCWSTR lpPath2)
Definition: wizard.c:3140
static VOID UpdateLocalSystemTime(HWND hwnd, SYSTEMTIME LocalTime)
Definition: wizard.c:1863
static INT_PTR CALLBACK LocalePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1486
VOID EnableVisualTheme(_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
Definition: wizard.c:1382
static BOOL WriteDefaultLogonData(LPWSTR Domain)
Definition: wizard.c:985
static void GenerateComputerName(LPWSTR lpBuffer)
Definition: wizard.c:1037
static PTIMEZONE_ENTRY GetLargerTimeZoneEntry(PSETUPDATA SetupData, DWORD Index)
Definition: wizard.c:1571
static VOID SetUserLocaleName(HWND hwnd)
Definition: wizard.c:1221
static INT_PTR CALLBACK OwnerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:805
static BOOL WriteDateTimeSettings(HWND hwndDlg, PSETUPDATA SetupData)
Definition: wizard.c:1871
#define MAX_LAYOUTS_PER_LANGID
static INT_PTR CALLBACK DateTimePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1902
static HFONT CreateBoldFont(VOID)
Definition: wizard.c:101
static BOOL WriteComputerSettings(WCHAR *ComputerName, HWND hwndDlg)
Definition: wizard.c:914
VOID ProcessSetupInf(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:3257
static VOID ShowStepError(HWND hwndDlg, PREGISTRATIONNOTIFY RegistrationNotify)
Definition: wizard.c:2512
static const WCHAR s_szWinlogon[]
Definition: wizard.c:395
static VOID DestroyTimeZoneList(PSETUPDATA SetupData)
Definition: wizard.c:1675
static const WCHAR * s_DefaultSoundEvents[][2]
Definition: wizard.c:414
static BOOL GetLocalSystemTime(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1819
static LONG RetrieveTimeZone(IN HKEY hZoneKey, IN PVOID Context)
Definition: wizard.c:1588
static struct ThemeInfo Themes[]
DWORD(WINAPI * PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA)
Definition: wizard.c:3389
static PTIMEZONE_ENTRY GetSelectedTimeZoneEntry(PSETUPDATA SetupData, DWORD dwEntryIndex)
Definition: wizard.c:1706
static PTIMEZONE_ENTRY GetTimeZoneEntryByIndex(PSETUPDATA SetupData, DWORD dwComboIndex)
Definition: wizard.c:1720
void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
Definition: control.c:1177
struct _REGISTRATIONDATA * PREGISTRATIONDATA
static VOID SetLocalTimeZone(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1774
static INT_PTR CALLBACK ThemePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2048
static void OnChooseOption(HWND hwndDlg, PRODUCT_OPTION nOption)
Definition: wizard.c:646
static INT_PTR CALLBACK AckPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:286
static BOOL HasDaylightSavingTime(PTIMEZONE_ENTRY Entry)
Definition: wizard.c:1697
static DWORD CALLBACK ItemCompletionThread(LPVOID Parameter)
Definition: wizard.c:2400
static BOOL RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
Definition: wizard.c:1320
static VOID SetInstallationCompleted(VOID)
Definition: wizard.c:2669
static VOID AddInstallationSource(IN HKEY hKey, IN LPWSTR lpPath)
Definition: wizard.c:3166
struct _TIMEZONE_ENTRY * PTIMEZONE_ENTRY
static const WCHAR s_szExplorerSoundEvents[]
Definition: wizard.c:397
VOID ProcessUnattendSection(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:2865
VOID InstallWizard(VOID)
Definition: wizard.c:3392
static VOID UpdateAutoDaylightCheckbox(HWND hwndDlg, PTIMEZONE_ENTRY Entry)
Definition: wizard.c:1731
struct _TIMEZONE_ENTRY TIMEZONE_ENTRY
static const WCHAR s_szProductOptions[]
Definition: wizard.c:392
static const WCHAR s_szControlWindows[]
Definition: wizard.c:394
static VOID ShowTimeZoneList(HWND hwnd, PSETUPDATA SetupData, DWORD dwEntryIndex)
Definition: wizard.c:1744
static INT_PTR CALLBACK ProcessPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2550
static INT_PTR CALLBACK ProductPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:669
static const WCHAR s_szDefaultSoundEvents[]
Definition: wizard.c:396
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:98
enum _PRODUCT_OPTION PRODUCT_OPTION
@ PRODUCT_OPTION_WORKSTATION
Definition: syssetup.h:29
@ PRODUCT_OPTION_DEFAULT
Definition: syssetup.h:30
@ PRODUCT_OPTION_SERVER
Definition: syssetup.h:28
@ Password
Definition: telnetd.h:67
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
VOID EnumerateTimeZoneList(IN PENUM_TIMEZONE_CALLBACK Callback, IN PVOID Context OPTIONAL)
Definition: tzlib.c:223
LONG QueryTimeZoneData(IN HKEY hZoneKey, OUT PULONG Index OPTIONAL, OUT PREG_TZI_FORMAT TimeZoneInfo, OUT PWCHAR Description OPTIONAL, IN OUT PULONG DescriptionSize OPTIONAL, OUT PWCHAR StandardName OPTIONAL, IN OUT PULONG StandardNameSize OPTIONAL, OUT PWCHAR DaylightName OPTIONAL, IN OUT PULONG DaylightNameSize OPTIONAL)
Definition: tzlib.c:141
VOID SetAutoDaylight(IN BOOL EnableAutoDaylightTime)
Definition: tzlib.c:323
BOOL GetTimeZoneListIndex(IN OUT PULONG pIndex)
Definition: tzlib.c:20
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:186
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:56
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:82
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:45
struct _THEME_FILE THEME_FILE
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ ULONG MessageID
Definition: wdfinterrupt.h:92
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
Definition: display.c:408
LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode, DWORD dwflags)
Definition: display.c:612
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define DRIVE_CDROM
Definition: winbase.h:278
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:267
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define ListBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:472
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1272
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define DM_BITSPERPEL
Definition: wingdi.h:1268
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
@ GEO_FRIENDLYNAME
Definition: winnls.h:634
#define LOCALE_ILANGUAGE
Definition: winnls.h:30
#define LOCALE_SLANGUAGE
Definition: winnls.h:31
@ GEOCLASS_NATION
Definition: winnls.h:621
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegSetValueEx
Definition: winreg.h:565
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SW_HIDE
Definition: winuser.h:779
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
#define WM_CLOSE
Definition: winuser.h:1649
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define IMAGE_BITMAP
Definition: winuser.h:211
#define DWLP_USER
Definition: winuser.h:883
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2128
#define IDCANCEL
Definition: winuser.h:842
#define IsDialogMessage
Definition: winuser.h:5975
#define BST_UNCHECKED
Definition: winuser.h:199
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define GetDlgItemText
Definition: winuser.h:5951
#define LR_CREATEDIBSECTION
Definition: winuser.h:1109
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI SetForegroundWindow(_In_ HWND)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define CB_SETCURSEL
Definition: winuser.h:1990
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:893
#define QS_ALLINPUT
Definition: winuser.h:914
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_INITDIALOG
Definition: winuser.h:1767
#define CDS_UPDATEREGISTRY
Definition: winuser.h:181
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define WM_GETFONT
Definition: winuser.h:1679
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDI_WINLOGO
Definition: winuser.h:717
#define STM_SETIMAGE
Definition: winuser.h:2129
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define BM_SETCHECK
Definition: winuser.h:1950
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define MB_ICONERROR
Definition: winuser.h:798
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WM_SETTEXT
Definition: winuser.h:1645
#define GetMessage
Definition: winuser.h:5956
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
#define HWND_TOP
Definition: winuser.h:1218
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_SETFONT
Definition: winuser.h:1678
#define WM_TIMER
Definition: winuser.h:1770
#define PM_REMOVE
Definition: winuser.h:1207
#define CB_ADDSTRING
Definition: winuser.h:1965
#define LoadIcon
Definition: winuser.h:5979
struct tagNMHDR * LPNMHDR
#define SendMessage
Definition: winuser.h:6009
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2047
#define MB_OK
Definition: winuser.h:801
#define wsprintf
Definition: winuser.h:6031
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define MB_ICONWARNING
Definition: winuser.h:797
#define PostMessage
Definition: winuser.h:5998
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define BN_CLICKED
Definition: winuser.h:1954
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define DispatchMessage
Definition: winuser.h:5931
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define CB_GETCURSEL
Definition: winuser.h:1972
#define GWL_STYLE
Definition: winuser.h:863
#define SendDlgItemMessage
Definition: winuser.h:6008
BOOL WINAPI DestroyWindow(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
#define DialogBox
Definition: winuser.h:5927
#define BM_GETCHECK
Definition: winuser.h:1947
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336
unsigned char BYTE
Definition: xxhash.c:193