ReactOS 0.4.17-dev-683-g0dafdc5
usetup.c
Go to the documentation of this file.
1/*
2 * ReactOS kernel
3 * Copyright (C) 2002, 2003, 2004 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19/*
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: base/setup/usetup/usetup.c
23 * PURPOSE: Text-mode setup
24 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
25 * Hervé Poussineau (hpoussin@reactos.org)
26 */
27
28#include <usetup.h>
29#include <math.h>
30#include <ntstrsafe.h>
31
32#include "cmdcons.h"
33#include "devinst.h"
34#include "fmtchk.h"
35
36#define NDEBUG
37#include <debug.h>
38
39
40/* GLOBALS & LOCALS *********************************************************/
41
43
46
47/* The partition where to perform the installation */
49// static PVOLENTRY InstallVolume = NULL;
50#define InstallVolume (InstallPartition->Volume)
51/*
52 * The system partition we will actually use. It can be different from
53 * PartitionList->SystemPartition in case we don't support it, or we install
54 * on a removable disk.
55 * We may indeed not support the original system partition in case we do not
56 * have write support on it. Please note that this situation is partly a HACK
57 * and MUST NEVER happen on architectures where real system partitions are
58 * mandatory (because then they are formatted in FAT FS and we support write
59 * operation on them).
60 */
62// static PVOLENTRY SystemVolume = NULL;
63#define SystemVolume (SystemPartition->Volume)
64
65
66/* OTHER Stuff *****/
67
69static WCHAR DefaultLanguage[20]; // Copy of string inside LanguageList
70static WCHAR DefaultKBLayout[20]; // Copy of string inside KeyboardList
71
73
74/* Global partition list on the system */
76
77/* Currently selected partition entry in the list */
79static enum {
80 PartTypeData, // On MBR-disks, primary or logical partition
81 PartTypeExtended // MBR-disk container
83
84/* Flag set in VOLENTRY::New when a partition/volume is created automatically */
85#define VOLUME_NEW_AUTOCREATE 0x80
86
87/* List of supported file systems for the partition to be formatted */
89
90/*****************************************************/
91
94
95#ifdef __REACTOS__ /* HACK */
96
97/* FONT SUBSTITUTION WORKAROUND *************************************************/
98
99/* For font file check */
100FONTSUBSTSETTINGS s_SubstSettings = { FALSE };
101
102static void
103DoWatchDestFileName(LPCWSTR FileName)
104{
105 if (FileName[0] == 'm' || FileName[0] == 'M')
106 {
107 if (_wcsicmp(FileName, L"mingliu.ttc") == 0)
108 {
109 DPRINT("mingliu.ttc found\n");
110 s_SubstSettings.bFoundFontMINGLIU = TRUE;
111 }
112 else if (_wcsicmp(FileName, L"msgothic.ttc") == 0)
113 {
114 DPRINT("msgothic.ttc found\n");
115 s_SubstSettings.bFoundFontMSGOTHIC = TRUE;
116 }
117 else if (_wcsicmp(FileName, L"msmincho.ttc") == 0)
118 {
119 DPRINT("msmincho.ttc found\n");
120 s_SubstSettings.bFoundFontMSMINCHO = TRUE;
121 }
122 else if (_wcsicmp(FileName, L"mssong.ttf") == 0)
123 {
124 DPRINT("mssong.ttf found\n");
125 s_SubstSettings.bFoundFontMSSONG = TRUE;
126 }
127 }
128 else
129 {
130 if (_wcsicmp(FileName, L"simsun.ttc") == 0)
131 {
132 DPRINT("simsun.ttc found\n");
133 s_SubstSettings.bFoundFontSIMSUN = TRUE;
134 }
135 else if (_wcsicmp(FileName, L"gulim.ttc") == 0)
136 {
137 DPRINT("gulim.ttc found\n");
138 s_SubstSettings.bFoundFontGULIM = TRUE;
139 }
140 else if (_wcsicmp(FileName, L"batang.ttc") == 0)
141 {
142 DPRINT("batang.ttc found\n");
143 s_SubstSettings.bFoundFontBATANG = TRUE;
144 }
145 }
146}
147#endif /* HACK */
148
149/* FUNCTIONS ****************************************************************/
150
151static VOID
153{
154 CHAR buffer[512];
155 va_list ap;
158
159 va_start(ap, fmt);
161 va_end(ap);
162
167}
168
169
170static VOID
172 IN SHORT yTop,
173 IN SHORT Width,
175{
176 COORD coPos;
177 DWORD Written;
178
179 /* Draw upper left corner */
180 coPos.X = xLeft;
181 coPos.Y = yTop;
183 CharUpperLeftCorner, // '+',
184 1,
185 coPos,
186 &Written);
187
188 /* Draw upper edge */
189 coPos.X = xLeft + 1;
190 coPos.Y = yTop;
192 CharHorizontalLine, // '-',
193 Width - 2,
194 coPos,
195 &Written);
196
197 /* Draw upper right corner */
198 coPos.X = xLeft + Width - 1;
199 coPos.Y = yTop;
201 CharUpperRightCorner, // '+',
202 1,
203 coPos,
204 &Written);
205
206 /* Draw right edge, inner space and left edge */
207 for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
208 {
209 coPos.X = xLeft;
211 CharVerticalLine, // '|',
212 1,
213 coPos,
214 &Written);
215
216 coPos.X = xLeft + 1;
218 ' ',
219 Width - 2,
220 coPos,
221 &Written);
222
223 coPos.X = xLeft + Width - 1;
225 CharVerticalLine, // '|',
226 1,
227 coPos,
228 &Written);
229 }
230
231 /* Draw lower left corner */
232 coPos.X = xLeft;
233 coPos.Y = yTop + Height - 1;
235 CharLowerLeftCorner, // '+',
236 1,
237 coPos,
238 &Written);
239
240 /* Draw lower edge */
241 coPos.X = xLeft + 1;
242 coPos.Y = yTop + Height - 1;
244 CharHorizontalLine, // '-',
245 Width - 2,
246 coPos,
247 &Written);
248
249 /* Draw lower right corner */
250 coPos.X = xLeft + Width - 1;
251 coPos.Y = yTop + Height - 1;
253 CharLowerRightCorner, // '+',
254 1,
255 coPos,
256 &Written);
257}
258
259
260VOID
262 PCCH Status,
263 PINPUT_RECORD Ir,
264 ULONG WaitEvent)
265{
266 SHORT yTop;
267 SHORT xLeft;
268 COORD coPos;
269 DWORD Written;
271 ULONG MaxLength;
272 ULONG Lines;
273 PCHAR p;
274 PCCH pnext;
275 BOOLEAN LastLine;
276 SHORT Width;
278
279 /* Count text lines and longest line */
280 MaxLength = 0;
281 Lines = 0;
282 pnext = Text;
283
284 while (TRUE)
285 {
286 p = strchr(pnext, '\n');
287
288 if (p == NULL)
289 {
290 Length = strlen(pnext);
291 LastLine = TRUE;
292 }
293 else
294 {
295 Length = (ULONG)(p - pnext);
296 LastLine = FALSE;
297 }
298
299 Lines++;
300
301 if (Length > MaxLength)
302 MaxLength = Length;
303
304 if (LastLine)
305 break;
306
307 pnext = p + 1;
308 }
309
310 /* Check length of status line */
311 if (Status != NULL)
312 {
314
315 if (Length > MaxLength)
316 MaxLength = Length;
317 }
318
319 Width = MaxLength + 4;
320 Height = Lines + 2;
321
322 if (Status != NULL)
323 Height += 2;
324
325 yTop = (yScreen - Height) / 2;
326 xLeft = (xScreen - Width) / 2;
327
328
329 /* Set screen attributes */
330 coPos.X = xLeft;
331 for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++)
332 {
335 Width,
336 coPos,
337 &Written);
338 }
339
340 DrawBox(xLeft, yTop, Width, Height);
341
342 /* Print message text */
343 coPos.Y = yTop + 1;
344 pnext = Text;
345 while (TRUE)
346 {
347 p = strchr(pnext, '\n');
348
349 if (p == NULL)
350 {
351 Length = strlen(pnext);
352 LastLine = TRUE;
353 }
354 else
355 {
356 Length = (ULONG)(p - pnext);
357 LastLine = FALSE;
358 }
359
360 if (Length != 0)
361 {
362 coPos.X = xLeft + 2;
364 pnext,
365 Length,
366 coPos,
367 &Written);
368 }
369
370 if (LastLine)
371 break;
372
373 coPos.Y++;
374 pnext = p + 1;
375 }
376
377 /* Print separator line and status text */
378 if (Status != NULL)
379 {
380 coPos.Y = yTop + Height - 3;
381 coPos.X = xLeft;
384 1,
385 coPos,
386 &Written);
387
388 coPos.X = xLeft + 1;
390 CharHorizontalLine, // '-',
391 Width - 2,
392 coPos,
393 &Written);
394
395 coPos.X = xLeft + Width - 1;
398 1,
399 coPos,
400 &Written);
401
402 coPos.Y++;
403 coPos.X = xLeft + 2;
405 Status,
406 min(strlen(Status), (SIZE_T)Width - 4),
407 coPos,
408 &Written);
409 }
410
411 if (WaitEvent == POPUP_WAIT_NONE)
412 return;
413
414 while (TRUE)
415 {
417
418 if (WaitEvent == POPUP_WAIT_ANY_KEY ||
419 Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
420 {
421 return;
422 }
423 }
424}
425
426
427/*
428 * Confirm quit setup
429 * RETURNS
430 * TRUE: Quit setup.
431 * FALSE: Don't quit setup.
432 */
433static BOOL
435{
436 BOOL Result = FALSE;
438
439 while (TRUE)
440 {
442
443 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
444 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
445 {
446 Result = TRUE;
447 break;
448 }
449 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
450 {
451 Result = FALSE;
452 break;
453 }
454 }
455
456 return Result;
457}
458
459
460static VOID
462{
463 PGENERIC_LIST_ENTRY ListEntry;
464 KLID newLayout;
465
467
469 {
472 {
473 /* FIXME: Handle error! */
474 return;
475 }
476 }
477
478 /* Search for default layout (if provided) */
479 if (newLayout != 0)
480 {
481 for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
482 ListEntry = GetNextListEntry(ListEntry))
483 {
484 PCWSTR pszLayoutId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
485 KLID LayoutId = (KLID)(pszLayoutId ? wcstoul(pszLayoutId, NULL, 16) : 0);
486 if (newLayout == LayoutId)
487 {
489 break;
490 }
491 }
492 }
493}
494
495
496static NTSTATUS
497NTAPI
501 IN SIZE_T cchBufferSize)
502{
503 return RtlStringCchPrintfA(Buffer, cchBufferSize, "%S",
505}
506
507static NTSTATUS
508NTAPI
512 IN SIZE_T cchBufferSize)
513{
515 PVOLINFO VolInfo = (NtOsInstall->Volume ? &NtOsInstall->Volume->Info : NULL);
516
517 if (VolInfo && VolInfo->DriveLetter)
518 {
519 /* We have retrieved a partition that is mounted */
520 return RtlStringCchPrintfA(Buffer, cchBufferSize,
521 "%C:%S \"%S\"",
522 VolInfo->DriveLetter,
523 NtOsInstall->PathComponent,
524 NtOsInstall->InstallationName);
525 }
526 else
527 {
528 /* We failed somewhere, just show the NT path */
529 return RtlStringCchPrintfA(Buffer, cchBufferSize,
530 "%wZ \"%S\"",
531 &NtOsInstall->SystemNtPath,
532 NtOsInstall->InstallationName);
533 }
534}
535
536
537// PSETUP_ERROR_ROUTINE
538static VOID
541 IN PUSETUP_DATA pSetupData,
542 ...)
543{
544 INPUT_RECORD Ir;
545 va_list arg_ptr;
546
547 va_start(arg_ptr, pSetupData);
548
549 if (pSetupData->LastErrorNumber >= ERROR_SUCCESS &&
550 pSetupData->LastErrorNumber < ERROR_LAST_ERROR_CODE)
551 {
552 // Note: the "POPUP_WAIT_ENTER" actually depends on the LastErrorNumber...
553 MUIDisplayErrorV(pSetupData->LastErrorNumber, &Ir, POPUP_WAIT_ENTER, arg_ptr);
554 }
555
556 va_end(arg_ptr);
557}
558
559/*
560 * Start page
561 *
562 * Next pages:
563 * LanguagePage (at once, default)
564 * InstallIntroPage (at once, if unattended)
565 * QuitPage
566 *
567 * SIDEEFFECTS
568 * Init Sdi
569 * Init USetupData.SourcePath
570 * Init USetupData.SourceRootPath
571 * Init USetupData.SourceRootDir
572 * Init USetupData.SetupInf
573 * Init USetupData.RequiredPartitionDiskSpace
574 * Init IsUnattendedSetup
575 * If unattended, init *List and sets the Codepage
576 * If unattended, init SelectedLanguageId
577 * If unattended, init USetupData.LanguageId
578 *
579 * RETURNS
580 * Number of the next page.
581 */
582static PAGE_NUMBER
584{
585 ULONG Error;
586 PGENERIC_LIST_ENTRY ListEntry;
588
590
591 /* Initialize Setup */
594 if (Error != ERROR_SUCCESS)
595 {
597 return QUIT_PAGE;
598 }
599
600 /* Initialize the user-mode PnP manager */
602 DPRINT1("The user-mode PnP manager could not initialize, expect unavailable devices!\n");
603
604 /* Wait for any immediate pending installations to finish */
606 DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
607
610 {
611 // TODO: Read options from inf
612 /* Load the hardware, language and keyboard layout lists */
613
617
619
620 /* new part */
624
626
627 /* first we hack LanguageList */
628 for (ListEntry = GetFirstListEntry(USetupData.LanguageList); ListEntry;
629 ListEntry = GetNextListEntry(ListEntry))
630 {
631 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
633 {
634 DPRINT("found %S in LanguageList\n", LocaleId);
636 break;
637 }
638 }
639
640 /* now LayoutList */
641 for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
642 ListEntry = GetNextListEntry(ListEntry))
643 {
644 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
646 {
647 DPRINT("found %S in LayoutList\n", LocaleId);
649 break;
650 }
651 }
652
654
655 return INSTALL_INTRO_PAGE;
656 }
657
658 return LANGUAGE_PAGE;
659}
660
661
662/*
663 * Displays the LanguagePage.
664 *
665 * Next pages: WelcomePage, QuitPage
666 *
667 * SIDEEFFECTS
668 * Init SelectedLanguageId
669 * Init USetupData.LanguageId
670 *
671 * RETURNS
672 * Number of the next page.
673 */
674static PAGE_NUMBER
676{
677 GENERIC_LIST_UI ListUi;
678 PCWSTR NewLanguageId;
679 BOOL RefreshPage = FALSE;
680
681 /* Initialize the computer settings list */
683 {
686 {
687 PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
688 return WELCOME_PAGE;
689 }
690 }
691
694
695 /* Load the font */
698
699 /*
700 * If there is no language or just a single one in the list,
701 * skip the language selection process altogether.
702 */
704 {
706 return WELCOME_PAGE;
707 }
708
710 DrawGenericList(&ListUi,
711 2, 18,
712 xScreen - 3,
713 yScreen - 3);
714
716
718
719 while (TRUE)
720 {
722
723 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
724 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
725 {
726 ScrollDownGenericList(&ListUi);
727 RefreshPage = TRUE;
728 }
729 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
730 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
731 {
732 ScrollUpGenericList(&ListUi);
733 RefreshPage = TRUE;
734 }
735 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
736 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
737 {
739 RefreshPage = TRUE;
740 }
741 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
742 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
743 {
745 RefreshPage = TRUE;
746 }
747 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
748 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
749 {
750 if (ConfirmQuit(Ir))
751 return QUIT_PAGE;
752 RedrawGenericList(&ListUi);
753 }
754 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
755 {
757
760
762
764 {
766 }
767
768 /* Load the font */
770
771 return WELCOME_PAGE;
772 }
773 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
774 {
775 /* a-z */
777 RefreshPage = TRUE;
778 }
779
780 if (RefreshPage)
781 {
783
784 NewLanguageId =
786
787 if (wcscmp(SelectedLanguageId, NewLanguageId))
788 {
789 /* Clear the language page */
791
792 SelectedLanguageId = NewLanguageId;
793
794 /* Load the font */
796
797 /* Redraw the list */
798 DrawGenericList(&ListUi,
799 2, 18,
800 xScreen - 3,
801 yScreen - 3);
802
803 /* Redraw language selection page in native language */
805 }
806
807 RefreshPage = FALSE;
808 }
809 }
810
811 return WELCOME_PAGE;
812}
813
814
815/*
816 * Displays the WelcomePage.
817 *
818 * Next pages:
819 * InstallIntroPage (default)
820 * RepairIntroPage
821 * RecoveryPage
822 * LicensePage
823 * QuitPage
824 *
825 * RETURNS
826 * Number of the next page.
827 */
828static PAGE_NUMBER
830{
832
833 while (TRUE)
834 {
836
837 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
838 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
839 {
840 if (ConfirmQuit(Ir))
841 return QUIT_PAGE;
842 break;
843 }
844 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
845 {
846 return INSTALL_INTRO_PAGE;
847 }
848 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
849 {
850 return RECOVERY_PAGE; // REPAIR_INTRO_PAGE;
851 }
852 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'L') /* L */
853 {
854 return LICENSE_PAGE;
855 }
856 }
857
858 return WELCOME_PAGE;
859}
860
861
862/*
863 * Displays the License page.
864 *
865 * Next page:
866 * WelcomePage (default)
867 *
868 * RETURNS
869 * Number of the next page.
870 */
871static PAGE_NUMBER
873{
875
876 while (TRUE)
877 {
879
880 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
881 {
882 return WELCOME_PAGE;
883 }
884 }
885
886 return LICENSE_PAGE;
887}
888
889
890/*
891 * Displays the RepairIntroPage.
892 *
893 * Next pages:
894 * RebootPage (default)
895 * InstallIntroPage
896 * RecoveryPage
897 * IntroPage
898 *
899 * RETURNS
900 * Number of the next page.
901 */
902static PAGE_NUMBER
904{
906
907 while (TRUE)
908 {
910
911 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
912 {
913 return REBOOT_PAGE;
914 }
915 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
916 {
918 return INSTALL_INTRO_PAGE;
919 }
920 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
921 {
922 return RECOVERY_PAGE;
923 }
924 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
925 {
926 return WELCOME_PAGE;
927 }
928 }
929
930 return REPAIR_INTRO_PAGE;
931}
932
933/*
934 * Displays the UpgradeRepairPage.
935 *
936 * Next pages:
937 * RebootPage (default)
938 * InstallIntroPage
939 * RecoveryPage
940 * WelcomePage
941 *
942 * RETURNS
943 * Number of the next page.
944 */
945static PAGE_NUMBER
947{
948 GENERIC_LIST_UI ListUi;
949
950/*** HACK!! ***/
951 if (PartitionList == NULL)
952 {
954 if (PartitionList == NULL)
955 {
956 /* FIXME: show an error dialog */
958 return QUIT_PAGE;
959 }
961 {
963 return QUIT_PAGE;
964 }
965 }
966/**************/
967
969 if (!NtOsInstallsList)
970 DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
971
972 /*
973 * If there is no available installation (or just a single one??) that can
974 * be updated in the list, just continue with the regular installation.
975 */
977 {
979
980 // return INSTALL_INTRO_PAGE;
982 // return SCSI_CONTROLLER_PAGE;
983 }
984
986
988 DrawGenericList(&ListUi,
989 2, 23,
990 xScreen - 3,
991 yScreen - 3);
992
993 // return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
994 while (TRUE)
995 {
997
998 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00)
999 {
1000 switch (Ir->Event.KeyEvent.wVirtualKeyCode)
1001 {
1002 case VK_DOWN: /* DOWN */
1003 ScrollDownGenericList(&ListUi);
1004 break;
1005 case VK_UP: /* UP */
1006 ScrollUpGenericList(&ListUi);
1007 break;
1008 case VK_NEXT: /* PAGE DOWN */
1010 break;
1011 case VK_PRIOR: /* PAGE UP */
1012 ScrollPageUpGenericList(&ListUi);
1013 break;
1014 case VK_F3: /* F3 */
1015 {
1016 if (ConfirmQuit(Ir))
1017 return QUIT_PAGE;
1018 RedrawGenericList(&ListUi);
1019 break;
1020 }
1021#if 1
1022/* TODO: Temporarily kept until correct keyboard layout is in place.
1023 * (Actual AsciiChar of ESCAPE should be 0x1B instead of 0.)
1024 * Addendum to commit 8b94515b.
1025 */
1026 case VK_ESCAPE: /* ESC */
1027 {
1029 // return nextPage; // prevPage;
1030
1031 // return INSTALL_INTRO_PAGE;
1032 return DEVICE_SETTINGS_PAGE;
1033 // return SCSI_CONTROLLER_PAGE;
1034 }
1035
1036#endif
1037 }
1038 }
1039#if 0
1040/* TODO: Restore this once correct keyboard layout is in place. */
1041 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1042 {
1044 // return nextPage; // prevPage;
1045
1046 // return INSTALL_INTRO_PAGE;
1047 return DEVICE_SETTINGS_PAGE;
1048 // return SCSI_CONTROLLER_PAGE;
1049 }
1050#endif
1051 else
1052 {
1053 // switch (toupper(Ir->Event.KeyEvent.uChar.AsciiChar))
1054 // if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1055 if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
1056 {
1057 /* Retrieve the current installation */
1059
1062
1063 DPRINT1("Selected installation for repair: \"%S\" ; DiskNumber = %d , PartitionNumber = %d\n",
1065
1067
1068 // return nextPage;
1069 /***/return INSTALL_INTRO_PAGE;/***/
1070 }
1071 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) &&
1072 (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) /* a-z */
1073 {
1075 }
1076 }
1077 }
1078
1079 return UPGRADE_REPAIR_PAGE;
1080}
1081
1082
1083/*
1084 * Displays the InstallIntroPage.
1085 *
1086 * Next pages:
1087 * DeviceSettingsPage (At once if repair or update is selected)
1088 * SelectPartitionPage (At once if unattended setup)
1089 * DeviceSettingsPage (default)
1090 * QuitPage
1091 *
1092 * RETURNS
1093 * Number of the next page.
1094 */
1095static PAGE_NUMBER
1097{
1098 if (RepairUpdateFlag)
1099 {
1100#if 1 /* Old code that looks good */
1101
1102 // return SELECT_PARTITION_PAGE;
1103 return DEVICE_SETTINGS_PAGE;
1104
1105#else /* Possible new code? */
1106
1107 return DEVICE_SETTINGS_PAGE;
1108 // return SCSI_CONTROLLER_PAGE;
1109
1110#endif
1111 }
1112
1114 return SELECT_PARTITION_PAGE;
1115
1117
1118 while (TRUE)
1119 {
1120 CONSOLE_ConInKey(Ir);
1121
1122 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1123 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1124 {
1125 if (ConfirmQuit(Ir))
1126 return QUIT_PAGE;
1127 break;
1128 }
1129 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1130 {
1131 return UPGRADE_REPAIR_PAGE;
1132 }
1133 }
1134
1135 return INSTALL_INTRO_PAGE;
1136}
1137
1138
1139#if 0
1140static PAGE_NUMBER
1141ScsiControllerPage(PINPUT_RECORD Ir)
1142{
1143 // MUIDisplayPage(SCSI_CONTROLLER_PAGE);
1144
1145 CONSOLE_SetTextXY(6, 8, "Setup detected the following mass storage devices:");
1146
1147 /* FIXME: print loaded mass storage driver descriptions */
1148#if 0
1149 CONSOLE_SetTextXY(8, 10, "TEST device");
1150#endif
1151
1152 CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
1153
1154 while (TRUE)
1155 {
1156 CONSOLE_ConInKey(Ir);
1157
1158 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1159 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1160 {
1161 if (ConfirmQuit(Ir))
1162 return QUIT_PAGE;
1163 break;
1164 }
1165 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1166 {
1167 return DEVICE_SETTINGS_PAGE;
1168 }
1169 }
1170
1171 return SCSI_CONTROLLER_PAGE;
1172}
1173
1174static PAGE_NUMBER
1175OemDriverPage(PINPUT_RECORD Ir)
1176{
1177 // MUIDisplayPage(OEM_DRIVER_PAGE);
1178
1179 CONSOLE_SetTextXY(6, 8, "This is the OEM driver page!");
1180
1181 /* FIXME: Implement!! */
1182
1183 CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
1184
1185 while (TRUE)
1186 {
1187 CONSOLE_ConInKey(Ir);
1188
1189 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1190 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1191 {
1192 if (ConfirmQuit(Ir))
1193 return QUIT_PAGE;
1194 break;
1195 }
1196 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1197 {
1198 return DEVICE_SETTINGS_PAGE;
1199 }
1200 }
1201
1202 return OEM_DRIVER_PAGE;
1203}
1204#endif
1205
1206
1207/*
1208 * Displays the DeviceSettingsPage.
1209 *
1210 * Next pages:
1211 * SelectPartitionPage (At once if repair or update is selected)
1212 * ComputerSettingsPage
1213 * DisplaySettingsPage
1214 * KeyboardSettingsPage
1215 * LayoutsettingsPage
1216 * SelectPartitionPage
1217 * QuitPage
1218 *
1219 * SIDEEFFECTS
1220 * Init USetupData.ComputerList
1221 * Init USetupData.DisplayList
1222 * Init USetupData.KeyboardList
1223 * Init USetupData.LayoutList
1224 *
1225 * RETURNS
1226 * Number of the next page.
1227 */
1228static PAGE_NUMBER
1230{
1231 static ULONG Line = 16;
1232
1233 /* Initialize the computer settings list */
1235 {
1238 {
1240 return QUIT_PAGE;
1241 }
1242 }
1243
1244 /* Initialize the display settings list */
1246 {
1249 {
1251 return QUIT_PAGE;
1252 }
1253 }
1254
1255 /* Initialize the keyboard settings list */
1257 {
1260 {
1262 return QUIT_PAGE;
1263 }
1264 }
1265
1266 /* Initialize the keyboard layout list */
1268 {
1271 {
1272 /* FIXME: report error */
1274 return QUIT_PAGE;
1275 }
1276 }
1277
1278 if (RepairUpdateFlag)
1279 return SELECT_PARTITION_PAGE;
1280
1281 // if (IsUnattendedSetup)
1282 // return SELECT_PARTITION_PAGE;
1283
1285
1290
1291 CONSOLE_InvertTextXY(24, Line, 48, 1);
1292
1293 while (TRUE)
1294 {
1295 CONSOLE_ConInKey(Ir);
1296
1297 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1298 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1299 {
1300 CONSOLE_NormalTextXY(24, Line, 48, 1);
1301
1302 if (Line == 14)
1303 Line = 16;
1304 else if (Line == 16)
1305 Line = 11;
1306 else
1307 Line++;
1308
1309 CONSOLE_InvertTextXY(24, Line, 48, 1);
1310 }
1311 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1312 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1313 {
1314 CONSOLE_NormalTextXY(24, Line, 48, 1);
1315
1316 if (Line == 11)
1317 Line = 16;
1318 else if (Line == 16)
1319 Line = 14;
1320 else
1321 Line--;
1322
1323 CONSOLE_InvertTextXY(24, Line, 48, 1);
1324 }
1325 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1326 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1327 {
1328 if (ConfirmQuit(Ir))
1329 return QUIT_PAGE;
1330 break;
1331 }
1332 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1333 {
1334 if (Line == 11)
1336 else if (Line == 12)
1337 return DISPLAY_SETTINGS_PAGE;
1338 else if (Line == 13)
1340 else if (Line == 14)
1341 return LAYOUT_SETTINGS_PAGE;
1342 else if (Line == 16)
1343 return SELECT_PARTITION_PAGE;
1344 }
1345 }
1346
1347 return DEVICE_SETTINGS_PAGE;
1348}
1349
1350
1351/*
1352 * Handles generic selection lists.
1353 *
1354 * PARAMS
1355 * GenericList: The list to handle.
1356 * nextPage: The page it needs to jump to after this page.
1357 * Ir: The PINPUT_RECORD
1358 */
1359static PAGE_NUMBER
1361 PAGE_NUMBER nextPage,
1362 PINPUT_RECORD Ir)
1363{
1364 while (TRUE)
1365 {
1366 CONSOLE_ConInKey(Ir);
1367
1368 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1369 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1370 {
1371 ScrollDownGenericList(ListUi);
1372 }
1373 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1374 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1375 {
1376 ScrollUpGenericList(ListUi);
1377 }
1378 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1379 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1380 {
1382 }
1383 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1384 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1385 {
1387 }
1388 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1389 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1390 {
1391 if (ConfirmQuit(Ir))
1392 return QUIT_PAGE;
1393 RedrawGenericList(ListUi);
1394 }
1395 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1396 {
1398 return nextPage; // Use some "prevPage;" instead?
1399 }
1400 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1401 {
1402 return nextPage;
1403 }
1404 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1405 {
1406 /* a-z */
1408 }
1409 }
1410}
1411
1412
1413/*
1414 * Displays the ComputerSettingsPage.
1415 *
1416 * Next pages:
1417 * DeviceSettingsPage
1418 * QuitPage
1419 *
1420 * RETURNS
1421 * Number of the next page.
1422 */
1423static PAGE_NUMBER
1425{
1426 GENERIC_LIST_UI ListUi;
1428
1430 DrawGenericList(&ListUi,
1431 2, 18,
1432 xScreen - 3,
1433 yScreen - 3);
1434
1435 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1436}
1437
1438
1439/*
1440 * Displays the DisplaySettingsPage.
1441 *
1442 * Next pages:
1443 * DeviceSettingsPage
1444 * QuitPage
1445 *
1446 * RETURNS
1447 * Number of the next page.
1448 */
1449static PAGE_NUMBER
1451{
1452 GENERIC_LIST_UI ListUi;
1454
1456 DrawGenericList(&ListUi,
1457 2, 18,
1458 xScreen - 3,
1459 yScreen - 3);
1460
1461 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1462}
1463
1464
1465/*
1466 * Displays the KeyboardSettingsPage.
1467 *
1468 * Next pages:
1469 * DeviceSettingsPage
1470 * QuitPage
1471 *
1472 * RETURNS
1473 * Number of the next page.
1474 */
1475static PAGE_NUMBER
1477{
1478 GENERIC_LIST_UI ListUi;
1480
1482 DrawGenericList(&ListUi,
1483 2, 18,
1484 xScreen - 3,
1485 yScreen - 3);
1486
1487 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1488}
1489
1490
1491/*
1492 * Displays the LayoutSettingsPage.
1493 *
1494 * Next pages:
1495 * DeviceSettingsPage
1496 * QuitPage
1497 *
1498 * RETURNS
1499 * Number of the next page.
1500 */
1501static PAGE_NUMBER
1503{
1504 GENERIC_LIST_UI ListUi;
1506
1508 DrawGenericList(&ListUi,
1509 2, 18,
1510 xScreen - 3,
1511 yScreen - 3);
1512
1513 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1514}
1515
1516
1517static BOOLEAN
1519 _In_ ULONGLONG SizeInBytes)
1520{
1521 /* Retrieve the maximum size in MB (rounded up) */
1522 ULONGLONG SizeInMB = RoundingDivide(SizeInBytes, MB);
1523
1524 /* Check the medium size */
1526 {
1527 DPRINT1("Partition/Volume is too small (size: %I64u MB), required space is %lu MB\n",
1529 return FALSE;
1530 }
1531 return TRUE;
1532}
1533
1534
1535/*
1536 * Displays the SelectPartitionPage.
1537 *
1538 * Next pages:
1539 * SelectFileSystemPage (At once if unattended)
1540 * SelectFileSystemPage (Default if free space is selected)
1541 * CreatePartitionPage
1542 * ConfirmDeleteSystemPartitionPage (if the selected partition is the system partition, aka with the boot flag set)
1543 * DeletePartitionPage
1544 * QuitPage
1545 *
1546 * SIDEEFFECTS
1547 * Set InstallShortcut (only if not unattended + free space is selected)
1548 *
1549 * RETURNS
1550 * Number of the next page.
1551 */
1552static PAGE_NUMBER
1554{
1555 PARTLIST_UI ListUi;
1556 ULONG Error;
1557 ULONGLONG MaxTargetSize;
1558
1559 if (PartitionList == NULL)
1560 {
1562 if (PartitionList == NULL)
1563 {
1565 return QUIT_PAGE;
1566 }
1568 {
1570 return QUIT_PAGE;
1571 }
1572 }
1573
1574 if (RepairUpdateFlag)
1575 {
1577
1578 /* Determine the selected installation disk & partition.
1579 * It must exist and be valid, since this is the partition
1580 * where the existing installation already resides. */
1584 if (!InstallPartition)
1585 {
1586 DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
1587 ASSERT(FALSE);
1588 }
1591
1593 }
1594
1596
1599 2, 21,
1600 xScreen - 3,
1601 yScreen - 3);
1602 DrawPartitionList(&ListUi);
1603
1604 if (IsUnattendedSetup) do
1605 {
1606 /* If DestinationDiskNumber or DestinationPartitionNumber are invalid
1607 * (see below), don't select the partition and show the list instead */
1610 {
1611 break;
1612 }
1613
1614 /* Determine the selected installation disk & partition */
1618
1619 /* Now reset DestinationDiskNumber and DestinationPartitionNumber
1620 * to *invalid* values, so that if the corresponding partition is
1621 * determined to be invalid by the code below or in CreateInstallPartition,
1622 * we don't reselect it when SelectPartitionPage() is called again */
1625
1626 // FIXME: Here and in the AutoPartition case below, the CurrentPartition
1627 // may actually be unsuitable (MBR-extended, non-simple volume...).
1628 // More checks need to be made here!
1629 //
1630 // NOTE: We don't check for CurrentPartition->Volume in case
1631 // the partition doesn't contain a recognized volume/none exists.
1632 // We also don't check whether IsPartitioned is TRUE, because if
1633 // the partition is still empty space, we'll try to partition it.
1635 goto CreateInstallPartition;
1636
1638 {
1640 // TODO: Do more checks, and loop until we find a valid partition.
1641 goto CreateInstallPartition;
1642 }
1643 } while (0);
1644
1645 while (TRUE)
1646 {
1647 ULONG uID;
1648
1650
1651 /* Update status text */
1652 if (!CurrentPartition)
1653 {
1654 // FIXME: If we get a NULL current partition, this means that
1655 // the current disk is of unrecognized type. So we should display
1656 // instead a status string to initialize the disk with one of
1657 // the recognized partitioning schemes (MBR, later: GPT, etc.)
1658 // For the time being we don't have that, so use instead another
1659 // known string.
1661 }
1662 else
1663 {
1665 {
1669 {
1671 }
1672 }
1673 else
1674 {
1678 }
1679 }
1681
1682 CONSOLE_ConInKey(Ir);
1683
1684 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1685 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1686 {
1687 if (ConfirmQuit(Ir))
1688 {
1691 return QUIT_PAGE;
1692 }
1693 return SELECT_PARTITION_PAGE;
1694 }
1695 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1696 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1697 {
1699 }
1700 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1701 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1702 {
1704 }
1705 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1706 {
1708
1709 /* Don't select an extended partition for OS installation */
1711 continue;
1712
1713 /*
1714 * Check whether the user wants to install ReactOS on a disk that
1715 * is not recognized by the computer's firmware and if so, display
1716 * a warning since such disks may not be bootable.
1717 */
1718 if (CurrentPartition->DiskEntry->MediaType == FixedMedia &&
1719 !CurrentPartition->DiskEntry->BiosFound)
1720 {
1721 PopupError("The disk you have selected for installing ReactOS\n"
1722 "is not visible by the firmware of your computer,\n"
1723 "and so may not be bootable.\n"
1724 "Press ENTER to continue anyway.",
1726 Ir, POPUP_WAIT_ENTER);
1727 // return SELECT_PARTITION_PAGE;
1728 }
1729
1730 goto CreateInstallPartition;
1731 }
1732 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
1733 {
1735
1737 if (Error != NOT_AN_ERROR)
1738 {
1740 return SELECT_PARTITION_PAGE;
1741 }
1742
1744 return CREATE_PARTITION_PAGE;
1745 }
1746 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'E') /* E */
1747 {
1749
1750 /* Don't create an extended partition within a logical partition */
1752 continue;
1753
1755 if (Error != NOT_AN_ERROR)
1756 {
1758 return SELECT_PARTITION_PAGE;
1759 }
1760
1762 return CREATE_PARTITION_PAGE;
1763 }
1764 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
1765 {
1767
1768 /* Ignore deletion in case this is not a partitioned entry */
1770 continue;
1771
1772// TODO: Do something similar before trying to format the partition?
1775 {
1776 UNICODE_STRING CurrentPartitionU;
1777 WCHAR PathBuffer[RTL_NUMBER_OF_FIELD(VOLINFO, DeviceName) + 1];
1778
1780
1781 RtlStringCchPrintfW(PathBuffer, _countof(PathBuffer),
1783 RtlInitUnicodeString(&CurrentPartitionU, PathBuffer);
1784
1785 /*
1786 * Check whether the user attempts to delete the partition on which
1787 * the installation source is present. If so, fail with an error.
1788 */
1789 // &USetupData.SourceRootPath
1790 if (RtlPrefixUnicodeString(&CurrentPartitionU, &USetupData.SourcePath, TRUE))
1791 {
1793 return SELECT_PARTITION_PAGE;
1794 }
1795 }
1796
1799 {
1801 }
1802
1803 return DELETE_PARTITION_PAGE;
1804 }
1805 }
1806
1807CreateInstallPartition:
1810
1811 /* Create the partition if the selected region is empty */
1813 {
1815 if (Error != NOT_AN_ERROR)
1816 {
1818 return SELECT_PARTITION_PAGE;
1819 }
1820
1821 /* Automatically create the partition on the whole empty space;
1822 * it will be formatted later with default parameters */
1825 0ULL,
1826 0);
1830 }
1831
1832 /* Verify the target medium size */
1834 if (!IsMediumLargeEnough(MaxTargetSize))
1835 {
1838 return SELECT_PARTITION_PAGE; /* Let the user select another partition */
1839 }
1840
1843}
1844
1845
1846#define PARTITION_SIZE_INPUT_FIELD_LENGTH 9
1847/* Restriction for MaxSize */
1848#define PARTITION_MAXSIZE (pow(10, (PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)) - 1)
1849
1850static VOID
1852 SHORT Top,
1853 SHORT Right,
1854 SHORT Bottom,
1855 ULONG MaxSize,
1857 PBOOLEAN Quit,
1859{
1860 INPUT_RECORD Ir;
1861 COORD coPos;
1862 DWORD Written;
1863 CHAR Buffer[128];
1864 INT Length, Pos;
1865 WCHAR ch;
1866 SHORT iLeft;
1867 SHORT iTop;
1868
1869 if (Quit != NULL)
1870 *Quit = FALSE;
1871
1872 if (Cancel != NULL)
1873 *Cancel = FALSE;
1874
1875 DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1);
1876
1877 /* Print message */
1878 coPos.X = Left + 2;
1879 coPos.Y = Top + 2;
1881 iLeft = coPos.X + (USHORT)strlen(Buffer) + 1;
1882 iTop = coPos.Y;
1883
1885 Buffer,
1886 strlen(Buffer),
1887 coPos,
1888 &Written);
1889
1891 coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1;
1892 coPos.Y = iTop;
1894 Buffer,
1895 strlen(Buffer),
1896 coPos,
1897 &Written);
1898
1899 _swprintf(InputBuffer, L"%lu", MaxSize);
1901 Pos = Length;
1903 iTop,
1905 InputBuffer);
1906 CONSOLE_SetCursorXY(iLeft + Length, iTop);
1908
1909 while (TRUE)
1910 {
1911 CONSOLE_ConInKey(&Ir);
1912
1913 if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1914 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1915 {
1916 if (Quit != NULL)
1917 *Quit = TRUE;
1918
1920 break;
1921 }
1922 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1923 {
1924 break;
1925 }
1926 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1927 {
1928 if (Cancel != NULL)
1929 *Cancel = TRUE;
1930
1932 break;
1933 }
1934 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1935 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
1936 {
1937 Pos = 0;
1938 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1939 }
1940 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1941 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
1942 {
1943 Pos = Length;
1944 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1945 }
1946 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1947 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
1948 {
1949 if (Pos > 0)
1950 {
1951 Pos--;
1952 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1953 }
1954 }
1955 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1956 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
1957 {
1958 if (Pos < Length)
1959 {
1960 Pos++;
1961 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1962 }
1963 }
1964 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1965 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
1966 {
1967 if (Pos < Length)
1968 {
1970 &InputBuffer[Pos + 1],
1971 (Length - Pos - 1) * sizeof(WCHAR));
1973
1974 Length--;
1976 iTop,
1978 InputBuffer);
1979 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1980 }
1981 }
1982 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_BACK) /* BACKSPACE */
1983 {
1984 if (Pos > 0)
1985 {
1986 if (Pos < Length)
1987 memmove(&InputBuffer[Pos - 1],
1988 &InputBuffer[Pos],
1989 (Length - Pos) * sizeof(WCHAR));
1991
1992 Pos--;
1993 Length--;
1995 iTop,
1997 InputBuffer);
1998 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1999 }
2000 }
2001 else if (Ir.Event.KeyEvent.uChar.AsciiChar != 0x00)
2002 {
2004 {
2006
2007 if ((ch >= L'0') && (ch <= L'9'))
2008 {
2009 if (Pos < Length)
2010 memmove(&InputBuffer[Pos + 1],
2011 &InputBuffer[Pos],
2012 (Length - Pos) * sizeof(WCHAR));
2014 InputBuffer[Pos] = ch;
2015
2016 Pos++;
2017 Length++;
2019 iTop,
2021 InputBuffer);
2022 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
2023 }
2024 }
2025 }
2026 }
2027
2029}
2030
2031
2032/*
2033 * Displays the CreatePartitionPage.
2034 *
2035 * Next pages:
2036 * SelectPartitionPage
2037 * SelectFileSystemPage (default)
2038 * QuitPage
2039 *
2040 * RETURNS
2041 * Number of the next page.
2042 */
2043static PAGE_NUMBER
2045{
2046 PPARTENTRY PartEntry;
2047 PDISKENTRY DiskEntry;
2048 ULONG uID;
2049 ULONG MaxSize;
2050 ULONGLONG MaxPartSize, PartSize;
2051 BOOLEAN Quit, Cancel;
2052 WCHAR InputBuffer[50];
2053 CHAR LineBuffer[100];
2054
2056 {
2057 /* FIXME: show an error dialog */
2058 return QUIT_PAGE;
2059 }
2060
2062 {
2066 }
2067 else // if (PartCreateType == PartTypeExtended)
2068 {
2070 }
2071
2073
2074 PartEntry = CurrentPartition;
2075 DiskEntry = CurrentPartition->DiskEntry;
2076
2077 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2079 LineBuffer);
2080
2082
2084
2085 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
2086
2087 while (TRUE)
2088 {
2089 /* Retrieve the maximum size in MB (rounded up)
2090 * and cap it with what the user can enter */
2091 MaxSize = (ULONG)RoundingDivide(MaxPartSize, MB);
2092 MaxSize = min(MaxSize, PARTITION_MAXSIZE);
2093
2094 ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17,
2095 MaxSize, InputBuffer, &Quit, &Cancel);
2096 if (Quit)
2097 {
2098 if (ConfirmQuit(Ir))
2099 return QUIT_PAGE;
2100 break;
2101 }
2102 else if (Cancel)
2103 {
2104 return SELECT_PARTITION_PAGE;
2105 }
2106
2107 PartSize = _wcstoui64(InputBuffer, NULL, 10);
2108
2109 /* Retry if too small or too large */
2110 if ((PartSize < 1) || (PartSize > MaxSize))
2111 continue;
2112
2113 /*
2114 * If the input size, given in MB, specifies the maximum partition
2115 * size, it may slightly under- or over-estimate the latter due to
2116 * rounding error. In this case, use all of the unpartitioned space.
2117 * Otherwise, directly convert the size to bytes.
2118 */
2119 if (PartSize == MaxSize)
2120 PartSize = MaxPartSize;
2121 else // if (PartSize < MaxSize)
2122 PartSize *= MB;
2123 DPRINT("Partition size: %I64u bytes\n", PartSize);
2124
2125 ASSERT(PartSize <= MaxPartSize);
2126
2129 PartSize,
2131 ? 0
2132 // (PartCreateType == PartTypeExtended)
2134
2135 return SELECT_PARTITION_PAGE;
2136 }
2137
2138 return CREATE_PARTITION_PAGE;
2139}
2140
2141
2142/*
2143 * Displays the ConfirmDeleteSystemPartitionPage.
2144 *
2145 * Next pages:
2146 * DeletePartitionPage (default)
2147 * SelectPartitionPage
2148 *
2149 * RETURNS
2150 * Number of the next page.
2151 */
2152static PAGE_NUMBER
2154{
2156
2157 while (TRUE)
2158 {
2159 CONSOLE_ConInKey(Ir);
2160
2161 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2162 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2163 {
2164 if (ConfirmQuit(Ir))
2165 return QUIT_PAGE;
2166 break;
2167 }
2168 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2169 {
2170 return DELETE_PARTITION_PAGE;
2171 }
2172 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2173 {
2174 return SELECT_PARTITION_PAGE;
2175 }
2176 }
2177
2179}
2180
2181
2182/*
2183 * Displays the DeletePartitionPage.
2184 *
2185 * Next pages:
2186 * SelectPartitionPage (default)
2187 * QuitPage
2188 *
2189 * RETURNS
2190 * Number of the next page.
2191 */
2192static PAGE_NUMBER
2194{
2195 PPARTENTRY PartEntry;
2196 PDISKENTRY DiskEntry;
2197 CHAR LineBuffer[100];
2198
2200 {
2201 /* FIXME: show an error dialog */
2202 return QUIT_PAGE;
2203 }
2204
2205 PartEntry = CurrentPartition;
2206 DiskEntry = CurrentPartition->DiskEntry;
2207
2209
2210 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2211 CONSOLE_SetTextXY(6, 10, LineBuffer);
2212
2213 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2215 LineBuffer);
2216
2217 while (TRUE)
2218 {
2219 CONSOLE_ConInKey(Ir);
2220
2221 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2222 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2223 {
2224 if (ConfirmQuit(Ir))
2225 return QUIT_PAGE;
2226 break;
2227 }
2228 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2229 {
2230 return SELECT_PARTITION_PAGE;
2231 }
2232 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
2233 {
2237 return SELECT_PARTITION_PAGE;
2238 }
2239 }
2240
2241 return DELETE_PARTITION_PAGE;
2242}
2243
2244
2245/*
2246 * Displays the SelectFileSystemPage.
2247 *
2248 * Next pages:
2249 * CheckFileSystemPage (At once if RepairUpdate is selected)
2250 * CheckFileSystemPage (At once if Unattended and not USetupData.FormatPartition)
2251 * FormatPartitionPage (Default, at once if Unattended and USetupData.FormatPartition)
2252 * SelectPartitionPage (If the user aborts)
2253 * QuitPage
2254 *
2255 * RETURNS
2256 * Number of the next page.
2257 */
2258// PFSVOL_CALLBACK
2259static FSVOL_OP
2263 _In_ FSVOLNOTIFY FormatStatus,
2264 _In_ ULONG_PTR Param1,
2265 _In_ ULONG_PTR Param2);
2266
2267typedef struct _FSVOL_CONTEXT
2268{
2272
2273static PAGE_NUMBER
2275{
2276 FSVOL_CONTEXT FsVolContext = {Ir, QUIT_PAGE};
2278
2280 {
2281 /* FIXME: show an error dialog */
2282 return QUIT_PAGE;
2283 }
2284
2285 /* Find or set the active system partition before starting formatting */
2290 &FsVolContext);
2291 if (!Success)
2292 return FsVolContext.NextPageOnAbort;
2293 //
2294 // FIXME?? If cannot use any system partition, install FreeLdr on floppy / removable media??
2295 //
2296
2297 /* Set the AUTOCREATE flag if the system partition was automatically created */
2300
2302 CONSOLE_Flush();
2303
2304 /* Apply all pending operations on partitions: formatting and checking */
2309 &FsVolContext);
2310 if (!Success)
2311 return FsVolContext.NextPageOnAbort;
2313}
2314
2315static BOOLEAN
2317 IN PINPUT_RECORD Ir,
2319{
2320 PPARTENTRY PartEntry;
2321 PDISKENTRY DiskEntry;
2322 CHAR LineBuffer[100];
2323
2324 // CONSOLE_ClearScreen();
2325 // CONSOLE_Flush();
2327
2328 PartEntry = PartitionList->SystemPartition;
2329 DiskEntry = PartEntry->DiskEntry;
2330
2331 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2332 CONSOLE_SetTextXY(8, 10, LineBuffer);
2333
2334 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2336 LineBuffer);
2337
2338
2339 PartEntry = SystemPartition;
2340 DiskEntry = PartEntry->DiskEntry;
2341
2342 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2343 CONSOLE_SetTextXY(8, 23, LineBuffer);
2344
2345 while (TRUE)
2346 {
2347 CONSOLE_ConInKey(Ir);
2348
2349 if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2350 break;
2351 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2352 return FALSE;
2353 }
2354
2355 return TRUE;
2356}
2357
2358static VOID
2360{
2361 if (!FileSystemList)
2362 return;
2363
2366}
2367
2368static FSVOL_OP
2370 _In_ PFSVOL_CONTEXT FsVolContext,
2372{
2373 PINPUT_RECORD Ir = FsVolContext->Ir;
2374 PPARTENTRY PartEntry = Volume->PartEntry;
2375 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
2376 PCWSTR DefaultFs;
2377 BOOLEAN ForceFormat;
2378 CHAR LineBuffer[100];
2379
2380 DPRINT("SelectFileSystemPage()\n");
2381
2382 ForceFormat = (Volume->New || Volume->FormatState == Unformatted);
2383
2384Restart:
2385 /* Reset the file system list for each volume that is to be formatted */
2387
2389 CONSOLE_Flush();
2391
2392 if (Volume->New & VOLUME_NEW_AUTOCREATE)
2393 {
2394 Volume->New &= ~VOLUME_NEW_AUTOCREATE;
2395
2397 }
2398 else if (Volume->New)
2399 {
2400 ULONG uID;
2401
2402 if (Volume == SystemVolume)
2404 else if (Volume == InstallVolume)
2406 else
2408
2410 }
2411 else
2412 {
2414 }
2415
2416 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2417 CONSOLE_SetTextXY(6, 10, LineBuffer);
2418
2419 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2421 LineBuffer);
2422
2423 /* Show "This Partition will be formatted next" only if it is unformatted */
2424 if (ForceFormat)
2426
2428
2430 {
2431 /* In unattended mode, preselect the file system */
2432 switch (USetupData.FsType)
2433 {
2434 /* 1 is for BtrFS */
2435 case 1:
2436 DefaultFs = L"BTRFS";
2437 break;
2438
2439 /* If we don't understand input, default to FAT */
2440 default:
2441 DefaultFs = L"FAT";
2442 break;
2443 }
2444 }
2445 else
2446 {
2447 /* By default select the "FAT" file system */
2448 DefaultFs = L"FAT";
2449 }
2450
2451 /* Create the file system list */
2452 // TODO: Display only the FSes compatible with the selected volume!
2453 FileSystemList = CreateFileSystemList(6, 26, ForceFormat, DefaultFs);
2454 if (!FileSystemList)
2455 {
2456 /* FIXME: show an error dialog */
2457 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2458 return FSVOL_ABORT;
2459 }
2460
2462 {
2463 /* In unattended setup, directly format the partition if requested.
2464 * Otherwise, skip the partition if it doesn't require formatting.
2465 * Else, ask the user what to do. */
2467 {
2468 return FSVOL_DOIT;
2469 }
2470 else if (!ForceFormat)
2471 {
2472 /* Skip formatting this volume, but file system checks will be performed */
2473 return FSVOL_SKIP;
2474 }
2475 // TODO: If unattended mode doesn't allow interaction,
2476 // popup or log error and exit, since we don't allow regular interaction.
2477 }
2478
2480
2481 while (TRUE)
2482 {
2483 CONSOLE_ConInKey(Ir);
2484
2485 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2486 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2487 {
2488 if (ConfirmQuit(Ir))
2489 {
2490 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2491 return FSVOL_ABORT;
2492 }
2493 break;
2494 }
2495 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2496 {
2497 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2498 return FSVOL_ABORT;
2499 }
2500 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2501 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
2502 {
2504 }
2505 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2506 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
2507 {
2509 }
2510 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2511 {
2513 {
2514 /* The 'Keep existing filesystem' entry was chosen,
2515 * the volume must be already formatted */
2516 ASSERT(!ForceFormat);
2517
2518 /* Skip formatting this volume. We will also ignore
2519 * file system checks on it, unless it is either the
2520 * system or the installation volume. */
2521 if ((Volume != SystemVolume) && (Volume != InstallVolume))
2522 Volume->NeedsCheck = FALSE;
2523
2524 return FSVOL_SKIP;
2525 }
2526 else
2527 {
2528 /* Format this volume */
2529 return FSVOL_DOIT;
2530 }
2531 }
2532 }
2533
2534 goto Restart;
2535}
2536
2537static FSVOL_OP
2539 _In_ PFSVOL_CONTEXT FsVolContext,
2541{
2542 PINPUT_RECORD Ir = FsVolContext->Ir;
2543 PPARTENTRY PartEntry = Volume->PartEntry;
2544 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
2545 CHAR LineBuffer[100];
2546
2547Restart:
2549 CONSOLE_Flush();
2551
2552 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2553 CONSOLE_SetTextXY(6, 10, LineBuffer);
2554
2555 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2557 LineBuffer);
2558
2559 while (TRUE)
2560 {
2561 if (!IsUnattendedSetup)
2562 CONSOLE_ConInKey(Ir);
2563
2564 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2565 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2566 {
2567 if (ConfirmQuit(Ir))
2568 {
2569 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2570 return FSVOL_ABORT;
2571 }
2572 goto Restart;
2573 }
2574 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2575 {
2576 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2577 return FSVOL_ABORT;
2578 }
2579 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
2580 {
2581 /*
2582 * Remove the "Press ENTER to continue" message prompt when the ENTER
2583 * key is pressed as the user wants to begin the partition formatting.
2584 */
2587
2588 return FSVOL_DOIT;
2589 }
2590 }
2591}
2592
2593static VOID
2596{
2597 PPARTENTRY PartEntry = Volume->PartEntry;
2598 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
2599 CHAR LineBuffer[100];
2600
2602 CONSOLE_Flush();
2604
2605 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2606 CONSOLE_SetTextXY(6, 10, LineBuffer);
2607
2608 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2610 LineBuffer);
2611}
2612
2613// PFSVOL_CALLBACK
2614static FSVOL_OP
2618 _In_ FSVOLNOTIFY FormatStatus,
2619 _In_ ULONG_PTR Param1,
2620 _In_ ULONG_PTR Param2)
2621{
2622 PFSVOL_CONTEXT FsVolContext = (PFSVOL_CONTEXT)Context;
2623 PINPUT_RECORD Ir = FsVolContext->Ir;
2624
2625 switch (FormatStatus)
2626 {
2627 // FIXME: Deprecate!
2629 {
2631
2632 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2634 return FSVOL_DOIT;
2635 return FSVOL_ABORT;
2636 }
2637
2639 {
2640 switch (Param1)
2641 {
2643 {
2645 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2646 break;
2647 }
2648
2650 {
2651 /* FIXME: improve the error dialog */
2652 //
2653 // Error dialog should say that we cannot find a suitable
2654 // system partition and create one on the system. At this point,
2655 // it may be nice to ask the user whether he wants to continue,
2656 // or use an external drive as the system drive/partition
2657 // (e.g. floppy, USB drive, etc...)
2658 //
2659 PopupError("The ReactOS Setup could not find a supported system partition\n"
2660 "on your system or could not create a new one. Without such a partition\n"
2661 "the Setup program cannot install ReactOS.\n"
2662 "Press ENTER to return to the partition selection list.",
2664 Ir, POPUP_WAIT_ENTER);
2665
2666 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2667 break;
2668 }
2669
2670 default:
2671 break;
2672 }
2673 return FSVOL_ABORT;
2674 }
2675
2678 // NOTE: If needed, clear screen and flush input.
2679 return FSVOL_DOIT;
2680
2682 {
2683 if ((FSVOL_OP)Param1 == FSVOL_FORMAT)
2684 {
2685 /* In case we just repair an existing installation,
2686 * just go to the file system check step */
2687 if (RepairUpdateFlag)
2688 return FSVOL_SKIP;
2689 }
2690 return FSVOL_DOIT;
2691 }
2692
2694 return 0;
2695
2697 {
2698 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
2700
2701 // FIXME: See also FSVOLNOTIFY_PARTITIONERROR
2702 if (FmtInfo->ErrorStatus == STATUS_PARTITION_FAILURE)
2703 {
2705 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2706 return FSVOL_ABORT;
2707 }
2708 else
2710 {
2711 /* FIXME: show an error dialog */
2712 // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY,
2713 // FmtInfo->Volume->Info.DeviceName);
2714 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2715 return FSVOL_ABORT;
2716 }
2717 else
2718 if (FmtInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
2719 {
2721 sizeof(Buffer),
2722 "Setup is currently unable to format a partition in %S.\n"
2723 "\n"
2724 " \x07 Press ENTER to continue Setup.\n"
2725 " \x07 Press F3 to quit Setup.",
2726 FmtInfo->FileSystemName);
2727
2731
2732 while (TRUE)
2733 {
2734 CONSOLE_ConInKey(Ir);
2735
2736 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2737 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2738 {
2739 if (ConfirmQuit(Ir))
2740 {
2741 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2742 return FSVOL_ABORT;
2743 }
2744 return FSVOL_RETRY;
2745 }
2746 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2747 {
2748 return FSVOL_RETRY;
2749 }
2750 }
2751 }
2752 else if (!NT_SUCCESS(FmtInfo->ErrorStatus))
2753 {
2754 DPRINT1("FormatPartition() failed: Status 0x%08lx\n", FmtInfo->ErrorStatus);
2756 FmtInfo->Volume->Info.DeviceName);
2757 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2758 return FSVOL_ABORT;
2759 }
2760 return FSVOL_RETRY;
2761 }
2762
2764 {
2765 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
2767
2768 if (ChkInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
2769 {
2771 sizeof(Buffer),
2772 "Setup is currently unable to check a partition formatted in %S.\n"
2773 "\n"
2774 " \x07 Press ENTER to continue Setup.\n"
2775 " \x07 Press F3 to quit Setup.",
2776 ChkInfo->Volume->Info.FileSystem);
2777
2781
2782 while (TRUE)
2783 {
2784 CONSOLE_ConInKey(Ir);
2785
2786 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2787 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2788 {
2789 if (ConfirmQuit(Ir))
2790 {
2791 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2792 return FSVOL_ABORT;
2793 }
2794 return FSVOL_SKIP;
2795 }
2796 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2797 {
2798 return FSVOL_SKIP;
2799 }
2800 }
2801 }
2802 else if (!NT_SUCCESS(ChkInfo->ErrorStatus))
2803 {
2804 DPRINT1("ChkdskPartition() failed: Status 0x%08lx\n", ChkInfo->ErrorStatus);
2805
2807 sizeof(Buffer),
2808 "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
2809 ChkInfo->ErrorStatus);
2810
2813 Ir, POPUP_WAIT_ENTER);
2814 return FSVOL_SKIP;
2815 }
2816 return FSVOL_SKIP;
2817 }
2818
2820 {
2821 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
2823
2824 ASSERT((FSVOL_OP)Param2 == FSVOL_FORMAT);
2825
2826 /* Select the file system */
2827 Result = SelectFileSystemPage(FsVolContext, FmtInfo->Volume);
2828 if (Result != FSVOL_DOIT)
2829 return Result;
2830
2831 /* Display the formatting page */
2832 Result = FormatPartitionPage(FsVolContext, FmtInfo->Volume);
2833 if (Result != FSVOL_DOIT)
2834 return Result;
2835
2837 return FSVOL_DOIT;
2838 }
2839
2841 {
2842 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
2843 EndFormat(FmtInfo->ErrorStatus);
2844
2845 /* Reset the file system list */
2847 return 0;
2848 }
2849
2851 {
2852 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
2853
2854 ASSERT((FSVOL_OP)Param2 == FSVOL_CHECK);
2855
2856 CheckFileSystemPage(ChkInfo->Volume);
2857 StartCheck(ChkInfo);
2858 return FSVOL_DOIT;
2859 }
2860
2862 {
2863 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
2864 EndCheck(ChkInfo->ErrorStatus);
2865 return 0;
2866 }
2867 }
2868
2869 return 0;
2870}
2871
2872
2873/*
2874 * Displays the InstallDirectoryPage.
2875 *
2876 * Next pages:
2877 * PrepareCopyPage
2878 * QuitPage
2879 *
2880 * RETURNS
2881 * Number of the next page.
2882 */
2883static PAGE_NUMBER
2885{
2887 ULONG Length, Pos;
2888 WCHAR c;
2889 WCHAR InstallDir[MAX_PATH];
2890
2892 {
2893 /* FIXME: show an error dialog */
2894 return QUIT_PAGE;
2895 }
2896
2897 // if (IsUnattendedSetup)
2898 if (RepairUpdateFlag)
2899 wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
2902 else
2903 wcscpy(InstallDir, L"\\ReactOS");
2904
2905 /*
2906 * Check the validity of the predefined 'InstallDir'. If we are either
2907 * in unattended setup or in update/repair mode, and the installation path
2908 * is valid, just perform the installation. Otherwise (either in the case
2909 * of an invalid path, or we are in regular setup), display the UI and allow
2910 * the user to specify a new installation path.
2911 */
2913 {
2914 /* Check for the validity of the installation directory and pop up
2915 * an error if it is not the case. Then the user can fix it. */
2916 if (IsValidInstallDirectory(InstallDir))
2917 goto InitInstallDir;
2918
2920 }
2921
2922 Length = wcslen(InstallDir);
2923 Pos = Length;
2924
2926 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
2927 CONSOLE_SetCursorXY(8 + Pos, 11);
2929
2930 while (TRUE)
2931 {
2932 CONSOLE_ConInKey(Ir);
2933
2934 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2935 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2936 {
2938
2939 if (ConfirmQuit(Ir))
2940 return QUIT_PAGE;
2942 }
2943 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2944 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
2945 {
2946 if (Pos < Length)
2947 {
2948 memmove(&InstallDir[Pos],
2949 &InstallDir[Pos + 1],
2950 (Length - Pos - 1) * sizeof(WCHAR));
2951 InstallDir[Length - 1] = UNICODE_NULL;
2952
2953 Length--;
2954 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
2955 CONSOLE_SetCursorXY(8 + Pos, 11);
2956 }
2957 }
2958 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2959 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
2960 {
2961 Pos = 0;
2962 CONSOLE_SetCursorXY(8 + Pos, 11);
2963 }
2964 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2965 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
2966 {
2967 Pos = Length;
2968 CONSOLE_SetCursorXY(8 + Pos, 11);
2969 }
2970 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2971 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
2972 {
2973 if (Pos > 0)
2974 {
2975 Pos--;
2976 CONSOLE_SetCursorXY(8 + Pos, 11);
2977 }
2978 }
2979 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2980 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
2981 {
2982 if (Pos < Length)
2983 {
2984 Pos++;
2985 CONSOLE_SetCursorXY(8 + Pos, 11);
2986 }
2987 }
2988 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2989 {
2990 /* Erase the whole line */
2991 *InstallDir = UNICODE_NULL;
2992 Pos = Length = 0;
2993 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
2994 CONSOLE_SetCursorXY(8 + Pos, 11);
2995 }
2996 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
2997 {
2999
3000 /* Check for the validity of the installation directory and pop up
3001 * an error if it is not the case. Then the user can fix it. */
3002 if (IsValidInstallDirectory(InstallDir))
3003 goto InitInstallDir;
3004
3007 }
3008 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3009 {
3010 if (Pos > 0)
3011 {
3012 if (Pos < Length)
3013 memmove(&InstallDir[Pos - 1],
3014 &InstallDir[Pos],
3015 (Length - Pos) * sizeof(WCHAR));
3016 InstallDir[Length - 1] = UNICODE_NULL;
3017
3018 Pos--;
3019 Length--;
3020 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3021 CONSOLE_SetCursorXY(8 + Pos, 11);
3022 }
3023 }
3024 else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3025 {
3026 if (Length < 50)
3027 {
3028 /* Only accept valid characters for the installation path */
3031 {
3032 if (Pos < Length)
3033 memmove(&InstallDir[Pos + 1],
3034 &InstallDir[Pos],
3035 (Length - Pos) * sizeof(WCHAR));
3036 InstallDir[Length + 1] = UNICODE_NULL;
3037 InstallDir[Pos] = c;
3038
3039 Pos++;
3040 Length++;
3041 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3042 CONSOLE_SetCursorXY(8 + Pos, 11);
3043 }
3044 }
3045 }
3046 }
3047
3048InitInstallDir:
3050 if (!NT_SUCCESS(Status))
3051 {
3052 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
3054 return QUIT_PAGE;
3055 }
3056
3057 /*
3058 * Check whether the user attempts to install ReactOS within the
3059 * installation source directory, or in a subdirectory thereof.
3060 * If so, fail with an error.
3061 */
3063 {
3066 }
3067
3068 return PREPARE_COPY_PAGE;
3069}
3070
3071
3072/*
3073 * Displays the PrepareCopyPage.
3074 *
3075 * Next pages:
3076 * FileCopyPage(At once)
3077 * QuitPage
3078 *
3079 * SIDEEFFECTS
3080 * Calls PrepareFileCopy
3081 *
3082 * RETURNS
3083 * Number of the next page.
3084 */
3085static PAGE_NUMBER
3087{
3088 // ERROR_NUMBER ErrorNumber;
3090
3092
3093 /* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
3094 if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
3095 {
3096 // MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
3097 return QUIT_PAGE;
3098 }
3099
3100 return FILE_COPY_PAGE;
3101}
3102
3103typedef struct _COPYCONTEXT
3104{
3110
3111static VOID
3114{
3116
3117 /* Get the memory information from the system */
3119 &PerfInfo,
3120 sizeof(PerfInfo),
3121 NULL);
3122
3123 /* Check if this is initial setup */
3124 if (First)
3125 {
3126 /* Set maximum limits to be total RAM pages */
3127 ProgressSetStepCount(CopyContext->MemoryBars[0], PerfInfo.CommitLimit);
3128 ProgressSetStepCount(CopyContext->MemoryBars[1], PerfInfo.CommitLimit);
3129 ProgressSetStepCount(CopyContext->MemoryBars[2], PerfInfo.CommitLimit);
3130 }
3131
3132 /* Set current values */
3133 ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages + PerfInfo.NonPagedPoolPages);
3134 ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.ResidentSystemCachePage);
3135 ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages);
3136}
3137
3138static UINT
3142 UINT_PTR Param1,
3143 UINT_PTR Param2)
3144{
3146 PFILEPATHS_W FilePathInfo;
3147 PCWSTR SrcFileName, DstFileName;
3148
3149 switch (Notification)
3150 {
3152 {
3153 CopyContext->TotalOperations = (ULONG)Param2;
3154 CopyContext->CompletedOperations = 0;
3155 ProgressSetStepCount(CopyContext->ProgressBar,
3156 CopyContext->TotalOperations);
3158 break;
3159 }
3160
3164 {
3165 FilePathInfo = (PFILEPATHS_W)Param1;
3166
3168 {
3169 /* Display delete message */
3170 ASSERT(Param2 == FILEOP_DELETE);
3171
3172 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3173 if (DstFileName) ++DstFileName;
3174 else DstFileName = FilePathInfo->Target;
3175
3177 DstFileName);
3178 }
3180 {
3181 /* Display move/rename message */
3182 ASSERT(Param2 == FILEOP_RENAME);
3183
3184 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
3185 if (SrcFileName) ++SrcFileName;
3186 else SrcFileName = FilePathInfo->Source;
3187
3188 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3189 if (DstFileName) ++DstFileName;
3190 else DstFileName = FilePathInfo->Target;
3191
3192 if (!_wcsicmp(SrcFileName, DstFileName))
3193 Param2 = STRING_MOVING;
3194 else
3195 Param2 = STRING_RENAMING;
3196
3198 SrcFileName, DstFileName);
3199 }
3201 {
3202 static PCSTR s_pszCopying = NULL; /* Cached for speed */
3203
3204 /* Display copy message */
3205 ASSERT(Param2 == FILEOP_COPY);
3206
3207 /* NOTE: When extracting from CABs the Source is the CAB name */
3208 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3209 if (DstFileName) ++DstFileName;
3210 else DstFileName = FilePathInfo->Target;
3211
3212 if (!s_pszCopying)
3213 s_pszCopying = MUIGetString(STRING_COPYING);
3214 CONSOLE_SetStatusText(s_pszCopying, DstFileName);
3215#ifdef __REACTOS__ /* HACK */
3216 DoWatchDestFileName(DstFileName);
3217#endif
3218 }
3219
3221 break;
3222 }
3223
3225 {
3226 FilePathInfo = (PFILEPATHS_W)Param1;
3227
3228 DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
3229 FilePathInfo->Target, FilePathInfo->Win32Error);
3230 return FILEOP_SKIP;
3231 }
3232
3236 {
3237 CopyContext->CompletedOperations++;
3238
3239 /* SYSREG checkpoint */
3240 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
3241 DPRINT1("CHECKPOINT:HALF_COPIED\n");
3242
3243 ProgressNextStep(CopyContext->ProgressBar);
3245 break;
3246 }
3247 }
3248
3249 return FILEOP_DOIT;
3250}
3251
3252
3253/*
3254 * Displays the FileCopyPage.
3255 *
3256 * Next pages:
3257 * RegistryPage(At once)
3258 *
3259 * SIDEEFFECTS
3260 * Calls DoFileCopy
3261 *
3262 * RETURNS
3263 * Number of the next page.
3264 */
3265static PAGE_NUMBER
3267{
3269 UINT MemBarWidth;
3270
3272
3273 /* Create context for the copy process */
3274 CopyContext.TotalOperations = 0;
3275 CopyContext.CompletedOperations = 0;
3276
3277 /* Create the progress bar as well */
3278 CopyContext.ProgressBar = CreateProgressBar(13,
3279 26,
3280 xScreen - 13,
3281 yScreen - 20,
3282 10,
3283 24,
3284 TRUE,
3286
3287 // fit memory bars to screen width, distribute them uniform
3288 MemBarWidth = (xScreen - 26) / 5;
3289 MemBarWidth -= MemBarWidth % 2; // make even
3290 /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
3291 /* Create the paged pool progress bar */
3292 CopyContext.MemoryBars[0] = CreateProgressBar(13,
3293 40,
3294 13 + MemBarWidth,
3295 43,
3296 13,
3297 44,
3298 FALSE,
3299 "Kernel Pool");
3300
3301 /* Create the non paged pool progress bar */
3302 CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (MemBarWidth / 2),
3303 40,
3304 (xScreen / 2) + (MemBarWidth / 2),
3305 43,
3306 (xScreen / 2)- (MemBarWidth / 2),
3307 44,
3308 FALSE,
3309 "Kernel Cache");
3310
3311 /* Create the global memory progress bar */
3312 CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - MemBarWidth,
3313 40,
3314 xScreen - 13,
3315 43,
3316 xScreen - 13 - MemBarWidth,
3317 44,
3318 FALSE,
3319 "Free Memory");
3320
3321 /* Do the file copying */
3323
3324 /* If we get here, we're done, so cleanup the progress bar */
3325 DestroyProgressBar(CopyContext.ProgressBar);
3326 DestroyProgressBar(CopyContext.MemoryBars[0]);
3327 DestroyProgressBar(CopyContext.MemoryBars[1]);
3328 DestroyProgressBar(CopyContext.MemoryBars[2]);
3329
3330 /* Create the $winnt$.inf file */
3332
3333 /* Go display the next page */
3334 return REGISTRY_PAGE;
3335}
3336
3337
3338static VOID
3339__cdecl
3341{
3342 /* WARNING: Please keep this lookup table in sync with the resources! */
3343 static const UINT StringIDs[] =
3344 {
3345 STRING_DONE, /* Success */
3346 STRING_REGHIVEUPDATE, /* RegHiveUpdate */
3347 STRING_IMPORTFILE, /* ImportRegHive */
3348 STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
3349 STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
3350 STRING_ADDKBLAYOUTS, /* KeybLayouts */
3351 STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
3352 STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
3353 };
3354
3355 va_list args;
3356
3357 if (RegStatus < ARRAYSIZE(StringIDs))
3358 {
3359 va_start(args, RegStatus);
3360 CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
3361 va_end(args);
3362 }
3363 else
3364 {
3365 CONSOLE_SetStatusText("Unknown status %d", RegStatus);
3366 }
3367}
3368
3369/*
3370 * Displays the RegistryPage.
3371 *
3372 * Next pages:
3373 * BootLoaderSelectPage
3374 * QuitPage
3375 *
3376 * SIDEEFFECTS
3377 * Calls UpdateRegistry
3378 *
3379 * RETURNS
3380 * Number of the next page.
3381 */
3382static PAGE_NUMBER
3384{
3385 ULONG Error;
3386
3388
3392 InstallVolume->Info.DriveLetter,
3395 &s_SubstSettings);
3396 if (Error != ERROR_SUCCESS)
3397 {
3399 return QUIT_PAGE;
3400 }
3401 else
3402 {
3405 }
3406}
3407
3408
3409/*
3410 * Displays the BootLoaderSelectPage.
3411 *
3412 * Next pages:
3413 * SuccessPage
3414 * QuitPage
3415 *
3416 * RETURNS
3417 * Number of the next page.
3418 */
3419static PAGE_NUMBER
3421{
3422 USHORT Line = 12;
3423
3425
3426 /* We must have a supported system partition by now */
3428
3429 /*
3430 * If we repair an existing installation and we made it up to here,
3431 * this means a valid bootloader and boot entry have been found.
3432 * Thus, there is no need to re-install it: skip its installation.
3433 */
3434 if (RepairUpdateFlag)
3435 {
3437 goto Quit;
3438 }
3439
3440 /* For unattended setup, skip MBR installation or install on removable disk if needed */
3442 {
3443 if ((USetupData.BootLoaderLocation == 0) ||
3445 {
3446 goto Quit;
3447 }
3448 }
3449
3450#if 0 // Deprecated code, whose global logic may need to be moved elsewhere...
3451 /*
3452 * We may install an MBR or VBR, but before that, check whether
3453 * we need to actually install the VBR on removable disk if the
3454 * system partition is not recognized.
3455 */
3456 if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
3458 {
3460 goto Quit;
3461 }
3462#endif
3463
3464 /* Is it an unattended install on hdd? */
3466 {
3467 if ((USetupData.BootLoaderLocation == 2) ||
3469 {
3470 goto Quit;
3471 }
3472 }
3473
3475 CONSOLE_InvertTextXY(8, Line, 60, 1);
3476
3477 while (TRUE)
3478 {
3479 CONSOLE_ConInKey(Ir);
3480
3481 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3482 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
3483 {
3484 CONSOLE_NormalTextXY(8, Line, 60, 1);
3485
3486 Line++;
3487 if (Line < 12)
3488 Line = 15;
3489
3490 if (Line > 15)
3491 Line = 12;
3492
3493 CONSOLE_InvertTextXY(8, Line, 60, 1);
3494 }
3495 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3496 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
3497 {
3498 CONSOLE_NormalTextXY(8, Line, 60, 1);
3499
3500 Line--;
3501 if (Line < 12)
3502 Line = 15;
3503
3504 if (Line > 15)
3505 Line = 12;
3506
3507 CONSOLE_InvertTextXY(8, Line, 60, 1);
3508 }
3509 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3510 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3511 {
3512 CONSOLE_NormalTextXY(8, Line, 60, 1);
3513
3514 Line = 12;
3515
3516 CONSOLE_InvertTextXY(8, Line, 60, 1);
3517 }
3518 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3519 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3520 {
3521 CONSOLE_NormalTextXY(8, Line, 60, 1);
3522
3523 Line = 15;
3524
3525 CONSOLE_InvertTextXY(8, Line, 60, 1);
3526 }
3527 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3528 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3529 {
3530 if (ConfirmQuit(Ir))
3531 return QUIT_PAGE;
3532 break;
3533 }
3534 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3535 {
3536 if (Line == 12)
3537 {
3538 /* Install on both MBR and VBR */
3540 break;
3541 }
3542 else if (Line == 13)
3543 {
3544 /* Install on VBR only */
3546 break;
3547 }
3548 else if (Line == 14)
3549 {
3550 /* Install on removable disk */
3552 break;
3553 }
3554 else if (Line == 15)
3555 {
3556 /* Skip installation */
3558 break;
3559 }
3560
3562 }
3563 }
3564
3565Quit:
3566 /* Continue the installation; the bootloader is installed at the end */
3568}
3569
3570
3571/*
3572 * Installs the bootloader on removable disk.
3573 */
3574static BOOLEAN
3576{
3578
3579Retry:
3581 CONSOLE_Flush();
3583// CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
3584
3585 while (TRUE)
3586 {
3587 CONSOLE_ConInKey(Ir);
3588
3589 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3590 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3591 {
3592 if (ConfirmQuit(Ir))
3593 return FALSE;
3594 break;
3595 }
3596 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3597 {
3598 // FIXME: So far USETUP only supports the 1st floppy.
3599 static const UNICODE_STRING FloppyDrive = RTL_CONSTANT_STRING(L"\\Device\\Floppy0\\");
3601 &FloppyDrive,
3604 if (Status == STATUS_SUCCESS)
3605 return TRUE; /* Successful installation */
3606
3608 {
3610 }
3611 else if (!NT_SUCCESS(Status))
3612 {
3613 /* Any other NTSTATUS failure code */
3615
3616 DPRINT1("InstallBootcodeToRemovable() failed: Status 0x%lx\n", Status);
3618 "Setup could not install the bootloader.\n"
3619 "(Status 0x%08lx).\n"
3620 "Press ENTER to continue anyway.",
3621 Status);
3624 Ir, POPUP_WAIT_ENTER);
3625 }
3626 goto Retry;
3627 }
3628 }
3629 goto Retry;
3630}
3631
3632/*
3633 * Installs the bootloader on hard-disk.
3634 */
3635static BOOLEAN
3637{
3639
3640 /* Copy FreeLoader to the disk and save the boot entries */
3647 ? 1 /* Install MBR and VBR */
3648 : 0 /* Install VBR only */);
3649 if (Status == STATUS_SUCCESS)
3650 return TRUE; /* Successful installation */
3651
3652 if (Status == ERROR_WRITE_BOOT)
3653 {
3654 /* Error when writing the VBR */
3656 SystemVolume->Info.FileSystem);
3657 }
3658 else if (Status == ERROR_INSTALL_BOOTCODE)
3659 {
3660 /* Error when writing the MBR */
3662 }
3663 else if (Status == STATUS_NOT_SUPPORTED)
3664 {
3665 PopupError("Setup does not currently support installing\n"
3666 "the bootloader on the computer you are using.\n"
3667 "Press ENTER to continue anyway.",
3669 Ir, POPUP_WAIT_ENTER);
3670 }
3671 else if (!NT_SUCCESS(Status))
3672 {
3673 /* Any other NTSTATUS failure code */
3675
3676 DPRINT1("InstallBootManagerAndBootEntries() failed: Status 0x%lx\n", Status);
3678 "Setup could not install the bootloader.\n"
3679 "(Status 0x%08lx).\n"
3680 "Press ENTER to continue anyway.",
3681 Status);
3684 Ir, POPUP_WAIT_ENTER);
3685 }
3686 return FALSE;
3687}
3688
3689/*
3690 * Actually installs the bootloader at the end of the installation.
3691 * The bootloader installation place has already been chosen before,
3692 * see BootLoaderSelectPage().
3693 *
3694 * Next pages:
3695 * SuccessPage (At once)
3696 * QuitPage
3697 *
3698 * RETURNS
3699 * Number of the next page.
3700 */
3701static PAGE_NUMBER
3703{
3705
3707 RtlStringCchPrintfW(PathBuffer, _countof(PathBuffer),
3708 L"%s\\", SystemPartition->DeviceName);
3710 DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
3711
3714
3716 {
3717 /* Install on removable disk */
3718 case 1:
3720
3721 /* Install on hard-disk */
3722 case 2: // System partition / MBR and VBR (on BIOS-based PC)
3723 case 3: // VBR only (on BIOS-based PC)
3725
3726 /* Skip installation */
3727 case 0:
3728 default:
3729 return SUCCESS_PAGE;
3730 }
3731}
3732
3733
3756static
3760 IN BOOLEAN AlwaysUpdate,
3761 OUT PSTR Buffer,
3762 IN SIZE_T cchBufferSize)
3763{
3764 ULONG OldProgress = Bar->Progress;
3765
3766 if (Bar->StepCount == 0)
3767 {
3768 Bar->Progress = 0;
3769 }
3770 else
3771 {
3772 Bar->Progress = Bar->StepCount - Bar->CurrentStep;
3773 }
3774
3775 /* Build the progress string if it has changed */
3776 if (Bar->ProgressFormatText &&
3777 (AlwaysUpdate || (Bar->Progress != OldProgress)))
3778 {
3779 RtlStringCchPrintfA(Buffer, cchBufferSize,
3780 Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
3781
3782 return TRUE;
3783 }
3784
3785 return FALSE;
3786}
3787
3804static VOID
3806 IN PINPUT_RECORD Ir,
3807 IN LONG TimeOut)
3808{
3810 ULONG StartTime, BarWidth, TimerDiv;
3811 LONG TimeElapsed;
3812 LONG TimerValue, OldTimerValue;
3815 BOOLEAN RefreshProgress = TRUE;
3816
3817 /* Bail out if the timeout is already zero */
3818 if (TimeOut <= 0)
3819 return;
3820
3821 /* Create the timeout progress bar and set it up */
3823 26,
3824 xScreen - 13,
3825 yScreen - 20,
3826 10,
3827 24,
3828 TRUE,
3830 0,
3831 NULL,
3834
3835 BarWidth = max(1, ProgressBar->Width);
3836 TimerValue = TimeOut * BarWidth;
3837 ProgressSetStepCount(ProgressBar, TimerValue);
3838
3840 CONSOLE_Flush();
3841
3842 TimerDiv = 1000 / BarWidth;
3843 TimerDiv = max(1, TimerDiv);
3844 OldTimerValue = TimerValue;
3845 while (TRUE)
3846 {
3847 /* Decrease the timer */
3848
3849 /*
3850 * Compute how much time the previous operations took.
3851 * This allows us in particular to take account for any time
3852 * elapsed if something slowed down.
3853 */
3854 TimeElapsed = NtGetTickCount() - StartTime;
3855 if (TimeElapsed >= TimerDiv)
3856 {
3857 /* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
3858 TimeElapsed /= TimerDiv;
3859 StartTime += (TimerDiv * TimeElapsed);
3860
3861 if (TimeElapsed <= TimerValue)
3862 TimerValue -= TimeElapsed;
3863 else
3864 TimerValue = 0;
3865
3866 RefreshProgress = TRUE;
3867 }
3868
3869 if (RefreshProgress)
3870 {
3871 ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
3872 RefreshProgress = FALSE;
3873 }
3874
3875 /* Stop when the timer reaches zero */
3876 if (TimerValue <= 0)
3877 break;
3878
3879 /* Check for user key presses */
3880
3881 /*
3882 * If the timer is used, use a passive wait of maximum 1 second
3883 * while monitoring for incoming console input events, so that
3884 * we are still able to display the timing count.
3885 */
3886
3887 /* Wait a maximum of 1 second for input events */
3888 TimeElapsed = NtGetTickCount() - StartTime;
3889 if (TimeElapsed < TimerDiv)
3890 {
3891 /* Convert the time to NT format */
3892 Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
3894 }
3895 else
3896 {
3898 }
3899
3900 /* Check whether the input event has been signaled, or a timeout happened */
3901 if (Status == STATUS_TIMEOUT)
3902 {
3903 continue;
3904 }
3905 if (Status != STATUS_WAIT_0)
3906 {
3907 /* An error happened, bail out */
3908 DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
3909 break;
3910 }
3911
3912 /* Check for an ENTER key press */
3913 while (CONSOLE_ConInKeyPeek(Ir))
3914 {
3915 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3916 {
3917 /* Found it, stop waiting */
3918 goto Exit;
3919 }
3920 }
3921 }
3922
3923Exit:
3924 /* Destroy the progress bar and quit */
3926}
3927
3928
3929/*
3930 * Displays the QuitPage.
3931 *
3932 * Next pages:
3933 * FlushPage (At once)
3934 *
3935 * SIDEEFFECTS
3936 * Destroy the Lists
3937 *
3938 * RETURNS
3939 * Number of the next page.
3940 */
3941static PAGE_NUMBER
3943{
3945
3946 /* Destroy the NTOS installations list */
3947 if (NtOsInstallsList != NULL)
3948 {
3951 }
3952
3953 /* Destroy the partition list */
3954 if (PartitionList != NULL)
3955 {
3958 }
3959
3961
3963 return FLUSH_PAGE;
3964
3965 /* Wait for maximum 15 seconds or an ENTER key before quitting */
3966 ProgressCountdown(Ir, 15);
3967 return FLUSH_PAGE;
3968}
3969
3970
3971/*
3972 * Displays the SuccessPage.
3973 *
3974 * Next pages:
3975 * FlushPage (At once)
3976 *
3977 * SIDEEFFECTS
3978 * Destroy the Lists
3979 *
3980 * RETURNS
3981 * Number of the next page.
3982 */
3983static PAGE_NUMBER
3985{
3987
3989 return FLUSH_PAGE;
3990
3991 /* Wait for maximum 15 seconds or an ENTER key before quitting */
3992 ProgressCountdown(Ir, 15);
3993 return FLUSH_PAGE;
3994}
3995
3996
3997/*
3998 * Displays the FlushPage.
3999 *
4000 * Next pages:
4001 * RebootPage (At once)
4002 *
4003 * RETURNS
4004 * Number of the next page.
4005 */
4006static PAGE_NUMBER
4008{
4010 return REBOOT_PAGE;
4011}
4012
4013
4014/*
4015 * The start routine and page management
4016 */
4019{
4021 INPUT_RECORD Ir;
4023 BOOLEAN Old;
4024
4026
4027 /* Tell the Cm this is a setup boot, and it has to behave accordingly */
4029 if (!NT_SUCCESS(Status))
4030 DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
4031
4032 /* Initialize the user-mode PnP manager */
4034 if (!NT_SUCCESS(Status))
4035 {
4036 // PrintString(??);
4037 DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
4038 }
4039
4040 if (!CONSOLE_Init())
4041 {
4045
4046 /* We failed to initialize the video, just quit the installer */
4048 }
4049
4050 /* Hide the cursor and clear the screen and keyboard buffer */
4053 CONSOLE_Flush();
4054
4055 /* Global Initialization page */
4056 Page = SetupStartPage(&Ir);
4057
4058 while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
4059 {
4061 CONSOLE_Flush();
4062
4063 // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4064
4065 switch (Page)
4066 {
4067 /* Language page */
4068 case LANGUAGE_PAGE:
4069 Page = LanguagePage(&Ir);
4070 break;
4071
4072 /* Welcome page */
4073 case WELCOME_PAGE:
4074 Page = WelcomePage(&Ir);
4075 break;
4076
4077 /* License page */
4078 case LICENSE_PAGE:
4079 Page = LicensePage(&Ir);
4080 break;
4081
4082 /* Install pages */
4083 case INSTALL_INTRO_PAGE:
4084 Page = InstallIntroPage(&Ir);
4085 break;
4086
4087#if 0
4088 case SCSI_CONTROLLER_PAGE:
4089 Page = ScsiControllerPage(&Ir);
4090 break;
4091
4092 case OEM_DRIVER_PAGE:
4093 Page = OemDriverPage(&Ir);
4094 break;
4095#endif
4096
4098 Page = DeviceSettingsPage(&Ir);
4099 break;
4100
4103 break;
4104
4107 break;
4108
4111 break;
4112
4114 Page = LayoutSettingsPage(&Ir);
4115 break;
4116
4117 /* Partitioning pages */
4120 break;
4121
4124 break;
4125
4128 break;
4129
4132 break;
4133
4134 /* File system partition operations pages */
4137 break;
4138
4139 /* Bootloader selection page */
4142 break;
4143
4144 /* Installation pages */
4147 break;
4148
4149 case PREPARE_COPY_PAGE:
4150 Page = PrepareCopyPage(&Ir);
4151 break;
4152
4153 case FILE_COPY_PAGE:
4154 Page = FileCopyPage(&Ir);
4155 break;
4156
4157 case REGISTRY_PAGE:
4158 Page = RegistryPage(&Ir);
4159 break;
4160
4161 /* Bootloader installation page */
4163 // case BOOTLOADER_REMOVABLE_DISK_PAGE:
4165 break;
4166
4167 /* Repair pages */
4168 case REPAIR_INTRO_PAGE:
4169 Page = RepairIntroPage(&Ir);
4170 break;
4171
4173 Page = UpgradeRepairPage(&Ir);
4174 break;
4175
4176 case SUCCESS_PAGE:
4177 Page = SuccessPage(&Ir);
4178 break;
4179
4180 case FLUSH_PAGE:
4181 Page = FlushPage(&Ir);
4182 break;
4183
4184 case QUIT_PAGE:
4185 Page = QuitPage(&Ir);
4186 break;
4187
4188 /* Virtual pages */
4189 case SETUP_INIT_PAGE:
4192 // case CHECK_FILE_SYSTEM_PAGE:
4193 case REBOOT_PAGE:
4194 case RECOVERY_PAGE:
4195 break;
4196
4197 default:
4198 break;
4199 }
4200 }
4201
4202 /* Terminate the user-mode PnP manager */
4204
4205 /* Setup has finished */
4207
4208 if (Page == RECOVERY_PAGE)
4210
4211 FreeConsole();
4212
4213 /* Reboot */
4217
4218 return STATUS_SUCCESS;
4219}
4220
4221
4222VOID NTAPI
4224{
4227
4229
4231
4233
4234 Status = RunUSetup();
4235
4236 if (NT_SUCCESS(Status))
4237 {
4238 /*
4239 * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
4240 * a protective waiting.
4241 * This wait is needed because, since we are started as SMSS.EXE,
4242 * the NT kernel explicitly waits 5 seconds for the initial process
4243 * SMSS.EXE to initialize (as a protective measure), and otherwise
4244 * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
4245 */
4246 Time.QuadPart += 50000000;
4248 }
4249 else
4250 {
4251 /* The installer failed to start: raise a hard error (crash the system/BSOD) */
4253 0, 0, NULL, 0, NULL);
4254 }
4255
4257}
4258
4259/* EOF */
DWORD Id
WCHAR First[]
Definition: FormatMessage.c:11
#define isprint(c)
Definition: acclib.h:73
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI PrepareFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
Definition: install.c:685
BOOLEAN NTAPI DoFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
Definition: install.c:828
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1072
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:524
ULONG GetDefaultLanguageIndex(VOID)
Definition: settings.c:1098
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:708
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1209
PGENERIC_LIST CreateLanguageList(IN HINF InfFile, OUT PWSTR DefaultLanguage)
Definition: settings.c:1159
struct _GENENTRY * PGENENTRY
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:407
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:560
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
Definition: console.c:525
NTSTATUS InitializeUserModePnpManager(IN HINF *phSetupInf)
Definition: devinst.c:559
VOID TerminateUserModePnpManager(VOID)
Definition: devinst.c:690
NTSTATUS WaitNoPendingInstallEvents(IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: devinst.c:514
BOOLEAN EnableUserModePnpManager(VOID)
Definition: devinst.c:521
VOID ProgressSetStep(IN PPROGRESSBAR Bar, IN ULONG Step)
Definition: progress.c:368
VOID ProgressNextStep(IN PPROGRESSBAR Bar)
Definition: progress.c:361
PPROGRESSBAR CreateProgressBarEx(IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN SHORT ProgressColour, IN ULONG StepCount, IN PCSTR DescriptionText OPTIONAL, IN PCSTR ProgressFormatText OPTIONAL, IN PUPDATE_PROGRESS UpdateProgressProc OPTIONAL)
Definition: progress.c:272
VOID ProgressSetStepCount(IN PPROGRESSBAR Bar, IN ULONG StepCount)
Definition: progress.c:347
PPROGRESSBAR CreateProgressBar(IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN PCSTR DescriptionText OPTIONAL)
Definition: progress.c:317
VOID DestroyProgressBar(IN OUT PPROGRESSBAR Bar)
Definition: progress.c:339
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
BOOL Error
Definition: chkdsk.c:66
#define BACKGROUND_BLUE
Definition: blue.h:65
#define FOREGROUND_RED
Definition: blue.h:63
NTSTATUS NTAPI InstallBootcodeToRemovable(_In_ ARCHITECTURE_TYPE ArchType, _In_ PCUNICODE_STRING RemovableRootPath, _In_ PCUNICODE_STRING SourceRootPath, _In_ PCUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1830
NTSTATUS NTAPI InstallBootManagerAndBootEntries(_In_ ARCHITECTURE_TYPE ArchType, _In_ PCUNICODE_STRING SystemRootPath, _In_ PCUNICODE_STRING SourceRootPath, _In_ PCUNICODE_STRING DestinationArcPath, _In_ ULONG_PTR Options)
Installs FreeLoader on the system and configure the boot entries.
Definition: bootsup.c:1674
Definition: bufpool.h:45
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
VOID RecoveryConsole(VOID)
Definition: cmdcons.c:1160
char * Text
Definition: combotst.c:136
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
BOOL CONSOLE_Flush(VOID)
Definition: consup.c:175
VOID CONSOLE_SetInputTextXY(IN SHORT x, IN SHORT y, IN SHORT len, IN LPCWSTR Text)
Definition: consup.c:357
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:276
VOID CONSOLE_SetCursorXY(IN SHORT x, IN SHORT y)
Definition: consup.c:227
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:298
SHORT yScreen
Definition: consup.c:40
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:480
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:320
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:595
VOID CONSOLE_ClearScreen(VOID)
Definition: consup.c:239
BOOLEAN CONSOLE_Init(VOID)
Definition: consup.c:45
VOID CONSOLE_SetStatusTextV(IN LPCSTR fmt, IN va_list args)
Definition: consup.c:471
BOOLEAN CONSOLE_ConInKeyPeek(OUT PINPUT_RECORD Buffer)
Definition: consup.c:89
VOID CONSOLE_SetCursorType(IN BOOL bInsert, IN BOOL bVisible)
Definition: consup.c:214
HANDLE StdOutput
Definition: consup.c:37
HANDLE StdInput
Definition: consup.c:36
#define TEXT_TYPE_REGULAR
Definition: consup.h:39
#define BACKGROUND_WHITE
Definition: consup.h:31
#define STATUS_TIMEOUT
Definition: d3dkmdt.h:49
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
ush Pos
Definition: deflate.h:92
#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
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define wcsrchr
Definition: compat.h:16
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
PPEB Peb
Definition: dllmain.c:27
BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole(void)
Definition: console.c:663
BOOL WINAPI CopyContext(CONTEXT *dst, DWORD context_flags, CONTEXT *src)
Definition: memory.c:1633
unsigned char ch[4][2]
Definition: console.c:118
int CDECL toupper(int c)
Definition: ctype.c:514
#define __cdecl
Definition: corecrt.h:121
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2917
_ACRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2890
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
_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
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vsprintf(char *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
char * va_list
Definition: vadefs.h:50
@ AnsiString
Definition: dnslib.h:19
static VOID DrawPartitionList(_In_ HWND hWndList, _In_ PPARTLIST List)
Definition: drivepage.c:1373
#define L(x)
Definition: resources.c:13
static PDISK_IMAGE FloppyDrive[2]
Definition: dskbios32.c:36
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
@ ERROR_SOURCE_DIR
Definition: errorcode.h:21
@ ERROR_LOAD_KBLAYOUT
Definition: errorcode.h:32
@ ERROR_LOAD_KEYBOARD
Definition: errorcode.h:31
@ ERROR_WRITE_BOOT
Definition: errorcode.h:28
@ NOT_AN_ERROR
Definition: errorcode.h:17
@ ERROR_DIRECTORY_NAME
Definition: errorcode.h:56
@ ERROR_LAST_ERROR_CODE
Definition: errorcode.h:62
@ ERROR_LOAD_DISPLAY
Definition: errorcode.h:30
@ ERROR_DRIVE_INFORMATION
Definition: errorcode.h:27
@ ERROR_INSUFFICIENT_PARTITION_SIZE
Definition: errorcode.h:57
@ ERROR_LOAD_COMPUTER
Definition: errorcode.h:29
@ ERROR_SOURCE_PATH
Definition: errorcode.h:20
@ ERROR_NO_BUILD_PATH
Definition: errorcode.h:19
@ ERROR_WRITE_PTABLE
Definition: errorcode.h:51
@ ERROR_NO_HDD
Definition: errorcode.h:22
@ ERROR_FORMATTING_PARTITION
Definition: errorcode.h:60
@ ERROR_INSTALL_BOOTCODE
Definition: errorcode.h:35
@ ERROR_NO_FLOPPY
Definition: errorcode.h:36
@ Success
Definition: eventcreate.c:712
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define FILEOP_COPY
Definition: fileqsup.h:42
struct _FILEPATHS_W * PFILEPATHS_W
#define FILEOP_SKIP
Definition: fileqsup.h:49
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define SPFILENOTIFY_ENDCOPY
Definition: fileqsup.h:36
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
#define SPFILENOTIFY_COPYERROR
Definition: fileqsup.h:37
#define FILEOP_RENAME
Definition: fileqsup.h:43
#define SPFILENOTIFY_STARTRENAME
Definition: fileqsup.h:31
#define SPFILENOTIFY_ENDRENAME
Definition: fileqsup.h:32
#define FILEOP_DELETE
Definition: fileqsup.h:44
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID EndCheck(_In_ NTSTATUS Status)
Definition: fmtchk.c:150
VOID StartCheck(_Inout_ PCHECK_VOLUME_INFO ChkInfo)
Definition: fmtchk.c:127
VOID StartFormat(_Inout_ PFORMAT_VOLUME_INFO FmtInfo, _In_ PFILE_SYSTEM_ITEM SelectedFileSystem)
Definition: fmtchk.c:70
static PPROGRESSBAR ProgressBar
Definition: fmtchk.c:17
VOID EndFormat(_In_ NTSTATUS Status)
Definition: fmtchk.c:97
VOID ScrollUpFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:236
VOID DrawFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:167
VOID ScrollDownFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:225
PFILE_SYSTEM_LIST CreateFileSystemList(IN SHORT Left, IN SHORT Top, IN BOOLEAN ForceFormat, IN PCWSTR SelectFileSystem)
Definition: fslist.c:109
VOID DestroyFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:149
Status
Definition: gdiplustypes.h:24
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLfloat GLfloat p
Definition: glext.h:8902
unsigned int UINT
Definition: sysinfo.c:13
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
VOID InfSetHeap(PVOID Heap)
Definition: infrosgen.c:40
static LARGE_INTEGER StartTime
Definition: sys_arch.c:15
#define c
Definition: ke_i.h:80
KLID MUIDefaultKeyboardLayout(IN PCWSTR LanguageId)
Definition: mui.c:88
USHORT LANGID
Definition: mui.h:9
ULONG KLID
Definition: mui.h:10
SPFILE_EXPORTS SpFileExports
Definition: fileqsup.c:23
SPINF_EXPORTS SpInfExports
Definition: infsupp.c:24
ULONG NTAPI GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:149
VOID NTAPI SetCurrentListEntry(IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:91
VOID NTAPI DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:38
PGENERIC_LIST_ENTRY NTAPI GetFirstListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:110
PGENERIC_LIST_ENTRY NTAPI GetNextListEntry(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:121
PGENERIC_LIST_ENTRY NTAPI GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:102
PVOID NTAPI GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:134
struct _PARTENTRY * PPARTENTRY
Definition: partlist.h:42
@ Unformatted
Definition: partlist.h:34
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:255
if(dx< 0)
Definition: linetemp.h:194
#define SystemPerformanceInformation
Definition: memtest.h:87
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define ASSERT(a)
Definition: mode.c:44
void Cancel(int sigNum)
Definition: shell.c:481
@ PARTITION_STYLE_MBR
Definition: imports.h:201
void Bar(void)
Definition: terminate.cpp:70
#define sprintf
Definition: sprintf.c:45
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:573
#define ULL(a, b)
Definition: format_msg.c:27
static PLARGE_INTEGER Time
Definition: time.c:37
#define min(a, b)
Definition: monoChain.cc:55
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define CM_BOOT_FLAG_SETUP
Definition: cmtypes.h:173
@ ShutdownReboot
Definition: extypes.h:177
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
NTSTATUS NTAPI NtDisplayString(PUNICODE_STRING String)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
#define NtCurrentProcess()
Definition: nt_native.h:1660
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:876
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
NTSTATUS NTAPI NtInitializeRegistry(IN USHORT Flag)
Definition: ntapi.c:1318
#define RTL_NUMBER_OF_FIELD(type, field)
Definition: ntbasedef.h:715
#define UNICODE_NULL
CONST CHAR * PCCH
Definition: ntbasedef.h:404
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:321
#define IsRecognizedPartition(PartitionType)
Definition: ntdddisk.h:342
@ FixedMedia
Definition: ntdddisk.h:383
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:563
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1305
#define STATUS_WAIT_0
Definition: ntstatus.h:330
#define STATUS_PARTITION_FAILURE
Definition: ntstatus.h:698
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:792
#define STATUS_APP_INIT_FAILURE
Definition: ntstatus.h:655
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1085
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
PGENERIC_LIST NTAPI CreateNTOSInstallationsList(_In_ PPARTLIST PartList)
Create a list of available NT OS installations on the computer, by searching for recognized ones on e...
Definition: osdetect.c:768
struct _NTOS_INSTALLATION * PNTOS_INSTALLATION
#define PARTITION_EXTENDED
Definition: part_mbr.h:55
short WCHAR
Definition: pedump.c:58
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
char CHAR
Definition: pedump.c:57
static ULONG Timeout
Definition: ping.c:61
_In_ UINT uID
Definition: shlwapi.h:156
#define NtGetTickCount
Definition: rtlp.h:163
@ Restart
Definition: sacdrv.h:269
wcscpy
strcpy
Definition: string.h:131
#define args
Definition: format.c:66
Entry
Definition: section.c:5216
BOOLEAN NTAPI FsVolCommitOpsQueue(_In_ PPARTLIST PartitionList, _In_ PVOLENTRY SystemVolume, _In_ PVOLENTRY InstallVolume, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Definition: fsutil.c:1097
@ FSVOLNOTIFY_STARTCHECK
Definition: fsutil.h:153
@ FSVOLNOTIFY_ENDQUEUE
Definition: fsutil.h:145
@ FSVOLNOTIFY_STARTSUBQUEUE
Definition: fsutil.h:146
@ FSVOLNOTIFY_ENDFORMAT
Definition: fsutil.h:151
@ FSVOLNOTIFY_STARTFORMAT
Definition: fsutil.h:150
@ FSVOLNOTIFY_STARTQUEUE
Definition: fsutil.h:144
@ FSVOLNOTIFY_ENDSUBQUEUE
Definition: fsutil.h:147
@ FSVOLNOTIFY_PARTITIONERROR
Definition: fsutil.h:149
@ FSVOLNOTIFY_CHECKERROR
Definition: fsutil.h:155
@ ChangeSystemPartition
Definition: fsutil.h:156
@ FSVOLNOTIFY_FORMATERROR
Definition: fsutil.h:152
@ FSVOLNOTIFY_ENDCHECK
Definition: fsutil.h:154
enum _FSVOL_OP FSVOL_OP
struct _FORMAT_VOLUME_INFO * PFORMAT_VOLUME_INFO
@ FSVOL_FORMAT
Definition: fsutil.h:162
@ FSVOL_CHECK
Definition: fsutil.h:163
@ FSVOL_DOIT
Definition: fsutil.h:166
@ FSVOL_ABORT
Definition: fsutil.h:165
@ FSVOL_RETRY
Definition: fsutil.h:167
@ FSVOL_SKIP
Definition: fsutil.h:168
enum _FSVOLNOTIFY FSVOLNOTIFY
struct _CHECK_VOLUME_INFO * PCHECK_VOLUME_INFO
ERROR_NUMBER NTAPI PartitionCreateChecks(_In_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2946
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:97
VOID NTAPI DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:2130
BOOLEAN NTAPI CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2975
BOOLEAN NTAPI DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
Definition: partlist.c:3075
BOOLEAN IsPartitionActive(IN PPARTENTRY PartEntry)
Definition: partlist.c:1962
PPARTLIST NTAPI CreatePartitionList(VOID)
Definition: partlist.c:2043
PPARTENTRY SelectPartition(_In_ PPARTLIST List, _In_ ULONG DiskNumber, _In_ ULONG PartitionNumber)
Definition: partlist.c:2333
VOID ScrollUpDownPartitionList(_In_ PPARTLIST_UI ListUi, _In_ BOOLEAN Direction)
Definition: partlist.c:819
VOID PartitionDescription(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:126
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:279
VOID InitPartitionListUi(IN OUT PPARTLIST_UI ListUi, IN PPARTLIST List, IN PPARTENTRY CurrentEntry OPTIONAL, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: partlist.c:329
#define ERROR_NOT_INSTALLED
Definition: setupapi.h:295
VOID NTAPI InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:208
ERROR_NUMBER NTAPI InitializeSetup(_Inout_ PUSETUP_DATA pSetupData, _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine, _In_ PSPFILE_EXPORTS pSpFileExports, _In_ PSPINF_EXPORTS pSpInfExports)
Definition: setuplib.c:1022
NTSTATUS NTAPI InitDestinationPaths(_Inout_ PUSETUP_DATA pSetupData, _In_ PCWSTR InstallationDir, _In_ PVOLENTRY Volume)
Definition: setuplib.c:866
BOOLEAN NTAPI InitSystemPartition(_In_ PPARTLIST PartitionList, _In_ PPARTENTRY InstallPartition, _Out_ PPARTENTRY *pSystemPartition, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Find or set the active system partition.
Definition: setuplib.c:681
BOOLEAN NTAPI CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:32
VOID NTAPI FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:1106
BOOLEAN NTAPI IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:781
ERROR_NUMBER NTAPI UpdateRegistry(IN OUT PUSETUP_DATA pSetupData, IN BOOLEAN RepairUpdateFlag, IN PPARTLIST PartitionList, IN WCHAR DestinationDriveLetter, IN PCWSTR SelectedLanguageId, IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
Definition: setuplib.c:1157
#define ERROR_SYSTEM_PARTITION_NOT_FOUND
Definition: setuplib.h:188
#define IS_VALID_INSTALL_PATH_CHAR(c)
Defines the class of characters valid for the installation directory.
Definition: setuplib.h:206
enum _REGISTRY_STATUS REGISTRY_STATUS
#define MB
Definition: setuplib.h:75
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
static void Exit(void)
Definition: sock.c:1330
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
_In_ PVOID Context
Definition: storport.h:2269
Definition: ncftp.h:79
NTSTATUS ErrorStatus
Definition: fsutil.h:191
PVOLENTRY Volume
Definition: fsutil.h:189
PPROGRESSBAR MemoryBars[4]
Definition: usetup.c:3108
ULONG TotalOperations
Definition: reactos.c:1763
ULONG CompletedOperations
Definition: reactos.c:1764
PPROGRESSBAR ProgressBar
Definition: usetup.c:3107
UINT Win32Error
Definition: fileqsup.h:62
PCWSTR Source
Definition: fileqsup.h:61
PCWSTR Target
Definition: fileqsup.h:60
PCWSTR FileSystem
Definition: fslist.h:34
PFILE_SYSTEM_ITEM Selected
Definition: fslist.h:42
BOOL bFoundFontMINGLIU
Definition: substset.h:5
BOOL bFoundFontGULIM
Definition: substset.h:10
BOOL bFoundFontMSGOTHIC
Definition: substset.h:8
BOOL bFoundFontMSSONG
Definition: substset.h:7
BOOL bFoundFontSIMSUN
Definition: substset.h:6
BOOL bFoundFontBATANG
Definition: substset.h:11
BOOL bFoundFontMSMINCHO
Definition: substset.h:9
NTSTATUS ErrorStatus
Definition: fsutil.h:175
PVOLENTRY Volume
Definition: fsutil.h:173
PCWSTR FileSystemName
Definition: fsutil.h:178
PAGE_NUMBER NextPageOnAbort
Definition: usetup.c:2270
PINPUT_RECORD Ir
Definition: usetup.c:2269
Definition: genlist.h:11
union _INPUT_RECORD::@3576 Event
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:296
union _KEY_EVENT_RECORD::@3575 uChar
WORD wVirtualKeyCode
Definition: wincon.h:263
ULONG PartitionNumber
Definition: osdetect.h:24
WCHAR InstallationName[MAX_PATH]
Definition: osdetect.h:26
UNICODE_STRING SystemNtPath
Definition: osdetect.h:21
PVOLENTRY Volume
Definition: osdetect.h:25
PCWSTR PathComponent
Definition: osdetect.h:22
BOOLEAN IsPartitioned
Definition: partlist.h:82
UCHAR PartitionType
Definition: partlist.h:73
BOOLEAN New
Definition: partlist.h:85
WCHAR DeviceName[MAX_PATH]
NT device name: "\Device\HarddiskM\PartitionN".
Definition: partlist.h:77
PVOLENTRY Volume
Definition: partlist.h:95
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
BOOLEAN LogicalPartition
Definition: partlist.h:79
ULONG PartitionNumber
Definition: partlist.h:75
PPARTENTRY CurrentPartition
Definition: partlist.h:43
PPARTENTRY SystemPartition
Definition: partlist.h:181
LIST_ENTRY DiskListHead
Definition: partlist.h:183
PVOID ProcessHeap
Definition: ntddk_ex.h:249
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
SHORT Width
Definition: progress.h:48
PGENERIC_LIST DisplayList
Definition: setuplib.h:139
LONG DestinationPartitionNumber
Definition: setuplib.h:130
PGENERIC_LIST LanguageList
Definition: setuplib.h:142
UNICODE_STRING SourcePath
Definition: setuplib.h:103
PGENERIC_LIST LayoutList
Definition: setuplib.h:141
PGENERIC_LIST ComputerList
Definition: setuplib.h:138
HINF SetupInf
Definition: setuplib.h:95
UNICODE_STRING SystemRootPath
Definition: setuplib.h:119
LONG FsType
Definition: setuplib.h:135
LONG AutoPartition
Definition: setuplib.h:134
UNICODE_STRING SourceRootPath
Definition: setuplib.h:101
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:157
LONG BootLoaderLocation
Definition: setuplib.h:132
UNICODE_STRING DestinationPath
Definition: setuplib.h:123
ARCHITECTURE_TYPE ArchType
Definition: setuplib.h:145
PGENERIC_LIST KeyboardList
Definition: setuplib.h:140
LANGID LanguageId
Definition: setuplib.h:154
UNICODE_STRING DestinationArcPath
Definition: setuplib.h:122
WCHAR LocaleID[9]
Definition: setuplib.h:153
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:156
LONG DestinationDiskNumber
Definition: setuplib.h:129
LONG FormatPartition
Definition: setuplib.h:133
FORMATSTATE FormatState
Definition: partlist.h:48
VOLINFO Info
Definition: partlist.h:47
BOOLEAN New
Definition: partlist.h:53
WCHAR DeviceName[MAX_PATH]
NT device name: "\Device\HarddiskVolumeN".
Definition: volutil.h:18
WCHAR FileSystem[MAX_PATH+1]
Definition: volutil.h:22
WCHAR DriveLetter
Definition: volutil.h:20
Definition: match.c:390
Definition: dsound.c:943
Definition: blue.h:25
SHORT Y
Definition: blue.h:27
SHORT X
Definition: blue.h:26
#define max(a, b)
Definition: svc.c:63
uint16_t * PWSTR
Definition: typedefs.h:56
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint64_t ULONGLONG
Definition: typedefs.h:67
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
VOID RedrawGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:511
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
VOID ScrollPageUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:454
VOID ScrollToPositionGenericList(IN PGENERIC_LIST_UI ListUi, IN ULONG uIndex)
Definition: genlist.c:476
VOID RestoreGenericListUiState(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:62
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
VOID ScrollDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:376
VOID ScrollPageDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:432
VOID DrawGenericListCurrentItem(IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc, IN SHORT Left, IN SHORT Top)
Definition: genlist.c:353
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
CHAR CharHorizontalLine
Definition: mui.c:39
CHAR CharUpperRightCorner
Definition: mui.c:42
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
VOID SetConsoleCodePage(VOID)
Definition: mui.c:537
CHAR CharLeftHorizLineAndVertLine
Definition: mui.c:46
CHAR CharVertLineAndRightHorizLine
Definition: mui.c:45
VOID MUIDisplayErrorV(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent, IN va_list args)
Definition: mui.c:199
CHAR CharLowerRightCorner
Definition: mui.c:44
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
CHAR CharUpperLeftCorner
Definition: mui.c:41
VOID MUIClearStyledText(IN ULONG Page, IN INT TextID, IN INT Flags)
Definition: mui.c:399
CHAR CharVerticalLine
Definition: mui.c:40
VOID MUIClearPage(IN ULONG page)
Definition: mui.c:142
CHAR CharLowerLeftCorner
Definition: mui.c:43
#define STRING_CONSOLEFAIL1
Definition: mui.h:165
#define STRING_CONSOLEFAIL3
Definition: mui.h:167
#define STRING_MAXSIZE
Definition: mui.h:179
#define STRING_CREATEPARTITION
Definition: mui.h:142
#define STRING_CONTINUE
Definition: mui.h:149
#define STRING_DELETEPARTITION
Definition: mui.h:136
#define STRING_CHOOSE_NEW_EXTENDED_PARTITION
Definition: mui.h:139
#define TEXT_ID_FORMAT_PROMPT
Definition: mui.h:129
#define STRING_KEYBOARDSETTINGSUPDATE
Definition: mui.h:161
#define STRING_PARTITIONSIZE
Definition: mui.h:137
#define STRING_CODEPAGEINFOUPDATE
Definition: mui.h:162
#define STRING_LOCALESETTINGSUPDATE
Definition: mui.h:160
#define STRING_IMPORTFILE
Definition: mui.h:158
#define STRING_ADDKBLAYOUTS
Definition: mui.h:187
#define STRING_COPYING
Definition: mui.h:155
#define STRING_REBOOTCOMPUTER2
Definition: mui.h:164
#define STRING_HDDISK1
Definition: mui.h:173
#define STRING_CHOOSE_NEW_PARTITION
Definition: mui.h:138
#define STRING_HDPARTSIZE
Definition: mui.h:141
#define STRING_INSTALLCREATELOGICAL
Definition: mui.h:134
#define STRING_DONE
Definition: mui.h:163
#define STRING_NONFORMATTEDSYSTEMPART
Definition: mui.h:146
#define STRING_PLEASEWAIT
Definition: mui.h:132
#define STRING_CONSOLEFAIL2
Definition: mui.h:166
#define STRING_INSTALLDELETEPARTITION
Definition: mui.h:135
#define STRING_NONFORMATTEDOTHERPART
Definition: mui.h:147
#define STRING_MOVING
Definition: mui.h:153
#define STRING_PARTFORMAT
Definition: mui.h:144
#define STRING_SETUPCOPYINGFILES
Definition: mui.h:156
#define STRING_REBOOTPROGRESSBAR
Definition: mui.h:188
#define STRING_DELETING
Definition: mui.h:152
#define STRING_DISPLAYSETTINGSUPDATE
Definition: mui.h:159
#define STRING_RENAMING
Definition: mui.h:154
#define STRING_INSTALLCREATEPARTITION
Definition: mui.h:133
#define STRING_HDDISK2
Definition: mui.h:174
#define STRING_CHOOSE_NEW_LOGICAL_PARTITION
Definition: mui.h:140
#define STRING_REGHIVEUPDATE
Definition: mui.h:157
#define STRING_INSTALLONPART
Definition: mui.h:148
#define STRING_QUITCONTINUE
Definition: mui.h:150
#define STRING_NEWPARTITION
Definition: mui.h:143
#define STRING_NONFORMATTEDPART
Definition: mui.h:145
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:498
#define PARTITION_SIZE_INPUT_FIELD_LENGTH
Definition: usetup.c:1846
static VOID ProgressCountdown(IN PINPUT_RECORD Ir, IN LONG TimeOut)
Definition: usetup.c:3805
static PAGE_NUMBER DeviceSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1229
static PAGE_NUMBER FlushPage(PINPUT_RECORD Ir)
Definition: usetup.c:4007
static VOID CheckFileSystemPage(_In_ PVOLENTRY Volume)
Definition: usetup.c:2594
static BOOLEAN ChangeSystemPartitionPage(IN PINPUT_RECORD Ir, IN PPARTENTRY SystemPartition)
Definition: usetup.c:2316
static PAGE_NUMBER DeletePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2193
static WCHAR DefaultLanguage[20]
Definition: usetup.c:69
struct _FSVOL_CONTEXT FSVOL_CONTEXT
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:70
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: usetup.c:3340
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: usetup.c:2616
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2359
struct _COPYCONTEXT * PCOPYCONTEXT
static BOOLEAN IsMediumLargeEnough(_In_ ULONGLONG SizeInBytes)
Definition: usetup.c:1518
#define SystemVolume
Definition: usetup.c:63
static PAGE_NUMBER LicensePage(PINPUT_RECORD Ir)
Definition: usetup.c:872
VOID PopupError(PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
Definition: usetup.c:261
static VOID __cdecl USetupErrorRoutine(IN PUSETUP_DATA pSetupData,...)
Definition: usetup.c:540
static FSVOL_OP FormatPartitionPage(_In_ PFSVOL_CONTEXT FsVolContext, _In_ PVOLENTRY Volume)
Definition: usetup.c:2538
#define InstallVolume
Definition: usetup.c:50
static BOOLEAN BootLoaderRemovableDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3575
static USETUP_DATA USetupData
Definition: usetup.c:44
static BOOLEAN NTAPI ProgressTimeOutStringHandler(IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:3758
static PAGE_NUMBER DisplaySettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1450
HANDLE ProcessHeap
Definition: usetup.c:42
static PPARTLIST PartitionList
Definition: usetup.c:75
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1360
static PPARTENTRY InstallPartition
Definition: usetup.c:48
static PAGE_NUMBER ComputerSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1424
static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3266
VOID NTAPI NtProcessStartup(PPEB Peb)
Definition: usetup.c:4223
static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1476
static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir)
Definition: usetup.c:675
struct _FSVOL_CONTEXT * PFSVOL_CONTEXT
static VOID SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, IN BOOLEAN First)
Definition: usetup.c:3112
static VOID UpdateKBLayout(VOID)
Definition: usetup.c:461
@ PartTypeData
Definition: usetup.c:80
@ PartTypeExtended
Definition: usetup.c:81
static PAGE_NUMBER StartPartitionOperationsPage(PINPUT_RECORD Ir)
Definition: usetup.c:2274
static PAGE_NUMBER BootLoaderSelectPage(PINPUT_RECORD Ir)
Definition: usetup.c:3420
#define VOLUME_NEW_AUTOCREATE
Definition: usetup.c:85
static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3383
static PPARTENTRY SystemPartition
Definition: usetup.c:61
static PAGE_NUMBER LayoutSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1502
static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:1096
static PAGE_NUMBER SuccessPage(PINPUT_RECORD Ir)
Definition: usetup.c:3984
static PAGE_NUMBER BootLoaderInstallPage(PINPUT_RECORD Ir)
Definition: usetup.c:3702
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:434
static PPARTENTRY CurrentPartition
Definition: usetup.c:78
NTSTATUS RunUSetup(VOID)
Definition: usetup.c:4018
#define PARTITION_MAXSIZE
Definition: usetup.c:1848
static VOID DrawBox(IN SHORT xLeft, IN SHORT yTop, IN SHORT Width, IN SHORT Height)
Definition: usetup.c:171
static NTSTATUS NTAPI GetNTOSInstallationName(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:509
static FSVOL_OP SelectFileSystemPage(_In_ PFSVOL_CONTEXT FsVolContext, _In_ PVOLENTRY Volume)
Definition: usetup.c:2369
static PAGE_NUMBER SelectPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:1553
static PAGE_NUMBER WelcomePage(PINPUT_RECORD Ir)
Definition: usetup.c:829
static BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2153
static enum @81 PartCreateType
static PAGE_NUMBER QuitPage(PINPUT_RECORD Ir)
Definition: usetup.c:3942
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:72
struct _COPYCONTEXT COPYCONTEXT
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:88
static VOID PrintString(IN PCSTR fmt,...)
Definition: usetup.c:152
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1851
static PAGE_NUMBER CreatePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2044
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:93
static BOOLEAN BootLoaderHardDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3636
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:92
static PAGE_NUMBER SetupStartPage(PINPUT_RECORD Ir)
Definition: usetup.c:583
PCWSTR SelectedLanguageId
Definition: usetup.c:68
static PAGE_NUMBER PrepareCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3086
static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:903
static PAGE_NUMBER UpgradeRepairPage(PINPUT_RECORD Ir)
Definition: usetup.c:946
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: usetup.c:3140
static PAGE_NUMBER InstallDirectoryPage(PINPUT_RECORD Ir)
Definition: usetup.c:2884
#define POPUP_WAIT_ENTER
Definition: usetup.h:124
@ BOOTLOADER_SELECT_PAGE
Definition: usetup.h:106
@ SELECT_FILE_SYSTEM_PAGE
Definition: usetup.h:103
@ SUCCESS_PAGE
Definition: usetup.h:115
@ LAYOUT_SETTINGS_PAGE
Definition: usetup.h:94
@ COMPUTER_SETTINGS_PAGE
Definition: usetup.h:91
@ CHECK_FILE_SYSTEM_PAGE
Definition: usetup.h:105
@ LICENSE_PAGE
Definition: usetup.h:81
@ DELETE_PARTITION_PAGE
Definition: usetup.h:100
@ SELECT_PARTITION_PAGE
Definition: usetup.h:96
@ WELCOME_PAGE
Definition: usetup.h:80
@ UPGRADE_REPAIR_PAGE
Definition: usetup.h:88
@ START_PARTITION_OPERATIONS_PAGE
Definition: usetup.h:102
@ DEVICE_SETTINGS_PAGE
Definition: usetup.h:90
@ FLUSH_PAGE
Definition: usetup.h:117
@ PREPARE_COPY_PAGE
Definition: usetup.h:108
@ CONFIRM_DELETE_SYSTEM_PARTITION_PAGE
Definition: usetup.h:99
@ FILE_COPY_PAGE
Definition: usetup.h:110
@ REGISTRY_PAGE
Definition: usetup.h:111
@ REBOOT_PAGE
Definition: usetup.h:118
@ CHANGE_SYSTEM_PARTITION
Definition: usetup.h:98
@ QUIT_PAGE
Definition: usetup.h:116
@ FORMAT_PARTITION_PAGE
Definition: usetup.h:104
@ SETUP_INIT_PAGE
Definition: usetup.h:78
@ CREATE_PARTITION_PAGE
Definition: usetup.h:97
@ INSTALL_DIRECTORY_PAGE
Definition: usetup.h:109
@ DISPLAY_SETTINGS_PAGE
Definition: usetup.h:92
@ LANGUAGE_PAGE
Definition: usetup.h:79
@ KEYBOARD_SETTINGS_PAGE
Definition: usetup.h:93
@ BOOTLOADER_INSTALL_PAGE
Definition: usetup.h:112
@ REPAIR_INTRO_PAGE
Definition: usetup.h:87
@ INSTALL_INTRO_PAGE
Definition: usetup.h:82
@ RECOVERY_PAGE
Definition: usetup.h:119
@ BOOTLOADER_REMOVABLE_DISK_PAGE
Definition: usetup.h:113
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:123
#define POPUP_WAIT_NONE
Definition: usetup.h:122
enum _PAGE_NUMBER PAGE_NUMBER
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
Definition: wdfpdo.h:437
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define VK_UP
Definition: winuser.h:2261
#define VK_NEXT
Definition: winuser.h:2257
#define VK_RETURN
Definition: winuser.h:2237
#define VK_END
Definition: winuser.h:2258
#define VK_HOME
Definition: winuser.h:2259
#define VK_BACK
Definition: winuser.h:2234
#define VK_F3
Definition: winuser.h:2293
#define VK_LEFT
Definition: winuser.h:2260
#define VK_RIGHT
Definition: winuser.h:2262
#define VK_DOWN
Definition: winuser.h:2263
#define VK_PRIOR
Definition: winuser.h:2256
#define VK_DELETE
Definition: winuser.h:2269
#define VK_ESCAPE
Definition: winuser.h:2250
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409