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