3 * Copyright (C) 2002, 2003, 2004 ReactOS Team
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/usetup.c
23 * PURPOSE: Text-mode setup
24 * PROGRAMMER: Eric Kohl
25 * Casper S. Hornstrup (chorns@users.sourceforge.net)
33 typedef enum _PAGE_NUMBER
41 // SCSI_CONTROLLER_PAGE,
44 COMPUTER_SETTINGS_PAGE
,
45 DISPLAY_SETTINGS_PAGE
,
46 KEYBOARD_SETTINGS_PAGE
,
49 SELECT_PARTITION_PAGE
,
50 CREATE_PARTITION_PAGE
,
51 DELETE_PARTITION_PAGE
,
53 SELECT_FILE_SYSTEM_PAGE
,
54 FORMAT_PARTITION_PAGE
,
55 CHECK_FILE_SYSTEM_PAGE
,
58 INSTALL_DIRECTORY_PAGE
,
62 BOOT_LOADER_FLOPPY_PAGE
,
63 BOOT_LOADER_HARDDISK_PAGE
,
70 REBOOT_PAGE
, /* virtual page */
71 } PAGE_NUMBER
, *PPAGE_NUMBER
;
73 typedef struct _COPYCONTEXT
75 ULONG TotalOperations
;
76 ULONG CompletedOperations
;
77 PPROGRESSBAR ProgressBar
;
78 } COPYCONTEXT
, *PCOPYCONTEXT
;
81 /* GLOBALS ******************************************************************/
84 UNICODE_STRING SourceRootPath
;
85 BOOLEAN IsUnattendedSetup
;
86 LONG UnattendDestinationDiskNumber
;
87 LONG UnattendDestinationPartitionNumber
;
88 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
90 /* LOCALS *******************************************************************/
92 static PPARTLIST PartitionList
= NULL
;
94 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
97 static UNICODE_STRING SourcePath
;
99 static UNICODE_STRING InstallPath
;
101 /* Path to the install directory */
102 static UNICODE_STRING DestinationPath
;
103 static UNICODE_STRING DestinationArcPath
;
104 static UNICODE_STRING DestinationRootPath
;
106 /* Path to the active partition (boot manager) */
107 static UNICODE_STRING SystemRootPath
;
109 static HINF SetupInf
;
111 static HSPFILEQ SetupFileQueue
= NULL
;
113 static BOOLEAN WarnLinuxPartitions
= TRUE
;
115 static PGENERIC_LIST ComputerList
= NULL
;
116 static PGENERIC_LIST DisplayList
= NULL
;
117 static PGENERIC_LIST KeyboardList
= NULL
;
118 static PGENERIC_LIST LayoutList
= NULL
;
121 /* FUNCTIONS ****************************************************************/
124 PrintString(char* fmt
,...)
128 UNICODE_STRING UnicodeString
;
129 ANSI_STRING AnsiString
;
132 vsprintf(buffer
, fmt
, ap
);
135 RtlInitAnsiString(&AnsiString
, buffer
);
136 RtlAnsiStringToUnicodeString(&UnicodeString
,
139 NtDisplayString(&UnicodeString
);
140 RtlFreeUnicodeString(&UnicodeString
);
145 PopupError(PCHAR Text
,
163 /* Count text lines and longest line */
169 p
= strchr(pnext
, '\n');
172 Length
= strlen(pnext
);
177 Length
= (ULONG
)(p
- pnext
);
182 if (Length
> MaxLength
)
185 if (LastLine
== TRUE
)
191 /* Check length of status line */
194 Length
= strlen(Status
);
195 if (Length
> MaxLength
)
199 GetScreenSize(&xScreen
, &yScreen
);
201 Width
= MaxLength
+ 4;
206 yTop
= (yScreen
- Height
) / 2;
207 xLeft
= (xScreen
- Width
) / 2;
210 /* Set screen attributes */
212 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
214 FillConsoleOutputAttribute(0x74,
220 /* draw upper left corner */
223 FillConsoleOutputCharacter(0xDA, // '+',
228 /* draw upper edge */
231 FillConsoleOutputCharacter(0xC4, // '-',
236 /* draw upper right corner */
237 coPos
.X
= xLeft
+ Width
- 1;
239 FillConsoleOutputCharacter(0xBF, // '+',
244 /* Draw right edge, inner space and left edge */
245 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
248 FillConsoleOutputCharacter(0xB3, // '|',
254 FillConsoleOutputCharacter(' ',
259 coPos
.X
= xLeft
+ Width
- 1;
260 FillConsoleOutputCharacter(0xB3, // '|',
266 /* draw lower left corner */
268 coPos
.Y
= yTop
+ Height
- 1;
269 FillConsoleOutputCharacter(0xC0, // '+',
274 /* draw lower edge */
276 coPos
.Y
= yTop
+ Height
- 1;
277 FillConsoleOutputCharacter(0xC4, // '-',
282 /* draw lower right corner */
283 coPos
.X
= xLeft
+ Width
- 1;
284 coPos
.Y
= yTop
+ Height
- 1;
285 FillConsoleOutputCharacter(0xD9, // '+',
290 /* Print message text */
295 p
= strchr(pnext
, '\n');
298 Length
= strlen(pnext
);
303 Length
= (ULONG
)(p
- pnext
);
310 WriteConsoleOutputCharacters(pnext
,
315 if (LastLine
== TRUE
)
322 /* Print separator line and status text */
325 coPos
.Y
= yTop
+ Height
- 3;
327 FillConsoleOutputCharacter(0xC3, // '+',
333 FillConsoleOutputCharacter(0xC4, // '-',
338 coPos
.X
= xLeft
+ Width
- 1;
339 FillConsoleOutputCharacter(0xB4, // '+',
346 WriteConsoleOutputCharacters(Status
,
347 min(strlen(Status
), (SIZE_T
)Width
- 4),
357 * FALSE: Don't quit setup.
360 ConfirmQuit(PINPUT_RECORD Ir
)
364 PopupError("ReactOS is not completely installed on your\n"
365 "computer. If you quit Setup now, you will need to\n"
366 "run Setup again to install ReactOS.\n"
368 " \x07 Press ENTER to continue Setup.\n"
369 " \x07 Press F3 to quit Setup.",
370 "F3= Quit ENTER = Continue");
376 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
377 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
382 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
394 CheckUnattendedSetup(VOID
)
396 WCHAR UnattendInfPath
[MAX_PATH
];
397 UNICODE_STRING FileName
;
405 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
407 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
408 IsUnattendedSetup
= FALSE
;
412 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
413 wcscat(UnattendInfPath
, L
"\\unattend.inf");
415 RtlInitUnicodeString(&FileName
,
418 /* Load 'unattend.inf' from install media. */
419 Status
= InfOpenFile(&UnattendInf
,
422 if (!NT_SUCCESS(Status
))
424 DPRINT("InfOpenFile() failed with status 0x%x\n", Status
);
428 /* Open 'Unattend' section */
429 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
431 DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
432 InfFreeContext(Context
);
433 InfCloseFile(UnattendInf
);
437 /* Get pointer 'Signature' key */
438 if (!InfGetData(Context
, NULL
, &Value
))
440 DPRINT("InfGetData() failed for key 'Signature'\n");
441 InfFreeContext(Context
);
442 InfCloseFile(UnattendInf
);
446 /* Check 'Signature' string */
447 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
449 DPRINT("Signature not $ReactOS$\n");
450 InfFreeContext(Context
);
451 InfCloseFile(UnattendInf
);
455 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
456 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
458 DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
459 InfFreeContext(Context
);
460 InfCloseFile(UnattendInf
);
463 if (!InfGetIntField(Context
, 0, &IntValue
))
465 DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
466 InfFreeContext(Context
);
467 InfCloseFile(UnattendInf
);
470 UnattendDestinationDiskNumber
= IntValue
;
471 InfFreeContext(Context
);
473 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
474 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
476 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
477 InfFreeContext(Context
);
478 InfCloseFile(UnattendInf
);
481 if (!InfGetIntField(Context
, 0, &IntValue
))
483 DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
484 InfFreeContext(Context
);
485 InfCloseFile(UnattendInf
);
488 UnattendDestinationPartitionNumber
= IntValue
;
489 InfFreeContext(Context
);
491 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
492 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
494 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
495 InfCloseFile(UnattendInf
);
499 /* Get pointer 'InstallationDirectory' key */
500 if (!InfGetData(Context
, NULL
, &Value
))
502 DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
503 InfFreeContext(Context
);
504 InfCloseFile(UnattendInf
);
507 wcscpy(UnattendInstallationDirectory
, Value
);
509 InfFreeContext(Context
);
510 InfCloseFile(UnattendInf
);
512 IsUnattendedSetup
= TRUE
;
514 DPRINT("Running unattended setup\n");
521 * Number of the next page.
524 SetupStartPage(PINPUT_RECORD Ir
)
526 SYSTEM_DEVICE_INFORMATION Sdi
;
528 WCHAR FileNameBuffer
[MAX_PATH
];
529 UNICODE_STRING FileName
;
535 SetStatusText(" Please wait...");
538 /* Check whether a harddisk is available */
539 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
541 sizeof(SYSTEM_DEVICE_INFORMATION
),
543 if (!NT_SUCCESS (Status
))
545 PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
546 PopupError("Setup could not retrieve system drive information.\n",
547 "ENTER = Reboot computer");
552 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
559 if (Sdi
.NumberOfDisks
== 0)
561 PopupError("Setup could not find a harddisk.\n",
562 "ENTER = Reboot computer");
567 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
574 /* Get the source path and source root path */
575 Status
= GetSourcePaths(&SourcePath
,
577 if (!NT_SUCCESS(Status
))
579 PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status
);
580 PopupError("Setup could not find its source drive.\n",
581 "ENTER = Reboot computer");
586 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
595 PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
596 PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
600 /* Load txtsetup.sif from install media. */
601 wcscpy(FileNameBuffer
, SourceRootPath
.Buffer
);
602 wcscat(FileNameBuffer
, L
"\\reactos\\txtsetup.sif");
603 RtlInitUnicodeString(&FileName
,
606 Status
= InfOpenFile(&SetupInf
,
609 if (!NT_SUCCESS(Status
))
611 PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
612 "ENTER = Reboot computer");
618 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
625 /* Open 'Version' section */
626 if (!InfFindFirstLine (SetupInf
, L
"Version", L
"Signature", &Context
))
628 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
629 "ENTER = Reboot computer");
635 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
643 /* Get pointer 'Signature' key */
644 if (!InfGetData (Context
, NULL
, &Value
))
646 InfFreeContext(Context
);
647 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
648 "ENTER = Reboot computer");
654 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
661 /* Check 'Signature' string */
662 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
664 InfFreeContext(Context
);
665 PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
666 "ENTER = Reboot computer");
672 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
678 InfFreeContext(Context
);
680 CheckUnattendedSetup();
692 IntroPage(PINPUT_RECORD Ir
)
694 SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup");
696 SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your");
697 SetTextXY(6, 12, "computer and prepares the second part of the setup.");
699 SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS.");
700 SetTextXY(8, 17, "\x07 Press R to repair ReactOS.");
701 SetTextXY(8, 19, "\x07 Press L to view the ReactOS Licensing Terms and Conditions");
702 SetTextXY(8, 21, "\x07 Press F3 to quit without installing ReactOS.");
704 SetStatusText(" ENTER = Continue R = Repair F3 = Quit");
706 if (IsUnattendedSetup
)
708 return INSTALL_INTRO_PAGE
;
715 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
716 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
718 if (ConfirmQuit(Ir
) == TRUE
)
722 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
727 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
729 return REPAIR_INTRO_PAGE
;
732 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* R */
745 * Back to main setup page.
748 LicensePage(PINPUT_RECORD Ir
)
750 SetHighlightedTextXY(6, 8, "Licensing:");
752 SetTextXY(8, 11, "The ReactOS System is licensed under the terms of the");
753 SetTextXY(8, 12, "GNU GPL with parts containing code from other compatible");
754 SetTextXY(8, 13, "licenses such as the X11 or BSD and GNU LGPL licenses.");
755 SetTextXY(8, 14, "All software that is part of the ReactOS system is");
756 SetTextXY(8, 15, "therefore released under the GNU GPL as well as maintaining");
757 SetTextXY(8, 16, "the original license.");
759 SetTextXY(8, 18, "This software comes with NO WARRANTY or restrictions on usage");
760 SetTextXY(8, 19, "save applicable local and international law. The licensing of");
761 SetTextXY(8, 20, "ReactOS only covers distribution to third parties.");
763 SetTextXY(8, 22, "If for some reason you did not receive a copy of the");
764 SetTextXY(8, 23, "GNU General Public License with ReactOS please visit");
765 SetHighlightedTextXY(8, 25, "http://www.gnu.org/licenses/licenses.html");
767 SetStatusText(" ENTER = Return");
773 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
789 WarningPage(PINPUT_RECORD Ir
)
791 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Warranty Statement");
792 SetHighlightedTextXY(6, 8, "Warranty:");
794 SetTextXY(8, 11, "This is free software; see the source for copying conditions.");
795 SetTextXY(8, 12, "There is NO warranty; not even for MERCHANTABILITY or");
796 SetTextXY(8, 13, "FITNESS FOR A PARTICULAR PURPOSE");
798 SetTextXY(8, 15, "For more information on ReactOS, please visit:");
799 SetHighlightedTextXY(8, 16, "http://www.reactos.org");
801 SetStatusText(" F8 = Continue ESC = Exit");
807 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
808 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F8
)) /* F8 */
810 return INSTALL_INTRO_PAGE
;
813 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
814 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
824 RepairIntroPage(PINPUT_RECORD Ir
)
826 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
827 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
829 SetTextXY(6, 12, "The repair functions are not implemented yet.");
831 SetTextXY(8, 15, "\x07 Press R for the Recovery Console.");
833 SetTextXY(8, 17, "\x07 Press ESC to return to the main page.");
835 SetTextXY(8, 19, "\x07 Press ENTER to reboot your computer.");
837 SetStatusText(" ESC = Main page ENTER = Reboot");
843 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
847 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
851 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
852 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
858 return REPAIR_INTRO_PAGE
;
863 InstallIntroPage(PINPUT_RECORD Ir
)
865 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
867 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
868 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
870 SetTextXY(6, 12, "The following limitations apply:");
871 SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
872 SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
873 SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
874 SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
875 SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
876 SetTextXY(8, 18, "- Setup supports FAT file systems only.");
877 SetTextXY(8, 19, "- File system checks are not implemented yet.");
880 SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
882 SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
885 SetStatusText(" ENTER = Continue F3 = Quit");
887 if (IsUnattendedSetup
)
889 return SELECT_PARTITION_PAGE
;
896 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
897 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
899 if (ConfirmQuit(Ir
) == TRUE
)
903 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
905 return DEVICE_SETTINGS_PAGE
;
906 // return SCSI_CONTROLLER_PAGE;
910 return INSTALL_INTRO_PAGE
;
916 ScsiControllerPage(PINPUT_RECORD Ir
)
918 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
920 /* FIXME: print loaded mass storage driver descriptions */
922 SetTextXY(8, 10, "TEST device");
926 SetStatusText(" ENTER = Continue F3 = Quit");
932 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
933 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
935 if (ConfirmQuit(Ir
) == TRUE
)
939 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
941 return DEVICE_SETTINGS_PAGE
;
945 return SCSI_CONTROLLER_PAGE
;
951 DeviceSettingsPage(PINPUT_RECORD Ir
)
953 static ULONG Line
= 16;
955 /* Initialize the computer settings list */
956 if (ComputerList
== NULL
)
958 ComputerList
= CreateComputerTypeList(SetupInf
);
959 if (ComputerList
== NULL
)
961 /* FIXME: report error */
965 /* Initialize the display settings list */
966 if (DisplayList
== NULL
)
968 DisplayList
= CreateDisplayDriverList(SetupInf
);
969 if (DisplayList
== NULL
)
971 /* FIXME: report error */
975 /* Initialize the keyboard settings list */
976 if (KeyboardList
== NULL
)
978 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
979 if (KeyboardList
== NULL
)
981 /* FIXME: report error */
985 /* Initialize the keyboard layout list */
986 if (LayoutList
== NULL
)
988 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
989 if (LayoutList
== NULL
)
991 /* FIXME: report error */
992 PopupError("Setup failed to load the keyboard layout list.\n",
993 "ENTER = Reboot computer");
999 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1007 SetTextXY(6, 8, "The list below shows the current device settings.");
1009 SetTextXY(8, 11, " Computer:");
1010 SetTextXY(8, 12, " Display:");
1011 SetTextXY(8, 13, " Keyboard:");
1012 SetTextXY(8, 14, "Keyboard layout:");
1014 SetTextXY(8, 16, " Accept:");
1016 SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
1017 SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
1018 SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
1019 SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
1021 SetTextXY(25, 16, "Accept these device settings");
1022 InvertTextXY (24, Line
, 48, 1);
1025 SetTextXY(6, 19, "You can change the hardware settings by pressing the UP or DOWN keys");
1026 SetTextXY(6, 20, "to select an entry. Then press the ENTER key to select alternative");
1027 SetTextXY(6, 21, "settings.");
1029 SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\"");
1030 SetTextXY(6, 24, "and press ENTER.");
1032 SetStatusText(" ENTER = Continue F3 = Quit");
1038 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1039 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1041 NormalTextXY (24, Line
, 48, 1);
1044 else if (Line
== 16)
1048 InvertTextXY (24, Line
, 48, 1);
1050 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1051 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1053 NormalTextXY (24, Line
, 48, 1);
1056 else if (Line
== 16)
1060 InvertTextXY (24, Line
, 48, 1);
1062 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1063 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1065 if (ConfirmQuit(Ir
) == TRUE
)
1069 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1072 return COMPUTER_SETTINGS_PAGE
;
1073 else if (Line
== 12)
1074 return DISPLAY_SETTINGS_PAGE
;
1075 else if (Line
== 13)
1076 return KEYBOARD_SETTINGS_PAGE
;
1077 else if (Line
== 14)
1078 return LAYOUT_SETTINGS_PAGE
;
1079 else if (Line
== 16)
1080 return SELECT_PARTITION_PAGE
;
1084 return DEVICE_SETTINGS_PAGE
;
1089 ComputerSettingsPage(PINPUT_RECORD Ir
)
1094 SetTextXY(6, 8, "You want to change the type of computer to be installed.");
1096 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
1097 SetTextXY(8, 11, " Then press ENTER.");
1099 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1100 SetTextXY(8, 14, " the computer type.");
1102 GetScreenSize(&xScreen
, &yScreen
);
1104 DrawGenericList(ComputerList
,
1110 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1112 SaveGenericListState(ComputerList
);
1118 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1119 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1121 ScrollDownGenericList (ComputerList
);
1123 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1124 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1126 ScrollUpGenericList (ComputerList
);
1128 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1129 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1131 if (ConfirmQuit(Ir
) == TRUE
)
1135 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1136 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1138 RestoreGenericListState(ComputerList
);
1139 return DEVICE_SETTINGS_PAGE
;
1141 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1143 return DEVICE_SETTINGS_PAGE
;
1147 return COMPUTER_SETTINGS_PAGE
;
1152 DisplaySettingsPage(PINPUT_RECORD Ir
)
1157 SetTextXY(6, 8, "You want to change the type of display to be installed.");
1159 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
1160 SetTextXY(8, 11, " Then press ENTER.");
1162 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1163 SetTextXY(8, 14, " the display type.");
1165 GetScreenSize(&xScreen
, &yScreen
);
1167 DrawGenericList(DisplayList
,
1173 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1175 SaveGenericListState(DisplayList
);
1181 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1182 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1184 ScrollDownGenericList (DisplayList
);
1186 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1187 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1189 ScrollUpGenericList (DisplayList
);
1191 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1192 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1194 if (ConfirmQuit(Ir
) == TRUE
)
1200 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1201 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1203 RestoreGenericListState(DisplayList
);
1204 return DEVICE_SETTINGS_PAGE
;
1206 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1208 return DEVICE_SETTINGS_PAGE
;
1212 return DISPLAY_SETTINGS_PAGE
;
1217 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1222 SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
1224 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
1225 SetTextXY(8, 11, " Then press ENTER.");
1227 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1228 SetTextXY(8, 14, " the keyboard type.");
1230 GetScreenSize(&xScreen
, &yScreen
);
1232 DrawGenericList(KeyboardList
,
1238 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1240 SaveGenericListState(KeyboardList
);
1246 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1247 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1249 ScrollDownGenericList (KeyboardList
);
1251 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1252 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1254 ScrollUpGenericList (KeyboardList
);
1256 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1257 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1259 if (ConfirmQuit(Ir
) == TRUE
)
1263 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1264 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1266 RestoreGenericListState(KeyboardList
);
1267 return DEVICE_SETTINGS_PAGE
;
1269 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1271 return DEVICE_SETTINGS_PAGE
;
1275 return DISPLAY_SETTINGS_PAGE
;
1280 LayoutSettingsPage(PINPUT_RECORD Ir
)
1285 SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
1287 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
1288 SetTextXY(8, 11, " layout. Then press ENTER.");
1290 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1291 SetTextXY(8, 14, " the keyboard layout.");
1293 GetScreenSize(&xScreen
, &yScreen
);
1295 DrawGenericList(LayoutList
,
1301 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1303 SaveGenericListState(LayoutList
);
1309 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1310 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1312 ScrollDownGenericList (LayoutList
);
1314 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1315 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1317 ScrollUpGenericList (LayoutList
);
1319 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1320 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1322 if (ConfirmQuit(Ir
) == TRUE
)
1326 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1327 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1329 RestoreGenericListState(LayoutList
);
1330 return DEVICE_SETTINGS_PAGE
;
1332 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1334 return DEVICE_SETTINGS_PAGE
;
1338 return DISPLAY_SETTINGS_PAGE
;
1343 SelectPartitionPage(PINPUT_RECORD Ir
)
1348 SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
1349 SetTextXY(6, 9, "space for new partitions.");
1351 SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
1352 SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
1353 SetTextXY(8, 15, "\x07 Press C to create a new partition.");
1354 SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
1356 SetStatusText(" Please wait...");
1358 GetScreenSize(&xScreen
, &yScreen
);
1360 if (PartitionList
== NULL
)
1362 PartitionList
= CreatePartitionList (2,
1366 if (PartitionList
== NULL
)
1368 /* FIXME: show an error dialog */
1373 CheckActiveBootPartition (PartitionList
);
1375 DrawPartitionList (PartitionList
);
1377 /* Warn about partitions created by Linux Fdisk */
1378 if (WarnLinuxPartitions
== TRUE
&&
1379 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1381 PopupError ("Setup found that at least one harddisk contains an incompatible\n"
1382 "partition table that can not be handled properly!\n"
1384 "Creating or deleting partitions can destroy the partiton table.\n"
1386 " \x07 Press F3 to quit Setup."
1387 " \x07 Press ENTER to continue.",
1388 "F3= Quit ENTER = Continue");
1393 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1394 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1398 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1400 WarnLinuxPartitions
= FALSE
;
1401 return SELECT_PARTITION_PAGE
;
1406 if (IsUnattendedSetup
)
1408 SelectPartition(PartitionList
,
1409 UnattendDestinationDiskNumber
,
1410 UnattendDestinationPartitionNumber
);
1411 return(SELECT_FILE_SYSTEM_PAGE
);
1416 /* Update status text */
1417 if (PartitionList
->CurrentPartition
== NULL
||
1418 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1420 SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1424 SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1429 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1430 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1432 if (ConfirmQuit(Ir
) == TRUE
)
1434 DestroyPartitionList (PartitionList
);
1435 PartitionList
= NULL
;
1440 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1441 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1443 ScrollDownPartitionList (PartitionList
);
1445 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1446 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1448 ScrollUpPartitionList (PartitionList
);
1450 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1452 if (PartitionList
->CurrentPartition
== NULL
||
1453 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1455 CreateNewPartition (PartitionList
,
1460 return SELECT_FILE_SYSTEM_PAGE
;
1462 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'C') /* C */
1464 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1466 PopupError ("You can not create a new Partition inside\n"
1467 "of an already existing Partition!\n"
1469 " * Press any key to continue.",
1473 return SELECT_PARTITION_PAGE
;
1476 return CREATE_PARTITION_PAGE
;
1478 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1480 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1482 PopupError ("You can not delete unpartitioned disk space!\n"
1484 " * Press any key to continue.",
1488 return SELECT_PARTITION_PAGE
;
1491 return DELETE_PARTITION_PAGE
;
1495 return SELECT_PARTITION_PAGE
;
1500 DrawInputField(ULONG FieldLength
,
1510 memset(buf
, '_', sizeof(buf
));
1511 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1512 strcat(buf
, FieldContent
);
1514 WriteConsoleOutputCharacters (buf
,
1520 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1523 ShowPartitionSizeInputBox(SHORT Left
,
1548 /* draw upper left corner */
1551 FillConsoleOutputCharacter(0xDA, // '+',
1556 /* draw upper edge */
1559 FillConsoleOutputCharacter(0xC4, // '-',
1564 /* draw upper right corner */
1567 FillConsoleOutputCharacter(0xBF, // '+',
1572 /* draw left and right edge */
1573 for (i
= Top
+ 1; i
< Bottom
; i
++)
1577 FillConsoleOutputCharacter(0xB3, // '|',
1583 FillConsoleOutputCharacter(0xB3, //'|',
1589 /* draw lower left corner */
1592 FillConsoleOutputCharacter(0xC0, // '+',
1597 /* draw lower edge */
1600 FillConsoleOutputCharacter(0xC4, // '-',
1605 /* draw lower right corner */
1608 FillConsoleOutputCharacter(0xD9, // '+',
1616 strcpy (Buffer
, "Size of new partition:");
1617 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1619 WriteConsoleOutputCharacters (Buffer
,
1623 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1624 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1626 WriteConsoleOutputCharacters (Buffer
,
1630 sprintf(Buffer
, "%lu", MaxSize
);
1631 Index
= strlen(Buffer
);
1632 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1641 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1642 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1649 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1653 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1660 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1665 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1670 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1671 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1673 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1674 if ((ch
>= '0') && (ch
<= '9'))
1679 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1687 strcpy (InputBuffer
,
1693 CreatePartitionPage (PINPUT_RECORD Ir
)
1695 PDISKENTRY DiskEntry
;
1696 PPARTENTRY PartEntry
;
1701 CHAR InputBuffer
[50];
1707 if (PartitionList
== NULL
||
1708 PartitionList
->CurrentDisk
== NULL
||
1709 PartitionList
->CurrentPartition
== NULL
)
1711 /* FIXME: show an error dialog */
1715 DiskEntry
= PartitionList
->CurrentDisk
;
1716 PartEntry
= PartitionList
->CurrentPartition
;
1718 SetStatusText (" Please wait...");
1720 GetScreenSize (&xScreen
, &yScreen
);
1722 SetTextXY (6, 8, "You have chosen to create a new partition on");
1725 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1727 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1733 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1739 if (DiskEntry
->DriverName
.Length
> 0)
1742 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1745 DiskEntry
->DiskNumber
,
1749 &DiskEntry
->DriverName
);
1754 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1757 DiskEntry
->DiskNumber
,
1764 SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1767 PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1768 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1771 SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1773 PartEntry
= PartitionList
->CurrentPartition
;
1776 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1777 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1778 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1781 if (ConfirmQuit (Ir
) == TRUE
)
1786 else if (Cancel
== TRUE
)
1788 return SELECT_PARTITION_PAGE
;
1792 PartSize
= atoi (InputBuffer
);
1799 if (PartSize
> MaxSize
)
1805 /* Convert to bytes */
1806 if (PartSize
== MaxSize
)
1808 /* Use all of the unpartitioned disk space */
1809 PartSize
= PartEntry
->UnpartitionedLength
;
1813 /* Round-up by cylinder size */
1814 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1815 DiskEntry
->CylinderSize
);
1817 /* But never get larger than the unpartitioned disk space */
1818 if (PartSize
> PartEntry
->UnpartitionedLength
)
1819 PartSize
= PartEntry
->UnpartitionedLength
;
1822 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1824 CreateNewPartition (PartitionList
,
1828 return SELECT_PARTITION_PAGE
;
1832 return CREATE_PARTITION_PAGE
;
1837 DeletePartitionPage (PINPUT_RECORD Ir
)
1839 PDISKENTRY DiskEntry
;
1840 PPARTENTRY PartEntry
;
1846 if (PartitionList
== NULL
||
1847 PartitionList
->CurrentDisk
== NULL
||
1848 PartitionList
->CurrentPartition
== NULL
)
1850 /* FIXME: show an error dialog */
1854 DiskEntry
= PartitionList
->CurrentDisk
;
1855 PartEntry
= PartitionList
->CurrentPartition
;
1857 SetTextXY (6, 8, "You have chosen to delete the partition");
1859 /* Determine partition type */
1861 if (PartEntry
->New
== TRUE
)
1863 PartType
= "New (Unformatted)";
1865 else if (PartEntry
->Unpartitioned
== FALSE
)
1867 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1868 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1869 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1870 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1874 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1875 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1879 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1881 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1886 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
1888 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1893 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000LL
) /* 10 MB */
1895 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1900 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1904 if (PartType
== NULL
)
1907 " %c%c Type %lu %I64u %s",
1908 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1909 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1910 PartEntry
->PartInfo
[0].PartitionType
,
1917 " %c%c %s %I64u %s",
1918 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1919 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1926 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1928 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1934 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1940 if (DiskEntry
->DriverName
.Length
> 0)
1943 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1946 DiskEntry
->DiskNumber
,
1950 &DiskEntry
->DriverName
);
1955 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1958 DiskEntry
->DiskNumber
,
1964 SetTextXY (8, 18, "\x07 Press D to delete the partition.");
1965 SetTextXY (11, 19, "WARNING: All data on this partition will be lost!");
1967 SetTextXY (8, 21, "\x07 Press ESC to cancel.");
1969 SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit");
1975 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1976 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1978 if (ConfirmQuit (Ir
) == TRUE
)
1984 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
1986 return SELECT_PARTITION_PAGE
;
1988 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1990 DeleteCurrentPartition (PartitionList
);
1992 return SELECT_PARTITION_PAGE
;
1996 return DELETE_PARTITION_PAGE
;
2001 SelectFileSystemPage (PINPUT_RECORD Ir
)
2003 PDISKENTRY DiskEntry
;
2004 PPARTENTRY PartEntry
;
2011 if (PartitionList
== NULL
||
2012 PartitionList
->CurrentDisk
== NULL
||
2013 PartitionList
->CurrentPartition
== NULL
)
2015 /* FIXME: show an error dialog */
2019 DiskEntry
= PartitionList
->CurrentDisk
;
2020 PartEntry
= PartitionList
->CurrentPartition
;
2022 /* adjust disk size */
2023 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2025 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2030 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2034 /* adjust partition size */
2035 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
2037 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
2042 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
2046 /* adjust partition type */
2047 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
2048 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
2049 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
2050 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
2054 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
2055 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
2059 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
2061 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2063 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2065 PartType
= "Unused";
2069 PartType
= "Unknown";
2072 if (PartEntry
->AutoCreate
== TRUE
)
2074 SetTextXY(6, 8, "Setup created a new partition on");
2077 PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2078 PartEntry
->PartInfo
[0].PartitionNumber
,
2084 PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2085 DiskEntry
->DiskNumber
,
2091 &DiskEntry
->DriverName
);
2093 SetTextXY(6, 12, "This Partition will be formatted next.");
2096 PartEntry
->AutoCreate
= FALSE
;
2098 else if (PartEntry
->New
== TRUE
)
2100 SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
2101 SetTextXY(6, 10, "This Partition will be formatted next.");
2105 SetTextXY(6, 8, "Setup install ReactOS onto Partition");
2107 if (PartType
== NULL
)
2110 "%c%c Type %lu %I64u %s",
2111 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2112 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2113 PartEntry
->PartInfo
[0].PartitionType
,
2121 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2122 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2128 PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2129 DiskEntry
->DiskNumber
,
2135 &DiskEntry
->DriverName
);
2139 SetTextXY(6, 17, "Select a file system from the list below.");
2141 SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system.");
2142 SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
2143 SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
2145 if (FileSystemList
== NULL
)
2147 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, FsFat
);
2148 if (FileSystemList
== NULL
)
2150 /* FIXME: show an error dialog */
2154 /* FIXME: Add file systems to list */
2156 DrawFileSystemList (FileSystemList
);
2158 SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit");
2160 if (IsUnattendedSetup
)
2162 return(CHECK_FILE_SYSTEM_PAGE
);
2169 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2170 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2172 if (ConfirmQuit (Ir
) == TRUE
)
2178 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2179 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2181 return SELECT_PARTITION_PAGE
;
2183 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2184 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2186 ScrollDownFileSystemList (FileSystemList
);
2188 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2189 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2191 ScrollUpFileSystemList (FileSystemList
);
2193 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2195 if (FileSystemList
->CurrentFileSystem
== FsKeep
)
2197 return CHECK_FILE_SYSTEM_PAGE
;
2201 return FORMAT_PARTITION_PAGE
;
2206 return SELECT_FILE_SYSTEM_PAGE
;
2211 FormatPartitionPage (PINPUT_RECORD Ir
)
2213 WCHAR PathBuffer
[MAX_PATH
];
2214 PDISKENTRY DiskEntry
;
2215 PPARTENTRY PartEntry
;
2225 SetTextXY(6, 8, "Format partition");
2227 SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue.");
2229 SetStatusText(" ENTER = Continue F3 = Quit");
2232 if (PartitionList
== NULL
||
2233 PartitionList
->CurrentDisk
== NULL
||
2234 PartitionList
->CurrentPartition
== NULL
)
2236 /* FIXME: show an error dialog */
2240 DiskEntry
= PartitionList
->CurrentDisk
;
2241 PartEntry
= PartitionList
->CurrentPartition
;
2247 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2248 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2250 if (ConfirmQuit (Ir
) == TRUE
)
2256 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2258 SetStatusText (" Please wait ...");
2260 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2262 switch (FileSystemList
->CurrentFileSystem
)
2265 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200LL * 1024LL))
2267 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2268 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2270 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024LL * 255LL * 63LL * 512LL))
2272 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2274 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32LL * 1024LL * 1024LL))
2276 /* FAT16 CHS partition (partiton size < 32MB) */
2277 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2279 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2281 /* FAT16 CHS partition (partition size < 512MB) */
2282 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2286 /* FAT32 CHS partition (partition size >= 512MB) */
2287 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2292 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2294 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2296 /* FAT16 LBA partition (partition size < 512MB) */
2297 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2301 /* FAT32 LBA partition (partition size >= 512MB) */
2302 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2315 CheckActiveBootPartition (PartitionList
);
2319 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2320 DiskEntry
->DiskSize
,
2321 DiskEntry
->CylinderSize
,
2322 DiskEntry
->TrackSize
);
2325 DiskEntry
= PartitionList
->CurrentDisk
;
2326 Entry
= DiskEntry
->PartListHead
.Flink
;
2327 while (Entry
!= &DiskEntry
->PartListHead
)
2329 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2331 if (PartEntry
->Unpartitioned
== FALSE
)
2334 for (i
= 0; i
< 4; i
++)
2336 PrintTextXY (6, Line
,
2337 "%2u: %2u %c %12I64u %12I64u %2u %c",
2339 PartEntry
->PartInfo
[i
].PartitionNumber
,
2340 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2341 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2342 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2343 PartEntry
->PartInfo
[i
].PartitionType
,
2344 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2352 Entry
= Entry
->Flink
;
2355 /* Restore the old entry */
2356 PartEntry
= PartitionList
->CurrentPartition
;
2359 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2361 DPRINT ("WritePartitionsToDisk() failed\n");
2363 PopupError ("Setup failed to write partition tables.\n",
2364 "ENTER = Reboot computer");
2370 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2377 /* Set DestinationRootPath */
2378 RtlFreeUnicodeString (&DestinationRootPath
);
2379 swprintf (PathBuffer
,
2380 L
"\\Device\\Harddisk%lu\\Partition%lu",
2381 PartitionList
->CurrentDisk
->DiskNumber
,
2382 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2383 RtlCreateUnicodeString (&DestinationRootPath
,
2385 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2388 /* Set SystemRootPath */
2389 RtlFreeUnicodeString (&SystemRootPath
);
2390 swprintf (PathBuffer
,
2391 L
"\\Device\\Harddisk%lu\\Partition%lu",
2392 PartitionList
->ActiveBootDisk
->DiskNumber
,
2393 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2394 RtlCreateUnicodeString (&SystemRootPath
,
2396 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2399 switch (FileSystemList
->CurrentFileSystem
)
2402 Status
= FormatPartition (&DestinationRootPath
);
2403 if (!NT_SUCCESS (Status
))
2405 DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status
);
2406 /* FIXME: show an error dialog */
2410 PartEntry
->New
= FALSE
;
2411 if (FileSystemList
!= NULL
)
2413 DestroyFileSystemList (FileSystemList
);
2414 FileSystemList
= NULL
;
2417 CheckActiveBootPartition (PartitionList
);
2419 /* FIXME: Install boot code. This is a hack! */
2420 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
) ||
2421 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2423 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2424 wcscat (PathBuffer
, L
"\\loader\\fat32.bin");
2426 DPRINT ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2427 DestinationRootPath
.Buffer
);
2428 Status
= InstallFat32BootCodeToDisk (PathBuffer
,
2429 DestinationRootPath
.Buffer
);
2430 if (!NT_SUCCESS (Status
))
2432 DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2433 /* FIXME: show an error dialog */
2439 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2440 wcscat (PathBuffer
, L
"\\loader\\fat.bin");
2442 DPRINT ("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2443 DestinationRootPath
.Buffer
);
2444 Status
= InstallFat16BootCodeToDisk (PathBuffer
,
2445 DestinationRootPath
.Buffer
);
2446 if (!NT_SUCCESS (Status
))
2448 DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2449 /* FIXME: show an error dialog */
2463 SetStatusText (" Done. Press any key ...");
2467 return INSTALL_DIRECTORY_PAGE
;
2471 return FORMAT_PARTITION_PAGE
;
2476 CheckFileSystemPage(PINPUT_RECORD Ir
)
2478 WCHAR PathBuffer
[MAX_PATH
];
2480 SetTextXY(6, 8, "Check file system");
2482 SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
2484 SetStatusText(" Please wait ...");
2487 SetStatusText(" ENTER = Continue F3 = Quit");
2490 /* Set DestinationRootPath */
2491 RtlFreeUnicodeString (&DestinationRootPath
);
2492 swprintf (PathBuffer
,
2493 L
"\\Device\\Harddisk%lu\\Partition%lu",
2494 PartitionList
->CurrentDisk
->DiskNumber
,
2495 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2496 RtlCreateUnicodeString (&DestinationRootPath
,
2498 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2500 /* Set SystemRootPath */
2501 RtlFreeUnicodeString (&SystemRootPath
);
2502 swprintf (PathBuffer
,
2503 L
"\\Device\\Harddisk%lu\\Partition%lu",
2504 PartitionList
->ActiveBootDisk
->DiskNumber
,
2505 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2506 RtlCreateUnicodeString (&SystemRootPath
,
2508 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2511 if (IsUnattendedSetup
)
2513 return(INSTALL_DIRECTORY_PAGE
);
2520 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2521 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2523 if (ConfirmQuit(Ir
) == TRUE
)
2527 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2529 return(INSTALL_DIRECTORY_PAGE
);
2533 return(CHECK_FILE_SYSTEM_PAGE
);
2538 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2540 WCHAR PathBuffer
[MAX_PATH
];
2542 /* Create 'InstallPath' string */
2543 RtlFreeUnicodeString(&InstallPath
);
2544 RtlCreateUnicodeString(&InstallPath
,
2547 /* Create 'DestinationPath' string */
2548 RtlFreeUnicodeString(&DestinationPath
);
2550 DestinationRootPath
.Buffer
);
2551 if (InstallDir
[0] != L
'\\')
2554 wcscat(PathBuffer
, InstallDir
);
2555 RtlCreateUnicodeString(&DestinationPath
,
2558 /* Create 'DestinationArcPath' */
2559 RtlFreeUnicodeString(&DestinationArcPath
);
2560 swprintf(PathBuffer
,
2561 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2562 DiskEntry
->BiosDiskNumber
,
2563 PartEntry
->PartInfo
[0].PartitionNumber
);
2564 if (InstallDir
[0] != L
'\\')
2567 wcscat(PathBuffer
, InstallDir
);
2568 RtlCreateUnicodeString(&DestinationArcPath
,
2571 return(PREPARE_COPY_PAGE
);
2576 InstallDirectoryPage(PINPUT_RECORD Ir
)
2578 PDISKENTRY DiskEntry
;
2579 PPARTENTRY PartEntry
;
2580 WCHAR InstallDir
[51];
2582 PINFCONTEXT Context
;
2585 if (PartitionList
== NULL
||
2586 PartitionList
->CurrentDisk
== NULL
||
2587 PartitionList
->CurrentPartition
== NULL
)
2589 /* FIXME: show an error dialog */
2593 DiskEntry
= PartitionList
->CurrentDisk
;
2594 PartEntry
= PartitionList
->CurrentPartition
;
2596 /* Search for 'DefaultPath' in the 'SetupData' section */
2597 if (!InfFindFirstLine (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2599 PopupError("Setup failed to find the 'SetupData' section\n"
2600 "in TXTSETUP.SIF.\n",
2601 "ENTER = Reboot computer");
2607 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2614 /* Read the 'DefaultPath' data */
2615 if (InfGetData (Context
, NULL
, &DefaultPath
))
2617 wcscpy(InstallDir
, DefaultPath
);
2621 wcscpy(InstallDir
, L
"\\ReactOS");
2623 InfFreeContext(Context
);
2624 Length
= wcslen(InstallDir
);
2626 SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
2627 SetTextXY(6, 9, "directory where you want ReactOS to be installed:");
2629 SetInputTextXY(8, 11, 51, InstallDir
);
2631 SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete");
2632 SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to");
2633 SetTextXY(6, 16, "be installed.");
2635 SetStatusText(" ENTER = Continue F3 = Quit");
2637 if (IsUnattendedSetup
)
2639 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2646 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2647 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2649 if (ConfirmQuit(Ir
) == TRUE
)
2653 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2655 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2657 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2662 InstallDir
[Length
] = 0;
2663 SetInputTextXY(8, 11, 51, InstallDir
);
2666 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2670 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2672 InstallDir
[Length
] = 0;
2673 SetInputTextXY(8, 11, 51, InstallDir
);
2678 return(INSTALL_DIRECTORY_PAGE
);
2683 AddSectionToCopyQueue(HINF InfFile
,
2685 PWCHAR SourceCabinet
,
2688 PINFCONTEXT FilesContext
;
2689 PINFCONTEXT DirContext
;
2691 PWCHAR FileKeyValue
;
2693 PWCHAR TargetFileName
;
2695 /* Search for the SectionName section */
2696 if (!InfFindFirstLine (InfFile
, SectionName
, NULL
, &FilesContext
))
2699 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2700 PopupError(Buffer
, "ENTER = Reboot computer");
2706 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2714 * Enumerate the files in the section
2715 * and add them to the file queue.
2719 /* Get source file name and target directory id */
2720 if (!InfGetData (FilesContext
, &FileKeyName
, &FileKeyValue
))
2722 /* FIXME: Handle error! */
2723 DPRINT1("InfGetData() failed\n");
2727 /* Get optional target file name */
2728 if (!InfGetDataField (FilesContext
, 2, &TargetFileName
))
2729 TargetFileName
= NULL
;
2731 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2733 /* Lookup target directory */
2734 if (!InfFindFirstLine (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2736 /* FIXME: Handle error! */
2737 DPRINT1("InfFindFirstLine() failed\n");
2741 if (!InfGetData (DirContext
, NULL
, &DirKeyValue
))
2743 /* FIXME: Handle error! */
2744 InfFreeContext(DirContext
);
2745 DPRINT1("InfGetData() failed\n");
2749 if (!SetupQueueCopy(SetupFileQueue
,
2751 SourceRootPath
.Buffer
,
2757 /* FIXME: Handle error! */
2758 DPRINT1("SetupQueueCopy() failed\n");
2760 InfFreeContext(DirContext
);
2762 while (InfFindNextLine(FilesContext
, FilesContext
));
2764 InfFreeContext(FilesContext
);
2770 PrepareCopyPageInfFile(HINF InfFile
,
2771 PWCHAR SourceCabinet
,
2774 WCHAR PathBuffer
[MAX_PATH
];
2775 PINFCONTEXT DirContext
;
2776 PWCHAR AdditionalSectionName
= NULL
;
2781 /* Add common files */
2782 if (!AddSectionToCopyQueue(InfFile
, L
"SourceFiles", SourceCabinet
, Ir
))
2785 /* Add specific files depending of computer type */
2786 if (SourceCabinet
== NULL
)
2788 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
2790 if (AdditionalSectionName
)
2792 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, Ir
))
2797 /* Create directories */
2801 * Install directories like '\reactos\test' are not handled yet.
2804 /* Get destination path */
2805 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2807 /* Remove trailing backslash */
2808 Length
= wcslen(PathBuffer
);
2809 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2811 PathBuffer
[Length
- 1] = 0;
2814 /* Create the install directory */
2815 Status
= SetupCreateDirectory(PathBuffer
);
2816 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2818 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2819 PopupError("Setup could not create the install directory.",
2820 "ENTER = Reboot computer");
2826 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2834 /* Search for the 'Directories' section */
2835 if (!InfFindFirstLine(InfFile
, L
"Directories", NULL
, &DirContext
))
2839 PopupError("Setup failed to find the 'Directories' section\n"
2840 "in the cabinet.\n", "ENTER = Reboot computer");
2844 PopupError("Setup failed to find the 'Directories' section\n"
2845 "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
2852 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2859 /* Enumerate the directory values and create the subdirectories */
2862 if (!InfGetData (DirContext
, NULL
, &KeyValue
))
2868 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2870 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2872 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2873 wcscat(PathBuffer
, KeyValue
);
2875 DPRINT("FullPath: '%S'\n", PathBuffer
);
2877 else if (KeyValue
[0] != L
'\\')
2879 DPRINT("RelativePath: '%S'\n", KeyValue
);
2880 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2881 wcscat(PathBuffer
, L
"\\");
2882 wcscat(PathBuffer
, KeyValue
);
2884 DPRINT("FullPath: '%S'\n", PathBuffer
);
2886 Status
= SetupCreateDirectory(PathBuffer
);
2887 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2889 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2890 PopupError("Setup could not create install directories.",
2891 "ENTER = Reboot computer");
2897 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2905 while (InfFindNextLine (DirContext
, DirContext
));
2907 InfFreeContext(DirContext
);
2914 PrepareCopyPage(PINPUT_RECORD Ir
)
2917 WCHAR PathBuffer
[MAX_PATH
];
2918 PINFCONTEXT CabinetsContext
;
2925 SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
2927 SetStatusText(" Building the file copy list...");
2929 /* Create the file queue */
2930 SetupFileQueue
= SetupOpenFileQueue();
2931 if (SetupFileQueue
== NULL
)
2933 PopupError("Setup failed to open the copy file queue.\n",
2934 "ENTER = Reboot computer");
2940 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2947 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
2952 /* Search for the 'Cabinets' section */
2953 if (!InfFindFirstLine (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
2955 return FILE_COPY_PAGE
;
2959 * Enumerate the directory values in the 'Cabinets'
2960 * section and parse their inf files.
2964 if (!InfGetData (CabinetsContext
, NULL
, &KeyValue
))
2967 wcscpy(PathBuffer
, SourcePath
.Buffer
);
2968 wcscat(PathBuffer
, L
"\\");
2969 wcscat(PathBuffer
, KeyValue
);
2971 CabinetInitialize();
2972 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
2973 CabinetSetCabinetName(PathBuffer
);
2975 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
2977 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
2979 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
2980 if (InfFileData
== NULL
)
2982 PopupError("Cabinet has no setup script.\n",
2983 "ENTER = Reboot computer");
2989 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2998 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
3000 PopupError("Cabinet not found.\n",
3001 "ENTER = Reboot computer");
3007 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3014 Status
= InfOpenBufferedFile(&InfHandle
,
3018 if (!NT_SUCCESS(Status
))
3020 PopupError("Cabinet has no valid inf file.\n",
3021 "ENTER = Reboot computer");
3027 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3036 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3041 while (InfFindNextLine (CabinetsContext
, CabinetsContext
));
3043 InfFreeContext(CabinetsContext
);
3045 return FILE_COPY_PAGE
;
3050 FileCopyCallback(PVOID Context
,
3055 PCOPYCONTEXT CopyContext
;
3057 CopyContext
= (PCOPYCONTEXT
)Context
;
3059 switch (Notification
)
3061 case SPFILENOTIFY_STARTSUBQUEUE
:
3062 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3063 ProgressSetStepCount(CopyContext
->ProgressBar
,
3064 CopyContext
->TotalOperations
);
3067 case SPFILENOTIFY_STARTCOPY
:
3068 /* Display copy message */
3069 SetStatusText(" \xB3 Copying file: %S", (PWSTR
)Param1
);
3072 case SPFILENOTIFY_ENDCOPY
:
3073 CopyContext
->CompletedOperations
++;
3074 ProgressNextStep(CopyContext
->ProgressBar
);
3083 FileCopyPage(PINPUT_RECORD Ir
)
3085 COPYCONTEXT CopyContext
;
3089 SetStatusText(" \xB3 Please wait... ");
3091 SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS");
3092 SetTextXY(30, 13, "installation folder.");
3093 SetTextXY(20, 14, "This may take several minutes to complete.");
3095 GetScreenSize(&xScreen
, &yScreen
);
3096 CopyContext
.TotalOperations
= 0;
3097 CopyContext
.CompletedOperations
= 0;
3098 CopyContext
.ProgressBar
= CreateProgressBar(13,
3102 "Setup is copying files...");
3104 SetupCommitFileQueue(SetupFileQueue
,
3105 DestinationRootPath
.Buffer
,
3107 (PSP_FILE_CALLBACK
)FileCopyCallback
,
3110 SetupCloseFileQueue(SetupFileQueue
);
3112 DestroyProgressBar(CopyContext
.ProgressBar
);
3114 return REGISTRY_PAGE
;
3119 RegistryPage(PINPUT_RECORD Ir
)
3121 PINFCONTEXT InfContext
;
3128 SetTextXY(6, 8, "Setup is updating the system configuration");
3130 SetStatusText(" Creating registry hives...");
3132 if (!SetInstallPathValue(&DestinationPath
))
3134 DPRINT("SetInstallPathValue() failed\n");
3135 PopupError("Setup failed to set the initialize the registry.",
3136 "ENTER = Reboot computer");
3142 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3149 /* Create the default hives */
3150 Status
= NtInitializeRegistry(TRUE
);
3151 if (!NT_SUCCESS(Status
))
3153 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3154 PopupError("Setup failed to create the registry hives.",
3155 "ENTER = Reboot computer");
3161 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3168 /* Update registry */
3169 SetStatusText(" Updating registry hives...");
3171 if (!InfFindFirstLine(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3173 DPRINT1("InfFindFirstLine() failed\n");
3174 PopupError("Setup failed to find the registry data files.",
3175 "ENTER = Reboot computer");
3181 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3190 InfGetDataField (InfContext
, 0, &Action
);
3191 InfGetDataField (InfContext
, 1, &File
);
3192 InfGetDataField (InfContext
, 2, &Section
);
3194 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3196 if (!_wcsicmp (Action
, L
"AddReg"))
3200 else if (!_wcsicmp (Action
, L
"DelReg"))
3209 SetStatusText(" Importing %S...", File
);
3211 if (!ImportRegistryFile(File
, Section
, Delete
))
3213 DPRINT("Importing %S failed\n", File
);
3215 PopupError("Setup failed to import a hive file.",
3216 "ENTER = Reboot computer");
3222 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3229 while (InfFindNextLine (InfContext
, InfContext
));
3231 InfFreeContext(InfContext
);
3233 /* Update display registry settings */
3234 SetStatusText(" Updating display registry settings...");
3235 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3237 PopupError("Setup failed to update display registry settings.",
3238 "ENTER = Reboot computer");
3244 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3251 /* Update keyboard layout settings */
3252 SetStatusText(" Updating keyboard layout settings...");
3253 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3255 PopupError("Setup failed to update keyboard layout settings.",
3256 "ENTER = Reboot computer");
3262 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3269 /* Update the mounted devices list */
3270 SetMountedDeviceValues(PartitionList
);
3272 SetStatusText(" Done...");
3274 return BOOT_LOADER_PAGE
;
3279 BootLoaderPage(PINPUT_RECORD Ir
)
3281 UCHAR PartitionType
;
3282 BOOLEAN InstallOnFloppy
;
3285 SetStatusText(" Please wait...");
3287 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3289 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3291 DPRINT("Error: active partition invalid (unused)\n");
3292 InstallOnFloppy
= TRUE
;
3294 else if (PartitionType
== 0x0A)
3296 /* OS/2 boot manager partition */
3297 DPRINT("Found OS/2 boot manager partition\n");
3298 InstallOnFloppy
= TRUE
;
3300 else if (PartitionType
== 0x83)
3302 /* Linux ext2 partition */
3303 DPRINT("Found Linux ext2 partition\n");
3304 InstallOnFloppy
= TRUE
;
3306 else if (PartitionType
== PARTITION_IFS
)
3308 /* NTFS partition */
3309 DPRINT("Found NTFS partition\n");
3310 InstallOnFloppy
= TRUE
;
3312 else if ((PartitionType
== PARTITION_FAT_12
) ||
3313 (PartitionType
== PARTITION_FAT_16
) ||
3314 (PartitionType
== PARTITION_HUGE
) ||
3315 (PartitionType
== PARTITION_XINT13
) ||
3316 (PartitionType
== PARTITION_FAT32
) ||
3317 (PartitionType
== PARTITION_FAT32_XINT13
))
3319 DPRINT("Found FAT partition\n");
3320 InstallOnFloppy
= FALSE
;
3324 /* Unknown partition */
3325 DPRINT("Unknown partition found\n");
3326 InstallOnFloppy
= TRUE
;
3329 if (InstallOnFloppy
== TRUE
)
3331 return BOOT_LOADER_FLOPPY_PAGE
;
3334 SetTextXY(6, 8, "Setup is installing the boot loader");
3336 SetTextXY(8, 12, "Install bootloader on the harddisk (MBR).");
3337 SetTextXY(8, 13, "Install bootloader on a floppy disk.");
3338 SetTextXY(8, 14, "Skip install bootloader.");
3339 InvertTextXY (8, Line
, 48, 1);
3341 SetStatusText(" ENTER = Continue F3 = Quit");
3347 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3348 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3350 NormalTextXY (8, Line
, 48, 1);
3353 if (Line
<12) Line
=14;
3354 if (Line
>14) Line
=12;
3358 InvertTextXY (8, Line
, 48, 1);
3360 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3361 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3363 NormalTextXY (8, Line
, 48, 1);
3366 if (Line
<12) Line
=14;
3367 if (Line
>14) Line
=12;
3370 InvertTextXY (8, Line
, 48, 1);
3372 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3373 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3375 if (ConfirmQuit(Ir
) == TRUE
)
3379 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3383 return BOOT_LOADER_HARDDISK_PAGE
;
3385 else if (Line
== 13)
3387 return BOOT_LOADER_FLOPPY_PAGE
;
3389 else if (Line
== 14)
3391 return SUCCESS_PAGE
;;
3394 return BOOT_LOADER_PAGE
;
3399 return BOOT_LOADER_PAGE
;
3404 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3408 SetTextXY(6, 8, "Setup cannot install the bootloader on your computers");
3409 SetTextXY(6, 9, "harddisk");
3411 SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and");
3412 SetTextXY(6, 14, "press ENTER.");
3415 SetStatusText(" ENTER = Continue F3 = Quit");
3416 // SetStatusText(" Please wait...");
3422 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3423 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3425 if (ConfirmQuit(Ir
) == TRUE
)
3429 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3431 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3433 PopupError("No disk in drive A:.",
3434 "ENTER = Continue");
3439 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3443 return BOOT_LOADER_FLOPPY_PAGE
;
3446 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3447 &DestinationArcPath
);
3448 if (!NT_SUCCESS(Status
))
3450 /* Print error message */
3451 return BOOT_LOADER_FLOPPY_PAGE
;
3454 return SUCCESS_PAGE
;
3458 return BOOT_LOADER_FLOPPY_PAGE
;
3463 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3465 UCHAR PartitionType
;
3468 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3469 if ((PartitionType
== PARTITION_FAT_12
) ||
3470 (PartitionType
== PARTITION_FAT_16
) ||
3471 (PartitionType
== PARTITION_HUGE
) ||
3472 (PartitionType
== PARTITION_XINT13
) ||
3473 (PartitionType
== PARTITION_FAT32
) ||
3474 (PartitionType
== PARTITION_FAT32_XINT13
))
3476 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3478 &DestinationArcPath
,
3480 if (!NT_SUCCESS(Status
))
3482 PopupError("Setup failed to install the FAT bootcode on the system partition.",
3483 "ENTER = Reboot computer");
3489 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3496 return SUCCESS_PAGE
;
3500 PopupError("failed to install FAT bootcode on the system partition.",
3501 "ENTER = Reboot computer");
3507 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3514 return BOOT_LOADER_HARDDISK_PAGE
;
3519 QuitPage(PINPUT_RECORD Ir
)
3521 SetTextXY(10, 6, "ReactOS is not completely installed");
3523 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3524 SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
3526 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3528 SetStatusText(" Please wait ...");
3530 /* Destroy partition list */
3531 if (PartitionList
!= NULL
)
3533 DestroyPartitionList (PartitionList
);
3534 PartitionList
= NULL
;
3537 /* Destroy filesystem list */
3538 if (FileSystemList
!= NULL
)
3540 DestroyFileSystemList (FileSystemList
);
3541 FileSystemList
= NULL
;
3544 /* Destroy computer settings list */
3545 if (ComputerList
!= NULL
)
3547 DestroyGenericList(ComputerList
, TRUE
);
3548 ComputerList
= NULL
;
3551 /* Destroy display settings list */
3552 if (DisplayList
!= NULL
)
3554 DestroyGenericList(DisplayList
, TRUE
);
3558 /* Destroy keyboard settings list */
3559 if (KeyboardList
!= NULL
)
3561 DestroyGenericList(KeyboardList
, TRUE
);
3562 KeyboardList
= NULL
;
3565 /* Destroy keyboard layout list */
3566 if (LayoutList
!= NULL
)
3568 DestroyGenericList(LayoutList
, TRUE
);
3572 SetStatusText(" ENTER = Reboot computer");
3578 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3587 SuccessPage(PINPUT_RECORD Ir
)
3589 SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully.");
3591 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3592 SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
3594 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3596 SetStatusText(" ENTER = Reboot computer");
3598 if (IsUnattendedSetup
)
3607 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3616 FlushPage(PINPUT_RECORD Ir
)
3618 SetTextXY(10, 6, "The system is now making sure all data is stored on your disk");
3620 SetTextXY(10, 8, "This may take a minute");
3621 SetTextXY(10, 9, "When finished, your computer will reboot automatically");
3623 SetStatusText(" Flushing cache");
3633 OBJECT_ATTRIBUTES ObjectAttributes
;
3634 UNICODE_STRING UnicodeString
= RTL_CONSTANT_STRING(L
"\\ReactOSInitDone");
3635 HANDLE ReactOSInitEvent
;
3637 InitializeObjectAttributes(&ObjectAttributes
,
3642 Status
= NtOpenEvent(&ReactOSInitEvent
,
3645 if (NT_SUCCESS(Status
))
3647 LARGE_INTEGER Timeout
;
3648 /* This will cause the boot screen image to go away (if displayed) */
3649 NtPulseEvent(ReactOSInitEvent
, NULL
);
3651 /* Wait for the display mode to be changed (if in graphics mode) */
3652 Timeout
.QuadPart
= -50000000LL; /* 5 second timeout */
3653 NtWaitForSingleObject(ReactOSInitEvent
, FALSE
, &Timeout
);
3655 NtClose(ReactOSInitEvent
);
3659 /* We don't really care if this fails */
3660 DPRINT1("USETUP: Failed to open ReactOS init notification event\n");
3666 NtProcessStartup(PPEB Peb
)
3672 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3674 ProcessHeap
= Peb
->ProcessHeap
;
3675 InfSetHeap(ProcessHeap
);
3679 Status
= AllocConsole();
3680 if (!NT_SUCCESS(Status
))
3682 PrintString("Unable to open the console (Status = 0x%08lx)\n\n", Status
);
3683 PrintString("The most common cause of this is using an USB keyboard\n");
3684 PrintString("USB keyboards are not fully supported yet\n");
3686 /* Raise a hard error (crash the system/BSOD) */
3687 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3692 /* Initialize global unicode strings */
3693 RtlInitUnicodeString(&SourcePath
, NULL
);
3694 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3695 RtlInitUnicodeString(&InstallPath
, NULL
);
3696 RtlInitUnicodeString(&DestinationPath
, NULL
);
3697 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3698 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3699 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3701 /* Hide the cursor */
3702 SetCursorType(TRUE
, FALSE
);
3705 while (Page
!= REBOOT_PAGE
)
3709 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3715 Page
= SetupStartPage(&Ir
);
3720 Page
= LicensePage(&Ir
);
3725 Page
= WarningPage(&Ir
);
3730 Page
= IntroPage(&Ir
);
3734 case INSTALL_INTRO_PAGE
:
3735 Page
= InstallIntroPage(&Ir
);
3739 case SCSI_CONTROLLER_PAGE
:
3740 Page
= ScsiControllerPage(&Ir
);
3745 case OEM_DRIVER_PAGE
:
3746 Page
= OemDriverPage(&Ir
);
3750 case DEVICE_SETTINGS_PAGE
:
3751 Page
= DeviceSettingsPage(&Ir
);
3754 case COMPUTER_SETTINGS_PAGE
:
3755 Page
= ComputerSettingsPage(&Ir
);
3758 case DISPLAY_SETTINGS_PAGE
:
3759 Page
= DisplaySettingsPage(&Ir
);
3762 case KEYBOARD_SETTINGS_PAGE
:
3763 Page
= KeyboardSettingsPage(&Ir
);
3766 case LAYOUT_SETTINGS_PAGE
:
3767 Page
= LayoutSettingsPage(&Ir
);
3770 case SELECT_PARTITION_PAGE
:
3771 Page
= SelectPartitionPage(&Ir
);
3774 case CREATE_PARTITION_PAGE
:
3775 Page
= CreatePartitionPage(&Ir
);
3778 case DELETE_PARTITION_PAGE
:
3779 Page
= DeletePartitionPage(&Ir
);
3782 case SELECT_FILE_SYSTEM_PAGE
:
3783 Page
= SelectFileSystemPage(&Ir
);
3786 case FORMAT_PARTITION_PAGE
:
3787 Page
= FormatPartitionPage(&Ir
);
3790 case CHECK_FILE_SYSTEM_PAGE
:
3791 Page
= CheckFileSystemPage(&Ir
);
3794 case INSTALL_DIRECTORY_PAGE
:
3795 Page
= InstallDirectoryPage(&Ir
);
3798 case PREPARE_COPY_PAGE
:
3799 Page
= PrepareCopyPage(&Ir
);
3802 case FILE_COPY_PAGE
:
3803 Page
= FileCopyPage(&Ir
);
3807 Page
= RegistryPage(&Ir
);
3810 case BOOT_LOADER_PAGE
:
3811 Page
= BootLoaderPage(&Ir
);
3814 case BOOT_LOADER_FLOPPY_PAGE
:
3815 Page
= BootLoaderFloppyPage(&Ir
);
3818 case BOOT_LOADER_HARDDISK_PAGE
:
3819 Page
= BootLoaderHarddiskPage(&Ir
);
3824 case REPAIR_INTRO_PAGE
:
3825 Page
= RepairIntroPage(&Ir
);
3829 Page
= SuccessPage(&Ir
);
3833 Page
= FlushPage(&Ir
);
3837 Page
= QuitPage(&Ir
);
3847 NtShutdownSystem(ShutdownReboot
);
3848 NtTerminateProcess(NtCurrentProcess(), 0);