ReactOS 0.4.17-dev-470-gf9e3448
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 * Whindmar Saksit <whindsaks@proton.me>
12 */
13
14/* INCLUDES *****************************************************************/
15
16#include "precomp.h"
17
18#include <stdlib.h>
19#include <time.h>
20#include <winnls.h>
21#include <windowsx.h>
22#include <wincon.h>
23#include <shlobj.h>
24#include <shlwapi.h>
25#include <tzlib.h>
26#include <strsafe.h>
27
28#define NDEBUG
29#include <debug.h>
30
31typedef struct _REGISTRATIONDATA
32{
39
40typedef struct _TIMEZONE_ENTRY
41{
42 struct _TIMEZONE_ENTRY *Prev;
43 struct _TIMEZONE_ENTRY *Next;
44 WCHAR Description[128]; /* 'Display' */
45 WCHAR StandardName[32]; /* 'Std' */
46 WCHAR DaylightName[32]; /* 'Dlt' */
47 REG_TZI_FORMAT TimezoneInfo; /* 'TZI' */
50
51
52/* FUNCTIONS ****************************************************************/
53
55
56static VOID
58{
60 RECT rcParent;
61 RECT rcWindow;
62
64 if (hWndParent == NULL)
66
67 GetWindowRect(hWndParent, &rcParent);
68 GetWindowRect(hWnd, &rcWindow);
69
72 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
73 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
74 0,
75 0,
77}
78
79
80static HFONT
82{
83 LOGFONTW LogFont = {0};
84 HDC hdc;
85 HFONT hFont;
86
87 LogFont.lfWeight = FW_BOLD;
88 wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
89
90 hdc = GetDC(NULL);
91 LogFont.lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);
92
93 hFont = CreateFontIndirectW(&LogFont);
94
96
97 return hFont;
98}
99
100
101static HFONT
103{
104 LOGFONTW tmpFont = {0};
105 HFONT hBoldFont;
106 HDC hDc;
107
108 /* Grabs the Drawing Context */
109 hDc = GetDC(NULL);
110
111 tmpFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDc, LOGPIXELSY), 72);
112 tmpFont.lfWeight = FW_BOLD;
113 wcscpy(tmpFont.lfFaceName, L"MS Shell Dlg");
114
115 hBoldFont = CreateFontIndirectW(&tmpFont);
116
117 ReleaseDC(NULL, hDc);
118
119 return hBoldFont;
120}
121
122static INT_PTR CALLBACK
124 UINT uMsg,
127{
128 HRSRC GplTextResource;
129 HGLOBAL GplTextMem;
130 PVOID GplTextLocked;
131 PCHAR GplText;
132 DWORD Size;
133
134
135 switch (uMsg)
136 {
137 case WM_INITDIALOG:
138 GplTextResource = FindResourceW(hDllInstance, MAKEINTRESOURCE(IDR_GPL), L"RT_TEXT");
139 if (NULL == GplTextResource)
140 {
141 break;
142 }
143 Size = SizeofResource(hDllInstance, GplTextResource);
144 if (0 == Size)
145 {
146 break;
147 }
148 GplText = HeapAlloc(GetProcessHeap(), 0, Size + 1);
149 if (NULL == GplText)
150 {
151 break;
152 }
153 GplTextMem = LoadResource(hDllInstance, GplTextResource);
154 if (NULL == GplTextMem)
155 {
156 HeapFree(GetProcessHeap(), 0, GplText);
157 break;
158 }
159 GplTextLocked = LockResource(GplTextMem);
160 if (NULL == GplTextLocked)
161 {
162 HeapFree(GetProcessHeap(), 0, GplText);
163 break;
164 }
165 memcpy(GplText, GplTextLocked, Size);
166 GplText[Size] = '\0';
167 SendMessageA(GetDlgItem(hwndDlg, IDC_GPL_TEXT), WM_SETTEXT, 0, (LPARAM) GplText);
168 HeapFree(GetProcessHeap(), 0, GplText);
169 SetFocus(GetDlgItem(hwndDlg, IDOK));
170 return FALSE;
171
172 case WM_CLOSE:
173 EndDialog(hwndDlg, IDCANCEL);
174 break;
175
176 case WM_COMMAND:
177 if (HIWORD(wParam) == BN_CLICKED && IDOK == LOWORD(wParam))
178 {
179 EndDialog(hwndDlg, IDOK);
180 }
181 break;
182
183 default:
184 break;
185 }
186
187 return FALSE;
188}
189
190
191static INT_PTR CALLBACK
193 UINT uMsg,
196{
197 PSETUPDATA pSetupData;
198
199 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
200
201 switch (uMsg)
202 {
203 case WM_INITDIALOG:
204 {
205 HWND hwndControl;
206 DWORD dwStyle;
207
208 /* Get pointer to the global setup data */
209 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
210 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
211
212 hwndControl = GetParent(hwndDlg);
213
214 /* Center the wizard window */
215 CenterWindow(hwndControl);
216
217 /* Hide the system menu */
218 dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
219 SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
220
221 /* Hide and disable the 'Cancel' button */
222 hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
223 ShowWindow(hwndControl, SW_HIDE);
224 EnableWindow(hwndControl, FALSE);
225
226 /* Set title font */
227 SendDlgItemMessage(hwndDlg,
230 (WPARAM)pSetupData->hTitleFont,
231 (LPARAM)TRUE);
232 }
233 break;
234
235 case WM_NOTIFY:
236 {
237 LPNMHDR lpnm = (LPNMHDR)lParam;
238
239 switch (lpnm->code)
240 {
241 case PSN_SETACTIVE:
242 {
243 LogItem(L"BEGIN", L"WelcomePage");
244 /* Only "Next" for the first page and hide "Back" */
246 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
248 if (pSetupData->UnattendSetup)
249 {
251 return TRUE;
252 }
253 break;
254 }
255
256 case PSN_KILLACTIVE:
257 {
258 /* Show "Back" button */
259 // PropSheet_ShowWizButtons(GetParent(hwndDlg), PSWIZB_BACK, PSWIZB_BACK);
261 break;
262 }
263
264 case PSN_WIZNEXT:
265 LogItem(L"END", L"WelcomePage");
266 break;
267
268 case PSN_WIZBACK:
269 pSetupData->UnattendSetup = FALSE;
270 break;
271
272 default:
273 break;
274 }
275 }
276 break;
277
278 default:
279 break;
280 }
281
282 return FALSE;
283}
284
285
286static INT_PTR CALLBACK
288 UINT uMsg,
291{
292 LPNMHDR lpnm;
293 PWCHAR Projects;
294 PWCHAR End, CurrentProject;
295 INT ProjectsSize, ProjectsCount;
296 PSETUPDATA pSetupData;
297
298 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
299
300 switch (uMsg)
301 {
302 case WM_INITDIALOG:
303 {
304 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
305 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
306
307 Projects = NULL;
308 ProjectsSize = 256;
309 while (TRUE)
310 {
311 Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR));
312 if (NULL == Projects)
313 {
314 return FALSE;
315 }
316 ProjectsCount = LoadStringW(hDllInstance, IDS_ACKPROJECTS, Projects, ProjectsSize);
317 if (0 == ProjectsCount)
318 {
319 HeapFree(GetProcessHeap(), 0, Projects);
320 return FALSE;
321 }
322 if (ProjectsCount < ProjectsSize - 1)
323 {
324 break;
325 }
326 HeapFree(GetProcessHeap(), 0, Projects);
327 ProjectsSize *= 2;
328 }
329
330 CurrentProject = Projects;
331 while (*CurrentProject != L'\0')
332 {
333 End = wcschr(CurrentProject, L'\n');
334 if (NULL != End)
335 {
336 *End = L'\0';
337 }
338 (void)ListBox_AddString(GetDlgItem(hwndDlg, IDC_PROJECTS), CurrentProject);
339 if (NULL != End)
340 {
341 CurrentProject = End + 1;
342 }
343 else
344 {
345 CurrentProject += wcslen(CurrentProject);
346 }
347 }
348 HeapFree(GetProcessHeap(), 0, Projects);
349 }
350 break;
351
352 case WM_COMMAND:
354 {
357 }
358 break;
359
360 case WM_NOTIFY:
361 {
362 lpnm = (LPNMHDR)lParam;
363
364 switch (lpnm->code)
365 {
366 case PSN_SETACTIVE:
367 /* Enable the Back and Next buttons */
369 if (pSetupData->UnattendSetup)
370 {
372 return TRUE;
373 }
374 break;
375
376 case PSN_WIZBACK:
377 pSetupData->UnattendSetup = FALSE;
378 break;
379
380 default:
381 break;
382 }
383 }
384 break;
385
386 default:
387 break;
388 }
389
390 return FALSE;
391}
392
393static const WCHAR s_szProductOptions[] = L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions";
394static const WCHAR s_szRosVersion[] = L"SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version";
395static const WCHAR s_szControlWindows[] = L"SYSTEM\\CurrentControlSet\\Control\\Windows";
396static const WCHAR s_szWinlogon[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon";
397static const WCHAR s_szDefaultSoundEvents[] = L"AppEvents\\Schemes\\Apps\\.Default";
398static const WCHAR s_szExplorerSoundEvents[] = L"AppEvents\\Schemes\\Apps\\Explorer";
399static const WCHAR s_szCurrentVersion[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
400
402{
409
411{
412 { L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 },
413 { L"\0", L"WinNT", 1, 0x300, 1 },
414 { L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 }
415 // { L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 }
416};
417
419{
420 L"Server",
421 L"Client",
422 L"Server Core",
423 // L"Nano Server"
424};
425
426static const WCHAR* s_DefaultSoundEvents[][2] =
427{
428 { L".Default", L"%SystemRoot%\\Media\\ReactOS_Default.wav" },
429 { L"AppGPFault", L"" },
430 { L"Close", L"" },
431 { L"CriticalBatteryAlarm", L"%SystemRoot%\\Media\\ReactOS_Battery_Critical.wav" },
432 { L"DeviceConnect", L"%SystemRoot%\\Media\\ReactOS_Hardware_Insert.wav" },
433 { L"DeviceDisconnect", L"%SystemRoot%\\Media\\ReactOS_Hardware_Remove.wav" },
434 { L"DeviceFail", L"%SystemRoot%\\Media\\ReactOS_Hardware_Fail.wav" },
435 { L"LowBatteryAlarm", L"%SystemRoot%\\Media\\ReactOS_Battery_Low.wav" },
436 { L"MailBeep", L"%SystemRoot%\\Media\\ReactOS_Notify.wav" },
437 { L"Maximize", L"%SystemRoot%\\Media\\ReactOS_Restore.wav" },
438 { L"MenuCommand", L"%SystemRoot%\\Media\\ReactOS_Menu_Command.wav" },
439 { L"MenuPopup", L"" },
440 { L"Minimize", L"%SystemRoot%\\Media\\ReactOS_Minimize.wav" },
441 { L"Open", L"" },
442 { L"PrintComplete", L"%SystemRoot%\\Media\\ReactOS_Print_Complete.wav" },
443 { L"RestoreDown", L"" },
444 { L"RestoreUp", L"" },
445 { L"SystemAsterisk", L"%SystemRoot%\\Media\\ReactOS_Ding.wav" },
446 { L"SystemExclamation", L"%SystemRoot%\\Media\\ReactOS_Exclamation.wav" },
447 { L"SystemExit", L"%SystemRoot%\\Media\\ReactOS_Shutdown.wav" },
448 { L"SystemHand", L"%SystemRoot%\\Media\\ReactOS_Critical_Stop.wav" },
449 { L"SystemNotification", L"%SystemRoot%\\Media\\ReactOS_Balloon.wav" },
450 { L"SystemQuestion", L"%SystemRoot%\\Media\\ReactOS_Ding.wav" },
451 { L"SystemStart", L"%SystemRoot%\\Media\\ReactOS_Startup.wav" },
452 { L"WindowsLogoff", L"%SystemRoot%\\Media\\ReactOS_LogOff.wav" }
453/* Logon sound is already set by default for both Server and Workstation */
454};
455
456static const WCHAR* s_ExplorerSoundEvents[][2] =
457{
458 { L"EmptyRecycleBin", L"%SystemRoot%\\Media\\ReactOS_Recycle.wav" },
459 { L"Navigating", L"%SystemRoot%\\Media\\ReactOS_Start.wav" }
460};
461
462static BOOL
464 LPCWSTR lpSubkey,
465 LPCWSTR lpEventsArray[][2],
467{
468 HKEY hRootKey, hEventKey, hDefaultKey;
469 LONG error;
470 ULONG i;
471 WCHAR szDest[MAX_PATH];
472 DWORD dwAttribs;
474
475 /* Open the sound events key */
476 error = RegOpenKeyExW(hKey, lpSubkey, 0, KEY_READ, &hRootKey);
477 if (error)
478 {
479 DPRINT1("RegOpenKeyExW failed\n");
480 goto Error;
481 }
482
483 /* Set each sound event */
484 for (i = 0; i < dwSize; i++)
485 {
486 /*
487 * Verify that the sound file exists and is an actual file.
488 */
489
490 /* Expand the sound file path */
491 if (!ExpandEnvironmentStringsW(lpEventsArray[i][1], szDest, _countof(szDest)))
492 {
493 /* Failed to expand, continue with the next sound event */
494 continue;
495 }
496
497 /* Check if the sound file exists and isn't a directory */
498 dwAttribs = GetFileAttributesW(szDest);
499 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
500 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
501 {
502 /* It does not, just continue with the next sound event */
503 continue;
504 }
505
506 /*
507 * Create the sound event entry.
508 */
509
510 /* Open the sound event subkey */
511 error = RegOpenKeyExW(hRootKey, lpEventsArray[i][0], 0, KEY_READ, &hEventKey);
512 if (error)
513 {
514 /* Failed to open, continue with next sound event */
515 continue;
516 }
517
518 /* Open .Default subkey */
519 error = RegOpenKeyExW(hEventKey, L".Default", 0, KEY_WRITE, &hDefaultKey);
520 RegCloseKey(hEventKey);
521 if (error)
522 {
523 /* Failed to open, continue with next sound event */
524 continue;
525 }
526
527 /* Associate the sound file to this sound event */
528 cbData = (lstrlenW(lpEventsArray[i][1]) + 1) * sizeof(WCHAR);
529 error = RegSetValueExW(hDefaultKey, NULL, 0, REG_EXPAND_SZ, (const BYTE *)lpEventsArray[i][1], cbData);
530 RegCloseKey(hDefaultKey);
531 if (error)
532 {
533 /* Failed to set the value, continue with next sound event */
534 continue;
535 }
536 }
537
538Error:
539 if (hRootKey)
540 RegCloseKey(hRootKey);
541
542 return error == ERROR_SUCCESS;
543}
544
545static BOOL
547{
548 HKEY hKey;
549 LONG error;
550 LPCWSTR pszData;
551 DWORD dwValue, cbData;
553 ASSERT(0 <= nOption && nOption < INSTALLATION_TYPE_MAX);
554
555 /* open ProductOptions key */
557 if (error)
558 {
559 DPRINT1("RegOpenKeyExW failed\n");
560 goto Error;
561 }
562
563 /* write ProductSuite */
564 pszData = pData->ProductSuite;
565 cbData = (lstrlenW(pszData) + 2) * sizeof(WCHAR);
566 error = RegSetValueExW(hKey, L"ProductSuite", 0, REG_MULTI_SZ, (const BYTE *)pszData, cbData);
567 if (error)
568 {
569 DPRINT1("RegSetValueExW failed\n");
570 goto Error;
571 }
572
573 /* write ProductType */
574 pszData = pData->ProductType;
575 cbData = (lstrlenW(pszData) + 1) * sizeof(WCHAR);
576 error = RegSetValueExW(hKey, L"ProductType", 0, REG_SZ, (const BYTE *)pszData, cbData);
577 if (error)
578 {
579 DPRINT1("RegSetValueExW failed\n");
580 goto Error;
581 }
582
584
585 /* open ReactOS version key */
587 if (error)
588 {
589 DPRINT1("RegOpenKeyExW failed\n");
590 goto Error;
591 }
592
593 /* write ReportAsWorkstation */
594 dwValue = pData->ReportAsWorkstation;
595 cbData = sizeof(dwValue);
596 error = RegSetValueExW(hKey, L"ReportAsWorkstation", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
597 if (error)
598 {
599 DPRINT1("RegSetValueExW failed\n");
600 goto Error;
601 }
602
604
605 /* open Control Windows key */
607 if (error)
608 {
609 DPRINT1("RegOpenKeyExW failed\n");
610 goto Error;
611 }
612
613 /* write Control Windows CSDVersion */
614 dwValue = pData->CSDVersion;
615 cbData = sizeof(dwValue);
616 error = RegSetValueExW(hKey, L"CSDVersion", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
617 if (error)
618 {
619 DPRINT1("RegSetValueExW failed\n");
620 goto Error;
621 }
622
624
625 /* open Winlogon key */
627 if (error)
628 {
629 DPRINT1("RegOpenKeyExW failed\n");
630 goto Error;
631 }
632
633 /* write LogonType */
634 dwValue = pData->LogonType;
635 cbData = sizeof(dwValue);
636 error = RegSetValueExW(hKey, L"LogonType", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
637 if (error)
638 {
639 DPRINT1("RegSetValueExW failed\n");
640 goto Error;
641 }
642
643 if (nOption == INSTALLATION_TYPE_WORKSTATION)
644 {
645 /* Write system sound events values for Workstation */
648 }
649
650 if (nOption == INSTALLATION_TYPE_SERVER_CORE)
651 {
652 /* Set the shell to command prompt */
653 WCHAR szShell[] = L"cmd.exe";
654 cbData = sizeof(szShell);
655 error = RegSetValueExW(hKey, L"Shell", 0, REG_SZ, (const BYTE *)szShell, cbData);
656 if (error)
657 {
658 DPRINT1("RegSetValueExW failed\n");
659 goto Error;
660 }
661 }
662
663 /* Open InstallationType key and write InstallationType value */
665 if (error)
666 {
667 DPRINT1("RegOpenKeyExW failed\n");
668 goto Error;
669 }
670
671 cbData = (DWORD)((wcslen(InstallationTypes[nOption]) + 1) * sizeof(WCHAR));
672 error = RegSetValueExW(hKey, L"InstallationType", 0, REG_SZ, (const BYTE *)InstallationTypes[nOption], cbData);
673 if (error)
674 {
675 DPRINT1("RegSetValueExW failed\n");
676 goto Error;
677 }
678
679Error:
680 if (hKey)
682
683 return error == ERROR_SUCCESS;
684}
685
686static void
688{
689 WCHAR szText[256];
690 ASSERT(0 <= nOption && nOption < INSTALLATION_TYPE_MAX);
691
692 switch (nOption)
693 {
696 break;
697
700 break;
701
704 break;
705
706 // case INSTALLATION_TYPE_NANO_SERVER:
707 // LoadStringW(hDllInstance, IDS_INSTALLATIONSERVERINFO, szText, _countof(szText));
708 // break;
709
710 default:
711 return;
712 }
713
715}
716
717static INT_PTR CALLBACK
719{
720 LPNMHDR lpnm;
721 PSETUPDATA pSetupData;
722 INT iItem;
723 WCHAR szText[64], szDefault[64];
724 HICON hIcon;
725
726 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
727
728 switch (uMsg)
729 {
730 case WM_INITDIALOG:
731 {
732 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
733 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
734
735 LoadStringW(hDllInstance, IDS_DEFAULT, szDefault, _countof(szDefault));
736
739 {
740 StringCchCatW(szText, _countof(szText), L" ");
741 StringCchCatW(szText, _countof(szText), szDefault);
742 }
744
747 {
748 StringCchCatW(szText, _countof(szText), L" ");
749 StringCchCatW(szText, _countof(szText), szDefault);
750 }
752
755 {
756 StringCchCatW(szText, _countof(szText), L" ");
757 StringCchCatW(szText, _countof(szText), szDefault);
758 }
760
761#if 0
762 LoadStringW(hDllInstance, IDS_INSTALLATIONNANOSERVERNAME, szText, _countof(szText));
763 if (INSTALLATION_TYPE_DEFAULT == INSTALLATION_TYPE_NANO_SERVER)
764 {
765 StringCchCatW(szText, _countof(szText), L" ");
766 StringCchCatW(szText, _countof(szText), szDefault);
767 }
769#endif
770
773
776 return TRUE;
777 }
778
779 case WM_COMMAND:
781 {
784 }
785 break;
786
787 case WM_NOTIFY:
788 {
789 lpnm = (LPNMHDR)lParam;
790
791 switch (lpnm->code)
792 {
793 case PSN_SETACTIVE:
794 /* Enable the Back and Next buttons */
796 if (pSetupData->UnattendSetup)
797 {
798 OnChooseInstallationType(hwndDlg, pSetupData->InstallationType);
801 return TRUE;
802 }
803 break;
804
805 case PSN_WIZNEXT:
807 pSetupData->InstallationType = (INSTALLATION_TYPE)iItem;
809 break;
810
811 case PSN_WIZBACK:
812 pSetupData->UnattendSetup = FALSE;
813 break;
814
815 default:
816 break;
817 }
818 }
819 break;
820
821 default:
822 break;
823 }
824
825 return FALSE;
826}
827
828static
829BOOL
831 WCHAR * OwnerOrganization)
832{
833 HKEY hKey;
834 LONG res;
835
837 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
838 0,
840 &hKey);
841
842 if (res != ERROR_SUCCESS)
843 {
844 return FALSE;
845 }
846
848 L"RegisteredOwner",
849 0,
850 REG_SZ,
851 (LPBYTE)OwnerName,
852 (wcslen(OwnerName) + 1) * sizeof(WCHAR));
853
854 if (res != ERROR_SUCCESS)
855 {
857 return FALSE;
858 }
859
861 L"RegisteredOrganization",
862 0,
863 REG_SZ,
864 (LPBYTE)OwnerOrganization,
865 (wcslen(OwnerOrganization) + 1) * sizeof(WCHAR));
866
868 return (res == ERROR_SUCCESS);
869}
870
871static INT_PTR CALLBACK
873 UINT uMsg,
876{
877 WCHAR OwnerName[51];
878 WCHAR OwnerOrganization[51];
879 WCHAR Title[64];
880 WCHAR ErrorName[256];
881 LPNMHDR lpnm;
882 PSETUPDATA pSetupData;
883
884 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
885
886 switch (uMsg)
887 {
888 case WM_INITDIALOG:
889 {
890 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
891 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
892
893 /* set a localized ('Owner') placeholder string as default */
894 if (LoadStringW(hDllInstance, IDS_MACHINE_OWNER_NAME, OwnerName, _countof(OwnerName)))
895 {
896 SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, WM_SETTEXT, 0, (LPARAM)OwnerName);
897 }
898
901
902 /* Set focus to owner name */
904
905 /* Select the default text to quickly overwrite it by typing */
907 }
908 break;
909
910
911 case WM_NOTIFY:
912 {
913 lpnm = (LPNMHDR)lParam;
914
915 switch (lpnm->code)
916 {
917 case PSN_SETACTIVE:
918 /* Enable the Back and Next buttons */
920 if (pSetupData->UnattendSetup)
921 {
922 SendMessage(GetDlgItem(hwndDlg, IDC_OWNERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->OwnerName);
924 if (WriteOwnerSettings(pSetupData->OwnerName, pSetupData->OwnerOrganization))
925 {
927 return TRUE;
928 }
929 }
930 break;
931
932 case PSN_WIZNEXT:
933 OwnerName[0] = 0;
934 if (GetDlgItemTextW(hwndDlg, IDC_OWNERNAME, OwnerName, 50) == 0)
935 {
937 {
938 wcscpy(Title, L"ReactOS Setup");
939 }
940 if (0 == LoadStringW(hDllInstance, IDS_WZD_NAME, ErrorName, ARRAYSIZE(ErrorName)))
941 {
942 wcscpy(ErrorName, L"Setup cannot continue until you enter your name.");
943 }
944 MessageBoxW(hwndDlg, ErrorName, Title, MB_ICONERROR | MB_OK);
945
947 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
948
949 return TRUE;
950 }
951
952 OwnerOrganization[0] = 0;
953 GetDlgItemTextW(hwndDlg, IDC_OWNERORGANIZATION, OwnerOrganization, 50);
954
955 if (!WriteOwnerSettings(OwnerName, OwnerOrganization))
956 {
958 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
959 return TRUE;
960 }
961
962 case PSN_WIZBACK:
963 pSetupData->UnattendSetup = FALSE;
964 break;
965
966 default:
967 break;
968 }
969 }
970 break;
971
972 default:
973 break;
974 }
975
976 return FALSE;
977}
978
979static
980BOOL
981WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
982{
983 WCHAR Title[64];
984 WCHAR ErrorComputerName[256];
985 LONG lError;
986 HKEY hKey = NULL;
987
988 if (!SetComputerNameW(ComputerName))
989 {
990 if (hwndDlg != NULL)
991 {
993 {
994 wcscpy(Title, L"ReactOS Setup");
995 }
996 if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName,
997 ARRAYSIZE(ErrorComputerName)))
998 {
999 wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
1000 }
1001 MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
1002 }
1003
1004 return FALSE;
1005 }
1006
1007 /* Set the physical DNS domain */
1008 SetComputerNameExW(ComputerNamePhysicalDnsDomain, L"");
1009
1010 /* Set the physical DNS hostname */
1011 SetComputerNameExW(ComputerNamePhysicalDnsHostname, ComputerName);
1012
1013 /* Set the accounts domain name */
1014 SetAccountsDomainSid(NULL, ComputerName);
1015
1016 /* Now we need to set the Hostname */
1018 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
1019 0,
1020 NULL,
1022 KEY_WRITE,
1023 NULL,
1024 &hKey,
1025 NULL);
1026 if (lError == ERROR_SUCCESS)
1027 {
1028 lError = RegSetValueEx(hKey,
1029 L"Hostname",
1030 0,
1031 REG_SZ,
1032 (LPBYTE)ComputerName,
1033 (wcslen(ComputerName) + 1) * sizeof(WCHAR));
1034 if (lError != ERROR_SUCCESS)
1035 {
1036 DPRINT1("RegSetValueEx(\"Hostname\") failed (%08lX)\n", lError);
1037 }
1038
1040 }
1041 else
1042 {
1043 DPRINT1("RegCreateKeyExW for Tcpip\\Parameters failed (%08lX)\n", lError);
1044 }
1045
1046 return TRUE;
1047}
1048
1049
1050static
1051BOOL
1053{
1054 WCHAR szAdministratorName[256];
1055 HKEY hKey = NULL;
1056 LONG lError;
1057
1060 szAdministratorName,
1061 ARRAYSIZE(szAdministratorName)) == 0)
1062 {
1063 wcscpy(szAdministratorName, L"Administrator");
1064 }
1065
1067 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1068 0,
1070 &hKey);
1071 if (lError != ERROR_SUCCESS)
1072 return FALSE;
1073
1074 lError = RegSetValueEx(hKey,
1075 L"DefaultDomainName",
1076 0,
1077 REG_SZ,
1078 (LPBYTE)Domain,
1079 (wcslen(Domain)+ 1) * sizeof(WCHAR));
1080 if (lError != ERROR_SUCCESS)
1081 {
1082 DPRINT1("RegSetValueEx(\"DefaultDomainName\") failed!\n");
1083 }
1084
1085 lError = RegSetValueEx(hKey,
1086 L"DefaultUserName",
1087 0,
1088 REG_SZ,
1089 (LPBYTE)szAdministratorName,
1090 (wcslen(szAdministratorName)+ 1) * sizeof(WCHAR));
1091 if (lError != ERROR_SUCCESS)
1092 {
1093 DPRINT1("RegSetValueEx(\"DefaultUserName\") failed!\n");
1094 }
1095
1097
1098 return TRUE;
1099}
1100
1101
1102/* lpBuffer will be filled with a 15-char string (plus the null terminator) */
1103static void
1105{
1106 static const WCHAR Chars[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1107 static const unsigned cChars = sizeof(Chars) / sizeof(WCHAR) - 1;
1108 unsigned i;
1109
1110 wcscpy(lpBuffer, L"REACTOS-");
1111
1113
1114 /* fill in 7 characters */
1115 for (i = 8; i < 15; i++)
1116 lpBuffer[i] = Chars[rand() % cChars];
1117
1118 lpBuffer[15] = UNICODE_NULL; /* NULL-terminate */
1119}
1120
1121static INT_PTR CALLBACK
1123 UINT uMsg,
1124 WPARAM wParam,
1125 LPARAM lParam)
1126{
1127 WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
1128 WCHAR Password1[128];
1129 WCHAR Password2[128];
1131 WCHAR Title[64];
1132 WCHAR EmptyComputerName[256], NotMatchPassword[256], WrongPassword[256];
1133 LPNMHDR lpnm;
1134 PSETUPDATA pSetupData;
1135
1136 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
1137
1139 {
1140 wcscpy(Title, L"ReactOS Setup");
1141 }
1142
1143 switch (uMsg)
1144 {
1145 case WM_INITDIALOG:
1146 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1147 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
1148
1149 /* Generate a new pseudo-random computer name */
1150 GenerateComputerName(ComputerName);
1151
1152 /* Display current computer name */
1153 SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName);
1154
1155 /* Set text limits */
1159
1160 /* Set focus to computer name */
1162 if (pSetupData->UnattendSetup)
1163 {
1164 /* "*" means use random name (we have already generated it above) */
1165 if (pSetupData->ComputerName[0] == L'*' && !pSetupData->ComputerName[1])
1166 wcscpy(pSetupData->ComputerName, ComputerName);
1167 else
1168 SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, pSetupData->ComputerName);
1169 SetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, pSetupData->AdminPassword);
1170 SetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, pSetupData->AdminPassword);
1171 WriteComputerSettings(pSetupData->ComputerName, NULL);
1172 SetAdministratorPassword(pSetupData->AdminPassword);
1173 }
1174
1175 /* Store the administrator account name as the default user name */
1176 WriteDefaultLogonData(pSetupData->ComputerName);
1177 break;
1178
1179
1180 case WM_NOTIFY:
1181 {
1182 lpnm = (LPNMHDR)lParam;
1183
1184 switch (lpnm->code)
1185 {
1186 case PSN_SETACTIVE:
1187 /* Enable the Back and Next buttons */
1189 if (pSetupData->UnattendSetup && WriteComputerSettings(pSetupData->ComputerName, hwndDlg))
1190 {
1192 return TRUE;
1193 }
1194 break;
1195
1196 case PSN_WIZNEXT:
1197 if (0 == GetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName, MAX_COMPUTERNAME_LENGTH + 1))
1198 {
1199 if (0 == LoadStringW(hDllInstance, IDS_WZD_COMPUTERNAME, EmptyComputerName,
1200 ARRAYSIZE(EmptyComputerName)))
1201 {
1202 wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer.");
1203 }
1204 MessageBoxW(hwndDlg, EmptyComputerName, Title, MB_ICONERROR | MB_OK);
1206 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1207 return TRUE;
1208 }
1209
1210 /* No need to check computer name for invalid characters,
1211 * SetComputerName() will do it for us */
1212
1213 if (!WriteComputerSettings(ComputerName, hwndDlg))
1214 {
1216 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1217 return TRUE;
1218 }
1219
1220#ifdef PASSWORDS_MANDATORY
1221 /* Check if admin passwords have been entered */
1222 if ((GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128) == 0) ||
1223 (GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128) == 0))
1224 {
1225 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDEMPTY, EmptyPassword,
1226 ARRAYSIZE(EmptyPassword)))
1227 {
1228 wcscpy(EmptyPassword, L"You must enter a password !");
1229 }
1230 MessageBoxW(hwndDlg, EmptyPassword, Title, MB_ICONERROR | MB_OK);
1231 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1232 return TRUE;
1233 }
1234#else
1235 GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128);
1236 GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128);
1237#endif
1238 /* Check if passwords match */
1239 if (wcscmp(Password1, Password2))
1240 {
1241 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDMATCH, NotMatchPassword,
1242 ARRAYSIZE(NotMatchPassword)))
1243 {
1244 wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again.");
1245 }
1246 MessageBoxW(hwndDlg, NotMatchPassword, Title, MB_ICONERROR | MB_OK);
1247 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1248 return TRUE;
1249 }
1250
1251 /* Check password for invalid characters */
1252 Password = (PWCHAR)Password1;
1253 while (*Password)
1254 {
1255 if (!isprint(*Password))
1256 {
1257 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDCHAR, WrongPassword,
1258 ARRAYSIZE(WrongPassword)))
1259 {
1260 wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password.");
1261 }
1262 MessageBoxW(hwndDlg, WrongPassword, Title, MB_ICONERROR | MB_OK);
1263 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1264 return TRUE;
1265 }
1266 Password++;
1267 }
1268
1269 /* Set admin password */
1270 SetAdministratorPassword(Password1);
1271 break;
1272
1273 case PSN_WIZBACK:
1274 pSetupData->UnattendSetup = FALSE;
1275 break;
1276
1277 default:
1278 break;
1279 }
1280 }
1281 break;
1282
1283 default:
1284 break;
1285 }
1286
1287 return FALSE;
1288}
1289
1290
1291static VOID
1293{
1294 WCHAR CurLocale[256] = L"";
1295 WCHAR CurGeo[256] = L"";
1296 WCHAR ResText[256] = L"";
1297 WCHAR LocaleText[256 * 2];
1298
1301
1302 LoadStringW(hDllInstance, IDS_LOCALETEXT, ResText, ARRAYSIZE(ResText));
1303 StringCchPrintfW(LocaleText, ARRAYSIZE(LocaleText), ResText, CurLocale, CurGeo);
1304
1305 SetWindowTextW(hwnd, LocaleText);
1306}
1307
1308static VOID
1310{
1311 HKL hkl;
1312 BOOL LayoutSpecial = FALSE;
1313 WCHAR LayoutPath[256];
1314 WCHAR LocaleName[32];
1315 WCHAR SpecialId[5] = L"";
1316 WCHAR ResText[256] = L"";
1317 DWORD dwValueSize;
1318 HKEY hKey;
1319 UINT i;
1320
1321 /* Get the default input language and method */
1322 if (!SystemParametersInfoW(SPI_GETDEFAULTINPUTLANG, 0, (LPDWORD)&hkl, 0))
1323 {
1325 }
1326
1327 if ((HIWORD(hkl) & 0xF000) == 0xF000)
1328 {
1329 /* Process keyboard layout with special id */
1330 StringCchPrintfW(SpecialId, ARRAYSIZE(SpecialId), L"%04x", (HIWORD(hkl) & 0x0FFF));
1331 LayoutSpecial = TRUE;
1332 }
1333
1334#define MAX_LAYOUTS_PER_LANGID 0x10000
1335 for (i = 0; i < (LayoutSpecial ? MAX_LAYOUTS_PER_LANGID : 1); i++)
1336 {
1337 /* Generate a hexadecimal identifier for keyboard layout registry key */
1339
1340 StringCchCopyW(LayoutPath, ARRAYSIZE(LayoutPath), L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\");
1341 StringCchCatW(LayoutPath, ARRAYSIZE(LayoutPath), LocaleName);
1343
1345 LayoutPath,
1346 0,
1348 &hKey) == ERROR_SUCCESS)
1349 {
1350 /* Make sure the keyboard layout key we opened is the one we need.
1351 * If the layout has no special id, just pass this check. */
1352 dwValueSize = sizeof(LocaleName);
1353 if (!LayoutSpecial ||
1355 L"Layout Id",
1356 NULL,
1357 NULL,
1358 (PVOID)&LocaleName,
1359 &dwValueSize) == ERROR_SUCCESS) &&
1360 (wcscmp(LocaleName, SpecialId) == 0)))
1361 {
1363 dwValueSize = sizeof(LocaleName);
1365 L"Layout Text",
1366 NULL,
1367 NULL,
1368 (PVOID)&LocaleName,
1369 &dwValueSize);
1370 /* Let the loop know where to stop */
1372 }
1374 }
1375 else
1376 {
1377 /* Keyboard layout registry keys are expected to go in order without gaps */
1378 break;
1379 }
1380 }
1381#undef MAX_LAYOUTS_PER_LANGID
1382
1383 LoadStringW(hDllInstance, IDS_LAYOUTTEXT, ResText, ARRAYSIZE(ResText));
1384 StringCchPrintfW(LayoutPath, ARRAYSIZE(LayoutPath), ResText, LocaleName);
1385
1386 SetWindowTextW(hwnd, LayoutPath);
1387}
1388
1389
1390static BOOL
1392{
1393 MSG msg;
1394 HWND MainWindow = GetParent(hwnd);
1395 STARTUPINFOW StartupInfo;
1396 PROCESS_INFORMATION ProcessInformation;
1397 WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
1398
1399 if (!pwszCPLParameters)
1400 {
1401 MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
1402 return FALSE;
1403 }
1404
1405 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
1406 StartupInfo.cb = sizeof(StartupInfo);
1407 ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
1408
1409 ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters));
1410 wcscat(CmdLine, pwszCPLParameters);
1411
1412 if (!CreateProcessW(NULL,
1413 CmdLine,
1414 NULL,
1415 NULL,
1416 FALSE,
1417 0,
1418 NULL,
1419 NULL,
1420 &StartupInfo,
1421 &ProcessInformation))
1422 {
1423 MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
1424 return FALSE;
1425 }
1426
1427 /* Disable the Back and Next buttons and the main window
1428 * while we're interacting with the control panel applet */
1429 PropSheet_SetWizButtons(MainWindow, 0);
1430 EnableWindow(MainWindow, FALSE);
1431
1433 {
1434 /* We still need to process main window messages to avoid freeze */
1435 while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
1436 {
1439 }
1440 }
1441 CloseHandle(ProcessInformation.hThread);
1442 CloseHandle(ProcessInformation.hProcess);
1443
1444 /* Enable the Back and Next buttons and the main window again */
1446 EnableWindow(MainWindow, TRUE);
1447
1448 return TRUE;
1449}
1450
1451
1452VOID
1455 _In_opt_ PCWSTR ThemeFile)
1456{
1457 enum { THEME_FILE, STYLE_FILE, UNKNOWN } fType;
1458 WCHAR szPath[MAX_PATH]; // Expanded path of the file to use.
1459 WCHAR szStyleFile[MAX_PATH];
1460
1461 fType = THEME_FILE; // Default to Classic theme.
1462 if (ThemeFile)
1463 {
1464 /* Expand the path if possible */
1465 if (ExpandEnvironmentStringsW(ThemeFile, szPath, _countof(szPath)) != 0)
1466 ThemeFile = szPath;
1467
1468 /* Determine the file type from its extension */
1469 fType = UNKNOWN; {
1470 PCWSTR pszExt = wcsrchr(ThemeFile, L'.'); // PathFindExtensionW(ThemeFile);
1471 if (pszExt)
1472 {
1473 if (_wcsicmp(pszExt, L".theme") == 0)
1474 fType = THEME_FILE;
1475 else if (_wcsicmp(pszExt, L".msstyles") == 0)
1476 fType = STYLE_FILE;
1477 } }
1478 if (fType == UNKNOWN)
1479 {
1480 DPRINT1("EnableVisualTheme(): Unknown file '%S'\n", ThemeFile);
1481 return;
1482 }
1483 }
1484
1485 DPRINT1("Applying visual %s '%S'\n",
1486 (fType == THEME_FILE) ? "theme" : "style",
1487 ThemeFile ? ThemeFile : L"(Classic)");
1488
1489//
1490// TODO: Use instead uxtheme!SetSystemVisualStyle() once it is implemented,
1491// https://stackoverflow.com/a/1036903
1492// https://pinvoke.net/default.aspx/uxtheme.SetSystemVisualStyle
1493// or ApplyTheme(NULL, 0, NULL) for restoring the classic theme.
1494//
1495// NOTE: The '/Action:ActivateMSTheme' is ReactOS-specific.
1496//
1497
1498 if (ThemeFile && (fType == THEME_FILE))
1499 {
1500 /* Retrieve the visual style specified in the theme file.
1501 * If none, fall back to the classic theme. */
1502 if (GetPrivateProfileStringW(L"VisualStyles", L"Path", NULL,
1503 szStyleFile, _countof(szStyleFile), ThemeFile) && *szStyleFile)
1504 {
1505 /* Expand the path if possible */
1506 ThemeFile = szStyleFile;
1507 if (ExpandEnvironmentStringsW(ThemeFile, szPath, _countof(szPath)) != 0)
1508 ThemeFile = szPath;
1509 }
1510 else
1511 {
1512 ThemeFile = NULL;
1513 }
1514
1515 DPRINT1("--> Applying visual style '%S'\n",
1516 ThemeFile ? ThemeFile : L"(Classic)");
1517 }
1518
1519 if (ThemeFile)
1520 {
1521 WCHAR wszParams[1024];
1522 // FIXME: L"desk.cpl desk,@Appearance" regression, see commit 50d260a7f0
1523 PCWSTR format = L"desk.cpl,,2 /Action:ActivateMSTheme /file:\"%s\"";
1524
1525 StringCchPrintfW(wszParams, _countof(wszParams), format, ThemeFile);
1527 }
1528 else
1529 {
1530 RunControlPanelApplet(hwndParent, L"desk.cpl,,2 /Action:ActivateMSTheme");
1531 }
1532}
1533
1534
1535static VOID
1537{
1538 HKEY hKey;
1539 LCID lcid;
1540 WCHAR Locale[9] = L"0000";
1541
1543
1544 if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, &Locale[4], _countof(Locale) - 4) != 0)
1545 {
1546 if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International",
1549 {
1550 RegSetValueExW(hKey, L"Locale", 0, REG_SZ, (LPBYTE)Locale, (wcslen(Locale) + 1) * sizeof(WCHAR));
1552 }
1553 }
1554}
1555
1556static INT_PTR CALLBACK
1558 UINT uMsg,
1559 WPARAM wParam,
1560 LPARAM lParam)
1561{
1563
1564 /* Retrieve pointer to the global setup data */
1566
1567 switch (uMsg)
1568 {
1569 case WM_INITDIALOG:
1570 {
1571 /* Save pointer to the global setup data */
1575
1578 }
1579 break;
1580
1581 case WM_COMMAND:
1582 if (HIWORD(wParam) == BN_CLICKED)
1583 {
1584 switch (LOWORD(wParam))
1585 {
1586 case IDC_CUSTOMLOCALE:
1587 RunControlPanelApplet(hwndDlg, L"intl.cpl,,5");
1589 break;
1590
1591 case IDC_CUSTOMLAYOUT:
1592 RunControlPanelApplet(hwndDlg, L"input.dll,@1");
1594 break;
1595 }
1596 }
1597 break;
1598
1599 case WM_NOTIFY:
1600 {
1601 LPNMHDR lpnm = (LPNMHDR)lParam;
1602
1603 switch (lpnm->code)
1604 {
1605 case PSN_SETACTIVE:
1606 /* Enable the Back and Next buttons */
1609 {
1610 // if (!*SetupData->SourcePath)
1611 {
1612 RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"$winnt$.inf\""); // Should be in System32
1613 }
1614
1616 return TRUE;
1617 }
1618 break;
1619
1620 case PSN_WIZNEXT:
1621 break;
1622
1623 case PSN_WIZBACK:
1625 break;
1626
1627 default:
1628 break;
1629 }
1630 }
1631 break;
1632
1633 default:
1634 break;
1635 }
1636
1637 return FALSE;
1638}
1639
1640
1641static PTIMEZONE_ENTRY
1643{
1645
1647 while (Entry != NULL)
1648 {
1649 if (Entry->Index >= Index)
1650 return Entry;
1651
1652 Entry = Entry->Next;
1653 }
1654
1655 return NULL;
1656}
1657
1658static LONG
1660 IN HKEY hZoneKey,
1662{
1663 LONG lError;
1666 PTIMEZONE_ENTRY Current;
1667 ULONG DescriptionSize;
1668 ULONG StandardNameSize;
1669 ULONG DaylightNameSize;
1670
1672 if (Entry == NULL)
1673 {
1675 }
1676
1677 DescriptionSize = sizeof(Entry->Description);
1678 StandardNameSize = sizeof(Entry->StandardName);
1679 DaylightNameSize = sizeof(Entry->DaylightName);
1680
1681 lError = QueryTimeZoneData(hZoneKey,
1682 &Entry->Index,
1683 &Entry->TimezoneInfo,
1684 Entry->Description,
1685 &DescriptionSize,
1686 Entry->StandardName,
1687 &StandardNameSize,
1688 Entry->DaylightName,
1689 &DaylightNameSize);
1690 if (lError != ERROR_SUCCESS)
1691 {
1693 return lError;
1694 }
1695
1698 {
1699 Entry->Prev = NULL;
1700 Entry->Next = NULL;
1703 }
1704 else
1705 {
1706 Current = GetLargerTimeZoneEntry(SetupData, Entry->Index);
1707 if (Current != NULL)
1708 {
1709 if (Current == SetupData->TimeZoneListHead)
1710 {
1711 /* Prepend to head */
1712 Entry->Prev = NULL;
1716 }
1717 else
1718 {
1719 /* Insert before current */
1720 Entry->Prev = Current->Prev;
1721 Entry->Next = Current;
1722 Current->Prev->Next = Entry;
1723 Current->Prev = Entry;
1724 }
1725 }
1726 else
1727 {
1728 /* Append to tail */
1730 Entry->Next = NULL;
1733 }
1734 }
1735
1736 return ERROR_SUCCESS;
1737}
1738
1739static VOID
1741{
1743}
1744
1745static VOID
1747{
1749
1750 while (SetupData->TimeZoneListHead != NULL)
1751 {
1753
1756 {
1758 }
1759
1761 }
1762
1764}
1765
1766
1767static BOOL
1769{
1770 /* If StandardDate.wMonth and DaylightDate.wMonth are zero,
1771 * the timezone does not observe daylight saving time */
1772 return (Entry->TimezoneInfo.StandardDate.wMonth != 0 &&
1773 Entry->TimezoneInfo.DaylightDate.wMonth != 0);
1774}
1775
1776static PTIMEZONE_ENTRY
1778{
1780
1781 for (Entry = SetupData->TimeZoneListHead; Entry != NULL; Entry = Entry->Next)
1782 {
1783 if (Entry->Index == dwEntryIndex)
1784 return Entry;
1785 }
1786
1787 return NULL;
1788}
1789
1790static PTIMEZONE_ENTRY
1792{
1794 DWORD i;
1795
1796 for (Entry = SetupData->TimeZoneListHead, i = 0; Entry != NULL && i < dwComboIndex; i++, Entry = Entry->Next);
1797
1798 return Entry;
1799}
1800
1801static VOID
1803{
1804 BOOL bHasDST = (Entry != NULL && HasDaylightSavingTime(Entry));
1805
1806 /* Enable or disable the checkbox based on DST support */
1807 EnableDlgItem(hwndDlg, IDC_AUTODAYLIGHT, bHasDST);
1808
1809 /* Check the checkbox only if DST is supported, otherwise uncheck it */
1811 (WPARAM)(bHasDST ? BST_CHECKED : BST_UNCHECKED), 0);
1812}
1813
1814static VOID
1816{
1818 DWORD dwIndex = 0;
1819 DWORD dwCount;
1820
1821 GetTimeZoneListIndex(&dwEntryIndex);
1822
1824 while (Entry != NULL)
1825 {
1826 dwCount = SendMessage(hwnd,
1828 0,
1829 (LPARAM)Entry->Description);
1830
1831 if (dwEntryIndex != 0 && dwEntryIndex == Entry->Index)
1832 dwIndex = dwCount;
1833
1834 Entry = Entry->Next;
1835 }
1836
1839 (WPARAM)dwIndex,
1840 0);
1841}
1842
1843
1844static VOID
1846{
1847 TIME_ZONE_INFORMATION TimeZoneInformation;
1849 DWORD dwIndex;
1850 DWORD i;
1851
1852 dwIndex = SendMessage(hwnd,
1854 0,
1855 0);
1856
1857 i = 0;
1859 while (i < dwIndex)
1860 {
1861 if (Entry == NULL)
1862 return;
1863
1864 i++;
1865 Entry = Entry->Next;
1866 }
1867
1868 wcscpy(TimeZoneInformation.StandardName,
1869 Entry->StandardName);
1870 wcscpy(TimeZoneInformation.DaylightName,
1871 Entry->DaylightName);
1872
1873 TimeZoneInformation.Bias = Entry->TimezoneInfo.Bias;
1874 TimeZoneInformation.StandardBias = Entry->TimezoneInfo.StandardBias;
1875 TimeZoneInformation.DaylightBias = Entry->TimezoneInfo.DaylightBias;
1876
1877 memcpy(&TimeZoneInformation.StandardDate,
1878 &Entry->TimezoneInfo.StandardDate,
1879 sizeof(SYSTEMTIME));
1880 memcpy(&TimeZoneInformation.DaylightDate,
1881 &Entry->TimezoneInfo.DaylightDate,
1882 sizeof(SYSTEMTIME));
1883
1884 /* Set time zone information */
1885 SetTimeZoneInformation(&TimeZoneInformation);
1886}
1887
1888
1889static BOOL
1891{
1892 SYSTEMTIME Date;
1894
1896 {
1897 return FALSE;
1898 }
1899
1901 {
1902 return FALSE;
1903 }
1904
1908 SetupData->SystemTime.wDay = Date.wDay;
1909 SetupData->SystemTime.wHour = Time.wHour;
1910 SetupData->SystemTime.wMinute = Time.wMinute;
1911 SetupData->SystemTime.wSecond = Time.wSecond;
1912 SetupData->SystemTime.wMilliseconds = Time.wMilliseconds;
1913
1914 return TRUE;
1915}
1916
1917
1918static BOOL
1920{
1921 BOOL Ret = FALSE;
1922
1923 /*
1924 * Call SetLocalTime twice to ensure correct results
1925 */
1928
1929 return Ret;
1930}
1931
1932
1933static VOID
1935{
1938}
1939
1940
1941static BOOL
1943{
1944 WCHAR Title[64];
1945 WCHAR ErrorLocalTime[256];
1946
1947 GetLocalSystemTime(hwndDlg, SetupData);
1949 SetupData);
1950
1952 BM_GETCHECK, 0, 0) != BST_UNCHECKED);
1953 if (!SetSystemLocalTime(hwndDlg, SetupData))
1954 {
1956 {
1957 wcscpy(Title, L"ReactOS Setup");
1958 }
1959 if (0 == LoadStringW(hDllInstance, IDS_WZD_LOCALTIME, ErrorLocalTime,
1960 ARRAYSIZE(ErrorLocalTime)))
1961 {
1962 wcscpy(ErrorLocalTime, L"Setup was unable to set the local time.");
1963 }
1964 MessageBoxW(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK);
1965 return FALSE;
1966 }
1967
1968 return TRUE;
1969}
1970
1971
1972static INT_PTR CALLBACK
1974 UINT uMsg,
1975 WPARAM wParam,
1976 LPARAM lParam)
1977{
1979
1980 /* Retrieve pointer to the global setup data */
1982
1983 switch (uMsg)
1984 {
1985 case WM_INITDIALOG:
1986 {
1987 DWORD dwEntryIndex;
1989
1990 /* Save pointer to the global setup data */
1993
1995
1997 {
2000
2003 {
2006 }
2007 else
2008 {
2011 }
2012 }
2013 else
2014 {
2015 /* Get the default time zone index from the registry */
2016 dwEntryIndex = (DWORD)-1;
2017 GetTimeZoneListIndex(&dwEntryIndex);
2018
2020 SetupData, -1);
2021
2022 /* Set the auto-daylight checkbox based on whether
2023 * the selected timezone observes DST */
2024 Entry = GetSelectedTimeZoneEntry(SetupData, dwEntryIndex);
2026 }
2027 break;
2028 }
2029
2030 case WM_TIMER:
2031 {
2032 SYSTEMTIME LocalTime;
2033
2034 GetLocalTime(&LocalTime);
2035 UpdateLocalSystemTime(hwndDlg, LocalTime);
2036
2037 // Reset timeout.
2038 SetTimer(hwndDlg, 1, 1000 - LocalTime.wMilliseconds, NULL);
2039 break;
2040 }
2041
2042 case WM_COMMAND:
2044 {
2045 /* User changed the timezone selection */
2046 DWORD dwIndex = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TIMEZONELIST, CB_GETCURSEL, 0, 0);
2049 }
2050 break;
2051
2052 case WM_NOTIFY:
2053 switch (((LPNMHDR)lParam)->code)
2054 {
2055 case PSN_SETACTIVE:
2056 {
2057 SYSTEMTIME LocalTime;
2058
2059 GetLocalTime(&LocalTime);
2060 UpdateLocalSystemTime(hwndDlg, LocalTime);
2061
2062 /* Enable the Back and Next buttons */
2064
2066 {
2068 return TRUE;
2069 }
2070
2071 SetTimer(hwndDlg, 1, 1000 - LocalTime.wMilliseconds, NULL);
2072 break;
2073 }
2074
2075 case PSN_KILLACTIVE:
2076 case DTN_DATETIMECHANGE:
2077 // NB: Not re-set until changing page (PSN_SETACTIVE).
2078 KillTimer(hwndDlg, 1);
2079 break;
2080
2081 case PSN_WIZNEXT:
2083 break;
2084
2085 case PSN_WIZBACK:
2087 break;
2088
2089 default:
2090 break;
2091 }
2092 break;
2093
2094 case WM_DESTROY:
2096 break;
2097
2098 default:
2099 break;
2100 }
2101
2102 return FALSE;
2103}
2104
2105static struct ThemeInfo
2106{
2110
2111} Themes[] = {
2113 { MAKEINTRESOURCE(IDB_LAUTUS), IDS_LAUTUS, L"themes\\lautus\\lautus.msstyles" },
2114 { MAKEINTRESOURCE(IDB_LUNAR), IDS_LUNAR, L"themes\\lunar\\lunar.msstyles" },
2115 { MAKEINTRESOURCE(IDB_MIZU), IDS_MIZU, L"themes\\mizu\\mizu.msstyles"},
2117
2118static INT_PTR CALLBACK
2120 UINT uMsg,
2121 WPARAM wParam,
2122 LPARAM lParam)
2123{
2125 LPNMLISTVIEW pnmv;
2126
2127 /* Retrieve pointer to the global setup data */
2129
2130 switch (uMsg)
2131 {
2132 case WM_INITDIALOG:
2133 {
2134 HWND hListView;
2136 DWORD n;
2137 LVITEM lvi = {0};
2138
2139 /* Save pointer to the global setup data */
2142
2143 hListView = GetDlgItem(hwndDlg, IDC_THEMEPICKER);
2144
2145 /* Common */
2147 lvi.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE;
2148
2149 for (n = 0; n < ARRAYSIZE(Themes); ++n)
2150 {
2151 WCHAR DisplayName[100] = {0};
2152 /* Load the bitmap */
2154 ImageList_AddMasked(himl, image, RGB(255,0,255));
2155
2156 /* Load the string */
2157 LoadStringW(hDllInstance, Themes[n].DisplayName, DisplayName, ARRAYSIZE(DisplayName));
2158 DisplayName[ARRAYSIZE(DisplayName)-1] = UNICODE_NULL;
2159
2160 /* Add the listview item */
2161 lvi.iItem = n;
2162 lvi.iImage = n;
2163 lvi.pszText = DisplayName;
2164 ListView_InsertItem(hListView, &lvi);
2165 }
2166
2167 /* Register the imagelist */
2169 /* Transparent background */
2170 ListView_SetBkColor(hListView, CLR_NONE);
2172 /* Reduce the size between the items */
2173 ListView_SetIconSpacing(hListView, 190, 173);
2174 break;
2175 }
2176
2177 case WM_NOTIFY:
2178 switch (((LPNMHDR)lParam)->code)
2179 {
2180 //case LVN_ITEMCHANGING:
2181 case LVN_ITEMCHANGED:
2182 pnmv = (LPNMLISTVIEW)lParam;
2183 if ((pnmv->uChanged & LVIF_STATE) && (pnmv->uNewState & LVIS_SELECTED))
2184 {
2185 int iTheme = pnmv->iItem;
2186 DPRINT1("Selected theme: %u\n", Themes[iTheme].DisplayName);
2187
2188 if (Themes[iTheme].ThemeFile)
2189 {
2190 WCHAR wszTheme[MAX_PATH];
2191 SHGetFolderPathAndSubDirW(0, CSIDL_RESOURCES, NULL, SHGFP_TYPE_DEFAULT, Themes[iTheme].ThemeFile, wszTheme);
2192 EnableVisualTheme(hwndDlg, wszTheme);
2193 }
2194 else
2195 {
2196 EnableVisualTheme(hwndDlg, Themes[iTheme].ThemeFile);
2197 }
2198 }
2199 break;
2200 case PSN_SETACTIVE:
2201 /* Enable the Back and Next buttons */
2204 {
2206 return TRUE;
2207 }
2208 break;
2209
2210 case PSN_WIZNEXT:
2211 break;
2212
2213 case PSN_WIZBACK:
2215 break;
2216
2217 default:
2218 break;
2219 }
2220 break;
2221
2222 default:
2223 break;
2224 }
2225
2226 return FALSE;
2227}
2228
2229static UINT CALLBACK
2232 UINT_PTR Param1,
2233 UINT_PTR Param2)
2234{
2235 PREGISTRATIONDATA RegistrationData;
2238
2239 RegistrationData = (PREGISTRATIONDATA)Context;
2240
2243 {
2244 StatusInfo = (PSP_REGISTER_CONTROL_STATUSW) Param1;
2245 RegistrationData->pNotify->CurrentItem = wcsrchr(StatusInfo->FileName, L'\\');
2246 if (RegistrationData->pNotify->CurrentItem == NULL)
2247 {
2248 RegistrationData->pNotify->CurrentItem = StatusInfo->FileName;
2249 }
2250 else
2251 {
2252 RegistrationData->pNotify->CurrentItem++;
2253 }
2254
2256 {
2257 DPRINT("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n",
2258 StatusInfo->FileName);
2259 RegistrationData->pNotify->Progress = RegistrationData->Registered;
2260
2261 DPRINT("RegisterDll: Start step %ld\n", RegistrationData->pNotify->Progress);
2262 SendMessage(RegistrationData->hwndDlg, PM_STEP_START, 0, (LPARAM)RegistrationData->pNotify);
2263 }
2264 else
2265 {
2266 DPRINT("Received SPFILENOTIFY_ENDREGISTRATION notification for %S\n",
2267 StatusInfo->FileName);
2268 DPRINT("Win32Error %u FailureCode %u\n", StatusInfo->Win32Error,
2269 StatusInfo->FailureCode);
2270 if (StatusInfo->FailureCode != SPREG_SUCCESS)
2271 {
2272 switch (StatusInfo->FailureCode)
2273 {
2274 case SPREG_LOADLIBRARY:
2276 break;
2277 case SPREG_GETPROCADDR:
2279 break;
2280 case SPREG_REGSVR:
2282 break;
2283 case SPREG_DLLINSTALL:
2285 break;
2286 case SPREG_TIMEOUT:
2288 break;
2289 default:
2291 break;
2292 }
2293
2294 RegistrationData->pNotify->MessageID = MessageID;
2295 RegistrationData->pNotify->LastError = StatusInfo->Win32Error;
2296 }
2297 else
2298 {
2299 RegistrationData->pNotify->MessageID = 0;
2300 RegistrationData->pNotify->LastError = ERROR_SUCCESS;
2301 }
2302
2303 if (RegistrationData->Registered < RegistrationData->DllCount)
2304 {
2305 RegistrationData->Registered++;
2306 }
2307
2308 RegistrationData->pNotify->Progress = RegistrationData->Registered;
2309 DPRINT("RegisterDll: End step %ld\n", RegistrationData->pNotify->Progress);
2310 SendMessage(RegistrationData->hwndDlg, PM_STEP_END, 0, (LPARAM)RegistrationData->pNotify);
2311 }
2312
2313 return FILEOP_DOIT;
2314 }
2315 else
2316 {
2317 DPRINT1("Received unexpected notification %u\n", Notification);
2318 return SetupDefaultQueueCallback(RegistrationData->DefaultContext,
2319 Notification, Param1, Param2);
2320 }
2321}
2322
2323
2324static
2325DWORD
2327 _In_ PITEMSDATA pItemsData,
2328 _In_ PREGISTRATIONNOTIFY pNotify)
2329{
2330 REGISTRATIONDATA RegistrationData;
2331 WCHAR SectionName[512];
2333 LONG DllCount = 0;
2335
2336 ZeroMemory(&RegistrationData, sizeof(REGISTRATIONDATA));
2337 RegistrationData.hwndDlg = pItemsData->hwndDlg;
2338 RegistrationData.Registered = 0;
2339
2340 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2341 L"RegisterDlls", &Context))
2342 {
2343 DPRINT1("No RegistrationPhase2 section found\n");
2344 return GetLastError();
2345 }
2346
2347 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2348 ARRAYSIZE(SectionName),
2349 NULL))
2350 {
2351 DPRINT1("Unable to retrieve section name\n");
2352 return GetLastError();
2353 }
2354
2355 DllCount = SetupGetLineCountW(hSysSetupInf, SectionName);
2356 DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount);
2357 if (DllCount < 0)
2358 {
2359 return STATUS_NOT_FOUND;
2360 }
2361
2362 RegistrationData.DllCount = (ULONG)DllCount;
2363 RegistrationData.DefaultContext = SetupInitDefaultQueueCallback(RegistrationData.hwndDlg);
2364 RegistrationData.pNotify = pNotify;
2365
2366 _SEH2_TRY
2367 {
2368 if (!SetupInstallFromInfSectionW(GetParent(RegistrationData.hwndDlg),
2370 L"RegistrationPhase2",
2371 SPINST_REGISTRY | SPINST_REGISTERCALLBACKAWARE | SPINST_REGSVR,
2372 0,
2373 NULL,
2374 0,
2376 &RegistrationData,
2377 NULL,
2378 NULL))
2379 {
2380 Error = GetLastError();
2381 }
2382 }
2384 {
2385 DPRINT("Catching exception\n");
2387 }
2388 _SEH2_END;
2389
2391
2392 return Error;
2393}
2394
2395static
2396VOID
2398 PITEMSDATA pItemsData)
2399{
2400 WCHAR SectionName[512];
2402 LONG Steps = 0;
2405
2406 ZeroMemory(&Notify, sizeof(Notify));
2407
2408 /* Count the 'RegisterDlls' steps */
2409 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2410 L"RegisterDlls", &Context))
2411 {
2412 DPRINT1("No RegistrationPhase2 section found\n");
2413 return;
2414 }
2415
2416 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2417 ARRAYSIZE(SectionName),
2418 NULL))
2419 {
2420 DPRINT1("Unable to retrieve section name\n");
2421 return;
2422 }
2423
2424 Steps += SetupGetLineCountW(hSysSetupInf, SectionName);
2425
2426 /* Count the 'TypeLibratries' steps */
2427 Steps += SetupGetLineCountW(hSysSetupInf, L"TypeLibraries");
2428
2429 /* Start the item */
2430 DPRINT("Register Components: %ld Steps\n", Steps);
2431 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 0, (LPARAM)Steps);
2432
2433 Error = RegisterDlls(pItemsData, &Notify);
2434 if (Error == ERROR_SUCCESS)
2435 RegisterTypeLibraries(pItemsData, &Notify, hSysSetupInf, L"TypeLibraries");
2436
2437 /* End the item */
2438 DPRINT("Register Components: done\n");
2439 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 0, Error);
2440}
2441
2442static
2443VOID
2445 PITEMSDATA pItemsData)
2446{
2447 LONG Steps = 0;
2450
2451 ZeroMemory(&Notify, sizeof(Notify));
2452
2453 /* Count steps */
2454 Steps = CountSecuritySteps();
2455
2456 /* Start the item */
2457 DPRINT("Install security: %ld Steps\n", Steps);
2458 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 2, (LPARAM)Steps);
2459
2460 /* Install steps */
2461 Error = InstallSecurity(pItemsData, &Notify);
2462
2463 /* End the item */
2464 DPRINT("Install security: done\n");
2465 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 2, Error);
2466}
2467
2468static
2469DWORD
2473{
2474 PITEMSDATA pItemsData;
2475 HWND hwndDlg;
2476
2477 pItemsData = (PITEMSDATA)Parameter;
2478 hwndDlg = pItemsData->hwndDlg;
2479
2480 /* Step 0 - Registering components */
2481 RegisterComponents(pItemsData);
2482
2483 /* Step 1 - Installing start menu items */
2484 InstallStartMenuItems(pItemsData);
2485
2486 /* Step 2 - Saving Settings */
2487 SaveSettings(pItemsData);
2488
2489 /* Step 3 - Install optional components */
2490 InstallOptionalComponents(pItemsData);
2491
2492 /* Step 4 - Removing temporary files */
2493// RemoveTempFiles(pItemsData);
2494
2495 // FIXME: Move this call to a separate cleanup page!
2497
2498 /* Free the items data */
2499 HeapFree(GetProcessHeap(), 0, pItemsData);
2500
2501 /* Tell the wizard page that we are done */
2502 PostMessage(hwndDlg, PM_ITEMS_DONE, 0, 0);
2503
2504 return 0;
2505}
2506
2507
2508static
2509BOOL
2511 _In_ HWND hwndDlg)
2512{
2513 HANDLE hCompletionThread;
2514 PITEMSDATA pItemsData;
2515
2516 pItemsData = HeapAlloc(GetProcessHeap(), 0, sizeof(ITEMSDATA));
2517 if (pItemsData == NULL)
2518 return FALSE;
2519
2520 pItemsData->hwndDlg = hwndDlg;
2521
2522 hCompletionThread = CreateThread(NULL,
2523 0,
2525 pItemsData,
2526 0,
2527 NULL);
2528 if (hCompletionThread == NULL)
2529 {
2530 HeapFree(GetProcessHeap(), 0, pItemsData);
2531 }
2532 else
2533 {
2534 CloseHandle(hCompletionThread);
2535 return TRUE;
2536 }
2537
2538 return FALSE;
2539}
2540
2541static
2542VOID
2544 HWND hwndDlg,
2545 DWORD LastError)
2546{
2548 WCHAR UnknownError[84];
2549 WCHAR Title[64];
2550
2552 NULL, LastError, 0, ErrorMessage, 0, NULL) == 0)
2553 {
2555 UnknownError,
2556 ARRAYSIZE(UnknownError) - 20) == 0)
2557 {
2558 wcscpy(UnknownError, L"Unknown error");
2559 }
2560 wcscat(UnknownError, L" ");
2561 _ultow(LastError, UnknownError + wcslen(UnknownError), 10);
2562 ErrorMessage = UnknownError;
2563 }
2564
2565 if (ErrorMessage != NULL)
2566 {
2568 Title, ARRAYSIZE(Title)) == 0)
2569 {
2570 wcscpy(Title, L"ReactOS Setup");
2571 }
2572
2574 }
2575
2576 if (ErrorMessage != NULL &&
2577 ErrorMessage != UnknownError)
2578 {
2580 }
2581}
2582
2583
2584static
2585VOID
2587 HWND hwndDlg,
2588 PREGISTRATIONNOTIFY RegistrationNotify)
2589{
2590 WCHAR ErrorMessage[128];
2591 WCHAR Title[64];
2592
2593 if (LoadStringW(hDllInstance, RegistrationNotify->MessageID,
2595 ARRAYSIZE(ErrorMessage)) == 0)
2596 {
2597 ErrorMessage[0] = L'\0';
2598 }
2599
2600 if (RegistrationNotify->MessageID != IDS_TIMEOUT)
2601 {
2603 RegistrationNotify->LastError, 0,
2606 NULL);
2607 }
2608
2609 if (ErrorMessage[0] != L'\0')
2610 {
2612 Title, ARRAYSIZE(Title)) == 0)
2613 {
2614 wcscpy(Title, L"ReactOS Setup");
2615 }
2616
2617 MessageBoxW(hwndDlg, ErrorMessage,
2619 }
2620}
2621
2622
2623static INT_PTR CALLBACK
2625 UINT uMsg,
2626 WPARAM wParam,
2627 LPARAM lParam)
2628{
2630 PREGISTRATIONNOTIFY RegistrationNotify;
2631 static HICON s_hCheckIcon, s_hArrowIcon, s_hCrossIcon;
2632 static HFONT s_hNormalFont;
2633
2634 /* Retrieve pointer to the global setup data */
2636
2637 switch (uMsg)
2638 {
2639 case WM_INITDIALOG:
2640 {
2641 /* Save pointer to the global setup data */
2645 ShowDlgItem(hwndDlg, IDC_CHECK5, SW_HIDE);
2646 s_hCheckIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CHECKICON), IMAGE_ICON, 16, 16, 0);
2647 s_hArrowIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_ARROWICON), IMAGE_ICON, 16, 16, 0);
2648 s_hCrossIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CROSSICON), IMAGE_ICON, 16, 16, 0);
2649 s_hNormalFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1, WM_GETFONT, 0, 0);
2650 break;
2651 }
2652
2653 case WM_DESTROY:
2654 DestroyIcon(s_hCheckIcon);
2655 DestroyIcon(s_hArrowIcon);
2656 DestroyIcon(s_hCrossIcon);
2657 break;
2658
2659 case WM_NOTIFY:
2660 switch (((LPNMHDR)lParam)->code)
2661 {
2662 case PSN_SETACTIVE:
2663 {
2664 LogItem(L"BEGIN", L"ProcessPage");
2665
2666 /* Disable all buttons during installation; hide "Back" */
2668 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
2670
2671 RunItemCompletionThread(hwndDlg);
2672 break;
2673 }
2674
2675 case PSN_WIZNEXT:
2676 LogItem(L"END", L"ProcessPage");
2677 break;
2678
2679 case PSN_WIZBACK:
2681 break;
2682
2683 default:
2684 break;
2685 }
2686 break;
2687
2688 case PM_ITEM_START:
2689 DPRINT("PM_ITEM_START %lu\n", (ULONG)lParam);
2694 break;
2695
2696 case PM_ITEM_END:
2697 DPRINT("PM_ITEM_END\n");
2698 SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1 + wParam, WM_SETFONT, (WPARAM)s_hNormalFont, (LPARAM)TRUE);
2699 if (lParam == ERROR_SUCCESS)
2700 {
2702 }
2703 else
2704 {
2706 ShowItemError(hwndDlg, (DWORD)lParam);
2707 }
2708 break;
2709
2710 case PM_STEP_START:
2711 DPRINT("PM_STEP_START\n");
2712 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2714 (LPARAM)((RegistrationNotify->CurrentItem != NULL)? RegistrationNotify->CurrentItem : L""));
2715 break;
2716
2717 case PM_STEP_END:
2718 DPRINT("PM_STEP_END\n");
2719 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2720 SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS, RegistrationNotify->Progress, 0);
2721 if (RegistrationNotify->LastError != ERROR_SUCCESS)
2722 {
2723 ShowStepError(hwndDlg, RegistrationNotify);
2724 }
2725 break;
2726
2727 case PM_ITEMS_DONE:
2728 DPRINT("PM_ITEMS_DONE\n");
2729 /* Enable the Back and Next buttons */
2732 break;
2733
2734 default:
2735 break;
2736 }
2737
2738 return FALSE;
2739}
2740
2741
2742static VOID
2744{
2745 HKEY hKey = 0;
2746 DWORD InProgress = 0;
2747 DWORD InstallDate;
2748
2750 L"SYSTEM\\Setup",
2751 0,
2752 KEY_WRITE,
2753 &hKey ) == ERROR_SUCCESS)
2754 {
2755 RegSetValueExW( hKey, L"SystemSetupInProgress", 0, REG_DWORD, (LPBYTE)&InProgress, sizeof(InProgress) );
2756 RegCloseKey( hKey );
2757 }
2758
2760 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
2761 0,
2762 KEY_WRITE,
2763 &hKey ) == ERROR_SUCCESS)
2764 {
2765 InstallDate = (DWORD)time(NULL);
2766 RegSetValueExW( hKey, L"InstallDate", 0, REG_DWORD, (LPBYTE)&InstallDate, sizeof(InstallDate) );
2767 RegCloseKey( hKey );
2768 }
2769}
2770
2771static INT_PTR CALLBACK
2773 UINT uMsg,
2774 WPARAM wParam,
2775 LPARAM lParam)
2776{
2777 switch (uMsg)
2778 {
2779 case WM_INITDIALOG:
2780 {
2781 /* Get pointer to the global setup data */
2783
2784 /* Set title font */
2785 SendDlgItemMessage(hwndDlg,
2787 WM_SETFONT,
2789 (LPARAM)TRUE);
2791 {
2792 KillTimer(hwndDlg, 1);
2794 PostQuitMessage(0);
2795 }
2796
2797 /* Ensure that the installer wizard window is made visible and focused */
2798 ShowWindow(GetParent(hwndDlg), SW_SHOW);
2800 break;
2801 }
2802
2803 case WM_DESTROY:
2804 {
2806 PostQuitMessage(0);
2807 return TRUE;
2808 }
2809
2810 case WM_TIMER:
2811 {
2812 HWND hWndProgress;
2813 INT Position;
2814
2815 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
2816 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
2817 if (Position == 300)
2818 {
2819 KillTimer(hwndDlg, 1);
2821 }
2822 else
2823 {
2824 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
2825 }
2826 return TRUE;
2827 }
2828
2829 case WM_NOTIFY:
2830 {
2831 LPNMHDR lpnm = (LPNMHDR)lParam;
2832
2833 switch (lpnm->code)
2834 {
2835 case PSN_SETACTIVE:
2836 {
2837 HWND hWndParent = GetParent(hwndDlg);
2838
2839 /* Only "Finish" for closing the wizard, and hide "Back" and "Next" */
2841 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_CANCEL);
2844
2845 /* Set up the reboot progress bar and countdown timer.
2846 * 300 steps at 50 ms each: 15 seconds */
2849 SetTimer(hwndDlg, 1, 50, NULL);
2850 break;
2851 }
2852
2853 case PSN_WIZFINISH:
2854 DestroyWindow(GetParent(hwndDlg));
2855 break;
2856
2857 default:
2858 break;
2859 }
2860 break;
2861 }
2862
2863 default:
2864 break;
2865 }
2866
2867 return FALSE;
2868}
2869
2870
2871/*
2872 * GetInstallSourceWin32 retrieves the path to the ReactOS installation medium
2873 * in Win32 format, for later use by syssetup and storage in the registry.
2874 */
2875static BOOL
2877 OUT PWSTR pwszPath,
2878 IN DWORD cchPathMax,
2879 IN PCWSTR pwszNTPath)
2880{
2881 WCHAR wszDrives[512];
2882 WCHAR wszNTPath[512]; // MAX_PATH ?
2883 DWORD cchDrives;
2884 PWCHAR pwszDrive;
2885
2886 *pwszPath = UNICODE_NULL;
2887
2888 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2889 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2890 {
2891 /* Buffer too small or failure */
2892 LogItem(NULL, L"GetLogicalDriveStringsW failed");
2893 return FALSE;
2894 }
2895
2896 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2897 {
2898 WCHAR wszBuf[MAX_PATH];
2899
2900 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2901 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2902 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2903 pwszDrive[2] = L'\\'; // Restore the backslash
2904
2905 wcscat(wszNTPath, L"\\"); // Concat a backslash
2906
2907 /* Logging */
2908 wsprintf(wszBuf, L"Testing '%s' --> '%s' %s a CD",
2909 pwszDrive, wszNTPath,
2910 (GetDriveTypeW(pwszDrive) == DRIVE_CDROM) ? L"is" : L"is not");
2911 LogItem(NULL, wszBuf);
2912
2913 /* Check whether the NT path corresponds to the NT installation source path */
2914 if (!_wcsicmp(wszNTPath, pwszNTPath))
2915 {
2916 /* Found it! */
2917 wcscpy(pwszPath, pwszDrive); // cchPathMax
2918
2919 /* Logging */
2920 wsprintf(wszBuf, L"GetInstallSourceWin32: %s", pwszPath);
2921 LogItem(NULL, wszBuf);
2922 wcscat(wszBuf, L"\n");
2923 OutputDebugStringW(wszBuf);
2924
2925 return TRUE;
2926 }
2927 }
2928
2929 return FALSE;
2930}
2931
2932VOID
2934 IN OUT PSETUPDATA pSetupData)
2935{
2936 INFCONTEXT InfContext;
2937 WCHAR szName[256];
2938 WCHAR szValue[MAX_PATH];
2939 DWORD LineLength;
2940 HKEY hKey;
2941
2942 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2943 L"Unattend",
2944 L"UnattendSetupEnabled",
2945 &InfContext))
2946 {
2947 DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError());
2948 return;
2949 }
2950
2951 if (!SetupGetStringFieldW(&InfContext,
2952 1,
2953 szValue,
2954 ARRAYSIZE(szValue),
2955 &LineLength))
2956 {
2957 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2958 return;
2959 }
2960
2961 if (_wcsicmp(szValue, L"yes") != 0)
2962 {
2963 DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n");
2964 return;
2965 }
2966
2967 pSetupData->UnattendSetup = TRUE;
2968
2969 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2970 L"Unattend",
2971 NULL,
2972 &InfContext))
2973 {
2974 DPRINT1("Error: SetupFindFirstLine failed %d\n", GetLastError());
2975 return;
2976 }
2977
2978 do
2979 {
2980 if (!SetupGetStringFieldW(&InfContext,
2981 0,
2982 szName,
2984 &LineLength))
2985 {
2986 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2987 return;
2988 }
2989
2990 if (!SetupGetStringFieldW(&InfContext,
2991 1,
2992 szValue,
2993 ARRAYSIZE(szValue),
2994 &LineLength))
2995 {
2996 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2997 return;
2998 }
2999 DPRINT1("Name %S Value %S\n", szName, szValue);
3000 if (!_wcsicmp(szName, L"FullName"))
3001 {
3002 if (ARRAYSIZE(pSetupData->OwnerName) > LineLength)
3003 {
3004 wcscpy(pSetupData->OwnerName, szValue);
3005 }
3006 }
3007 else if (!_wcsicmp(szName, L"OrgName"))
3008 {
3009 if (ARRAYSIZE(pSetupData->OwnerOrganization) > LineLength)
3010 {
3011 wcscpy(pSetupData->OwnerOrganization, szValue);
3012 }
3013 }
3014 else if (!_wcsicmp(szName, L"ComputerName"))
3015 {
3016 if (ARRAYSIZE(pSetupData->ComputerName) > LineLength)
3017 {
3018 wcscpy(pSetupData->ComputerName, szValue);
3019 }
3020 }
3021 else if (!_wcsicmp(szName, L"AdminPassword"))
3022 {
3023 if (ARRAYSIZE(pSetupData->AdminPassword) > LineLength)
3024 {
3025 wcscpy(pSetupData->AdminPassword, szValue);
3026 }
3027 }
3028 else if (!_wcsicmp(szName, L"TimeZoneIndex"))
3029 {
3030 pSetupData->TimeZoneIndex = _wtoi(szValue);
3031 }
3032 else if (!_wcsicmp(szName, L"DisableAutoDaylightTimeSet"))
3033 {
3034 pSetupData->DisableAutoDaylightTimeSet = _wtoi(szValue);
3035 }
3036 else if (!_wcsicmp(szName, L"RappsDownload"))
3037 {
3038 if (!_wcsicmp(szValue, L"yes"))
3039 pSetupData->RappsDownload = TRUE;
3040 else
3041 pSetupData->RappsDownload = FALSE;
3042 }
3043 else if (!_wcsicmp(szName, L"InstallationType"))
3044 {
3045 pSetupData->InstallationType = (INSTALLATION_TYPE)_wtoi(szValue);
3046 }
3047 } while (SetupFindNextLine(&InfContext, &InfContext));
3048
3049 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3050 L"Display",
3051 NULL,
3052 &InfContext))
3053 {
3054 DEVMODEW dm = { { 0 } };
3055 dm.dmSize = sizeof(dm);
3057 {
3058 do
3059 {
3060 int iValue;
3061 if (!SetupGetStringFieldW(&InfContext,
3062 0,
3063 szName,
3065 &LineLength))
3066 {
3067 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3068 return;
3069 }
3070
3071 if (!SetupGetStringFieldW(&InfContext,
3072 1,
3073 szValue,
3074 ARRAYSIZE(szValue),
3075 &LineLength))
3076 {
3077 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3078 return;
3079 }
3080 iValue = _wtoi(szValue);
3081 DPRINT1("Name %S Value %i\n", szName, iValue);
3082
3083 if (!iValue)
3084 continue;
3085
3086 if (!_wcsicmp(szName, L"BitsPerPel"))
3087 {
3088 dm.dmFields |= DM_BITSPERPEL;
3089 dm.dmBitsPerPel = iValue;
3090 }
3091 else if (!_wcsicmp(szName, L"XResolution"))
3092 {
3093 dm.dmFields |= DM_PELSWIDTH;
3094 dm.dmPelsWidth = iValue;
3095 }
3096 else if (!_wcsicmp(szName, L"YResolution"))
3097 {
3098 dm.dmFields |= DM_PELSHEIGHT;
3099 dm.dmPelsHeight = iValue;
3100 }
3101 else if (!_wcsicmp(szName, L"VRefresh"))
3102 {
3104 dm.dmDisplayFrequency = iValue;
3105 }
3106 } while (SetupFindNextLine(&InfContext, &InfContext));
3107
3109 }
3110 }
3111
3113 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
3114 0,
3116 &hKey) != ERROR_SUCCESS)
3117 {
3118 DPRINT1("Error: failed to open HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n");
3119 return;
3120 }
3121
3122 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3123 L"GuiRunOnce",
3124 NULL,
3125 &InfContext))
3126 {
3127 int i = 0;
3128 do
3129 {
3130 if (SetupGetStringFieldW(&InfContext,
3131 0,
3132 szValue,
3133 ARRAYSIZE(szValue),
3134 NULL))
3135 {
3137 _swprintf(szName, L"%d", i);
3138 DPRINT("szName %S szValue %S\n", szName, szValue);
3139
3141 {
3142 DPRINT("value %S\n", szPath);
3143 if (RegSetValueExW(hKey,
3144 szName,
3145 0,
3146 REG_SZ,
3147 (const BYTE*)szPath,
3148 (wcslen(szPath) + 1) * sizeof(WCHAR)) == ERROR_SUCCESS)
3149 {
3150 i++;
3151 }
3152 }
3153 }
3154 } while (SetupFindNextLine(&InfContext, &InfContext));
3155 }
3156
3158
3159 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3160 L"Env",
3161 NULL,
3162 &InfContext))
3163 {
3164 if (RegCreateKeyExW(
3165 HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", 0, NULL,
3167 {
3168 DPRINT1("Error: failed to open HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\n");
3169 return;
3170 }
3171 do
3172 {
3173 if (!SetupGetStringFieldW(&InfContext,
3174 0,
3175 szName,
3177 &LineLength))
3178 {
3179 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3180 return;
3181 }
3182
3183 if (!SetupGetStringFieldW(&InfContext,
3184 1,
3185 szValue,
3186 ARRAYSIZE(szValue),
3187 &LineLength))
3188 {
3189 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3190 return;
3191 }
3192 DPRINT1("[ENV] %S=%S\n", szName, szValue);
3193
3194 DWORD dwType = wcschr(szValue, '%') != NULL ? REG_EXPAND_SZ : REG_SZ;
3195
3196 if (RegSetValueExW(hKey, szName, 0, dwType, (const BYTE*)szValue, (DWORD)(wcslen(szValue) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS)
3197 {
3198 DPRINT1(" - Error %d\n", GetLastError());
3199 }
3200
3201 } while (SetupFindNextLine(&InfContext, &InfContext));
3202
3204 }
3205}
3206
3207static BOOL
3209 IN LPCWSTR lpPath1,
3210 IN LPCWSTR lpPath2)
3211{
3212 WCHAR szPath1[MAX_PATH];
3213 WCHAR szPath2[MAX_PATH];
3214
3215 /* If something goes wrong, better return TRUE,
3216 * so the calling function returns early.
3217 */
3218 if (!PathCanonicalizeW(szPath1, lpPath1))
3219 return TRUE;
3220
3221 if (!PathAddBackslashW(szPath1))
3222 return TRUE;
3223
3224 if (!PathCanonicalizeW(szPath2, lpPath2))
3225 return TRUE;
3226
3227 if (!PathAddBackslashW(szPath2))
3228 return TRUE;
3229
3230 return (_wcsicmp(szPath1, szPath2) == 0);
3231}
3232
3233static VOID
3235 IN HKEY hKey,
3236 IN LPWSTR lpPath)
3237{
3238 LONG res;
3239 DWORD dwRegType;
3240 DWORD dwPathLength = 0;
3241 DWORD dwNewLength = 0;
3242 LPWSTR Buffer = NULL;
3243 LPWSTR Path;
3244
3246 hKey,
3247 L"Installation Sources",
3248 NULL,
3249 &dwRegType,
3250 NULL,
3251 &dwPathLength);
3252
3253 if (res != ERROR_SUCCESS ||
3254 dwRegType != REG_MULTI_SZ ||
3255 dwPathLength == 0 ||
3256 dwPathLength % sizeof(WCHAR) != 0)
3257 {
3258 dwPathLength = 0;
3259 goto set;
3260 }
3261
3262 /* Reserve space for existing data + new string */
3263 dwNewLength = dwPathLength + (wcslen(lpPath) + 1) * sizeof(WCHAR);
3264 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3265 if (!Buffer)
3266 return;
3267
3268 ZeroMemory(Buffer, dwNewLength);
3269
3271 hKey,
3272 L"Installation Sources",
3273 NULL,
3274 NULL,
3275 (LPBYTE)Buffer,
3276 &dwPathLength);
3277
3278 if (res != ERROR_SUCCESS)
3279 {
3281 dwPathLength = 0;
3282 goto set;
3283 }
3284
3285 /* Sanity check, these should already be zeros */
3286 Buffer[dwPathLength / sizeof(WCHAR) - 2] = UNICODE_NULL;
3287 Buffer[dwPathLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3288
3289 for (Path = Buffer; *Path; Path += wcslen(Path) + 1)
3290 {
3291 /* Check if path is already added */
3292 if (PathIsEqual(Path, lpPath))
3293 goto cleanup;
3294 }
3295
3296 Path = Buffer + dwPathLength / sizeof(WCHAR) - 1;
3297
3298set:
3299 if (dwPathLength == 0)
3300 {
3301 dwNewLength = (wcslen(lpPath) + 1 + 1) * sizeof(WCHAR);
3302 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3303 if (!Buffer)
3304 return;
3305
3306 Path = Buffer;
3307 }
3308
3309 StringCbCopyW(Path, dwNewLength - (Path - Buffer) * sizeof(WCHAR), lpPath);
3310 Buffer[dwNewLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3311
3313 hKey,
3314 L"Installation Sources",
3315 0,
3317 (LPBYTE)Buffer,
3318 dwNewLength);
3319
3320cleanup:
3322}
3323
3324VOID
3326 IN OUT PSETUPDATA pSetupData)
3327{
3329 WCHAR szValue[MAX_PATH];
3330 INFCONTEXT InfContext;
3331 DWORD LineLength;
3332 HKEY hKey;
3333 LONG res;
3334
3335 pSetupData->hSetupInf = INVALID_HANDLE_VALUE;
3336
3337 /* Retrieve the path of the setup INF */
3339 wcscat(szPath, L"\\$winnt$.inf");
3340
3341 /* Open the setup INF */
3342 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3343 NULL,
3345 NULL);
3346 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3347 {
3348 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3349 return;
3350 }
3351
3352
3353 /* Retrieve the NT source path from which the 1st-stage installer was run */
3354 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
3355 L"data",
3356 L"sourcepath",
3357 &InfContext))
3358 {
3359 DPRINT1("Error: Cannot find sourcepath Key! %d\n", GetLastError());
3360 return;
3361 }
3362
3363 if (!SetupGetStringFieldW(&InfContext,
3364 1,
3365 szValue,
3366 ARRAYSIZE(szValue),
3367 &LineLength))
3368 {
3369 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3370 return;
3371 }
3372
3373 *pSetupData->SourcePath = UNICODE_NULL;
3374
3375 /* Close the setup INF as we are going to modify it manually */
3376 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3377 SetupCloseInfFile(pSetupData->hSetupInf);
3378
3379
3380 /* Find the installation source path in Win32 format */
3381 if (!GetInstallSourceWin32(pSetupData->SourcePath,
3382 _countof(pSetupData->SourcePath),
3383 szValue))
3384 {
3385 *pSetupData->SourcePath = UNICODE_NULL;
3386 }
3387
3388 /* Save the path in Win32 format in the setup INF */
3389 _swprintf(szValue, L"\"%s\"", pSetupData->SourcePath);
3390 WritePrivateProfileStringW(L"data", L"dospath", szValue, szPath);
3391
3392 /*
3393 * Save it also in the registry, in the following keys:
3394 * - HKLM\Software\Microsoft\Windows\CurrentVersion\Setup ,
3395 * values "SourcePath" and "ServicePackSourcePath" (REG_SZ);
3396 * - HKLM\Software\Microsoft\Windows NT\CurrentVersion ,
3397 * value "SourcePath" (REG_SZ); set to the full path (e.g. D:\I386).
3398 */
3399#if 0
3401 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
3402 0,
3404 &hKey);
3405
3406 if (res != ERROR_SUCCESS)
3407 {
3408 return FALSE;
3409 }
3410#endif
3411
3413 L"Software\\Microsoft\\Windows\\CurrentVersion\\Setup",
3414 0, NULL,
3416 KEY_ALL_ACCESS, // KEY_WRITE
3417 NULL,
3418 &hKey,
3419 NULL);
3420 if (res == ERROR_SUCCESS)
3421 {
3422 AddInstallationSource(hKey, pSetupData->SourcePath);
3423
3425 L"SourcePath",
3426 0,
3427 REG_SZ,
3428 (LPBYTE)pSetupData->SourcePath,
3429 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3430
3432 L"ServicePackSourcePath",
3433 0,
3434 REG_SZ,
3435 (LPBYTE)pSetupData->SourcePath,
3436 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3437
3439 }
3440
3441
3442 /* Now, re-open the setup INF (this must succeed) */
3443 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3444 NULL,
3446 NULL);
3447 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3448 {
3449 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3450 return;
3451 }
3452
3453 /* Process the unattended section of the setup file */
3454 ProcessUnattendSection(pSetupData);
3455}
3456
3458
3459VOID
3461{
3462 PROPSHEETHEADER psh = {0};
3463 HPROPSHEETPAGE *phpage = NULL;
3464 PROPSHEETPAGE psp = {0};
3465 UINT nPages = 0;
3466 HWND hWnd;
3467 MSG msg;
3468 PSETUPDATA pSetupData = NULL;
3469 HMODULE hNetShell = NULL;
3471 DWORD dwPageCount = 10, dwNetworkPageCount = 0;
3472
3473 LogItem(L"BEGIN_SECTION", L"InstallWizard");
3474
3475 /* Allocate setup data */
3476 pSetupData = HeapAlloc(GetProcessHeap(),
3478 sizeof(SETUPDATA));
3479 if (pSetupData == NULL)
3480 {
3481 LogItem(NULL, L"SetupData allocation failed!");
3483 L"Setup failed to allocate global data!",
3484 L"ReactOS Setup",
3486 goto done;
3487 }
3489
3490 hNetShell = LoadLibraryW(L"netshell.dll");
3491 if (hNetShell != NULL)
3492 {
3493 DPRINT("Netshell.dll loaded!\n");
3494
3495 pfn = (PFNREQUESTWIZARDPAGES)GetProcAddress(hNetShell,
3496 "NetSetupRequestWizardPages");
3497 if (pfn != NULL)
3498 {
3499 pfn(&dwNetworkPageCount, NULL, NULL);
3500 dwPageCount += dwNetworkPageCount;
3501 }
3502 }
3503
3504 DPRINT("PageCount: %lu\n", dwPageCount);
3505
3506 phpage = HeapAlloc(GetProcessHeap(),
3508 dwPageCount * sizeof(HPROPSHEETPAGE));
3509 if (phpage == NULL)
3510 {
3511 LogItem(NULL, L"Page array allocation failed!");
3513 L"Setup failed to allocate page array!",
3514 L"ReactOS Setup",
3516 goto done;
3517 }
3518
3519 /* Process the $winnt$.inf setup file */
3520 ProcessSetupInf(pSetupData);
3521
3522 /* Create the Welcome page */
3523 psp.dwSize = sizeof(PROPSHEETPAGE);
3524 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3525 psp.hInstance = hDllInstance;
3526 psp.lParam = (LPARAM)pSetupData;
3527 psp.pfnDlgProc = WelcomeDlgProc;
3528 psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
3529 phpage[nPages++] = CreatePropertySheetPage(&psp);
3530
3531 /* Create the Acknowledgements page */
3532 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3533 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ACKTITLE);
3534 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE);
3535 psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE);
3536 psp.pfnDlgProc = AckPageDlgProc;
3537 phpage[nPages++] = CreatePropertySheetPage(&psp);
3538
3539 /* Create the Installation Type page */
3540 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3541 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALLATIONTITLE);
3542 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_INSTALLATIONSUBTITLE);
3543 psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLATION);
3544 psp.pfnDlgProc = InstallTypePageDlgProc;
3545 phpage[nPages++] = CreatePropertySheetPage(&psp);
3546
3547 /* Create the Locale page */
3548 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3549 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
3550 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
3551 psp.pfnDlgProc = LocalePageDlgProc;
3552 psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
3553 phpage[nPages++] = CreatePropertySheetPage(&psp);
3554
3555 /* Create the Owner page */
3556 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3557 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
3558 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
3559 psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
3560 psp.pfnDlgProc = OwnerPageDlgProc;
3561 phpage[nPages++] = CreatePropertySheetPage(&psp);
3562
3563 /* Create the Computer page */
3564 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3565 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
3566 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
3567 psp.pfnDlgProc = ComputerPageDlgProc;
3568 psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
3569 phpage[nPages++] = CreatePropertySheetPage(&psp);
3570
3571 /* Create the DateTime page */
3572 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3573 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
3574 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
3575 psp.pfnDlgProc = DateTimePageDlgProc;
3576 psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
3577 phpage[nPages++] = CreatePropertySheetPage(&psp);
3578
3579 /* Create the theme selection page */
3580 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3581 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONTITLE);
3582 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONSUBTITLE);
3583 psp.pfnDlgProc = ThemePageDlgProc;
3584 psp.pszTemplate = MAKEINTRESOURCE(IDD_THEMEPAGE);
3585 phpage[nPages++] = CreatePropertySheetPage(&psp);
3586
3589
3590 if (pfn)
3591 {
3592 pfn(&dwNetworkPageCount, &phpage[nPages], pSetupData);
3593 nPages += dwNetworkPageCount;
3594 }
3595
3596 /* Create the Process page */
3597 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3598 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
3599 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
3600 psp.pfnDlgProc = ProcessPageDlgProc;
3601 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
3602 phpage[nPages++] = CreatePropertySheetPage(&psp);
3603
3604 /* Create the Finish page */
3605 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3606 psp.pfnDlgProc = FinishDlgProc;
3607 psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
3608 phpage[nPages++] = CreatePropertySheetPage(&psp);
3609
3610 ASSERT(nPages == dwPageCount);
3611
3612 /* Create the property sheet */
3613 psh.dwSize = sizeof(PROPSHEETHEADER);
3614 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_MODELESS;
3615 psh.hInstance = hDllInstance;
3616 psh.hwndParent = NULL;
3617 psh.nPages = nPages;
3618 psh.nStartPage = 0;
3619 psh.phpage = phpage;
3620 psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
3621 psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
3622
3623 /* Create title font */
3624 pSetupData->hTitleFont = CreateTitleFont();
3625 pSetupData->hBoldFont = CreateBoldFont();
3626
3627 /* Display the wizard */
3628 hWnd = (HWND)PropertySheet(&psh);
3630
3631 while (GetMessage(&msg, NULL, 0, 0))
3632 {
3633 if (!IsDialogMessage(hWnd, &msg))
3634 {
3637 }
3638 }
3639
3640 DeleteObject(pSetupData->hBoldFont);
3641 DeleteObject(pSetupData->hTitleFont);
3642
3643 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3644 SetupCloseInfFile(pSetupData->hSetupInf);
3645
3646done:
3647 if (phpage != NULL)
3648 HeapFree(GetProcessHeap(), 0, phpage);
3649
3650 if (hNetShell != NULL)
3651 FreeLibrary(hNetShell);
3652
3653 if (pSetupData != NULL)
3654 HeapFree(GetProcessHeap(), 0, pSetupData);
3655
3656 LogItem(L"END_SECTION", L"InstallWizard");
3657}
3658
3659/* 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:299
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
static CHAR Title[MAX_PATH]
Definition: dem.c:257
#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
#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
#define IDS_UNKNOWN_ERROR
Definition: resource.h:91
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:492
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:4441
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:5660
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
_ACRTIMP wchar_t *__cdecl _ultow(__msvcrt_ulong, wchar_t *, int)
Definition: string.c:2204
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2778
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_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:137
#define IDC_OWNERORGANIZATION
Definition: resource.h:50
#define IDS_INSTALLATIONSERVERINFO
Definition: resource.h:179
#define IDC_CHECK5
Definition: resource.h:86
#define IDS_INSTALLATIONSUBTITLE
Definition: resource.h:177
#define IDC_INSTALLATION_ICON
Definition: resource.h:113
#define IDS_LOCALESUBTITLE
Definition: resource.h:127
#define IDD_ACKPAGE
Definition: resource.h:44
#define IDR_GPL
Definition: resource.h:188
#define IDS_INSTALLATIONWORKSTATIONNAME
Definition: resource.h:180
#define IDC_VIEWGPL
Definition: resource.h:46
#define IDS_ACKTITLE
Definition: resource.h:117
#define IDC_INSTALLATION_TYPES
Definition: resource.h:114
#define IDC_ADMINPASSWORD2
Definition: resource.h:55
#define IDS_LAUTUS
Definition: resource.h:172
#define IDS_DEFAULT
Definition: resource.h:186
#define IDS_DLLINSTALL_FAILED
Definition: resource.h:147
#define IDS_REGSVR_FAILED
Definition: resource.h:146
#define IDS_WZD_COMPUTERNAME
Definition: resource.h:155
#define IDD_OWNERPAGE
Definition: resource.h:48
#define IDC_INSTALLATION_DESCRIPTION
Definition: resource.h:115
#define IDS_LOADLIBRARY_FAILED
Definition: resource.h:144
#define IDB_LUNAR
Definition: resource.h:25
#define IDS_OWNERSUBTITLE
Definition: resource.h:121
#define IDS_GETPROCADDR_FAILED
Definition: resource.h:145
#define IDS_WZD_PASSWORDMATCH
Definition: resource.h:157
#define IDB_MIZU
Definition: resource.h:26
#define IDD_INSTALLATION
Definition: resource.h:112
#define IDD_GPL
Definition: resource.h:95
#define IDS_COMPUTERSUBTITLE
Definition: resource.h:124
#define IDS_LAYOUTTEXT
Definition: resource.h:129
#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_INSTALLATIONTITLE
Definition: resource.h:176
#define IDS_CLASSIC
Definition: resource.h:171
#define IDC_TASKTEXT5
Definition: resource.h:76
#define IDS_LUNAR
Definition: resource.h:173
#define IDS_WZD_PASSWORDCHAR
Definition: resource.h:158
#define IDS_DATETIMESUBTITLE
Definition: resource.h:132
#define IDI_ARROWICON
Definition: resource.h:36
#define IDS_LOCALETITLE
Definition: resource.h:126
#define IDS_THEMESELECTIONSUBTITLE
Definition: resource.h:138
#define IDS_REASON_UNKNOWN
Definition: resource.h:149
#define IDS_LOCALETEXT
Definition: resource.h:128
#define IDC_THEMEPICKER
Definition: resource.h:93
#define IDS_INSTALLATIONSERVERNAME
Definition: resource.h:178
#define IDS_COMPUTERTITLE
Definition: resource.h:123
#define IDS_WZD_LOCALTIME
Definition: resource.h:159
#define IDS_ACKPROJECTS
Definition: resource.h:140
#define IDS_MACHINE_OWNER_NAME
Definition: resource.h:151
#define IDS_WZD_SETCOMPUTERNAME
Definition: resource.h:154
#define IDS_MIZU
Definition: resource.h:174
#define IDD_THEMEPAGE
Definition: resource.h:92
#define IDB_LAUTUS
Definition: resource.h:24
#define IDS_WZD_PASSWORDEMPTY
Definition: resource.h:156
#define IDS_INSTALLATIONSERVERCORENAME
Definition: resource.h:182
#define IDI_CHECKICON
Definition: resource.h:35
#define IDS_WZD_NAME
Definition: resource.h:153
#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:120
#define IDB_CLASSIC
Definition: resource.h:23
#define IDC_LAYOUTTEXT
Definition: resource.h:60
#define IDS_ACKSUBTITLE
Definition: resource.h:118
#define IDS_INSTALLATIONWORKSTATIONINFO
Definition: resource.h:181
#define IDC_GPL_TEXT
Definition: resource.h:96
#define IDS_DATETIMETITLE
Definition: resource.h:131
#define IDS_ADMINISTRATOR_NAME
Definition: resource.h:150
#define IDS_INSTALLATIONSERVERCOREINFO
Definition: resource.h:183
#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
unsigned int UINT
Definition: sysinfo.c:13
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
_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:2167
#define CSIDL_RESOURCES
Definition: shlobj.h:2242
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:2107
UINT DisplayName
Definition: wizard.c:2108
LPCWSTR ThemeFile
Definition: wizard.c:2109
HWND hwndDlg
Definition: globals.h:31
DWORD ReportAsWorkstation
Definition: wizard.c:405
LPCWSTR ProductSuite
Definition: wizard.c:403
LPCWSTR ProductType
Definition: wizard.c:404
PVOID DefaultContext
Definition: wizard.c:36
PREGISTRATIONNOTIFY pNotify
Definition: wizard.c:37
ULONG Registered
Definition: wizard.c:35
ULONG DllCount
Definition: wizard.c:34
LPCWSTR CurrentItem
Definition: globals.h:38
DWORD TimeZoneIndex
Definition: syssetup.h:56
INSTALLATION_TYPE InstallationType
Definition: syssetup.h:65
struct _TIMEZONE_ENTRY * TimeZoneListHead
Definition: syssetup.h:54
HFONT hBoldFont
Definition: reactos.h:126
UINT uPostNetworkWizardPage
Definition: syssetup.h:63
HFONT hTitleFont
Definition: reactos.h:125
WCHAR OwnerName[51]
Definition: syssetup.h:46
struct _TIMEZONE_ENTRY * TimeZoneListTail
Definition: syssetup.h:55
UINT uFirstNetworkWizardPage
Definition: syssetup.h:62
HINF hSetupInf
Definition: syssetup.h:60
BOOL UnattendSetup
Definition: syssetup.h:50
WCHAR OwnerOrganization[51]
Definition: syssetup.h:47
DWORD DisableAutoDaylightTimeSet
Definition: syssetup.h:57
SYSTEMTIME SystemTime
Definition: syssetup.h:53
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:48
SYSTEMTIME DaylightDate
Definition: timezoneapi.h:30
SYSTEMTIME StandardDate
Definition: timezoneapi.h:27
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:830
static VOID RegisterComponents(PITEMSDATA pItemsData)
Definition: wizard.c:2397
static const WCHAR * s_ExplorerSoundEvents[][2]
Definition: wizard.c:456
static INT_PTR CALLBACK GplDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:123
static BOOL DoWriteSoundEvents(HKEY hKey, LPCWSTR lpSubkey, LPCWSTR lpEventsArray[][2], DWORD dwSize)
Definition: wizard.c:463
struct _PRODUCT_OPTION_DATA PRODUCT_OPTION_DATA
static VOID ShowItemError(HWND hwndDlg, DWORD LastError)
Definition: wizard.c:2543
struct _REGISTRATIONDATA REGISTRATIONDATA
static BOOL GetInstallSourceWin32(OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
Definition: wizard.c:2876
static const WCHAR s_szRosVersion[]
Definition: wizard.c:394
static BOOL RunItemCompletionThread(_In_ HWND hwndDlg)
Definition: wizard.c:2510
static UINT CALLBACK RegistrationNotificationProc(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: wizard.c:2230
static VOID CreateTimeZoneList(PSETUPDATA SetupData)
Definition: wizard.c:1740
static VOID SetKeyboardLayoutName(HWND hwnd)
Definition: wizard.c:1309
static BOOL SetSystemLocalTime(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1919
static VOID WriteUserLocale(VOID)
Definition: wizard.c:1536
static INT_PTR CALLBACK ComputerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1122
static BOOL PathIsEqual(IN LPCWSTR lpPath1, IN LPCWSTR lpPath2)
Definition: wizard.c:3208
static VOID UpdateLocalSystemTime(HWND hwnd, SYSTEMTIME LocalTime)
Definition: wizard.c:1934
static INT_PTR CALLBACK LocalePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1557
VOID EnableVisualTheme(_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
Definition: wizard.c:1453
static BOOL WriteDefaultLogonData(LPWSTR Domain)
Definition: wizard.c:1052
static void GenerateComputerName(LPWSTR lpBuffer)
Definition: wizard.c:1104
static PTIMEZONE_ENTRY GetLargerTimeZoneEntry(PSETUPDATA SetupData, DWORD Index)
Definition: wizard.c:1642
static VOID SetUserLocaleName(HWND hwnd)
Definition: wizard.c:1292
static INT_PTR CALLBACK OwnerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:872
static BOOL WriteDateTimeSettings(HWND hwndDlg, PSETUPDATA SetupData)
Definition: wizard.c:1942
#define MAX_LAYOUTS_PER_LANGID
static INT_PTR CALLBACK DateTimePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1973
static const WCHAR * InstallationTypes[INSTALLATION_TYPE_MAX]
Definition: wizard.c:418
static HFONT CreateBoldFont(VOID)
Definition: wizard.c:102
static BOOL WriteComputerSettings(WCHAR *ComputerName, HWND hwndDlg)
Definition: wizard.c:981
VOID ProcessSetupInf(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:3325
static VOID ShowStepError(HWND hwndDlg, PREGISTRATIONNOTIFY RegistrationNotify)
Definition: wizard.c:2586
static const WCHAR s_szWinlogon[]
Definition: wizard.c:396
static VOID DestroyTimeZoneList(PSETUPDATA SetupData)
Definition: wizard.c:1746
static const PRODUCT_OPTION_DATA s_ProductOptionData[INSTALLATION_TYPE_MAX]
Definition: wizard.c:410
static const WCHAR * s_DefaultSoundEvents[][2]
Definition: wizard.c:426
static BOOL GetLocalSystemTime(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1890
static void OnChooseInstallationType(HWND hwndDlg, INSTALLATION_TYPE nOption)
Definition: wizard.c:687
static LONG RetrieveTimeZone(IN HKEY hZoneKey, IN PVOID Context)
Definition: wizard.c:1659
static struct ThemeInfo Themes[]
DWORD(WINAPI * PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA)
Definition: wizard.c:3457
static PTIMEZONE_ENTRY GetSelectedTimeZoneEntry(PSETUPDATA SetupData, DWORD dwEntryIndex)
Definition: wizard.c:1777
static PTIMEZONE_ENTRY GetTimeZoneEntryByIndex(PSETUPDATA SetupData, DWORD dwComboIndex)
Definition: wizard.c:1791
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:1845
static INT_PTR CALLBACK ThemePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2119
static INT_PTR CALLBACK AckPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:287
static BOOL HasDaylightSavingTime(PTIMEZONE_ENTRY Entry)
Definition: wizard.c:1768
static DWORD CALLBACK ItemCompletionThread(LPVOID Parameter)
Definition: wizard.c:2471
static BOOL RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
Definition: wizard.c:1391
static const WCHAR s_szCurrentVersion[]
Definition: wizard.c:399
static VOID SetInstallationCompleted(VOID)
Definition: wizard.c:2743
static VOID AddInstallationSource(IN HKEY hKey, IN LPWSTR lpPath)
Definition: wizard.c:3234
struct _TIMEZONE_ENTRY * PTIMEZONE_ENTRY
static const WCHAR s_szExplorerSoundEvents[]
Definition: wizard.c:398
static INT_PTR CALLBACK InstallTypePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:718
VOID ProcessUnattendSection(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:2933
VOID InstallWizard(VOID)
Definition: wizard.c:3460
static BOOL DoWriteInstallationType(INSTALLATION_TYPE nOption)
Definition: wizard.c:546
static VOID UpdateAutoDaylightCheckbox(HWND hwndDlg, PTIMEZONE_ENTRY Entry)
Definition: wizard.c:1802
struct _TIMEZONE_ENTRY TIMEZONE_ENTRY
static const WCHAR s_szProductOptions[]
Definition: wizard.c:393
static const WCHAR s_szControlWindows[]
Definition: wizard.c:395
static VOID ShowTimeZoneList(HWND hwnd, PSETUPDATA SetupData, DWORD dwEntryIndex)
Definition: wizard.c:1815
static INT_PTR CALLBACK ProcessPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2624
static const WCHAR s_szDefaultSoundEvents[]
Definition: wizard.c:397
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:102
@ INSTALLATION_TYPE_SERVER_CORE
Definition: syssetup.h:30
@ INSTALLATION_TYPE_DEFAULT
Definition: syssetup.h:34
@ INSTALLATION_TYPE_SERVER
Definition: syssetup.h:28
@ INSTALLATION_TYPE_WORKSTATION
Definition: syssetup.h:29
@ INSTALLATION_TYPE_MAX
Definition: syssetup.h:32
enum _INSTALLATION_TYPE INSTALLATION_TYPE
@ 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
HRESULT InstallOptionalComponents(_In_ PITEMSDATA pItemsData)
Definition: addons.c:135
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:279
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:268
_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:645
#define LOCALE_ILANGUAGE
Definition: winnls.h:30
#define LOCALE_SLANGUAGE
Definition: winnls.h:31
@ GEOCLASS_NATION
Definition: winnls.h:632
#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