3 * Copyright (C) 2002, 2003, 2004 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/usetup.c
23 * PURPOSE: Text-mode setup
24 * PROGRAMMER: Eric Kohl
25 * Casper S. Hornstrup (chorns@users.sourceforge.net)
33 typedef enum _PAGE_NUMBER
41 // SCSI_CONTROLLER_PAGE,
44 COMPUTER_SETTINGS_PAGE
,
45 DISPLAY_SETTINGS_PAGE
,
46 KEYBOARD_SETTINGS_PAGE
,
49 SELECT_PARTITION_PAGE
,
50 CREATE_PARTITION_PAGE
,
51 DELETE_PARTITION_PAGE
,
53 SELECT_FILE_SYSTEM_PAGE
,
54 FORMAT_PARTITION_PAGE
,
55 CHECK_FILE_SYSTEM_PAGE
,
58 INSTALL_DIRECTORY_PAGE
,
62 BOOT_LOADER_FLOPPY_PAGE
,
63 BOOT_LOADER_HARDDISK_PAGE
,
70 REBOOT_PAGE
, /* virtual page */
71 } PAGE_NUMBER
, *PPAGE_NUMBER
;
73 typedef struct _COPYCONTEXT
75 ULONG TotalOperations
;
76 ULONG CompletedOperations
;
77 PPROGRESSBAR ProgressBar
;
78 } COPYCONTEXT
, *PCOPYCONTEXT
;
81 /* GLOBALS ******************************************************************/
84 UNICODE_STRING SourceRootPath
;
85 BOOLEAN IsUnattendedSetup
;
86 LONG UnattendDestinationDiskNumber
;
87 LONG UnattendDestinationPartitionNumber
;
88 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
90 /* LOCALS *******************************************************************/
92 static PPARTLIST PartitionList
= NULL
;
94 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
97 static UNICODE_STRING SourcePath
;
99 static UNICODE_STRING InstallPath
;
101 /* Path to the install directory */
102 static UNICODE_STRING DestinationPath
;
103 static UNICODE_STRING DestinationArcPath
;
104 static UNICODE_STRING DestinationRootPath
;
106 /* Path to the active partition (boot manager) */
107 static UNICODE_STRING SystemRootPath
;
109 static HINF SetupInf
;
111 static HSPFILEQ SetupFileQueue
= NULL
;
113 static BOOLEAN WarnLinuxPartitions
= TRUE
;
115 static PGENERIC_LIST ComputerList
= NULL
;
116 static PGENERIC_LIST DisplayList
= NULL
;
117 static PGENERIC_LIST KeyboardList
= NULL
;
118 static PGENERIC_LIST LayoutList
= NULL
;
121 /* FUNCTIONS ****************************************************************/
124 PrintString(char* fmt
,...)
128 UNICODE_STRING UnicodeString
;
129 ANSI_STRING AnsiString
;
132 vsprintf(buffer
, fmt
, ap
);
135 RtlInitAnsiString(&AnsiString
, buffer
);
136 RtlAnsiStringToUnicodeString(&UnicodeString
,
139 NtDisplayString(&UnicodeString
);
140 RtlFreeUnicodeString(&UnicodeString
);
145 PopupError(PCHAR Text
,
163 /* Count text lines and longest line */
169 p
= strchr(pnext
, '\n');
172 Length
= strlen(pnext
);
177 Length
= (ULONG
)(p
- pnext
);
182 if (Length
> MaxLength
)
185 if (LastLine
== TRUE
)
191 /* Check length of status line */
194 Length
= strlen(Status
);
195 if (Length
> MaxLength
)
199 GetScreenSize(&xScreen
, &yScreen
);
201 Width
= MaxLength
+ 4;
206 yTop
= (yScreen
- Height
) / 2;
207 xLeft
= (xScreen
- Width
) / 2;
210 /* Set screen attributes */
212 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
214 FillConsoleOutputAttribute(0x74,
220 /* draw upper left corner */
223 FillConsoleOutputCharacter(0xDA, // '+',
228 /* draw upper edge */
231 FillConsoleOutputCharacter(0xC4, // '-',
236 /* draw upper right corner */
237 coPos
.X
= xLeft
+ Width
- 1;
239 FillConsoleOutputCharacter(0xBF, // '+',
244 /* Draw right edge, inner space and left edge */
245 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
248 FillConsoleOutputCharacter(0xB3, // '|',
254 FillConsoleOutputCharacter(' ',
259 coPos
.X
= xLeft
+ Width
- 1;
260 FillConsoleOutputCharacter(0xB3, // '|',
266 /* draw lower left corner */
268 coPos
.Y
= yTop
+ Height
- 1;
269 FillConsoleOutputCharacter(0xC0, // '+',
274 /* draw lower edge */
276 coPos
.Y
= yTop
+ Height
- 1;
277 FillConsoleOutputCharacter(0xC4, // '-',
282 /* draw lower right corner */
283 coPos
.X
= xLeft
+ Width
- 1;
284 coPos
.Y
= yTop
+ Height
- 1;
285 FillConsoleOutputCharacter(0xD9, // '+',
290 /* Print message text */
295 p
= strchr(pnext
, '\n');
298 Length
= strlen(pnext
);
303 Length
= (ULONG
)(p
- pnext
);
310 WriteConsoleOutputCharacters(pnext
,
315 if (LastLine
== TRUE
)
322 /* Print separator line and status text */
325 coPos
.Y
= yTop
+ Height
- 3;
327 FillConsoleOutputCharacter(0xC3, // '+',
333 FillConsoleOutputCharacter(0xC4, // '-',
338 coPos
.X
= xLeft
+ Width
- 1;
339 FillConsoleOutputCharacter(0xB4, // '+',
346 WriteConsoleOutputCharacters(Status
,
347 min(strlen(Status
), (SIZE_T
)Width
- 4),
357 * FALSE: Don't quit setup.
360 ConfirmQuit(PINPUT_RECORD Ir
)
364 PopupError("ReactOS is not completely installed on your\n"
365 "computer. If you quit Setup now, you will need to\n"
366 "run Setup again to install ReactOS.\n"
368 " \x07 Press ENTER to continue Setup.\n"
369 " \x07 Press F3 to quit Setup.",
370 "F3= Quit ENTER = Continue");
376 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
377 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
382 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
394 CheckUnattendedSetup(VOID
)
396 WCHAR UnattendInfPath
[MAX_PATH
];
397 UNICODE_STRING FileName
;
405 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
407 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
408 IsUnattendedSetup
= FALSE
;
412 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
413 wcscat(UnattendInfPath
, L
"\\unattend.inf");
415 RtlInitUnicodeString(&FileName
,
418 /* Load 'unattend.inf' from install media. */
419 Status
= InfOpenFile(&UnattendInf
,
422 if (!NT_SUCCESS(Status
))
424 DPRINT("InfOpenFile() failed with status 0x%x\n", Status
);
428 /* Open 'Unattend' section */
429 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
431 DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
432 InfCloseFile(UnattendInf
);
436 /* Get pointer 'Signature' key */
437 if (!InfGetData(&Context
, NULL
, &Value
))
439 DPRINT("InfGetData() failed for key 'Signature'\n");
440 InfCloseFile(UnattendInf
);
444 /* Check 'Signature' string */
445 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
447 DPRINT("Signature not $ReactOS$\n");
448 InfCloseFile(UnattendInf
);
452 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
453 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
455 DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
456 InfCloseFile(UnattendInf
);
459 if (!InfGetIntField(&Context
, 0, &IntValue
))
461 DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
462 InfCloseFile(UnattendInf
);
465 UnattendDestinationDiskNumber
= IntValue
;
467 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
468 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
470 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
471 InfCloseFile(UnattendInf
);
474 if (!InfGetIntField(&Context
, 0, &IntValue
))
476 DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
477 InfCloseFile(UnattendInf
);
480 UnattendDestinationPartitionNumber
= IntValue
;
482 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
483 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
485 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
486 InfCloseFile(UnattendInf
);
490 /* Get pointer 'InstallationDirectory' key */
491 if (!InfGetData(&Context
, NULL
, &Value
))
493 DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
494 InfCloseFile(UnattendInf
);
497 wcscpy(UnattendInstallationDirectory
, Value
);
499 InfCloseFile(UnattendInf
);
501 IsUnattendedSetup
= TRUE
;
503 DPRINT("Running unattended setup\n");
510 * Number of the next page.
513 SetupStartPage(PINPUT_RECORD Ir
)
515 SYSTEM_DEVICE_INFORMATION Sdi
;
517 WCHAR FileNameBuffer
[MAX_PATH
];
518 UNICODE_STRING FileName
;
524 SetStatusText(" Please wait...");
527 /* Check whether a harddisk is available */
528 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
530 sizeof(SYSTEM_DEVICE_INFORMATION
),
532 if (!NT_SUCCESS (Status
))
534 PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
535 PopupError("Setup could not retrieve system drive information.\n",
536 "ENTER = Reboot computer");
541 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
548 if (Sdi
.NumberOfDisks
== 0)
550 PopupError("Setup could not find a harddisk.\n",
551 "ENTER = Reboot computer");
556 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
563 /* Get the source path and source root path */
564 Status
= GetSourcePaths(&SourcePath
,
566 if (!NT_SUCCESS(Status
))
568 PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status
);
569 PopupError("Setup could not find its source drive.\n",
570 "ENTER = Reboot computer");
575 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
584 PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
585 PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
589 /* Load txtsetup.sif from install media. */
590 wcscpy(FileNameBuffer
, SourceRootPath
.Buffer
);
591 wcscat(FileNameBuffer
, L
"\\reactos\\txtsetup.sif");
592 RtlInitUnicodeString(&FileName
,
595 Status
= InfOpenFile(&SetupInf
,
598 if (!NT_SUCCESS(Status
))
600 PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
601 "ENTER = Reboot computer");
607 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
614 /* Open 'Version' section */
615 if (!InfFindFirstLine (SetupInf
, L
"Version", L
"Signature", &Context
))
617 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
618 "ENTER = Reboot computer");
624 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
632 /* Get pointer 'Signature' key */
633 if (!InfGetData (&Context
, NULL
, &Value
))
635 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
636 "ENTER = Reboot computer");
642 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
649 /* Check 'Signature' string */
650 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
652 PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
653 "ENTER = Reboot computer");
659 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
666 CheckUnattendedSetup();
678 IntroPage(PINPUT_RECORD Ir
)
680 SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup");
682 SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your");
683 SetTextXY(6, 12, "computer and prepares the second part of the setup.");
685 SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS.");
686 SetTextXY(8, 17, "\x07 Press R to repair ReactOS.");
687 SetTextXY(8, 19, "\x07 Press L to view the ReactOS Licensing Terms and Conditions");
688 SetTextXY(8, 21, "\x07 Press F3 to quit without installing ReactOS.");
690 SetStatusText(" ENTER = Continue R = Repair F3 = Quit");
692 if (IsUnattendedSetup
)
694 return INSTALL_INTRO_PAGE
;
701 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
702 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
704 if (ConfirmQuit(Ir
) == TRUE
)
708 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
713 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
715 return REPAIR_INTRO_PAGE
;
718 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* R */
731 * Back to main setup page.
734 LicensePage(PINPUT_RECORD Ir
)
736 SetHighlightedTextXY(6, 8, "Licensing:");
738 SetTextXY(8, 11, "The ReactOS System is licensed under the terms of the");
739 SetTextXY(8, 12, "GNU GPL with parts containing code from other compatible");
740 SetTextXY(8, 13, "licenses such as the X11 or BSD and GNU LGPL licenses.");
741 SetTextXY(8, 14, "All software that is part of the ReactOS system is");
742 SetTextXY(8, 15, "therefore released under the GNU GPL as well as maintaining");
743 SetTextXY(8, 16, "the original license.");
745 SetTextXY(8, 18, "This software comes with NO WARRANTY or restrictions on usage");
746 SetTextXY(8, 19, "save applicable local and international law. The licensing of");
747 SetTextXY(8, 20, "ReactOS only covers distribution to third parties.");
749 SetTextXY(8, 22, "If for some reason you did not receive a copy of the");
750 SetTextXY(8, 23, "GNU General Public License with ReactOS please visit");
751 SetHighlightedTextXY(8, 25, "http://www.gnu.org/licenses/licenses.html");
753 SetStatusText(" ENTER = Return");
759 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
775 WarningPage(PINPUT_RECORD Ir
)
777 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Warranty Statement");
778 SetHighlightedTextXY(6, 8, "Warranty:");
780 SetTextXY(8, 11, "This is free software; see the source for copying conditions.");
781 SetTextXY(8, 12, "There is NO warranty; not even for MERCHANTABILITY or");
782 SetTextXY(8, 13, "FITNESS FOR A PARTICULAR PURPOSE");
784 SetTextXY(8, 15, "For more information on ReactOS, please visit:");
785 SetHighlightedTextXY(8, 16, "http://www.reactos.org");
787 SetStatusText(" F8 = Continue ESC = Exit");
793 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
794 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F8
)) /* F8 */
796 return INSTALL_INTRO_PAGE
;
799 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
800 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
810 RepairIntroPage(PINPUT_RECORD Ir
)
812 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
813 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
815 SetTextXY(6, 12, "The repair functions are not implemented yet.");
817 SetTextXY(8, 15, "\x07 Press R for the Recovery Console.");
819 SetTextXY(8, 17, "\x07 Press ESC to return to the main page.");
821 SetTextXY(8, 19, "\x07 Press ENTER to reboot your computer.");
823 SetStatusText(" ESC = Main page ENTER = Reboot");
829 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
833 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
837 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
838 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
844 return REPAIR_INTRO_PAGE
;
849 InstallIntroPage(PINPUT_RECORD Ir
)
851 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
853 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
854 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
856 SetTextXY(6, 12, "The following limitations apply:");
857 SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
858 SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
859 SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
860 SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
861 SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
862 SetTextXY(8, 18, "- Setup supports FAT file systems only.");
863 SetTextXY(8, 19, "- File system checks are not implemented yet.");
866 SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
868 SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
871 SetStatusText(" ENTER = Continue F3 = Quit");
873 if (IsUnattendedSetup
)
875 return SELECT_PARTITION_PAGE
;
882 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
883 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
885 if (ConfirmQuit(Ir
) == TRUE
)
889 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
891 return DEVICE_SETTINGS_PAGE
;
892 // return SCSI_CONTROLLER_PAGE;
896 return INSTALL_INTRO_PAGE
;
902 ScsiControllerPage(PINPUT_RECORD Ir
)
904 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
906 /* FIXME: print loaded mass storage driver descriptions */
908 SetTextXY(8, 10, "TEST device");
912 SetStatusText(" ENTER = Continue F3 = Quit");
918 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
919 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
921 if (ConfirmQuit(Ir
) == TRUE
)
925 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
927 return DEVICE_SETTINGS_PAGE
;
931 return SCSI_CONTROLLER_PAGE
;
937 DeviceSettingsPage(PINPUT_RECORD Ir
)
939 static ULONG Line
= 16;
941 /* Initialize the computer settings list */
942 if (ComputerList
== NULL
)
944 ComputerList
= CreateComputerTypeList(SetupInf
);
945 if (ComputerList
== NULL
)
947 /* FIXME: report error */
951 /* Initialize the display settings list */
952 if (DisplayList
== NULL
)
954 DisplayList
= CreateDisplayDriverList(SetupInf
);
955 if (DisplayList
== NULL
)
957 /* FIXME: report error */
961 /* Initialize the keyboard settings list */
962 if (KeyboardList
== NULL
)
964 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
965 if (KeyboardList
== NULL
)
967 /* FIXME: report error */
971 /* Initialize the keyboard layout list */
972 if (LayoutList
== NULL
)
974 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
975 if (LayoutList
== NULL
)
977 /* FIXME: report error */
978 PopupError("Setup failed to load the keyboard layout list.\n",
979 "ENTER = Reboot computer");
985 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
993 SetTextXY(6, 8, "The list below shows the current device settings.");
995 SetTextXY(8, 11, " Computer:");
996 SetTextXY(8, 12, " Display:");
997 SetTextXY(8, 13, " Keyboard:");
998 SetTextXY(8, 14, "Keyboard layout:");
1000 SetTextXY(8, 16, " Accept:");
1002 SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
1003 SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
1004 SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
1005 SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
1007 SetTextXY(25, 16, "Accept these device settings");
1008 InvertTextXY (24, Line
, 48, 1);
1011 SetTextXY(6, 19, "You can change the hardware settings by pressing the UP or DOWN keys");
1012 SetTextXY(6, 20, "to select an entry. Then press the ENTER key to select alternative");
1013 SetTextXY(6, 21, "settings.");
1015 SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\"");
1016 SetTextXY(6, 24, "and press ENTER.");
1018 SetStatusText(" ENTER = Continue F3 = Quit");
1024 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1025 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1027 NormalTextXY (24, Line
, 48, 1);
1030 else if (Line
== 16)
1034 InvertTextXY (24, Line
, 48, 1);
1036 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1037 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1039 NormalTextXY (24, Line
, 48, 1);
1042 else if (Line
== 16)
1046 InvertTextXY (24, Line
, 48, 1);
1048 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1049 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1051 if (ConfirmQuit(Ir
) == TRUE
)
1055 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1058 return COMPUTER_SETTINGS_PAGE
;
1059 else if (Line
== 12)
1060 return DISPLAY_SETTINGS_PAGE
;
1061 else if (Line
== 13)
1062 return KEYBOARD_SETTINGS_PAGE
;
1063 else if (Line
== 14)
1064 return LAYOUT_SETTINGS_PAGE
;
1065 else if (Line
== 16)
1066 return SELECT_PARTITION_PAGE
;
1070 return DEVICE_SETTINGS_PAGE
;
1075 ComputerSettingsPage(PINPUT_RECORD Ir
)
1080 SetTextXY(6, 8, "You want to change the type of computer to be installed.");
1082 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
1083 SetTextXY(8, 11, " Then press ENTER.");
1085 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1086 SetTextXY(8, 14, " the computer type.");
1088 GetScreenSize(&xScreen
, &yScreen
);
1090 DrawGenericList(ComputerList
,
1096 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1098 SaveGenericListState(ComputerList
);
1104 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1105 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1107 ScrollDownGenericList (ComputerList
);
1109 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1110 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1112 ScrollUpGenericList (ComputerList
);
1114 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1115 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1117 if (ConfirmQuit(Ir
) == TRUE
)
1121 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1122 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1124 RestoreGenericListState(ComputerList
);
1125 return DEVICE_SETTINGS_PAGE
;
1127 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1129 return DEVICE_SETTINGS_PAGE
;
1133 return COMPUTER_SETTINGS_PAGE
;
1138 DisplaySettingsPage(PINPUT_RECORD Ir
)
1143 SetTextXY(6, 8, "You want to change the type of display to be installed.");
1145 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
1146 SetTextXY(8, 11, " Then press ENTER.");
1148 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1149 SetTextXY(8, 14, " the display type.");
1151 GetScreenSize(&xScreen
, &yScreen
);
1153 DrawGenericList(DisplayList
,
1159 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1161 SaveGenericListState(DisplayList
);
1167 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1168 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1170 ScrollDownGenericList (DisplayList
);
1172 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1173 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1175 ScrollUpGenericList (DisplayList
);
1177 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1178 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1180 if (ConfirmQuit(Ir
) == TRUE
)
1186 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1187 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1189 RestoreGenericListState(DisplayList
);
1190 return DEVICE_SETTINGS_PAGE
;
1192 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1194 return DEVICE_SETTINGS_PAGE
;
1198 return DISPLAY_SETTINGS_PAGE
;
1203 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1208 SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
1210 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
1211 SetTextXY(8, 11, " Then press ENTER.");
1213 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1214 SetTextXY(8, 14, " the keyboard type.");
1216 GetScreenSize(&xScreen
, &yScreen
);
1218 DrawGenericList(KeyboardList
,
1224 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1226 SaveGenericListState(KeyboardList
);
1232 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1233 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1235 ScrollDownGenericList (KeyboardList
);
1237 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1238 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1240 ScrollUpGenericList (KeyboardList
);
1242 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1243 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1245 if (ConfirmQuit(Ir
) == TRUE
)
1249 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1250 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1252 RestoreGenericListState(KeyboardList
);
1253 return DEVICE_SETTINGS_PAGE
;
1255 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1257 return DEVICE_SETTINGS_PAGE
;
1261 return DISPLAY_SETTINGS_PAGE
;
1266 LayoutSettingsPage(PINPUT_RECORD Ir
)
1271 SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
1273 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
1274 SetTextXY(8, 11, " layout. Then press ENTER.");
1276 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1277 SetTextXY(8, 14, " the keyboard layout.");
1279 GetScreenSize(&xScreen
, &yScreen
);
1281 DrawGenericList(LayoutList
,
1287 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1289 SaveGenericListState(LayoutList
);
1295 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1296 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1298 ScrollDownGenericList (LayoutList
);
1300 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1301 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1303 ScrollUpGenericList (LayoutList
);
1305 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1306 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1308 if (ConfirmQuit(Ir
) == TRUE
)
1312 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1313 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1315 RestoreGenericListState(LayoutList
);
1316 return DEVICE_SETTINGS_PAGE
;
1318 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1320 return DEVICE_SETTINGS_PAGE
;
1324 return DISPLAY_SETTINGS_PAGE
;
1329 SelectPartitionPage(PINPUT_RECORD Ir
)
1334 SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
1335 SetTextXY(6, 9, "space for new partitions.");
1337 SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
1338 SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
1339 SetTextXY(8, 15, "\x07 Press C to create a new partition.");
1340 SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
1342 SetStatusText(" Please wait...");
1344 GetScreenSize(&xScreen
, &yScreen
);
1346 if (PartitionList
== NULL
)
1348 PartitionList
= CreatePartitionList (2,
1352 if (PartitionList
== NULL
)
1354 /* FIXME: show an error dialog */
1359 CheckActiveBootPartition (PartitionList
);
1361 DrawPartitionList (PartitionList
);
1363 /* Warn about partitions created by Linux Fdisk */
1364 if (WarnLinuxPartitions
== TRUE
&&
1365 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1367 PopupError ("Setup found that at least one harddisk contains an incompatible\n"
1368 "partition table that can not be handled properly!\n"
1370 "Creating or deleting partitions can destroy the partiton table.\n"
1372 " \x07 Press F3 to quit Setup."
1373 " \x07 Press ENTER to continue.",
1374 "F3= Quit ENTER = Continue");
1379 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1380 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1384 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1386 WarnLinuxPartitions
= FALSE
;
1387 return SELECT_PARTITION_PAGE
;
1392 if (IsUnattendedSetup
)
1394 SelectPartition(PartitionList
,
1395 UnattendDestinationDiskNumber
,
1396 UnattendDestinationPartitionNumber
);
1397 return(SELECT_FILE_SYSTEM_PAGE
);
1402 /* Update status text */
1403 if (PartitionList
->CurrentPartition
== NULL
||
1404 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1406 SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1410 SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1415 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1416 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1418 if (ConfirmQuit(Ir
) == TRUE
)
1420 DestroyPartitionList (PartitionList
);
1421 PartitionList
= NULL
;
1426 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1427 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1429 ScrollDownPartitionList (PartitionList
);
1431 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1432 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1434 ScrollUpPartitionList (PartitionList
);
1436 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1438 if (PartitionList
->CurrentPartition
== NULL
||
1439 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1441 CreateNewPartition (PartitionList
,
1446 return SELECT_FILE_SYSTEM_PAGE
;
1448 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'C') /* C */
1450 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1452 PopupError ("You can not create a new Partition inside\n"
1453 "of an already existing Partition!\n"
1455 " * Press any key to continue.",
1459 return SELECT_PARTITION_PAGE
;
1462 return CREATE_PARTITION_PAGE
;
1464 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1466 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1468 PopupError ("You can not delete unpartitioned disk space!\n"
1470 " * Press any key to continue.",
1474 return SELECT_PARTITION_PAGE
;
1477 return DELETE_PARTITION_PAGE
;
1481 return SELECT_PARTITION_PAGE
;
1486 DrawInputField(ULONG FieldLength
,
1496 memset(buf
, '_', sizeof(buf
));
1497 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1498 strcat(buf
, FieldContent
);
1500 WriteConsoleOutputCharacters (buf
,
1506 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1509 ShowPartitionSizeInputBox(SHORT Left
,
1534 /* draw upper left corner */
1537 FillConsoleOutputCharacter(0xDA, // '+',
1542 /* draw upper edge */
1545 FillConsoleOutputCharacter(0xC4, // '-',
1550 /* draw upper right corner */
1553 FillConsoleOutputCharacter(0xBF, // '+',
1558 /* draw left and right edge */
1559 for (i
= Top
+ 1; i
< Bottom
; i
++)
1563 FillConsoleOutputCharacter(0xB3, // '|',
1569 FillConsoleOutputCharacter(0xB3, //'|',
1575 /* draw lower left corner */
1578 FillConsoleOutputCharacter(0xC0, // '+',
1583 /* draw lower edge */
1586 FillConsoleOutputCharacter(0xC4, // '-',
1591 /* draw lower right corner */
1594 FillConsoleOutputCharacter(0xD9, // '+',
1602 strcpy (Buffer
, "Size of new partition:");
1603 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1605 WriteConsoleOutputCharacters (Buffer
,
1609 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1610 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1612 WriteConsoleOutputCharacters (Buffer
,
1616 sprintf(Buffer
, "%lu", MaxSize
);
1617 Index
= strlen(Buffer
);
1618 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1627 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1628 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1635 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1639 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1646 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1651 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1656 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1657 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1659 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1660 if ((ch
>= '0') && (ch
<= '9'))
1665 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1673 strcpy (InputBuffer
,
1679 CreatePartitionPage (PINPUT_RECORD Ir
)
1681 PDISKENTRY DiskEntry
;
1682 PPARTENTRY PartEntry
;
1687 CHAR InputBuffer
[50];
1693 if (PartitionList
== NULL
||
1694 PartitionList
->CurrentDisk
== NULL
||
1695 PartitionList
->CurrentPartition
== NULL
)
1697 /* FIXME: show an error dialog */
1701 DiskEntry
= PartitionList
->CurrentDisk
;
1702 PartEntry
= PartitionList
->CurrentPartition
;
1704 SetStatusText (" Please wait...");
1706 GetScreenSize (&xScreen
, &yScreen
);
1708 SetTextXY (6, 8, "You have chosen to create a new partition on");
1711 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1713 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1719 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1725 if (DiskEntry
->DriverName
.Length
> 0)
1728 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1731 DiskEntry
->DiskNumber
,
1735 &DiskEntry
->DriverName
);
1740 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1743 DiskEntry
->DiskNumber
,
1750 SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1753 PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1754 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1757 SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1759 PartEntry
= PartitionList
->CurrentPartition
;
1762 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1763 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1764 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1767 if (ConfirmQuit (Ir
) == TRUE
)
1772 else if (Cancel
== TRUE
)
1774 return SELECT_PARTITION_PAGE
;
1778 PartSize
= atoi (InputBuffer
);
1785 if (PartSize
> MaxSize
)
1791 /* Convert to bytes */
1792 if (PartSize
== MaxSize
)
1794 /* Use all of the unpartitioned disk space */
1795 PartSize
= PartEntry
->UnpartitionedLength
;
1799 /* Round-up by cylinder size */
1800 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1801 DiskEntry
->CylinderSize
);
1803 /* But never get larger than the unpartitioned disk space */
1804 if (PartSize
> PartEntry
->UnpartitionedLength
)
1805 PartSize
= PartEntry
->UnpartitionedLength
;
1808 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1810 CreateNewPartition (PartitionList
,
1814 return SELECT_PARTITION_PAGE
;
1818 return CREATE_PARTITION_PAGE
;
1823 DeletePartitionPage (PINPUT_RECORD Ir
)
1825 PDISKENTRY DiskEntry
;
1826 PPARTENTRY PartEntry
;
1832 if (PartitionList
== NULL
||
1833 PartitionList
->CurrentDisk
== NULL
||
1834 PartitionList
->CurrentPartition
== NULL
)
1836 /* FIXME: show an error dialog */
1840 DiskEntry
= PartitionList
->CurrentDisk
;
1841 PartEntry
= PartitionList
->CurrentPartition
;
1843 SetTextXY (6, 8, "You have chosen to delete the partition");
1845 /* Determine partition type */
1847 if (PartEntry
->New
== TRUE
)
1849 PartType
= "New (Unformatted)";
1851 else if (PartEntry
->Unpartitioned
== FALSE
)
1853 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1854 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1855 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1856 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1860 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1861 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1865 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1867 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1872 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
1874 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1879 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000LL
) /* 10 MB */
1881 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1886 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1890 if (PartType
== NULL
)
1893 " %c%c Type %lu %I64u %s",
1894 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1895 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1896 PartEntry
->PartInfo
[0].PartitionType
,
1903 " %c%c %s %I64u %s",
1904 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1905 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1912 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1914 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1920 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1926 if (DiskEntry
->DriverName
.Length
> 0)
1929 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1932 DiskEntry
->DiskNumber
,
1936 &DiskEntry
->DriverName
);
1941 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1944 DiskEntry
->DiskNumber
,
1950 SetTextXY (8, 18, "\x07 Press D to delete the partition.");
1951 SetTextXY (11, 19, "WARNING: All data on this partition will be lost!");
1953 SetTextXY (8, 21, "\x07 Press ESC to cancel.");
1955 SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit");
1961 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1962 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1964 if (ConfirmQuit (Ir
) == TRUE
)
1970 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
1972 return SELECT_PARTITION_PAGE
;
1974 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1976 DeleteCurrentPartition (PartitionList
);
1978 return SELECT_PARTITION_PAGE
;
1982 return DELETE_PARTITION_PAGE
;
1987 SelectFileSystemPage (PINPUT_RECORD Ir
)
1989 PDISKENTRY DiskEntry
;
1990 PPARTENTRY PartEntry
;
1997 if (PartitionList
== NULL
||
1998 PartitionList
->CurrentDisk
== NULL
||
1999 PartitionList
->CurrentPartition
== NULL
)
2001 /* FIXME: show an error dialog */
2005 DiskEntry
= PartitionList
->CurrentDisk
;
2006 PartEntry
= PartitionList
->CurrentPartition
;
2008 /* adjust disk size */
2009 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2011 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2016 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2020 /* adjust partition size */
2021 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
2023 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
2028 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
2032 /* adjust partition type */
2033 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
2034 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
2035 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
2036 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
2040 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
2041 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
2045 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
2047 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2049 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2051 PartType
= "Unused";
2055 PartType
= "Unknown";
2058 if (PartEntry
->AutoCreate
== TRUE
)
2060 SetTextXY(6, 8, "Setup created a new partition on");
2063 PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2064 PartEntry
->PartInfo
[0].PartitionNumber
,
2070 PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2071 DiskEntry
->DiskNumber
,
2077 &DiskEntry
->DriverName
);
2079 SetTextXY(6, 12, "This Partition will be formatted next.");
2082 PartEntry
->AutoCreate
= FALSE
;
2084 else if (PartEntry
->New
== TRUE
)
2086 SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
2087 SetTextXY(6, 10, "This Partition will be formatted next.");
2091 SetTextXY(6, 8, "Setup install ReactOS onto Partition");
2093 if (PartType
== NULL
)
2096 "%c%c Type %lu %I64u %s",
2097 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2098 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2099 PartEntry
->PartInfo
[0].PartitionType
,
2107 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2108 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2114 PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2115 DiskEntry
->DiskNumber
,
2121 &DiskEntry
->DriverName
);
2125 SetTextXY(6, 17, "Select a file system from the list below.");
2127 SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system.");
2128 SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
2129 SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
2131 if (FileSystemList
== NULL
)
2133 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, FsFat
);
2134 if (FileSystemList
== NULL
)
2136 /* FIXME: show an error dialog */
2140 /* FIXME: Add file systems to list */
2142 DrawFileSystemList (FileSystemList
);
2144 SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit");
2146 if (IsUnattendedSetup
)
2148 return(CHECK_FILE_SYSTEM_PAGE
);
2155 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2156 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2158 if (ConfirmQuit (Ir
) == TRUE
)
2164 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2165 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2167 return SELECT_PARTITION_PAGE
;
2169 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2170 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2172 ScrollDownFileSystemList (FileSystemList
);
2174 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2175 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2177 ScrollUpFileSystemList (FileSystemList
);
2179 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2181 if (FileSystemList
->CurrentFileSystem
== FsKeep
)
2183 return CHECK_FILE_SYSTEM_PAGE
;
2187 return FORMAT_PARTITION_PAGE
;
2192 return SELECT_FILE_SYSTEM_PAGE
;
2197 FormatPartitionPage (PINPUT_RECORD Ir
)
2199 WCHAR PathBuffer
[MAX_PATH
];
2200 PDISKENTRY DiskEntry
;
2201 PPARTENTRY PartEntry
;
2211 SetTextXY(6, 8, "Format partition");
2213 SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue.");
2215 SetStatusText(" ENTER = Continue F3 = Quit");
2218 if (PartitionList
== NULL
||
2219 PartitionList
->CurrentDisk
== NULL
||
2220 PartitionList
->CurrentPartition
== NULL
)
2222 /* FIXME: show an error dialog */
2226 DiskEntry
= PartitionList
->CurrentDisk
;
2227 PartEntry
= PartitionList
->CurrentPartition
;
2233 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2234 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2236 if (ConfirmQuit (Ir
) == TRUE
)
2242 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2244 SetStatusText (" Please wait ...");
2246 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2248 switch (FileSystemList
->CurrentFileSystem
)
2251 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200LL * 1024LL))
2253 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2254 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2256 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024LL * 255LL * 63LL * 512LL))
2258 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2260 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32LL * 1024LL * 1024LL))
2262 /* FAT16 CHS partition (partiton size < 32MB) */
2263 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2265 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2267 /* FAT16 CHS partition (partition size < 512MB) */
2268 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2272 /* FAT32 CHS partition (partition size >= 512MB) */
2273 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2278 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2280 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2282 /* FAT16 LBA partition (partition size < 512MB) */
2283 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2287 /* FAT32 LBA partition (partition size >= 512MB) */
2288 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2301 CheckActiveBootPartition (PartitionList
);
2305 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2306 DiskEntry
->DiskSize
,
2307 DiskEntry
->CylinderSize
,
2308 DiskEntry
->TrackSize
);
2311 DiskEntry
= PartitionList
->CurrentDisk
;
2312 Entry
= DiskEntry
->PartListHead
.Flink
;
2313 while (Entry
!= &DiskEntry
->PartListHead
)
2315 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2317 if (PartEntry
->Unpartitioned
== FALSE
)
2320 for (i
= 0; i
< 4; i
++)
2322 PrintTextXY (6, Line
,
2323 "%2u: %2u %c %12I64u %12I64u %2u %c",
2325 PartEntry
->PartInfo
[i
].PartitionNumber
,
2326 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2327 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2328 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2329 PartEntry
->PartInfo
[i
].PartitionType
,
2330 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2338 Entry
= Entry
->Flink
;
2341 /* Restore the old entry */
2342 PartEntry
= PartitionList
->CurrentPartition
;
2345 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2347 DPRINT ("WritePartitionsToDisk() failed\n");
2349 PopupError ("Setup failed to write partition tables.\n",
2350 "ENTER = Reboot computer");
2356 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2363 /* Set DestinationRootPath */
2364 RtlFreeUnicodeString (&DestinationRootPath
);
2365 swprintf (PathBuffer
,
2366 L
"\\Device\\Harddisk%lu\\Partition%lu",
2367 PartitionList
->CurrentDisk
->DiskNumber
,
2368 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2369 RtlCreateUnicodeString (&DestinationRootPath
,
2371 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2374 /* Set SystemRootPath */
2375 RtlFreeUnicodeString (&SystemRootPath
);
2376 swprintf (PathBuffer
,
2377 L
"\\Device\\Harddisk%lu\\Partition%lu",
2378 PartitionList
->ActiveBootDisk
->DiskNumber
,
2379 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2380 RtlCreateUnicodeString (&SystemRootPath
,
2382 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2385 switch (FileSystemList
->CurrentFileSystem
)
2388 Status
= FormatPartition (&DestinationRootPath
);
2389 if (!NT_SUCCESS (Status
))
2391 DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status
);
2392 /* FIXME: show an error dialog */
2396 PartEntry
->New
= FALSE
;
2397 if (FileSystemList
!= NULL
)
2399 DestroyFileSystemList (FileSystemList
);
2400 FileSystemList
= NULL
;
2403 CheckActiveBootPartition (PartitionList
);
2405 /* FIXME: Install boot code. This is a hack! */
2406 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
) ||
2407 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2409 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2410 wcscat (PathBuffer
, L
"\\loader\\fat32.bin");
2412 DPRINT ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2413 DestinationRootPath
.Buffer
);
2414 Status
= InstallFat32BootCodeToDisk (PathBuffer
,
2415 DestinationRootPath
.Buffer
);
2416 if (!NT_SUCCESS (Status
))
2418 DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2419 /* FIXME: show an error dialog */
2425 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2426 wcscat (PathBuffer
, L
"\\loader\\fat.bin");
2428 DPRINT ("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2429 DestinationRootPath
.Buffer
);
2430 Status
= InstallFat16BootCodeToDisk (PathBuffer
,
2431 DestinationRootPath
.Buffer
);
2432 if (!NT_SUCCESS (Status
))
2434 DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2435 /* FIXME: show an error dialog */
2449 SetStatusText (" Done. Press any key ...");
2453 return INSTALL_DIRECTORY_PAGE
;
2457 return FORMAT_PARTITION_PAGE
;
2462 CheckFileSystemPage(PINPUT_RECORD Ir
)
2464 WCHAR PathBuffer
[MAX_PATH
];
2466 SetTextXY(6, 8, "Check file system");
2468 SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
2470 SetStatusText(" Please wait ...");
2473 SetStatusText(" ENTER = Continue F3 = Quit");
2476 /* Set DestinationRootPath */
2477 RtlFreeUnicodeString (&DestinationRootPath
);
2478 swprintf (PathBuffer
,
2479 L
"\\Device\\Harddisk%lu\\Partition%lu",
2480 PartitionList
->CurrentDisk
->DiskNumber
,
2481 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2482 RtlCreateUnicodeString (&DestinationRootPath
,
2484 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2486 /* Set SystemRootPath */
2487 RtlFreeUnicodeString (&SystemRootPath
);
2488 swprintf (PathBuffer
,
2489 L
"\\Device\\Harddisk%lu\\Partition%lu",
2490 PartitionList
->ActiveBootDisk
->DiskNumber
,
2491 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2492 RtlCreateUnicodeString (&SystemRootPath
,
2494 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2497 if (IsUnattendedSetup
)
2499 return(INSTALL_DIRECTORY_PAGE
);
2506 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2507 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2509 if (ConfirmQuit(Ir
) == TRUE
)
2513 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2515 return(INSTALL_DIRECTORY_PAGE
);
2519 return(CHECK_FILE_SYSTEM_PAGE
);
2524 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2526 WCHAR PathBuffer
[MAX_PATH
];
2528 /* Create 'InstallPath' string */
2529 RtlFreeUnicodeString(&InstallPath
);
2530 RtlCreateUnicodeString(&InstallPath
,
2533 /* Create 'DestinationPath' string */
2534 RtlFreeUnicodeString(&DestinationPath
);
2536 DestinationRootPath
.Buffer
);
2537 if (InstallDir
[0] != L
'\\')
2540 wcscat(PathBuffer
, InstallDir
);
2541 RtlCreateUnicodeString(&DestinationPath
,
2544 /* Create 'DestinationArcPath' */
2545 RtlFreeUnicodeString(&DestinationArcPath
);
2546 swprintf(PathBuffer
,
2547 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2548 DiskEntry
->BiosDiskNumber
,
2549 PartEntry
->PartInfo
[0].PartitionNumber
);
2550 if (InstallDir
[0] != L
'\\')
2553 wcscat(PathBuffer
, InstallDir
);
2554 RtlCreateUnicodeString(&DestinationArcPath
,
2557 return(PREPARE_COPY_PAGE
);
2562 InstallDirectoryPage(PINPUT_RECORD Ir
)
2564 PDISKENTRY DiskEntry
;
2565 PPARTENTRY PartEntry
;
2566 WCHAR InstallDir
[51];
2571 if (PartitionList
== NULL
||
2572 PartitionList
->CurrentDisk
== NULL
||
2573 PartitionList
->CurrentPartition
== NULL
)
2575 /* FIXME: show an error dialog */
2579 DiskEntry
= PartitionList
->CurrentDisk
;
2580 PartEntry
= PartitionList
->CurrentPartition
;
2582 /* Search for 'DefaultPath' in the 'SetupData' section */
2583 if (!InfFindFirstLine (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2585 PopupError("Setup failed to find the 'SetupData' section\n"
2586 "in TXTSETUP.SIF.\n",
2587 "ENTER = Reboot computer");
2593 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2600 /* Read the 'DefaultPath' data */
2601 if (InfGetData (&Context
, NULL
, &DefaultPath
))
2603 wcscpy(InstallDir
, DefaultPath
);
2607 wcscpy(InstallDir
, L
"\\ReactOS");
2609 Length
= wcslen(InstallDir
);
2611 SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
2612 SetTextXY(6, 9, "directory where you want ReactOS to be installed:");
2614 SetInputTextXY(8, 11, 51, InstallDir
);
2616 SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete");
2617 SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to");
2618 SetTextXY(6, 16, "be installed.");
2620 SetStatusText(" ENTER = Continue F3 = Quit");
2622 if (IsUnattendedSetup
)
2624 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2631 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2632 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2634 if (ConfirmQuit(Ir
) == TRUE
)
2638 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2640 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2642 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2647 InstallDir
[Length
] = 0;
2648 SetInputTextXY(8, 11, 51, InstallDir
);
2651 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2655 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2657 InstallDir
[Length
] = 0;
2658 SetInputTextXY(8, 11, 51, InstallDir
);
2663 return(INSTALL_DIRECTORY_PAGE
);
2668 AddSectionToCopyQueue(HINF InfFile
,
2670 PWCHAR SourceCabinet
,
2673 INFCONTEXT FilesContext
;
2674 INFCONTEXT DirContext
;
2676 PWCHAR FileKeyValue
;
2678 PWCHAR TargetFileName
;
2680 /* Search for the SectionName section */
2681 if (!InfFindFirstLine (InfFile
, SectionName
, NULL
, &FilesContext
))
2684 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2685 PopupError(Buffer
, "ENTER = Reboot computer");
2691 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2699 * Enumerate the files in the section
2700 * and add them to the file queue.
2704 /* Get source file name and target directory id */
2705 if (!InfGetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2707 /* FIXME: Handle error! */
2708 DPRINT1("InfGetData() failed\n");
2712 /* Get optional target file name */
2713 if (!InfGetDataField (&FilesContext
, 2, &TargetFileName
))
2714 TargetFileName
= NULL
;
2716 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2718 /* Lookup target directory */
2719 if (!InfFindFirstLine (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2721 /* FIXME: Handle error! */
2722 DPRINT1("InfFindFirstLine() failed\n");
2726 if (!InfGetData (&DirContext
, NULL
, &DirKeyValue
))
2728 /* FIXME: Handle error! */
2729 DPRINT1("InfGetData() failed\n");
2733 if (!SetupQueueCopy(SetupFileQueue
,
2735 SourceRootPath
.Buffer
,
2741 /* FIXME: Handle error! */
2742 DPRINT1("SetupQueueCopy() failed\n");
2745 while (InfFindNextLine(&FilesContext
, &FilesContext
));
2751 PrepareCopyPageInfFile(HINF InfFile
,
2752 PWCHAR SourceCabinet
,
2755 WCHAR PathBuffer
[MAX_PATH
];
2756 INFCONTEXT DirContext
;
2757 PWCHAR AdditionalSectionName
;
2762 /* Add common files */
2763 if (!AddSectionToCopyQueue(InfFile
, L
"SourceFiles", SourceCabinet
, Ir
))
2766 /* Add specific files depending of computer type */
2767 if (SourceCabinet
== NULL
)
2769 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
2771 if (AdditionalSectionName
)
2773 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, Ir
))
2778 /* Create directories */
2782 * Install directories like '\reactos\test' are not handled yet.
2785 /* Get destination path */
2786 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2788 /* Remove trailing backslash */
2789 Length
= wcslen(PathBuffer
);
2790 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2792 PathBuffer
[Length
- 1] = 0;
2795 /* Create the install directory */
2796 Status
= SetupCreateDirectory(PathBuffer
);
2797 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2799 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2800 PopupError("Setup could not create the install directory.",
2801 "ENTER = Reboot computer");
2807 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2815 /* Search for the 'Directories' section */
2816 if (!InfFindFirstLine(InfFile
, L
"Directories", NULL
, &DirContext
))
2820 PopupError("Setup failed to find the 'Directories' section\n"
2821 "in the cabinet.\n", "ENTER = Reboot computer");
2825 PopupError("Setup failed to find the 'Directories' section\n"
2826 "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
2833 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2840 /* Enumerate the directory values and create the subdirectories */
2843 if (!InfGetData (&DirContext
, NULL
, &KeyValue
))
2849 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2851 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2853 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2854 wcscat(PathBuffer
, KeyValue
);
2856 DPRINT("FullPath: '%S'\n", PathBuffer
);
2858 else if (KeyValue
[0] != L
'\\')
2860 DPRINT("RelativePath: '%S'\n", KeyValue
);
2861 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2862 wcscat(PathBuffer
, L
"\\");
2863 wcscat(PathBuffer
, KeyValue
);
2865 DPRINT("FullPath: '%S'\n", PathBuffer
);
2867 Status
= SetupCreateDirectory(PathBuffer
);
2868 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2870 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2871 PopupError("Setup could not create install directories.",
2872 "ENTER = Reboot computer");
2878 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2886 while (InfFindNextLine (&DirContext
, &DirContext
));
2893 PrepareCopyPage(PINPUT_RECORD Ir
)
2896 WCHAR PathBuffer
[MAX_PATH
];
2897 INFCONTEXT CabinetsContext
;
2904 SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
2906 SetStatusText(" Building the file copy list...");
2908 /* Create the file queue */
2909 SetupFileQueue
= SetupOpenFileQueue();
2910 if (SetupFileQueue
== NULL
)
2912 PopupError("Setup failed to open the copy file queue.\n",
2913 "ENTER = Reboot computer");
2919 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2926 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
2931 /* Search for the 'Cabinets' section */
2932 if (!InfFindFirstLine (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
2934 return FILE_COPY_PAGE
;
2938 * Enumerate the directory values in the 'Cabinets'
2939 * section and parse their inf files.
2943 if (!InfGetData (&CabinetsContext
, NULL
, &KeyValue
))
2946 wcscpy(PathBuffer
, SourcePath
.Buffer
);
2947 wcscat(PathBuffer
, L
"\\");
2948 wcscat(PathBuffer
, KeyValue
);
2950 CabinetInitialize();
2951 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
2952 CabinetSetCabinetName(PathBuffer
);
2954 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
2956 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
2958 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
2959 if (InfFileData
== NULL
)
2961 PopupError("Cabinet has no setup script.\n",
2962 "ENTER = Reboot computer");
2968 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2977 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
2979 PopupError("Cabinet not found.\n",
2980 "ENTER = Reboot computer");
2986 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2993 Status
= InfOpenBufferedFile(&InfHandle
,
2997 if (!NT_SUCCESS(Status
))
2999 PopupError("Cabinet has no valid inf file.\n",
3000 "ENTER = Reboot computer");
3006 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3015 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3020 while (InfFindNextLine (&CabinetsContext
, &CabinetsContext
));
3022 return FILE_COPY_PAGE
;
3027 FileCopyCallback(PVOID Context
,
3032 PCOPYCONTEXT CopyContext
;
3034 CopyContext
= (PCOPYCONTEXT
)Context
;
3036 switch (Notification
)
3038 case SPFILENOTIFY_STARTSUBQUEUE
:
3039 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3040 ProgressSetStepCount(CopyContext
->ProgressBar
,
3041 CopyContext
->TotalOperations
);
3044 case SPFILENOTIFY_STARTCOPY
:
3045 /* Display copy message */
3046 SetStatusText(" \xB3 Copying file: %S", (PWSTR
)Param1
);
3049 case SPFILENOTIFY_ENDCOPY
:
3050 CopyContext
->CompletedOperations
++;
3051 ProgressNextStep(CopyContext
->ProgressBar
);
3060 FileCopyPage(PINPUT_RECORD Ir
)
3062 COPYCONTEXT CopyContext
;
3066 SetStatusText(" \xB3 Please wait... ");
3068 SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS");
3069 SetTextXY(30, 13, "installation folder.");
3070 SetTextXY(20, 14, "This may take several minutes to complete.");
3072 GetScreenSize(&xScreen
, &yScreen
);
3073 CopyContext
.TotalOperations
= 0;
3074 CopyContext
.CompletedOperations
= 0;
3075 CopyContext
.ProgressBar
= CreateProgressBar(13,
3079 "Setup is copying files...");
3081 SetupCommitFileQueue(SetupFileQueue
,
3082 DestinationRootPath
.Buffer
,
3084 (PSP_FILE_CALLBACK
)FileCopyCallback
,
3087 SetupCloseFileQueue(SetupFileQueue
);
3089 DestroyProgressBar(CopyContext
.ProgressBar
);
3091 return REGISTRY_PAGE
;
3096 RegistryPage(PINPUT_RECORD Ir
)
3098 INFCONTEXT InfContext
;
3105 SetTextXY(6, 8, "Setup is updating the system configuration");
3107 SetStatusText(" Creating registry hives...");
3109 if (!SetInstallPathValue(&DestinationPath
))
3111 DPRINT("SetInstallPathValue() failed\n");
3112 PopupError("Setup failed to set the initialize the registry.",
3113 "ENTER = Reboot computer");
3119 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3126 /* Create the default hives */
3127 Status
= NtInitializeRegistry(TRUE
);
3128 if (!NT_SUCCESS(Status
))
3130 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3131 PopupError("Setup failed to create the registry hives.",
3132 "ENTER = Reboot computer");
3138 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3145 /* Update registry */
3146 SetStatusText(" Updating registry hives...");
3148 if (!InfFindFirstLine(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3150 DPRINT1("InfFindFirstLine() failed\n");
3151 PopupError("Setup failed to find the registry data files.",
3152 "ENTER = Reboot computer");
3158 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3167 InfGetDataField (&InfContext
, 0, &Action
);
3168 InfGetDataField (&InfContext
, 1, &File
);
3169 InfGetDataField (&InfContext
, 2, &Section
);
3171 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3173 if (!_wcsicmp (Action
, L
"AddReg"))
3177 else if (!_wcsicmp (Action
, L
"DelReg"))
3186 SetStatusText(" Importing %S...", File
);
3188 if (!ImportRegistryFile(File
, Section
, Delete
))
3190 DPRINT("Importing %S failed\n", File
);
3192 PopupError("Setup failed to import a hive file.",
3193 "ENTER = Reboot computer");
3199 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3206 while (InfFindNextLine (&InfContext
, &InfContext
));
3208 /* Update display registry settings */
3209 SetStatusText(" Updating display registry settings...");
3210 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3212 PopupError("Setup failed to update display registry settings.",
3213 "ENTER = Reboot computer");
3219 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3226 /* Update keyboard layout settings */
3227 SetStatusText(" Updating keyboard layout settings...");
3228 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3230 PopupError("Setup failed to update keyboard layout settings.",
3231 "ENTER = Reboot computer");
3237 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3244 /* Update the mounted devices list */
3245 SetMountedDeviceValues(PartitionList
);
3247 SetStatusText(" Done...");
3249 return BOOT_LOADER_PAGE
;
3254 BootLoaderPage(PINPUT_RECORD Ir
)
3256 UCHAR PartitionType
;
3257 BOOLEAN InstallOnFloppy
;
3260 SetStatusText(" Please wait...");
3262 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3264 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3266 DPRINT("Error: active partition invalid (unused)\n");
3267 InstallOnFloppy
= TRUE
;
3269 else if (PartitionType
== 0x0A)
3271 /* OS/2 boot manager partition */
3272 DPRINT("Found OS/2 boot manager partition\n");
3273 InstallOnFloppy
= TRUE
;
3275 else if (PartitionType
== 0x83)
3277 /* Linux ext2 partition */
3278 DPRINT("Found Linux ext2 partition\n");
3279 InstallOnFloppy
= TRUE
;
3281 else if (PartitionType
== PARTITION_IFS
)
3283 /* NTFS partition */
3284 DPRINT("Found NTFS partition\n");
3285 InstallOnFloppy
= TRUE
;
3287 else if ((PartitionType
== PARTITION_FAT_12
) ||
3288 (PartitionType
== PARTITION_FAT_16
) ||
3289 (PartitionType
== PARTITION_HUGE
) ||
3290 (PartitionType
== PARTITION_XINT13
) ||
3291 (PartitionType
== PARTITION_FAT32
) ||
3292 (PartitionType
== PARTITION_FAT32_XINT13
))
3294 DPRINT("Found FAT partition\n");
3295 InstallOnFloppy
= FALSE
;
3299 /* Unknown partition */
3300 DPRINT("Unknown partition found\n");
3301 InstallOnFloppy
= TRUE
;
3304 if (InstallOnFloppy
== TRUE
)
3306 return BOOT_LOADER_FLOPPY_PAGE
;
3309 SetTextXY(6, 8, "Setup is installing the boot loader");
3311 SetTextXY(8, 12, "Install bootloader on the harddisk (MBR).");
3312 SetTextXY(8, 13, "Install bootloader on a floppy disk.");
3313 SetTextXY(8, 14, "Skip install bootloader.");
3314 InvertTextXY (8, Line
, 48, 1);
3316 SetStatusText(" ENTER = Continue F3 = Quit");
3322 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3323 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3325 NormalTextXY (8, Line
, 48, 1);
3328 if (Line
<12) Line
=14;
3329 if (Line
>14) Line
=12;
3333 InvertTextXY (8, Line
, 48, 1);
3335 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3336 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3338 NormalTextXY (8, Line
, 48, 1);
3341 if (Line
<12) Line
=14;
3342 if (Line
>14) Line
=12;
3345 InvertTextXY (8, Line
, 48, 1);
3347 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3348 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3350 if (ConfirmQuit(Ir
) == TRUE
)
3354 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3358 return BOOT_LOADER_HARDDISK_PAGE
;
3360 else if (Line
== 13)
3362 return BOOT_LOADER_FLOPPY_PAGE
;
3364 else if (Line
== 14)
3366 return SUCCESS_PAGE
;;
3369 return BOOT_LOADER_PAGE
;
3374 return BOOT_LOADER_PAGE
;
3379 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3383 SetTextXY(6, 8, "Setup cannot install the bootloader on your computers");
3384 SetTextXY(6, 9, "harddisk");
3386 SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and");
3387 SetTextXY(6, 14, "press ENTER.");
3390 SetStatusText(" ENTER = Continue F3 = Quit");
3391 // SetStatusText(" Please wait...");
3397 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3398 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3400 if (ConfirmQuit(Ir
) == TRUE
)
3404 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3406 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3408 PopupError("No disk in drive A:.",
3409 "ENTER = Continue");
3414 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3418 return BOOT_LOADER_FLOPPY_PAGE
;
3421 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3422 &DestinationArcPath
);
3423 if (!NT_SUCCESS(Status
))
3425 /* Print error message */
3426 return BOOT_LOADER_FLOPPY_PAGE
;
3429 return SUCCESS_PAGE
;
3433 return BOOT_LOADER_FLOPPY_PAGE
;
3438 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3440 UCHAR PartitionType
;
3443 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3444 if ((PartitionType
== PARTITION_FAT_12
) ||
3445 (PartitionType
== PARTITION_FAT_16
) ||
3446 (PartitionType
== PARTITION_HUGE
) ||
3447 (PartitionType
== PARTITION_XINT13
) ||
3448 (PartitionType
== PARTITION_FAT32
) ||
3449 (PartitionType
== PARTITION_FAT32_XINT13
))
3451 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3453 &DestinationArcPath
,
3455 if (!NT_SUCCESS(Status
))
3457 PopupError("Setup failed to install the FAT bootcode on the system partition.",
3458 "ENTER = Reboot computer");
3464 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3471 return SUCCESS_PAGE
;
3475 PopupError("failed to install FAT bootcode on the system partition.",
3476 "ENTER = Reboot computer");
3482 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3489 return BOOT_LOADER_HARDDISK_PAGE
;
3494 QuitPage(PINPUT_RECORD Ir
)
3496 SetTextXY(10, 6, "ReactOS is not completely installed");
3498 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3499 SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
3501 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3503 SetStatusText(" Please wait ...");
3505 /* Destroy partition list */
3506 if (PartitionList
!= NULL
)
3508 DestroyPartitionList (PartitionList
);
3509 PartitionList
= NULL
;
3512 /* Destroy filesystem list */
3513 if (FileSystemList
!= NULL
)
3515 DestroyFileSystemList (FileSystemList
);
3516 FileSystemList
= NULL
;
3519 /* Destroy computer settings list */
3520 if (ComputerList
!= NULL
)
3522 DestroyGenericList(ComputerList
, TRUE
);
3523 ComputerList
= NULL
;
3526 /* Destroy display settings list */
3527 if (DisplayList
!= NULL
)
3529 DestroyGenericList(DisplayList
, TRUE
);
3533 /* Destroy keyboard settings list */
3534 if (KeyboardList
!= NULL
)
3536 DestroyGenericList(KeyboardList
, TRUE
);
3537 KeyboardList
= NULL
;
3540 /* Destroy keyboard layout list */
3541 if (LayoutList
!= NULL
)
3543 DestroyGenericList(LayoutList
, TRUE
);
3547 SetStatusText(" ENTER = Reboot computer");
3553 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3562 SuccessPage(PINPUT_RECORD Ir
)
3564 SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully.");
3566 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3567 SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
3569 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3571 SetStatusText(" ENTER = Reboot computer");
3573 if (IsUnattendedSetup
)
3582 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3591 FlushPage(PINPUT_RECORD Ir
)
3593 SetTextXY(10, 6, "The system is now making sure all data is stored on your disk");
3595 SetTextXY(10, 8, "This may take a minute");
3596 SetTextXY(10, 9, "When finished, your computer will reboot automatically");
3598 SetStatusText(" Flushing cache");
3608 OBJECT_ATTRIBUTES ObjectAttributes
;
3609 UNICODE_STRING UnicodeString
= RTL_CONSTANT_STRING(L
"\\ReactOSInitDone");
3610 HANDLE ReactOSInitEvent
;
3612 InitializeObjectAttributes(&ObjectAttributes
,
3617 Status
= NtOpenEvent(&ReactOSInitEvent
,
3620 if (NT_SUCCESS(Status
))
3622 LARGE_INTEGER Timeout
;
3623 /* This will cause the boot screen image to go away (if displayed) */
3624 NtPulseEvent(ReactOSInitEvent
, NULL
);
3626 /* Wait for the display mode to be changed (if in graphics mode) */
3627 Timeout
.QuadPart
= -50000000LL; /* 5 second timeout */
3628 NtWaitForSingleObject(ReactOSInitEvent
, FALSE
, &Timeout
);
3630 NtClose(ReactOSInitEvent
);
3634 /* We don't really care if this fails */
3635 DPRINT1("USETUP: Failed to open ReactOS init notification event\n");
3641 NtProcessStartup(PPEB Peb
)
3647 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3649 ProcessHeap
= Peb
->ProcessHeap
;
3653 Status
= AllocConsole();
3654 if (!NT_SUCCESS(Status
))
3656 PrintString("AllocConsole() failed (Status = 0x%08lx)\n", Status
);
3658 /* Raise a hard error (crash the system/BSOD) */
3659 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3664 /* Initialize global unicode strings */
3665 RtlInitUnicodeString(&SourcePath
, NULL
);
3666 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3667 RtlInitUnicodeString(&InstallPath
, NULL
);
3668 RtlInitUnicodeString(&DestinationPath
, NULL
);
3669 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3670 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3671 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3673 /* Hide the cursor */
3674 SetCursorType(TRUE
, FALSE
);
3677 while (Page
!= REBOOT_PAGE
)
3681 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3687 Page
= SetupStartPage(&Ir
);
3692 Page
= LicensePage(&Ir
);
3697 Page
= WarningPage(&Ir
);
3702 Page
= IntroPage(&Ir
);
3706 case INSTALL_INTRO_PAGE
:
3707 Page
= InstallIntroPage(&Ir
);
3711 case SCSI_CONTROLLER_PAGE
:
3712 Page
= ScsiControllerPage(&Ir
);
3717 case OEM_DRIVER_PAGE
:
3718 Page
= OemDriverPage(&Ir
);
3722 case DEVICE_SETTINGS_PAGE
:
3723 Page
= DeviceSettingsPage(&Ir
);
3726 case COMPUTER_SETTINGS_PAGE
:
3727 Page
= ComputerSettingsPage(&Ir
);
3730 case DISPLAY_SETTINGS_PAGE
:
3731 Page
= DisplaySettingsPage(&Ir
);
3734 case KEYBOARD_SETTINGS_PAGE
:
3735 Page
= KeyboardSettingsPage(&Ir
);
3738 case LAYOUT_SETTINGS_PAGE
:
3739 Page
= LayoutSettingsPage(&Ir
);
3742 case SELECT_PARTITION_PAGE
:
3743 Page
= SelectPartitionPage(&Ir
);
3746 case CREATE_PARTITION_PAGE
:
3747 Page
= CreatePartitionPage(&Ir
);
3750 case DELETE_PARTITION_PAGE
:
3751 Page
= DeletePartitionPage(&Ir
);
3754 case SELECT_FILE_SYSTEM_PAGE
:
3755 Page
= SelectFileSystemPage(&Ir
);
3758 case FORMAT_PARTITION_PAGE
:
3759 Page
= FormatPartitionPage(&Ir
);
3762 case CHECK_FILE_SYSTEM_PAGE
:
3763 Page
= CheckFileSystemPage(&Ir
);
3766 case INSTALL_DIRECTORY_PAGE
:
3767 Page
= InstallDirectoryPage(&Ir
);
3770 case PREPARE_COPY_PAGE
:
3771 Page
= PrepareCopyPage(&Ir
);
3774 case FILE_COPY_PAGE
:
3775 Page
= FileCopyPage(&Ir
);
3779 Page
= RegistryPage(&Ir
);
3782 case BOOT_LOADER_PAGE
:
3783 Page
= BootLoaderPage(&Ir
);
3786 case BOOT_LOADER_FLOPPY_PAGE
:
3787 Page
= BootLoaderFloppyPage(&Ir
);
3790 case BOOT_LOADER_HARDDISK_PAGE
:
3791 Page
= BootLoaderHarddiskPage(&Ir
);
3796 case REPAIR_INTRO_PAGE
:
3797 Page
= RepairIntroPage(&Ir
);
3801 Page
= SuccessPage(&Ir
);
3805 Page
= FlushPage(&Ir
);
3809 Page
= QuitPage(&Ir
);
3819 NtShutdownSystem(ShutdownReboot
);
3820 NtTerminateProcess(NtCurrentProcess(), 0);