ReactOS 0.4.17-dev-966-gf06eace
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 HRESULT HrCoInit;
2357
2358 ZeroMemory(&RegistrationData, sizeof(REGISTRATIONDATA));
2359 RegistrationData.hwndDlg = pItemsData->hwndDlg;
2360 RegistrationData.Registered = 0;
2361
2362 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2363 L"RegisterDlls", &Context))
2364 {
2365 DPRINT1("No RegistrationPhase2 section found\n");
2366 return GetLastError();
2367 }
2368
2369 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2370 ARRAYSIZE(SectionName),
2371 NULL))
2372 {
2373 DPRINT1("Unable to retrieve section name\n");
2374 return GetLastError();
2375 }
2376
2377 DllCount = SetupGetLineCountW(hSysSetupInf, SectionName);
2378 DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount);
2379 if (DllCount < 0)
2380 {
2381 return STATUS_NOT_FOUND;
2382 }
2383
2384 RegistrationData.DllCount = (ULONG)DllCount;
2385 RegistrationData.DefaultContext = SetupInitDefaultQueueCallback(RegistrationData.hwndDlg);
2386 RegistrationData.pNotify = pNotify;
2387
2388 /* A DllRegisterServer is allowed to use COM, and several do: quartz and
2389 * qcap register their filters through IFilterMapper2, devenum and qedit
2390 * likewise. Nothing on this path had initialised COM, so every one of those
2391 * failed with CO_E_NOTINITIALIZED and setup reported "DllRegisterServer
2392 * failed". regsvr32 initialises COM around the same call for this reason. */
2393 HrCoInit = CoInitialize(NULL);
2394 if (FAILED(HrCoInit))
2395 DPRINT1("CoInitialize failed with 0x%08lx; COM-based registration will fail\n", HrCoInit);
2396
2397 _SEH2_TRY
2398 {
2399 if (!SetupInstallFromInfSectionW(GetParent(RegistrationData.hwndDlg),
2401 L"RegistrationPhase2",
2402 SPINST_REGISTRY | SPINST_REGISTERCALLBACKAWARE | SPINST_REGSVR,
2403 0,
2404 NULL,
2405 0,
2407 &RegistrationData,
2408 NULL,
2409 NULL))
2410 {
2411 Error = GetLastError();
2412 }
2413 }
2415 {
2416 DPRINT("Catching exception\n");
2418 }
2419 _SEH2_END;
2420
2421 if (SUCCEEDED(HrCoInit))
2423
2425
2426 return Error;
2427}
2428
2429static
2430VOID
2432 PITEMSDATA pItemsData)
2433{
2434 WCHAR SectionName[512];
2436 LONG Steps = 0;
2439
2440 ZeroMemory(&Notify, sizeof(Notify));
2441
2442 /* Count the 'RegisterDlls' steps */
2443 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2444 L"RegisterDlls", &Context))
2445 {
2446 DPRINT1("No RegistrationPhase2 section found\n");
2447 return;
2448 }
2449
2450 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2451 ARRAYSIZE(SectionName),
2452 NULL))
2453 {
2454 DPRINT1("Unable to retrieve section name\n");
2455 return;
2456 }
2457
2458 Steps += SetupGetLineCountW(hSysSetupInf, SectionName);
2459
2460 /* Count the 'TypeLibratries' steps */
2461 Steps += SetupGetLineCountW(hSysSetupInf, L"TypeLibraries");
2462
2463 /* Start the item */
2464 DPRINT("Register Components: %ld Steps\n", Steps);
2465 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 0, (LPARAM)Steps);
2466
2467 Error = RegisterDlls(pItemsData, &Notify);
2468 if (Error == ERROR_SUCCESS)
2469 RegisterTypeLibraries(pItemsData, &Notify, hSysSetupInf, L"TypeLibraries");
2470
2471 /* End the item */
2472 DPRINT("Register Components: done\n");
2473 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 0, Error);
2474}
2475
2476static
2477VOID
2479 PITEMSDATA pItemsData)
2480{
2481 LONG Steps = 0;
2484
2485 ZeroMemory(&Notify, sizeof(Notify));
2486
2487 /* Count steps */
2488 Steps = CountSecuritySteps();
2489
2490 /* Start the item */
2491 DPRINT("Install security: %ld Steps\n", Steps);
2492 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 2, (LPARAM)Steps);
2493
2494 /* Install steps */
2495 Error = InstallSecurity(pItemsData, &Notify);
2496
2497 /* End the item */
2498 DPRINT("Install security: done\n");
2499 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 2, Error);
2500}
2501
2502static
2503DWORD
2507{
2508 PITEMSDATA pItemsData;
2509 HWND hwndDlg;
2510
2511 pItemsData = (PITEMSDATA)Parameter;
2512 hwndDlg = pItemsData->hwndDlg;
2513
2514 /* Step 0 - Registering components */
2515 RegisterComponents(pItemsData);
2516
2517 /* Step 1 - Installing start menu items */
2518 InstallStartMenuItems(pItemsData);
2519
2520 /* Step 2 - Saving Settings */
2521 SaveSettings(pItemsData);
2522
2523 /* Step 3 - Install optional components */
2524 InstallOptionalComponents(pItemsData);
2525
2526 /* Step 4 - Removing temporary files */
2527// RemoveTempFiles(pItemsData);
2528
2529 // FIXME: Move this call to a separate cleanup page!
2531
2532 /* Free the items data */
2533 HeapFree(GetProcessHeap(), 0, pItemsData);
2534
2535 /* Tell the wizard page that we are done */
2536 PostMessage(hwndDlg, PM_ITEMS_DONE, 0, 0);
2537
2538 return 0;
2539}
2540
2541
2542static
2543BOOL
2545 _In_ HWND hwndDlg)
2546{
2547 HANDLE hCompletionThread;
2548 PITEMSDATA pItemsData;
2549
2550 pItemsData = HeapAlloc(GetProcessHeap(), 0, sizeof(ITEMSDATA));
2551 if (pItemsData == NULL)
2552 return FALSE;
2553
2554 pItemsData->hwndDlg = hwndDlg;
2555
2556 hCompletionThread = CreateThread(NULL,
2557 0,
2559 pItemsData,
2560 0,
2561 NULL);
2562 if (hCompletionThread == NULL)
2563 {
2564 HeapFree(GetProcessHeap(), 0, pItemsData);
2565 }
2566 else
2567 {
2568 CloseHandle(hCompletionThread);
2569 return TRUE;
2570 }
2571
2572 return FALSE;
2573}
2574
2575static
2576VOID
2578 HWND hwndDlg,
2579 DWORD LastError)
2580{
2582 WCHAR UnknownError[84];
2583 WCHAR Title[64];
2584
2586 NULL, LastError, 0, ErrorMessage, 0, NULL) == 0)
2587 {
2589 UnknownError,
2590 ARRAYSIZE(UnknownError) - 20) == 0)
2591 {
2592 wcscpy(UnknownError, L"Unknown error");
2593 }
2594 wcscat(UnknownError, L" ");
2595 _ultow(LastError, UnknownError + wcslen(UnknownError), 10);
2596 ErrorMessage = UnknownError;
2597 }
2598
2599 if (ErrorMessage != NULL)
2600 {
2602 Title, ARRAYSIZE(Title)) == 0)
2603 {
2604 wcscpy(Title, L"ReactOS Setup");
2605 }
2606
2608 }
2609
2610 if (ErrorMessage != NULL &&
2611 ErrorMessage != UnknownError)
2612 {
2614 }
2615}
2616
2617
2618static
2619VOID
2621 HWND hwndDlg,
2622 PREGISTRATIONNOTIFY RegistrationNotify)
2623{
2624 WCHAR ErrorMessage[128];
2625 WCHAR Title[64];
2626
2627 if (LoadStringW(hDllInstance, RegistrationNotify->MessageID,
2629 ARRAYSIZE(ErrorMessage)) == 0)
2630 {
2631 ErrorMessage[0] = L'\0';
2632 }
2633
2634 if (RegistrationNotify->MessageID != IDS_TIMEOUT)
2635 {
2637 RegistrationNotify->LastError, 0,
2640 NULL);
2641 }
2642
2643 if (ErrorMessage[0] != L'\0')
2644 {
2646 Title, ARRAYSIZE(Title)) == 0)
2647 {
2648 wcscpy(Title, L"ReactOS Setup");
2649 }
2650
2651 MessageBoxW(hwndDlg, ErrorMessage,
2653 }
2654}
2655
2656
2657static INT_PTR CALLBACK
2659 UINT uMsg,
2660 WPARAM wParam,
2661 LPARAM lParam)
2662{
2664 PREGISTRATIONNOTIFY RegistrationNotify;
2665 static HICON s_hCheckIcon, s_hArrowIcon, s_hCrossIcon;
2666 static HFONT s_hNormalFont;
2667
2668 /* Retrieve pointer to the global setup data */
2670
2671 switch (uMsg)
2672 {
2673 case WM_INITDIALOG:
2674 {
2675 /* Save pointer to the global setup data */
2679 ShowDlgItem(hwndDlg, IDC_CHECK5, SW_HIDE);
2680 s_hCheckIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CHECKICON), IMAGE_ICON, 16, 16, 0);
2681 s_hArrowIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_ARROWICON), IMAGE_ICON, 16, 16, 0);
2682 s_hCrossIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CROSSICON), IMAGE_ICON, 16, 16, 0);
2683 s_hNormalFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1, WM_GETFONT, 0, 0);
2684 break;
2685 }
2686
2687 case WM_DESTROY:
2688 DestroyIcon(s_hCheckIcon);
2689 DestroyIcon(s_hArrowIcon);
2690 DestroyIcon(s_hCrossIcon);
2691 break;
2692
2693 case WM_NOTIFY:
2694 switch (((LPNMHDR)lParam)->code)
2695 {
2696 case PSN_SETACTIVE:
2697 {
2698 LogItem(L"BEGIN", L"ProcessPage");
2699
2700 /* Disable all buttons during installation; hide "Back" */
2702 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
2704
2705 RunItemCompletionThread(hwndDlg);
2706 break;
2707 }
2708
2709 case PSN_WIZNEXT:
2710 LogItem(L"END", L"ProcessPage");
2711 break;
2712
2713 case PSN_WIZBACK:
2715 break;
2716
2717 default:
2718 break;
2719 }
2720 break;
2721
2722 case PM_ITEM_START:
2723 DPRINT("PM_ITEM_START %lu\n", (ULONG)lParam);
2728 break;
2729
2730 case PM_ITEM_END:
2731 DPRINT("PM_ITEM_END\n");
2732 SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1 + wParam, WM_SETFONT, (WPARAM)s_hNormalFont, (LPARAM)TRUE);
2733 if (lParam == ERROR_SUCCESS)
2734 {
2736 }
2737 else
2738 {
2740 ShowItemError(hwndDlg, (DWORD)lParam);
2741 }
2742 break;
2743
2744 case PM_STEP_START:
2745 DPRINT("PM_STEP_START\n");
2746 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2748 (LPARAM)((RegistrationNotify->CurrentItem != NULL)? RegistrationNotify->CurrentItem : L""));
2749 break;
2750
2751 case PM_STEP_END:
2752 DPRINT("PM_STEP_END\n");
2753 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2754 SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS, RegistrationNotify->Progress, 0);
2755 if (RegistrationNotify->LastError != ERROR_SUCCESS)
2756 {
2757 ShowStepError(hwndDlg, RegistrationNotify);
2758 }
2759 break;
2760
2761 case PM_ITEMS_DONE:
2762 DPRINT("PM_ITEMS_DONE\n");
2763 /* Enable the Back and Next buttons */
2766 break;
2767
2768 default:
2769 break;
2770 }
2771
2772 return FALSE;
2773}
2774
2775
2776static VOID
2778{
2779 HKEY hKey = 0;
2780 DWORD InProgress = 0;
2781 DWORD InstallDate;
2782
2783 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
2784 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
2785 {
2786 InstallDate = (DWORD)time(NULL);
2787 RegSetValueExW(hKey, L"InstallDate", 0, REG_DWORD, (LPBYTE)&InstallDate, sizeof(InstallDate));
2789 }
2790
2791 if (Unattended)
2792 {
2793 WCHAR szInf[MAX_PATH];
2794 WCHAR szInfCmd[MAX_PATH * 4], szCmd[_countof(szInfCmd)];
2795
2796 GetSetupInfPath(szInf, _countof(szInf));
2797 if (GetPrivateProfileStringW(L"SetupParams", L"UserExecute", L"", szInfCmd, _countof(szInfCmd), szInf) && *szInfCmd)
2798 {
2799 *szCmd = UNICODE_NULL;
2800 ExpandEnvironmentStringsW(szInfCmd, szCmd, _countof(szInfCmd));
2801 RunCommandAndWait(szCmd);
2802 }
2803 }
2804
2805 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\Setup", 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
2806 {
2807 RegSetValueExW(hKey, L"SystemSetupInProgress", 0, REG_DWORD, (LPBYTE)&InProgress, sizeof(InProgress));
2809 }
2810}
2811
2812static INT_PTR CALLBACK
2814 UINT uMsg,
2815 WPARAM wParam,
2816 LPARAM lParam)
2817{
2818 switch (uMsg)
2819 {
2820 case WM_INITDIALOG:
2821 {
2822 /* Get pointer to the global setup data */
2824
2825 /* Set title font */
2826 SendDlgItemMessage(hwndDlg,
2828 WM_SETFONT,
2830 (LPARAM)TRUE);
2832 {
2833 KillTimer(hwndDlg, 1);
2835 PostQuitMessage(0);
2836 }
2837
2838 /* Ensure that the installer wizard window is made visible and focused */
2839 ShowWindow(GetParent(hwndDlg), SW_SHOW);
2841 break;
2842 }
2843
2844 case WM_DESTROY:
2845 {
2847 PostQuitMessage(0);
2848 return TRUE;
2849 }
2850
2851 case WM_TIMER:
2852 {
2853 HWND hWndProgress;
2854 INT Position;
2855
2856 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
2857 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
2858 if (Position == 300)
2859 {
2860 KillTimer(hwndDlg, 1);
2862 }
2863 else
2864 {
2865 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
2866 }
2867 return TRUE;
2868 }
2869
2870 case WM_NOTIFY:
2871 {
2872 LPNMHDR lpnm = (LPNMHDR)lParam;
2873
2874 switch (lpnm->code)
2875 {
2876 case PSN_SETACTIVE:
2877 {
2878 HWND hWndParent = GetParent(hwndDlg);
2879
2880 /* Only "Finish" for closing the wizard, and hide "Back" and "Next" */
2882 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_CANCEL);
2885
2886 /* Set up the reboot progress bar and countdown timer.
2887 * 300 steps at 50 ms each: 15 seconds */
2890 SetTimer(hwndDlg, 1, 50, NULL);
2891 break;
2892 }
2893
2894 case PSN_WIZFINISH:
2895 DestroyWindow(GetParent(hwndDlg));
2896 break;
2897
2898 default:
2899 break;
2900 }
2901 break;
2902 }
2903
2904 default:
2905 break;
2906 }
2907
2908 return FALSE;
2909}
2910
2911
2912/*
2913 * GetInstallSourceWin32 retrieves the path to the ReactOS installation medium
2914 * in Win32 format, for later use by syssetup and storage in the registry.
2915 */
2916static BOOL
2918 OUT PWSTR pwszPath,
2919 IN DWORD cchPathMax,
2920 IN PCWSTR pwszNTPath)
2921{
2922 WCHAR wszDrives[512];
2923 WCHAR wszNTPath[512]; // MAX_PATH ?
2924 DWORD cchDrives;
2925 PWCHAR pwszDrive;
2926
2927 *pwszPath = UNICODE_NULL;
2928
2929 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2930 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2931 {
2932 /* Buffer too small or failure */
2933 LogItem(NULL, L"GetLogicalDriveStringsW failed");
2934 return FALSE;
2935 }
2936
2937 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2938 {
2939 WCHAR wszBuf[MAX_PATH];
2940
2941 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2942 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2943 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2944 pwszDrive[2] = L'\\'; // Restore the backslash
2945
2946 wcscat(wszNTPath, L"\\"); // Concat a backslash
2947
2948 /* Logging */
2949 wsprintf(wszBuf, L"Testing '%s' --> '%s' %s a CD",
2950 pwszDrive, wszNTPath,
2951 (GetDriveTypeW(pwszDrive) == DRIVE_CDROM) ? L"is" : L"is not");
2952 LogItem(NULL, wszBuf);
2953
2954 /* Check whether the NT path corresponds to the NT installation source path */
2955 if (!_wcsicmp(wszNTPath, pwszNTPath))
2956 {
2957 /* Found it! */
2958 wcscpy(pwszPath, pwszDrive); // cchPathMax
2959
2960 /* Logging */
2961 wsprintf(wszBuf, L"GetInstallSourceWin32: %s", pwszPath);
2962 LogItem(NULL, wszBuf);
2963 wcscat(wszBuf, L"\n");
2964 OutputDebugStringW(wszBuf);
2965
2966 return TRUE;
2967 }
2968 }
2969
2970 return FALSE;
2971}
2972
2973VOID
2975 IN OUT PSETUPDATA pSetupData)
2976{
2977 INFCONTEXT InfContext;
2978 WCHAR szName[256];
2979 WCHAR szValue[MAX_PATH];
2980 DWORD LineLength;
2981 HKEY hKey;
2982
2983 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2984 L"Unattend",
2985 L"UnattendSetupEnabled",
2986 &InfContext))
2987 {
2988 DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError());
2989 return;
2990 }
2991
2992 if (!SetupGetStringFieldW(&InfContext,
2993 1,
2994 szValue,
2995 ARRAYSIZE(szValue),
2996 &LineLength))
2997 {
2998 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2999 return;
3000 }
3001
3002 if (_wcsicmp(szValue, L"yes") != 0)
3003 {
3004 DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n");
3005 return;
3006 }
3007
3008 pSetupData->UnattendSetup = TRUE;
3009
3010 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
3011 L"Unattend",
3012 NULL,
3013 &InfContext))
3014 {
3015 DPRINT1("Error: SetupFindFirstLine failed %d\n", GetLastError());
3016 return;
3017 }
3018
3019 do
3020 {
3021 if (!SetupGetStringFieldW(&InfContext,
3022 0,
3023 szName,
3025 &LineLength))
3026 {
3027 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3028 return;
3029 }
3030
3031 if (!SetupGetStringFieldW(&InfContext,
3032 1,
3033 szValue,
3034 ARRAYSIZE(szValue),
3035 &LineLength))
3036 {
3037 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3038 return;
3039 }
3040 DPRINT1("Name %S Value %S\n", szName, szValue);
3041 if (!_wcsicmp(szName, L"FullName"))
3042 {
3043 if (ARRAYSIZE(pSetupData->OwnerName) > LineLength)
3044 {
3045 wcscpy(pSetupData->OwnerName, szValue);
3046 }
3047 }
3048 else if (!_wcsicmp(szName, L"OrgName"))
3049 {
3050 if (ARRAYSIZE(pSetupData->OwnerOrganization) > LineLength)
3051 {
3052 wcscpy(pSetupData->OwnerOrganization, szValue);
3053 }
3054 }
3055 else if (!_wcsicmp(szName, L"ComputerName"))
3056 {
3057 if (ARRAYSIZE(pSetupData->ComputerName) > LineLength)
3058 {
3059 wcscpy(pSetupData->ComputerName, szValue);
3060 }
3061 }
3062 else if (!_wcsicmp(szName, L"AdminPassword"))
3063 {
3064 if (ARRAYSIZE(pSetupData->AdminPassword) > LineLength)
3065 {
3066 wcscpy(pSetupData->AdminPassword, szValue);
3067 }
3068 }
3069 else if (!_wcsicmp(szName, L"TimeZoneIndex"))
3070 {
3071 pSetupData->TimeZoneIndex = _wtoi(szValue);
3072 }
3073 else if (!_wcsicmp(szName, L"DisableAutoDaylightTimeSet"))
3074 {
3075 pSetupData->DisableAutoDaylightTimeSet = _wtoi(szValue);
3076 }
3077 else if (!_wcsicmp(szName, L"RappsDownload"))
3078 {
3079 if (!_wcsicmp(szValue, L"yes"))
3080 pSetupData->RappsDownload = TRUE;
3081 else
3082 pSetupData->RappsDownload = FALSE;
3083 }
3084 else if (!_wcsicmp(szName, L"InstallationType"))
3085 {
3086 pSetupData->InstallationType = (INSTALLATION_TYPE)_wtoi(szValue);
3087 }
3088 } while (SetupFindNextLine(&InfContext, &InfContext));
3089
3090 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3091 L"Display",
3092 NULL,
3093 &InfContext))
3094 {
3095 DEVMODEW dm = { { 0 } };
3096 dm.dmSize = sizeof(dm);
3098 {
3099 do
3100 {
3101 int iValue;
3102 if (!SetupGetStringFieldW(&InfContext,
3103 0,
3104 szName,
3106 &LineLength))
3107 {
3108 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3109 return;
3110 }
3111
3112 if (!SetupGetStringFieldW(&InfContext,
3113 1,
3114 szValue,
3115 ARRAYSIZE(szValue),
3116 &LineLength))
3117 {
3118 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3119 return;
3120 }
3121 iValue = _wtoi(szValue);
3122 DPRINT1("Name %S Value %i\n", szName, iValue);
3123
3124 if (!iValue)
3125 continue;
3126
3127 if (!_wcsicmp(szName, L"BitsPerPel"))
3128 {
3129 dm.dmFields |= DM_BITSPERPEL;
3130 dm.dmBitsPerPel = iValue;
3131 }
3132 else if (!_wcsicmp(szName, L"XResolution"))
3133 {
3134 dm.dmFields |= DM_PELSWIDTH;
3135 dm.dmPelsWidth = iValue;
3136 }
3137 else if (!_wcsicmp(szName, L"YResolution"))
3138 {
3139 dm.dmFields |= DM_PELSHEIGHT;
3140 dm.dmPelsHeight = iValue;
3141 }
3142 else if (!_wcsicmp(szName, L"VRefresh"))
3143 {
3145 dm.dmDisplayFrequency = iValue;
3146 }
3147 } while (SetupFindNextLine(&InfContext, &InfContext));
3148
3150 }
3151 }
3152
3154 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
3155 0,
3157 &hKey) != ERROR_SUCCESS)
3158 {
3159 DPRINT1("Error: failed to open HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n");
3160 return;
3161 }
3162
3163 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3164 L"GuiRunOnce",
3165 NULL,
3166 &InfContext))
3167 {
3168 int i = 0;
3169 do
3170 {
3171 if (SetupGetStringFieldW(&InfContext,
3172 0,
3173 szValue,
3174 ARRAYSIZE(szValue),
3175 NULL))
3176 {
3178 _swprintf(szName, L"%d", i);
3179 DPRINT("szName %S szValue %S\n", szName, szValue);
3180
3182 {
3183 DPRINT("value %S\n", szPath);
3184 if (RegSetValueExW(hKey,
3185 szName,
3186 0,
3187 REG_SZ,
3188 (const BYTE*)szPath,
3189 (wcslen(szPath) + 1) * sizeof(WCHAR)) == ERROR_SUCCESS)
3190 {
3191 i++;
3192 }
3193 }
3194 }
3195 } while (SetupFindNextLine(&InfContext, &InfContext));
3196 }
3197
3199
3200 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3201 L"Env",
3202 NULL,
3203 &InfContext))
3204 {
3205 if (RegCreateKeyExW(
3206 HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", 0, NULL,
3208 {
3209 DPRINT1("Error: failed to open HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\n");
3210 return;
3211 }
3212 do
3213 {
3214 if (!SetupGetStringFieldW(&InfContext,
3215 0,
3216 szName,
3218 &LineLength))
3219 {
3220 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3221 return;
3222 }
3223
3224 if (!SetupGetStringFieldW(&InfContext,
3225 1,
3226 szValue,
3227 ARRAYSIZE(szValue),
3228 &LineLength))
3229 {
3230 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3231 return;
3232 }
3233 DPRINT1("[ENV] %S=%S\n", szName, szValue);
3234
3235 DWORD dwType = wcschr(szValue, '%') != NULL ? REG_EXPAND_SZ : REG_SZ;
3236
3237 if (RegSetValueExW(hKey, szName, 0, dwType, (const BYTE*)szValue, (DWORD)(wcslen(szValue) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS)
3238 {
3239 DPRINT1(" - Error %d\n", GetLastError());
3240 }
3241
3242 } while (SetupFindNextLine(&InfContext, &InfContext));
3243
3245 }
3246}
3247
3248static BOOL
3250 IN LPCWSTR lpPath1,
3251 IN LPCWSTR lpPath2)
3252{
3253 WCHAR szPath1[MAX_PATH];
3254 WCHAR szPath2[MAX_PATH];
3255
3256 /* If something goes wrong, better return TRUE,
3257 * so the calling function returns early.
3258 */
3259 if (!PathCanonicalizeW(szPath1, lpPath1))
3260 return TRUE;
3261
3262 if (!PathAddBackslashW(szPath1))
3263 return TRUE;
3264
3265 if (!PathCanonicalizeW(szPath2, lpPath2))
3266 return TRUE;
3267
3268 if (!PathAddBackslashW(szPath2))
3269 return TRUE;
3270
3271 return (_wcsicmp(szPath1, szPath2) == 0);
3272}
3273
3274static VOID
3276 IN HKEY hKey,
3277 IN LPWSTR lpPath)
3278{
3279 LONG res;
3280 DWORD dwRegType;
3281 DWORD dwPathLength = 0;
3282 DWORD dwNewLength = 0;
3283 LPWSTR Buffer = NULL;
3284 LPWSTR Path;
3285
3287 hKey,
3288 L"Installation Sources",
3289 NULL,
3290 &dwRegType,
3291 NULL,
3292 &dwPathLength);
3293
3294 if (res != ERROR_SUCCESS ||
3295 dwRegType != REG_MULTI_SZ ||
3296 dwPathLength == 0 ||
3297 dwPathLength % sizeof(WCHAR) != 0)
3298 {
3299 dwPathLength = 0;
3300 goto set;
3301 }
3302
3303 /* Reserve space for existing data + new string */
3304 dwNewLength = dwPathLength + (wcslen(lpPath) + 1) * sizeof(WCHAR);
3305 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3306 if (!Buffer)
3307 return;
3308
3309 ZeroMemory(Buffer, dwNewLength);
3310
3312 hKey,
3313 L"Installation Sources",
3314 NULL,
3315 NULL,
3316 (LPBYTE)Buffer,
3317 &dwPathLength);
3318
3319 if (res != ERROR_SUCCESS)
3320 {
3322 dwPathLength = 0;
3323 goto set;
3324 }
3325
3326 /* Sanity check, these should already be zeros */
3327 Buffer[dwPathLength / sizeof(WCHAR) - 2] = UNICODE_NULL;
3328 Buffer[dwPathLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3329
3330 for (Path = Buffer; *Path; Path += wcslen(Path) + 1)
3331 {
3332 /* Check if path is already added */
3333 if (PathIsEqual(Path, lpPath))
3334 goto cleanup;
3335 }
3336
3337 Path = Buffer + dwPathLength / sizeof(WCHAR) - 1;
3338
3339set:
3340 if (dwPathLength == 0)
3341 {
3342 dwNewLength = (wcslen(lpPath) + 1 + 1) * sizeof(WCHAR);
3343 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3344 if (!Buffer)
3345 return;
3346
3347 Path = Buffer;
3348 }
3349
3350 StringCbCopyW(Path, dwNewLength - (Path - Buffer) * sizeof(WCHAR), lpPath);
3351 Buffer[dwNewLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3352
3354 hKey,
3355 L"Installation Sources",
3356 0,
3358 (LPBYTE)Buffer,
3359 dwNewLength);
3360
3361cleanup:
3363}
3364
3365VOID
3367 IN OUT PSETUPDATA pSetupData)
3368{
3370 WCHAR szValue[MAX_PATH];
3371 INFCONTEXT InfContext;
3372 DWORD LineLength;
3373 HKEY hKey;
3374 LONG res;
3375
3376 pSetupData->hSetupInf = INVALID_HANDLE_VALUE;
3377
3378 /* Retrieve the path of the setup INF */
3380
3381 /* Open the setup INF */
3382 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3383 NULL,
3385 NULL);
3386 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3387 {
3388 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3389 return;
3390 }
3391
3392
3393 /* Retrieve the NT source path from which the 1st-stage installer was run */
3394 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
3395 L"data",
3396 L"sourcepath",
3397 &InfContext))
3398 {
3399 DPRINT1("Error: Cannot find sourcepath Key! %d\n", GetLastError());
3400 return;
3401 }
3402
3403 if (!SetupGetStringFieldW(&InfContext,
3404 1,
3405 szValue,
3406 ARRAYSIZE(szValue),
3407 &LineLength))
3408 {
3409 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3410 return;
3411 }
3412
3413 *pSetupData->SourcePath = UNICODE_NULL;
3414
3415 /* Close the setup INF as we are going to modify it manually */
3416 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3417 SetupCloseInfFile(pSetupData->hSetupInf);
3418
3419
3420 /* Find the installation source path in Win32 format */
3421 if (!GetInstallSourceWin32(pSetupData->SourcePath,
3422 _countof(pSetupData->SourcePath),
3423 szValue))
3424 {
3425 *pSetupData->SourcePath = UNICODE_NULL;
3426 }
3427
3428 /* Save the path in Win32 format in the setup INF */
3429 _swprintf(szValue, L"\"%s\"", pSetupData->SourcePath);
3430 WritePrivateProfileStringW(L"data", L"dospath", szValue, szPath);
3431
3432 /*
3433 * Save it also in the registry, in the following keys:
3434 * - HKLM\Software\Microsoft\Windows\CurrentVersion\Setup ,
3435 * values "SourcePath" and "ServicePackSourcePath" (REG_SZ);
3436 * - HKLM\Software\Microsoft\Windows NT\CurrentVersion ,
3437 * value "SourcePath" (REG_SZ); set to the full path (e.g. D:\I386).
3438 */
3439#if 0
3441 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
3442 0,
3444 &hKey);
3445
3446 if (res != ERROR_SUCCESS)
3447 {
3448 return FALSE;
3449 }
3450#endif
3451
3453 L"Software\\Microsoft\\Windows\\CurrentVersion\\Setup",
3454 0, NULL,
3456 KEY_ALL_ACCESS, // KEY_WRITE
3457 NULL,
3458 &hKey,
3459 NULL);
3460 if (res == ERROR_SUCCESS)
3461 {
3462 AddInstallationSource(hKey, pSetupData->SourcePath);
3463
3465 L"SourcePath",
3466 0,
3467 REG_SZ,
3468 (LPBYTE)pSetupData->SourcePath,
3469 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3470
3472 L"ServicePackSourcePath",
3473 0,
3474 REG_SZ,
3475 (LPBYTE)pSetupData->SourcePath,
3476 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3477
3479 }
3480
3481
3482 /* Now, re-open the setup INF (this must succeed) */
3483 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3484 NULL,
3486 NULL);
3487 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3488 {
3489 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3490 return;
3491 }
3492
3493 /* Process the unattended section of the setup file */
3494 ProcessUnattendSection(pSetupData);
3495}
3496
3498
3499VOID
3501{
3502 PROPSHEETHEADER psh = {0};
3503 HPROPSHEETPAGE *phpage = NULL;
3504 PROPSHEETPAGE psp = {0};
3505 UINT nPages = 0;
3506 HWND hWnd;
3507 MSG msg;
3508 PSETUPDATA pSetupData = NULL;
3509 HMODULE hNetShell = NULL;
3511 DWORD dwPageCount = 10, dwNetworkPageCount = 0;
3512
3513 LogItem(L"BEGIN_SECTION", L"InstallWizard");
3514
3515 /* Allocate setup data */
3516 pSetupData = HeapAlloc(GetProcessHeap(),
3518 sizeof(SETUPDATA));
3519 if (pSetupData == NULL)
3520 {
3521 LogItem(NULL, L"SetupData allocation failed!");
3523 L"Setup failed to allocate global data!",
3524 L"ReactOS Setup",
3526 goto done;
3527 }
3529
3530 hNetShell = LoadLibraryW(L"netshell.dll");
3531 if (hNetShell != NULL)
3532 {
3533 DPRINT("Netshell.dll loaded!\n");
3534
3535 pfn = (PFNREQUESTWIZARDPAGES)GetProcAddress(hNetShell,
3536 "NetSetupRequestWizardPages");
3537 if (pfn != NULL)
3538 {
3539 pfn(&dwNetworkPageCount, NULL, NULL);
3540 dwPageCount += dwNetworkPageCount;
3541 }
3542 }
3543
3544 DPRINT("PageCount: %lu\n", dwPageCount);
3545
3546 phpage = HeapAlloc(GetProcessHeap(),
3548 dwPageCount * sizeof(HPROPSHEETPAGE));
3549 if (phpage == NULL)
3550 {
3551 LogItem(NULL, L"Page array allocation failed!");
3553 L"Setup failed to allocate page array!",
3554 L"ReactOS Setup",
3556 goto done;
3557 }
3558
3559 /* Process the $winnt$.inf setup file */
3560 ProcessSetupInf(pSetupData);
3561
3562 /* Create the Welcome page */
3563 psp.dwSize = sizeof(PROPSHEETPAGE);
3564 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3565 psp.hInstance = hDllInstance;
3566 psp.lParam = (LPARAM)pSetupData;
3567 psp.pfnDlgProc = WelcomeDlgProc;
3568 psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
3569 phpage[nPages++] = CreatePropertySheetPage(&psp);
3570
3571 /* Create the Acknowledgements page */
3572 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3573 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ACKTITLE);
3574 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE);
3575 psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE);
3576 psp.pfnDlgProc = AckPageDlgProc;
3577 phpage[nPages++] = CreatePropertySheetPage(&psp);
3578
3579 /* Create the Installation Type page */
3580 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3581 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALLATIONTITLE);
3582 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_INSTALLATIONSUBTITLE);
3583 psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLATION);
3584 psp.pfnDlgProc = InstallTypePageDlgProc;
3585 phpage[nPages++] = CreatePropertySheetPage(&psp);
3586
3587 /* Create the Locale page */
3588 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3589 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
3590 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
3591 psp.pfnDlgProc = LocalePageDlgProc;
3592 psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
3593 phpage[nPages++] = CreatePropertySheetPage(&psp);
3594
3595 /* Create the Owner page */
3596 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3597 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
3598 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
3599 psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
3600 psp.pfnDlgProc = OwnerPageDlgProc;
3601 phpage[nPages++] = CreatePropertySheetPage(&psp);
3602
3603 /* Create the Computer page */
3604 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3605 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
3606 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
3607 psp.pfnDlgProc = ComputerPageDlgProc;
3608 psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
3609 phpage[nPages++] = CreatePropertySheetPage(&psp);
3610
3611 /* Create the DateTime page */
3612 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3613 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
3614 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
3615 psp.pfnDlgProc = DateTimePageDlgProc;
3616 psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
3617 phpage[nPages++] = CreatePropertySheetPage(&psp);
3618
3619 /* Create the theme selection page */
3620 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3621 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONTITLE);
3622 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONSUBTITLE);
3623 psp.pfnDlgProc = ThemePageDlgProc;
3624 psp.pszTemplate = MAKEINTRESOURCE(IDD_THEMEPAGE);
3625 phpage[nPages++] = CreatePropertySheetPage(&psp);
3626
3629
3630 if (pfn)
3631 {
3632 pfn(&dwNetworkPageCount, &phpage[nPages], pSetupData);
3633 nPages += dwNetworkPageCount;
3634 }
3635
3636 /* Create the Process page */
3637 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3638 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
3639 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
3640 psp.pfnDlgProc = ProcessPageDlgProc;
3641 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
3642 phpage[nPages++] = CreatePropertySheetPage(&psp);
3643
3644 /* Create the Finish page */
3645 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3646 psp.pfnDlgProc = FinishDlgProc;
3647 psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
3648 phpage[nPages++] = CreatePropertySheetPage(&psp);
3649
3650 ASSERT(nPages == dwPageCount);
3651
3652 /* Create the property sheet */
3653 psh.dwSize = sizeof(PROPSHEETHEADER);
3654 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_MODELESS;
3655 psh.hInstance = hDllInstance;
3656 psh.hwndParent = NULL;
3657 psh.nPages = nPages;
3658 psh.nStartPage = 0;
3659 psh.phpage = phpage;
3660 psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
3661 psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
3662
3663 /* Create title font */
3664 pSetupData->hTitleFont = CreateTitleFont();
3665 pSetupData->hBoldFont = CreateBoldFont();
3666
3667 /* Display the wizard */
3668 hWnd = (HWND)PropertySheet(&psh);
3670
3671 while (GetMessage(&msg, NULL, 0, 0))
3672 {
3673 if (!IsDialogMessage(hWnd, &msg))
3674 {
3677 }
3678 }
3679
3680 DeleteObject(pSetupData->hBoldFont);
3681 DeleteObject(pSetupData->hTitleFont);
3682
3683 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3684 SetupCloseInfFile(pSetupData->hSetupInf);
3685
3686done:
3687 if (phpage != NULL)
3688 HeapFree(GetProcessHeap(), 0, phpage);
3689
3690 if (hNetShell != NULL)
3691 FreeLibrary(hNetShell);
3692
3693 if (pSetupData != NULL)
3694 HeapFree(GetProcessHeap(), 0, pSetupData);
3695
3696 LogItem(L"END_SECTION", L"InstallWizard");
3697}
3698
3699/* EOF */
PRTL_UNICODE_STRING_BUFFER Path
UINT cchMax
#define isprint(c)
Definition: acclib.h:73
#define REG_SZ
Definition: layer.c:22
#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
#define ARRAYSIZE(a)
Definition: cat.c:25
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 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
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
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:2331
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
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
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:39
BOOL RegisterTypeLibraries(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:541
VOID InstallStartMenuItems(_In_ PITEMSDATA pItemsData)
Definition: install.c:315
#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)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
void * UNKNOWN
Definition: ks.h:2676
#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
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
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
#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:110
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
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
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: image.c:84
UINT code
Definition: winuser.h:3267
UINT uNewState
Definition: commctrl.h:3041
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:2431
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:2577
struct _REGISTRATIONDATA REGISTRATIONDATA
static BOOL GetInstallSourceWin32(OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
Definition: wizard.c:2917
static const WCHAR s_szRosVersion[]
Definition: wizard.c:401
static BOOL RunItemCompletionThread(_In_ HWND hwndDlg)
Definition: wizard.c:2544
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:3249
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:3366
static VOID ShowStepError(HWND hwndDlg, PREGISTRATIONNOTIFY RegistrationNotify)
Definition: wizard.c:2620
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:3497
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:2505
static BOOL RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
Definition: wizard.c:1412
static VOID SetInstallationCompleted(IN BOOL Unattended)
Definition: wizard.c:2777
static const WCHAR s_szCurrentVersion[]
Definition: wizard.c:406
static VOID AddInstallationSource(IN HKEY hKey, IN LPWSTR lpPath)
Definition: wizard.c:3275
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:2974
VOID InstallWizard(VOID)
Definition: wizard.c:3500
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:2658
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_ INT _In_ INT cChars
Definition: winddi.h:1486
_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
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336
unsigned char BYTE
Definition: xxhash.c:193