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