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)
26 * Hervé Poussineau (hpoussin@reactos.org)
34 /* GLOBALS ******************************************************************/
37 UNICODE_STRING SourceRootPath
;
38 UNICODE_STRING SourceRootDir
;
39 UNICODE_STRING SourcePath
;
40 BOOLEAN IsUnattendedSetup
= FALSE
;
41 LONG UnattendDestinationDiskNumber
;
42 LONG UnattendDestinationPartitionNumber
;
43 LONG UnattendMBRInstallType
= -1;
44 LONG UnattendFormatPartition
= 0;
45 LONG AutoPartition
= 0;
46 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
47 PWCHAR SelectedLanguageId
;
48 BOOLEAN RepairUpdateFlag
= FALSE
;
49 HANDLE hPnpThread
= INVALID_HANDLE_VALUE
;
51 /* LOCALS *******************************************************************/
53 static PPARTLIST PartitionList
= NULL
;
55 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
57 static UNICODE_STRING InstallPath
;
59 /* Path to the install directory */
60 static UNICODE_STRING DestinationPath
;
61 static UNICODE_STRING DestinationArcPath
;
62 static UNICODE_STRING DestinationRootPath
;
64 /* Path to the active partition (boot manager) */
65 static UNICODE_STRING SystemRootPath
;
69 static HSPFILEQ SetupFileQueue
= NULL
;
71 static BOOLEAN WarnLinuxPartitions
= TRUE
;
73 static PGENERIC_LIST ComputerList
= NULL
;
74 static PGENERIC_LIST DisplayList
= NULL
;
75 static PGENERIC_LIST KeyboardList
= NULL
;
76 static PGENERIC_LIST LayoutList
= NULL
;
77 static PGENERIC_LIST LanguageList
= NULL
;
79 /* FUNCTIONS ****************************************************************/
82 PrintString(char* fmt
,...)
86 UNICODE_STRING UnicodeString
;
87 ANSI_STRING AnsiString
;
90 vsprintf(buffer
, fmt
, ap
);
93 RtlInitAnsiString(&AnsiString
, buffer
);
94 RtlAnsiStringToUnicodeString(&UnicodeString
,
97 NtDisplayString(&UnicodeString
);
98 RtlFreeUnicodeString(&UnicodeString
);
112 /* draw upper left corner */
115 FillConsoleOutputCharacterA(
122 /* draw upper edge */
125 FillConsoleOutputCharacterA(
132 /* draw upper right corner */
133 coPos
.X
= xLeft
+ Width
- 1;
135 FillConsoleOutputCharacterA(
142 /* Draw right edge, inner space and left edge */
143 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
146 FillConsoleOutputCharacterA(
154 FillConsoleOutputCharacterA(
161 coPos
.X
= xLeft
+ Width
- 1;
162 FillConsoleOutputCharacterA(
170 /* draw lower left corner */
172 coPos
.Y
= yTop
+ Height
- 1;
173 FillConsoleOutputCharacterA(
180 /* draw lower edge */
182 coPos
.Y
= yTop
+ Height
- 1;
183 FillConsoleOutputCharacterA(
190 /* draw lower right corner */
191 coPos
.X
= xLeft
+ Width
- 1;
192 coPos
.Y
= yTop
+ Height
- 1;
193 FillConsoleOutputCharacterA(
202 PopupError(PCHAR Text
,
220 /* Count text lines and longest line */
226 p
= strchr(pnext
, '\n');
229 Length
= strlen(pnext
);
234 Length
= (ULONG
)(p
- pnext
);
239 if (Length
> MaxLength
)
242 if (LastLine
== TRUE
)
248 /* Check length of status line */
251 Length
= strlen(Status
);
252 if (Length
> MaxLength
)
256 Width
= MaxLength
+ 4;
261 yTop
= (yScreen
- Height
) / 2;
262 xLeft
= (xScreen
- Width
) / 2;
265 /* Set screen attributes */
267 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
269 FillConsoleOutputAttribute(StdOutput
,
270 FOREGROUND_RED
| BACKGROUND_WHITE
,
276 DrawBox(xLeft
, yTop
, Width
, Height
);
278 /* Print message text */
283 p
= strchr(pnext
, '\n');
286 Length
= strlen(pnext
);
291 Length
= (ULONG
)(p
- pnext
);
298 WriteConsoleOutputCharacterA(StdOutput
,
305 if (LastLine
== TRUE
)
312 /* Print separator line and status text */
315 coPos
.Y
= yTop
+ Height
- 3;
317 FillConsoleOutputCharacterA(StdOutput
,
324 FillConsoleOutputCharacterA(StdOutput
,
330 coPos
.X
= xLeft
+ Width
- 1;
331 FillConsoleOutputCharacterA(StdOutput
,
339 WriteConsoleOutputCharacterA(StdOutput
,
341 min(strlen(Status
), (SIZE_T
)Width
- 4),
346 if (WaitEvent
== POPUP_WAIT_NONE
)
351 CONSOLE_ConInKey(Ir
);
353 if (WaitEvent
== POPUP_WAIT_ANY_KEY
354 || Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D)
366 * FALSE: Don't quit setup.
369 ConfirmQuit(PINPUT_RECORD Ir
)
372 MUIDisplayError(ERROR_NOT_INSTALLED
, NULL
, POPUP_WAIT_NONE
);
376 CONSOLE_ConInKey(Ir
);
378 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
379 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
384 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
396 CheckUnattendedSetup(VOID
)
398 WCHAR UnattendInfPath
[MAX_PATH
];
405 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
407 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
411 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
412 wcscat(UnattendInfPath
, L
"\\unattend.inf");
414 /* Load 'unattend.inf' from install media. */
415 UnattendInf
= SetupOpenInfFileW(UnattendInfPath
,
419 if (UnattendInf
== INVALID_HANDLE_VALUE
)
421 DPRINT("SetupOpenInfFileW() failed\n");
425 /* Open 'Unattend' section */
426 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
428 DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n");
429 SetupCloseInfFile(UnattendInf
);
433 /* Get pointer 'Signature' key */
434 if (!INF_GetData(&Context
, NULL
, &Value
))
436 DPRINT("INF_GetData() failed for key 'Signature'\n");
437 SetupCloseInfFile(UnattendInf
);
441 /* Check 'Signature' string */
442 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
444 DPRINT("Signature not $ReactOS$\n");
445 SetupCloseInfFile(UnattendInf
);
449 /* Check if Unattend setup is enabled */
450 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"UnattendSetupEnabled", &Context
))
452 DPRINT("Can't find key 'UnattendSetupEnabled'\n");
453 SetupCloseInfFile(UnattendInf
);
456 if (!INF_GetData(&Context
, NULL
, &Value
))
458 DPRINT("Can't read key 'UnattendSetupEnabled'\n");
459 SetupCloseInfFile(UnattendInf
);
462 if (_wcsicmp(Value
, L
"yes") != 0)
464 DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
465 SetupCloseInfFile(UnattendInf
);
469 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
470 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
472 DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n");
473 SetupCloseInfFile(UnattendInf
);
476 if (!SetupGetIntField(&Context
, 1, &IntValue
))
478 DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n");
479 SetupCloseInfFile(UnattendInf
);
482 UnattendDestinationDiskNumber
= (LONG
)IntValue
;
484 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
485 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
487 DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
488 SetupCloseInfFile(UnattendInf
);
491 if (!SetupGetIntField(&Context
, 1, &IntValue
))
493 DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n");
494 SetupCloseInfFile(UnattendInf
);
497 UnattendDestinationPartitionNumber
= IntValue
;
499 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
500 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
502 DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
503 SetupCloseInfFile(UnattendInf
);
507 /* Get pointer 'InstallationDirectory' key */
508 if (!INF_GetData(&Context
, NULL
, &Value
))
510 DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
511 SetupCloseInfFile(UnattendInf
);
514 wcscpy(UnattendInstallationDirectory
, Value
);
516 IsUnattendedSetup
= TRUE
;
518 /* Search for 'MBRInstallType' in the 'Unattend' section */
519 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"MBRInstallType", &Context
))
521 if (SetupGetIntField(&Context
, 1, &IntValue
))
523 UnattendMBRInstallType
= IntValue
;
526 /* Search for 'FormatPartition' in the 'Unattend' section */
527 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"FormatPartition", &Context
))
529 if (SetupGetIntField(&Context
, 1, &IntValue
))
531 UnattendFormatPartition
= IntValue
;
534 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"AutoPartition", &Context
))
536 if (SetupGetIntField(&Context
, 1, &IntValue
))
538 AutoPartition
= IntValue
;
541 SetupCloseInfFile(UnattendInf
);
543 DPRINT("Running unattended setup\n");
547 LanguagePage(PINPUT_RECORD Ir
)
549 /* Initialize the computer settings list */
550 if (LanguageList
== NULL
)
552 LanguageList
= CreateLanguageList(SetupInf
);
553 if (LanguageList
== NULL
)
555 PopupError("Setup failed to initialize available translations", NULL
, NULL
, POPUP_WAIT_NONE
);
560 DrawGenericList(LanguageList
,
566 MUIDisplayPage(LANGUAGE_PAGE
);
570 CONSOLE_ConInKey(Ir
);
572 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
573 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
575 #if 0 //Dinamically update user interface
576 SelectedLanguageId
= (PWCHAR
)LanguageList
->CurrentEntry
->UserData
;
577 MUIDisplayPage(LANGUAGE_PAGE
);
579 ScrollDownGenericList (LanguageList
);
581 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
582 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
585 SelectedLanguageId
= (PWCHAR
)LanguageList
->CurrentEntry
->UserData
;
586 MUIDisplayPage(LANGUAGE_PAGE
);
588 ScrollUpGenericList (LanguageList
);
590 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
591 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
593 if (ConfirmQuit(Ir
) == TRUE
)
596 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
598 SelectedLanguageId
= (PWCHAR
)LanguageList
->CurrentEntry
->UserData
;
610 * Number of the next page.
613 SetupStartPage(PINPUT_RECORD Ir
)
615 SYSTEM_DEVICE_INFORMATION Sdi
;
617 WCHAR FileNameBuffer
[MAX_PATH
];
623 CONSOLE_SetStatusText(" Please wait...");
626 /* Check whether a harddisk is available */
627 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
629 sizeof(SYSTEM_DEVICE_INFORMATION
),
631 if (!NT_SUCCESS (Status
))
633 CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
634 MUIDisplayError(ERROR_DRIVE_INFORMATION
, Ir
, POPUP_WAIT_ENTER
);
638 if (Sdi
.NumberOfDisks
== 0)
640 MUIDisplayError(ERROR_NO_HDD
, Ir
, POPUP_WAIT_ENTER
);
644 /* Get the source path and source root path */
645 Status
= GetSourcePaths(&SourcePath
,
648 if (!NT_SUCCESS(Status
))
650 CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status
);
651 MUIDisplayError(ERROR_NO_SOURCE_DRIVE
, Ir
, POPUP_WAIT_ENTER
);
657 CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
658 CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
659 CONSOLE_PrintTextXY(6, 17, "SourceRootDir: '%wZ'", &SourceRootDir
);
663 /* Load txtsetup.sif from install media. */
664 wcscpy(FileNameBuffer
, SourcePath
.Buffer
);
665 wcscat(FileNameBuffer
, L
"\\txtsetup.sif");
667 SetupInf
= SetupOpenInfFileW(FileNameBuffer
,
671 if (SetupInf
== INVALID_HANDLE_VALUE
)
673 MUIDisplayError(ERROR_LOAD_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
677 /* Open 'Version' section */
678 if (!SetupFindFirstLineW (SetupInf
, L
"Version", L
"Signature", &Context
))
680 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
685 /* Get pointer 'Signature' key */
686 if (!INF_GetData (&Context
, NULL
, &Value
))
688 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
692 /* Check 'Signature' string */
693 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
695 MUIDisplayError(ERROR_SIGNATURE_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
699 /* Start PnP thread */
700 if (hPnpThread
!= INVALID_HANDLE_VALUE
)
702 //HACK: Commented out till the problem with CM is solved
703 //NtResumeThread(hPnpThread, NULL);
704 hPnpThread
= INVALID_HANDLE_VALUE
;
707 CheckUnattendedSetup();
709 if (IsUnattendedSetup
)
712 //read options from inf
713 ComputerList
= CreateComputerTypeList(SetupInf
);
714 DisplayList
= CreateDisplayDriverList(SetupInf
);
715 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
716 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
717 LanguageList
= CreateLanguageList(SetupInf
);
719 return INSTALL_INTRO_PAGE
;
722 return LANGUAGE_PAGE
;
732 IntroPage(PINPUT_RECORD Ir
)
734 MUIDisplayPage(START_PAGE
);
738 CONSOLE_ConInKey(Ir
);
740 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
741 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
743 if (ConfirmQuit(Ir
) == TRUE
)
747 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
749 return INSTALL_INTRO_PAGE
;
752 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
754 return REPAIR_INTRO_PAGE
;
757 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* R */
770 * Back to main setup page.
773 LicensePage(PINPUT_RECORD Ir
)
775 MUIDisplayPage(LICENSE_PAGE
);
779 CONSOLE_ConInKey(Ir
);
781 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
792 RepairIntroPage(PINPUT_RECORD Ir
)
794 MUIDisplayPage(REPAIR_INTRO_PAGE
);
798 CONSOLE_ConInKey(Ir
);
800 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
804 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'U') /* U */
806 RepairUpdateFlag
= TRUE
;
807 return INSTALL_INTRO_PAGE
;
809 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
813 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
814 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
820 return REPAIR_INTRO_PAGE
;
825 InstallIntroPage(PINPUT_RECORD Ir
)
827 MUIDisplayPage(INSTALL_INTRO_PAGE
);
829 if (RepairUpdateFlag
)
831 //return SELECT_PARTITION_PAGE;
832 return DEVICE_SETTINGS_PAGE
;
835 if (IsUnattendedSetup
)
837 return SELECT_PARTITION_PAGE
;
842 CONSOLE_ConInKey(Ir
);
844 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
845 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
847 if (ConfirmQuit(Ir
) == TRUE
)
851 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
853 return DEVICE_SETTINGS_PAGE
;
854 // return SCSI_CONTROLLER_PAGE;
858 return INSTALL_INTRO_PAGE
;
864 ScsiControllerPage(PINPUT_RECORD Ir
)
866 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
868 /* FIXME: print loaded mass storage driver descriptions */
870 SetTextXY(8, 10, "TEST device");
874 SetStatusText(" ENTER = Continue F3 = Quit");
880 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
881 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
883 if (ConfirmQuit(Ir
) == TRUE
)
887 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
889 return DEVICE_SETTINGS_PAGE
;
893 return SCSI_CONTROLLER_PAGE
;
899 DeviceSettingsPage(PINPUT_RECORD Ir
)
901 static ULONG Line
= 16;
902 MUIDisplayPage(DEVICE_SETTINGS_PAGE
);
904 /* Initialize the computer settings list */
905 if (ComputerList
== NULL
)
907 ComputerList
= CreateComputerTypeList(SetupInf
);
908 if (ComputerList
== NULL
)
910 MUIDisplayError(ERROR_LOAD_COMPUTER
, Ir
, POPUP_WAIT_ENTER
);
915 /* Initialize the display settings list */
916 if (DisplayList
== NULL
)
918 DisplayList
= CreateDisplayDriverList(SetupInf
);
919 if (DisplayList
== NULL
)
921 MUIDisplayError(ERROR_LOAD_DISPLAY
, Ir
, POPUP_WAIT_ENTER
);
926 /* Initialize the keyboard settings list */
927 if (KeyboardList
== NULL
)
929 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
930 if (KeyboardList
== NULL
)
932 MUIDisplayError(ERROR_LOAD_KEYBOARD
, Ir
, POPUP_WAIT_ENTER
);
937 /* Initialize the keyboard layout list */
938 if (LayoutList
== NULL
)
940 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
941 if (LayoutList
== NULL
)
943 /* FIXME: report error */
944 MUIDisplayError(ERROR_LOAD_KBLAYOUT
, Ir
, POPUP_WAIT_ENTER
);
949 MUIDisplayPage(DEVICE_SETTINGS_PAGE
);
952 CONSOLE_SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
953 CONSOLE_SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
954 CONSOLE_SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
955 CONSOLE_SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
957 CONSOLE_InvertTextXY (24, Line
, 48, 1);
959 if (RepairUpdateFlag
)
961 return SELECT_PARTITION_PAGE
;
966 CONSOLE_ConInKey(Ir
);
968 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
969 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
971 CONSOLE_NormalTextXY (24, Line
, 48, 1);
978 CONSOLE_InvertTextXY (24, Line
, 48, 1);
980 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
981 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
983 CONSOLE_NormalTextXY (24, Line
, 48, 1);
990 CONSOLE_InvertTextXY (24, Line
, 48, 1);
992 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
993 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
995 if (ConfirmQuit(Ir
) == TRUE
)
999 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1002 return COMPUTER_SETTINGS_PAGE
;
1003 else if (Line
== 12)
1004 return DISPLAY_SETTINGS_PAGE
;
1005 else if (Line
== 13)
1006 return KEYBOARD_SETTINGS_PAGE
;
1007 else if (Line
== 14)
1008 return LAYOUT_SETTINGS_PAGE
;
1009 else if (Line
== 16)
1010 return SELECT_PARTITION_PAGE
;
1014 return DEVICE_SETTINGS_PAGE
;
1019 ComputerSettingsPage(PINPUT_RECORD Ir
)
1021 MUIDisplayPage(COMPUTER_SETTINGS_PAGE
);
1023 DrawGenericList(ComputerList
,
1029 SaveGenericListState(ComputerList
);
1033 CONSOLE_ConInKey(Ir
);
1035 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1036 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1038 ScrollDownGenericList (ComputerList
);
1040 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1041 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1043 ScrollUpGenericList (ComputerList
);
1045 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1046 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1048 if (ConfirmQuit(Ir
) == TRUE
)
1052 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1053 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1055 RestoreGenericListState(ComputerList
);
1056 return DEVICE_SETTINGS_PAGE
;
1058 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1060 return DEVICE_SETTINGS_PAGE
;
1064 return COMPUTER_SETTINGS_PAGE
;
1069 DisplaySettingsPage(PINPUT_RECORD Ir
)
1071 MUIDisplayPage(DISPLAY_SETTINGS_PAGE
);
1073 DrawGenericList(DisplayList
,
1079 SaveGenericListState(DisplayList
);
1083 CONSOLE_ConInKey(Ir
);
1085 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1086 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1088 ScrollDownGenericList (DisplayList
);
1090 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1091 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1093 ScrollUpGenericList (DisplayList
);
1095 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1096 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1098 if (ConfirmQuit(Ir
) == TRUE
)
1104 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1105 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1107 RestoreGenericListState(DisplayList
);
1108 return DEVICE_SETTINGS_PAGE
;
1110 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1112 return DEVICE_SETTINGS_PAGE
;
1116 return DISPLAY_SETTINGS_PAGE
;
1121 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1123 MUIDisplayPage(KEYBOARD_SETTINGS_PAGE
);
1125 DrawGenericList(KeyboardList
,
1133 SaveGenericListState(KeyboardList
);
1137 CONSOLE_ConInKey(Ir
);
1139 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1140 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1142 ScrollDownGenericList (KeyboardList
);
1144 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1145 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1147 ScrollUpGenericList (KeyboardList
);
1149 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1150 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1152 if (ConfirmQuit(Ir
) == TRUE
)
1156 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1157 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1159 RestoreGenericListState(KeyboardList
);
1160 return DEVICE_SETTINGS_PAGE
;
1162 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1164 return DEVICE_SETTINGS_PAGE
;
1168 return DISPLAY_SETTINGS_PAGE
;
1173 LayoutSettingsPage(PINPUT_RECORD Ir
)
1175 MUIDisplayPage(LAYOUT_SETTINGS_PAGE
);
1177 DrawGenericList(LayoutList
,
1183 SaveGenericListState(LayoutList
);
1187 CONSOLE_ConInKey(Ir
);
1189 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1190 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1192 ScrollDownGenericList (LayoutList
);
1194 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1195 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1197 ScrollUpGenericList (LayoutList
);
1199 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1200 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1202 if (ConfirmQuit(Ir
) == TRUE
)
1206 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1207 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1209 RestoreGenericListState(LayoutList
);
1210 return DEVICE_SETTINGS_PAGE
;
1212 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1214 return DEVICE_SETTINGS_PAGE
;
1218 return DISPLAY_SETTINGS_PAGE
;
1223 SelectPartitionPage(PINPUT_RECORD Ir
)
1225 MUIDisplayPage(SELECT_PARTITION_PAGE
);
1227 if (PartitionList
== NULL
)
1229 PartitionList
= CreatePartitionList (2,
1233 if (PartitionList
== NULL
)
1235 /* FIXME: show an error dialog */
1240 CheckActiveBootPartition (PartitionList
);
1242 DrawPartitionList (PartitionList
);
1244 /* Warn about partitions created by Linux Fdisk */
1245 if (WarnLinuxPartitions
== TRUE
&&
1246 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1248 MUIDisplayError(ERROR_WARN_PARTITION
, NULL
, POPUP_WAIT_NONE
);
1251 CONSOLE_ConInKey (Ir
);
1253 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1254 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1258 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1260 WarnLinuxPartitions
= FALSE
;
1261 return SELECT_PARTITION_PAGE
;
1266 if (IsUnattendedSetup
)
1268 if (!SelectPartition(PartitionList
, UnattendDestinationDiskNumber
, UnattendDestinationPartitionNumber
))
1272 PPARTENTRY PartEntry
= PartEntry
= PartitionList
->CurrentPartition
;
1273 ULONG MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1274 CreateNewPartition (PartitionList
,
1277 return (SELECT_FILE_SYSTEM_PAGE
);
1282 return(SELECT_FILE_SYSTEM_PAGE
);
1288 /* Update status text */
1289 if (PartitionList
->CurrentPartition
== NULL
||
1290 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1292 CONSOLE_SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1296 CONSOLE_SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1299 CONSOLE_ConInKey(Ir
);
1301 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1302 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1304 if (ConfirmQuit(Ir
) == TRUE
)
1306 DestroyPartitionList (PartitionList
);
1307 PartitionList
= NULL
;
1312 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1313 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1315 ScrollDownPartitionList (PartitionList
);
1317 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1318 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1320 ScrollUpPartitionList (PartitionList
);
1322 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1324 if (PartitionList
->CurrentPartition
== NULL
||
1325 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1327 CreateNewPartition (PartitionList
,
1332 return SELECT_FILE_SYSTEM_PAGE
;
1334 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'C') /* C */
1336 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1338 MUIDisplayError(ERROR_NEW_PARTITION
, Ir
, POPUP_WAIT_ANY_KEY
);
1339 return SELECT_PARTITION_PAGE
;
1342 return CREATE_PARTITION_PAGE
;
1344 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1346 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1348 MUIDisplayError(ERROR_DELETE_SPACE
, Ir
, POPUP_WAIT_ANY_KEY
);
1349 return SELECT_PARTITION_PAGE
;
1352 return DELETE_PARTITION_PAGE
;
1356 return SELECT_PARTITION_PAGE
;
1361 DrawInputField(ULONG FieldLength
,
1372 memset(buf
, '_', sizeof(buf
));
1373 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1374 strcat(buf
, FieldContent
);
1376 WriteConsoleOutputCharacterA (StdOutput
,
1384 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1387 ShowPartitionSizeInputBox(SHORT Left
,
1411 DrawBox(Left
, Top
, Right
- Left
+ 1, Bottom
- Top
+ 1);
1416 strcpy (Buffer
, "Size of new partition:");
1417 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1419 WriteConsoleOutputCharacterA (StdOutput
,
1425 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1426 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1428 WriteConsoleOutputCharacterA (StdOutput
,
1434 sprintf(Buffer
, "%lu", MaxSize
);
1435 Index
= strlen(Buffer
);
1436 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1443 CONSOLE_ConInKey (&Ir
);
1445 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1446 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1453 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1457 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1464 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1469 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1474 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1475 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1477 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1478 if ((ch
>= '0') && (ch
<= '9'))
1483 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1491 strcpy (InputBuffer
,
1497 CreatePartitionPage (PINPUT_RECORD Ir
)
1499 PDISKENTRY DiskEntry
;
1500 PPARTENTRY PartEntry
;
1503 CHAR InputBuffer
[50];
1509 if (PartitionList
== NULL
||
1510 PartitionList
->CurrentDisk
== NULL
||
1511 PartitionList
->CurrentPartition
== NULL
)
1513 /* FIXME: show an error dialog */
1517 DiskEntry
= PartitionList
->CurrentDisk
;
1518 PartEntry
= PartitionList
->CurrentPartition
;
1520 CONSOLE_SetStatusText (" Please wait...");
1522 CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on");
1525 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1527 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1533 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1539 if (DiskEntry
->DriverName
.Length
> 0)
1541 CONSOLE_PrintTextXY (6, 10,
1542 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1545 DiskEntry
->DiskNumber
,
1549 &DiskEntry
->DriverName
);
1553 CONSOLE_PrintTextXY (6, 10,
1554 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1557 DiskEntry
->DiskNumber
,
1564 CONSOLE_SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1567 CONSOLE_PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1568 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1571 CONSOLE_SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1573 PartEntry
= PartitionList
->CurrentPartition
;
1576 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1577 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1578 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1581 if (ConfirmQuit (Ir
) == TRUE
)
1586 else if (Cancel
== TRUE
)
1588 return SELECT_PARTITION_PAGE
;
1592 PartSize
= atoi (InputBuffer
);
1599 if (PartSize
> MaxSize
)
1605 /* Convert to bytes */
1606 if (PartSize
== MaxSize
)
1608 /* Use all of the unpartitioned disk space */
1609 PartSize
= PartEntry
->UnpartitionedLength
;
1613 /* Round-up by cylinder size */
1614 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1615 DiskEntry
->CylinderSize
);
1617 /* But never get larger than the unpartitioned disk space */
1618 if (PartSize
> PartEntry
->UnpartitionedLength
)
1619 PartSize
= PartEntry
->UnpartitionedLength
;
1622 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1624 CreateNewPartition (PartitionList
,
1628 return SELECT_PARTITION_PAGE
;
1632 return CREATE_PARTITION_PAGE
;
1637 DeletePartitionPage (PINPUT_RECORD Ir
)
1639 PDISKENTRY DiskEntry
;
1640 PPARTENTRY PartEntry
;
1646 if (PartitionList
== NULL
||
1647 PartitionList
->CurrentDisk
== NULL
||
1648 PartitionList
->CurrentPartition
== NULL
)
1650 /* FIXME: show an error dialog */
1654 DiskEntry
= PartitionList
->CurrentDisk
;
1655 PartEntry
= PartitionList
->CurrentPartition
;
1657 MUIDisplayPage(DELETE_PARTITION_PAGE
);
1659 /* Determine partition type */
1661 if (PartEntry
->New
== TRUE
)
1663 PartType
= "New (Unformatted)";
1665 else if (PartEntry
->Unpartitioned
== FALSE
)
1667 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1668 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1669 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1670 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1674 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1675 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1679 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1681 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1686 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
1688 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1693 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000LL
) /* 10 MB */
1695 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1700 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1704 if (PartType
== NULL
)
1706 CONSOLE_PrintTextXY (6, 10,
1707 " %c%c Type %lu %I64u %s",
1708 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1709 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1710 PartEntry
->PartInfo
[0].PartitionType
,
1716 CONSOLE_PrintTextXY (6, 10,
1717 " %c%c %s %I64u %s",
1718 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1719 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1726 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1728 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1734 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1740 if (DiskEntry
->DriverName
.Length
> 0)
1742 CONSOLE_PrintTextXY (6, 12,
1743 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1746 DiskEntry
->DiskNumber
,
1750 &DiskEntry
->DriverName
);
1754 CONSOLE_PrintTextXY (6, 12,
1755 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1758 DiskEntry
->DiskNumber
,
1766 CONSOLE_ConInKey (Ir
);
1768 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1769 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1771 if (ConfirmQuit (Ir
) == TRUE
)
1777 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
1779 return SELECT_PARTITION_PAGE
;
1781 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1783 DeleteCurrentPartition (PartitionList
);
1785 return SELECT_PARTITION_PAGE
;
1789 return DELETE_PARTITION_PAGE
;
1794 SelectFileSystemPage (PINPUT_RECORD Ir
)
1796 PDISKENTRY DiskEntry
;
1797 PPARTENTRY PartEntry
;
1804 if (PartitionList
== NULL
||
1805 PartitionList
->CurrentDisk
== NULL
||
1806 PartitionList
->CurrentPartition
== NULL
)
1808 /* FIXME: show an error dialog */
1812 DiskEntry
= PartitionList
->CurrentDisk
;
1813 PartEntry
= PartitionList
->CurrentPartition
;
1815 /* adjust disk size */
1816 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1818 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1823 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1827 /* adjust partition size */
1828 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
1830 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1835 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1839 /* adjust partition type */
1840 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1841 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1842 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1843 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1847 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1848 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1852 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1854 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1856 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
1858 PartType
= "Unused";
1862 PartType
= "Unknown";
1865 if (PartEntry
->AutoCreate
== TRUE
)
1867 CONSOLE_SetTextXY(6, 8, "Setup created a new partition on");
1870 CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
1871 PartEntry
->PartInfo
[0].PartitionNumber
,
1877 CONSOLE_PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
1878 DiskEntry
->DiskNumber
,
1884 &DiskEntry
->DriverName
);
1886 CONSOLE_SetTextXY(6, 12, "This Partition will be formatted next.");
1889 PartEntry
->AutoCreate
= FALSE
;
1891 else if (PartEntry
->New
== TRUE
)
1893 CONSOLE_SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
1894 CONSOLE_SetTextXY(6, 10, "This Partition will be formatted next.");
1898 CONSOLE_SetTextXY(6, 8, "Setup install ReactOS onto Partition");
1900 if (PartType
== NULL
)
1902 CONSOLE_PrintTextXY (8, 10,
1903 "%c%c Type %lu %I64u %s",
1904 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1905 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1906 PartEntry
->PartInfo
[0].PartitionType
,
1912 CONSOLE_PrintTextXY (8, 10,
1914 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1915 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1921 CONSOLE_PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
1922 DiskEntry
->DiskNumber
,
1928 &DiskEntry
->DriverName
);
1931 MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE
);
1933 if (FileSystemList
== NULL
)
1935 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, L
"FAT");
1936 if (FileSystemList
== NULL
)
1938 /* FIXME: show an error dialog */
1942 /* FIXME: Add file systems to list */
1944 DrawFileSystemList (FileSystemList
);
1946 if (RepairUpdateFlag
)
1948 return (CHECK_FILE_SYSTEM_PAGE
);
1949 //return SELECT_PARTITION_PAGE;
1952 if (IsUnattendedSetup
)
1954 if (UnattendFormatPartition
)
1956 return FORMAT_PARTITION_PAGE
;
1958 return(CHECK_FILE_SYSTEM_PAGE
);
1963 CONSOLE_ConInKey (Ir
);
1965 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1966 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1968 if (ConfirmQuit (Ir
) == TRUE
)
1974 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1975 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1977 return SELECT_PARTITION_PAGE
;
1979 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1980 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1982 ScrollDownFileSystemList (FileSystemList
);
1984 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1985 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1987 ScrollUpFileSystemList (FileSystemList
);
1989 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1991 if (!FileSystemList
->Selected
->FormatFunc
)
1993 return CHECK_FILE_SYSTEM_PAGE
;
1997 return FORMAT_PARTITION_PAGE
;
2002 return SELECT_FILE_SYSTEM_PAGE
;
2007 FormatPartitionPage (PINPUT_RECORD Ir
)
2009 WCHAR PathBuffer
[MAX_PATH
];
2010 PDISKENTRY DiskEntry
;
2011 PPARTENTRY PartEntry
;
2020 MUIDisplayPage(FORMAT_PARTITION_PAGE
);
2022 if (PartitionList
== NULL
||
2023 PartitionList
->CurrentDisk
== NULL
||
2024 PartitionList
->CurrentPartition
== NULL
)
2026 /* FIXME: show an error dialog */
2030 DiskEntry
= PartitionList
->CurrentDisk
;
2031 PartEntry
= PartitionList
->CurrentPartition
;
2035 if (!IsUnattendedSetup
)
2037 CONSOLE_ConInKey(Ir
);
2040 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2041 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2043 if (ConfirmQuit (Ir
) == TRUE
)
2049 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
|| IsUnattendedSetup
) /* ENTER */
2051 CONSOLE_SetStatusText (" Please wait ...");
2053 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2055 if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"FAT") == 0)
2057 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200LL * 1024LL))
2059 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2060 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2062 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024LL * 255LL * 63LL * 512LL))
2064 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2066 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32LL * 1024LL * 1024LL))
2068 /* FAT16 CHS partition (partiton size < 32MB) */
2069 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2071 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2073 /* FAT16 CHS partition (partition size < 512MB) */
2074 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2078 /* FAT32 CHS partition (partition size >= 512MB) */
2079 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2084 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2086 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2088 /* FAT16 LBA partition (partition size < 512MB) */
2089 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2093 /* FAT32 LBA partition (partition size >= 512MB) */
2094 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2098 else if (!FileSystemList
->Selected
->FormatFunc
)
2102 CheckActiveBootPartition (PartitionList
);
2105 CONSOLE_PrintTextXY (6, 12,
2106 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2107 DiskEntry
->DiskSize
,
2108 DiskEntry
->CylinderSize
,
2109 DiskEntry
->TrackSize
);
2112 DiskEntry
= PartitionList
->CurrentDisk
;
2113 Entry
= DiskEntry
->PartListHead
.Flink
;
2114 while (Entry
!= &DiskEntry
->PartListHead
)
2116 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2118 if (PartEntry
->Unpartitioned
== FALSE
)
2121 for (i
= 0; i
< 4; i
++)
2123 CONSOLE_PrintTextXY (6, Line
,
2124 "%2u: %2u %c %12I64u %12I64u %2u %c",
2126 PartEntry
->PartInfo
[i
].PartitionNumber
,
2127 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2128 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2129 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2130 PartEntry
->PartInfo
[i
].PartitionType
,
2131 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2139 Entry
= Entry
->Flink
;
2142 /* Restore the old entry */
2143 PartEntry
= PartitionList
->CurrentPartition
;
2146 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2148 DPRINT ("WritePartitionsToDisk() failed\n");
2149 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2153 /* Set DestinationRootPath */
2154 RtlFreeUnicodeString (&DestinationRootPath
);
2155 swprintf (PathBuffer
,
2156 L
"\\Device\\Harddisk%lu\\Partition%lu",
2157 PartitionList
->CurrentDisk
->DiskNumber
,
2158 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2159 RtlCreateUnicodeString (&DestinationRootPath
,
2161 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2164 /* Set SystemRootPath */
2165 RtlFreeUnicodeString (&SystemRootPath
);
2166 swprintf (PathBuffer
,
2167 L
"\\Device\\Harddisk%lu\\Partition%lu",
2168 PartitionList
->ActiveBootDisk
->DiskNumber
,
2169 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2170 RtlCreateUnicodeString (&SystemRootPath
,
2172 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2175 if (FileSystemList
->Selected
->FormatFunc
)
2177 Status
= FormatPartition(&DestinationRootPath
, FileSystemList
->Selected
);
2178 if (!NT_SUCCESS(Status
))
2180 DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status
);
2181 /* FIXME: show an error dialog */
2185 PartEntry
->New
= FALSE
;
2187 CheckActiveBootPartition(PartitionList
);
2190 if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"FAT") == 0)
2192 /* FIXME: Install boot code. This is a hack! */
2193 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
)
2194 || (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2196 wcscpy(PathBuffer
, SourceRootPath
.Buffer
);
2197 wcscat(PathBuffer
, L
"\\loader\\fat32.bin");
2199 DPRINT("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2200 DestinationRootPath
.Buffer
);
2201 Status
= InstallFat32BootCodeToDisk(PathBuffer
,
2202 DestinationRootPath
.Buffer
);
2203 if (!NT_SUCCESS(Status
))
2205 DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status
);
2206 /* FIXME: show an error dialog */
2207 DestroyFileSystemList(FileSystemList
);
2208 FileSystemList
= NULL
;
2214 wcscpy(PathBuffer
, SourceRootPath
.Buffer
);
2215 wcscat(PathBuffer
, L
"\\loader\\fat.bin");
2217 DPRINT("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2218 DestinationRootPath
.Buffer
);
2219 Status
= InstallFat16BootCodeToDisk(PathBuffer
,
2220 DestinationRootPath
.Buffer
);
2221 if (!NT_SUCCESS(Status
))
2223 DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2224 /* FIXME: show an error dialog */
2225 DestroyFileSystemList(FileSystemList
);
2226 FileSystemList
= NULL
;
2231 else if (FileSystemList
->Selected
->FormatFunc
)
2233 DestroyFileSystemList(FileSystemList
);
2234 FileSystemList
= NULL
;
2239 CONSOLE_SetStatusText (" Done. Press any key ...");
2240 CONSOLE_ConInKey(Ir
);
2243 DestroyFileSystemList(FileSystemList
);
2244 FileSystemList
= NULL
;
2245 return INSTALL_DIRECTORY_PAGE
;
2249 return FORMAT_PARTITION_PAGE
;
2254 CheckFileSystemPage(PINPUT_RECORD Ir
)
2256 PFILE_SYSTEM_ITEM CurrentFileSystem
;
2257 WCHAR PathBuffer
[MAX_PATH
];
2258 CHAR Buffer
[MAX_PATH
];
2261 /* FIXME: code duplicated in FormatPartitionPage */
2262 /* Set DestinationRootPath */
2263 RtlFreeUnicodeString(&DestinationRootPath
);
2264 swprintf(PathBuffer
,
2265 L
"\\Device\\Harddisk%lu\\Partition%lu",
2266 PartitionList
->CurrentDisk
->DiskNumber
,
2267 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2268 RtlCreateUnicodeString(&DestinationRootPath
, PathBuffer
);
2269 DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2271 /* Set SystemRootPath */
2272 RtlFreeUnicodeString(&SystemRootPath
);
2273 swprintf(PathBuffer
,
2274 L
"\\Device\\Harddisk%lu\\Partition%lu",
2275 PartitionList
->ActiveBootDisk
->DiskNumber
,
2276 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2277 RtlCreateUnicodeString(&SystemRootPath
, PathBuffer
);
2278 DPRINT("SystemRootPath: %wZ\n", &SystemRootPath
);
2280 CONSOLE_SetTextXY(6, 8, "Setup is now checking the selected partition.");
2282 CONSOLE_SetStatusText(" Please wait...");
2284 /* WRONG: first filesystem is not necesseraly the one of the current partition! */
2285 CurrentFileSystem
= CONTAINING_RECORD(FileSystemList
->ListHead
.Flink
, FILE_SYSTEM_ITEM
, ListEntry
);
2287 if (!CurrentFileSystem
->ChkdskFunc
)
2290 "Setup is currently unable to check a partition formatted in %S.\n"
2292 " \x07 Press ENTER to continue Setup.\n"
2293 " \x07 Press F3 to quit Setup.",
2294 CurrentFileSystem
->FileSystem
);
2297 "F3= Quit ENTER = Continue",
2298 NULL
, POPUP_WAIT_NONE
);
2302 CONSOLE_ConInKey(Ir
);
2304 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00
2305 && Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
) /* F3 */
2307 if (ConfirmQuit(Ir
))
2310 return CHECK_FILE_SYSTEM_PAGE
;
2312 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== VK_RETURN
) /* ENTER */
2314 return INSTALL_DIRECTORY_PAGE
;
2320 Status
= ChkdskPartition(&DestinationRootPath
, CurrentFileSystem
);
2321 if (!NT_SUCCESS(Status
))
2323 DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status
);
2324 sprintf(Buffer
, "Setup failed to verify the selected partition.\n"
2325 "(Status 0x%08lx).\n", Status
);
2327 "ENTER = Reboot computer",
2328 Ir
, POPUP_WAIT_ENTER
);
2332 return INSTALL_DIRECTORY_PAGE
;
2338 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2340 WCHAR PathBuffer
[MAX_PATH
];
2342 /* Create 'InstallPath' string */
2343 RtlFreeUnicodeString(&InstallPath
);
2344 RtlCreateUnicodeString(&InstallPath
,
2347 /* Create 'DestinationPath' string */
2348 RtlFreeUnicodeString(&DestinationPath
);
2350 DestinationRootPath
.Buffer
);
2351 if (InstallDir
[0] != L
'\\')
2354 wcscat(PathBuffer
, InstallDir
);
2355 RtlCreateUnicodeString(&DestinationPath
,
2358 /* Create 'DestinationArcPath' */
2359 RtlFreeUnicodeString(&DestinationArcPath
);
2360 swprintf(PathBuffer
,
2361 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2362 DiskEntry
->BiosDiskNumber
,
2363 PartEntry
->PartInfo
[0].PartitionNumber
);
2364 if (InstallDir
[0] != L
'\\')
2367 wcscat(PathBuffer
, InstallDir
);
2368 RtlCreateUnicodeString(&DestinationArcPath
,
2371 return(PREPARE_COPY_PAGE
);
2376 InstallDirectoryPage(PINPUT_RECORD Ir
)
2378 PDISKENTRY DiskEntry
;
2379 PPARTENTRY PartEntry
;
2380 WCHAR InstallDir
[51];
2385 if (PartitionList
== NULL
||
2386 PartitionList
->CurrentDisk
== NULL
||
2387 PartitionList
->CurrentPartition
== NULL
)
2389 /* FIXME: show an error dialog */
2393 DiskEntry
= PartitionList
->CurrentDisk
;
2394 PartEntry
= PartitionList
->CurrentPartition
;
2396 /* Search for 'DefaultPath' in the 'SetupData' section */
2397 if (!SetupFindFirstLineW (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2399 MUIDisplayError(ERROR_FIND_SETUPDATA
, Ir
, POPUP_WAIT_ENTER
);
2403 /* Read the 'DefaultPath' data */
2404 if (INF_GetData (&Context
, NULL
, &DefaultPath
))
2406 wcscpy(InstallDir
, DefaultPath
);
2410 wcscpy(InstallDir
, L
"\\ReactOS");
2412 Length
= wcslen(InstallDir
);
2413 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2414 MUIDisplayPage(INSTALL_DIRECTORY_PAGE
);
2416 if (IsUnattendedSetup
)
2418 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2423 CONSOLE_ConInKey(Ir
);
2425 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2426 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2428 if (ConfirmQuit(Ir
) == TRUE
)
2432 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2434 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2436 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2441 InstallDir
[Length
] = 0;
2442 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2445 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2449 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2451 InstallDir
[Length
] = 0;
2452 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2457 return(INSTALL_DIRECTORY_PAGE
);
2461 AddSectionToCopyQueueCab(HINF InfFile
,
2463 PWCHAR SourceCabinet
,
2464 PCUNICODE_STRING DestinationPath
,
2467 INFCONTEXT FilesContext
;
2468 INFCONTEXT DirContext
;
2470 PWCHAR FileKeyValue
;
2472 PWCHAR TargetFileName
;
2474 /* Search for the SectionName section */
2475 if (!SetupFindFirstLineW (InfFile
, SectionName
, NULL
, &FilesContext
))
2478 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2479 PopupError(Buffer
, "ENTER = Reboot computer", Ir
, POPUP_WAIT_ENTER
);
2484 * Enumerate the files in the section
2485 * and add them to the file queue.
2489 /* Get source file name and target directory id */
2490 if (!INF_GetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2492 /* FIXME: Handle error! */
2493 DPRINT1("INF_GetData() failed\n");
2497 /* Get optional target file name */
2498 if (!INF_GetDataField (&FilesContext
, 2, &TargetFileName
))
2499 TargetFileName
= NULL
;
2501 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2503 /* Lookup target directory */
2504 if (!SetupFindFirstLineW (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2506 /* FIXME: Handle error! */
2507 DPRINT1("SetupFindFirstLine() failed\n");
2511 if (!INF_GetData (&DirContext
, NULL
, &DirKeyValue
))
2513 /* FIXME: Handle error! */
2514 DPRINT1("INF_GetData() failed\n");
2518 if (!SetupQueueCopy(SetupFileQueue
,
2520 SourceRootPath
.Buffer
,
2521 SourceRootDir
.Buffer
,
2526 /* FIXME: Handle error! */
2527 DPRINT1("SetupQueueCopy() failed\n");
2530 while (SetupFindNextLine(&FilesContext
, &FilesContext
));
2536 AddSectionToCopyQueue(HINF InfFile
,
2538 PWCHAR SourceCabinet
,
2539 PCUNICODE_STRING DestinationPath
,
2542 INFCONTEXT FilesContext
;
2543 INFCONTEXT DirContext
;
2545 PWCHAR FileKeyValue
;
2547 PWCHAR TargetFileName
;
2550 return AddSectionToCopyQueueCab(InfFile
, L
"SourceFiles", SourceCabinet
, DestinationPath
, Ir
);
2552 /* Search for the SectionName section */
2553 if (!SetupFindFirstLineW (InfFile
, SectionName
, NULL
, &FilesContext
))
2556 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2557 PopupError(Buffer
, "ENTER = Reboot computer", Ir
, POPUP_WAIT_ENTER
);
2562 * Enumerate the files in the section
2563 * and add them to the file queue.
2567 /* Get source file name and target directory id */
2568 if (!INF_GetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2570 /* FIXME: Handle error! */
2571 DPRINT1("INF_GetData() failed\n");
2575 /* Get target directory id */
2576 if (!INF_GetDataField (&FilesContext
, 13, &FileKeyValue
))
2578 /* FIXME: Handle error! */
2579 DPRINT1("INF_GetData() failed\n");
2583 /* Get optional target file name */
2584 if (!INF_GetDataField (&FilesContext
, 11, &TargetFileName
))
2585 TargetFileName
= NULL
;
2586 else if (!*TargetFileName
)
2587 TargetFileName
= NULL
;
2589 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2591 /* Lookup target directory */
2592 if (!SetupFindFirstLineW (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2594 /* FIXME: Handle error! */
2595 DPRINT1("SetupFindFirstLine() failed\n");
2599 if (!INF_GetData (&DirContext
, NULL
, &DirKeyValue
))
2601 /* FIXME: Handle error! */
2602 DPRINT1("INF_GetData() failed\n");
2606 if (!SetupQueueCopy(SetupFileQueue
,
2608 SourceRootPath
.Buffer
,
2609 SourceRootDir
.Buffer
,
2614 /* FIXME: Handle error! */
2615 DPRINT1("SetupQueueCopy() failed\n");
2618 while (SetupFindNextLine(&FilesContext
, &FilesContext
));
2624 PrepareCopyPageInfFile(HINF InfFile
,
2625 PWCHAR SourceCabinet
,
2628 WCHAR PathBuffer
[MAX_PATH
];
2629 INFCONTEXT DirContext
;
2630 PWCHAR AdditionalSectionName
= NULL
;
2635 /* Add common files */
2636 if (!AddSectionToCopyQueue(InfFile
, L
"SourceDisksFiles", SourceCabinet
, &DestinationPath
, Ir
))
2639 /* Add specific files depending of computer type */
2640 if (SourceCabinet
== NULL
)
2642 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
2644 if (AdditionalSectionName
)
2646 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, &DestinationPath
, Ir
))
2651 /* Create directories */
2655 * Install directories like '\reactos\test' are not handled yet.
2658 /* Get destination path */
2659 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2661 /* Remove trailing backslash */
2662 Length
= wcslen(PathBuffer
);
2663 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2665 PathBuffer
[Length
- 1] = 0;
2668 /* Create the install directory */
2669 Status
= SetupCreateDirectory(PathBuffer
);
2670 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2672 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2673 MUIDisplayError(ERROR_CREATE_INSTALL_DIR
, Ir
, POPUP_WAIT_ENTER
);
2678 /* Search for the 'Directories' section */
2679 if (!SetupFindFirstLineW(InfFile
, L
"Directories", NULL
, &DirContext
))
2683 MUIDisplayError(ERROR_CABINET_SECTION
, Ir
, POPUP_WAIT_ENTER
);
2687 MUIDisplayError(ERROR_TXTSETUP_SECTION
, Ir
, POPUP_WAIT_ENTER
);
2692 /* Enumerate the directory values and create the subdirectories */
2695 if (!INF_GetData (&DirContext
, NULL
, &KeyValue
))
2701 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2703 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2705 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2706 wcscat(PathBuffer
, KeyValue
);
2708 DPRINT("FullPath: '%S'\n", PathBuffer
);
2710 else if (KeyValue
[0] != L
'\\')
2712 DPRINT("RelativePath: '%S'\n", KeyValue
);
2713 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2714 wcscat(PathBuffer
, L
"\\");
2715 wcscat(PathBuffer
, KeyValue
);
2717 DPRINT("FullPath: '%S'\n", PathBuffer
);
2719 Status
= SetupCreateDirectory(PathBuffer
);
2720 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2722 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2723 MUIDisplayError(ERROR_CREATE_DIR
, Ir
, POPUP_WAIT_ENTER
);
2728 while (SetupFindNextLine (&DirContext
, &DirContext
));
2734 PrepareCopyPage(PINPUT_RECORD Ir
)
2737 WCHAR PathBuffer
[MAX_PATH
];
2738 INFCONTEXT CabinetsContext
;
2744 MUIDisplayPage(PREPARE_COPY_PAGE
);
2746 /* Create the file queue */
2747 SetupFileQueue
= SetupOpenFileQueue();
2748 if (SetupFileQueue
== NULL
)
2750 MUIDisplayError(ERROR_COPY_QUEUE
, Ir
, POPUP_WAIT_ENTER
);
2754 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
2759 /* Search for the 'Cabinets' section */
2760 if (!SetupFindFirstLineW (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
2762 return FILE_COPY_PAGE
;
2766 * Enumerate the directory values in the 'Cabinets'
2767 * section and parse their inf files.
2771 if (!INF_GetData (&CabinetsContext
, NULL
, &KeyValue
))
2774 wcscpy(PathBuffer
, SourcePath
.Buffer
);
2775 wcscat(PathBuffer
, L
"\\");
2776 wcscat(PathBuffer
, KeyValue
);
2779 CabinetInitialize();
2780 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
2781 CabinetSetCabinetName(PathBuffer
);
2783 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
2785 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
2787 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
2788 if (InfFileData
== NULL
)
2790 MUIDisplayError(ERROR_CABINET_SCRIPT
, Ir
, POPUP_WAIT_ENTER
);
2796 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
2797 MUIDisplayError(ERROR_CABINET_MISSING
, Ir
, POPUP_WAIT_ENTER
);
2801 InfHandle
= INF_OpenBufferedFileA((CHAR
*) InfFileData
,
2806 if (InfHandle
== INVALID_HANDLE_VALUE
)
2808 MUIDisplayError(ERROR_INVALID_CABINET_INF
, Ir
, POPUP_WAIT_ENTER
);
2814 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
2820 while (SetupFindNextLine (&CabinetsContext
, &CabinetsContext
));
2822 return FILE_COPY_PAGE
;
2827 SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext
,
2830 SYSTEM_PERFORMANCE_INFORMATION PerfInfo
;
2832 /* Get the memory information from the system */
2833 NtQuerySystemInformation(SystemPerformanceInformation
,
2838 /* Check if this is initial setup */
2841 /* Set maximum limits to be total RAM pages */
2842 ProgressSetStepCount(CopyContext
->MemoryBars
[0], PerfInfo
.CommitLimit
);
2843 ProgressSetStepCount(CopyContext
->MemoryBars
[1], PerfInfo
.CommitLimit
);
2844 ProgressSetStepCount(CopyContext
->MemoryBars
[2], PerfInfo
.CommitLimit
);
2847 /* Set current values */
2848 ProgressSetStep(CopyContext
->MemoryBars
[0], PerfInfo
.PagedPoolPages
);
2849 ProgressSetStep(CopyContext
->MemoryBars
[1], PerfInfo
.NonPagedPoolPages
);
2850 ProgressSetStep(CopyContext
->MemoryBars
[2], PerfInfo
.AvailablePages
);
2852 /* Check if memory dropped below 40%! */
2853 if (CopyContext
->MemoryBars
[2]->Percent
<= 40)
2855 /* Wait a while until Mm does its thing */
2856 LARGE_INTEGER Interval
;
2857 Interval
.QuadPart
= -1 * 15 * 1000 * 100;
2858 NtDelayExecution(FALSE
, &Interval
);
2862 static UINT CALLBACK
2863 FileCopyCallback(PVOID Context
,
2868 PCOPYCONTEXT CopyContext
;
2870 CopyContext
= (PCOPYCONTEXT
)Context
;
2872 switch (Notification
)
2874 case SPFILENOTIFY_STARTSUBQUEUE
:
2875 CopyContext
->TotalOperations
= (ULONG
)Param2
;
2876 ProgressSetStepCount(CopyContext
->ProgressBar
,
2877 CopyContext
->TotalOperations
);
2878 SetupUpdateMemoryInfo(CopyContext
, TRUE
);
2881 case SPFILENOTIFY_STARTCOPY
:
2882 /* Display copy message */
2883 CONSOLE_SetStatusText(" \xB3 Copying file: %S", (PWSTR
)Param1
);
2884 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
2887 case SPFILENOTIFY_ENDCOPY
:
2888 CopyContext
->CompletedOperations
++;
2889 ProgressNextStep(CopyContext
->ProgressBar
);
2890 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
2899 FileCopyPage(PINPUT_RECORD Ir
)
2901 COPYCONTEXT CopyContext
;
2903 MUIDisplayPage(FILE_COPY_PAGE
);
2905 /* Create context for the copy process */
2906 CopyContext
.DestinationRootPath
= DestinationRootPath
.Buffer
;
2907 CopyContext
.InstallPath
= InstallPath
.Buffer
;
2908 CopyContext
.TotalOperations
= 0;
2909 CopyContext
.CompletedOperations
= 0;
2911 /* Create the progress bar as well */
2912 CopyContext
.ProgressBar
= CreateProgressBar(13,
2919 "Setup is copying files...");
2921 /* Create the paged pool progress bar */
2922 CopyContext
.MemoryBars
[0] = CreateProgressBar(13,
2931 /* Create the non paged pool progress bar */
2932 CopyContext
.MemoryBars
[1] = CreateProgressBar(28,
2941 /* Create the global memory progress bar */
2942 CopyContext
.MemoryBars
[2] = CreateProgressBar(43,
2951 /* Do the file copying */
2952 SetupCommitFileQueueW(NULL
,
2957 /* If we get here, we're done, so cleanup the queue and progress bar */
2958 SetupCloseFileQueue(SetupFileQueue
);
2959 DestroyProgressBar(CopyContext
.ProgressBar
);
2960 DestroyProgressBar(CopyContext
.MemoryBars
[0]);
2961 DestroyProgressBar(CopyContext
.MemoryBars
[1]);
2962 DestroyProgressBar(CopyContext
.MemoryBars
[2]);
2964 /* Go display the next page */
2965 return REGISTRY_PAGE
;
2969 RegistryPage(PINPUT_RECORD Ir
)
2971 INFCONTEXT InfContext
;
2978 CONSOLE_SetTextXY(6, 8, "Setup is updating the system configuration");
2980 CONSOLE_SetStatusText(" Creating registry hives...");
2982 if (RepairUpdateFlag
)
2984 return SUCCESS_PAGE
;
2987 if (!SetInstallPathValue(&DestinationPath
))
2989 DPRINT("SetInstallPathValue() failed\n");
2990 MUIDisplayError(ERROR_INITIALIZE_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
2994 /* Create the default hives */
2996 Status
= NtInitializeRegistry(CM_BOOT_FLAG_SETUP
);
2997 if (!NT_SUCCESS(Status
))
2999 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3000 MUIDisplayError(ERROR_CREATE_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3004 RegInitializeRegistry();
3007 /* Update registry */
3008 CONSOLE_SetStatusText(" Updating registry hives...");
3010 if (!SetupFindFirstLineW(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3012 DPRINT1("SetupFindFirstLine() failed\n");
3013 MUIDisplayError(ERROR_FIND_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
3019 INF_GetDataField (&InfContext
, 0, &Action
);
3020 INF_GetDataField (&InfContext
, 1, &File
);
3021 INF_GetDataField (&InfContext
, 2, &Section
);
3023 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3025 if (!_wcsicmp (Action
, L
"AddReg"))
3029 else if (!_wcsicmp (Action
, L
"DelReg"))
3038 CONSOLE_SetStatusText(" Importing %S...", File
);
3040 if (!ImportRegistryFile(File
, Section
, Delete
))
3042 DPRINT("Importing %S failed\n", File
);
3044 MUIDisplayError(ERROR_IMPORT_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3048 while (SetupFindNextLine (&InfContext
, &InfContext
));
3050 /* Update display registry settings */
3051 CONSOLE_SetStatusText(" Updating display registry settings...");
3052 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3054 MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3058 /* Update keyboard layout settings */
3059 CONSOLE_SetStatusText(" Updating keyboard layout settings...");
3060 if (!ProcessKeyboardLayoutRegistry(LanguageList
))
3062 MUIDisplayError(ERROR_UPDATE_KBSETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3066 /* Update the mounted devices list */
3067 SetMountedDeviceValues(PartitionList
);
3069 CONSOLE_SetStatusText(" Done...");
3071 return BOOT_LOADER_PAGE
;
3076 BootLoaderPage(PINPUT_RECORD Ir
)
3078 UCHAR PartitionType
;
3079 BOOLEAN InstallOnFloppy
;
3082 CONSOLE_SetStatusText(" Please wait...");
3084 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3086 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3088 DPRINT("Error: active partition invalid (unused)\n");
3089 InstallOnFloppy
= TRUE
;
3091 else if (PartitionType
== 0x0A)
3093 /* OS/2 boot manager partition */
3094 DPRINT("Found OS/2 boot manager partition\n");
3095 InstallOnFloppy
= TRUE
;
3097 else if (PartitionType
== 0x83)
3099 /* Linux ext2 partition */
3100 DPRINT("Found Linux ext2 partition\n");
3101 InstallOnFloppy
= TRUE
;
3103 else if (PartitionType
== PARTITION_IFS
)
3105 /* NTFS partition */
3106 DPRINT("Found NTFS partition\n");
3107 InstallOnFloppy
= TRUE
;
3109 else if ((PartitionType
== PARTITION_FAT_12
) ||
3110 (PartitionType
== PARTITION_FAT_16
) ||
3111 (PartitionType
== PARTITION_HUGE
) ||
3112 (PartitionType
== PARTITION_XINT13
) ||
3113 (PartitionType
== PARTITION_FAT32
) ||
3114 (PartitionType
== PARTITION_FAT32_XINT13
))
3116 DPRINT("Found FAT partition\n");
3117 InstallOnFloppy
= FALSE
;
3121 /* Unknown partition */
3122 DPRINT("Unknown partition found\n");
3123 InstallOnFloppy
= TRUE
;
3126 if (InstallOnFloppy
== TRUE
)
3128 return BOOT_LOADER_FLOPPY_PAGE
;
3131 if (IsUnattendedSetup
)
3133 if (UnattendMBRInstallType
== 0) /* skip MBR installation */
3135 return SUCCESS_PAGE
;
3137 else if (UnattendMBRInstallType
== 1) /* install on floppy */
3139 return BOOT_LOADER_FLOPPY_PAGE
;
3141 else if (UnattendMBRInstallType
== 2) /* install on hdd */
3143 return BOOT_LOADER_HARDDISK_PAGE
;
3147 MUIDisplayPage(BOOT_LOADER_PAGE
);
3148 CONSOLE_InvertTextXY (8, Line
, 60, 1);
3152 CONSOLE_ConInKey(Ir
);
3154 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3155 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3157 CONSOLE_NormalTextXY (8, Line
, 60, 1);
3160 if (Line
<12) Line
=14;
3161 if (Line
>14) Line
=12;
3165 CONSOLE_InvertTextXY (8, Line
, 60, 1);
3167 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3168 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3170 CONSOLE_NormalTextXY (8, Line
, 48, 1);
3173 if (Line
<12) Line
=14;
3174 if (Line
>14) Line
=12;
3177 CONSOLE_InvertTextXY (8, Line
, 48, 1);
3179 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3180 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3182 if (ConfirmQuit(Ir
) == TRUE
)
3186 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3190 return BOOT_LOADER_HARDDISK_PAGE
;
3192 else if (Line
== 13)
3194 return BOOT_LOADER_FLOPPY_PAGE
;
3196 else if (Line
== 14)
3198 return SUCCESS_PAGE
;;
3201 return BOOT_LOADER_PAGE
;
3206 return BOOT_LOADER_PAGE
;
3211 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3215 MUIDisplayPage(BOOT_LOADER_FLOPPY_PAGE
);
3217 // SetStatusText(" Please wait...");
3221 CONSOLE_ConInKey(Ir
);
3223 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3224 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3226 if (ConfirmQuit(Ir
) == TRUE
)
3230 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3232 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3234 MUIDisplayError(ERROR_NO_FLOPPY
, Ir
, POPUP_WAIT_ENTER
);
3235 return BOOT_LOADER_FLOPPY_PAGE
;
3238 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3239 &DestinationArcPath
);
3240 if (!NT_SUCCESS(Status
))
3242 /* Print error message */
3243 return BOOT_LOADER_FLOPPY_PAGE
;
3246 return SUCCESS_PAGE
;
3250 return BOOT_LOADER_FLOPPY_PAGE
;
3255 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3257 UCHAR PartitionType
;
3260 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3261 if ((PartitionType
== PARTITION_FAT_12
) ||
3262 (PartitionType
== PARTITION_FAT_16
) ||
3263 (PartitionType
== PARTITION_HUGE
) ||
3264 (PartitionType
== PARTITION_XINT13
) ||
3265 (PartitionType
== PARTITION_FAT32
) ||
3266 (PartitionType
== PARTITION_FAT32_XINT13
))
3268 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3270 &DestinationArcPath
,
3272 if (!NT_SUCCESS(Status
))
3274 MUIDisplayError(ERROR_INSTALL_BOOTCODE
, Ir
, POPUP_WAIT_ENTER
);
3278 return SUCCESS_PAGE
;
3282 MUIDisplayError(ERROR_WRITE_BOOT
, Ir
, POPUP_WAIT_ENTER
);
3286 return BOOT_LOADER_HARDDISK_PAGE
;
3291 QuitPage(PINPUT_RECORD Ir
)
3293 MUIDisplayPage(QUIT_PAGE
);
3295 /* Destroy partition list */
3296 if (PartitionList
!= NULL
)
3298 DestroyPartitionList (PartitionList
);
3299 PartitionList
= NULL
;
3302 /* Destroy filesystem list */
3303 if (FileSystemList
!= NULL
)
3305 DestroyFileSystemList (FileSystemList
);
3306 FileSystemList
= NULL
;
3309 /* Destroy computer settings list */
3310 if (ComputerList
!= NULL
)
3312 DestroyGenericList(ComputerList
, TRUE
);
3313 ComputerList
= NULL
;
3316 /* Destroy display settings list */
3317 if (DisplayList
!= NULL
)
3319 DestroyGenericList(DisplayList
, TRUE
);
3323 /* Destroy keyboard settings list */
3324 if (KeyboardList
!= NULL
)
3326 DestroyGenericList(KeyboardList
, TRUE
);
3327 KeyboardList
= NULL
;
3330 /* Destroy keyboard layout list */
3331 if (LayoutList
!= NULL
)
3333 DestroyGenericList(LayoutList
, TRUE
);
3337 if (LanguageList
!= NULL
)
3339 DestroyGenericList(LanguageList
, FALSE
);
3340 LanguageList
= NULL
;
3343 CONSOLE_SetStatusText(" ENTER = Reboot computer");
3347 CONSOLE_ConInKey(Ir
);
3349 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3358 SuccessPage(PINPUT_RECORD Ir
)
3360 MUIDisplayPage(SUCCESS_PAGE
);
3362 if (IsUnattendedSetup
)
3369 CONSOLE_ConInKey(Ir
);
3371 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3380 FlushPage(PINPUT_RECORD Ir
)
3382 MUIDisplayPage(FLUSH_PAGE
);
3388 PnpEventThread(IN LPVOID lpParameter
);
3398 NtQuerySystemTime(&Time
);
3400 Status
= RtlCreateUserThread(NtCurrentProcess(), NULL
, TRUE
, 0, 0, 0, PnpEventThread
, &SetupInf
, &hPnpThread
, NULL
);
3401 if (!NT_SUCCESS(Status
))
3402 hPnpThread
= INVALID_HANDLE_VALUE
;
3403 if (!CONSOLE_Init())
3405 PrintString("Unable to open the console\n\n");
3406 PrintString("The most common cause of this is using an USB keyboard\n");
3407 PrintString("USB keyboards are not fully supported yet\n");
3409 /* Raise a hard error (crash the system/BSOD) */
3410 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3414 /* Initialize global unicode strings */
3415 RtlInitUnicodeString(&SourcePath
, NULL
);
3416 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3417 RtlInitUnicodeString(&SourceRootDir
, NULL
);
3418 RtlInitUnicodeString(&InstallPath
, NULL
);
3419 RtlInitUnicodeString(&DestinationPath
, NULL
);
3420 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3421 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3422 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3424 /* Hide the cursor */
3425 CONSOLE_SetCursorType(TRUE
, FALSE
);
3428 while (Page
!= REBOOT_PAGE
)
3430 CONSOLE_ClearScreen();
3433 //CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
3440 Page
= SetupStartPage(&Ir
);
3444 Page
= LanguagePage(&Ir
);
3448 Page
= LicensePage(&Ir
);
3453 Page
= IntroPage(&Ir
);
3457 case INSTALL_INTRO_PAGE
:
3458 Page
= InstallIntroPage(&Ir
);
3462 case SCSI_CONTROLLER_PAGE
:
3463 Page
= ScsiControllerPage(&Ir
);
3468 case OEM_DRIVER_PAGE
:
3469 Page
= OemDriverPage(&Ir
);
3473 case DEVICE_SETTINGS_PAGE
:
3474 Page
= DeviceSettingsPage(&Ir
);
3477 case COMPUTER_SETTINGS_PAGE
:
3478 Page
= ComputerSettingsPage(&Ir
);
3481 case DISPLAY_SETTINGS_PAGE
:
3482 Page
= DisplaySettingsPage(&Ir
);
3485 case KEYBOARD_SETTINGS_PAGE
:
3486 Page
= KeyboardSettingsPage(&Ir
);
3489 case LAYOUT_SETTINGS_PAGE
:
3490 Page
= LayoutSettingsPage(&Ir
);
3493 case SELECT_PARTITION_PAGE
:
3494 Page
= SelectPartitionPage(&Ir
);
3497 case CREATE_PARTITION_PAGE
:
3498 Page
= CreatePartitionPage(&Ir
);
3501 case DELETE_PARTITION_PAGE
:
3502 Page
= DeletePartitionPage(&Ir
);
3505 case SELECT_FILE_SYSTEM_PAGE
:
3506 Page
= SelectFileSystemPage(&Ir
);
3509 case FORMAT_PARTITION_PAGE
:
3510 Page
= (PAGE_NUMBER
) FormatPartitionPage(&Ir
);
3513 case CHECK_FILE_SYSTEM_PAGE
:
3514 Page
= (PAGE_NUMBER
) CheckFileSystemPage(&Ir
);
3517 case INSTALL_DIRECTORY_PAGE
:
3518 Page
= InstallDirectoryPage(&Ir
);
3521 case PREPARE_COPY_PAGE
:
3522 Page
= PrepareCopyPage(&Ir
);
3525 case FILE_COPY_PAGE
:
3526 Page
= FileCopyPage(&Ir
);
3530 Page
= RegistryPage(&Ir
);
3533 case BOOT_LOADER_PAGE
:
3534 Page
= BootLoaderPage(&Ir
);
3537 case BOOT_LOADER_FLOPPY_PAGE
:
3538 Page
= BootLoaderFloppyPage(&Ir
);
3541 case BOOT_LOADER_HARDDISK_PAGE
:
3542 Page
= BootLoaderHarddiskPage(&Ir
);
3546 case REPAIR_INTRO_PAGE
:
3547 Page
= RepairIntroPage(&Ir
);
3551 Page
= SuccessPage(&Ir
);
3555 Page
= FlushPage(&Ir
);
3559 Page
= QuitPage(&Ir
);
3567 /// THE FOLLOWING DPRINT IS FOR THE SYSTEM REGRESSION TOOL
3568 /// DO NOT REMOVE!!!
3569 DPRINT1("SYSREG_CHECKPOINT:USETUP_COMPLETE\n");
3573 /* Avoid bugcheck */
3574 Time
.QuadPart
+= 50000000;
3575 NtDelayExecution(FALSE
, &Time
);
3578 NtShutdownSystem(ShutdownReboot
);
3579 NtTerminateProcess(NtCurrentProcess(), 0);
3586 NtProcessStartup(PPEB Peb
)
3588 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3590 ProcessHeap
= Peb
->ProcessHeap
;
3591 INF_SetHeap(ProcessHeap
);
3594 #endif /* __REACTOS__ */