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)
28 #include <ddk/ntddk.h>
29 #include <ntdll/rtl.h>
31 #include <ntos/minmax.h>
32 #include <reactos/resource.h>
39 #include "filequeue.h"
55 typedef enum _PAGE_NUMBER
61 // SCSI_CONTROLLER_PAGE,
64 COMPUTER_SETTINGS_PAGE
,
65 DISPLAY_SETTINGS_PAGE
,
66 KEYBOARD_SETTINGS_PAGE
,
68 POINTER_SETTINGS_PAGE
,
70 SELECT_PARTITION_PAGE
,
71 CREATE_PARTITION_PAGE
,
72 DELETE_PARTITION_PAGE
,
74 SELECT_FILE_SYSTEM_PAGE
,
75 FORMAT_PARTITION_PAGE
,
76 CHECK_FILE_SYSTEM_PAGE
,
79 INSTALL_DIRECTORY_PAGE
,
83 BOOT_LOADER_FLOPPY_PAGE
,
84 BOOT_LOADER_HARDDISK_PAGE
,
93 REBOOT_PAGE
, /* virtual page */
94 } PAGE_NUMBER
, *PPAGE_NUMBER
;
96 typedef struct _COPYCONTEXT
98 ULONG TotalOperations
;
99 ULONG CompletedOperations
;
100 PPROGRESSBAR ProgressBar
;
101 } COPYCONTEXT
, *PCOPYCONTEXT
;
104 /* GLOBALS ******************************************************************/
107 UNICODE_STRING SourceRootPath
;
108 BOOLEAN IsUnattendedSetup
;
109 LONG UnattendDestinationDiskNumber
;
110 LONG UnattendDestinationPartitionNumber
;
111 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
113 /* LOCALS *******************************************************************/
115 static PPARTLIST PartitionList
= NULL
;
117 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
120 static UNICODE_STRING SourcePath
;
122 static UNICODE_STRING InstallPath
;
124 /* Path to the install directory */
125 static UNICODE_STRING DestinationPath
;
126 static UNICODE_STRING DestinationArcPath
;
127 static UNICODE_STRING DestinationRootPath
;
129 /* Path to the active partition (boot manager) */
130 static UNICODE_STRING SystemRootPath
;
132 static HINF SetupInf
;
134 static HSPFILEQ SetupFileQueue
= NULL
;
136 static BOOLEAN WarnLinuxPartitions
= TRUE
;
138 static PGENERIC_LIST ComputerList
= NULL
;
139 static PGENERIC_LIST DisplayList
= NULL
;
140 static PGENERIC_LIST KeyboardList
= NULL
;
141 static PGENERIC_LIST LayoutList
= NULL
;
142 static PGENERIC_LIST PointerList
= NULL
;
145 /* FUNCTIONS ****************************************************************/
148 PrintString(char* fmt
,...)
152 UNICODE_STRING UnicodeString
;
153 ANSI_STRING AnsiString
;
156 vsprintf(buffer
, fmt
, ap
);
159 RtlInitAnsiString(&AnsiString
, buffer
);
160 RtlAnsiStringToUnicodeString(&UnicodeString
,
163 NtDisplayString(&UnicodeString
);
164 RtlFreeUnicodeString(&UnicodeString
);
169 PopupError(PCHAR Text
,
187 /* Count text lines and longest line */
193 p
= strchr(pnext
, '\n');
196 Length
= strlen(pnext
);
201 Length
= (ULONG
)(p
- pnext
);
206 if (Length
> MaxLength
)
209 if (LastLine
== TRUE
)
215 /* Check length of status line */
218 Length
= strlen(Status
);
219 if (Length
> MaxLength
)
223 GetScreenSize(&xScreen
, &yScreen
);
225 Width
= MaxLength
+ 4;
230 yTop
= (yScreen
- Height
) / 2;
231 xLeft
= (xScreen
- Width
) / 2;
234 /* Set screen attributes */
236 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
238 FillConsoleOutputAttribute(0x74,
244 /* draw upper left corner */
247 FillConsoleOutputCharacter(0xDA, // '+',
252 /* draw upper edge */
255 FillConsoleOutputCharacter(0xC4, // '-',
260 /* draw upper right corner */
261 coPos
.X
= xLeft
+ Width
- 1;
263 FillConsoleOutputCharacter(0xBF, // '+',
268 /* Draw right edge, inner space and left edge */
269 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
272 FillConsoleOutputCharacter(0xB3, // '|',
278 FillConsoleOutputCharacter(' ',
283 coPos
.X
= xLeft
+ Width
- 1;
284 FillConsoleOutputCharacter(0xB3, // '|',
290 /* draw lower left corner */
292 coPos
.Y
= yTop
+ Height
- 1;
293 FillConsoleOutputCharacter(0xC0, // '+',
298 /* draw lower edge */
300 coPos
.Y
= yTop
+ Height
- 1;
301 FillConsoleOutputCharacter(0xC4, // '-',
306 /* draw lower right corner */
307 coPos
.X
= xLeft
+ Width
- 1;
308 coPos
.Y
= yTop
+ Height
- 1;
309 FillConsoleOutputCharacter(0xD9, // '+',
314 /* Print message text */
319 p
= strchr(pnext
, '\n');
322 Length
= strlen(pnext
);
327 Length
= (ULONG
)(p
- pnext
);
334 WriteConsoleOutputCharacters(pnext
,
339 if (LastLine
== TRUE
)
346 /* Print separator line and status text */
349 coPos
.Y
= yTop
+ Height
- 3;
351 FillConsoleOutputCharacter(0xC3, // '+',
357 FillConsoleOutputCharacter(0xC4, // '-',
362 coPos
.X
= xLeft
+ Width
- 1;
363 FillConsoleOutputCharacter(0xB4, // '+',
370 WriteConsoleOutputCharacters(Status
,
371 min(strlen(Status
), Width
- 4),
381 * FALSE: Don't quit setup.
384 ConfirmQuit(PINPUT_RECORD Ir
)
388 PopupError("ReactOS is not completely installed on your\n"
389 "computer. If you quit Setup now, you will need to\n"
390 "run Setup again to install ReactOS.\n"
392 " \x07 Press ENTER to continue Setup.\n"
393 " \x07 Press F3 to quit Setup.",
394 "F3= Quit ENTER = Continue");
400 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
401 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
406 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
418 CheckUnattendedSetup(VOID
)
420 WCHAR UnattendInfPath
[MAX_PATH
];
421 UNICODE_STRING FileName
;
429 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
431 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
432 IsUnattendedSetup
= FALSE
;
436 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
437 wcscat(UnattendInfPath
, L
"\\unattend.inf");
439 RtlInitUnicodeString(&FileName
,
442 /* Load 'unattend.inf' from install media. */
443 Status
= InfOpenFile(&UnattendInf
,
446 if (!NT_SUCCESS(Status
))
448 DPRINT("InfOpenFile() failed with status 0x%x\n", Status
);
452 /* Open 'Unattend' section */
453 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
455 DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
456 InfCloseFile(UnattendInf
);
460 /* Get pointer 'Signature' key */
461 if (!InfGetData(&Context
, NULL
, &Value
))
463 DPRINT("InfGetData() failed for key 'Signature'\n");
464 InfCloseFile(UnattendInf
);
468 /* Check 'Signature' string */
469 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
471 DPRINT("Signature not $ReactOS$\n");
472 InfCloseFile(UnattendInf
);
476 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
477 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
479 DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
480 InfCloseFile(UnattendInf
);
483 if (!InfGetIntField(&Context
, 0, &IntValue
))
485 DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
486 InfCloseFile(UnattendInf
);
489 UnattendDestinationDiskNumber
= IntValue
;
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
);
498 if (!InfGetIntField(&Context
, 0, &IntValue
))
500 DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
501 InfCloseFile(UnattendInf
);
504 UnattendDestinationPartitionNumber
= IntValue
;
506 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
507 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
509 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
510 InfCloseFile(UnattendInf
);
514 /* Get pointer 'InstallationDirectory' key */
515 if (!InfGetData(&Context
, NULL
, &Value
))
517 DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
518 InfCloseFile(UnattendInf
);
521 wcscpy(UnattendInstallationDirectory
, Value
);
523 InfCloseFile(UnattendInf
);
525 IsUnattendedSetup
= TRUE
;
527 DPRINT("Running unattended setup\n");
534 * Number of the next page.
537 StartPage(PINPUT_RECORD Ir
)
539 SYSTEM_DEVICE_INFORMATION Sdi
;
541 WCHAR FileNameBuffer
[MAX_PATH
];
542 UNICODE_STRING FileName
;
548 SetStatusText(" Please wait...");
551 /* Check whether a harddisk is available */
552 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
554 sizeof(SYSTEM_DEVICE_INFORMATION
),
556 if (!NT_SUCCESS (Status
))
558 PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
559 PopupError("Setup could not retrieve system drive information.\n",
560 "ENTER = Reboot computer");
565 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
572 if (Sdi
.NumberOfDisks
== 0)
574 PopupError("Setup could not find a harddisk.\n",
575 "ENTER = Reboot computer");
580 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
587 /* Get the source path and source root path */
588 Status
= GetSourcePaths(&SourcePath
,
590 if (!NT_SUCCESS(Status
))
592 PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status
);
593 PopupError("Setup could not find its source drive.\n",
594 "ENTER = Reboot computer");
599 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
608 PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
609 PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
613 /* Load txtsetup.sif from install media. */
614 wcscpy(FileNameBuffer
, SourceRootPath
.Buffer
);
615 wcscat(FileNameBuffer
, L
"\\reactos\\txtsetup.sif");
616 RtlInitUnicodeString(&FileName
,
619 Status
= InfOpenFile(&SetupInf
,
622 if (!NT_SUCCESS(Status
))
624 PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
625 "ENTER = Reboot computer");
631 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
638 /* Open 'Version' section */
639 if (!InfFindFirstLine (SetupInf
, L
"Version", L
"Signature", &Context
))
641 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
642 "ENTER = Reboot computer");
648 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
656 /* Get pointer 'Signature' key */
657 if (!InfGetData (&Context
, NULL
, &Value
))
659 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
660 "ENTER = Reboot computer");
666 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
673 /* Check 'Signature' string */
674 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
676 PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
677 "ENTER = Reboot computer");
683 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
690 CheckUnattendedSetup();
702 IntroPage(PINPUT_RECORD Ir
)
704 SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup");
706 SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your");
707 SetTextXY(6, 12, "computer and prepares the second part of the setup.");
709 SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS.");
710 SetTextXY(8, 17, "\x07 Press E to start the emergency console.");
711 SetTextXY(8, 19, "\x07 Press R to repair ReactOS.");
712 SetTextXY(8, 21, "\x07 Press F3 to quit without installing ReactOS.");
714 SetStatusText(" ENTER = Continue F3 = Quit");
716 if (IsUnattendedSetup
)
718 return INSTALL_INTRO_PAGE
;
725 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
726 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
728 if (ConfirmQuit(Ir
) == TRUE
)
732 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
734 return INSTALL_INTRO_PAGE
;
736 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'E') /* E */
738 return EMERGENCY_INTRO_PAGE
;
740 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
742 return REPAIR_INTRO_PAGE
;
751 EmergencyIntroPage(PINPUT_RECORD Ir
)
753 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
754 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
756 SetTextXY(6, 12, "The emergency console is not implemented yet.");
758 SetTextXY(8, 15, "\x07 Press ESC to return to the main page.");
760 SetTextXY(8, 17, "\x07 Press ENTER to reboot your computer.");
762 SetStatusText(" ESC = Main page ENTER = Reboot");
768 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
772 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
773 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
779 return REPAIR_INTRO_PAGE
;
784 RepairIntroPage(PINPUT_RECORD Ir
)
786 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
787 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
789 SetTextXY(6, 12, "The repair functions are not implemented yet.");
791 SetTextXY(8, 15, "\x07 Press ESC to return to the main page.");
793 SetTextXY(8, 17, "\x07 Press ENTER to reboot your computer.");
795 SetStatusText(" ESC = Main page ENTER = Reboot");
801 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
805 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
806 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
812 return REPAIR_INTRO_PAGE
;
817 InstallIntroPage(PINPUT_RECORD Ir
)
819 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
820 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
822 SetTextXY(6, 12, "The following limitations apply:");
823 SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
824 SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
825 SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
826 SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
827 SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
828 SetTextXY(8, 18, "- Setup supports FAT file systems only.");
829 SetTextXY(8, 19, "- File system checks are not implemented yet.");
832 SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
834 SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
837 SetStatusText(" ENTER = Continue F3 = Quit");
839 if (IsUnattendedSetup
)
841 return SELECT_PARTITION_PAGE
;
848 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
849 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
851 if (ConfirmQuit(Ir
) == TRUE
)
855 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
857 return DEVICE_SETTINGS_PAGE
;
858 // return SCSI_CONTROLLER_PAGE;
862 return INSTALL_INTRO_PAGE
;
868 ScsiControllerPage(PINPUT_RECORD Ir
)
870 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
872 /* FIXME: print loaded mass storage driver descriptions */
874 SetTextXY(8, 10, "TEST device");
878 SetStatusText(" ENTER = Continue F3 = Quit");
884 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
885 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
887 if (ConfirmQuit(Ir
) == TRUE
)
891 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
893 return DEVICE_SETTINGS_PAGE
;
897 return SCSI_CONTROLLER_PAGE
;
903 DeviceSettingsPage(PINPUT_RECORD Ir
)
905 static ULONG Line
= 17;
907 /* Initialize the computer settings list */
908 if (ComputerList
== NULL
)
910 ComputerList
= CreateComputerTypeList(SetupInf
);
911 if (ComputerList
== NULL
)
913 /* FIXME: report error */
917 /* Initialize the display settings list */
918 if (DisplayList
== NULL
)
920 DisplayList
= CreateDisplayDriverList(SetupInf
);
921 if (DisplayList
== NULL
)
923 /* FIXME: report error */
927 /* Initialize the keyboard settings list */
928 if (KeyboardList
== NULL
)
930 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
931 if (KeyboardList
== NULL
)
933 /* FIXME: report error */
937 /* Initialize the keyboard layout list */
938 if (LayoutList
== NULL
)
940 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
941 if (LayoutList
== NULL
)
943 /* FIXME: report error */
944 PopupError("Setup failed to load the keyboard layout list.\n",
945 "ENTER = Reboot computer");
951 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
959 /* Initialize the pointer settings list */
960 if (PointerList
== NULL
)
962 PointerList
= CreateMouseDriverList(SetupInf
);
963 if (PointerList
== NULL
)
965 /* FIXME: report error */
969 SetTextXY(6, 8, "The list below shows the current device settings.");
971 SetTextXY(8, 11, " Computer:");
972 SetTextXY(8, 12, " Display:");
973 SetTextXY(8, 13, " Keyboard:");
974 SetTextXY(8, 14, "Keyboard layout:");
975 SetTextXY(8, 15, " Pointer device:");
977 SetTextXY(8, 17, " Accept:");
979 SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
980 SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
981 SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
982 SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
983 SetTextXY(25, 15, GetGenericListEntry(PointerList
)->Text
);
985 SetTextXY(25, 17, "Accept these device settings");
986 InvertTextXY (24, Line
, 48, 1);
989 SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
990 SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
991 SetTextXY(6, 22, "settings.");
993 SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
994 SetTextXY(6, 25, "and press ENTER.");
996 SetStatusText(" ENTER = Continue F3 = Quit");
1002 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1003 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1005 NormalTextXY (24, Line
, 48, 1);
1008 else if (Line
== 17)
1012 InvertTextXY (24, Line
, 48, 1);
1014 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1015 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1017 NormalTextXY (24, Line
, 48, 1);
1020 else if (Line
== 17)
1024 InvertTextXY (24, Line
, 48, 1);
1026 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1027 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1029 if (ConfirmQuit(Ir
) == TRUE
)
1033 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1036 return COMPUTER_SETTINGS_PAGE
;
1037 else if (Line
== 12)
1038 return DISPLAY_SETTINGS_PAGE
;
1039 else if (Line
== 13)
1040 return KEYBOARD_SETTINGS_PAGE
;
1041 else if (Line
== 14)
1042 return LAYOUT_SETTINGS_PAGE
;
1043 else if (Line
== 15)
1044 return POINTER_SETTINGS_PAGE
;
1045 else if (Line
== 17)
1046 return SELECT_PARTITION_PAGE
;
1050 return DEVICE_SETTINGS_PAGE
;
1055 ComputerSettingsPage(PINPUT_RECORD Ir
)
1060 SetTextXY(6, 8, "You want to change the type of computer to be installed.");
1062 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
1063 SetTextXY(8, 11, " Then press ENTER.");
1065 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1066 SetTextXY(8, 14, " the computer type.");
1068 GetScreenSize(&xScreen
, &yScreen
);
1070 DrawGenericList(ComputerList
,
1076 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1078 SaveGenericListState(ComputerList
);
1084 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1085 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1087 ScrollDownGenericList (ComputerList
);
1089 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1090 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1092 ScrollUpGenericList (ComputerList
);
1094 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1095 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1097 if (ConfirmQuit(Ir
) == TRUE
)
1101 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1102 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1104 RestoreGenericListState(ComputerList
);
1105 return DEVICE_SETTINGS_PAGE
;
1107 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1109 return DEVICE_SETTINGS_PAGE
;
1113 return COMPUTER_SETTINGS_PAGE
;
1118 DisplaySettingsPage(PINPUT_RECORD Ir
)
1123 SetTextXY(6, 8, "You want to change the type of display to be installed.");
1125 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
1126 SetTextXY(8, 11, " Then press ENTER.");
1128 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1129 SetTextXY(8, 14, " the display type.");
1131 GetScreenSize(&xScreen
, &yScreen
);
1133 DrawGenericList(DisplayList
,
1139 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1141 SaveGenericListState(DisplayList
);
1147 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1148 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1150 ScrollDownGenericList (DisplayList
);
1152 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1153 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1155 ScrollUpGenericList (DisplayList
);
1157 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1158 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1160 if (ConfirmQuit(Ir
) == TRUE
)
1166 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1167 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1169 RestoreGenericListState(DisplayList
);
1170 return DEVICE_SETTINGS_PAGE
;
1172 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1174 return DEVICE_SETTINGS_PAGE
;
1178 return DISPLAY_SETTINGS_PAGE
;
1183 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1188 SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
1190 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
1191 SetTextXY(8, 11, " Then press ENTER.");
1193 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1194 SetTextXY(8, 14, " the keyboard type.");
1196 GetScreenSize(&xScreen
, &yScreen
);
1198 DrawGenericList(KeyboardList
,
1204 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1206 SaveGenericListState(KeyboardList
);
1212 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1213 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1215 ScrollDownGenericList (KeyboardList
);
1217 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1218 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1220 ScrollUpGenericList (KeyboardList
);
1222 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1223 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1225 if (ConfirmQuit(Ir
) == TRUE
)
1229 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1230 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1232 RestoreGenericListState(KeyboardList
);
1233 return DEVICE_SETTINGS_PAGE
;
1235 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1237 return DEVICE_SETTINGS_PAGE
;
1241 return DISPLAY_SETTINGS_PAGE
;
1246 LayoutSettingsPage(PINPUT_RECORD Ir
)
1251 SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
1253 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
1254 SetTextXY(8, 11, " layout. Then press ENTER.");
1256 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1257 SetTextXY(8, 14, " the keyboard layout.");
1259 GetScreenSize(&xScreen
, &yScreen
);
1261 DrawGenericList(LayoutList
,
1267 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1269 SaveGenericListState(LayoutList
);
1275 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1276 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1278 ScrollDownGenericList (LayoutList
);
1280 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1281 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1283 ScrollUpGenericList (LayoutList
);
1285 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1286 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1288 if (ConfirmQuit(Ir
) == TRUE
)
1292 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1293 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1295 RestoreGenericListState(LayoutList
);
1296 return DEVICE_SETTINGS_PAGE
;
1298 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1300 return DEVICE_SETTINGS_PAGE
;
1304 return DISPLAY_SETTINGS_PAGE
;
1309 PointerSettingsPage(PINPUT_RECORD Ir
)
1314 SetTextXY(6, 8, "You want to change the pointing device to be installed.");
1316 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired pointing");
1317 SetTextXY(8, 11, " device. Then press ENTER.");
1319 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1320 SetTextXY(8, 14, " the pointing device.");
1322 GetScreenSize(&xScreen
, &yScreen
);
1324 DrawGenericList(PointerList
,
1330 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1332 SaveGenericListState(PointerList
);
1338 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1339 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1341 ScrollDownGenericList(PointerList
);
1343 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1344 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1346 ScrollUpGenericList(PointerList
);
1348 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1349 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1351 if (ConfirmQuit(Ir
) == TRUE
)
1355 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1356 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1358 RestoreGenericListState(PointerList
);
1359 return DEVICE_SETTINGS_PAGE
;
1361 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1363 return DEVICE_SETTINGS_PAGE
;
1367 return DISPLAY_SETTINGS_PAGE
;
1372 SelectPartitionPage(PINPUT_RECORD Ir
)
1377 SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
1378 SetTextXY(6, 9, "space for new partitions.");
1380 SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
1381 SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
1382 SetTextXY(8, 15, "\x07 Press C to create a new partition.");
1383 SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
1385 SetStatusText(" Please wait...");
1387 GetScreenSize(&xScreen
, &yScreen
);
1389 if (PartitionList
== NULL
)
1391 PartitionList
= CreatePartitionList (2,
1395 if (PartitionList
== NULL
)
1397 /* FIXME: show an error dialog */
1402 CheckActiveBootPartition (PartitionList
);
1404 DrawPartitionList (PartitionList
);
1406 /* Warn about partitions created by Linux Fdisk */
1407 if (WarnLinuxPartitions
== TRUE
&&
1408 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1410 PopupError ("Setup found that at least one harddisk contains an incompatible\n"
1411 "partition table that can not be handled properly!\n"
1413 "Creating or deleting partitions can destroy the partiton table.\n"
1415 " \x07 Press F3 to quit Setup."
1416 " \x07 Press ENTER to continue.",
1417 "F3= Quit ENTER = Continue");
1422 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1423 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1427 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1429 WarnLinuxPartitions
= FALSE
;
1430 return SELECT_PARTITION_PAGE
;
1435 if (IsUnattendedSetup
)
1437 SelectPartition(PartitionList
,
1438 UnattendDestinationDiskNumber
,
1439 UnattendDestinationPartitionNumber
);
1440 return(SELECT_FILE_SYSTEM_PAGE
);
1445 /* Update status text */
1446 if (PartitionList
->CurrentPartition
== NULL
||
1447 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1449 SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1453 SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1458 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1459 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1461 if (ConfirmQuit(Ir
) == TRUE
)
1463 DestroyPartitionList (PartitionList
);
1464 PartitionList
= NULL
;
1469 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1470 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1472 ScrollDownPartitionList (PartitionList
);
1474 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1475 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1477 ScrollUpPartitionList (PartitionList
);
1479 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1481 if (PartitionList
->CurrentPartition
== NULL
||
1482 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1484 CreateNewPartition (PartitionList
,
1489 return SELECT_FILE_SYSTEM_PAGE
;
1491 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_C
) /* C */
1493 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1495 PopupError ("You can not create a new Partition inside\n"
1496 "of an already existing Partition!\n"
1498 " * Press any key to continue.",
1502 return SELECT_PARTITION_PAGE
;
1505 return CREATE_PARTITION_PAGE
;
1507 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
1509 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1511 PopupError ("You can not delete unpartitioned disk space!\n"
1513 " * Press any key to continue.",
1517 return SELECT_PARTITION_PAGE
;
1520 return DELETE_PARTITION_PAGE
;
1524 return SELECT_PARTITION_PAGE
;
1529 DrawInputField(ULONG FieldLength
,
1539 memset(buf
, '_', sizeof(buf
));
1540 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1541 strcat(buf
, FieldContent
);
1543 WriteConsoleOutputCharacters (buf
,
1549 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1552 ShowPartitionSizeInputBox(SHORT Left
,
1577 /* draw upper left corner */
1580 FillConsoleOutputCharacter(0xDA, // '+',
1585 /* draw upper edge */
1588 FillConsoleOutputCharacter(0xC4, // '-',
1593 /* draw upper right corner */
1596 FillConsoleOutputCharacter(0xBF, // '+',
1601 /* draw left and right edge */
1602 for (i
= Top
+ 1; i
< Bottom
; i
++)
1606 FillConsoleOutputCharacter(0xB3, // '|',
1612 FillConsoleOutputCharacter(0xB3, //'|',
1618 /* draw lower left corner */
1621 FillConsoleOutputCharacter(0xC0, // '+',
1626 /* draw lower edge */
1629 FillConsoleOutputCharacter(0xC4, // '-',
1634 /* draw lower right corner */
1637 FillConsoleOutputCharacter(0xD9, // '+',
1645 strcpy (Buffer
, "Size of new partition:");
1646 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1648 WriteConsoleOutputCharacters (Buffer
,
1652 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1653 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1655 WriteConsoleOutputCharacters (Buffer
,
1661 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1670 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1671 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1678 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1682 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1689 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1694 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1699 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1700 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1702 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1703 if ((ch
>= '0') && (ch
<= '9'))
1708 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1716 strcpy (InputBuffer
,
1722 CreatePartitionPage (PINPUT_RECORD Ir
)
1724 PDISKENTRY DiskEntry
;
1725 PPARTENTRY PartEntry
;
1730 CHAR InputBuffer
[50];
1736 if (PartitionList
== NULL
||
1737 PartitionList
->CurrentDisk
== NULL
||
1738 PartitionList
->CurrentPartition
== NULL
)
1740 /* FIXME: show an error dialog */
1744 DiskEntry
= PartitionList
->CurrentDisk
;
1745 PartEntry
= PartitionList
->CurrentPartition
;
1747 SetStatusText (" Please wait...");
1749 GetScreenSize (&xScreen
, &yScreen
);
1751 SetTextXY (6, 8, "You have chosen to create a new partition on");
1754 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1756 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1762 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1768 if (DiskEntry
->DriverName
.Length
> 0)
1771 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1774 DiskEntry
->DiskNumber
,
1778 &DiskEntry
->DriverName
);
1783 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1786 DiskEntry
->DiskNumber
,
1793 SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1796 PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1797 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1800 SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1802 PartEntry
= PartitionList
->CurrentPartition
;
1805 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1806 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1807 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1810 if (ConfirmQuit (Ir
) == TRUE
)
1815 else if (Cancel
== TRUE
)
1817 return SELECT_PARTITION_PAGE
;
1821 PartSize
= atoi (InputBuffer
);
1828 if (PartSize
> MaxSize
)
1834 /* Convert to bytes */
1835 if (PartSize
== MaxSize
)
1837 /* Use all of the unpartitioned disk space */
1838 PartSize
= PartEntry
->UnpartitionedLength
;
1842 /* Round-up by cylinder size */
1843 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1844 DiskEntry
->CylinderSize
);
1846 /* But never get larger than the unpartitioned disk space */
1847 if (PartSize
> PartEntry
->UnpartitionedLength
)
1848 PartSize
= PartEntry
->UnpartitionedLength
;
1851 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1853 CreateNewPartition (PartitionList
,
1857 return SELECT_PARTITION_PAGE
;
1861 return CREATE_PARTITION_PAGE
;
1866 DeletePartitionPage (PINPUT_RECORD Ir
)
1868 PDISKENTRY DiskEntry
;
1869 PPARTENTRY PartEntry
;
1875 if (PartitionList
== NULL
||
1876 PartitionList
->CurrentDisk
== NULL
||
1877 PartitionList
->CurrentPartition
== NULL
)
1879 /* FIXME: show an error dialog */
1883 DiskEntry
= PartitionList
->CurrentDisk
;
1884 PartEntry
= PartitionList
->CurrentPartition
;
1886 SetTextXY (6, 8, "You have chosen to delete the partition");
1888 /* Determine partition type */
1890 if (PartEntry
->New
== TRUE
)
1892 PartType
= "New (Unformatted)";
1894 else if (PartEntry
->Unpartitioned
== FALSE
)
1896 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1897 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1898 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1899 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1903 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1904 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1908 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1910 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1915 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
1917 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1922 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000ULL
) /* 10 MB */
1924 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1929 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1933 if (PartType
== NULL
)
1936 " %c%c Type %lu %I64u %s",
1937 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1938 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1939 PartEntry
->PartInfo
[0].PartitionType
,
1946 " %c%c %s %I64u %s",
1947 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1948 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1955 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1957 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1963 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1969 if (DiskEntry
->DriverName
.Length
> 0)
1972 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1975 DiskEntry
->DiskNumber
,
1979 &DiskEntry
->DriverName
);
1984 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1987 DiskEntry
->DiskNumber
,
1993 SetTextXY (8, 18, "\x07 Press D to delete the partition.");
1994 SetTextXY (11, 19, "WARNING: All data on this partition will be lost!");
1996 SetTextXY (8, 21, "\x07 Press ESC to cancel.");
1998 SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit");
2004 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2005 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2007 if (ConfirmQuit (Ir
) == TRUE
)
2013 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
2015 return SELECT_PARTITION_PAGE
;
2017 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
2019 DeleteCurrentPartition (PartitionList
);
2021 return SELECT_PARTITION_PAGE
;
2025 return DELETE_PARTITION_PAGE
;
2030 SelectFileSystemPage (PINPUT_RECORD Ir
)
2032 PDISKENTRY DiskEntry
;
2033 PPARTENTRY PartEntry
;
2040 if (PartitionList
== NULL
||
2041 PartitionList
->CurrentDisk
== NULL
||
2042 PartitionList
->CurrentPartition
== NULL
)
2044 /* FIXME: show an error dialog */
2048 DiskEntry
= PartitionList
->CurrentDisk
;
2049 PartEntry
= PartitionList
->CurrentPartition
;
2051 /* adjust disk size */
2052 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2054 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2059 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2063 /* adjust partition size */
2064 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
2066 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
2071 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
2075 /* adjust partition type */
2076 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
2077 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
2078 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
2079 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
2083 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
2084 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
2088 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
2090 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2092 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2094 PartType
= "Unused";
2098 PartType
= "Unknown";
2101 if (PartEntry
->AutoCreate
== TRUE
)
2103 SetTextXY(6, 8, "Setup created a new partition on");
2106 PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2107 PartEntry
->PartInfo
[0].PartitionNumber
,
2113 PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2114 DiskEntry
->DiskNumber
,
2120 &DiskEntry
->DriverName
);
2122 SetTextXY(6, 12, "This Partition will be formatted next.");
2125 PartEntry
->AutoCreate
= FALSE
;
2127 else if (PartEntry
->New
== TRUE
)
2129 SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
2130 SetTextXY(6, 10, "This Partition will be formatted next.");
2134 SetTextXY(6, 8, "Setup install ReactOS onto Partition");
2136 if (PartType
== NULL
)
2139 "%c%c Type %lu %I64u %s",
2140 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2141 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2142 PartEntry
->PartInfo
[0].PartitionType
,
2150 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2151 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2157 PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2158 DiskEntry
->DiskNumber
,
2164 &DiskEntry
->DriverName
);
2168 SetTextXY(6, 17, "Select a file system from the list below.");
2170 SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system.");
2171 SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
2172 SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
2174 if (FileSystemList
== NULL
)
2176 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, FsFat
);
2177 if (FileSystemList
== NULL
)
2179 /* FIXME: show an error dialog */
2183 /* FIXME: Add file systems to list */
2185 DrawFileSystemList (FileSystemList
);
2187 SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit");
2189 if (IsUnattendedSetup
)
2191 return(CHECK_FILE_SYSTEM_PAGE
);
2198 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2199 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2201 if (ConfirmQuit (Ir
) == TRUE
)
2207 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2208 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2210 return SELECT_PARTITION_PAGE
;
2212 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2213 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2215 ScrollDownFileSystemList (FileSystemList
);
2217 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2218 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2220 ScrollUpFileSystemList (FileSystemList
);
2222 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2224 if (FileSystemList
->CurrentFileSystem
== FsKeep
)
2226 return CHECK_FILE_SYSTEM_PAGE
;
2230 return FORMAT_PARTITION_PAGE
;
2235 return SELECT_FILE_SYSTEM_PAGE
;
2240 FormatPartitionPage (PINPUT_RECORD Ir
)
2242 WCHAR PathBuffer
[MAX_PATH
];
2243 PDISKENTRY DiskEntry
;
2244 PPARTENTRY PartEntry
;
2253 SetTextXY(6, 8, "Format partition");
2255 SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue.");
2257 SetStatusText(" ENTER = Continue F3 = Quit");
2260 if (PartitionList
== NULL
||
2261 PartitionList
->CurrentDisk
== NULL
||
2262 PartitionList
->CurrentPartition
== NULL
)
2264 /* FIXME: show an error dialog */
2268 DiskEntry
= PartitionList
->CurrentDisk
;
2269 PartEntry
= PartitionList
->CurrentPartition
;
2275 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2276 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2278 if (ConfirmQuit (Ir
) == TRUE
)
2284 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2286 SetStatusText (" Please wait ...");
2288 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2290 switch (FileSystemList
->CurrentFileSystem
)
2293 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200ULL * 1024ULL))
2295 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2296 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2298 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024ULL * 255ULL * 63ULL * 512ULL))
2300 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2302 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32ULL * 1024ULL * 1024ULL))
2304 /* FAT16 CHS partition (partiton size < 32MB) */
2305 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2307 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2309 /* FAT16 CHS partition (partition size < 512MB) */
2310 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2314 /* FAT32 CHS partition (partition size >= 512MB) */
2315 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2320 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2322 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2324 /* FAT16 LBA partition (partition size < 512MB) */
2325 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2329 /* FAT32 LBA partition (partition size >= 512MB) */
2330 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2343 CheckActiveBootPartition (PartitionList
);
2347 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2348 DiskEntry
->DiskSize
,
2349 DiskEntry
->CylinderSize
,
2350 DiskEntry
->TrackSize
);
2353 DiskEntry
= PartitionList
->CurrentDisk
;
2354 Entry
= DiskEntry
->PartListHead
.Flink
;
2355 while (Entry
!= &DiskEntry
->PartListHead
)
2357 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2359 if (PartEntry
->Unpartitioned
== FALSE
)
2362 for (i
= 0; i
< 4; i
++)
2364 PrintTextXY (6, Line
,
2365 "%2u: %2u %c %12I64u %12I64u %2u %c",
2367 PartEntry
->PartInfo
[i
].PartitionNumber
,
2368 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2369 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2370 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2371 PartEntry
->PartInfo
[i
].PartitionType
,
2372 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2380 Entry
= Entry
->Flink
;
2383 /* Restore the old entry */
2384 PartEntry
= PartitionList
->CurrentPartition
;
2387 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2389 DPRINT ("WritePartitionsToDisk() failed\n");
2391 PopupError ("Setup failed to write partition tables.\n",
2392 "ENTER = Reboot computer");
2398 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2405 /* Set DestinationRootPath */
2406 RtlFreeUnicodeString (&DestinationRootPath
);
2407 swprintf (PathBuffer
,
2408 L
"\\Device\\Harddisk%lu\\Partition%lu",
2409 PartitionList
->CurrentDisk
->DiskNumber
,
2410 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2411 RtlCreateUnicodeString (&DestinationRootPath
,
2413 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2416 /* Set SystemRootPath */
2417 RtlFreeUnicodeString (&SystemRootPath
);
2418 swprintf (PathBuffer
,
2419 L
"\\Device\\Harddisk%lu\\Partition%lu",
2420 PartitionList
->ActiveBootDisk
->DiskNumber
,
2421 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2422 RtlCreateUnicodeString (&SystemRootPath
,
2424 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2427 switch (FileSystemList
->CurrentFileSystem
)
2430 Status
= FormatPartition (&DestinationRootPath
);
2431 if (!NT_SUCCESS (Status
))
2433 DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status
);
2434 /* FIXME: show an error dialog */
2438 PartEntry
->New
= FALSE
;
2439 if (FileSystemList
!= NULL
)
2441 DestroyFileSystemList (FileSystemList
);
2442 FileSystemList
= NULL
;
2445 CheckActiveBootPartition (PartitionList
);
2447 /* FIXME: Install boot code. This is a hack! */
2448 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
) ||
2449 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2451 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2452 wcscat (PathBuffer
, L
"\\loader\\fat32.bin");
2454 DPRINT ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2455 DestinationRootPath
.Buffer
);
2456 Status
= InstallFat32BootCodeToDisk (PathBuffer
,
2457 DestinationRootPath
.Buffer
);
2458 if (!NT_SUCCESS (Status
))
2460 DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2461 /* FIXME: show an error dialog */
2467 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2468 wcscat (PathBuffer
, L
"\\loader\\fat.bin");
2470 DPRINT ("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2471 DestinationRootPath
.Buffer
);
2472 Status
= InstallFat16BootCodeToDisk (PathBuffer
,
2473 DestinationRootPath
.Buffer
);
2474 if (!NT_SUCCESS (Status
))
2476 DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2477 /* FIXME: show an error dialog */
2491 SetStatusText (" Done. Press any key ...");
2495 return INSTALL_DIRECTORY_PAGE
;
2499 return FORMAT_PARTITION_PAGE
;
2504 CheckFileSystemPage(PINPUT_RECORD Ir
)
2506 WCHAR PathBuffer
[MAX_PATH
];
2508 SetTextXY(6, 8, "Check file system");
2510 SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
2512 SetStatusText(" Please wait ...");
2515 SetStatusText(" ENTER = Continue F3 = Quit");
2518 /* Set DestinationRootPath */
2519 RtlFreeUnicodeString (&DestinationRootPath
);
2520 swprintf (PathBuffer
,
2521 L
"\\Device\\Harddisk%lu\\Partition%lu",
2522 PartitionList
->CurrentDisk
->DiskNumber
,
2523 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2524 RtlCreateUnicodeString (&DestinationRootPath
,
2526 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2528 /* Set SystemRootPath */
2529 RtlFreeUnicodeString (&SystemRootPath
);
2530 swprintf (PathBuffer
,
2531 L
"\\Device\\Harddisk%lu\\Partition%lu",
2532 PartitionList
->ActiveBootDisk
->DiskNumber
,
2533 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2534 RtlCreateUnicodeString (&SystemRootPath
,
2536 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2539 if (IsUnattendedSetup
)
2541 return(INSTALL_DIRECTORY_PAGE
);
2548 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2549 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2551 if (ConfirmQuit(Ir
) == TRUE
)
2555 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2557 return(INSTALL_DIRECTORY_PAGE
);
2561 return(CHECK_FILE_SYSTEM_PAGE
);
2566 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2568 WCHAR PathBuffer
[MAX_PATH
];
2570 /* Create 'InstallPath' string */
2571 RtlFreeUnicodeString(&InstallPath
);
2572 RtlCreateUnicodeString(&InstallPath
,
2575 /* Create 'DestinationPath' string */
2576 RtlFreeUnicodeString(&DestinationPath
);
2578 DestinationRootPath
.Buffer
);
2579 if (InstallDir
[0] != L
'\\')
2582 wcscat(PathBuffer
, InstallDir
);
2583 RtlCreateUnicodeString(&DestinationPath
,
2586 /* Create 'DestinationArcPath' */
2587 RtlFreeUnicodeString(&DestinationArcPath
);
2588 swprintf(PathBuffer
,
2589 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2590 DiskEntry
->DiskNumber
,
2591 PartEntry
->PartInfo
[0].PartitionNumber
);
2592 if (InstallDir
[0] != L
'\\')
2595 wcscat(PathBuffer
, InstallDir
);
2596 RtlCreateUnicodeString(&DestinationArcPath
,
2599 return(PREPARE_COPY_PAGE
);
2604 InstallDirectoryPage(PINPUT_RECORD Ir
)
2606 PDISKENTRY DiskEntry
;
2607 PPARTENTRY PartEntry
;
2608 WCHAR InstallDir
[51];
2613 if (PartitionList
== NULL
||
2614 PartitionList
->CurrentDisk
== NULL
||
2615 PartitionList
->CurrentPartition
== NULL
)
2617 /* FIXME: show an error dialog */
2621 DiskEntry
= PartitionList
->CurrentDisk
;
2622 PartEntry
= PartitionList
->CurrentPartition
;
2624 /* Search for 'DefaultPath' in the 'SetupData' section */
2625 if (!InfFindFirstLine (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2627 PopupError("Setup failed to find the 'SetupData' section\n"
2628 "in TXTSETUP.SIF.\n",
2629 "ENTER = Reboot computer");
2635 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2642 /* Read the 'DefaultPath' data */
2643 if (InfGetData (&Context
, NULL
, &DefaultPath
))
2645 wcscpy(InstallDir
, DefaultPath
);
2649 wcscpy(InstallDir
, L
"\\ReactOS");
2651 Length
= wcslen(InstallDir
);
2653 SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
2654 SetTextXY(6, 9, "directory where you want ReactOS to be installed:");
2656 SetInputTextXY(8, 11, 51, InstallDir
);
2658 SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete");
2659 SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to");
2660 SetTextXY(6, 16, "be installed.");
2662 SetStatusText(" ENTER = Continue F3 = Quit");
2664 if (IsUnattendedSetup
)
2666 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2673 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2674 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2676 if (ConfirmQuit(Ir
) == TRUE
)
2680 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2682 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2684 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2689 InstallDir
[Length
] = 0;
2690 SetInputTextXY(8, 11, 51, InstallDir
);
2693 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2697 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2699 InstallDir
[Length
] = 0;
2700 SetInputTextXY(8, 11, 51, InstallDir
);
2705 return(INSTALL_DIRECTORY_PAGE
);
2710 PrepareCopyPageInfFile(HINF InfFile
,
2711 PWCHAR SourceCabinet
,
2714 WCHAR PathBuffer
[MAX_PATH
];
2715 INFCONTEXT FilesContext
;
2716 INFCONTEXT DirContext
;
2721 PWCHAR FileKeyValue
;
2723 PWCHAR TargetFileName
;
2725 /* Search for the 'SourceFiles' section */
2726 if (!InfFindFirstLine (InfFile
, L
"SourceFiles", NULL
, &FilesContext
))
2728 PopupError("Setup failed to find the 'SourceFiles' section\n"
2729 "in TXTSETUP.SIF.\n", // FIXME
2730 "ENTER = Reboot computer");
2736 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2744 * Enumerate the files in the 'SourceFiles' section
2745 * and add them to the file queue.
2749 /* Get source file name and target directory id */
2750 if (!InfGetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2752 /* FIXME: Handle error! */
2753 DPRINT1("InfGetData() failed\n");
2757 /* Get optional target file name */
2758 if (!InfGetDataField (&FilesContext
, 2, &TargetFileName
))
2759 TargetFileName
= NULL
;
2761 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2763 /* Lookup target directory */
2764 if (!InfFindFirstLine (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2766 /* FIXME: Handle error! */
2767 DPRINT1("InfFindFirstLine() failed\n");
2771 if (!InfGetData (&DirContext
, NULL
, &DirKeyValue
))
2773 /* FIXME: Handle error! */
2774 DPRINT1("InfGetData() failed\n");
2778 if (!SetupQueueCopy(SetupFileQueue
,
2780 SourceRootPath
.Buffer
,
2786 /* FIXME: Handle error! */
2787 DPRINT1("SetupQueueCopy() failed\n");
2790 while (InfFindNextLine(&FilesContext
, &FilesContext
));
2793 /* Create directories */
2797 * Install directories like '\reactos\test' are not handled yet.
2800 /* Get destination path */
2801 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2803 /* Remove trailing backslash */
2804 Length
= wcslen(PathBuffer
);
2805 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2807 PathBuffer
[Length
- 1] = 0;
2810 /* Create the install directory */
2811 Status
= CreateDirectory(PathBuffer
);
2812 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2814 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2815 PopupError("Setup could not create the install directory.",
2816 "ENTER = Reboot computer");
2822 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2830 /* Search for the 'Directories' section */
2831 if (!InfFindFirstLine(InfFile
, L
"Directories", NULL
, &DirContext
))
2835 PopupError("Setup failed to find the 'Directories' section\n"
2836 "in the cabinet.\n", "ENTER = Reboot computer");
2840 PopupError("Setup failed to find the 'Directories' section\n"
2841 "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
2848 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2855 /* Enumerate the directory values and create the subdirectories */
2858 if (!InfGetData (&DirContext
, NULL
, &KeyValue
))
2864 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2866 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2868 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2869 wcscat(PathBuffer
, KeyValue
);
2871 DPRINT("FullPath: '%S'\n", PathBuffer
);
2873 else if (KeyValue
[0] != L
'\\')
2875 DPRINT("RelativePath: '%S'\n", KeyValue
);
2876 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2877 wcscat(PathBuffer
, L
"\\");
2878 wcscat(PathBuffer
, KeyValue
);
2880 DPRINT("FullPath: '%S'\n", PathBuffer
);
2882 Status
= CreateDirectory(PathBuffer
);
2883 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2885 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2886 PopupError("Setup could not create install directories.",
2887 "ENTER = Reboot computer");
2893 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2901 while (InfFindNextLine (&DirContext
, &DirContext
));
2908 PrepareCopyPage(PINPUT_RECORD Ir
)
2911 WCHAR PathBuffer
[MAX_PATH
];
2912 INFCONTEXT CabinetsContext
;
2919 SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
2921 SetStatusText(" Building the file copy list...");
2923 /* Create the file queue */
2924 SetupFileQueue
= SetupOpenFileQueue();
2925 if (SetupFileQueue
== NULL
)
2927 PopupError("Setup failed to open the copy file queue.\n",
2928 "ENTER = Reboot computer");
2934 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2941 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
2946 /* Search for the 'Cabinets' section */
2947 if (!InfFindFirstLine (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
2949 return FILE_COPY_PAGE
;
2953 * Enumerate the directory values in the 'Cabinets'
2954 * section and parse their inf files.
2958 if (!InfGetData (&CabinetsContext
, NULL
, &KeyValue
))
2961 wcscpy(PathBuffer
, SourcePath
.Buffer
);
2962 wcscat(PathBuffer
, L
"\\");
2963 wcscat(PathBuffer
, KeyValue
);
2965 CabinetInitialize();
2966 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
2967 CabinetSetCabinetName(PathBuffer
);
2969 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
2971 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
2973 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
2974 if (InfFileData
== NULL
)
2976 PopupError("Cabinet has no setup script.\n",
2977 "ENTER = Reboot computer");
2983 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2992 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
2994 PopupError("Cabinet not found.\n",
2995 "ENTER = Reboot computer");
3001 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3008 Status
= InfOpenBufferedFile(&InfHandle
,
3012 if (!NT_SUCCESS(Status
))
3014 PopupError("Cabinet has no valid inf file.\n",
3015 "ENTER = Reboot computer");
3021 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3030 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3035 while (InfFindNextLine (&CabinetsContext
, &CabinetsContext
));
3037 return FILE_COPY_PAGE
;
3042 FileCopyCallback(PVOID Context
,
3047 PCOPYCONTEXT CopyContext
;
3049 CopyContext
= (PCOPYCONTEXT
)Context
;
3051 switch (Notification
)
3053 case SPFILENOTIFY_STARTSUBQUEUE
:
3054 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3055 ProgressSetStepCount(CopyContext
->ProgressBar
,
3056 CopyContext
->TotalOperations
);
3059 case SPFILENOTIFY_STARTCOPY
:
3060 /* Display copy message */
3061 PrintTextXYN(6, 16, 60, "Copying file: %S", (PWSTR
)Param1
);
3063 PrintTextXYN(6, 18, 60, "File %lu of %lu",
3064 CopyContext
->CompletedOperations
+ 1,
3065 CopyContext
->TotalOperations
);
3068 case SPFILENOTIFY_ENDCOPY
:
3069 CopyContext
->CompletedOperations
++;
3070 ProgressNextStep(CopyContext
->ProgressBar
);
3079 FileCopyPage(PINPUT_RECORD Ir
)
3081 COPYCONTEXT CopyContext
;
3085 SetStatusText(" Please wait...");
3087 SetTextXY(6, 8, "Copying files");
3089 GetScreenSize(&xScreen
, &yScreen
);
3091 CopyContext
.TotalOperations
= 0;
3092 CopyContext
.CompletedOperations
= 0;
3093 CopyContext
.ProgressBar
= CreateProgressBar(6,
3098 SetupCommitFileQueue(SetupFileQueue
,
3099 DestinationRootPath
.Buffer
,
3101 (PSP_FILE_CALLBACK
)FileCopyCallback
,
3104 SetupCloseFileQueue(SetupFileQueue
);
3106 DestroyProgressBar(CopyContext
.ProgressBar
);
3108 return REGISTRY_PAGE
;
3113 RegistryPage(PINPUT_RECORD Ir
)
3115 INFCONTEXT InfContext
;
3122 SetTextXY(6, 8, "Setup is updating the system configuration");
3124 SetStatusText(" Creating registry hives...");
3126 if (!SetInstallPathValue(&DestinationPath
))
3128 DPRINT("SetInstallPathValue() failed\n");
3129 PopupError("Setup failed to set the initialize the registry.",
3130 "ENTER = Reboot computer");
3136 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3143 /* Create the default hives */
3144 Status
= NtInitializeRegistry(TRUE
);
3145 if (!NT_SUCCESS(Status
))
3147 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3148 PopupError("Setup failed to create the registry hives.",
3149 "ENTER = Reboot computer");
3155 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3162 /* Update registry */
3163 SetStatusText(" Updating registry hives...");
3165 if (!InfFindFirstLine(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3167 DPRINT1("InfFindFirstLine() failed\n");
3168 PopupError("Setup failed to find the registry data files.",
3169 "ENTER = Reboot computer");
3175 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3184 InfGetDataField (&InfContext
, 0, &Action
);
3185 InfGetDataField (&InfContext
, 1, &File
);
3186 InfGetDataField (&InfContext
, 2, &Section
);
3188 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3190 if (!_wcsicmp (Action
, L
"AddReg"))
3194 else if (!_wcsicmp (Action
, L
"DelReg"))
3203 SetStatusText(" Importing %S...", File
);
3205 if (!ImportRegistryFile(File
, Section
, Delete
))
3207 DPRINT("Importing %S failed\n", File
);
3209 PopupError("Setup failed to import a hive file.",
3210 "ENTER = Reboot computer");
3216 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3223 while (InfFindNextLine (&InfContext
, &InfContext
));
3225 /* Update display registry settings */
3226 SetStatusText(" Updating display registry settings...");
3227 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3229 PopupError("Setup failed to update display registry settings.",
3230 "ENTER = Reboot computer");
3236 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3243 /* Update keyboard layout settings */
3244 SetStatusText(" Updating keyboard layout settings...");
3245 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3247 PopupError("Setup failed to update keyboard layout settings.",
3248 "ENTER = Reboot computer");
3254 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3261 /* Update mouse registry settings */
3262 SetStatusText(" Updating mouse registry settings...");
3263 if (!ProcessMouseRegistry(SetupInf
, PointerList
))
3265 PopupError("Setup failed to update mouse registry settings.",
3266 "ENTER = Reboot computer");
3272 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3279 SetStatusText(" Done...");
3281 return BOOT_LOADER_PAGE
;
3286 BootLoaderPage(PINPUT_RECORD Ir
)
3288 UCHAR PartitionType
;
3289 BOOLEAN InstallOnFloppy
;
3292 SetStatusText(" Please wait...");
3294 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3296 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3298 DPRINT("Error: active partition invalid (unused)\n");
3299 InstallOnFloppy
= TRUE
;
3301 else if (PartitionType
== 0x0A)
3303 /* OS/2 boot manager partition */
3304 DPRINT("Found OS/2 boot manager partition\n");
3305 InstallOnFloppy
= TRUE
;
3307 else if (PartitionType
== 0x83)
3309 /* Linux ext2 partition */
3310 DPRINT("Found Linux ext2 partition\n");
3311 InstallOnFloppy
= TRUE
;
3313 else if (PartitionType
== PARTITION_IFS
)
3315 /* NTFS partition */
3316 DPRINT("Found NTFS partition\n");
3317 InstallOnFloppy
= TRUE
;
3319 else if ((PartitionType
== PARTITION_FAT_12
) ||
3320 (PartitionType
== PARTITION_FAT_16
) ||
3321 (PartitionType
== PARTITION_HUGE
) ||
3322 (PartitionType
== PARTITION_XINT13
) ||
3323 (PartitionType
== PARTITION_FAT32
) ||
3324 (PartitionType
== PARTITION_FAT32_XINT13
))
3326 DPRINT("Found FAT partition\n");
3327 InstallOnFloppy
= FALSE
;
3331 /* Unknown partition */
3332 DPRINT("Unknown partition found\n");
3333 InstallOnFloppy
= TRUE
;
3336 if (InstallOnFloppy
== TRUE
)
3338 return BOOT_LOADER_FLOPPY_PAGE
;
3341 SetTextXY(6, 8, "Setup is installing the boot loader");
3343 SetTextXY(8, 12, "Install bootloader on the harddisk (MBR).");
3344 SetTextXY(8, 13, "Install bootloader on a floppy disk.");
3345 InvertTextXY (8, Line
, 48, 1);
3347 SetStatusText(" ENTER = Continue F3 = Quit");
3353 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3354 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3356 NormalTextXY (8, Line
, 48, 1);
3359 else if (Line
== 13)
3365 InvertTextXY (8, Line
, 48, 1);
3367 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3368 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3370 NormalTextXY (8, Line
, 48, 1);
3373 else if (Line
== 13)
3379 InvertTextXY (8, Line
, 48, 1);
3381 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3382 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3384 if (ConfirmQuit(Ir
) == TRUE
)
3388 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3392 return BOOT_LOADER_HARDDISK_PAGE
;
3394 else if (Line
== 13)
3396 return BOOT_LOADER_FLOPPY_PAGE
;
3399 return BOOT_LOADER_PAGE
;
3404 return BOOT_LOADER_PAGE
;
3409 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3413 SetTextXY(6, 8, "Setup cannot install the bootloader on your computers");
3414 SetTextXY(6, 9, "harddisk");
3416 SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and");
3417 SetTextXY(6, 14, "press ENTER.");
3420 SetStatusText(" ENTER = Continue F3 = Quit");
3421 // SetStatusText(" Please wait...");
3427 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3428 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3430 if (ConfirmQuit(Ir
) == TRUE
)
3434 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3436 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3438 PopupError("No disk in drive A:.",
3439 "ENTER = Continue");
3444 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3448 return BOOT_LOADER_FLOPPY_PAGE
;
3451 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3452 &DestinationArcPath
);
3453 if (!NT_SUCCESS(Status
))
3455 /* Print error message */
3456 return BOOT_LOADER_FLOPPY_PAGE
;
3459 return SUCCESS_PAGE
;
3463 return BOOT_LOADER_FLOPPY_PAGE
;
3468 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3470 UCHAR PartitionType
;
3473 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3474 if ((PartitionType
== PARTITION_FAT_12
) ||
3475 (PartitionType
== PARTITION_FAT_16
) ||
3476 (PartitionType
== PARTITION_HUGE
) ||
3477 (PartitionType
== PARTITION_XINT13
) ||
3478 (PartitionType
== PARTITION_FAT32
) ||
3479 (PartitionType
== PARTITION_FAT32_XINT13
))
3481 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3483 &DestinationArcPath
,
3485 if (!NT_SUCCESS(Status
))
3487 PopupError("Setup failed to install the FAT bootcode on the system partition.",
3488 "ENTER = Reboot computer");
3494 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3501 return SUCCESS_PAGE
;
3505 PopupError("failed to install FAT bootcode on the system partition.",
3506 "ENTER = Reboot computer");
3512 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3519 return BOOT_LOADER_HARDDISK_PAGE
;
3524 QuitPage(PINPUT_RECORD Ir
)
3526 SetTextXY(10, 6, "ReactOS is not completely installed");
3528 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3529 SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
3531 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3533 SetStatusText(" Please wait ...");
3535 /* Destroy partition list */
3536 if (PartitionList
!= NULL
)
3538 DestroyPartitionList (PartitionList
);
3539 PartitionList
= NULL
;
3542 /* Destroy filesystem list */
3543 if (FileSystemList
!= NULL
)
3545 DestroyFileSystemList (FileSystemList
);
3546 FileSystemList
= NULL
;
3549 /* Destroy computer settings list */
3550 if (ComputerList
!= NULL
)
3552 DestroyGenericList(ComputerList
, TRUE
);
3553 ComputerList
= NULL
;
3556 /* Destroy display settings list */
3557 if (DisplayList
!= NULL
)
3559 DestroyGenericList(DisplayList
, TRUE
);
3563 /* Destroy keyboard settings list */
3564 if (KeyboardList
!= NULL
)
3566 DestroyGenericList(KeyboardList
, TRUE
);
3567 KeyboardList
= NULL
;
3570 /* Destroy keyboard layout list */
3571 if (LayoutList
!= NULL
)
3573 DestroyGenericList(LayoutList
, TRUE
);
3577 /* Destroy pointer device list */
3578 if (PointerList
!= NULL
)
3580 DestroyGenericList(PointerList
, TRUE
);
3584 SetStatusText(" ENTER = Reboot computer");
3590 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3599 SuccessPage(PINPUT_RECORD Ir
)
3601 SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully.");
3603 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3604 SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
3606 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3608 SetStatusText(" ENTER = Reboot computer");
3610 if (IsUnattendedSetup
)
3619 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3628 FlushPage(PINPUT_RECORD Ir
)
3630 SetTextXY(10, 6, "The system is now making sure all data is stored on your disk");
3632 SetTextXY(10, 8, "This may take a minute");
3633 SetTextXY(10, 9, "When finished, your computer will reboot automatically");
3635 SetStatusText(" Flushing cache");
3642 NtProcessStartup(PPEB Peb
)
3648 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3650 ProcessHeap
= Peb
->ProcessHeap
;
3652 Status
= AllocConsole();
3653 if (!NT_SUCCESS(Status
))
3655 PrintString("AllocConsole() failed (Status = 0x%08lx)\n", Status
);
3657 /* Raise a hard error (crash the system/BSOD) */
3658 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3663 /* Initialize global unicode strings */
3664 RtlInitUnicodeString(&SourcePath
, NULL
);
3665 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3666 RtlInitUnicodeString(&InstallPath
, NULL
);
3667 RtlInitUnicodeString(&DestinationPath
, NULL
);
3668 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3669 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3670 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3672 /* Hide the cursor */
3673 SetCursorType(TRUE
, FALSE
);
3676 while (Page
!= REBOOT_PAGE
)
3680 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3686 Page
= StartPage(&Ir
);
3691 Page
= IntroPage(&Ir
);
3695 case INSTALL_INTRO_PAGE
:
3696 Page
= InstallIntroPage(&Ir
);
3700 case SCSI_CONTROLLER_PAGE
:
3701 Page
= ScsiControllerPage(&Ir
);
3706 case OEM_DRIVER_PAGE
:
3707 Page
= OemDriverPage(&Ir
);
3711 case DEVICE_SETTINGS_PAGE
:
3712 Page
= DeviceSettingsPage(&Ir
);
3715 case COMPUTER_SETTINGS_PAGE
:
3716 Page
= ComputerSettingsPage(&Ir
);
3719 case DISPLAY_SETTINGS_PAGE
:
3720 Page
= DisplaySettingsPage(&Ir
);
3723 case KEYBOARD_SETTINGS_PAGE
:
3724 Page
= KeyboardSettingsPage(&Ir
);
3727 case LAYOUT_SETTINGS_PAGE
:
3728 Page
= LayoutSettingsPage(&Ir
);
3731 case POINTER_SETTINGS_PAGE
:
3732 Page
= PointerSettingsPage(&Ir
);
3735 case SELECT_PARTITION_PAGE
:
3736 Page
= SelectPartitionPage(&Ir
);
3739 case CREATE_PARTITION_PAGE
:
3740 Page
= CreatePartitionPage(&Ir
);
3743 case DELETE_PARTITION_PAGE
:
3744 Page
= DeletePartitionPage(&Ir
);
3747 case SELECT_FILE_SYSTEM_PAGE
:
3748 Page
= SelectFileSystemPage(&Ir
);
3751 case FORMAT_PARTITION_PAGE
:
3752 Page
= FormatPartitionPage(&Ir
);
3755 case CHECK_FILE_SYSTEM_PAGE
:
3756 Page
= CheckFileSystemPage(&Ir
);
3759 case INSTALL_DIRECTORY_PAGE
:
3760 Page
= InstallDirectoryPage(&Ir
);
3763 case PREPARE_COPY_PAGE
:
3764 Page
= PrepareCopyPage(&Ir
);
3767 case FILE_COPY_PAGE
:
3768 Page
= FileCopyPage(&Ir
);
3772 Page
= RegistryPage(&Ir
);
3775 case BOOT_LOADER_PAGE
:
3776 Page
= BootLoaderPage(&Ir
);
3779 case BOOT_LOADER_FLOPPY_PAGE
:
3780 Page
= BootLoaderFloppyPage(&Ir
);
3783 case BOOT_LOADER_HARDDISK_PAGE
:
3784 Page
= BootLoaderHarddiskPage(&Ir
);
3789 case REPAIR_INTRO_PAGE
:
3790 Page
= RepairIntroPage(&Ir
);
3794 /* Emergency pages */
3795 case EMERGENCY_INTRO_PAGE
:
3796 Page
= EmergencyIntroPage(&Ir
);
3801 Page
= SuccessPage(&Ir
);
3805 Page
= FlushPage(&Ir
);
3809 Page
= QuitPage(&Ir
);
3819 NtShutdownSystem(ShutdownReboot
);