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)
30 #include <ntdll/rtl.h>
32 #include <ntos/minmax.h>
33 #include <reactos/resource.h>
40 #include "filequeue.h"
56 typedef enum _PAGE_NUMBER
63 // SCSI_CONTROLLER_PAGE,
66 COMPUTER_SETTINGS_PAGE
,
67 DISPLAY_SETTINGS_PAGE
,
68 KEYBOARD_SETTINGS_PAGE
,
70 POINTER_SETTINGS_PAGE
,
72 SELECT_PARTITION_PAGE
,
73 CREATE_PARTITION_PAGE
,
74 DELETE_PARTITION_PAGE
,
76 SELECT_FILE_SYSTEM_PAGE
,
77 FORMAT_PARTITION_PAGE
,
78 CHECK_FILE_SYSTEM_PAGE
,
81 INSTALL_DIRECTORY_PAGE
,
85 BOOT_LOADER_FLOPPY_PAGE
,
86 BOOT_LOADER_HARDDISK_PAGE
,
95 REBOOT_PAGE
, /* virtual page */
96 } PAGE_NUMBER
, *PPAGE_NUMBER
;
98 typedef struct _COPYCONTEXT
100 ULONG TotalOperations
;
101 ULONG CompletedOperations
;
102 PPROGRESSBAR ProgressBar
;
103 } COPYCONTEXT
, *PCOPYCONTEXT
;
106 /* GLOBALS ******************************************************************/
109 UNICODE_STRING SourceRootPath
;
110 BOOLEAN IsUnattendedSetup
;
111 LONG UnattendDestinationDiskNumber
;
112 LONG UnattendDestinationPartitionNumber
;
113 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
115 /* LOCALS *******************************************************************/
117 static PPARTLIST PartitionList
= NULL
;
119 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
122 static UNICODE_STRING SourcePath
;
124 static UNICODE_STRING InstallPath
;
126 /* Path to the install directory */
127 static UNICODE_STRING DestinationPath
;
128 static UNICODE_STRING DestinationArcPath
;
129 static UNICODE_STRING DestinationRootPath
;
131 /* Path to the active partition (boot manager) */
132 static UNICODE_STRING SystemRootPath
;
134 static HINF SetupInf
;
136 static HSPFILEQ SetupFileQueue
= NULL
;
138 static BOOLEAN WarnLinuxPartitions
= TRUE
;
140 static PGENERIC_LIST ComputerList
= NULL
;
141 static PGENERIC_LIST DisplayList
= NULL
;
142 static PGENERIC_LIST KeyboardList
= NULL
;
143 static PGENERIC_LIST LayoutList
= NULL
;
144 static PGENERIC_LIST PointerList
= NULL
;
147 /* FUNCTIONS ****************************************************************/
150 PrintString(char* fmt
,...)
154 UNICODE_STRING UnicodeString
;
155 ANSI_STRING AnsiString
;
158 vsprintf(buffer
, fmt
, ap
);
161 RtlInitAnsiString(&AnsiString
, buffer
);
162 RtlAnsiStringToUnicodeString(&UnicodeString
,
165 NtDisplayString(&UnicodeString
);
166 RtlFreeUnicodeString(&UnicodeString
);
171 PopupError(PCHAR Text
,
189 /* Count text lines and longest line */
195 p
= strchr(pnext
, '\n');
198 Length
= strlen(pnext
);
203 Length
= (ULONG
)(p
- pnext
);
208 if (Length
> MaxLength
)
211 if (LastLine
== TRUE
)
217 /* Check length of status line */
220 Length
= strlen(Status
);
221 if (Length
> MaxLength
)
225 GetScreenSize(&xScreen
, &yScreen
);
227 Width
= MaxLength
+ 4;
232 yTop
= (yScreen
- Height
) / 2;
233 xLeft
= (xScreen
- Width
) / 2;
236 /* Set screen attributes */
238 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
240 FillConsoleOutputAttribute(0x74,
246 /* draw upper left corner */
249 FillConsoleOutputCharacter(0xDA, // '+',
254 /* draw upper edge */
257 FillConsoleOutputCharacter(0xC4, // '-',
262 /* draw upper right corner */
263 coPos
.X
= xLeft
+ Width
- 1;
265 FillConsoleOutputCharacter(0xBF, // '+',
270 /* Draw right edge, inner space and left edge */
271 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
274 FillConsoleOutputCharacter(0xB3, // '|',
280 FillConsoleOutputCharacter(' ',
285 coPos
.X
= xLeft
+ Width
- 1;
286 FillConsoleOutputCharacter(0xB3, // '|',
292 /* draw lower left corner */
294 coPos
.Y
= yTop
+ Height
- 1;
295 FillConsoleOutputCharacter(0xC0, // '+',
300 /* draw lower edge */
302 coPos
.Y
= yTop
+ Height
- 1;
303 FillConsoleOutputCharacter(0xC4, // '-',
308 /* draw lower right corner */
309 coPos
.X
= xLeft
+ Width
- 1;
310 coPos
.Y
= yTop
+ Height
- 1;
311 FillConsoleOutputCharacter(0xD9, // '+',
316 /* Print message text */
321 p
= strchr(pnext
, '\n');
324 Length
= strlen(pnext
);
329 Length
= (ULONG
)(p
- pnext
);
336 WriteConsoleOutputCharacters(pnext
,
341 if (LastLine
== TRUE
)
348 /* Print separator line and status text */
351 coPos
.Y
= yTop
+ Height
- 3;
353 FillConsoleOutputCharacter(0xC3, // '+',
359 FillConsoleOutputCharacter(0xC4, // '-',
364 coPos
.X
= xLeft
+ Width
- 1;
365 FillConsoleOutputCharacter(0xB4, // '+',
372 WriteConsoleOutputCharacters(Status
,
373 min(strlen(Status
), Width
- 4),
383 * FALSE: Don't quit setup.
386 ConfirmQuit(PINPUT_RECORD Ir
)
390 PopupError("ReactOS is not completely installed on your\n"
391 "computer. If you quit Setup now, you will need to\n"
392 "run Setup again to install ReactOS.\n"
394 " \x07 Press ENTER to continue Setup.\n"
395 " \x07 Press F3 to quit Setup.",
396 "F3= Quit ENTER = Continue");
402 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
403 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
408 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
420 CheckUnattendedSetup(VOID
)
422 WCHAR UnattendInfPath
[MAX_PATH
];
423 UNICODE_STRING FileName
;
431 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
433 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
434 IsUnattendedSetup
= FALSE
;
438 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
439 wcscat(UnattendInfPath
, L
"\\unattend.inf");
441 RtlInitUnicodeString(&FileName
,
444 /* Load 'unattend.inf' from install media. */
445 Status
= InfOpenFile(&UnattendInf
,
448 if (!NT_SUCCESS(Status
))
450 DPRINT("InfOpenFile() failed with status 0x%x\n", Status
);
454 /* Open 'Unattend' section */
455 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
457 DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
458 InfCloseFile(UnattendInf
);
462 /* Get pointer 'Signature' key */
463 if (!InfGetData(&Context
, NULL
, &Value
))
465 DPRINT("InfGetData() failed for key 'Signature'\n");
466 InfCloseFile(UnattendInf
);
470 /* Check 'Signature' string */
471 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
473 DPRINT("Signature not $ReactOS$\n");
474 InfCloseFile(UnattendInf
);
478 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
479 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
481 DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
482 InfCloseFile(UnattendInf
);
485 if (!InfGetIntField(&Context
, 0, &IntValue
))
487 DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
488 InfCloseFile(UnattendInf
);
491 UnattendDestinationDiskNumber
= IntValue
;
493 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
494 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
496 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
497 InfCloseFile(UnattendInf
);
500 if (!InfGetIntField(&Context
, 0, &IntValue
))
502 DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
503 InfCloseFile(UnattendInf
);
506 UnattendDestinationPartitionNumber
= IntValue
;
508 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
509 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
511 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
512 InfCloseFile(UnattendInf
);
516 /* Get pointer 'InstallationDirectory' key */
517 if (!InfGetData(&Context
, NULL
, &Value
))
519 DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
520 InfCloseFile(UnattendInf
);
523 wcscpy(UnattendInstallationDirectory
, Value
);
525 InfCloseFile(UnattendInf
);
527 IsUnattendedSetup
= TRUE
;
529 DPRINT("Running unattended setup\n");
536 * Number of the next page.
539 StartPage(PINPUT_RECORD Ir
)
541 SYSTEM_DEVICE_INFORMATION Sdi
;
543 WCHAR FileNameBuffer
[MAX_PATH
];
544 UNICODE_STRING FileName
;
550 SetStatusText(" Please wait...");
553 /* Check whether a harddisk is available */
554 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
556 sizeof(SYSTEM_DEVICE_INFORMATION
),
558 if (!NT_SUCCESS (Status
))
560 PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
561 PopupError("Setup could not retrieve system drive information.\n",
562 "ENTER = Reboot computer");
567 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
574 if (Sdi
.NumberOfDisks
== 0)
576 PopupError("Setup could not find a harddisk.\n",
577 "ENTER = Reboot computer");
582 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
589 /* Get the source path and source root path */
590 Status
= GetSourcePaths(&SourcePath
,
592 if (!NT_SUCCESS(Status
))
594 PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status
);
595 PopupError("Setup could not find its source drive.\n",
596 "ENTER = Reboot computer");
601 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
610 PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
611 PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
615 /* Load txtsetup.sif from install media. */
616 wcscpy(FileNameBuffer
, SourceRootPath
.Buffer
);
617 wcscat(FileNameBuffer
, L
"\\reactos\\txtsetup.sif");
618 RtlInitUnicodeString(&FileName
,
621 Status
= InfOpenFile(&SetupInf
,
624 if (!NT_SUCCESS(Status
))
626 PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
627 "ENTER = Reboot computer");
633 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
640 /* Open 'Version' section */
641 if (!InfFindFirstLine (SetupInf
, L
"Version", L
"Signature", &Context
))
643 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
644 "ENTER = Reboot computer");
650 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
658 /* Get pointer 'Signature' key */
659 if (!InfGetData (&Context
, NULL
, &Value
))
661 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
662 "ENTER = Reboot computer");
668 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
675 /* Check 'Signature' string */
676 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
678 PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
679 "ENTER = Reboot computer");
685 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
692 CheckUnattendedSetup();
704 IntroPage(PINPUT_RECORD Ir
)
706 SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup");
708 SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your");
709 SetTextXY(6, 12, "computer and prepares the second part of the setup.");
711 SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS.");
712 SetTextXY(8, 17, "\x07 Press L to view the licensing terms for ReactOS.");
713 SetTextXY(8, 19, "\x07 Press E to start the emergency console.");
714 SetTextXY(8, 21, "\x07 Press R to repair ReactOS.");
715 SetTextXY(8, 23, "\x07 Press F3 to quit without installing ReactOS.");
717 SetStatusText(" ENTER = Continue F3 = Quit");
719 if (IsUnattendedSetup
)
721 return INSTALL_INTRO_PAGE
;
728 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
729 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
731 if (ConfirmQuit(Ir
) == TRUE
)
735 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
737 return INSTALL_INTRO_PAGE
;
739 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* L */
743 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'E') /* E */
745 return EMERGENCY_INTRO_PAGE
;
747 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
749 return REPAIR_INTRO_PAGE
;
759 * Back to main setup page.
762 LicensePage(PINPUT_RECORD Ir
)
764 SetHighlightedTextXY(6, 8, "Licensing:");
766 SetTextXY(8, 11, "The ReactOS System is licensed under the terms of the");
767 SetTextXY(8, 12, "GNU GPL with parts containing code from other compatible");
768 SetTextXY(8, 13, "licenses such as the X11 or BSD and GNU LGPL licenses.");
769 SetTextXY(8, 14, "All software that is part of the ReactOS system is");
770 SetTextXY(8, 15, "therefore released under the GNU GPL as well as maintaining");
771 SetTextXY(8, 16, "the original license.");
773 SetTextXY(8, 18, "This software comes with NO WARRANTY or restrictions on usage");
774 SetTextXY(8, 19, "save applicable local and international law. The licensing of");
775 SetTextXY(8, 20, "ReactOS only covers distribution to third parties.");
777 SetTextXY(8, 22, "If for some resion you did not receive a copy of the");
778 SetTextXY(8, 23, "GNU General Public License with ReactOS please visit");
779 SetHighlightedTextXY(8, 25, "http://www.gnu.org/licenses/licenses.html");
781 SetStatusText("ENTER = Continue F3 = Quit");
787 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
788 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
790 if (ConfirmQuit(Ir
) == TRUE
)
794 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
804 EmergencyIntroPage(PINPUT_RECORD Ir
)
806 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
807 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
809 SetTextXY(6, 12, "The emergency console is not implemented yet.");
811 SetTextXY(8, 15, "\x07 Press ESC to return to the main page.");
813 SetTextXY(8, 17, "\x07 Press ENTER to reboot your computer.");
815 SetStatusText(" ESC = Main page ENTER = Reboot");
821 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
825 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
826 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
832 return REPAIR_INTRO_PAGE
;
837 RepairIntroPage(PINPUT_RECORD Ir
)
839 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
840 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
842 SetTextXY(6, 12, "The repair functions are not implemented yet.");
844 SetTextXY(8, 15, "\x07 Press ESC to return to the main page.");
846 SetTextXY(8, 17, "\x07 Press ENTER to reboot your computer.");
848 SetStatusText(" ESC = Main page ENTER = Reboot");
854 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
858 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
859 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
865 return REPAIR_INTRO_PAGE
;
870 InstallIntroPage(PINPUT_RECORD Ir
)
872 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
873 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
875 SetTextXY(6, 12, "The following limitations apply:");
876 SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
877 SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
878 SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
879 SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
880 SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
881 SetTextXY(8, 18, "- Setup supports FAT file systems only.");
882 SetTextXY(8, 19, "- File system checks are not implemented yet.");
885 SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
887 SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
890 SetStatusText(" ENTER = Continue F3 = Quit");
892 if (IsUnattendedSetup
)
894 return SELECT_PARTITION_PAGE
;
901 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
902 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
904 if (ConfirmQuit(Ir
) == TRUE
)
908 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
910 return DEVICE_SETTINGS_PAGE
;
911 // return SCSI_CONTROLLER_PAGE;
915 return INSTALL_INTRO_PAGE
;
921 ScsiControllerPage(PINPUT_RECORD Ir
)
923 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
925 /* FIXME: print loaded mass storage driver descriptions */
927 SetTextXY(8, 10, "TEST device");
931 SetStatusText(" ENTER = Continue F3 = Quit");
937 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
938 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
940 if (ConfirmQuit(Ir
) == TRUE
)
944 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
946 return DEVICE_SETTINGS_PAGE
;
950 return SCSI_CONTROLLER_PAGE
;
956 DeviceSettingsPage(PINPUT_RECORD Ir
)
958 static ULONG Line
= 17;
960 /* Initialize the computer settings list */
961 if (ComputerList
== NULL
)
963 ComputerList
= CreateComputerTypeList(SetupInf
);
964 if (ComputerList
== NULL
)
966 /* FIXME: report error */
970 /* Initialize the display settings list */
971 if (DisplayList
== NULL
)
973 DisplayList
= CreateDisplayDriverList(SetupInf
);
974 if (DisplayList
== NULL
)
976 /* FIXME: report error */
980 /* Initialize the keyboard settings list */
981 if (KeyboardList
== NULL
)
983 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
984 if (KeyboardList
== NULL
)
986 /* FIXME: report error */
990 /* Initialize the keyboard layout list */
991 if (LayoutList
== NULL
)
993 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
994 if (LayoutList
== NULL
)
996 /* FIXME: report error */
997 PopupError("Setup failed to load the keyboard layout list.\n",
998 "ENTER = Reboot computer");
1004 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1012 /* Initialize the pointer settings list */
1013 if (PointerList
== NULL
)
1015 PointerList
= CreateMouseDriverList(SetupInf
);
1016 if (PointerList
== NULL
)
1018 /* FIXME: report error */
1022 SetTextXY(6, 8, "The list below shows the current device settings.");
1024 SetTextXY(8, 11, " Computer:");
1025 SetTextXY(8, 12, " Display:");
1026 SetTextXY(8, 13, " Keyboard:");
1027 SetTextXY(8, 14, "Keyboard layout:");
1028 SetTextXY(8, 15, " Pointer device:");
1030 SetTextXY(8, 17, " Accept:");
1032 SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
1033 SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
1034 SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
1035 SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
1036 SetTextXY(25, 15, GetGenericListEntry(PointerList
)->Text
);
1038 SetTextXY(25, 17, "Accept these device settings");
1039 InvertTextXY (24, Line
, 48, 1);
1042 SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
1043 SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
1044 SetTextXY(6, 22, "settings.");
1046 SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
1047 SetTextXY(6, 25, "and press ENTER.");
1049 SetStatusText(" ENTER = Continue F3 = Quit");
1055 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1056 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1058 NormalTextXY (24, Line
, 48, 1);
1061 else if (Line
== 17)
1065 InvertTextXY (24, Line
, 48, 1);
1067 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1068 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1070 NormalTextXY (24, Line
, 48, 1);
1073 else if (Line
== 17)
1077 InvertTextXY (24, Line
, 48, 1);
1079 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1080 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1082 if (ConfirmQuit(Ir
) == TRUE
)
1086 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1089 return COMPUTER_SETTINGS_PAGE
;
1090 else if (Line
== 12)
1091 return DISPLAY_SETTINGS_PAGE
;
1092 else if (Line
== 13)
1093 return KEYBOARD_SETTINGS_PAGE
;
1094 else if (Line
== 14)
1095 return LAYOUT_SETTINGS_PAGE
;
1096 else if (Line
== 15)
1097 return POINTER_SETTINGS_PAGE
;
1098 else if (Line
== 17)
1099 return SELECT_PARTITION_PAGE
;
1103 return DEVICE_SETTINGS_PAGE
;
1108 ComputerSettingsPage(PINPUT_RECORD Ir
)
1113 SetTextXY(6, 8, "You want to change the type of computer to be installed.");
1115 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
1116 SetTextXY(8, 11, " Then press ENTER.");
1118 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1119 SetTextXY(8, 14, " the computer type.");
1121 GetScreenSize(&xScreen
, &yScreen
);
1123 DrawGenericList(ComputerList
,
1129 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1131 SaveGenericListState(ComputerList
);
1137 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1138 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1140 ScrollDownGenericList (ComputerList
);
1142 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1143 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1145 ScrollUpGenericList (ComputerList
);
1147 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1148 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1150 if (ConfirmQuit(Ir
) == TRUE
)
1154 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1155 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1157 RestoreGenericListState(ComputerList
);
1158 return DEVICE_SETTINGS_PAGE
;
1160 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1162 return DEVICE_SETTINGS_PAGE
;
1166 return COMPUTER_SETTINGS_PAGE
;
1171 DisplaySettingsPage(PINPUT_RECORD Ir
)
1176 SetTextXY(6, 8, "You want to change the type of display to be installed.");
1178 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
1179 SetTextXY(8, 11, " Then press ENTER.");
1181 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1182 SetTextXY(8, 14, " the display type.");
1184 GetScreenSize(&xScreen
, &yScreen
);
1186 DrawGenericList(DisplayList
,
1192 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1194 SaveGenericListState(DisplayList
);
1200 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1201 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1203 ScrollDownGenericList (DisplayList
);
1205 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1206 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1208 ScrollUpGenericList (DisplayList
);
1210 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1211 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1213 if (ConfirmQuit(Ir
) == TRUE
)
1219 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1220 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1222 RestoreGenericListState(DisplayList
);
1223 return DEVICE_SETTINGS_PAGE
;
1225 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1227 return DEVICE_SETTINGS_PAGE
;
1231 return DISPLAY_SETTINGS_PAGE
;
1236 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1241 SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
1243 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
1244 SetTextXY(8, 11, " Then press ENTER.");
1246 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1247 SetTextXY(8, 14, " the keyboard type.");
1249 GetScreenSize(&xScreen
, &yScreen
);
1251 DrawGenericList(KeyboardList
,
1257 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1259 SaveGenericListState(KeyboardList
);
1265 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1266 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1268 ScrollDownGenericList (KeyboardList
);
1270 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1271 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1273 ScrollUpGenericList (KeyboardList
);
1275 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1276 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1278 if (ConfirmQuit(Ir
) == TRUE
)
1282 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1283 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1285 RestoreGenericListState(KeyboardList
);
1286 return DEVICE_SETTINGS_PAGE
;
1288 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1290 return DEVICE_SETTINGS_PAGE
;
1294 return DISPLAY_SETTINGS_PAGE
;
1299 LayoutSettingsPage(PINPUT_RECORD Ir
)
1304 SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
1306 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
1307 SetTextXY(8, 11, " layout. Then press ENTER.");
1309 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1310 SetTextXY(8, 14, " the keyboard layout.");
1312 GetScreenSize(&xScreen
, &yScreen
);
1314 DrawGenericList(LayoutList
,
1320 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1322 SaveGenericListState(LayoutList
);
1328 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1329 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1331 ScrollDownGenericList (LayoutList
);
1333 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1334 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1336 ScrollUpGenericList (LayoutList
);
1338 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1339 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1341 if (ConfirmQuit(Ir
) == TRUE
)
1345 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1346 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1348 RestoreGenericListState(LayoutList
);
1349 return DEVICE_SETTINGS_PAGE
;
1351 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1353 return DEVICE_SETTINGS_PAGE
;
1357 return DISPLAY_SETTINGS_PAGE
;
1362 PointerSettingsPage(PINPUT_RECORD Ir
)
1367 SetTextXY(6, 8, "You want to change the pointing device to be installed.");
1369 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired pointing");
1370 SetTextXY(8, 11, " device. Then press ENTER.");
1372 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1373 SetTextXY(8, 14, " the pointing device.");
1375 GetScreenSize(&xScreen
, &yScreen
);
1377 DrawGenericList(PointerList
,
1383 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1385 SaveGenericListState(PointerList
);
1391 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1392 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1394 ScrollDownGenericList(PointerList
);
1396 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1397 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1399 ScrollUpGenericList(PointerList
);
1401 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1402 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1404 if (ConfirmQuit(Ir
) == TRUE
)
1408 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1409 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1411 RestoreGenericListState(PointerList
);
1412 return DEVICE_SETTINGS_PAGE
;
1414 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1416 return DEVICE_SETTINGS_PAGE
;
1420 return DISPLAY_SETTINGS_PAGE
;
1425 SelectPartitionPage(PINPUT_RECORD Ir
)
1430 SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
1431 SetTextXY(6, 9, "space for new partitions.");
1433 SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
1434 SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
1435 SetTextXY(8, 15, "\x07 Press C to create a new partition.");
1436 SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
1438 SetStatusText(" Please wait...");
1440 GetScreenSize(&xScreen
, &yScreen
);
1442 if (PartitionList
== NULL
)
1444 PartitionList
= CreatePartitionList (2,
1448 if (PartitionList
== NULL
)
1450 /* FIXME: show an error dialog */
1455 CheckActiveBootPartition (PartitionList
);
1457 DrawPartitionList (PartitionList
);
1459 /* Warn about partitions created by Linux Fdisk */
1460 if (WarnLinuxPartitions
== TRUE
&&
1461 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1463 PopupError ("Setup found that at least one harddisk contains an incompatible\n"
1464 "partition table that can not be handled properly!\n"
1466 "Creating or deleting partitions can destroy the partiton table.\n"
1468 " \x07 Press F3 to quit Setup."
1469 " \x07 Press ENTER to continue.",
1470 "F3= Quit ENTER = Continue");
1475 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1476 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1480 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1482 WarnLinuxPartitions
= FALSE
;
1483 return SELECT_PARTITION_PAGE
;
1488 if (IsUnattendedSetup
)
1490 SelectPartition(PartitionList
,
1491 UnattendDestinationDiskNumber
,
1492 UnattendDestinationPartitionNumber
);
1493 return(SELECT_FILE_SYSTEM_PAGE
);
1498 /* Update status text */
1499 if (PartitionList
->CurrentPartition
== NULL
||
1500 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1502 SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1506 SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1511 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1512 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1514 if (ConfirmQuit(Ir
) == TRUE
)
1516 DestroyPartitionList (PartitionList
);
1517 PartitionList
= NULL
;
1522 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1523 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1525 ScrollDownPartitionList (PartitionList
);
1527 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1528 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1530 ScrollUpPartitionList (PartitionList
);
1532 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1534 if (PartitionList
->CurrentPartition
== NULL
||
1535 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1537 CreateNewPartition (PartitionList
,
1542 return SELECT_FILE_SYSTEM_PAGE
;
1544 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_C
) /* C */
1546 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1548 PopupError ("You can not create a new Partition inside\n"
1549 "of an already existing Partition!\n"
1551 " * Press any key to continue.",
1555 return SELECT_PARTITION_PAGE
;
1558 return CREATE_PARTITION_PAGE
;
1560 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
1562 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1564 PopupError ("You can not delete unpartitioned disk space!\n"
1566 " * Press any key to continue.",
1570 return SELECT_PARTITION_PAGE
;
1573 return DELETE_PARTITION_PAGE
;
1577 return SELECT_PARTITION_PAGE
;
1582 DrawInputField(ULONG FieldLength
,
1592 memset(buf
, '_', sizeof(buf
));
1593 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1594 strcat(buf
, FieldContent
);
1596 WriteConsoleOutputCharacters (buf
,
1602 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1605 ShowPartitionSizeInputBox(SHORT Left
,
1630 /* draw upper left corner */
1633 FillConsoleOutputCharacter(0xDA, // '+',
1638 /* draw upper edge */
1641 FillConsoleOutputCharacter(0xC4, // '-',
1646 /* draw upper right corner */
1649 FillConsoleOutputCharacter(0xBF, // '+',
1654 /* draw left and right edge */
1655 for (i
= Top
+ 1; i
< Bottom
; i
++)
1659 FillConsoleOutputCharacter(0xB3, // '|',
1665 FillConsoleOutputCharacter(0xB3, //'|',
1671 /* draw lower left corner */
1674 FillConsoleOutputCharacter(0xC0, // '+',
1679 /* draw lower edge */
1682 FillConsoleOutputCharacter(0xC4, // '-',
1687 /* draw lower right corner */
1690 FillConsoleOutputCharacter(0xD9, // '+',
1698 strcpy (Buffer
, "Size of new partition:");
1699 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1701 WriteConsoleOutputCharacters (Buffer
,
1705 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1706 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1708 WriteConsoleOutputCharacters (Buffer
,
1714 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1723 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1724 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1731 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1735 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1742 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1747 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1752 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1753 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1755 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1756 if ((ch
>= '0') && (ch
<= '9'))
1761 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1769 strcpy (InputBuffer
,
1775 CreatePartitionPage (PINPUT_RECORD Ir
)
1777 PDISKENTRY DiskEntry
;
1778 PPARTENTRY PartEntry
;
1783 CHAR InputBuffer
[50];
1789 if (PartitionList
== NULL
||
1790 PartitionList
->CurrentDisk
== NULL
||
1791 PartitionList
->CurrentPartition
== NULL
)
1793 /* FIXME: show an error dialog */
1797 DiskEntry
= PartitionList
->CurrentDisk
;
1798 PartEntry
= PartitionList
->CurrentPartition
;
1800 SetStatusText (" Please wait...");
1802 GetScreenSize (&xScreen
, &yScreen
);
1804 SetTextXY (6, 8, "You have chosen to create a new partition on");
1807 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1809 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1815 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1821 if (DiskEntry
->DriverName
.Length
> 0)
1824 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1827 DiskEntry
->DiskNumber
,
1831 &DiskEntry
->DriverName
);
1836 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1839 DiskEntry
->DiskNumber
,
1846 SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1849 PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1850 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1853 SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1855 PartEntry
= PartitionList
->CurrentPartition
;
1858 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1859 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1860 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1863 if (ConfirmQuit (Ir
) == TRUE
)
1868 else if (Cancel
== TRUE
)
1870 return SELECT_PARTITION_PAGE
;
1874 PartSize
= atoi (InputBuffer
);
1881 if (PartSize
> MaxSize
)
1887 /* Convert to bytes */
1888 if (PartSize
== MaxSize
)
1890 /* Use all of the unpartitioned disk space */
1891 PartSize
= PartEntry
->UnpartitionedLength
;
1895 /* Round-up by cylinder size */
1896 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1897 DiskEntry
->CylinderSize
);
1899 /* But never get larger than the unpartitioned disk space */
1900 if (PartSize
> PartEntry
->UnpartitionedLength
)
1901 PartSize
= PartEntry
->UnpartitionedLength
;
1904 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1906 CreateNewPartition (PartitionList
,
1910 return SELECT_PARTITION_PAGE
;
1914 return CREATE_PARTITION_PAGE
;
1919 DeletePartitionPage (PINPUT_RECORD Ir
)
1921 PDISKENTRY DiskEntry
;
1922 PPARTENTRY PartEntry
;
1928 if (PartitionList
== NULL
||
1929 PartitionList
->CurrentDisk
== NULL
||
1930 PartitionList
->CurrentPartition
== NULL
)
1932 /* FIXME: show an error dialog */
1936 DiskEntry
= PartitionList
->CurrentDisk
;
1937 PartEntry
= PartitionList
->CurrentPartition
;
1939 SetTextXY (6, 8, "You have chosen to delete the partition");
1941 /* Determine partition type */
1943 if (PartEntry
->New
== TRUE
)
1945 PartType
= "New (Unformatted)";
1947 else if (PartEntry
->Unpartitioned
== FALSE
)
1949 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1950 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1951 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1952 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1956 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1957 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1961 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1963 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1968 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
1970 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1975 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000ULL
) /* 10 MB */
1977 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1982 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1986 if (PartType
== NULL
)
1989 " %c%c Type %lu %I64u %s",
1990 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1991 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1992 PartEntry
->PartInfo
[0].PartitionType
,
1999 " %c%c %s %I64u %s",
2000 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2001 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2008 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2010 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2016 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2022 if (DiskEntry
->DriverName
.Length
> 0)
2025 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
2028 DiskEntry
->DiskNumber
,
2032 &DiskEntry
->DriverName
);
2037 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
2040 DiskEntry
->DiskNumber
,
2046 SetTextXY (8, 18, "\x07 Press D to delete the partition.");
2047 SetTextXY (11, 19, "WARNING: All data on this partition will be lost!");
2049 SetTextXY (8, 21, "\x07 Press ESC to cancel.");
2051 SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit");
2057 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2058 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2060 if (ConfirmQuit (Ir
) == TRUE
)
2066 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
2068 return SELECT_PARTITION_PAGE
;
2070 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
2072 DeleteCurrentPartition (PartitionList
);
2074 return SELECT_PARTITION_PAGE
;
2078 return DELETE_PARTITION_PAGE
;
2083 SelectFileSystemPage (PINPUT_RECORD Ir
)
2085 PDISKENTRY DiskEntry
;
2086 PPARTENTRY PartEntry
;
2093 if (PartitionList
== NULL
||
2094 PartitionList
->CurrentDisk
== NULL
||
2095 PartitionList
->CurrentPartition
== NULL
)
2097 /* FIXME: show an error dialog */
2101 DiskEntry
= PartitionList
->CurrentDisk
;
2102 PartEntry
= PartitionList
->CurrentPartition
;
2104 /* adjust disk size */
2105 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2107 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2112 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2116 /* adjust partition size */
2117 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
2119 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
2124 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
2128 /* adjust partition type */
2129 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
2130 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
2131 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
2132 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
2136 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
2137 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
2141 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
2143 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2145 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2147 PartType
= "Unused";
2151 PartType
= "Unknown";
2154 if (PartEntry
->AutoCreate
== TRUE
)
2156 SetTextXY(6, 8, "Setup created a new partition on");
2159 PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2160 PartEntry
->PartInfo
[0].PartitionNumber
,
2166 PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2167 DiskEntry
->DiskNumber
,
2173 &DiskEntry
->DriverName
);
2175 SetTextXY(6, 12, "This Partition will be formatted next.");
2178 PartEntry
->AutoCreate
= FALSE
;
2180 else if (PartEntry
->New
== TRUE
)
2182 SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
2183 SetTextXY(6, 10, "This Partition will be formatted next.");
2187 SetTextXY(6, 8, "Setup install ReactOS onto Partition");
2189 if (PartType
== NULL
)
2192 "%c%c Type %lu %I64u %s",
2193 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2194 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2195 PartEntry
->PartInfo
[0].PartitionType
,
2203 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2204 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2210 PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2211 DiskEntry
->DiskNumber
,
2217 &DiskEntry
->DriverName
);
2221 SetTextXY(6, 17, "Select a file system from the list below.");
2223 SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system.");
2224 SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
2225 SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
2227 if (FileSystemList
== NULL
)
2229 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, FsFat
);
2230 if (FileSystemList
== NULL
)
2232 /* FIXME: show an error dialog */
2236 /* FIXME: Add file systems to list */
2238 DrawFileSystemList (FileSystemList
);
2240 SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit");
2242 if (IsUnattendedSetup
)
2244 return(CHECK_FILE_SYSTEM_PAGE
);
2251 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2252 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2254 if (ConfirmQuit (Ir
) == TRUE
)
2260 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2261 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2263 return SELECT_PARTITION_PAGE
;
2265 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2266 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2268 ScrollDownFileSystemList (FileSystemList
);
2270 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2271 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2273 ScrollUpFileSystemList (FileSystemList
);
2275 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2277 if (FileSystemList
->CurrentFileSystem
== FsKeep
)
2279 return CHECK_FILE_SYSTEM_PAGE
;
2283 return FORMAT_PARTITION_PAGE
;
2288 return SELECT_FILE_SYSTEM_PAGE
;
2293 FormatPartitionPage (PINPUT_RECORD Ir
)
2295 WCHAR PathBuffer
[MAX_PATH
];
2296 PDISKENTRY DiskEntry
;
2297 PPARTENTRY PartEntry
;
2306 SetTextXY(6, 8, "Format partition");
2308 SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue.");
2310 SetStatusText(" ENTER = Continue F3 = Quit");
2313 if (PartitionList
== NULL
||
2314 PartitionList
->CurrentDisk
== NULL
||
2315 PartitionList
->CurrentPartition
== NULL
)
2317 /* FIXME: show an error dialog */
2321 DiskEntry
= PartitionList
->CurrentDisk
;
2322 PartEntry
= PartitionList
->CurrentPartition
;
2328 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2329 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2331 if (ConfirmQuit (Ir
) == TRUE
)
2337 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2339 SetStatusText (" Please wait ...");
2341 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2343 switch (FileSystemList
->CurrentFileSystem
)
2346 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200ULL * 1024ULL))
2348 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2349 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2351 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024ULL * 255ULL * 63ULL * 512ULL))
2353 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2355 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32ULL * 1024ULL * 1024ULL))
2357 /* FAT16 CHS partition (partiton size < 32MB) */
2358 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2360 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2362 /* FAT16 CHS partition (partition size < 512MB) */
2363 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2367 /* FAT32 CHS partition (partition size >= 512MB) */
2368 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2373 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2375 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2377 /* FAT16 LBA partition (partition size < 512MB) */
2378 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2382 /* FAT32 LBA partition (partition size >= 512MB) */
2383 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2396 CheckActiveBootPartition (PartitionList
);
2400 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2401 DiskEntry
->DiskSize
,
2402 DiskEntry
->CylinderSize
,
2403 DiskEntry
->TrackSize
);
2406 DiskEntry
= PartitionList
->CurrentDisk
;
2407 Entry
= DiskEntry
->PartListHead
.Flink
;
2408 while (Entry
!= &DiskEntry
->PartListHead
)
2410 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2412 if (PartEntry
->Unpartitioned
== FALSE
)
2415 for (i
= 0; i
< 4; i
++)
2417 PrintTextXY (6, Line
,
2418 "%2u: %2u %c %12I64u %12I64u %2u %c",
2420 PartEntry
->PartInfo
[i
].PartitionNumber
,
2421 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2422 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2423 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2424 PartEntry
->PartInfo
[i
].PartitionType
,
2425 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2433 Entry
= Entry
->Flink
;
2436 /* Restore the old entry */
2437 PartEntry
= PartitionList
->CurrentPartition
;
2440 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2442 DPRINT ("WritePartitionsToDisk() failed\n");
2444 PopupError ("Setup failed to write partition tables.\n",
2445 "ENTER = Reboot computer");
2451 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2458 /* Set DestinationRootPath */
2459 RtlFreeUnicodeString (&DestinationRootPath
);
2460 swprintf (PathBuffer
,
2461 L
"\\Device\\Harddisk%lu\\Partition%lu",
2462 PartitionList
->CurrentDisk
->DiskNumber
,
2463 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2464 RtlCreateUnicodeString (&DestinationRootPath
,
2466 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2469 /* Set SystemRootPath */
2470 RtlFreeUnicodeString (&SystemRootPath
);
2471 swprintf (PathBuffer
,
2472 L
"\\Device\\Harddisk%lu\\Partition%lu",
2473 PartitionList
->ActiveBootDisk
->DiskNumber
,
2474 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2475 RtlCreateUnicodeString (&SystemRootPath
,
2477 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2480 switch (FileSystemList
->CurrentFileSystem
)
2483 Status
= FormatPartition (&DestinationRootPath
);
2484 if (!NT_SUCCESS (Status
))
2486 DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status
);
2487 /* FIXME: show an error dialog */
2491 PartEntry
->New
= FALSE
;
2492 if (FileSystemList
!= NULL
)
2494 DestroyFileSystemList (FileSystemList
);
2495 FileSystemList
= NULL
;
2498 CheckActiveBootPartition (PartitionList
);
2500 /* FIXME: Install boot code. This is a hack! */
2501 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
) ||
2502 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2504 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2505 wcscat (PathBuffer
, L
"\\loader\\fat32.bin");
2507 DPRINT ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2508 DestinationRootPath
.Buffer
);
2509 Status
= InstallFat32BootCodeToDisk (PathBuffer
,
2510 DestinationRootPath
.Buffer
);
2511 if (!NT_SUCCESS (Status
))
2513 DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2514 /* FIXME: show an error dialog */
2520 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2521 wcscat (PathBuffer
, L
"\\loader\\fat.bin");
2523 DPRINT ("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2524 DestinationRootPath
.Buffer
);
2525 Status
= InstallFat16BootCodeToDisk (PathBuffer
,
2526 DestinationRootPath
.Buffer
);
2527 if (!NT_SUCCESS (Status
))
2529 DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2530 /* FIXME: show an error dialog */
2544 SetStatusText (" Done. Press any key ...");
2548 return INSTALL_DIRECTORY_PAGE
;
2552 return FORMAT_PARTITION_PAGE
;
2557 CheckFileSystemPage(PINPUT_RECORD Ir
)
2559 WCHAR PathBuffer
[MAX_PATH
];
2561 SetTextXY(6, 8, "Check file system");
2563 SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
2565 SetStatusText(" Please wait ...");
2568 SetStatusText(" ENTER = Continue F3 = Quit");
2571 /* Set DestinationRootPath */
2572 RtlFreeUnicodeString (&DestinationRootPath
);
2573 swprintf (PathBuffer
,
2574 L
"\\Device\\Harddisk%lu\\Partition%lu",
2575 PartitionList
->CurrentDisk
->DiskNumber
,
2576 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2577 RtlCreateUnicodeString (&DestinationRootPath
,
2579 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2581 /* Set SystemRootPath */
2582 RtlFreeUnicodeString (&SystemRootPath
);
2583 swprintf (PathBuffer
,
2584 L
"\\Device\\Harddisk%lu\\Partition%lu",
2585 PartitionList
->ActiveBootDisk
->DiskNumber
,
2586 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2587 RtlCreateUnicodeString (&SystemRootPath
,
2589 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2592 if (IsUnattendedSetup
)
2594 return(INSTALL_DIRECTORY_PAGE
);
2601 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2602 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2604 if (ConfirmQuit(Ir
) == TRUE
)
2608 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2610 return(INSTALL_DIRECTORY_PAGE
);
2614 return(CHECK_FILE_SYSTEM_PAGE
);
2619 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2621 WCHAR PathBuffer
[MAX_PATH
];
2623 /* Create 'InstallPath' string */
2624 RtlFreeUnicodeString(&InstallPath
);
2625 RtlCreateUnicodeString(&InstallPath
,
2628 /* Create 'DestinationPath' string */
2629 RtlFreeUnicodeString(&DestinationPath
);
2631 DestinationRootPath
.Buffer
);
2632 if (InstallDir
[0] != L
'\\')
2635 wcscat(PathBuffer
, InstallDir
);
2636 RtlCreateUnicodeString(&DestinationPath
,
2639 /* Create 'DestinationArcPath' */
2640 RtlFreeUnicodeString(&DestinationArcPath
);
2641 swprintf(PathBuffer
,
2642 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2643 DiskEntry
->DiskNumber
,
2644 PartEntry
->PartInfo
[0].PartitionNumber
);
2645 if (InstallDir
[0] != L
'\\')
2648 wcscat(PathBuffer
, InstallDir
);
2649 RtlCreateUnicodeString(&DestinationArcPath
,
2652 return(PREPARE_COPY_PAGE
);
2657 InstallDirectoryPage(PINPUT_RECORD Ir
)
2659 PDISKENTRY DiskEntry
;
2660 PPARTENTRY PartEntry
;
2661 WCHAR InstallDir
[51];
2666 if (PartitionList
== NULL
||
2667 PartitionList
->CurrentDisk
== NULL
||
2668 PartitionList
->CurrentPartition
== NULL
)
2670 /* FIXME: show an error dialog */
2674 DiskEntry
= PartitionList
->CurrentDisk
;
2675 PartEntry
= PartitionList
->CurrentPartition
;
2677 /* Search for 'DefaultPath' in the 'SetupData' section */
2678 if (!InfFindFirstLine (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2680 PopupError("Setup failed to find the 'SetupData' section\n"
2681 "in TXTSETUP.SIF.\n",
2682 "ENTER = Reboot computer");
2688 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2695 /* Read the 'DefaultPath' data */
2696 if (InfGetData (&Context
, NULL
, &DefaultPath
))
2698 wcscpy(InstallDir
, DefaultPath
);
2702 wcscpy(InstallDir
, L
"\\ReactOS");
2704 Length
= wcslen(InstallDir
);
2706 SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
2707 SetTextXY(6, 9, "directory where you want ReactOS to be installed:");
2709 SetInputTextXY(8, 11, 51, InstallDir
);
2711 SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete");
2712 SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to");
2713 SetTextXY(6, 16, "be installed.");
2715 SetStatusText(" ENTER = Continue F3 = Quit");
2717 if (IsUnattendedSetup
)
2719 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2726 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2727 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2729 if (ConfirmQuit(Ir
) == TRUE
)
2733 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2735 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2737 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2742 InstallDir
[Length
] = 0;
2743 SetInputTextXY(8, 11, 51, InstallDir
);
2746 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2750 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2752 InstallDir
[Length
] = 0;
2753 SetInputTextXY(8, 11, 51, InstallDir
);
2758 return(INSTALL_DIRECTORY_PAGE
);
2763 PrepareCopyPageInfFile(HINF InfFile
,
2764 PWCHAR SourceCabinet
,
2767 WCHAR PathBuffer
[MAX_PATH
];
2768 INFCONTEXT FilesContext
;
2769 INFCONTEXT DirContext
;
2774 PWCHAR FileKeyValue
;
2776 PWCHAR TargetFileName
;
2778 /* Search for the 'SourceFiles' section */
2779 if (!InfFindFirstLine (InfFile
, L
"SourceFiles", NULL
, &FilesContext
))
2781 PopupError("Setup failed to find the 'SourceFiles' section\n"
2782 "in TXTSETUP.SIF.\n", // FIXME
2783 "ENTER = Reboot computer");
2789 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2797 * Enumerate the files in the 'SourceFiles' section
2798 * and add them to the file queue.
2802 /* Get source file name and target directory id */
2803 if (!InfGetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2805 /* FIXME: Handle error! */
2806 DPRINT1("InfGetData() failed\n");
2810 /* Get optional target file name */
2811 if (!InfGetDataField (&FilesContext
, 2, &TargetFileName
))
2812 TargetFileName
= NULL
;
2814 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2816 /* Lookup target directory */
2817 if (!InfFindFirstLine (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2819 /* FIXME: Handle error! */
2820 DPRINT1("InfFindFirstLine() failed\n");
2824 if (!InfGetData (&DirContext
, NULL
, &DirKeyValue
))
2826 /* FIXME: Handle error! */
2827 DPRINT1("InfGetData() failed\n");
2831 if (!SetupQueueCopy(SetupFileQueue
,
2833 SourceRootPath
.Buffer
,
2839 /* FIXME: Handle error! */
2840 DPRINT1("SetupQueueCopy() failed\n");
2843 while (InfFindNextLine(&FilesContext
, &FilesContext
));
2846 /* Create directories */
2850 * Install directories like '\reactos\test' are not handled yet.
2853 /* Get destination path */
2854 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2856 /* Remove trailing backslash */
2857 Length
= wcslen(PathBuffer
);
2858 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2860 PathBuffer
[Length
- 1] = 0;
2863 /* Create the install directory */
2864 Status
= CreateDirectory(PathBuffer
);
2865 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2867 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2868 PopupError("Setup could not create the install directory.",
2869 "ENTER = Reboot computer");
2875 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2883 /* Search for the 'Directories' section */
2884 if (!InfFindFirstLine(InfFile
, L
"Directories", NULL
, &DirContext
))
2888 PopupError("Setup failed to find the 'Directories' section\n"
2889 "in the cabinet.\n", "ENTER = Reboot computer");
2893 PopupError("Setup failed to find the 'Directories' section\n"
2894 "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
2901 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2908 /* Enumerate the directory values and create the subdirectories */
2911 if (!InfGetData (&DirContext
, NULL
, &KeyValue
))
2917 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2919 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2921 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2922 wcscat(PathBuffer
, KeyValue
);
2924 DPRINT("FullPath: '%S'\n", PathBuffer
);
2926 else if (KeyValue
[0] != L
'\\')
2928 DPRINT("RelativePath: '%S'\n", KeyValue
);
2929 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2930 wcscat(PathBuffer
, L
"\\");
2931 wcscat(PathBuffer
, KeyValue
);
2933 DPRINT("FullPath: '%S'\n", PathBuffer
);
2935 Status
= CreateDirectory(PathBuffer
);
2936 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2938 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2939 PopupError("Setup could not create install directories.",
2940 "ENTER = Reboot computer");
2946 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2954 while (InfFindNextLine (&DirContext
, &DirContext
));
2961 PrepareCopyPage(PINPUT_RECORD Ir
)
2964 WCHAR PathBuffer
[MAX_PATH
];
2965 INFCONTEXT CabinetsContext
;
2972 SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
2974 SetStatusText(" Building the file copy list...");
2976 /* Create the file queue */
2977 SetupFileQueue
= SetupOpenFileQueue();
2978 if (SetupFileQueue
== NULL
)
2980 PopupError("Setup failed to open the copy file queue.\n",
2981 "ENTER = Reboot computer");
2987 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2994 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
2999 /* Search for the 'Cabinets' section */
3000 if (!InfFindFirstLine (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
3002 return FILE_COPY_PAGE
;
3006 * Enumerate the directory values in the 'Cabinets'
3007 * section and parse their inf files.
3011 if (!InfGetData (&CabinetsContext
, NULL
, &KeyValue
))
3014 wcscpy(PathBuffer
, SourcePath
.Buffer
);
3015 wcscat(PathBuffer
, L
"\\");
3016 wcscat(PathBuffer
, KeyValue
);
3018 CabinetInitialize();
3019 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
3020 CabinetSetCabinetName(PathBuffer
);
3022 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
3024 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
3026 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
3027 if (InfFileData
== NULL
)
3029 PopupError("Cabinet has no setup script.\n",
3030 "ENTER = Reboot computer");
3036 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3045 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
3047 PopupError("Cabinet not found.\n",
3048 "ENTER = Reboot computer");
3054 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3061 Status
= InfOpenBufferedFile(&InfHandle
,
3065 if (!NT_SUCCESS(Status
))
3067 PopupError("Cabinet has no valid inf file.\n",
3068 "ENTER = Reboot computer");
3074 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3083 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3088 while (InfFindNextLine (&CabinetsContext
, &CabinetsContext
));
3090 return FILE_COPY_PAGE
;
3095 FileCopyCallback(PVOID Context
,
3100 PCOPYCONTEXT CopyContext
;
3102 CopyContext
= (PCOPYCONTEXT
)Context
;
3104 switch (Notification
)
3106 case SPFILENOTIFY_STARTSUBQUEUE
:
3107 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3108 ProgressSetStepCount(CopyContext
->ProgressBar
,
3109 CopyContext
->TotalOperations
);
3112 case SPFILENOTIFY_STARTCOPY
:
3113 /* Display copy message */
3114 PrintTextXYN(6, 16, 60, "Copying file: %S", (PWSTR
)Param1
);
3116 PrintTextXYN(6, 18, 60, "File %lu of %lu",
3117 CopyContext
->CompletedOperations
+ 1,
3118 CopyContext
->TotalOperations
);
3121 case SPFILENOTIFY_ENDCOPY
:
3122 CopyContext
->CompletedOperations
++;
3123 ProgressNextStep(CopyContext
->ProgressBar
);
3132 FileCopyPage(PINPUT_RECORD Ir
)
3134 COPYCONTEXT CopyContext
;
3138 SetStatusText(" Please wait...");
3140 SetTextXY(6, 8, "Copying files");
3142 GetScreenSize(&xScreen
, &yScreen
);
3144 CopyContext
.TotalOperations
= 0;
3145 CopyContext
.CompletedOperations
= 0;
3146 CopyContext
.ProgressBar
= CreateProgressBar(6,
3151 SetupCommitFileQueue(SetupFileQueue
,
3152 DestinationRootPath
.Buffer
,
3154 (PSP_FILE_CALLBACK
)FileCopyCallback
,
3157 SetupCloseFileQueue(SetupFileQueue
);
3159 DestroyProgressBar(CopyContext
.ProgressBar
);
3161 return REGISTRY_PAGE
;
3166 RegistryPage(PINPUT_RECORD Ir
)
3168 INFCONTEXT InfContext
;
3175 SetTextXY(6, 8, "Setup is updating the system configuration");
3177 SetStatusText(" Creating registry hives...");
3179 if (!SetInstallPathValue(&DestinationPath
))
3181 DPRINT("SetInstallPathValue() failed\n");
3182 PopupError("Setup failed to set the initialize the registry.",
3183 "ENTER = Reboot computer");
3189 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3196 /* Create the default hives */
3197 Status
= NtInitializeRegistry(TRUE
);
3198 if (!NT_SUCCESS(Status
))
3200 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3201 PopupError("Setup failed to create the registry hives.",
3202 "ENTER = Reboot computer");
3208 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3215 /* Update registry */
3216 SetStatusText(" Updating registry hives...");
3218 if (!InfFindFirstLine(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3220 DPRINT1("InfFindFirstLine() failed\n");
3221 PopupError("Setup failed to find the registry data files.",
3222 "ENTER = Reboot computer");
3228 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3237 InfGetDataField (&InfContext
, 0, &Action
);
3238 InfGetDataField (&InfContext
, 1, &File
);
3239 InfGetDataField (&InfContext
, 2, &Section
);
3241 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3243 if (!_wcsicmp (Action
, L
"AddReg"))
3247 else if (!_wcsicmp (Action
, L
"DelReg"))
3256 SetStatusText(" Importing %S...", File
);
3258 if (!ImportRegistryFile(File
, Section
, Delete
))
3260 DPRINT("Importing %S failed\n", File
);
3262 PopupError("Setup failed to import a hive file.",
3263 "ENTER = Reboot computer");
3269 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3276 while (InfFindNextLine (&InfContext
, &InfContext
));
3278 /* Update display registry settings */
3279 SetStatusText(" Updating display registry settings...");
3280 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3282 PopupError("Setup failed to update display registry settings.",
3283 "ENTER = Reboot computer");
3289 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3296 /* Update keyboard layout settings */
3297 SetStatusText(" Updating keyboard layout settings...");
3298 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3300 PopupError("Setup failed to update keyboard layout settings.",
3301 "ENTER = Reboot computer");
3307 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3314 /* Update mouse registry settings */
3315 SetStatusText(" Updating mouse registry settings...");
3316 if (!ProcessMouseRegistry(SetupInf
, PointerList
))
3318 PopupError("Setup failed to update mouse registry settings.",
3319 "ENTER = Reboot computer");
3325 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3332 SetStatusText(" Done...");
3334 return BOOT_LOADER_PAGE
;
3339 BootLoaderPage(PINPUT_RECORD Ir
)
3341 UCHAR PartitionType
;
3342 BOOLEAN InstallOnFloppy
;
3345 SetStatusText(" Please wait...");
3347 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3349 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3351 DPRINT("Error: active partition invalid (unused)\n");
3352 InstallOnFloppy
= TRUE
;
3354 else if (PartitionType
== 0x0A)
3356 /* OS/2 boot manager partition */
3357 DPRINT("Found OS/2 boot manager partition\n");
3358 InstallOnFloppy
= TRUE
;
3360 else if (PartitionType
== 0x83)
3362 /* Linux ext2 partition */
3363 DPRINT("Found Linux ext2 partition\n");
3364 InstallOnFloppy
= TRUE
;
3366 else if (PartitionType
== PARTITION_IFS
)
3368 /* NTFS partition */
3369 DPRINT("Found NTFS partition\n");
3370 InstallOnFloppy
= TRUE
;
3372 else if ((PartitionType
== PARTITION_FAT_12
) ||
3373 (PartitionType
== PARTITION_FAT_16
) ||
3374 (PartitionType
== PARTITION_HUGE
) ||
3375 (PartitionType
== PARTITION_XINT13
) ||
3376 (PartitionType
== PARTITION_FAT32
) ||
3377 (PartitionType
== PARTITION_FAT32_XINT13
))
3379 DPRINT("Found FAT partition\n");
3380 InstallOnFloppy
= FALSE
;
3384 /* Unknown partition */
3385 DPRINT("Unknown partition found\n");
3386 InstallOnFloppy
= TRUE
;
3389 if (InstallOnFloppy
== TRUE
)
3391 return BOOT_LOADER_FLOPPY_PAGE
;
3394 SetTextXY(6, 8, "Setup is installing the boot loader");
3396 SetTextXY(8, 12, "Install bootloader on the harddisk (MBR).");
3397 SetTextXY(8, 13, "Install bootloader on a floppy disk.");
3398 InvertTextXY (8, Line
, 48, 1);
3400 SetStatusText(" ENTER = Continue F3 = Quit");
3406 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3407 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3409 NormalTextXY (8, Line
, 48, 1);
3412 else if (Line
== 13)
3418 InvertTextXY (8, Line
, 48, 1);
3420 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3421 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3423 NormalTextXY (8, Line
, 48, 1);
3426 else if (Line
== 13)
3432 InvertTextXY (8, Line
, 48, 1);
3434 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3435 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3437 if (ConfirmQuit(Ir
) == TRUE
)
3441 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3445 return BOOT_LOADER_HARDDISK_PAGE
;
3447 else if (Line
== 13)
3449 return BOOT_LOADER_FLOPPY_PAGE
;
3452 return BOOT_LOADER_PAGE
;
3457 return BOOT_LOADER_PAGE
;
3462 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3466 SetTextXY(6, 8, "Setup cannot install the bootloader on your computers");
3467 SetTextXY(6, 9, "harddisk");
3469 SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and");
3470 SetTextXY(6, 14, "press ENTER.");
3473 SetStatusText(" ENTER = Continue F3 = Quit");
3474 // SetStatusText(" Please wait...");
3480 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3481 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3483 if (ConfirmQuit(Ir
) == TRUE
)
3487 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3489 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3491 PopupError("No disk in drive A:.",
3492 "ENTER = Continue");
3497 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3501 return BOOT_LOADER_FLOPPY_PAGE
;
3504 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3505 &DestinationArcPath
);
3506 if (!NT_SUCCESS(Status
))
3508 /* Print error message */
3509 return BOOT_LOADER_FLOPPY_PAGE
;
3512 return SUCCESS_PAGE
;
3516 return BOOT_LOADER_FLOPPY_PAGE
;
3521 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3523 UCHAR PartitionType
;
3526 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3527 if ((PartitionType
== PARTITION_FAT_12
) ||
3528 (PartitionType
== PARTITION_FAT_16
) ||
3529 (PartitionType
== PARTITION_HUGE
) ||
3530 (PartitionType
== PARTITION_XINT13
) ||
3531 (PartitionType
== PARTITION_FAT32
) ||
3532 (PartitionType
== PARTITION_FAT32_XINT13
))
3534 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3536 &DestinationArcPath
,
3538 if (!NT_SUCCESS(Status
))
3540 PopupError("Setup failed to install the FAT bootcode on the system partition.",
3541 "ENTER = Reboot computer");
3547 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3554 return SUCCESS_PAGE
;
3558 PopupError("failed to install FAT bootcode on the system partition.",
3559 "ENTER = Reboot computer");
3565 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3572 return BOOT_LOADER_HARDDISK_PAGE
;
3577 QuitPage(PINPUT_RECORD Ir
)
3579 SetTextXY(10, 6, "ReactOS is not completely installed");
3581 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3582 SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
3584 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3586 SetStatusText(" Please wait ...");
3588 /* Destroy partition list */
3589 if (PartitionList
!= NULL
)
3591 DestroyPartitionList (PartitionList
);
3592 PartitionList
= NULL
;
3595 /* Destroy filesystem list */
3596 if (FileSystemList
!= NULL
)
3598 DestroyFileSystemList (FileSystemList
);
3599 FileSystemList
= NULL
;
3602 /* Destroy computer settings list */
3603 if (ComputerList
!= NULL
)
3605 DestroyGenericList(ComputerList
, TRUE
);
3606 ComputerList
= NULL
;
3609 /* Destroy display settings list */
3610 if (DisplayList
!= NULL
)
3612 DestroyGenericList(DisplayList
, TRUE
);
3616 /* Destroy keyboard settings list */
3617 if (KeyboardList
!= NULL
)
3619 DestroyGenericList(KeyboardList
, TRUE
);
3620 KeyboardList
= NULL
;
3623 /* Destroy keyboard layout list */
3624 if (LayoutList
!= NULL
)
3626 DestroyGenericList(LayoutList
, TRUE
);
3630 /* Destroy pointer device list */
3631 if (PointerList
!= NULL
)
3633 DestroyGenericList(PointerList
, TRUE
);
3637 SetStatusText(" ENTER = Reboot computer");
3643 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3652 SuccessPage(PINPUT_RECORD Ir
)
3654 SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully.");
3656 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3657 SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
3659 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3661 SetStatusText(" ENTER = Reboot computer");
3663 if (IsUnattendedSetup
)
3672 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3681 FlushPage(PINPUT_RECORD Ir
)
3683 SetTextXY(10, 6, "The system is now making sure all data is stored on your disk");
3685 SetTextXY(10, 8, "This may take a minute");
3686 SetTextXY(10, 9, "When finished, your computer will reboot automatically");
3688 SetStatusText(" Flushing cache");
3695 NtProcessStartup(PPEB Peb
)
3701 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3703 ProcessHeap
= Peb
->ProcessHeap
;
3705 Status
= AllocConsole();
3706 if (!NT_SUCCESS(Status
))
3708 PrintString("AllocConsole() failed (Status = 0x%08lx)\n", Status
);
3710 /* Raise a hard error (crash the system/BSOD) */
3711 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3716 /* Initialize global unicode strings */
3717 RtlInitUnicodeString(&SourcePath
, NULL
);
3718 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3719 RtlInitUnicodeString(&InstallPath
, NULL
);
3720 RtlInitUnicodeString(&DestinationPath
, NULL
);
3721 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3722 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3723 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3725 /* Hide the cursor */
3726 SetCursorType(TRUE
, FALSE
);
3729 while (Page
!= REBOOT_PAGE
)
3733 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3739 Page
= StartPage(&Ir
);
3744 Page
= LicensePage(&Ir
);
3749 Page
= IntroPage(&Ir
);
3753 case INSTALL_INTRO_PAGE
:
3754 Page
= InstallIntroPage(&Ir
);
3758 case SCSI_CONTROLLER_PAGE
:
3759 Page
= ScsiControllerPage(&Ir
);
3764 case OEM_DRIVER_PAGE
:
3765 Page
= OemDriverPage(&Ir
);
3769 case DEVICE_SETTINGS_PAGE
:
3770 Page
= DeviceSettingsPage(&Ir
);
3773 case COMPUTER_SETTINGS_PAGE
:
3774 Page
= ComputerSettingsPage(&Ir
);
3777 case DISPLAY_SETTINGS_PAGE
:
3778 Page
= DisplaySettingsPage(&Ir
);
3781 case KEYBOARD_SETTINGS_PAGE
:
3782 Page
= KeyboardSettingsPage(&Ir
);
3785 case LAYOUT_SETTINGS_PAGE
:
3786 Page
= LayoutSettingsPage(&Ir
);
3789 case POINTER_SETTINGS_PAGE
:
3790 Page
= PointerSettingsPage(&Ir
);
3793 case SELECT_PARTITION_PAGE
:
3794 Page
= SelectPartitionPage(&Ir
);
3797 case CREATE_PARTITION_PAGE
:
3798 Page
= CreatePartitionPage(&Ir
);
3801 case DELETE_PARTITION_PAGE
:
3802 Page
= DeletePartitionPage(&Ir
);
3805 case SELECT_FILE_SYSTEM_PAGE
:
3806 Page
= SelectFileSystemPage(&Ir
);
3809 case FORMAT_PARTITION_PAGE
:
3810 Page
= FormatPartitionPage(&Ir
);
3813 case CHECK_FILE_SYSTEM_PAGE
:
3814 Page
= CheckFileSystemPage(&Ir
);
3817 case INSTALL_DIRECTORY_PAGE
:
3818 Page
= InstallDirectoryPage(&Ir
);
3821 case PREPARE_COPY_PAGE
:
3822 Page
= PrepareCopyPage(&Ir
);
3825 case FILE_COPY_PAGE
:
3826 Page
= FileCopyPage(&Ir
);
3830 Page
= RegistryPage(&Ir
);
3833 case BOOT_LOADER_PAGE
:
3834 Page
= BootLoaderPage(&Ir
);
3837 case BOOT_LOADER_FLOPPY_PAGE
:
3838 Page
= BootLoaderFloppyPage(&Ir
);
3841 case BOOT_LOADER_HARDDISK_PAGE
:
3842 Page
= BootLoaderHarddiskPage(&Ir
);
3847 case REPAIR_INTRO_PAGE
:
3848 Page
= RepairIntroPage(&Ir
);
3852 /* Emergency pages */
3853 case EMERGENCY_INTRO_PAGE
:
3854 Page
= EmergencyIntroPage(&Ir
);
3859 Page
= SuccessPage(&Ir
);
3863 Page
= FlushPage(&Ir
);
3867 Page
= QuitPage(&Ir
);
3877 NtShutdownSystem(ShutdownReboot
);