ReactOS 0.4.15-dev-8434-g155a7c7
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
44
46
47/* The partition where to perform the installation */
49/*
50 * The system partition we will actually use. It can be different from
51 * PartitionList->SystemPartition in case we don't support it, or we install
52 * on a removable disk.
53 * We may indeed not support the original system partition in case we do not
54 * have write support on it. Please note that this situation is partly a HACK
55 * and MUST NEVER happen on architectures where real system partitions are
56 * mandatory (because then they are formatted in FAT FS and we support write
57 * operation on them).
58 */
60
61
62/* OTHER Stuff *****/
63
65static WCHAR DefaultLanguage[20]; // Copy of string inside LanguageList
66static WCHAR DefaultKBLayout[20]; // Copy of string inside KeyboardList
67
69
70/* Global partition list on the system */
72
73/* Currently selected partition entry in the list */
75static enum {
76 PartTypeData, // On MBR-disks, primary or logical partition
77 PartTypeExtended // MBR-disk container
79
80/* Flag set in PARTENTRY::New when a partition is created automatically */
81#define PARTITION_NEW_AUTOCREATE 0x80
82
83/* List of supported file systems for the partition to be formatted */
85
86/*****************************************************/
87
90
91#ifdef __REACTOS__ /* HACK */
92
93/* FONT SUBSTITUTION WORKAROUND *************************************************/
94
95/* For font file check */
96FONTSUBSTSETTINGS s_SubstSettings = { FALSE };
97
98static void
99DoWatchDestFileName(LPCWSTR FileName)
100{
101 if (FileName[0] == 'm' || FileName[0] == 'M')
102 {
103 if (wcsicmp(FileName, L"mingliu.ttc") == 0)
104 {
105 DPRINT("mingliu.ttc found\n");
106 s_SubstSettings.bFoundFontMINGLIU = TRUE;
107 }
108 else if (wcsicmp(FileName, L"msgothic.ttc") == 0)
109 {
110 DPRINT("msgothic.ttc found\n");
111 s_SubstSettings.bFoundFontMSGOTHIC = TRUE;
112 }
113 else if (wcsicmp(FileName, L"msmincho.ttc") == 0)
114 {
115 DPRINT("msmincho.ttc found\n");
116 s_SubstSettings.bFoundFontMSMINCHO = TRUE;
117 }
118 else if (wcsicmp(FileName, L"mssong.ttf") == 0)
119 {
120 DPRINT("mssong.ttf found\n");
121 s_SubstSettings.bFoundFontMSSONG = TRUE;
122 }
123 }
124 else
125 {
126 if (wcsicmp(FileName, L"simsun.ttc") == 0)
127 {
128 DPRINT("simsun.ttc found\n");
129 s_SubstSettings.bFoundFontSIMSUN = TRUE;
130 }
131 else if (wcsicmp(FileName, L"gulim.ttc") == 0)
132 {
133 DPRINT("gulim.ttc found\n");
134 s_SubstSettings.bFoundFontGULIM = TRUE;
135 }
136 else if (wcsicmp(FileName, L"batang.ttc") == 0)
137 {
138 DPRINT("batang.ttc found\n");
139 s_SubstSettings.bFoundFontBATANG = TRUE;
140 }
141 }
142}
143#endif /* HACK */
144
145/* FUNCTIONS ****************************************************************/
146
147static VOID
149{
150 CHAR buffer[512];
151 va_list ap;
154
155 va_start(ap, fmt);
157 va_end(ap);
158
163}
164
165
166static VOID
168 IN SHORT yTop,
169 IN SHORT Width,
171{
172 COORD coPos;
173 DWORD Written;
174
175 /* Draw upper left corner */
176 coPos.X = xLeft;
177 coPos.Y = yTop;
179 CharUpperLeftCorner, // '+',
180 1,
181 coPos,
182 &Written);
183
184 /* Draw upper edge */
185 coPos.X = xLeft + 1;
186 coPos.Y = yTop;
188 CharHorizontalLine, // '-',
189 Width - 2,
190 coPos,
191 &Written);
192
193 /* Draw upper right corner */
194 coPos.X = xLeft + Width - 1;
195 coPos.Y = yTop;
197 CharUpperRightCorner, // '+',
198 1,
199 coPos,
200 &Written);
201
202 /* Draw right edge, inner space and left edge */
203 for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
204 {
205 coPos.X = xLeft;
207 CharVerticalLine, // '|',
208 1,
209 coPos,
210 &Written);
211
212 coPos.X = xLeft + 1;
214 ' ',
215 Width - 2,
216 coPos,
217 &Written);
218
219 coPos.X = xLeft + Width - 1;
221 CharVerticalLine, // '|',
222 1,
223 coPos,
224 &Written);
225 }
226
227 /* Draw lower left corner */
228 coPos.X = xLeft;
229 coPos.Y = yTop + Height - 1;
231 CharLowerLeftCorner, // '+',
232 1,
233 coPos,
234 &Written);
235
236 /* Draw lower edge */
237 coPos.X = xLeft + 1;
238 coPos.Y = yTop + Height - 1;
240 CharHorizontalLine, // '-',
241 Width - 2,
242 coPos,
243 &Written);
244
245 /* Draw lower right corner */
246 coPos.X = xLeft + Width - 1;
247 coPos.Y = yTop + Height - 1;
249 CharLowerRightCorner, // '+',
250 1,
251 coPos,
252 &Written);
253}
254
255
256VOID
258 PCCH Status,
259 PINPUT_RECORD Ir,
260 ULONG WaitEvent)
261{
262 SHORT yTop;
263 SHORT xLeft;
264 COORD coPos;
265 DWORD Written;
267 ULONG MaxLength;
268 ULONG Lines;
269 PCHAR p;
270 PCCH pnext;
271 BOOLEAN LastLine;
272 SHORT Width;
274
275 /* Count text lines and longest line */
276 MaxLength = 0;
277 Lines = 0;
278 pnext = Text;
279
280 while (TRUE)
281 {
282 p = strchr(pnext, '\n');
283
284 if (p == NULL)
285 {
286 Length = strlen(pnext);
287 LastLine = TRUE;
288 }
289 else
290 {
291 Length = (ULONG)(p - pnext);
292 LastLine = FALSE;
293 }
294
295 Lines++;
296
297 if (Length > MaxLength)
298 MaxLength = Length;
299
300 if (LastLine)
301 break;
302
303 pnext = p + 1;
304 }
305
306 /* Check length of status line */
307 if (Status != NULL)
308 {
310
311 if (Length > MaxLength)
312 MaxLength = Length;
313 }
314
315 Width = MaxLength + 4;
316 Height = Lines + 2;
317
318 if (Status != NULL)
319 Height += 2;
320
321 yTop = (yScreen - Height) / 2;
322 xLeft = (xScreen - Width) / 2;
323
324
325 /* Set screen attributes */
326 coPos.X = xLeft;
327 for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++)
328 {
331 Width,
332 coPos,
333 &Written);
334 }
335
336 DrawBox(xLeft, yTop, Width, Height);
337
338 /* Print message text */
339 coPos.Y = yTop + 1;
340 pnext = Text;
341 while (TRUE)
342 {
343 p = strchr(pnext, '\n');
344
345 if (p == NULL)
346 {
347 Length = strlen(pnext);
348 LastLine = TRUE;
349 }
350 else
351 {
352 Length = (ULONG)(p - pnext);
353 LastLine = FALSE;
354 }
355
356 if (Length != 0)
357 {
358 coPos.X = xLeft + 2;
360 pnext,
361 Length,
362 coPos,
363 &Written);
364 }
365
366 if (LastLine)
367 break;
368
369 coPos.Y++;
370 pnext = p + 1;
371 }
372
373 /* Print separator line and status text */
374 if (Status != NULL)
375 {
376 coPos.Y = yTop + Height - 3;
377 coPos.X = xLeft;
380 1,
381 coPos,
382 &Written);
383
384 coPos.X = xLeft + 1;
386 CharHorizontalLine, // '-',
387 Width - 2,
388 coPos,
389 &Written);
390
391 coPos.X = xLeft + Width - 1;
394 1,
395 coPos,
396 &Written);
397
398 coPos.Y++;
399 coPos.X = xLeft + 2;
401 Status,
402 min(strlen(Status), (SIZE_T)Width - 4),
403 coPos,
404 &Written);
405 }
406
407 if (WaitEvent == POPUP_WAIT_NONE)
408 return;
409
410 while (TRUE)
411 {
413
414 if (WaitEvent == POPUP_WAIT_ANY_KEY ||
415 Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
416 {
417 return;
418 }
419 }
420}
421
422
423/*
424 * Confirm quit setup
425 * RETURNS
426 * TRUE: Quit setup.
427 * FALSE: Don't quit setup.
428 */
429static BOOL
431{
432 BOOL Result = FALSE;
434
435 while (TRUE)
436 {
438
439 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
440 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
441 {
442 Result = TRUE;
443 break;
444 }
445 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
446 {
447 Result = FALSE;
448 break;
449 }
450 }
451
452 return Result;
453}
454
455
456static VOID
458{
459 PGENERIC_LIST_ENTRY ListEntry;
460 KLID newLayout;
461
463
465 {
468 {
469 /* FIXME: Handle error! */
470 return;
471 }
472 }
473
474 /* Search for default layout (if provided) */
475 if (newLayout != 0)
476 {
477 for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
478 ListEntry = GetNextListEntry(ListEntry))
479 {
480 PCWSTR pszLayoutId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
481 KLID LayoutId = (KLID)(pszLayoutId ? wcstoul(pszLayoutId, NULL, 16) : 0);
482 if (newLayout == LayoutId)
483 {
485 break;
486 }
487 }
488 }
489}
490
491
492static NTSTATUS
493NTAPI
497 IN SIZE_T cchBufferSize)
498{
499 return RtlStringCchPrintfA(Buffer, cchBufferSize, "%S",
501}
502
503static NTSTATUS
504NTAPI
508 IN SIZE_T cchBufferSize)
509{
511 PPARTENTRY PartEntry = NtOsInstall->PartEntry;
512
513 if (PartEntry && PartEntry->DriveLetter)
514 {
515 /* We have retrieved a partition that is mounted */
516 return RtlStringCchPrintfA(Buffer, cchBufferSize,
517 "%C:%S \"%S\"",
518 PartEntry->DriveLetter,
519 NtOsInstall->PathComponent,
520 NtOsInstall->InstallationName);
521 }
522 else
523 {
524 /* We failed somewhere, just show the NT path */
525 return RtlStringCchPrintfA(Buffer, cchBufferSize,
526 "%wZ \"%S\"",
527 &NtOsInstall->SystemNtPath,
528 NtOsInstall->InstallationName);
529 }
530}
531
532
533/*
534 * Start page
535 *
536 * Next pages:
537 * LanguagePage (at once, default)
538 * InstallIntroPage (at once, if unattended)
539 * QuitPage
540 *
541 * SIDEEFFECTS
542 * Init Sdi
543 * Init USetupData.SourcePath
544 * Init USetupData.SourceRootPath
545 * Init USetupData.SourceRootDir
546 * Init USetupData.SetupInf
547 * Init USetupData.RequiredPartitionDiskSpace
548 * Init IsUnattendedSetup
549 * If unattended, init *List and sets the Codepage
550 * If unattended, init SelectedLanguageId
551 * If unattended, init USetupData.LanguageId
552 *
553 * RETURNS
554 * Number of the next page.
555 */
556static PAGE_NUMBER
558{
559 ULONG Error;
560 PGENERIC_LIST_ENTRY ListEntry;
562
564
565 /* Initialize Setup, phase 1 */
567 if (Error != ERROR_SUCCESS)
568 {
570 return QUIT_PAGE;
571 }
572
573 /* Initialize the user-mode PnP manager */
575 DPRINT1("The user-mode PnP manager could not initialize, expect unavailable devices!\n");
576
577 /* Wait for any immediate pending installations to finish */
579 DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
580
582
584 {
585 // TODO: Read options from inf
586 /* Load the hardware, language and keyboard layout lists */
587
591
593
594 /* new part */
598
600
601 /* first we hack LanguageList */
602 for (ListEntry = GetFirstListEntry(USetupData.LanguageList); ListEntry;
603 ListEntry = GetNextListEntry(ListEntry))
604 {
605 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
607 {
608 DPRINT("found %S in LanguageList\n", LocaleId);
610 break;
611 }
612 }
613
614 /* now LayoutList */
615 for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
616 ListEntry = GetNextListEntry(ListEntry))
617 {
618 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
620 {
621 DPRINT("found %S in LayoutList\n", LocaleId);
623 break;
624 }
625 }
626
628
629 return INSTALL_INTRO_PAGE;
630 }
631
632 return LANGUAGE_PAGE;
633}
634
635
636/*
637 * Displays the LanguagePage.
638 *
639 * Next pages: WelcomePage, QuitPage
640 *
641 * SIDEEFFECTS
642 * Init SelectedLanguageId
643 * Init USetupData.LanguageId
644 *
645 * RETURNS
646 * Number of the next page.
647 */
648static PAGE_NUMBER
650{
651 GENERIC_LIST_UI ListUi;
652 PCWSTR NewLanguageId;
653 BOOL RefreshPage = FALSE;
654
655 /* Initialize the computer settings list */
657 {
660 {
661 PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
662 return WELCOME_PAGE;
663 }
664 }
665
668
669 /* Load the font */
672
673 /*
674 * If there is no language or just a single one in the list,
675 * skip the language selection process altogether.
676 */
678 {
680 return WELCOME_PAGE;
681 }
682
684 DrawGenericList(&ListUi,
685 2, 18,
686 xScreen - 3,
687 yScreen - 3);
688
690
692
693 while (TRUE)
694 {
696
697 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
698 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
699 {
700 ScrollDownGenericList(&ListUi);
701 RefreshPage = TRUE;
702 }
703 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
704 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
705 {
706 ScrollUpGenericList(&ListUi);
707 RefreshPage = TRUE;
708 }
709 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
710 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
711 {
713 RefreshPage = TRUE;
714 }
715 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
716 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
717 {
719 RefreshPage = TRUE;
720 }
721 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
722 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
723 {
724 if (ConfirmQuit(Ir))
725 return QUIT_PAGE;
726 else
727 RedrawGenericList(&ListUi);
728 }
729 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
730 {
732
735
737
739 {
741 }
742
743 /* Load the font */
745
746 return WELCOME_PAGE;
747 }
748 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
749 {
750 /* a-z */
752 RefreshPage = TRUE;
753 }
754
755 if (RefreshPage)
756 {
758
759 NewLanguageId =
761
762 if (wcscmp(SelectedLanguageId, NewLanguageId))
763 {
764 /* Clear the language page */
766
767 SelectedLanguageId = NewLanguageId;
768
769 /* Load the font */
771
772 /* Redraw the list */
773 DrawGenericList(&ListUi,
774 2, 18,
775 xScreen - 3,
776 yScreen - 3);
777
778 /* Redraw language selection page in native language */
780 }
781
782 RefreshPage = FALSE;
783 }
784 }
785
786 return WELCOME_PAGE;
787}
788
789
790/*
791 * Displays the WelcomePage.
792 *
793 * Next pages:
794 * InstallIntroPage (default)
795 * RepairIntroPage
796 * RecoveryPage
797 * LicensePage
798 * QuitPage
799 *
800 * RETURNS
801 * Number of the next page.
802 */
803static PAGE_NUMBER
805{
807
808 while (TRUE)
809 {
811
812 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
813 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
814 {
815 if (ConfirmQuit(Ir))
816 return QUIT_PAGE;
817
818 break;
819 }
820 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
821 {
822 return INSTALL_INTRO_PAGE;
823 }
824 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
825 {
826 return RECOVERY_PAGE; // REPAIR_INTRO_PAGE;
827 }
828 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'L') /* L */
829 {
830 return LICENSE_PAGE;
831 }
832 }
833
834 return WELCOME_PAGE;
835}
836
837
838/*
839 * Displays the License page.
840 *
841 * Next page:
842 * WelcomePage (default)
843 *
844 * RETURNS
845 * Number of the next page.
846 */
847static PAGE_NUMBER
849{
851
852 while (TRUE)
853 {
855
856 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
857 {
858 return WELCOME_PAGE;
859 }
860 }
861
862 return LICENSE_PAGE;
863}
864
865
866/*
867 * Displays the RepairIntroPage.
868 *
869 * Next pages:
870 * RebootPage (default)
871 * InstallIntroPage
872 * RecoveryPage
873 * IntroPage
874 *
875 * RETURNS
876 * Number of the next page.
877 */
878static PAGE_NUMBER
880{
882
883 while (TRUE)
884 {
886
887 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
888 {
889 return REBOOT_PAGE;
890 }
891 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
892 {
894 return INSTALL_INTRO_PAGE;
895 }
896 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
897 {
898 return RECOVERY_PAGE;
899 }
900 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
901 {
902 return WELCOME_PAGE;
903 }
904 }
905
906 return REPAIR_INTRO_PAGE;
907}
908
909/*
910 * Displays the UpgradeRepairPage.
911 *
912 * Next pages:
913 * RebootPage (default)
914 * InstallIntroPage
915 * RecoveryPage
916 * WelcomePage
917 *
918 * RETURNS
919 * Number of the next page.
920 */
921static PAGE_NUMBER
923{
924 GENERIC_LIST_UI ListUi;
925
926/*** HACK!! ***/
927 if (PartitionList == NULL)
928 {
930 if (PartitionList == NULL)
931 {
932 /* FIXME: show an error dialog */
934 return QUIT_PAGE;
935 }
937 {
939 return QUIT_PAGE;
940 }
941 }
942/**************/
943
945 if (!NtOsInstallsList)
946 DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
947
948 /*
949 * If there is no available installation (or just a single one??) that can
950 * be updated in the list, just continue with the regular installation.
951 */
953 {
955
956 // return INSTALL_INTRO_PAGE;
958 // return SCSI_CONTROLLER_PAGE;
959 }
960
962
964 DrawGenericList(&ListUi,
965 2, 23,
966 xScreen - 3,
967 yScreen - 3);
968
969 // return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
970 while (TRUE)
971 {
973
974 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00)
975 {
976 switch (Ir->Event.KeyEvent.wVirtualKeyCode)
977 {
978 case VK_DOWN: /* DOWN */
979 ScrollDownGenericList(&ListUi);
980 break;
981 case VK_UP: /* UP */
982 ScrollUpGenericList(&ListUi);
983 break;
984 case VK_NEXT: /* PAGE DOWN */
986 break;
987 case VK_PRIOR: /* PAGE UP */
989 break;
990 case VK_F3: /* F3 */
991 {
992 if (ConfirmQuit(Ir))
993 return QUIT_PAGE;
994 else
995 RedrawGenericList(&ListUi);
996 break;
997 }
998#if 1
999/* TODO: Temporarily kept until correct keyboard layout is in place.
1000 * (Actual AsciiChar of ESCAPE should be 0x1B instead of 0.)
1001 * Addendum to commit 8b94515b.
1002 */
1003 case VK_ESCAPE: /* ESC */
1004 {
1006 // return nextPage; // prevPage;
1007
1008 // return INSTALL_INTRO_PAGE;
1009 return DEVICE_SETTINGS_PAGE;
1010 // return SCSI_CONTROLLER_PAGE;
1011 }
1012
1013#endif
1014 }
1015 }
1016#if 0
1017/* TODO: Restore this once correct keyboard layout is in place. */
1018 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1019 {
1021 // return nextPage; // prevPage;
1022
1023 // return INSTALL_INTRO_PAGE;
1024 return DEVICE_SETTINGS_PAGE;
1025 // return SCSI_CONTROLLER_PAGE;
1026 }
1027#endif
1028 else
1029 {
1030 // switch (toupper(Ir->Event.KeyEvent.uChar.AsciiChar))
1031 // if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1032 if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
1033 {
1034 /* Retrieve the current installation */
1036
1039
1040 DPRINT1("Selected installation for repair: \"%S\" ; DiskNumber = %d , PartitionNumber = %d\n",
1042
1044
1045 // return nextPage;
1046 /***/return INSTALL_INTRO_PAGE;/***/
1047 }
1048 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) &&
1049 (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) /* a-z */
1050 {
1052 }
1053 }
1054 }
1055
1056 return UPGRADE_REPAIR_PAGE;
1057}
1058
1059
1060/*
1061 * Displays the InstallIntroPage.
1062 *
1063 * Next pages:
1064 * DeviceSettingsPage (At once if repair or update is selected)
1065 * SelectPartitionPage (At once if unattended setup)
1066 * DeviceSettingsPage (default)
1067 * QuitPage
1068 *
1069 * RETURNS
1070 * Number of the next page.
1071 */
1072static PAGE_NUMBER
1074{
1075 if (RepairUpdateFlag)
1076 {
1077#if 1 /* Old code that looks good */
1078
1079 // return SELECT_PARTITION_PAGE;
1080 return DEVICE_SETTINGS_PAGE;
1081
1082#else /* Possible new code? */
1083
1084 return DEVICE_SETTINGS_PAGE;
1085 // return SCSI_CONTROLLER_PAGE;
1086
1087#endif
1088 }
1089
1091 return SELECT_PARTITION_PAGE;
1092
1094
1095 while (TRUE)
1096 {
1097 CONSOLE_ConInKey(Ir);
1098
1099 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1100 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1101 {
1102 if (ConfirmQuit(Ir))
1103 return QUIT_PAGE;
1104
1105 break;
1106 }
1107 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1108 {
1109 return UPGRADE_REPAIR_PAGE;
1110 }
1111 }
1112
1113 return INSTALL_INTRO_PAGE;
1114}
1115
1116
1117#if 0
1118static PAGE_NUMBER
1119ScsiControllerPage(PINPUT_RECORD Ir)
1120{
1121 // MUIDisplayPage(SCSI_CONTROLLER_PAGE);
1122
1123 CONSOLE_SetTextXY(6, 8, "Setup detected the following mass storage devices:");
1124
1125 /* FIXME: print loaded mass storage driver descriptions */
1126#if 0
1127 CONSOLE_SetTextXY(8, 10, "TEST device");
1128#endif
1129
1130 CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
1131
1132 while (TRUE)
1133 {
1134 CONSOLE_ConInKey(Ir);
1135
1136 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1137 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1138 {
1139 if (ConfirmQuit(Ir))
1140 return QUIT_PAGE;
1141
1142 break;
1143 }
1144 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1145 {
1146 return DEVICE_SETTINGS_PAGE;
1147 }
1148 }
1149
1150 return SCSI_CONTROLLER_PAGE;
1151}
1152
1153static PAGE_NUMBER
1154OemDriverPage(PINPUT_RECORD Ir)
1155{
1156 // MUIDisplayPage(OEM_DRIVER_PAGE);
1157
1158 CONSOLE_SetTextXY(6, 8, "This is the OEM driver page!");
1159
1160 /* FIXME: Implement!! */
1161
1162 CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
1163
1164 while (TRUE)
1165 {
1166 CONSOLE_ConInKey(Ir);
1167
1168 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1169 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1170 {
1171 if (ConfirmQuit(Ir))
1172 return QUIT_PAGE;
1173
1174 break;
1175 }
1176 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1177 {
1178 return DEVICE_SETTINGS_PAGE;
1179 }
1180 }
1181
1182 return OEM_DRIVER_PAGE;
1183}
1184#endif
1185
1186
1187/*
1188 * Displays the DeviceSettingsPage.
1189 *
1190 * Next pages:
1191 * SelectPartitionPage (At once if repair or update is selected)
1192 * ComputerSettingsPage
1193 * DisplaySettingsPage
1194 * KeyboardSettingsPage
1195 * LayoutsettingsPage
1196 * SelectPartitionPage
1197 * QuitPage
1198 *
1199 * SIDEEFFECTS
1200 * Init USetupData.ComputerList
1201 * Init USetupData.DisplayList
1202 * Init USetupData.KeyboardList
1203 * Init USetupData.LayoutList
1204 *
1205 * RETURNS
1206 * Number of the next page.
1207 */
1208static PAGE_NUMBER
1210{
1211 static ULONG Line = 16;
1212
1213 /* Initialize the computer settings list */
1215 {
1218 {
1220 return QUIT_PAGE;
1221 }
1222 }
1223
1224 /* Initialize the display settings list */
1226 {
1229 {
1231 return QUIT_PAGE;
1232 }
1233 }
1234
1235 /* Initialize the keyboard settings list */
1237 {
1240 {
1242 return QUIT_PAGE;
1243 }
1244 }
1245
1246 /* Initialize the keyboard layout list */
1248 {
1251 {
1252 /* FIXME: report error */
1254 return QUIT_PAGE;
1255 }
1256 }
1257
1258 if (RepairUpdateFlag)
1259 return SELECT_PARTITION_PAGE;
1260
1261 // if (IsUnattendedSetup)
1262 // return SELECT_PARTITION_PAGE;
1263
1265
1270
1271 CONSOLE_InvertTextXY(24, Line, 48, 1);
1272
1273 while (TRUE)
1274 {
1275 CONSOLE_ConInKey(Ir);
1276
1277 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1278 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1279 {
1280 CONSOLE_NormalTextXY(24, Line, 48, 1);
1281
1282 if (Line == 14)
1283 Line = 16;
1284 else if (Line == 16)
1285 Line = 11;
1286 else
1287 Line++;
1288
1289 CONSOLE_InvertTextXY(24, Line, 48, 1);
1290 }
1291 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1292 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1293 {
1294 CONSOLE_NormalTextXY(24, Line, 48, 1);
1295
1296 if (Line == 11)
1297 Line = 16;
1298 else if (Line == 16)
1299 Line = 14;
1300 else
1301 Line--;
1302
1303 CONSOLE_InvertTextXY(24, Line, 48, 1);
1304 }
1305 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1306 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1307 {
1308 if (ConfirmQuit(Ir))
1309 return QUIT_PAGE;
1310
1311 break;
1312 }
1313 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1314 {
1315 if (Line == 11)
1317 else if (Line == 12)
1318 return DISPLAY_SETTINGS_PAGE;
1319 else if (Line == 13)
1321 else if (Line == 14)
1322 return LAYOUT_SETTINGS_PAGE;
1323 else if (Line == 16)
1324 return SELECT_PARTITION_PAGE;
1325 }
1326 }
1327
1328 return DEVICE_SETTINGS_PAGE;
1329}
1330
1331
1332/*
1333 * Handles generic selection lists.
1334 *
1335 * PARAMS
1336 * GenericList: The list to handle.
1337 * nextPage: The page it needs to jump to after this page.
1338 * Ir: The PINPUT_RECORD
1339 */
1340static PAGE_NUMBER
1342 PAGE_NUMBER nextPage,
1343 PINPUT_RECORD Ir)
1344{
1345 while (TRUE)
1346 {
1347 CONSOLE_ConInKey(Ir);
1348
1349 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1350 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1351 {
1352 ScrollDownGenericList(ListUi);
1353 }
1354 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1355 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1356 {
1357 ScrollUpGenericList(ListUi);
1358 }
1359 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1360 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1361 {
1363 }
1364 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1365 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1366 {
1368 }
1369 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1370 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1371 {
1372 if (ConfirmQuit(Ir))
1373 return QUIT_PAGE;
1374 else
1375 RedrawGenericList(ListUi);
1376 }
1377 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1378 {
1380 return nextPage; // Use some "prevPage;" instead?
1381 }
1382 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1383 {
1384 return nextPage;
1385 }
1386 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1387 {
1388 /* a-z */
1390 }
1391 }
1392}
1393
1394
1395/*
1396 * Displays the ComputerSettingsPage.
1397 *
1398 * Next pages:
1399 * DeviceSettingsPage
1400 * QuitPage
1401 *
1402 * RETURNS
1403 * Number of the next page.
1404 */
1405static PAGE_NUMBER
1407{
1408 GENERIC_LIST_UI ListUi;
1410
1412 DrawGenericList(&ListUi,
1413 2, 18,
1414 xScreen - 3,
1415 yScreen - 3);
1416
1417 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1418}
1419
1420
1421/*
1422 * Displays the DisplaySettingsPage.
1423 *
1424 * Next pages:
1425 * DeviceSettingsPage
1426 * QuitPage
1427 *
1428 * RETURNS
1429 * Number of the next page.
1430 */
1431static PAGE_NUMBER
1433{
1434 GENERIC_LIST_UI ListUi;
1436
1438 DrawGenericList(&ListUi,
1439 2, 18,
1440 xScreen - 3,
1441 yScreen - 3);
1442
1443 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1444}
1445
1446
1447/*
1448 * Displays the KeyboardSettingsPage.
1449 *
1450 * Next pages:
1451 * DeviceSettingsPage
1452 * QuitPage
1453 *
1454 * RETURNS
1455 * Number of the next page.
1456 */
1457static PAGE_NUMBER
1459{
1460 GENERIC_LIST_UI ListUi;
1462
1464 DrawGenericList(&ListUi,
1465 2, 18,
1466 xScreen - 3,
1467 yScreen - 3);
1468
1469 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1470}
1471
1472
1473/*
1474 * Displays the LayoutSettingsPage.
1475 *
1476 * Next pages:
1477 * DeviceSettingsPage
1478 * QuitPage
1479 *
1480 * RETURNS
1481 * Number of the next page.
1482 */
1483static PAGE_NUMBER
1485{
1486 GENERIC_LIST_UI ListUi;
1488
1490 DrawGenericList(&ListUi,
1491 2, 18,
1492 xScreen - 3,
1493 yScreen - 3);
1494
1495 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1496}
1497
1498
1499static BOOLEAN
1501 _In_ PPARTENTRY PartEntry)
1502{
1503 /* Retrieve the maximum size in MB (rounded up) */
1504 ULONGLONG PartSize = RoundingDivide(GetPartEntrySizeInBytes(PartEntry), MB);
1505
1507 {
1508 /* Partition is too small so ask for another one */
1509 DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n",
1511 return FALSE;
1512 }
1513 else
1514 {
1515 return TRUE;
1516 }
1517}
1518
1519
1520/*
1521 * Displays the SelectPartitionPage.
1522 *
1523 * Next pages:
1524 * SelectFileSystemPage (At once if unattended)
1525 * SelectFileSystemPage (Default if free space is selected)
1526 * CreatePartitionPage
1527 * ConfirmDeleteSystemPartitionPage (if the selected partition is the system partition, aka with the boot flag set)
1528 * DeletePartitionPage
1529 * QuitPage
1530 *
1531 * SIDEEFFECTS
1532 * Set InstallShortcut (only if not unattended + free space is selected)
1533 *
1534 * RETURNS
1535 * Number of the next page.
1536 */
1537static PAGE_NUMBER
1539{
1540 PARTLIST_UI ListUi;
1541 ULONG Error;
1542
1543 if (PartitionList == NULL)
1544 {
1546 if (PartitionList == NULL)
1547 {
1549 return QUIT_PAGE;
1550 }
1552 {
1554 return QUIT_PAGE;
1555 }
1556 }
1557
1558 if (RepairUpdateFlag)
1559 {
1561
1562 /* Determine the selected installation disk & partition */
1566 if (!InstallPartition)
1567 {
1568 DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
1569 ASSERT(FALSE);
1570 }
1572
1574 }
1575
1577
1580 2, 21,
1581 xScreen - 3,
1582 yScreen - 3);
1583 DrawPartitionList(&ListUi);
1584
1586 {
1587 /* Determine the selected installation disk & partition */
1591 if (!InstallPartition)
1592 {
1594
1596 {
1599
1600 /* Automatically create the partition on the whole empty space;
1601 * it will be formatted later with default parameters */
1604 0ULL,
1605 0);
1607
1608// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
1610 {
1613 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1614 }
1615
1618 }
1619 }
1620 else
1621 {
1623
1624 DrawPartitionList(&ListUi); // FIXME: Doesn't make much sense...
1625
1626// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
1628 {
1631 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1632 }
1633
1635 }
1636 }
1637
1638 while (TRUE)
1639 {
1640 ULONG uID;
1641
1643
1644 /* Update status text */
1645 if (CurrentPartition == NULL)
1646 {
1647 // FIXME: If we get a NULL current partition, this means that
1648 // the current disk is of unrecognized type. So we should display
1649 // instead a status string to initialize the disk with one of
1650 // the recognized partitioning schemes (MBR, later: GPT, etc.)
1651 // For the time being we don't have that, so use instead another
1652 // known string.
1654 }
1655 else
1656 {
1658 {
1662 {
1664 }
1665 }
1666 else
1667 {
1671 }
1672 }
1674
1675 CONSOLE_ConInKey(Ir);
1676
1677 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1678 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1679 {
1680 if (ConfirmQuit(Ir))
1681 {
1684 return QUIT_PAGE;
1685 }
1686
1687 break;
1688 }
1689 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1690 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1691 {
1693 }
1694 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1695 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1696 {
1698 }
1699 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1700 {
1702
1704 continue; // return SELECT_PARTITION_PAGE;
1705
1706 /*
1707 * Check whether the user wants to install ReactOS on a disk that
1708 * is not recognized by the computer's firmware and if so, display
1709 * a warning since such disks may not be bootable.
1710 */
1711 if (CurrentPartition->DiskEntry->MediaType == FixedMedia &&
1712 !CurrentPartition->DiskEntry->BiosFound)
1713 {
1714 PopupError("The disk you have selected for installing ReactOS\n"
1715 "is not visible by the firmware of your computer,\n"
1716 "and so may not be bootable.\n"
1717 "Press ENTER to continue nonetheless.",
1719 Ir, POPUP_WAIT_ENTER);
1720 // return SELECT_PARTITION_PAGE;
1721 }
1722
1724 {
1726 if (Error != NOT_AN_ERROR)
1727 {
1729 return SELECT_PARTITION_PAGE;
1730 }
1731
1732 /* Automatically create the partition on the whole empty space;
1733 * it will be formatted later with default parameters */
1736 0ULL,
1737 0);
1739 }
1740
1742 {
1745 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1746 }
1747
1750 }
1751 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
1752 {
1754
1756 if (Error != NOT_AN_ERROR)
1757 {
1759 return SELECT_PARTITION_PAGE;
1760 }
1761
1763 return CREATE_PARTITION_PAGE;
1764 }
1765 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'E') /* E */
1766 {
1768
1770 {
1772 if (Error != NOT_AN_ERROR)
1773 {
1775 return SELECT_PARTITION_PAGE;
1776 }
1777
1779 return CREATE_PARTITION_PAGE;
1780 }
1781 }
1782 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
1783 {
1784 UNICODE_STRING CurrentPartitionU;
1785 WCHAR PathBuffer[MAX_PATH];
1786
1788
1789 /* Ignore deletion in case this is not a partitioned entry */
1791 {
1792 continue;
1793 }
1794
1795// TODO: Do something similar before trying to format the partition?
1796 if (!CurrentPartition->New &&
1799 {
1801
1802 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
1803 L"\\Device\\Harddisk%lu\\Partition%lu\\",
1804 CurrentPartition->DiskEntry->DiskNumber,
1806 RtlInitUnicodeString(&CurrentPartitionU, PathBuffer);
1807
1808 /*
1809 * Check whether the user attempts to delete the partition on which
1810 * the installation source is present. If so, fail with an error.
1811 */
1812 // &USetupData.SourceRootPath
1813 if (RtlPrefixUnicodeString(&CurrentPartitionU, &USetupData.SourcePath, TRUE))
1814 {
1816 return SELECT_PARTITION_PAGE;
1817 }
1818 }
1819
1822 {
1824 }
1825
1826 return DELETE_PARTITION_PAGE;
1827 }
1828 }
1829
1830 return SELECT_PARTITION_PAGE;
1831}
1832
1833
1834#define PARTITION_SIZE_INPUT_FIELD_LENGTH 9
1835/* Restriction for MaxSize */
1836#define PARTITION_MAXSIZE (pow(10, (PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)) - 1)
1837
1838static VOID
1840 SHORT Top,
1841 SHORT Right,
1842 SHORT Bottom,
1843 ULONG MaxSize,
1845 PBOOLEAN Quit,
1847{
1848 INPUT_RECORD Ir;
1849 COORD coPos;
1850 DWORD Written;
1851 CHAR Buffer[128];
1852 INT Length, Pos;
1853 WCHAR ch;
1854 SHORT iLeft;
1855 SHORT iTop;
1856
1857 if (Quit != NULL)
1858 *Quit = FALSE;
1859
1860 if (Cancel != NULL)
1861 *Cancel = FALSE;
1862
1863 DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1);
1864
1865 /* Print message */
1866 coPos.X = Left + 2;
1867 coPos.Y = Top + 2;
1869 iLeft = coPos.X + (USHORT)strlen(Buffer) + 1;
1870 iTop = coPos.Y;
1871
1873 Buffer,
1874 strlen(Buffer),
1875 coPos,
1876 &Written);
1877
1879 coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1;
1880 coPos.Y = iTop;
1882 Buffer,
1883 strlen(Buffer),
1884 coPos,
1885 &Written);
1886
1887 swprintf(InputBuffer, L"%lu", MaxSize);
1889 Pos = Length;
1891 iTop,
1893 InputBuffer);
1894 CONSOLE_SetCursorXY(iLeft + Length, iTop);
1896
1897 while (TRUE)
1898 {
1899 CONSOLE_ConInKey(&Ir);
1900
1901 if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1902 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1903 {
1904 if (Quit != NULL)
1905 *Quit = TRUE;
1906
1909 break;
1910 }
1911 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1912 {
1914 break;
1915 }
1916 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1917 {
1918 if (Cancel != NULL)
1919 *Cancel = TRUE;
1920
1923 break;
1924 }
1925 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1926 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
1927 {
1928 Pos = 0;
1929 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1930 }
1931 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1932 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
1933 {
1934 Pos = Length;
1935 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1936 }
1937 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1938 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
1939 {
1940 if (Pos > 0)
1941 {
1942 Pos--;
1943 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1944 }
1945 }
1946 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1947 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
1948 {
1949 if (Pos < Length)
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_DELETE)) /* DEL */
1957 {
1958 if (Pos < Length)
1959 {
1961 &InputBuffer[Pos + 1],
1962 (Length - Pos - 1) * sizeof(WCHAR));
1964
1965 Length--;
1967 iTop,
1969 InputBuffer);
1970 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1971 }
1972 }
1973 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_BACK) /* BACKSPACE */
1974 {
1975 if (Pos > 0)
1976 {
1977 if (Pos < Length)
1978 memmove(&InputBuffer[Pos - 1],
1979 &InputBuffer[Pos],
1980 (Length - Pos) * sizeof(WCHAR));
1982
1983 Pos--;
1984 Length--;
1986 iTop,
1988 InputBuffer);
1989 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1990 }
1991 }
1992 else if (Ir.Event.KeyEvent.uChar.AsciiChar != 0x00)
1993 {
1995 {
1997
1998 if ((ch >= L'0') && (ch <= L'9'))
1999 {
2000 if (Pos < Length)
2001 memmove(&InputBuffer[Pos + 1],
2002 &InputBuffer[Pos],
2003 (Length - Pos) * sizeof(WCHAR));
2005 InputBuffer[Pos] = ch;
2006
2007 Pos++;
2008 Length++;
2010 iTop,
2012 InputBuffer);
2013 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
2014 }
2015 }
2016 }
2017 }
2018}
2019
2020
2021/*
2022 * Displays the CreatePartitionPage.
2023 *
2024 * Next pages:
2025 * SelectPartitionPage
2026 * SelectFileSystemPage (default)
2027 * QuitPage
2028 *
2029 * RETURNS
2030 * Number of the next page.
2031 */
2032static PAGE_NUMBER
2034{
2035 PPARTENTRY PartEntry;
2036 PDISKENTRY DiskEntry;
2037 ULONG uID;
2038 ULONG MaxSize;
2039 ULONGLONG MaxPartSize, PartSize;
2040 BOOLEAN Quit, Cancel;
2041 WCHAR InputBuffer[50];
2042 CHAR LineBuffer[100];
2043
2045 {
2046 /* FIXME: show an error dialog */
2047 return QUIT_PAGE;
2048 }
2049
2051 {
2055 }
2056 else // if (PartCreateType == PartTypeExtended)
2057 {
2059 }
2060
2061 CONSOLE_SetTextXY(6, 8, MUIGetString(uID));
2062
2063 PartEntry = CurrentPartition;
2064 DiskEntry = CurrentPartition->DiskEntry;
2065
2066 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2068 LineBuffer);
2069
2071
2073
2074 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
2075
2076 while (TRUE)
2077 {
2078 /* Retrieve the maximum size in MB (rounded up)
2079 * and cap it with what the user can enter */
2080 MaxSize = (ULONG)RoundingDivide(MaxPartSize, MB);
2081 MaxSize = min(MaxSize, PARTITION_MAXSIZE);
2082
2083 ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17,
2084 MaxSize, InputBuffer, &Quit, &Cancel);
2085 if (Quit)
2086 {
2087 if (ConfirmQuit(Ir))
2088 return QUIT_PAGE;
2089 break;
2090 }
2091 else if (Cancel)
2092 {
2093 return SELECT_PARTITION_PAGE;
2094 }
2095
2096 PartSize = _wcstoui64(InputBuffer, NULL, 10);
2097
2098 /* Retry if too small or too large */
2099 if ((PartSize < 1) || (PartSize > MaxSize))
2100 continue;
2101
2102 /*
2103 * If the input size, given in MB, specifies the maximum partition
2104 * size, it may slightly under- or over-estimate it due to rounding
2105 * error. In this case, use all of the unpartitioned disk space.
2106 * Otherwise, directly convert the size to bytes.
2107 */
2108 if (PartSize == MaxSize)
2109 PartSize = MaxPartSize;
2110 else // if (PartSize < MaxSize)
2111 PartSize *= MB;
2112 DPRINT("Partition size: %I64u bytes\n", PartSize);
2113
2114 ASSERT(PartSize <= MaxPartSize);
2115
2118 PartSize,
2120 ? 0
2121 // (PartCreateType == PartTypeExtended)
2123
2124 return SELECT_PARTITION_PAGE;
2125 }
2126
2127 return CREATE_PARTITION_PAGE;
2128}
2129
2130
2131/*
2132 * Displays the ConfirmDeleteSystemPartitionPage.
2133 *
2134 * Next pages:
2135 * DeletePartitionPage (default)
2136 * SelectPartitionPage
2137 *
2138 * RETURNS
2139 * Number of the next page.
2140 */
2141static PAGE_NUMBER
2143{
2145
2146 while (TRUE)
2147 {
2148 CONSOLE_ConInKey(Ir);
2149
2150 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2151 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2152 {
2153 if (ConfirmQuit(Ir))
2154 return QUIT_PAGE;
2155
2156 break;
2157 }
2158 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2159 {
2160 return DELETE_PARTITION_PAGE;
2161 }
2162 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2163 {
2164 return SELECT_PARTITION_PAGE;
2165 }
2166 }
2167
2169}
2170
2171
2172/*
2173 * Displays the DeletePartitionPage.
2174 *
2175 * Next pages:
2176 * SelectPartitionPage (default)
2177 * QuitPage
2178 *
2179 * RETURNS
2180 * Number of the next page.
2181 */
2182static PAGE_NUMBER
2184{
2185 PPARTENTRY PartEntry;
2186 PDISKENTRY DiskEntry;
2187 CHAR LineBuffer[100];
2188
2190 {
2191 /* FIXME: show an error dialog */
2192 return QUIT_PAGE;
2193 }
2194
2195 PartEntry = CurrentPartition;
2196 DiskEntry = CurrentPartition->DiskEntry;
2197
2199
2200 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2201 CONSOLE_SetTextXY(6, 10, LineBuffer);
2202
2203 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2205 LineBuffer);
2206
2207 while (TRUE)
2208 {
2209 CONSOLE_ConInKey(Ir);
2210
2211 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2212 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2213 {
2214 if (ConfirmQuit(Ir))
2215 return QUIT_PAGE;
2216
2217 break;
2218 }
2219 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2220 {
2221 return SELECT_PARTITION_PAGE;
2222 }
2223 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
2224 {
2228 return SELECT_PARTITION_PAGE;
2229 }
2230 }
2231
2232 return DELETE_PARTITION_PAGE;
2233}
2234
2235
2236/*
2237 * Displays the SelectFileSystemPage.
2238 *
2239 * Next pages:
2240 * CheckFileSystemPage (At once if RepairUpdate is selected)
2241 * CheckFileSystemPage (At once if Unattended and not USetupData.FormatPartition)
2242 * FormatPartitionPage (Default, at once if Unattended and USetupData.FormatPartition)
2243 * SelectPartitionPage (If the user aborts)
2244 * QuitPage
2245 *
2246 * RETURNS
2247 * Number of the next page.
2248 */
2249// PFSVOL_CALLBACK
2250static FSVOL_OP
2254 _In_ FSVOLNOTIFY FormatStatus,
2255 _In_ ULONG_PTR Param1,
2256 _In_ ULONG_PTR Param2);
2257
2258typedef struct _FSVOL_CONTEXT
2259{
2263
2264static PAGE_NUMBER
2266{
2267 FSVOL_CONTEXT FsVolContext = {Ir, QUIT_PAGE};
2269
2271 {
2272 /* FIXME: show an error dialog */
2273 return QUIT_PAGE;
2274 }
2275
2276 /* Find or set the active system partition before starting formatting */
2281 &FsVolContext);
2282 if (!Success)
2283 return FsVolContext.NextPageOnAbort;
2284 //
2285 // FIXME?? If cannot use any system partition, install FreeLdr on floppy / removable media??
2286 //
2287
2288 /* Set the AUTOCREATE flag if the system partition was automatically created */
2289 if (SystemPartition->New)
2291
2293 CONSOLE_Flush();
2294
2295 /* Apply all pending operations on partitions: formatting and checking */
2300 &FsVolContext);
2301 if (!Success)
2302 return FsVolContext.NextPageOnAbort;
2304}
2305
2306static BOOLEAN
2308 IN PINPUT_RECORD Ir,
2310{
2311 PPARTENTRY PartEntry;
2312 PDISKENTRY DiskEntry;
2313 CHAR LineBuffer[100];
2314
2315 // CONSOLE_ClearScreen();
2316 // CONSOLE_Flush();
2318
2319 PartEntry = PartitionList->SystemPartition;
2320 DiskEntry = PartEntry->DiskEntry;
2321
2322 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2323 CONSOLE_SetTextXY(8, 10, LineBuffer);
2324
2325 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2327 LineBuffer);
2328
2329
2330 PartEntry = SystemPartition;
2331 DiskEntry = PartEntry->DiskEntry;
2332
2333 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2334 CONSOLE_SetTextXY(8, 23, LineBuffer);
2335
2336 while (TRUE)
2337 {
2338 CONSOLE_ConInKey(Ir);
2339
2340 if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2341 break;
2342 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2343 return FALSE;
2344 }
2345
2346 return TRUE;
2347}
2348
2349static VOID
2351{
2352 if (!FileSystemList)
2353 return;
2354
2357}
2358
2359static FSVOL_OP
2361 IN PFSVOL_CONTEXT FsVolContext,
2362 IN PPARTENTRY PartEntry)
2363{
2364 PINPUT_RECORD Ir = FsVolContext->Ir;
2365 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
2366 PCWSTR DefaultFs;
2367 CHAR LineBuffer[100];
2368
2369 DPRINT("SelectFileSystemPage()\n");
2370
2371 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2372
2373Restart:
2374 /* Reset the file system list for each partition that is to be formatted */
2376
2378 CONSOLE_Flush();
2380
2381 if (PartEntry->New & PARTITION_NEW_AUTOCREATE)
2382 {
2383 PartEntry->New &= ~PARTITION_NEW_AUTOCREATE;
2384
2386 }
2387 else if (PartEntry->New)
2388 {
2389 ULONG uID;
2390
2391 if (PartEntry == SystemPartition) // FormatSystemPartition
2393 else if (PartEntry == InstallPartition) // FormatInstallPartition
2395 else // FormatOtherPartition
2397
2398 CONSOLE_SetTextXY(6, 8, MUIGetString(uID));
2399 }
2400 else
2401 {
2403 }
2404
2405 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2406 CONSOLE_SetTextXY(6, 10, LineBuffer);
2407
2408 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2410 LineBuffer);
2411
2412 /* Show "This Partition will be formatted next" only if it is unformatted */
2413 if (PartEntry->New || PartEntry->FormatState == Unformatted)
2415
2417
2419 {
2421
2422 switch (USetupData.FsType)
2423 {
2424 /* 1 is for BtrFS */
2425 case 1:
2426 DefaultFs = L"BTRFS";
2427 break;
2428
2429 /* If we don't understand input, default to FAT */
2430 default:
2431 DefaultFs = L"FAT";
2432 break;
2433 }
2434 }
2435 else
2436 {
2437 /* By default select the "FAT" file system */
2438 DefaultFs = L"FAT";
2439 }
2440
2441 /* Create the file system list */
2442 // TODO: Display only the FSes compatible with the selected partition!
2444 PartEntry->New ||
2445 PartEntry->FormatState == Unformatted,
2446 DefaultFs);
2447 if (!FileSystemList)
2448 {
2449 /* FIXME: show an error dialog */
2450 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2451 return FSVOL_ABORT;
2452 }
2453
2455 {
2457 return FSVOL_DOIT;
2458 }
2459
2461
2462 while (TRUE)
2463 {
2464 CONSOLE_ConInKey(Ir);
2465
2466 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2467 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2468 {
2469 if (ConfirmQuit(Ir))
2470 {
2471 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2472 return FSVOL_ABORT;
2473 }
2474
2475 break;
2476 }
2477 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2478 {
2479 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2480 return FSVOL_ABORT;
2481 }
2482 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2483 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
2484 {
2486 }
2487 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2488 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
2489 {
2491 }
2492 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2493 {
2495 {
2496 ASSERT(!PartEntry->New && PartEntry->FormatState != Unformatted);
2497
2498 /*
2499 * Skip formatting this partition. We will also ignore
2500 * file system checks on it, unless it is either the
2501 * system or the installation partition.
2502 */
2503 if (PartEntry != SystemPartition &&
2504 PartEntry != InstallPartition)
2505 {
2506 PartEntry->NeedsCheck = FALSE;
2507 }
2508 return FSVOL_SKIP;
2509 }
2510 else
2511 {
2512 /* Format this partition */
2513 return FSVOL_DOIT;
2514 }
2515 }
2516 }
2517
2518 goto Restart;
2519}
2520
2521static FSVOL_OP
2523 IN PFSVOL_CONTEXT FsVolContext,
2524 IN PPARTENTRY PartEntry)
2525{
2526 PINPUT_RECORD Ir = FsVolContext->Ir;
2527 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
2528 CHAR LineBuffer[100];
2529
2530Restart:
2532 CONSOLE_Flush();
2534
2535 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2536 CONSOLE_SetTextXY(6, 10, LineBuffer);
2537
2538 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2540 LineBuffer);
2541
2542 while (TRUE)
2543 {
2544 if (!IsUnattendedSetup)
2545 CONSOLE_ConInKey(Ir);
2546
2547 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2548 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2549 {
2550 if (ConfirmQuit(Ir))
2551 {
2552 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2553 return FSVOL_ABORT;
2554 }
2555
2556 goto Restart;
2557 }
2558 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
2559 {
2560 /*
2561 * Remove the "Press ENTER to continue" message prompt when the ENTER
2562 * key is pressed as the user wants to begin the partition formatting.
2563 */
2566
2567 return FSVOL_DOIT;
2568 }
2569 }
2570}
2571
2572static VOID
2574 IN PPARTENTRY PartEntry)
2575{
2576 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
2577 CHAR LineBuffer[100];
2578
2580 CONSOLE_Flush();
2582
2583 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2584 CONSOLE_SetTextXY(6, 10, LineBuffer);
2585
2586 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2588 LineBuffer);
2589}
2590
2591// PFSVOL_CALLBACK
2592static FSVOL_OP
2596 _In_ FSVOLNOTIFY FormatStatus,
2597 _In_ ULONG_PTR Param1,
2598 _In_ ULONG_PTR Param2)
2599{
2600 PFSVOL_CONTEXT FsVolContext = (PFSVOL_CONTEXT)Context;
2601 PINPUT_RECORD Ir = FsVolContext->Ir;
2602
2603 switch (FormatStatus)
2604 {
2605 // FIXME: Deprecate!
2607 {
2609
2610 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2612 return FSVOL_DOIT;
2613 return FSVOL_ABORT;
2614 }
2615
2617 {
2618 switch (Param1)
2619 {
2621 {
2623 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2624 break;
2625 }
2626
2628 {
2629 /* FIXME: improve the error dialog */
2630 //
2631 // Error dialog should say that we cannot find a suitable
2632 // system partition and create one on the system. At this point,
2633 // it may be nice to ask the user whether he wants to continue,
2634 // or use an external drive as the system drive/partition
2635 // (e.g. floppy, USB drive, etc...)
2636 //
2637 PopupError("The ReactOS Setup could not find a supported system partition\n"
2638 "on your system or could not create a new one. Without such partition\n"
2639 "the Setup program cannot install ReactOS.\n"
2640 "Press ENTER to return to the partition selection list.",
2642 Ir, POPUP_WAIT_ENTER);
2643
2644 FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
2645 break;
2646 }
2647
2648 default:
2649 break;
2650 }
2651 return FSVOL_ABORT;
2652 }
2653
2656 // NOTE: If needed, clear screen and flush input.
2657 return FSVOL_DOIT;
2658
2660 {
2661 if ((FSVOL_OP)Param1 == FSVOL_FORMAT)
2662 {
2663 /*
2664 * In case we just repair an existing installation, or make
2665 * an unattended setup without formatting, just go to the
2666 * file system check step.
2667 */
2668 if (RepairUpdateFlag)
2669 return FSVOL_SKIP;
2672 return FSVOL_SKIP;
2673 }
2674 return FSVOL_DOIT;
2675 }
2676
2678 return 0;
2679
2681 {
2682 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
2684
2685 // FIXME: See also FSVOLNOTIFY_PARTITIONERROR
2686 if (FmtInfo->ErrorStatus == STATUS_PARTITION_FAILURE)
2687 {
2689 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2690 return FSVOL_ABORT;
2691 }
2692 else
2694 {
2695 /* FIXME: show an error dialog */
2696 // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
2697 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2698 return FSVOL_ABORT;
2699 }
2700 else
2701 if (FmtInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
2702 {
2704 sizeof(Buffer),
2705 "Setup is currently unable to format a partition in %S.\n"
2706 "\n"
2707 " \x07 Press ENTER to continue Setup.\n"
2708 " \x07 Press F3 to quit Setup.",
2709 FmtInfo->FileSystemName);
2710
2714
2715 while (TRUE)
2716 {
2717 CONSOLE_ConInKey(Ir);
2718
2719 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2720 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2721 {
2722 if (ConfirmQuit(Ir))
2723 {
2724 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2725 return FSVOL_ABORT;
2726 }
2727 else
2728 {
2729 return FSVOL_RETRY;
2730 }
2731 }
2732 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2733 {
2734 return FSVOL_RETRY;
2735 }
2736 }
2737 }
2738 else if (!NT_SUCCESS(FmtInfo->ErrorStatus))
2739 {
2740 WCHAR PathBuffer[MAX_PATH];
2741
2743 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
2744 L"\\Device\\Harddisk%lu\\Partition%lu",
2745 FmtInfo->PartEntry->DiskEntry->DiskNumber,
2746 FmtInfo->PartEntry->PartitionNumber);
2747
2748 DPRINT1("FormatPartition() failed: Status 0x%08lx\n", FmtInfo->ErrorStatus);
2750 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2751 return FSVOL_ABORT;
2752 }
2753 return FSVOL_RETRY;
2754 }
2755
2757 {
2758 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
2760
2761 if (ChkInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
2762 {
2764 sizeof(Buffer),
2765 "Setup is currently unable to check a partition formatted in %S.\n"
2766 "\n"
2767 " \x07 Press ENTER to continue Setup.\n"
2768 " \x07 Press F3 to quit Setup.",
2769 ChkInfo->PartEntry->FileSystem);
2770
2774
2775 while (TRUE)
2776 {
2777 CONSOLE_ConInKey(Ir);
2778
2779 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2780 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2781 {
2782 if (ConfirmQuit(Ir))
2783 {
2784 FsVolContext->NextPageOnAbort = QUIT_PAGE;
2785 return FSVOL_ABORT;
2786 }
2787 else
2788 {
2789 return FSVOL_SKIP;
2790 }
2791 }
2792 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2793 {
2794 return FSVOL_SKIP;
2795 }
2796 }
2797 }
2798 else if (!NT_SUCCESS(ChkInfo->ErrorStatus))
2799 {
2800 DPRINT1("ChkdskPartition() failed: Status 0x%08lx\n", ChkInfo->ErrorStatus);
2801
2803 sizeof(Buffer),
2804 "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
2805 ChkInfo->ErrorStatus);
2806
2809 Ir, POPUP_WAIT_ENTER);
2810 return FSVOL_SKIP;
2811 }
2812 return FSVOL_SKIP;
2813 }
2814
2816 {
2817 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
2819
2820 ASSERT((FSVOL_OP)Param2 == FSVOL_FORMAT);
2821
2822 /* Select the file system */
2823 Result = SelectFileSystemPage(FsVolContext, FmtInfo->PartEntry);
2824 if (Result != FSVOL_DOIT)
2825 return Result;
2826
2827 /* Display the formatting page */
2828 Result = FormatPartitionPage(FsVolContext, FmtInfo->PartEntry);
2829 if (Result != FSVOL_DOIT)
2830 return Result;
2831
2833 return FSVOL_DOIT;
2834 }
2835
2837 {
2838 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
2839 EndFormat(FmtInfo->ErrorStatus);
2840
2841 /* Reset the file system list */
2843 return 0;
2844 }
2845
2847 {
2848 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
2849
2850 ASSERT((FSVOL_OP)Param2 == FSVOL_CHECK);
2851
2853 StartCheck(ChkInfo);
2854 return FSVOL_DOIT;
2855 }
2856
2858 {
2859 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
2860 EndCheck(ChkInfo->ErrorStatus);
2861 return 0;
2862 }
2863 }
2864
2865 return 0;
2866}
2867
2868
2869static BOOLEAN
2871 IN PCWSTR InstallDir)
2872{
2873 UINT i, Length;
2874
2875 Length = wcslen(InstallDir);
2876
2877 // TODO: Add check for 8.3 too.
2878
2879 /* Path must be at least 2 characters long */
2880// if (Length < 2)
2881// return FALSE;
2882
2883 /* Path must start with a backslash */
2884// if (InstallDir[0] != L'\\')
2885// return FALSE;
2886
2887 /* Path must not end with a backslash */
2888 if (InstallDir[Length - 1] == L'\\')
2889 return FALSE;
2890
2891 /* Path must not contain whitespace characters */
2892 for (i = 0; i < Length; i++)
2893 {
2894 if (iswspace(InstallDir[i]))
2895 return FALSE;
2896 }
2897
2898 /* Path component must not end with a dot */
2899 for (i = 0; i < Length; i++)
2900 {
2901 if (InstallDir[i] == L'\\' && i > 0)
2902 {
2903 if (InstallDir[i - 1] == L'.')
2904 return FALSE;
2905 }
2906 }
2907
2908 if (InstallDir[Length - 1] == L'.')
2909 return FALSE;
2910
2911 return TRUE;
2912}
2913
2914
2915/*
2916 * Displays the InstallDirectoryPage.
2917 *
2918 * Next pages:
2919 * PrepareCopyPage
2920 * QuitPage
2921 *
2922 * RETURNS
2923 * Number of the next page.
2924 */
2925static PAGE_NUMBER
2927{
2929 ULONG Length, Pos;
2930 WCHAR c;
2931 WCHAR InstallDir[MAX_PATH];
2932
2934 {
2935 /* FIXME: show an error dialog */
2936 return QUIT_PAGE;
2937 }
2938
2939 // if (IsUnattendedSetup)
2940 if (RepairUpdateFlag)
2941 wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
2944 else
2945 wcscpy(InstallDir, L"\\ReactOS");
2946
2947 /*
2948 * Check the validity of the predefined 'InstallDir'. If we are either
2949 * in unattended setup or in update/repair mode, and the installation path
2950 * is valid, just perform the installation. Otherwise (either in the case
2951 * of an invalid path, or we are in regular setup), display the UI and allow
2952 * the user to specify a new installation path.
2953 */
2954 if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
2955 {
2957 if (!NT_SUCCESS(Status))
2958 {
2959 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
2961 return QUIT_PAGE;
2962 }
2963
2964 /*
2965 * Check whether the user attempts to install ReactOS within the
2966 * installation source directory, or in a subdirectory thereof.
2967 * If so, fail with an error.
2968 */
2970 {
2973 }
2974
2975 return PREPARE_COPY_PAGE;
2976 }
2977
2978 Length = wcslen(InstallDir);
2979 Pos = Length;
2980
2982 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
2983 CONSOLE_SetCursorXY(8 + Pos, 11);
2985
2986 while (TRUE)
2987 {
2988 CONSOLE_ConInKey(Ir);
2989
2990 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2991 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2992 {
2994
2995 if (ConfirmQuit(Ir))
2996 return QUIT_PAGE;
2997
2999 break;
3000 }
3001 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3002 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
3003 {
3004 if (Pos < Length)
3005 {
3006 memmove(&InstallDir[Pos],
3007 &InstallDir[Pos + 1],
3008 (Length - Pos - 1) * sizeof(WCHAR));
3009 InstallDir[Length - 1] = UNICODE_NULL;
3010
3011 Length--;
3012 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3013 CONSOLE_SetCursorXY(8 + Pos, 11);
3014 }
3015 }
3016 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3017 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3018 {
3019 Pos = 0;
3020 CONSOLE_SetCursorXY(8 + Pos, 11);
3021 }
3022 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3023 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3024 {
3025 Pos = Length;
3026 CONSOLE_SetCursorXY(8 + Pos, 11);
3027 }
3028 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3029 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
3030 {
3031 if (Pos > 0)
3032 {
3033 Pos--;
3034 CONSOLE_SetCursorXY(8 + Pos, 11);
3035 }
3036 }
3037 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3038 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
3039 {
3040 if (Pos < Length)
3041 {
3042 Pos++;
3043 CONSOLE_SetCursorXY(8 + Pos, 11);
3044 }
3045 }
3046 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3047 {
3049
3050 /*
3051 * Check for the validity of the installation directory and pop up
3052 * an error if it is not the case. Then the user can fix its input.
3053 */
3054 if (!IsValidPath(InstallDir))
3055 {
3058 }
3059
3061 if (!NT_SUCCESS(Status))
3062 {
3063 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
3065 return QUIT_PAGE;
3066 }
3067
3068 /*
3069 * Check whether the user attempts to install ReactOS within the
3070 * installation source directory, or in a subdirectory thereof.
3071 * If so, fail with an error.
3072 */
3074 {
3077 }
3078
3079 return PREPARE_COPY_PAGE;
3080 }
3081 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3082 {
3083 if (Pos > 0)
3084 {
3085 if (Pos < Length)
3086 memmove(&InstallDir[Pos - 1],
3087 &InstallDir[Pos],
3088 (Length - Pos) * sizeof(WCHAR));
3089 InstallDir[Length - 1] = UNICODE_NULL;
3090
3091 Pos--;
3092 Length--;
3093 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3094 CONSOLE_SetCursorXY(8 + Pos, 11);
3095 }
3096 }
3097 else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3098 {
3099 if (Length < 50)
3100 {
3102 if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
3103 {
3104 if (Pos < Length)
3105 memmove(&InstallDir[Pos + 1],
3106 &InstallDir[Pos],
3107 (Length - Pos) * sizeof(WCHAR));
3108 InstallDir[Length + 1] = UNICODE_NULL;
3109 InstallDir[Pos] = c;
3110
3111 Pos++;
3112 Length++;
3113 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3114 CONSOLE_SetCursorXY(8 + Pos, 11);
3115 }
3116 }
3117 }
3118 }
3119
3121}
3122
3123
3124// PSETUP_ERROR_ROUTINE
3125static VOID
3126__cdecl
3128 IN PUSETUP_DATA pSetupData,
3129 ...)
3130{
3131 INPUT_RECORD Ir;
3132 va_list arg_ptr;
3133
3134 va_start(arg_ptr, pSetupData);
3135
3136 if (pSetupData->LastErrorNumber >= ERROR_SUCCESS &&
3137 pSetupData->LastErrorNumber < ERROR_LAST_ERROR_CODE)
3138 {
3139 // Note: the "POPUP_WAIT_ENTER" actually depends on the LastErrorNumber...
3140 MUIDisplayErrorV(pSetupData->LastErrorNumber, &Ir, POPUP_WAIT_ENTER, arg_ptr);
3141 }
3142
3143 va_end(arg_ptr);
3144}
3145
3146/*
3147 * Displays the PrepareCopyPage.
3148 *
3149 * Next pages:
3150 * FileCopyPage(At once)
3151 * QuitPage
3152 *
3153 * SIDEEFFECTS
3154 * Calls PrepareFileCopy
3155 *
3156 * RETURNS
3157 * Number of the next page.
3158 */
3159static PAGE_NUMBER
3161{
3162 // ERROR_NUMBER ErrorNumber;
3164
3166
3167 /* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
3168 if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
3169 {
3170 // MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
3171 return QUIT_PAGE;
3172 }
3173
3174 return FILE_COPY_PAGE;
3175}
3176
3177typedef struct _COPYCONTEXT
3178{
3184
3185static VOID
3188{
3190
3191 /* Get the memory information from the system */
3193 &PerfInfo,
3194 sizeof(PerfInfo),
3195 NULL);
3196
3197 /* Check if this is initial setup */
3198 if (First)
3199 {
3200 /* Set maximum limits to be total RAM pages */
3201 ProgressSetStepCount(CopyContext->MemoryBars[0], PerfInfo.CommitLimit);
3202 ProgressSetStepCount(CopyContext->MemoryBars[1], PerfInfo.CommitLimit);
3203 ProgressSetStepCount(CopyContext->MemoryBars[2], PerfInfo.CommitLimit);
3204 }
3205
3206 /* Set current values */
3207 ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages + PerfInfo.NonPagedPoolPages);
3208 ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.ResidentSystemCachePage);
3209 ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages);
3210}
3211
3212static UINT
3216 UINT_PTR Param1,
3217 UINT_PTR Param2)
3218{
3219 PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
3220 PFILEPATHS_W FilePathInfo;
3221 PCWSTR SrcFileName, DstFileName;
3222
3223 switch (Notification)
3224 {
3226 {
3227 CopyContext->TotalOperations = (ULONG)Param2;
3228 CopyContext->CompletedOperations = 0;
3229 ProgressSetStepCount(CopyContext->ProgressBar,
3230 CopyContext->TotalOperations);
3231 SetupUpdateMemoryInfo(CopyContext, TRUE);
3232 break;
3233 }
3234
3238 {
3239 FilePathInfo = (PFILEPATHS_W)Param1;
3240
3242 {
3243 /* Display delete message */
3244 ASSERT(Param2 == FILEOP_DELETE);
3245
3246 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3247 if (DstFileName) ++DstFileName;
3248 else DstFileName = FilePathInfo->Target;
3249
3251 DstFileName);
3252 }
3254 {
3255 /* Display move/rename message */
3256 ASSERT(Param2 == FILEOP_RENAME);
3257
3258 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
3259 if (SrcFileName) ++SrcFileName;
3260 else SrcFileName = FilePathInfo->Source;
3261
3262 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3263 if (DstFileName) ++DstFileName;
3264 else DstFileName = FilePathInfo->Target;
3265
3266 if (!wcsicmp(SrcFileName, DstFileName))
3267 Param2 = STRING_MOVING;
3268 else
3269 Param2 = STRING_RENAMING;
3270
3272 SrcFileName, DstFileName);
3273 }
3275 {
3276 static PCSTR s_pszCopying = NULL; /* Cached for speed */
3277
3278 /* Display copy message */
3279 ASSERT(Param2 == FILEOP_COPY);
3280
3281 /* NOTE: When extracting from CABs the Source is the CAB name */
3282 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3283 if (DstFileName) ++DstFileName;
3284 else DstFileName = FilePathInfo->Target;
3285
3286 if (!s_pszCopying)
3287 s_pszCopying = MUIGetString(STRING_COPYING);
3288 CONSOLE_SetStatusText(s_pszCopying, DstFileName);
3289#ifdef __REACTOS__ /* HACK */
3290 DoWatchDestFileName(DstFileName);
3291#endif
3292 }
3293
3294 SetupUpdateMemoryInfo(CopyContext, FALSE);
3295 break;
3296 }
3297
3299 {
3300 FilePathInfo = (PFILEPATHS_W)Param1;
3301
3302 DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
3303 FilePathInfo->Target, FilePathInfo->Win32Error);
3304 return FILEOP_SKIP;
3305 }
3306
3310 {
3311 CopyContext->CompletedOperations++;
3312
3313 /* SYSREG checkpoint */
3314 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
3315 DPRINT1("CHECKPOINT:HALF_COPIED\n");
3316
3317 ProgressNextStep(CopyContext->ProgressBar);
3318 SetupUpdateMemoryInfo(CopyContext, FALSE);
3319 break;
3320 }
3321 }
3322
3323 return FILEOP_DOIT;
3324}
3325
3326
3327/*
3328 * Displays the FileCopyPage.
3329 *
3330 * Next pages:
3331 * RegistryPage(At once)
3332 *
3333 * SIDEEFFECTS
3334 * Calls DoFileCopy
3335 *
3336 * RETURNS
3337 * Number of the next page.
3338 */
3339static PAGE_NUMBER
3341{
3342 COPYCONTEXT CopyContext;
3343 UINT MemBarWidth;
3344
3346
3347 /* Create context for the copy process */
3348 CopyContext.TotalOperations = 0;
3349 CopyContext.CompletedOperations = 0;
3350
3351 /* Create the progress bar as well */
3352 CopyContext.ProgressBar = CreateProgressBar(13,
3353 26,
3354 xScreen - 13,
3355 yScreen - 20,
3356 10,
3357 24,
3358 TRUE,
3360
3361 // fit memory bars to screen width, distribute them uniform
3362 MemBarWidth = (xScreen - 26) / 5;
3363 MemBarWidth -= MemBarWidth % 2; // make even
3364 /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
3365 /* Create the paged pool progress bar */
3366 CopyContext.MemoryBars[0] = CreateProgressBar(13,
3367 40,
3368 13 + MemBarWidth,
3369 43,
3370 13,
3371 44,
3372 FALSE,
3373 "Kernel Pool");
3374
3375 /* Create the non paged pool progress bar */
3376 CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (MemBarWidth / 2),
3377 40,
3378 (xScreen / 2) + (MemBarWidth / 2),
3379 43,
3380 (xScreen / 2)- (MemBarWidth / 2),
3381 44,
3382 FALSE,
3383 "Kernel Cache");
3384
3385 /* Create the global memory progress bar */
3386 CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - MemBarWidth,
3387 40,
3388 xScreen - 13,
3389 43,
3390 xScreen - 13 - MemBarWidth,
3391 44,
3392 FALSE,
3393 "Free Memory");
3394
3395 /* Do the file copying */
3396 DoFileCopy(&USetupData, FileCopyCallback, &CopyContext);
3397
3398 /* If we get here, we're done, so cleanup the progress bar */
3399 DestroyProgressBar(CopyContext.ProgressBar);
3400 DestroyProgressBar(CopyContext.MemoryBars[0]);
3401 DestroyProgressBar(CopyContext.MemoryBars[1]);
3402 DestroyProgressBar(CopyContext.MemoryBars[2]);
3403
3404 /* Create the $winnt$.inf file */
3406
3407 /* Go display the next page */
3408 return REGISTRY_PAGE;
3409}
3410
3411
3412static VOID
3413__cdecl
3415{
3416 /* WARNING: Please keep this lookup table in sync with the resources! */
3417 static const UINT StringIDs[] =
3418 {
3419 STRING_DONE, /* Success */
3420 STRING_REGHIVEUPDATE, /* RegHiveUpdate */
3421 STRING_IMPORTFILE, /* ImportRegHive */
3422 STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
3423 STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
3424 STRING_ADDKBLAYOUTS, /* KeybLayouts */
3425 STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
3426 STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
3427 };
3428
3429 va_list args;
3430
3431 if (RegStatus < ARRAYSIZE(StringIDs))
3432 {
3433 va_start(args, RegStatus);
3434 CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
3435 va_end(args);
3436 }
3437 else
3438 {
3439 CONSOLE_SetStatusText("Unknown status %d", RegStatus);
3440 }
3441}
3442
3443/*
3444 * Displays the RegistryPage.
3445 *
3446 * Next pages:
3447 * BootLoaderSelectPage
3448 * QuitPage
3449 *
3450 * SIDEEFFECTS
3451 * Calls UpdateRegistry
3452 *
3453 * RETURNS
3454 * Number of the next page.
3455 */
3456static PAGE_NUMBER
3458{
3459 ULONG Error;
3460
3462
3469 &s_SubstSettings);
3470 if (Error != ERROR_SUCCESS)
3471 {
3473 return QUIT_PAGE;
3474 }
3475 else
3476 {
3479 }
3480}
3481
3482
3483/*
3484 * Displays the BootLoaderSelectPage.
3485 *
3486 * Next pages:
3487 * SuccessPage
3488 * QuitPage
3489 *
3490 * RETURNS
3491 * Number of the next page.
3492 */
3493static PAGE_NUMBER
3495{
3496 USHORT Line = 12;
3497
3499
3500 /* We must have a supported system partition by now */
3502
3503 /*
3504 * If we repair an existing installation and we made it up to here,
3505 * this means a valid bootloader and boot entry have been found.
3506 * Thus, there is no need to re-install it: skip its installation.
3507 */
3508 if (RepairUpdateFlag)
3509 {
3511 goto Quit;
3512 }
3513
3514 /* For unattended setup, skip MBR installation or install on removable disk if needed */
3516 {
3517 if ((USetupData.MBRInstallType == 0) ||
3519 {
3520 goto Quit;
3521 }
3522 }
3523
3524#if 0 // Deprecated code, whose global logic may need to be moved elsewhere...
3525 /*
3526 * We may install an MBR or VBR, but before that, check whether
3527 * we need to actually install the VBR on removable disk if the
3528 * system partition is not recognized.
3529 */
3530 if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
3532 {
3534 goto Quit;
3535 }
3536#endif
3537
3538 /* Is it an unattended install on hdd? */
3540 {
3541 if ((USetupData.MBRInstallType == 2) ||
3543 {
3544 goto Quit;
3545 }
3546 }
3547
3549 CONSOLE_InvertTextXY(8, Line, 60, 1);
3550
3551 while (TRUE)
3552 {
3553 CONSOLE_ConInKey(Ir);
3554
3555 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3556 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
3557 {
3558 CONSOLE_NormalTextXY(8, Line, 60, 1);
3559
3560 Line++;
3561 if (Line < 12)
3562 Line = 15;
3563
3564 if (Line > 15)
3565 Line = 12;
3566
3567 CONSOLE_InvertTextXY(8, Line, 60, 1);
3568 }
3569 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3570 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
3571 {
3572 CONSOLE_NormalTextXY(8, Line, 60, 1);
3573
3574 Line--;
3575 if (Line < 12)
3576 Line = 15;
3577
3578 if (Line > 15)
3579 Line = 12;
3580
3581 CONSOLE_InvertTextXY(8, Line, 60, 1);
3582 }
3583 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3584 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3585 {
3586 CONSOLE_NormalTextXY(8, Line, 60, 1);
3587
3588 Line = 12;
3589
3590 CONSOLE_InvertTextXY(8, Line, 60, 1);
3591 }
3592 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3593 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3594 {
3595 CONSOLE_NormalTextXY(8, Line, 60, 1);
3596
3597 Line = 15;
3598
3599 CONSOLE_InvertTextXY(8, Line, 60, 1);
3600 }
3601 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3602 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3603 {
3604 if (ConfirmQuit(Ir))
3605 return QUIT_PAGE;
3606
3607 break;
3608 }
3609 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3610 {
3611 if (Line == 12)
3612 {
3613 /* Install on both MBR and VBR */
3615 break;
3616 }
3617 else if (Line == 13)
3618 {
3619 /* Install on VBR only */
3621 break;
3622 }
3623 else if (Line == 14)
3624 {
3625 /* Install on removable disk */
3627 break;
3628 }
3629 else if (Line == 15)
3630 {
3631 /* Skip installation */
3633 break;
3634 }
3635
3637 }
3638 }
3639
3640Quit:
3641 /* Continue the installation; the bootloader is installed at the end */
3643}
3644
3645
3646/*
3647 * Installs the bootloader on removable disk.
3648 */
3649static BOOLEAN
3651{
3653
3654Retry:
3656 CONSOLE_Flush();
3658// CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
3659
3660 while (TRUE)
3661 {
3662 CONSOLE_ConInKey(Ir);
3663
3664 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3665 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3666 {
3667 if (ConfirmQuit(Ir))
3668 return FALSE;
3669
3670 break;
3671 }
3672 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3673 {
3676 if (!NT_SUCCESS(Status))
3677 {
3680
3681 /* TODO: Print error message */
3682 goto Retry;
3683 }
3684
3685 return TRUE;
3686 }
3687 }
3688
3689 goto Retry;
3690}
3691
3692/*
3693 * Installs the bootloader on hard-disk.
3694 */
3695static BOOLEAN
3697{
3699 WCHAR DestinationDevicePathBuffer[MAX_PATH];
3700
3701 if (USetupData.MBRInstallType == 2)
3702 {
3703 /* Step 1: Write the VBR */
3708 if (!NT_SUCCESS(Status))
3709 {
3712 return FALSE;
3713 }
3714
3715 /* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
3717 {
3718 RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
3719 L"\\Device\\Harddisk%d\\Partition0",
3720 SystemPartition->DiskEntry->DiskNumber);
3723 DestinationDevicePathBuffer);
3724 if (!NT_SUCCESS(Status))
3725 {
3726 DPRINT1("InstallMbrBootCodeToDisk() failed: Status 0x%lx\n", Status);
3728 return FALSE;
3729 }
3730 }
3731 }
3732 else
3733 {
3738 if (!NT_SUCCESS(Status))
3739 {
3742 return FALSE;
3743 }
3744 }
3745
3746 return TRUE;
3747}
3748
3749/*
3750 * Actually installs the bootloader at the end of the installation.
3751 * The bootloader installation place has already been chosen before,
3752 * see BootLoaderSelectPage().
3753 *
3754 * Next pages:
3755 * SuccessPage (At once)
3756 * QuitPage
3757 *
3758 * RETURNS
3759 * Number of the next page.
3760 */
3761static PAGE_NUMBER
3763{
3764 WCHAR PathBuffer[MAX_PATH];
3765
3766 // /* We must have a supported system partition by now */
3767 // ASSERT(SystemPartition && SystemPartition->IsPartitioned && SystemPartition->PartitionNumber != 0);
3768
3770 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3771 L"\\Device\\Harddisk%lu\\Partition%lu\\",
3772 SystemPartition->DiskEntry->DiskNumber,
3775 DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
3776
3777 if (USetupData.MBRInstallType != 0)
3779
3780 switch (USetupData.MBRInstallType)
3781 {
3782 /* Skip installation */
3783 case 0:
3784 return SUCCESS_PAGE;
3785
3786 /* Install on removable disk */
3787 case 1:
3789
3790 /* Install on hard-disk (both MBR and VBR, or VBR only) */
3791 case 2:
3792 case 3:
3794
3795 default:
3796 return SUCCESS_PAGE;
3797 }
3798}
3799
3800
3823static
3827 IN BOOLEAN AlwaysUpdate,
3828 OUT PSTR Buffer,
3829 IN SIZE_T cchBufferSize)
3830{
3831 ULONG OldProgress = Bar->Progress;
3832
3833 if (Bar->StepCount == 0)
3834 {
3835 Bar->Progress = 0;
3836 }
3837 else
3838 {
3839 Bar->Progress = Bar->StepCount - Bar->CurrentStep;
3840 }
3841
3842 /* Build the progress string if it has changed */
3843 if (Bar->ProgressFormatText &&
3844 (AlwaysUpdate || (Bar->Progress != OldProgress)))
3845 {
3846 RtlStringCchPrintfA(Buffer, cchBufferSize,
3847 Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
3848
3849 return TRUE;
3850 }
3851
3852 return FALSE;
3853}
3854
3871static VOID
3873 IN PINPUT_RECORD Ir,
3874 IN LONG TimeOut)
3875{
3877 ULONG StartTime, BarWidth, TimerDiv;
3878 LONG TimeElapsed;
3879 LONG TimerValue, OldTimerValue;
3882 BOOLEAN RefreshProgress = TRUE;
3883
3884 /* Bail out if the timeout is already zero */
3885 if (TimeOut <= 0)
3886 return;
3887
3888 /* Create the timeout progress bar and set it up */
3890 26,
3891 xScreen - 13,
3892 yScreen - 20,
3893 10,
3894 24,
3895 TRUE,
3897 0,
3898 NULL,
3901
3902 BarWidth = max(1, ProgressBar->Width);
3903 TimerValue = TimeOut * BarWidth;
3904 ProgressSetStepCount(ProgressBar, TimerValue);
3905
3907 CONSOLE_Flush();
3908
3909 TimerDiv = 1000 / BarWidth;
3910 TimerDiv = max(1, TimerDiv);
3911 OldTimerValue = TimerValue;
3912 while (TRUE)
3913 {
3914 /* Decrease the timer */
3915
3916 /*
3917 * Compute how much time the previous operations took.
3918 * This allows us in particular to take account for any time
3919 * elapsed if something slowed down.
3920 */
3921 TimeElapsed = NtGetTickCount() - StartTime;
3922 if (TimeElapsed >= TimerDiv)
3923 {
3924 /* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
3925 TimeElapsed /= TimerDiv;
3926 StartTime += (TimerDiv * TimeElapsed);
3927
3928 if (TimeElapsed <= TimerValue)
3929 TimerValue -= TimeElapsed;
3930 else
3931 TimerValue = 0;
3932
3933 RefreshProgress = TRUE;
3934 }
3935
3936 if (RefreshProgress)
3937 {
3938 ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
3939 RefreshProgress = FALSE;
3940 }
3941
3942 /* Stop when the timer reaches zero */
3943 if (TimerValue <= 0)
3944 break;
3945
3946 /* Check for user key presses */
3947
3948 /*
3949 * If the timer is used, use a passive wait of maximum 1 second
3950 * while monitoring for incoming console input events, so that
3951 * we are still able to display the timing count.
3952 */
3953
3954 /* Wait a maximum of 1 second for input events */
3955 TimeElapsed = NtGetTickCount() - StartTime;
3956 if (TimeElapsed < TimerDiv)
3957 {
3958 /* Convert the time to NT format */
3959 Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
3961 }
3962 else
3963 {
3965 }
3966
3967 /* Check whether the input event has been signaled, or a timeout happened */
3968 if (Status == STATUS_TIMEOUT)
3969 {
3970 continue;
3971 }
3972 if (Status != STATUS_WAIT_0)
3973 {
3974 /* An error happened, bail out */
3975 DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
3976 break;
3977 }
3978
3979 /* Check for an ENTER key press */
3980 while (CONSOLE_ConInKeyPeek(Ir))
3981 {
3982 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3983 {
3984 /* Found it, stop waiting */
3985 goto Exit;
3986 }
3987 }
3988 }
3989
3990Exit:
3991 /* Destroy the progress bar and quit */
3993}
3994
3995
3996/*
3997 * Displays the QuitPage.
3998 *
3999 * Next pages:
4000 * FlushPage (At once)
4001 *
4002 * SIDEEFFECTS
4003 * Destroy the Lists
4004 *
4005 * RETURNS
4006 * Number of the next page.
4007 */
4008static PAGE_NUMBER
4010{
4012
4013 /* Destroy the NTOS installations list */
4014 if (NtOsInstallsList != NULL)
4015 {
4018 }
4019
4020 /* Destroy the partition list */
4021 if (PartitionList != NULL)
4022 {
4025 }
4026
4028
4029 /* Wait for maximum 15 seconds or an ENTER key before quitting */
4030 ProgressCountdown(Ir, 15);
4031 return FLUSH_PAGE;
4032}
4033
4034
4035/*
4036 * Displays the SuccessPage.
4037 *
4038 * Next pages:
4039 * FlushPage (At once)
4040 *
4041 * SIDEEFFECTS
4042 * Destroy the Lists
4043 *
4044 * RETURNS
4045 * Number of the next page.
4046 */
4047static PAGE_NUMBER
4049{
4051
4053 return FLUSH_PAGE;
4054
4055 /* Wait for maximum 15 seconds or an ENTER key before quitting */
4056 ProgressCountdown(Ir, 15);
4057 return FLUSH_PAGE;
4058}
4059
4060
4061/*
4062 * Displays the FlushPage.
4063 *
4064 * Next pages:
4065 * RebootPage (At once)
4066 *
4067 * RETURNS
4068 * Number of the next page.
4069 */
4070static PAGE_NUMBER
4072{
4074 return REBOOT_PAGE;
4075}
4076
4077
4078/*
4079 * The start routine and page management
4080 */
4083{
4085 INPUT_RECORD Ir;
4087 BOOLEAN Old;
4088
4090
4091 /* Tell the Cm this is a setup boot, and it has to behave accordingly */
4093 if (!NT_SUCCESS(Status))
4094 DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
4095
4096 /* Initialize the user-mode PnP manager */
4098 if (!NT_SUCCESS(Status))
4099 {
4100 // PrintString(??);
4101 DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
4102 }
4103
4104 if (!CONSOLE_Init())
4105 {
4109
4110 /* We failed to initialize the video, just quit the installer */
4112 }
4113
4114 /* Initialize Setup, phase 0 */
4117
4118 /* Hide the cursor and clear the screen and keyboard buffer */
4121 CONSOLE_Flush();
4122
4123 /* Global Initialization page */
4124 Page = SetupStartPage(&Ir);
4125
4126 while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
4127 {
4129 CONSOLE_Flush();
4130
4131 // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4132
4133 switch (Page)
4134 {
4135 /* Language page */
4136 case LANGUAGE_PAGE:
4137 Page = LanguagePage(&Ir);
4138 break;
4139
4140 /* Welcome page */
4141 case WELCOME_PAGE:
4142 Page = WelcomePage(&Ir);
4143 break;
4144
4145 /* License page */
4146 case LICENSE_PAGE:
4147 Page = LicensePage(&Ir);
4148 break;
4149
4150 /* Install pages */
4151 case INSTALL_INTRO_PAGE:
4152 Page = InstallIntroPage(&Ir);
4153 break;
4154
4155#if 0
4156 case SCSI_CONTROLLER_PAGE:
4157 Page = ScsiControllerPage(&Ir);
4158 break;
4159
4160 case OEM_DRIVER_PAGE:
4161 Page = OemDriverPage(&Ir);
4162 break;
4163#endif
4164
4166 Page = DeviceSettingsPage(&Ir);
4167 break;
4168
4171 break;
4172
4175 break;
4176
4179 break;
4180
4182 Page = LayoutSettingsPage(&Ir);
4183 break;
4184
4185 /* Partitioning pages */
4188 break;
4189
4192 break;
4193
4196 break;
4197
4200 break;
4201
4202 /* File system partition operations pages */
4205 break;
4206
4207 /* Bootloader selection page */
4210 break;
4211
4212 /* Installation pages */
4215 break;
4216
4217 case PREPARE_COPY_PAGE:
4218 Page = PrepareCopyPage(&Ir);
4219 break;
4220
4221 case FILE_COPY_PAGE:
4222 Page = FileCopyPage(&Ir);
4223 break;
4224
4225 case REGISTRY_PAGE:
4226 Page = RegistryPage(&Ir);
4227 break;
4228
4229 /* Bootloader installation page */
4231 // case BOOTLOADER_REMOVABLE_DISK_PAGE:
4233 break;
4234
4235 /* Repair pages */
4236 case REPAIR_INTRO_PAGE:
4237 Page = RepairIntroPage(&Ir);
4238 break;
4239
4241 Page = UpgradeRepairPage(&Ir);
4242 break;
4243
4244 case SUCCESS_PAGE:
4245 Page = SuccessPage(&Ir);
4246 break;
4247
4248 case FLUSH_PAGE:
4249 Page = FlushPage(&Ir);
4250 break;
4251
4252 case QUIT_PAGE:
4253 Page = QuitPage(&Ir);
4254 break;
4255
4256 /* Virtual pages */
4257 case SETUP_INIT_PAGE:
4260 // case CHECK_FILE_SYSTEM_PAGE:
4261 case REBOOT_PAGE:
4262 case RECOVERY_PAGE:
4263 break;
4264
4265 default:
4266 break;
4267 }
4268 }
4269
4270 /* Terminate the user-mode PnP manager */
4272
4273 /* Setup has finished */
4275
4276 if (Page == RECOVERY_PAGE)
4278
4279 FreeConsole();
4280
4281 /* Reboot */
4285
4286 return STATUS_SUCCESS;
4287}
4288
4289
4290VOID NTAPI
4292{
4295
4297
4299
4301
4302 Status = RunUSetup();
4303
4304 if (NT_SUCCESS(Status))
4305 {
4306 /*
4307 * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
4308 * a protective waiting.
4309 * This wait is needed because, since we are started as SMSS.EXE,
4310 * the NT kernel explicitly waits 5 seconds for the initial process
4311 * SMSS.EXE to initialize (as a protective measure), and otherwise
4312 * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
4313 */
4314 Time.QuadPart += 50000000;
4316 }
4317 else
4318 {
4319 /* The installer failed to start: raise a hard error (crash the system/BSOD) */
4321 0, 0, NULL, 0, NULL);
4322 }
4323
4325}
4326
4327/* EOF */
DWORD Id
WCHAR First[]
Definition: FormatMessage.c:11
unsigned char BOOLEAN
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define isprint(c)
Definition: acclib.h:73
int toupper(int c)
Definition: utclib.c:881
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define __cdecl
Definition: accygwin.h:79
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOLEAN DoFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
Definition: install.c:826
BOOLEAN PrepareFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
Definition: install.c:684
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 FreeConsole(VOID)
Definition: console.c:156
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
#define PARTITION_EXTENDED
Definition: disk.h:91
NTSTATUS InstallVBRToPartition(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath, IN PCWSTR FileSystemName)
Definition: bootsup.c:1381
NTSTATUS InstallFatBootcodeToFloppy(IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1426
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
Definition: bootsup.c:831
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
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 wcsrchr
Definition: compat.h:16
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define wcsicmp
Definition: compat.h:15
PPEB Peb
Definition: dllmain.c:27
#define swprintf
Definition: precomp.h:40
@ AnsiString
Definition: dnslib.h:19
VOID DrawPartitionList(IN HWND hWndList, IN PPARTLIST List)
Definition: drivepage.c:591
#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:25
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
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
#define iswspace(_c)
Definition: ctype.h:669
#define iswdigit(_c)
Definition: ctype.h:667
#define iswalpha(_c)
Definition: ctype.h:664
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
VOID InfSetHeap(PVOID Heap)
Definition: infrosgen.c:40
#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
VOID SetCurrentListEntry(IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:87
PGENERIC_LIST_ENTRY GetFirstListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:104
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
ULONG GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:140
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
PGENERIC_LIST_ENTRY GetNextListEntry(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:114
struct _PARTENTRY * PPARTENTRY
@ Unformatted
Definition: partlist.h:34
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:230
if(dx< 0)
Definition: linetemp.h:194
#define SystemPerformanceInformation
Definition: memtest.h:87
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#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(buf, format,...)
Definition: sprintf.c:55
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
#define ULL(a, b)
Definition: format_msg.c:27
static PLARGE_INTEGER Time
Definition: time.c:105
#define min(a, b)
Definition: monoChain.cc:55
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define CM_BOOT_FLAG_SETUP
Definition: cmtypes.h:159
@ 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)
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:1657
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 UNICODE_NULL
CONST CHAR * PCCH
Definition: ntbasedef.h:392
#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:569
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define STATUS_WAIT_0
Definition: ntstatus.h:237
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_PARTITION_FAILURE
Definition: ntstatus.h:604
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:670
#define STATUS_APP_INIT_FAILURE
Definition: ntstatus.h:561
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
#define L(x)
Definition: ntvdm.h:50
PGENERIC_LIST CreateNTOSInstallationsList(IN PPARTLIST PartList)
Definition: osdetect.c:778
struct _NTOS_INSTALLATION * PNTOS_INSTALLATION
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
static ULONG Timeout
Definition: ping.c:61
#define NtGetTickCount
Definition: rtlp.h:163
@ Restart
Definition: sacdrv.h:269
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define args
Definition: format.c:66
BOOLEAN FsVolCommitOpsQueue(_In_ PPARTLIST PartitionList, _In_ PPARTENTRY SystemPartition, _In_ PPARTENTRY InstallPartition, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Definition: fsutil.c:1137
@ FSVOLNOTIFY_STARTCHECK
Definition: fsutil.h:146
@ FSVOLNOTIFY_ENDQUEUE
Definition: fsutil.h:138
@ FSVOLNOTIFY_STARTSUBQUEUE
Definition: fsutil.h:139
@ FSVOLNOTIFY_ENDFORMAT
Definition: fsutil.h:144
@ FSVOLNOTIFY_STARTFORMAT
Definition: fsutil.h:143
@ FSVOLNOTIFY_STARTQUEUE
Definition: fsutil.h:137
@ FSVOLNOTIFY_ENDSUBQUEUE
Definition: fsutil.h:140
@ FSVOLNOTIFY_PARTITIONERROR
Definition: fsutil.h:142
@ FSVOLNOTIFY_CHECKERROR
Definition: fsutil.h:148
@ ChangeSystemPartition
Definition: fsutil.h:149
@ FSVOLNOTIFY_FORMATERROR
Definition: fsutil.h:145
@ FSVOLNOTIFY_ENDCHECK
Definition: fsutil.h:147
enum _FSVOL_OP FSVOL_OP
struct _FORMAT_VOLUME_INFO * PFORMAT_VOLUME_INFO
@ FSVOL_FORMAT
Definition: fsutil.h:155
@ FSVOL_CHECK
Definition: fsutil.h:156
@ FSVOL_DOIT
Definition: fsutil.h:159
@ FSVOL_ABORT
Definition: fsutil.h:158
@ FSVOL_RETRY
Definition: fsutil.h:160
@ FSVOL_SKIP
Definition: fsutil.h:161
enum _FSVOLNOTIFY FSVOLNOTIFY
struct _CHECK_VOLUME_INFO * PCHECK_VOLUME_INFO
ERROR_NUMBER ExtendedPartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2806
VOID DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:2007
ERROR_NUMBER PartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2761
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:95
BOOLEAN CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2844
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:501
BOOLEAN DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
Definition: partlist.c:3002
PPARTLIST CreatePartitionList(VOID)
Definition: partlist.c:1923
BOOLEAN IsPartitionActive(IN PPARTENTRY PartEntry)
Definition: partlist.c:1844
PPARTENTRY SelectPartition(_In_ PPARTLIST List, _In_ ULONG DiskNumber, _In_ ULONG PartitionNumber)
Definition: partlist.c:2204
VOID ScrollUpDownPartitionList(_In_ PPARTLIST_UI ListUi, _In_ BOOLEAN Direction)
Definition: partlist.c:841
VOID PartitionDescription(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:148
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:301
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:351
#define ERROR_NOT_INSTALLED
Definition: setupapi.h:292
BOOLEAN 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:626
VOID FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:950
VOID CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:28
ERROR_NUMBER 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:1000
VOID InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:214
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:716
ERROR_NUMBER InitializeSetup(IN OUT PUSETUP_DATA pSetupData, IN ULONG InitPhase)
Definition: setuplib.c:873
#define ERROR_SYSTEM_PARTITION_NOT_FOUND
Definition: setuplib.h:170
enum _REGISTRY_STATUS REGISTRY_STATUS
#define MB
Definition: setuplib.h:56
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
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)
base of all file and directory entries
Definition: entries.h:83
Definition: ncftp.h:79
NTSTATUS ErrorStatus
Definition: fsutil.h:184
PPARTENTRY PartEntry
Definition: fsutil.h:182
Definition: bl.h:1338
ULONG Y
Definition: bl.h:1340
ULONG X
Definition: bl.h:1339
PPROGRESSBAR MemoryBars[4]
Definition: usetup.c:3182
ULONG TotalOperations
Definition: reactos.c:981
ULONG CompletedOperations
Definition: reactos.c:982
PPROGRESSBAR ProgressBar
Definition: usetup.c:3181
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
PPARTENTRY PartEntry
Definition: fsutil.h:166
NTSTATUS ErrorStatus
Definition: fsutil.h:168
PCWSTR FileSystemName
Definition: fsutil.h:171
PAGE_NUMBER NextPageOnAbort
Definition: usetup.c:2261
PINPUT_RECORD Ir
Definition: usetup.c:2260
Definition: genlist.h:11
union _INPUT_RECORD::@3288 Event
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
union _KEY_EVENT_RECORD::@3287 uChar
WORD wVirtualKeyCode
Definition: wincon.h:242
ULONG PartitionNumber
Definition: osdetect.h:24
WCHAR InstallationName[MAX_PATH]
Definition: osdetect.h:26
UNICODE_STRING SystemNtPath
Definition: osdetect.h:21
PPARTENTRY PartEntry
Definition: osdetect.h:25
PCWSTR PathComponent
Definition: osdetect.h:22
BOOLEAN IsPartitioned
Definition: partlist.h:66
UCHAR PartitionType
Definition: partlist.h:53
BOOLEAN New
Definition: partlist.h:71
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:60
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
BOOLEAN LogicalPartition
Definition: partlist.h:63
FORMATSTATE FormatState
Definition: partlist.h:61
WCHAR DriveLetter
Definition: partlist.h:58
ULONG PartitionNumber
Definition: partlist.h:55
PPARTENTRY CurrentPartition
Definition: partlist.h:43
PPARTENTRY SystemPartition
Definition: partlist.h:160
LIST_ENTRY DiskListHead
Definition: partlist.h:162
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:120
LONG DestinationPartitionNumber
Definition: setuplib.h:111
PGENERIC_LIST LanguageList
Definition: setuplib.h:123
LONG MBRInstallType
Definition: setuplib.h:113
UNICODE_STRING SourcePath
Definition: setuplib.h:84
PGENERIC_LIST LayoutList
Definition: setuplib.h:122
PGENERIC_LIST ComputerList
Definition: setuplib.h:119
PSETUP_ERROR_ROUTINE ErrorRoutine
Definition: setuplib.h:73
HINF SetupInf
Definition: setuplib.h:76
UNICODE_STRING SystemRootPath
Definition: setuplib.h:100
LONG FsType
Definition: setuplib.h:116
LONG AutoPartition
Definition: setuplib.h:115
UNICODE_STRING SourceRootPath
Definition: setuplib.h:82
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:137
UNICODE_STRING DestinationPath
Definition: setuplib.h:104
PGENERIC_LIST KeyboardList
Definition: setuplib.h:121
LANGID LanguageId
Definition: setuplib.h:134
UNICODE_STRING DestinationArcPath
Definition: setuplib.h:103
WCHAR LocaleID[9]
Definition: setuplib.h:133
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:136
LONG DestinationDiskNumber
Definition: setuplib.h:110
LONG FormatPartition
Definition: setuplib.h:114
Definition: match.c:390
Definition: dsound.c:943
#define max(a, b)
Definition: svc.c:63
static LARGE_INTEGER StartTime
Definition: sys_arch.c:13
uint16_t * PWSTR
Definition: typedefs.h:56
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
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
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
uint64_t ULONGLONG
Definition: typedefs.h:67
#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:494
#define PARTITION_SIZE_INPUT_FIELD_LENGTH
Definition: usetup.c:1834
static VOID ProgressCountdown(IN PINPUT_RECORD Ir, IN LONG TimeOut)
Definition: usetup.c:3872
static PAGE_NUMBER DeviceSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1209
static PAGE_NUMBER FlushPage(PINPUT_RECORD Ir)
Definition: usetup.c:4071
static BOOLEAN ChangeSystemPartitionPage(IN PINPUT_RECORD Ir, IN PPARTENTRY SystemPartition)
Definition: usetup.c:2307
static PAGE_NUMBER DeletePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2183
static WCHAR DefaultLanguage[20]
Definition: usetup.c:65
struct _FSVOL_CONTEXT FSVOL_CONTEXT
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:66
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: usetup.c:3414
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: usetup.c:2594
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2350
struct _COPYCONTEXT * PCOPYCONTEXT
static PAGE_NUMBER LicensePage(PINPUT_RECORD Ir)
Definition: usetup.c:848
VOID PopupError(PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
Definition: usetup.c:257
static VOID __cdecl USetupErrorRoutine(IN PUSETUP_DATA pSetupData,...)
Definition: usetup.c:3127
#define PARTITION_NEW_AUTOCREATE
Definition: usetup.c:81
static BOOLEAN BootLoaderRemovableDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3650
static USETUP_DATA USetupData
Definition: usetup.c:45
static BOOLEAN NTAPI ProgressTimeOutStringHandler(IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:3825
static PAGE_NUMBER DisplaySettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1432
HANDLE ProcessHeap
Definition: usetup.c:42
static VOID CheckFileSystemPage(IN PPARTENTRY PartEntry)
Definition: usetup.c:2573
static PPARTLIST PartitionList
Definition: usetup.c:71
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1341
static PPARTENTRY InstallPartition
Definition: usetup.c:48
static PAGE_NUMBER ComputerSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1406
static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3340
VOID NTAPI NtProcessStartup(PPEB Peb)
Definition: usetup.c:4291
static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1458
static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir)
Definition: usetup.c:649
struct _FSVOL_CONTEXT * PFSVOL_CONTEXT
static BOOLEAN IsValidPath(IN PCWSTR InstallDir)
Definition: usetup.c:2870
static VOID SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, IN BOOLEAN First)
Definition: usetup.c:3186
static VOID UpdateKBLayout(VOID)
Definition: usetup.c:457
static BOOLEAN IsPartitionLargeEnough(_In_ PPARTENTRY PartEntry)
Definition: usetup.c:1500
static PAGE_NUMBER StartPartitionOperationsPage(PINPUT_RECORD Ir)
Definition: usetup.c:2265
static FSVOL_OP SelectFileSystemPage(IN PFSVOL_CONTEXT FsVolContext, IN PPARTENTRY PartEntry)
Definition: usetup.c:2360
static FSVOL_OP FormatPartitionPage(IN PFSVOL_CONTEXT FsVolContext, IN PPARTENTRY PartEntry)
Definition: usetup.c:2522
static PAGE_NUMBER BootLoaderSelectPage(PINPUT_RECORD Ir)
Definition: usetup.c:3494
static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3457
static PPARTENTRY SystemPartition
Definition: usetup.c:59
static PAGE_NUMBER LayoutSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1484
static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:1073
static PAGE_NUMBER SuccessPage(PINPUT_RECORD Ir)
Definition: usetup.c:4048
static PAGE_NUMBER BootLoaderInstallPage(PINPUT_RECORD Ir)
Definition: usetup.c:3762
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:430
static PPARTENTRY CurrentPartition
Definition: usetup.c:74
NTSTATUS RunUSetup(VOID)
Definition: usetup.c:4082
#define PARTITION_MAXSIZE
Definition: usetup.c:1836
static VOID DrawBox(IN SHORT xLeft, IN SHORT yTop, IN SHORT Width, IN SHORT Height)
Definition: usetup.c:167
@ PartTypeData
Definition: usetup.c:76
@ PartTypeExtended
Definition: usetup.c:77
static NTSTATUS NTAPI GetNTOSInstallationName(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:505
static PAGE_NUMBER SelectPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:1538
static PAGE_NUMBER WelcomePage(PINPUT_RECORD Ir)
Definition: usetup.c:804
BOOLEAN IsUnattendedSetup
Definition: usetup.c:43
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2142
static enum @56 PartCreateType
static PAGE_NUMBER QuitPage(PINPUT_RECORD Ir)
Definition: usetup.c:4009
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:68
struct _COPYCONTEXT COPYCONTEXT
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:84
static VOID PrintString(IN PCSTR fmt,...)
Definition: usetup.c:148
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1839
static PAGE_NUMBER CreatePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2033
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:89
static BOOLEAN BootLoaderHardDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3696
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:88
static PAGE_NUMBER SetupStartPage(PINPUT_RECORD Ir)
Definition: usetup.c:557
PCWSTR SelectedLanguageId
Definition: usetup.c:64
static PAGE_NUMBER PrepareCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3160
static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:879
static PAGE_NUMBER UpgradeRepairPage(PINPUT_RECORD Ir)
Definition: usetup.c:922
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: usetup.c:3214
static PAGE_NUMBER InstallDirectoryPage(PINPUT_RECORD Ir)
Definition: usetup.c:2926
#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_ 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
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define VK_UP
Definition: winuser.h:2225
#define VK_NEXT
Definition: winuser.h:2221
#define VK_RETURN
Definition: winuser.h:2201
#define VK_END
Definition: winuser.h:2222
#define VK_HOME
Definition: winuser.h:2223
#define VK_BACK
Definition: winuser.h:2198
#define VK_F3
Definition: winuser.h:2257
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define VK_PRIOR
Definition: winuser.h:2220
#define VK_DELETE
Definition: winuser.h:2233
#define VK_ESCAPE
Definition: winuser.h:2214
_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
unsigned __int64 CDECL _wcstoui64(const wchar_t *nptr, wchar_t **endptr, int base)
Definition: wtoi64.c:200
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175