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 BOOLEAN RepairUpdateFlag
= FALSE
;
48 HANDLE hPnpThread
= INVALID_HANDLE_VALUE
;
50 /* LOCALS *******************************************************************/
52 static PPARTLIST PartitionList
= NULL
;
54 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
56 static UNICODE_STRING InstallPath
;
58 /* Path to the install directory */
59 static UNICODE_STRING DestinationPath
;
60 static UNICODE_STRING DestinationArcPath
;
61 static UNICODE_STRING DestinationRootPath
;
63 /* Path to the active partition (boot manager) */
64 static UNICODE_STRING SystemRootPath
;
68 static HSPFILEQ SetupFileQueue
= NULL
;
70 static BOOLEAN WarnLinuxPartitions
= TRUE
;
72 static PGENERIC_LIST ComputerList
= NULL
;
73 static PGENERIC_LIST DisplayList
= NULL
;
74 static PGENERIC_LIST KeyboardList
= NULL
;
75 static PGENERIC_LIST LayoutList
= NULL
;
76 static PGENERIC_LIST LanguageList
= NULL
;
78 /* FUNCTIONS ****************************************************************/
81 PrintString(char* fmt
,...)
85 UNICODE_STRING UnicodeString
;
86 ANSI_STRING AnsiString
;
89 vsprintf(buffer
, fmt
, ap
);
92 RtlInitAnsiString(&AnsiString
, buffer
);
93 RtlAnsiStringToUnicodeString(&UnicodeString
,
96 NtDisplayString(&UnicodeString
);
97 RtlFreeUnicodeString(&UnicodeString
);
111 /* draw upper left corner */
114 FillConsoleOutputCharacterA(
121 /* draw upper edge */
124 FillConsoleOutputCharacterA(
131 /* draw upper right corner */
132 coPos
.X
= xLeft
+ Width
- 1;
134 FillConsoleOutputCharacterA(
141 /* Draw right edge, inner space and left edge */
142 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
145 FillConsoleOutputCharacterA(
153 FillConsoleOutputCharacterA(
160 coPos
.X
= xLeft
+ Width
- 1;
161 FillConsoleOutputCharacterA(
169 /* draw lower left corner */
171 coPos
.Y
= yTop
+ Height
- 1;
172 FillConsoleOutputCharacterA(
179 /* draw lower edge */
181 coPos
.Y
= yTop
+ Height
- 1;
182 FillConsoleOutputCharacterA(
189 /* draw lower right corner */
190 coPos
.X
= xLeft
+ Width
- 1;
191 coPos
.Y
= yTop
+ Height
- 1;
192 FillConsoleOutputCharacterA(
201 PopupError(PCHAR Text
,
219 /* Count text lines and longest line */
225 p
= strchr(pnext
, '\n');
228 Length
= strlen(pnext
);
233 Length
= (ULONG
)(p
- pnext
);
238 if (Length
> MaxLength
)
241 if (LastLine
== TRUE
)
247 /* Check length of status line */
250 Length
= strlen(Status
);
251 if (Length
> MaxLength
)
255 Width
= MaxLength
+ 4;
260 yTop
= (yScreen
- Height
) / 2;
261 xLeft
= (xScreen
- Width
) / 2;
264 /* Set screen attributes */
266 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
268 FillConsoleOutputAttribute(StdOutput
,
269 FOREGROUND_RED
| BACKGROUND_WHITE
,
275 DrawBox(xLeft
, yTop
, Width
, Height
);
277 /* Print message text */
282 p
= strchr(pnext
, '\n');
285 Length
= strlen(pnext
);
290 Length
= (ULONG
)(p
- pnext
);
297 WriteConsoleOutputCharacterA(StdOutput
,
304 if (LastLine
== TRUE
)
311 /* Print separator line and status text */
314 coPos
.Y
= yTop
+ Height
- 3;
316 FillConsoleOutputCharacterA(StdOutput
,
323 FillConsoleOutputCharacterA(StdOutput
,
329 coPos
.X
= xLeft
+ Width
- 1;
330 FillConsoleOutputCharacterA(StdOutput
,
338 WriteConsoleOutputCharacterA(StdOutput
,
340 min(strlen(Status
), (SIZE_T
)Width
- 4),
345 if (WaitEvent
== POPUP_WAIT_NONE
)
350 CONSOLE_ConInKey(Ir
);
352 if (WaitEvent
== POPUP_WAIT_ANY_KEY
353 || Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D)
365 * FALSE: Don't quit setup.
368 ConfirmQuit(PINPUT_RECORD Ir
)
371 MUIDisplayError(ERROR_NOT_INSTALLED
, NULL
, POPUP_WAIT_NONE
);
375 CONSOLE_ConInKey(Ir
);
377 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
378 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
383 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
395 CheckUnattendedSetup(VOID
)
397 WCHAR UnattendInfPath
[MAX_PATH
];
404 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
406 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
410 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
411 wcscat(UnattendInfPath
, L
"\\unattend.inf");
413 /* Load 'unattend.inf' from install media. */
414 UnattendInf
= SetupOpenInfFileW(UnattendInfPath
,
418 if (UnattendInf
== INVALID_HANDLE_VALUE
)
420 DPRINT("SetupOpenInfFileW() failed\n");
424 /* Open 'Unattend' section */
425 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
427 DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n");
428 SetupCloseInfFile(UnattendInf
);
432 /* Get pointer 'Signature' key */
433 if (!INF_GetData(&Context
, NULL
, &Value
))
435 DPRINT("INF_GetData() failed for key 'Signature'\n");
436 SetupCloseInfFile(UnattendInf
);
440 /* Check 'Signature' string */
441 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
443 DPRINT("Signature not $ReactOS$\n");
444 SetupCloseInfFile(UnattendInf
);
448 /* Check if Unattend setup is enabled */
449 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"UnattendSetupEnabled", &Context
))
451 DPRINT("Can't find key 'UnattendSetupEnabled'\n");
452 SetupCloseInfFile(UnattendInf
);
455 if (!INF_GetData(&Context
, NULL
, &Value
))
457 DPRINT("Can't read key 'UnattendSetupEnabled'\n");
458 SetupCloseInfFile(UnattendInf
);
461 if (_wcsicmp(Value
, L
"yes") != 0)
463 DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
464 SetupCloseInfFile(UnattendInf
);
468 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
469 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
471 DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n");
472 SetupCloseInfFile(UnattendInf
);
475 if (!SetupGetIntField(&Context
, 1, &IntValue
))
477 DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n");
478 SetupCloseInfFile(UnattendInf
);
481 UnattendDestinationDiskNumber
= (LONG
)IntValue
;
483 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
484 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
486 DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
487 SetupCloseInfFile(UnattendInf
);
490 if (!SetupGetIntField(&Context
, 1, &IntValue
))
492 DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n");
493 SetupCloseInfFile(UnattendInf
);
496 UnattendDestinationPartitionNumber
= IntValue
;
498 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
499 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
501 DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
502 SetupCloseInfFile(UnattendInf
);
506 /* Get pointer 'InstallationDirectory' key */
507 if (!INF_GetData(&Context
, NULL
, &Value
))
509 DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
510 SetupCloseInfFile(UnattendInf
);
513 wcscpy(UnattendInstallationDirectory
, Value
);
515 IsUnattendedSetup
= TRUE
;
517 /* Search for 'MBRInstallType' in the 'Unattend' section */
518 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"MBRInstallType", &Context
))
520 if (SetupGetIntField(&Context
, 1, &IntValue
))
522 UnattendMBRInstallType
= IntValue
;
525 /* Search for 'FormatPartition' in the 'Unattend' section */
526 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"FormatPartition", &Context
))
528 if (SetupGetIntField(&Context
, 1, &IntValue
))
530 UnattendFormatPartition
= IntValue
;
533 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"AutoPartition", &Context
))
535 if (SetupGetIntField(&Context
, 1, &IntValue
))
537 AutoPartition
= IntValue
;
540 SetupCloseInfFile(UnattendInf
);
542 DPRINT("Running unattended setup\n");
546 LanguagePage(PINPUT_RECORD Ir
)
548 /* Initialize the computer settings list */
549 if (LanguageList
== NULL
)
551 LanguageList
= CreateLanguageList(SetupInf
);
552 if (LanguageList
== NULL
)
554 PopupError("Setup failed to initialize available translations", NULL
, NULL
, POPUP_WAIT_NONE
);
559 DrawGenericList(LanguageList
,
565 MUIDisplayPage(LANGUAGE_PAGE
);
569 CONSOLE_ConInKey(Ir
);
571 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
572 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
574 ScrollDownGenericList (LanguageList
);
576 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
577 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
579 ScrollUpGenericList (LanguageList
);
581 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
582 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
584 if (ConfirmQuit(Ir
) == TRUE
)
587 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
589 MUISelectLanguage((PWCHAR
)LanguageList
->CurrentEntry
->UserData
);
601 * Number of the next page.
604 SetupStartPage(PINPUT_RECORD Ir
)
606 SYSTEM_DEVICE_INFORMATION Sdi
;
608 WCHAR FileNameBuffer
[MAX_PATH
];
614 CONSOLE_SetStatusText(" Please wait...");
617 /* Check whether a harddisk is available */
618 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
620 sizeof(SYSTEM_DEVICE_INFORMATION
),
622 if (!NT_SUCCESS (Status
))
624 CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
625 MUIDisplayError(ERROR_DRIVE_INFORMATION
, Ir
, POPUP_WAIT_ENTER
);
629 if (Sdi
.NumberOfDisks
== 0)
631 MUIDisplayError(ERROR_NO_HDD
, Ir
, POPUP_WAIT_ENTER
);
635 /* Get the source path and source root path */
636 Status
= GetSourcePaths(&SourcePath
,
639 if (!NT_SUCCESS(Status
))
641 CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status
);
642 MUIDisplayError(ERROR_NO_SOURCE_DRIVE
, Ir
, POPUP_WAIT_ENTER
);
648 CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
649 CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
650 CONSOLE_PrintTextXY(6, 17, "SourceRootDir: '%wZ'", &SourceRootDir
);
654 /* Load txtsetup.sif from install media. */
655 wcscpy(FileNameBuffer
, SourcePath
.Buffer
);
656 wcscat(FileNameBuffer
, L
"\\txtsetup.sif");
658 SetupInf
= SetupOpenInfFileW(FileNameBuffer
,
662 if (SetupInf
== INVALID_HANDLE_VALUE
)
664 MUIDisplayError(ERROR_LOAD_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
668 /* Open 'Version' section */
669 if (!SetupFindFirstLineW (SetupInf
, L
"Version", L
"Signature", &Context
))
671 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
676 /* Get pointer 'Signature' key */
677 if (!INF_GetData (&Context
, NULL
, &Value
))
679 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
683 /* Check 'Signature' string */
684 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
686 MUIDisplayError(ERROR_SIGNATURE_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
690 /* Start PnP thread */
691 if (hPnpThread
!= INVALID_HANDLE_VALUE
)
693 //HACK: Commented out till the problem with CM is solved
694 //NtResumeThread(hPnpThread, NULL);
695 hPnpThread
= INVALID_HANDLE_VALUE
;
698 CheckUnattendedSetup();
700 if (IsUnattendedSetup
)
703 //read options from inf
704 ComputerList
= CreateComputerTypeList(SetupInf
);
705 DisplayList
= CreateDisplayDriverList(SetupInf
);
706 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
707 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
708 LanguageList
= CreateLanguageList(SetupInf
);
710 return INSTALL_INTRO_PAGE
;
713 return LANGUAGE_PAGE
;
723 IntroPage(PINPUT_RECORD Ir
)
725 MUIDisplayPage(START_PAGE
);
729 CONSOLE_ConInKey(Ir
);
731 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
732 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
734 if (ConfirmQuit(Ir
) == TRUE
)
738 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
740 return INSTALL_INTRO_PAGE
;
743 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
745 return REPAIR_INTRO_PAGE
;
748 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* R */
761 * Back to main setup page.
764 LicensePage(PINPUT_RECORD Ir
)
766 MUIDisplayPage(LICENSE_PAGE
);
770 CONSOLE_ConInKey(Ir
);
772 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
783 RepairIntroPage(PINPUT_RECORD Ir
)
785 MUIDisplayPage(REPAIR_INTRO_PAGE
);
789 CONSOLE_ConInKey(Ir
);
791 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
795 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'U') /* U */
797 RepairUpdateFlag
= TRUE
;
798 return INSTALL_INTRO_PAGE
;
800 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
804 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
805 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
811 return REPAIR_INTRO_PAGE
;
816 InstallIntroPage(PINPUT_RECORD Ir
)
818 MUIDisplayPage(INSTALL_INTRO_PAGE
);
820 if (RepairUpdateFlag
)
822 //return SELECT_PARTITION_PAGE;
823 return DEVICE_SETTINGS_PAGE
;
826 if (IsUnattendedSetup
)
828 return SELECT_PARTITION_PAGE
;
833 CONSOLE_ConInKey(Ir
);
835 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
836 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
838 if (ConfirmQuit(Ir
) == TRUE
)
842 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
844 return DEVICE_SETTINGS_PAGE
;
845 // return SCSI_CONTROLLER_PAGE;
849 return INSTALL_INTRO_PAGE
;
855 ScsiControllerPage(PINPUT_RECORD Ir
)
857 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
859 /* FIXME: print loaded mass storage driver descriptions */
861 SetTextXY(8, 10, "TEST device");
865 SetStatusText(" ENTER = Continue F3 = Quit");
871 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
872 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
874 if (ConfirmQuit(Ir
) == TRUE
)
878 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
880 return DEVICE_SETTINGS_PAGE
;
884 return SCSI_CONTROLLER_PAGE
;
890 DeviceSettingsPage(PINPUT_RECORD Ir
)
892 static ULONG Line
= 16;
893 MUIDisplayPage(DEVICE_SETTINGS_PAGE
);
895 /* Initialize the computer settings list */
896 if (ComputerList
== NULL
)
898 ComputerList
= CreateComputerTypeList(SetupInf
);
899 if (ComputerList
== NULL
)
901 MUIDisplayError(ERROR_LOAD_COMPUTER
, Ir
, POPUP_WAIT_ENTER
);
906 /* Initialize the display settings list */
907 if (DisplayList
== NULL
)
909 DisplayList
= CreateDisplayDriverList(SetupInf
);
910 if (DisplayList
== NULL
)
912 MUIDisplayError(ERROR_LOAD_DISPLAY
, Ir
, POPUP_WAIT_ENTER
);
917 /* Initialize the keyboard settings list */
918 if (KeyboardList
== NULL
)
920 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
921 if (KeyboardList
== NULL
)
923 MUIDisplayError(ERROR_LOAD_KEYBOARD
, Ir
, POPUP_WAIT_ENTER
);
928 /* Initialize the keyboard layout list */
929 if (LayoutList
== NULL
)
931 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
932 if (LayoutList
== NULL
)
934 /* FIXME: report error */
935 MUIDisplayError(ERROR_LOAD_KBLAYOUT
, Ir
, POPUP_WAIT_ENTER
);
940 MUIDisplayPage(DEVICE_SETTINGS_PAGE
);
943 CONSOLE_SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
944 CONSOLE_SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
945 CONSOLE_SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
946 CONSOLE_SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
948 CONSOLE_InvertTextXY (24, Line
, 48, 1);
950 if (RepairUpdateFlag
)
952 return SELECT_PARTITION_PAGE
;
957 CONSOLE_ConInKey(Ir
);
959 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
960 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
962 CONSOLE_NormalTextXY (24, Line
, 48, 1);
969 CONSOLE_InvertTextXY (24, Line
, 48, 1);
971 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
972 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
974 CONSOLE_NormalTextXY (24, Line
, 48, 1);
981 CONSOLE_InvertTextXY (24, Line
, 48, 1);
983 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
984 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
986 if (ConfirmQuit(Ir
) == TRUE
)
990 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
993 return COMPUTER_SETTINGS_PAGE
;
995 return DISPLAY_SETTINGS_PAGE
;
997 return KEYBOARD_SETTINGS_PAGE
;
999 return LAYOUT_SETTINGS_PAGE
;
1000 else if (Line
== 16)
1001 return SELECT_PARTITION_PAGE
;
1005 return DEVICE_SETTINGS_PAGE
;
1010 ComputerSettingsPage(PINPUT_RECORD Ir
)
1012 MUIDisplayPage(COMPUTER_SETTINGS_PAGE
);
1014 DrawGenericList(ComputerList
,
1020 SaveGenericListState(ComputerList
);
1024 CONSOLE_ConInKey(Ir
);
1026 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1027 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1029 ScrollDownGenericList (ComputerList
);
1031 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1032 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1034 ScrollUpGenericList (ComputerList
);
1036 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1037 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1039 if (ConfirmQuit(Ir
) == TRUE
)
1043 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1044 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1046 RestoreGenericListState(ComputerList
);
1047 return DEVICE_SETTINGS_PAGE
;
1049 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1051 return DEVICE_SETTINGS_PAGE
;
1055 return COMPUTER_SETTINGS_PAGE
;
1060 DisplaySettingsPage(PINPUT_RECORD Ir
)
1062 MUIDisplayPage(DISPLAY_SETTINGS_PAGE
);
1064 DrawGenericList(DisplayList
,
1070 SaveGenericListState(DisplayList
);
1074 CONSOLE_ConInKey(Ir
);
1076 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1077 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1079 ScrollDownGenericList (DisplayList
);
1081 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1082 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1084 ScrollUpGenericList (DisplayList
);
1086 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1087 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1089 if (ConfirmQuit(Ir
) == TRUE
)
1095 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1096 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1098 RestoreGenericListState(DisplayList
);
1099 return DEVICE_SETTINGS_PAGE
;
1101 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1103 return DEVICE_SETTINGS_PAGE
;
1107 return DISPLAY_SETTINGS_PAGE
;
1112 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1114 MUIDisplayPage(KEYBOARD_SETTINGS_PAGE
);
1116 DrawGenericList(KeyboardList
,
1124 SaveGenericListState(KeyboardList
);
1128 CONSOLE_ConInKey(Ir
);
1130 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1131 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1133 ScrollDownGenericList (KeyboardList
);
1135 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1136 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1138 ScrollUpGenericList (KeyboardList
);
1140 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1141 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1143 if (ConfirmQuit(Ir
) == TRUE
)
1147 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1148 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1150 RestoreGenericListState(KeyboardList
);
1151 return DEVICE_SETTINGS_PAGE
;
1153 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1155 return DEVICE_SETTINGS_PAGE
;
1159 return DISPLAY_SETTINGS_PAGE
;
1164 LayoutSettingsPage(PINPUT_RECORD Ir
)
1166 MUIDisplayPage(LAYOUT_SETTINGS_PAGE
);
1168 DrawGenericList(LayoutList
,
1174 SaveGenericListState(LayoutList
);
1178 CONSOLE_ConInKey(Ir
);
1180 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1181 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1183 ScrollDownGenericList (LayoutList
);
1185 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1186 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1188 ScrollUpGenericList (LayoutList
);
1190 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1191 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1193 if (ConfirmQuit(Ir
) == TRUE
)
1197 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1198 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1200 RestoreGenericListState(LayoutList
);
1201 return DEVICE_SETTINGS_PAGE
;
1203 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1205 return DEVICE_SETTINGS_PAGE
;
1209 return DISPLAY_SETTINGS_PAGE
;
1214 SelectPartitionPage(PINPUT_RECORD Ir
)
1216 MUIDisplayPage(SELECT_PARTITION_PAGE
);
1218 if (PartitionList
== NULL
)
1220 PartitionList
= CreatePartitionList (2,
1224 if (PartitionList
== NULL
)
1226 /* FIXME: show an error dialog */
1231 CheckActiveBootPartition (PartitionList
);
1233 DrawPartitionList (PartitionList
);
1235 /* Warn about partitions created by Linux Fdisk */
1236 if (WarnLinuxPartitions
== TRUE
&&
1237 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1239 MUIDisplayError(ERROR_WARN_PARTITION
, NULL
, POPUP_WAIT_NONE
);
1242 CONSOLE_ConInKey (Ir
);
1244 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1245 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1249 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1251 WarnLinuxPartitions
= FALSE
;
1252 return SELECT_PARTITION_PAGE
;
1257 if (IsUnattendedSetup
)
1259 if (!SelectPartition(PartitionList
, UnattendDestinationDiskNumber
, UnattendDestinationPartitionNumber
))
1263 PPARTENTRY PartEntry
= PartEntry
= PartitionList
->CurrentPartition
;
1264 ULONG MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1265 CreateNewPartition (PartitionList
,
1268 return (SELECT_FILE_SYSTEM_PAGE
);
1273 return(SELECT_FILE_SYSTEM_PAGE
);
1279 /* Update status text */
1280 if (PartitionList
->CurrentPartition
== NULL
||
1281 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1283 CONSOLE_SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1287 CONSOLE_SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1290 CONSOLE_ConInKey(Ir
);
1292 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1293 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1295 if (ConfirmQuit(Ir
) == TRUE
)
1297 DestroyPartitionList (PartitionList
);
1298 PartitionList
= NULL
;
1303 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1304 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1306 ScrollDownPartitionList (PartitionList
);
1308 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1309 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1311 ScrollUpPartitionList (PartitionList
);
1313 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1315 if (PartitionList
->CurrentPartition
== NULL
||
1316 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1318 CreateNewPartition (PartitionList
,
1323 return SELECT_FILE_SYSTEM_PAGE
;
1325 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'C') /* C */
1327 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1329 MUIDisplayError(ERROR_NEW_PARTITION
, Ir
, POPUP_WAIT_ANY_KEY
);
1330 return SELECT_PARTITION_PAGE
;
1333 return CREATE_PARTITION_PAGE
;
1335 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1337 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1339 MUIDisplayError(ERROR_DELETE_SPACE
, Ir
, POPUP_WAIT_ANY_KEY
);
1340 return SELECT_PARTITION_PAGE
;
1343 return DELETE_PARTITION_PAGE
;
1347 return SELECT_PARTITION_PAGE
;
1352 DrawInputField(ULONG FieldLength
,
1363 memset(buf
, '_', sizeof(buf
));
1364 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1365 strcat(buf
, FieldContent
);
1367 WriteConsoleOutputCharacterA (StdOutput
,
1375 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1378 ShowPartitionSizeInputBox(SHORT Left
,
1402 DrawBox(Left
, Top
, Right
- Left
+ 1, Bottom
- Top
+ 1);
1407 strcpy (Buffer
, "Size of new partition:");
1408 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1410 WriteConsoleOutputCharacterA (StdOutput
,
1416 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1417 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1419 WriteConsoleOutputCharacterA (StdOutput
,
1425 sprintf(Buffer
, "%lu", MaxSize
);
1426 Index
= strlen(Buffer
);
1427 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1434 CONSOLE_ConInKey (&Ir
);
1436 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1437 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1444 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1448 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1455 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1460 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1465 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1466 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1468 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1469 if ((ch
>= '0') && (ch
<= '9'))
1474 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1482 strcpy (InputBuffer
,
1488 CreatePartitionPage (PINPUT_RECORD Ir
)
1490 PDISKENTRY DiskEntry
;
1491 PPARTENTRY PartEntry
;
1494 CHAR InputBuffer
[50];
1500 if (PartitionList
== NULL
||
1501 PartitionList
->CurrentDisk
== NULL
||
1502 PartitionList
->CurrentPartition
== NULL
)
1504 /* FIXME: show an error dialog */
1508 DiskEntry
= PartitionList
->CurrentDisk
;
1509 PartEntry
= PartitionList
->CurrentPartition
;
1511 CONSOLE_SetStatusText (" Please wait...");
1513 CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on");
1516 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1518 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1524 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1530 if (DiskEntry
->DriverName
.Length
> 0)
1532 CONSOLE_PrintTextXY (6, 10,
1533 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1536 DiskEntry
->DiskNumber
,
1540 &DiskEntry
->DriverName
);
1544 CONSOLE_PrintTextXY (6, 10,
1545 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1548 DiskEntry
->DiskNumber
,
1555 CONSOLE_SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1558 CONSOLE_PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1559 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1562 CONSOLE_SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1564 PartEntry
= PartitionList
->CurrentPartition
;
1567 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1568 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1569 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1572 if (ConfirmQuit (Ir
) == TRUE
)
1577 else if (Cancel
== TRUE
)
1579 return SELECT_PARTITION_PAGE
;
1583 PartSize
= atoi (InputBuffer
);
1590 if (PartSize
> MaxSize
)
1596 /* Convert to bytes */
1597 if (PartSize
== MaxSize
)
1599 /* Use all of the unpartitioned disk space */
1600 PartSize
= PartEntry
->UnpartitionedLength
;
1604 /* Round-up by cylinder size */
1605 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1606 DiskEntry
->CylinderSize
);
1608 /* But never get larger than the unpartitioned disk space */
1609 if (PartSize
> PartEntry
->UnpartitionedLength
)
1610 PartSize
= PartEntry
->UnpartitionedLength
;
1613 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1615 CreateNewPartition (PartitionList
,
1619 return SELECT_PARTITION_PAGE
;
1623 return CREATE_PARTITION_PAGE
;
1628 DeletePartitionPage (PINPUT_RECORD Ir
)
1630 PDISKENTRY DiskEntry
;
1631 PPARTENTRY PartEntry
;
1637 if (PartitionList
== NULL
||
1638 PartitionList
->CurrentDisk
== NULL
||
1639 PartitionList
->CurrentPartition
== NULL
)
1641 /* FIXME: show an error dialog */
1645 DiskEntry
= PartitionList
->CurrentDisk
;
1646 PartEntry
= PartitionList
->CurrentPartition
;
1648 MUIDisplayPage(DELETE_PARTITION_PAGE
);
1650 /* Determine partition type */
1652 if (PartEntry
->New
== TRUE
)
1654 PartType
= "New (Unformatted)";
1656 else if (PartEntry
->Unpartitioned
== FALSE
)
1658 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1659 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1660 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1661 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1665 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1666 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1670 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1672 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1677 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
1679 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1684 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000LL
) /* 10 MB */
1686 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1691 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1695 if (PartType
== NULL
)
1697 CONSOLE_PrintTextXY (6, 10,
1698 " %c%c Type %lu %I64u %s",
1699 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1700 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1701 PartEntry
->PartInfo
[0].PartitionType
,
1707 CONSOLE_PrintTextXY (6, 10,
1708 " %c%c %s %I64u %s",
1709 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1710 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1717 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1719 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1725 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1731 if (DiskEntry
->DriverName
.Length
> 0)
1733 CONSOLE_PrintTextXY (6, 12,
1734 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1737 DiskEntry
->DiskNumber
,
1741 &DiskEntry
->DriverName
);
1745 CONSOLE_PrintTextXY (6, 12,
1746 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1749 DiskEntry
->DiskNumber
,
1757 CONSOLE_ConInKey (Ir
);
1759 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1760 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1762 if (ConfirmQuit (Ir
) == TRUE
)
1768 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
1770 return SELECT_PARTITION_PAGE
;
1772 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1774 DeleteCurrentPartition (PartitionList
);
1776 return SELECT_PARTITION_PAGE
;
1780 return DELETE_PARTITION_PAGE
;
1785 SelectFileSystemPage (PINPUT_RECORD Ir
)
1787 PDISKENTRY DiskEntry
;
1788 PPARTENTRY PartEntry
;
1795 if (PartitionList
== NULL
||
1796 PartitionList
->CurrentDisk
== NULL
||
1797 PartitionList
->CurrentPartition
== NULL
)
1799 /* FIXME: show an error dialog */
1803 DiskEntry
= PartitionList
->CurrentDisk
;
1804 PartEntry
= PartitionList
->CurrentPartition
;
1806 /* adjust disk size */
1807 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1809 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1814 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1818 /* adjust partition size */
1819 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000LL
) /* 10 GB */
1821 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1826 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1830 /* adjust partition type */
1831 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1832 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1833 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1834 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1838 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1839 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1843 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1845 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1847 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
1849 PartType
= "Unused";
1853 PartType
= "Unknown";
1856 if (PartEntry
->AutoCreate
== TRUE
)
1858 CONSOLE_SetTextXY(6, 8, "Setup created a new partition on");
1861 CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
1862 PartEntry
->PartInfo
[0].PartitionNumber
,
1868 CONSOLE_PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
1869 DiskEntry
->DiskNumber
,
1875 &DiskEntry
->DriverName
);
1877 CONSOLE_SetTextXY(6, 12, "This Partition will be formatted next.");
1880 PartEntry
->AutoCreate
= FALSE
;
1882 else if (PartEntry
->New
== TRUE
)
1884 CONSOLE_SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
1885 CONSOLE_SetTextXY(6, 10, "This Partition will be formatted next.");
1889 CONSOLE_SetTextXY(6, 8, "Setup install ReactOS onto Partition");
1891 if (PartType
== NULL
)
1893 CONSOLE_PrintTextXY (8, 10,
1894 "%c%c Type %lu %I64u %s",
1895 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1896 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1897 PartEntry
->PartInfo
[0].PartitionType
,
1903 CONSOLE_PrintTextXY (8, 10,
1905 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1906 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1912 CONSOLE_PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
1913 DiskEntry
->DiskNumber
,
1919 &DiskEntry
->DriverName
);
1922 MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE
);
1924 if (FileSystemList
== NULL
)
1926 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, L
"FAT");
1927 if (FileSystemList
== NULL
)
1929 /* FIXME: show an error dialog */
1933 /* FIXME: Add file systems to list */
1935 DrawFileSystemList (FileSystemList
);
1937 if (RepairUpdateFlag
)
1939 return (CHECK_FILE_SYSTEM_PAGE
);
1940 //return SELECT_PARTITION_PAGE;
1943 if (IsUnattendedSetup
)
1945 if (UnattendFormatPartition
)
1947 return FORMAT_PARTITION_PAGE
;
1949 return(CHECK_FILE_SYSTEM_PAGE
);
1954 CONSOLE_ConInKey (Ir
);
1956 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1957 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1959 if (ConfirmQuit (Ir
) == TRUE
)
1965 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1966 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1968 return SELECT_PARTITION_PAGE
;
1970 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1971 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1973 ScrollDownFileSystemList (FileSystemList
);
1975 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1976 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1978 ScrollUpFileSystemList (FileSystemList
);
1980 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1982 if (!FileSystemList
->Selected
->FormatFunc
)
1984 return CHECK_FILE_SYSTEM_PAGE
;
1988 return FORMAT_PARTITION_PAGE
;
1993 return SELECT_FILE_SYSTEM_PAGE
;
1998 FormatPartitionPage (PINPUT_RECORD Ir
)
2000 WCHAR PathBuffer
[MAX_PATH
];
2001 PDISKENTRY DiskEntry
;
2002 PPARTENTRY PartEntry
;
2011 MUIDisplayPage(FORMAT_PARTITION_PAGE
);
2013 if (PartitionList
== NULL
||
2014 PartitionList
->CurrentDisk
== NULL
||
2015 PartitionList
->CurrentPartition
== NULL
)
2017 /* FIXME: show an error dialog */
2021 DiskEntry
= PartitionList
->CurrentDisk
;
2022 PartEntry
= PartitionList
->CurrentPartition
;
2026 if (!IsUnattendedSetup
)
2028 CONSOLE_ConInKey(Ir
);
2031 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2032 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2034 if (ConfirmQuit (Ir
) == TRUE
)
2040 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
|| IsUnattendedSetup
) /* ENTER */
2042 CONSOLE_SetStatusText (" Please wait ...");
2044 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2046 if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"FAT") == 0)
2048 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200LL * 1024LL))
2050 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2051 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2053 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024LL * 255LL * 63LL * 512LL))
2055 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2057 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32LL * 1024LL * 1024LL))
2059 /* FAT16 CHS partition (partiton size < 32MB) */
2060 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2062 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2064 /* FAT16 CHS partition (partition size < 512MB) */
2065 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2069 /* FAT32 CHS partition (partition size >= 512MB) */
2070 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2075 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2077 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512LL * 1024LL * 1024LL))
2079 /* FAT16 LBA partition (partition size < 512MB) */
2080 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2084 /* FAT32 LBA partition (partition size >= 512MB) */
2085 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2089 else if (!FileSystemList
->Selected
->FormatFunc
)
2093 CheckActiveBootPartition (PartitionList
);
2096 CONSOLE_PrintTextXY (6, 12,
2097 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2098 DiskEntry
->DiskSize
,
2099 DiskEntry
->CylinderSize
,
2100 DiskEntry
->TrackSize
);
2103 DiskEntry
= PartitionList
->CurrentDisk
;
2104 Entry
= DiskEntry
->PartListHead
.Flink
;
2105 while (Entry
!= &DiskEntry
->PartListHead
)
2107 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2109 if (PartEntry
->Unpartitioned
== FALSE
)
2112 for (i
= 0; i
< 4; i
++)
2114 CONSOLE_PrintTextXY (6, Line
,
2115 "%2u: %2u %c %12I64u %12I64u %2u %c",
2117 PartEntry
->PartInfo
[i
].PartitionNumber
,
2118 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2119 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2120 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2121 PartEntry
->PartInfo
[i
].PartitionType
,
2122 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2130 Entry
= Entry
->Flink
;
2133 /* Restore the old entry */
2134 PartEntry
= PartitionList
->CurrentPartition
;
2137 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2139 DPRINT ("WritePartitionsToDisk() failed\n");
2140 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2144 /* Set DestinationRootPath */
2145 RtlFreeUnicodeString (&DestinationRootPath
);
2146 swprintf (PathBuffer
,
2147 L
"\\Device\\Harddisk%lu\\Partition%lu",
2148 PartitionList
->CurrentDisk
->DiskNumber
,
2149 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2150 RtlCreateUnicodeString (&DestinationRootPath
,
2152 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2155 /* Set SystemRootPath */
2156 RtlFreeUnicodeString (&SystemRootPath
);
2157 swprintf (PathBuffer
,
2158 L
"\\Device\\Harddisk%lu\\Partition%lu",
2159 PartitionList
->ActiveBootDisk
->DiskNumber
,
2160 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2161 RtlCreateUnicodeString (&SystemRootPath
,
2163 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2166 if (FileSystemList
->Selected
->FormatFunc
)
2168 Status
= FormatPartition(&DestinationRootPath
, FileSystemList
->Selected
);
2169 if (!NT_SUCCESS(Status
))
2171 DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status
);
2172 /* FIXME: show an error dialog */
2176 PartEntry
->New
= FALSE
;
2178 CheckActiveBootPartition(PartitionList
);
2181 if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"FAT") == 0)
2183 /* FIXME: Install boot code. This is a hack! */
2184 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
)
2185 || (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2187 wcscpy(PathBuffer
, SourceRootPath
.Buffer
);
2188 wcscat(PathBuffer
, L
"\\loader\\fat32.bin");
2190 DPRINT("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2191 DestinationRootPath
.Buffer
);
2192 Status
= InstallFat32BootCodeToDisk(PathBuffer
,
2193 DestinationRootPath
.Buffer
);
2194 if (!NT_SUCCESS(Status
))
2196 DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status
);
2197 /* FIXME: show an error dialog */
2198 DestroyFileSystemList(FileSystemList
);
2199 FileSystemList
= NULL
;
2205 wcscpy(PathBuffer
, SourceRootPath
.Buffer
);
2206 wcscat(PathBuffer
, L
"\\loader\\fat.bin");
2208 DPRINT("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2209 DestinationRootPath
.Buffer
);
2210 Status
= InstallFat16BootCodeToDisk(PathBuffer
,
2211 DestinationRootPath
.Buffer
);
2212 if (!NT_SUCCESS(Status
))
2214 DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2215 /* FIXME: show an error dialog */
2216 DestroyFileSystemList(FileSystemList
);
2217 FileSystemList
= NULL
;
2222 else if (FileSystemList
->Selected
->FormatFunc
)
2224 DestroyFileSystemList(FileSystemList
);
2225 FileSystemList
= NULL
;
2230 CONSOLE_SetStatusText (" Done. Press any key ...");
2231 CONSOLE_ConInKey(Ir
);
2234 DestroyFileSystemList(FileSystemList
);
2235 FileSystemList
= NULL
;
2236 return INSTALL_DIRECTORY_PAGE
;
2240 return FORMAT_PARTITION_PAGE
;
2245 CheckFileSystemPage(PINPUT_RECORD Ir
)
2247 PFILE_SYSTEM_ITEM CurrentFileSystem
;
2248 WCHAR PathBuffer
[MAX_PATH
];
2249 CHAR Buffer
[MAX_PATH
];
2252 /* FIXME: code duplicated in FormatPartitionPage */
2253 /* Set DestinationRootPath */
2254 RtlFreeUnicodeString(&DestinationRootPath
);
2255 swprintf(PathBuffer
,
2256 L
"\\Device\\Harddisk%lu\\Partition%lu",
2257 PartitionList
->CurrentDisk
->DiskNumber
,
2258 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2259 RtlCreateUnicodeString(&DestinationRootPath
, PathBuffer
);
2260 DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2262 /* Set SystemRootPath */
2263 RtlFreeUnicodeString(&SystemRootPath
);
2264 swprintf(PathBuffer
,
2265 L
"\\Device\\Harddisk%lu\\Partition%lu",
2266 PartitionList
->ActiveBootDisk
->DiskNumber
,
2267 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2268 RtlCreateUnicodeString(&SystemRootPath
, PathBuffer
);
2269 DPRINT("SystemRootPath: %wZ\n", &SystemRootPath
);
2271 CONSOLE_SetTextXY(6, 8, "Setup is now checking the selected partition.");
2273 CONSOLE_SetStatusText(" Please wait...");
2275 /* WRONG: first filesystem is not necesseraly the one of the current partition! */
2276 CurrentFileSystem
= CONTAINING_RECORD(FileSystemList
->ListHead
.Flink
, FILE_SYSTEM_ITEM
, ListEntry
);
2278 if (!CurrentFileSystem
->ChkdskFunc
)
2281 "Setup is currently unable to check a partition formatted in %S.\n"
2283 " \x07 Press ENTER to continue Setup.\n"
2284 " \x07 Press F3 to quit Setup.",
2285 CurrentFileSystem
->FileSystem
);
2288 "F3= Quit ENTER = Continue",
2289 NULL
, POPUP_WAIT_NONE
);
2293 CONSOLE_ConInKey(Ir
);
2295 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00
2296 && Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
) /* F3 */
2298 if (ConfirmQuit(Ir
))
2301 return CHECK_FILE_SYSTEM_PAGE
;
2303 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== VK_RETURN
) /* ENTER */
2305 return INSTALL_DIRECTORY_PAGE
;
2311 Status
= ChkdskPartition(&DestinationRootPath
, CurrentFileSystem
);
2312 if (!NT_SUCCESS(Status
))
2314 DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status
);
2315 sprintf(Buffer
, "Setup failed to verify the selected partition.\n"
2316 "(Status 0x%08lx).\n", Status
);
2318 "ENTER = Reboot computer",
2319 Ir
, POPUP_WAIT_ENTER
);
2323 return INSTALL_DIRECTORY_PAGE
;
2329 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2331 WCHAR PathBuffer
[MAX_PATH
];
2333 /* Create 'InstallPath' string */
2334 RtlFreeUnicodeString(&InstallPath
);
2335 RtlCreateUnicodeString(&InstallPath
,
2338 /* Create 'DestinationPath' string */
2339 RtlFreeUnicodeString(&DestinationPath
);
2341 DestinationRootPath
.Buffer
);
2342 if (InstallDir
[0] != L
'\\')
2345 wcscat(PathBuffer
, InstallDir
);
2346 RtlCreateUnicodeString(&DestinationPath
,
2349 /* Create 'DestinationArcPath' */
2350 RtlFreeUnicodeString(&DestinationArcPath
);
2351 swprintf(PathBuffer
,
2352 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2353 DiskEntry
->BiosDiskNumber
,
2354 PartEntry
->PartInfo
[0].PartitionNumber
);
2355 if (InstallDir
[0] != L
'\\')
2358 wcscat(PathBuffer
, InstallDir
);
2359 RtlCreateUnicodeString(&DestinationArcPath
,
2362 return(PREPARE_COPY_PAGE
);
2367 InstallDirectoryPage(PINPUT_RECORD Ir
)
2369 PDISKENTRY DiskEntry
;
2370 PPARTENTRY PartEntry
;
2371 WCHAR InstallDir
[51];
2376 if (PartitionList
== NULL
||
2377 PartitionList
->CurrentDisk
== NULL
||
2378 PartitionList
->CurrentPartition
== NULL
)
2380 /* FIXME: show an error dialog */
2384 DiskEntry
= PartitionList
->CurrentDisk
;
2385 PartEntry
= PartitionList
->CurrentPartition
;
2387 /* Search for 'DefaultPath' in the 'SetupData' section */
2388 if (!SetupFindFirstLineW (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2390 MUIDisplayError(ERROR_FIND_SETUPDATA
, Ir
, POPUP_WAIT_ENTER
);
2394 /* Read the 'DefaultPath' data */
2395 if (INF_GetData (&Context
, NULL
, &DefaultPath
))
2397 wcscpy(InstallDir
, DefaultPath
);
2401 wcscpy(InstallDir
, L
"\\ReactOS");
2403 Length
= wcslen(InstallDir
);
2404 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2405 MUIDisplayPage(INSTALL_DIRECTORY_PAGE
);
2407 if (IsUnattendedSetup
)
2409 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2414 CONSOLE_ConInKey(Ir
);
2416 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2417 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2419 if (ConfirmQuit(Ir
) == TRUE
)
2423 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2425 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2427 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2432 InstallDir
[Length
] = 0;
2433 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2436 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2440 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2442 InstallDir
[Length
] = 0;
2443 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2448 return(INSTALL_DIRECTORY_PAGE
);
2452 AddSectionToCopyQueueCab(HINF InfFile
,
2454 PWCHAR SourceCabinet
,
2455 PCUNICODE_STRING DestinationPath
,
2458 INFCONTEXT FilesContext
;
2459 INFCONTEXT DirContext
;
2461 PWCHAR FileKeyValue
;
2463 PWCHAR TargetFileName
;
2465 /* Search for the SectionName section */
2466 if (!SetupFindFirstLineW (InfFile
, SectionName
, NULL
, &FilesContext
))
2469 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2470 PopupError(Buffer
, "ENTER = Reboot computer", Ir
, POPUP_WAIT_ENTER
);
2475 * Enumerate the files in the section
2476 * and add them to the file queue.
2480 /* Get source file name and target directory id */
2481 if (!INF_GetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2483 /* FIXME: Handle error! */
2484 DPRINT1("INF_GetData() failed\n");
2488 /* Get optional target file name */
2489 if (!INF_GetDataField (&FilesContext
, 2, &TargetFileName
))
2490 TargetFileName
= NULL
;
2492 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2494 /* Lookup target directory */
2495 if (!SetupFindFirstLineW (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2497 /* FIXME: Handle error! */
2498 DPRINT1("SetupFindFirstLine() failed\n");
2502 if (!INF_GetData (&DirContext
, NULL
, &DirKeyValue
))
2504 /* FIXME: Handle error! */
2505 DPRINT1("INF_GetData() failed\n");
2509 if (!SetupQueueCopy(SetupFileQueue
,
2511 SourceRootPath
.Buffer
,
2512 SourceRootDir
.Buffer
,
2517 /* FIXME: Handle error! */
2518 DPRINT1("SetupQueueCopy() failed\n");
2521 while (SetupFindNextLine(&FilesContext
, &FilesContext
));
2527 AddSectionToCopyQueue(HINF InfFile
,
2529 PWCHAR SourceCabinet
,
2530 PCUNICODE_STRING DestinationPath
,
2533 INFCONTEXT FilesContext
;
2534 INFCONTEXT DirContext
;
2536 PWCHAR FileKeyValue
;
2538 PWCHAR TargetFileName
;
2541 return AddSectionToCopyQueueCab(InfFile
, L
"SourceFiles", SourceCabinet
, DestinationPath
, Ir
);
2543 /* Search for the SectionName section */
2544 if (!SetupFindFirstLineW (InfFile
, SectionName
, NULL
, &FilesContext
))
2547 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2548 PopupError(Buffer
, "ENTER = Reboot computer", Ir
, POPUP_WAIT_ENTER
);
2553 * Enumerate the files in the section
2554 * and add them to the file queue.
2558 /* Get source file name and target directory id */
2559 if (!INF_GetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2561 /* FIXME: Handle error! */
2562 DPRINT1("INF_GetData() failed\n");
2566 /* Get target directory id */
2567 if (!INF_GetDataField (&FilesContext
, 13, &FileKeyValue
))
2569 /* FIXME: Handle error! */
2570 DPRINT1("INF_GetData() failed\n");
2574 /* Get optional target file name */
2575 if (!INF_GetDataField (&FilesContext
, 11, &TargetFileName
))
2576 TargetFileName
= NULL
;
2577 else if (!*TargetFileName
)
2578 TargetFileName
= NULL
;
2580 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2582 /* Lookup target directory */
2583 if (!SetupFindFirstLineW (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2585 /* FIXME: Handle error! */
2586 DPRINT1("SetupFindFirstLine() failed\n");
2590 if (!INF_GetData (&DirContext
, NULL
, &DirKeyValue
))
2592 /* FIXME: Handle error! */
2593 DPRINT1("INF_GetData() failed\n");
2597 if (!SetupQueueCopy(SetupFileQueue
,
2599 SourceRootPath
.Buffer
,
2600 SourceRootDir
.Buffer
,
2605 /* FIXME: Handle error! */
2606 DPRINT1("SetupQueueCopy() failed\n");
2609 while (SetupFindNextLine(&FilesContext
, &FilesContext
));
2615 PrepareCopyPageInfFile(HINF InfFile
,
2616 PWCHAR SourceCabinet
,
2619 WCHAR PathBuffer
[MAX_PATH
];
2620 INFCONTEXT DirContext
;
2621 PWCHAR AdditionalSectionName
= NULL
;
2626 /* Add common files */
2627 if (!AddSectionToCopyQueue(InfFile
, L
"SourceDisksFiles", SourceCabinet
, &DestinationPath
, Ir
))
2630 /* Add specific files depending of computer type */
2631 if (SourceCabinet
== NULL
)
2633 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
2635 if (AdditionalSectionName
)
2637 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, &DestinationPath
, Ir
))
2642 /* Create directories */
2646 * Install directories like '\reactos\test' are not handled yet.
2649 /* Get destination path */
2650 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2652 /* Remove trailing backslash */
2653 Length
= wcslen(PathBuffer
);
2654 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2656 PathBuffer
[Length
- 1] = 0;
2659 /* Create the install directory */
2660 Status
= SetupCreateDirectory(PathBuffer
);
2661 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2663 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2664 MUIDisplayError(ERROR_CREATE_INSTALL_DIR
, Ir
, POPUP_WAIT_ENTER
);
2669 /* Search for the 'Directories' section */
2670 if (!SetupFindFirstLineW(InfFile
, L
"Directories", NULL
, &DirContext
))
2674 MUIDisplayError(ERROR_CABINET_SECTION
, Ir
, POPUP_WAIT_ENTER
);
2678 MUIDisplayError(ERROR_TXTSETUP_SECTION
, Ir
, POPUP_WAIT_ENTER
);
2683 /* Enumerate the directory values and create the subdirectories */
2686 if (!INF_GetData (&DirContext
, NULL
, &KeyValue
))
2692 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2694 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2696 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2697 wcscat(PathBuffer
, KeyValue
);
2699 DPRINT("FullPath: '%S'\n", PathBuffer
);
2701 else if (KeyValue
[0] != L
'\\')
2703 DPRINT("RelativePath: '%S'\n", KeyValue
);
2704 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2705 wcscat(PathBuffer
, L
"\\");
2706 wcscat(PathBuffer
, KeyValue
);
2708 DPRINT("FullPath: '%S'\n", PathBuffer
);
2710 Status
= SetupCreateDirectory(PathBuffer
);
2711 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2713 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2714 MUIDisplayError(ERROR_CREATE_DIR
, Ir
, POPUP_WAIT_ENTER
);
2719 while (SetupFindNextLine (&DirContext
, &DirContext
));
2725 PrepareCopyPage(PINPUT_RECORD Ir
)
2728 WCHAR PathBuffer
[MAX_PATH
];
2729 INFCONTEXT CabinetsContext
;
2735 MUIDisplayPage(PREPARE_COPY_PAGE
);
2737 /* Create the file queue */
2738 SetupFileQueue
= SetupOpenFileQueue();
2739 if (SetupFileQueue
== NULL
)
2741 MUIDisplayError(ERROR_COPY_QUEUE
, Ir
, POPUP_WAIT_ENTER
);
2745 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
2750 /* Search for the 'Cabinets' section */
2751 if (!SetupFindFirstLineW (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
2753 return FILE_COPY_PAGE
;
2757 * Enumerate the directory values in the 'Cabinets'
2758 * section and parse their inf files.
2762 if (!INF_GetData (&CabinetsContext
, NULL
, &KeyValue
))
2765 wcscpy(PathBuffer
, SourcePath
.Buffer
);
2766 wcscat(PathBuffer
, L
"\\");
2767 wcscat(PathBuffer
, KeyValue
);
2770 CabinetInitialize();
2771 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
2772 CabinetSetCabinetName(PathBuffer
);
2774 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
2776 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
2778 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
2779 if (InfFileData
== NULL
)
2781 MUIDisplayError(ERROR_CABINET_SCRIPT
, Ir
, POPUP_WAIT_ENTER
);
2787 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
2788 MUIDisplayError(ERROR_CABINET_MISSING
, Ir
, POPUP_WAIT_ENTER
);
2792 InfHandle
= INF_OpenBufferedFileA((CHAR
*) InfFileData
,
2797 if (InfHandle
== INVALID_HANDLE_VALUE
)
2799 MUIDisplayError(ERROR_INVALID_CABINET_INF
, Ir
, POPUP_WAIT_ENTER
);
2805 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
2811 while (SetupFindNextLine (&CabinetsContext
, &CabinetsContext
));
2813 return FILE_COPY_PAGE
;
2818 SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext
,
2821 SYSTEM_PERFORMANCE_INFORMATION PerfInfo
;
2823 /* Get the memory information from the system */
2824 NtQuerySystemInformation(SystemPerformanceInformation
,
2829 /* Check if this is initial setup */
2832 /* Set maximum limits to be total RAM pages */
2833 ProgressSetStepCount(CopyContext
->MemoryBars
[0], PerfInfo
.CommitLimit
);
2834 ProgressSetStepCount(CopyContext
->MemoryBars
[1], PerfInfo
.CommitLimit
);
2835 ProgressSetStepCount(CopyContext
->MemoryBars
[2], PerfInfo
.CommitLimit
);
2838 /* Set current values */
2839 ProgressSetStep(CopyContext
->MemoryBars
[0], PerfInfo
.PagedPoolPages
);
2840 ProgressSetStep(CopyContext
->MemoryBars
[1], PerfInfo
.NonPagedPoolPages
);
2841 ProgressSetStep(CopyContext
->MemoryBars
[2], PerfInfo
.AvailablePages
);
2843 /* Check if memory dropped below 40%! */
2844 if (CopyContext
->MemoryBars
[2]->Percent
<= 40)
2846 /* Wait a while until Mm does its thing */
2847 LARGE_INTEGER Interval
;
2848 Interval
.QuadPart
= -1 * 15 * 1000 * 100;
2849 NtDelayExecution(FALSE
, &Interval
);
2853 static UINT CALLBACK
2854 FileCopyCallback(PVOID Context
,
2859 PCOPYCONTEXT CopyContext
;
2861 CopyContext
= (PCOPYCONTEXT
)Context
;
2863 switch (Notification
)
2865 case SPFILENOTIFY_STARTSUBQUEUE
:
2866 CopyContext
->TotalOperations
= (ULONG
)Param2
;
2867 ProgressSetStepCount(CopyContext
->ProgressBar
,
2868 CopyContext
->TotalOperations
);
2869 SetupUpdateMemoryInfo(CopyContext
, TRUE
);
2872 case SPFILENOTIFY_STARTCOPY
:
2873 /* Display copy message */
2874 CONSOLE_SetStatusText(" \xB3 Copying file: %S", (PWSTR
)Param1
);
2875 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
2878 case SPFILENOTIFY_ENDCOPY
:
2879 CopyContext
->CompletedOperations
++;
2880 ProgressNextStep(CopyContext
->ProgressBar
);
2881 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
2890 FileCopyPage(PINPUT_RECORD Ir
)
2892 COPYCONTEXT CopyContext
;
2894 MUIDisplayPage(FILE_COPY_PAGE
);
2896 /* Create context for the copy process */
2897 CopyContext
.DestinationRootPath
= DestinationRootPath
.Buffer
;
2898 CopyContext
.InstallPath
= InstallPath
.Buffer
;
2899 CopyContext
.TotalOperations
= 0;
2900 CopyContext
.CompletedOperations
= 0;
2902 /* Create the progress bar as well */
2903 CopyContext
.ProgressBar
= CreateProgressBar(13,
2910 "Setup is copying files...");
2912 /* Create the paged pool progress bar */
2913 CopyContext
.MemoryBars
[0] = CreateProgressBar(13,
2922 /* Create the non paged pool progress bar */
2923 CopyContext
.MemoryBars
[1] = CreateProgressBar(28,
2932 /* Create the global memory progress bar */
2933 CopyContext
.MemoryBars
[2] = CreateProgressBar(43,
2942 /* Do the file copying */
2943 SetupCommitFileQueueW(NULL
,
2948 /* If we get here, we're done, so cleanup the queue and progress bar */
2949 SetupCloseFileQueue(SetupFileQueue
);
2950 DestroyProgressBar(CopyContext
.ProgressBar
);
2951 DestroyProgressBar(CopyContext
.MemoryBars
[0]);
2952 DestroyProgressBar(CopyContext
.MemoryBars
[1]);
2953 DestroyProgressBar(CopyContext
.MemoryBars
[2]);
2955 /* Go display the next page */
2956 return REGISTRY_PAGE
;
2960 RegistryPage(PINPUT_RECORD Ir
)
2962 INFCONTEXT InfContext
;
2969 CONSOLE_SetTextXY(6, 8, "Setup is updating the system configuration");
2971 CONSOLE_SetStatusText(" Creating registry hives...");
2973 if (RepairUpdateFlag
)
2975 return SUCCESS_PAGE
;
2978 if (!SetInstallPathValue(&DestinationPath
))
2980 DPRINT("SetInstallPathValue() failed\n");
2981 MUIDisplayError(ERROR_INITIALIZE_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
2985 /* Create the default hives */
2987 Status
= NtInitializeRegistry(CM_BOOT_FLAG_SETUP
);
2988 if (!NT_SUCCESS(Status
))
2990 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
2991 MUIDisplayError(ERROR_CREATE_HIVE
, Ir
, POPUP_WAIT_ENTER
);
2995 RegInitializeRegistry();
2998 /* Update registry */
2999 CONSOLE_SetStatusText(" Updating registry hives...");
3001 if (!SetupFindFirstLineW(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3003 DPRINT1("SetupFindFirstLine() failed\n");
3004 MUIDisplayError(ERROR_FIND_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
3010 INF_GetDataField (&InfContext
, 0, &Action
);
3011 INF_GetDataField (&InfContext
, 1, &File
);
3012 INF_GetDataField (&InfContext
, 2, &Section
);
3014 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3016 if (!_wcsicmp (Action
, L
"AddReg"))
3020 else if (!_wcsicmp (Action
, L
"DelReg"))
3029 CONSOLE_SetStatusText(" Importing %S...", File
);
3031 if (!ImportRegistryFile(File
, Section
, Delete
))
3033 DPRINT("Importing %S failed\n", File
);
3035 MUIDisplayError(ERROR_IMPORT_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3039 while (SetupFindNextLine (&InfContext
, &InfContext
));
3041 /* Update display registry settings */
3042 CONSOLE_SetStatusText(" Updating display registry settings...");
3043 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3045 MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3049 /* Update keyboard layout settings */
3050 CONSOLE_SetStatusText(" Updating keyboard layout settings...");
3051 if (!ProcessKeyboardLayoutRegistry(LanguageList
))
3053 MUIDisplayError(ERROR_UPDATE_KBSETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3057 /* Update the mounted devices list */
3058 SetMountedDeviceValues(PartitionList
);
3060 CONSOLE_SetStatusText(" Done...");
3062 return BOOT_LOADER_PAGE
;
3067 BootLoaderPage(PINPUT_RECORD Ir
)
3069 UCHAR PartitionType
;
3070 BOOLEAN InstallOnFloppy
;
3073 CONSOLE_SetStatusText(" Please wait...");
3075 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3077 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3079 DPRINT("Error: active partition invalid (unused)\n");
3080 InstallOnFloppy
= TRUE
;
3082 else if (PartitionType
== 0x0A)
3084 /* OS/2 boot manager partition */
3085 DPRINT("Found OS/2 boot manager partition\n");
3086 InstallOnFloppy
= TRUE
;
3088 else if (PartitionType
== 0x83)
3090 /* Linux ext2 partition */
3091 DPRINT("Found Linux ext2 partition\n");
3092 InstallOnFloppy
= TRUE
;
3094 else if (PartitionType
== PARTITION_IFS
)
3096 /* NTFS partition */
3097 DPRINT("Found NTFS partition\n");
3098 InstallOnFloppy
= TRUE
;
3100 else if ((PartitionType
== PARTITION_FAT_12
) ||
3101 (PartitionType
== PARTITION_FAT_16
) ||
3102 (PartitionType
== PARTITION_HUGE
) ||
3103 (PartitionType
== PARTITION_XINT13
) ||
3104 (PartitionType
== PARTITION_FAT32
) ||
3105 (PartitionType
== PARTITION_FAT32_XINT13
))
3107 DPRINT("Found FAT partition\n");
3108 InstallOnFloppy
= FALSE
;
3112 /* Unknown partition */
3113 DPRINT("Unknown partition found\n");
3114 InstallOnFloppy
= TRUE
;
3117 if (InstallOnFloppy
== TRUE
)
3119 return BOOT_LOADER_FLOPPY_PAGE
;
3122 if (IsUnattendedSetup
)
3124 if (UnattendMBRInstallType
== 0) /* skip MBR installation */
3126 return SUCCESS_PAGE
;
3128 else if (UnattendMBRInstallType
== 1) /* install on floppy */
3130 return BOOT_LOADER_FLOPPY_PAGE
;
3132 else if (UnattendMBRInstallType
== 2) /* install on hdd */
3134 return BOOT_LOADER_HARDDISK_PAGE
;
3138 MUIDisplayPage(BOOT_LOADER_PAGE
);
3139 CONSOLE_InvertTextXY (8, Line
, 60, 1);
3143 CONSOLE_ConInKey(Ir
);
3145 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3146 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3148 CONSOLE_NormalTextXY (8, Line
, 60, 1);
3151 if (Line
<12) Line
=14;
3152 if (Line
>14) Line
=12;
3156 CONSOLE_InvertTextXY (8, Line
, 60, 1);
3158 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3159 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3161 CONSOLE_NormalTextXY (8, Line
, 48, 1);
3164 if (Line
<12) Line
=14;
3165 if (Line
>14) Line
=12;
3168 CONSOLE_InvertTextXY (8, Line
, 48, 1);
3170 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3171 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3173 if (ConfirmQuit(Ir
) == TRUE
)
3177 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3181 return BOOT_LOADER_HARDDISK_PAGE
;
3183 else if (Line
== 13)
3185 return BOOT_LOADER_FLOPPY_PAGE
;
3187 else if (Line
== 14)
3189 return SUCCESS_PAGE
;;
3192 return BOOT_LOADER_PAGE
;
3197 return BOOT_LOADER_PAGE
;
3202 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3206 MUIDisplayPage(BOOT_LOADER_FLOPPY_PAGE
);
3208 // SetStatusText(" Please wait...");
3212 CONSOLE_ConInKey(Ir
);
3214 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3215 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3217 if (ConfirmQuit(Ir
) == TRUE
)
3221 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3223 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3225 MUIDisplayError(ERROR_NO_FLOPPY
, Ir
, POPUP_WAIT_ENTER
);
3226 return BOOT_LOADER_FLOPPY_PAGE
;
3229 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3230 &DestinationArcPath
);
3231 if (!NT_SUCCESS(Status
))
3233 /* Print error message */
3234 return BOOT_LOADER_FLOPPY_PAGE
;
3237 return SUCCESS_PAGE
;
3241 return BOOT_LOADER_FLOPPY_PAGE
;
3246 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3248 UCHAR PartitionType
;
3251 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3252 if ((PartitionType
== PARTITION_FAT_12
) ||
3253 (PartitionType
== PARTITION_FAT_16
) ||
3254 (PartitionType
== PARTITION_HUGE
) ||
3255 (PartitionType
== PARTITION_XINT13
) ||
3256 (PartitionType
== PARTITION_FAT32
) ||
3257 (PartitionType
== PARTITION_FAT32_XINT13
))
3259 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3261 &DestinationArcPath
,
3263 if (!NT_SUCCESS(Status
))
3265 MUIDisplayError(ERROR_INSTALL_BOOTCODE
, Ir
, POPUP_WAIT_ENTER
);
3269 return SUCCESS_PAGE
;
3273 MUIDisplayError(ERROR_WRITE_BOOT
, Ir
, POPUP_WAIT_ENTER
);
3277 return BOOT_LOADER_HARDDISK_PAGE
;
3282 QuitPage(PINPUT_RECORD Ir
)
3284 MUIDisplayPage(QUIT_PAGE
);
3286 /* Destroy partition list */
3287 if (PartitionList
!= NULL
)
3289 DestroyPartitionList (PartitionList
);
3290 PartitionList
= NULL
;
3293 /* Destroy filesystem list */
3294 if (FileSystemList
!= NULL
)
3296 DestroyFileSystemList (FileSystemList
);
3297 FileSystemList
= NULL
;
3300 /* Destroy computer settings list */
3301 if (ComputerList
!= NULL
)
3303 DestroyGenericList(ComputerList
, TRUE
);
3304 ComputerList
= NULL
;
3307 /* Destroy display settings list */
3308 if (DisplayList
!= NULL
)
3310 DestroyGenericList(DisplayList
, TRUE
);
3314 /* Destroy keyboard settings list */
3315 if (KeyboardList
!= NULL
)
3317 DestroyGenericList(KeyboardList
, TRUE
);
3318 KeyboardList
= NULL
;
3321 /* Destroy keyboard layout list */
3322 if (LayoutList
!= NULL
)
3324 DestroyGenericList(LayoutList
, TRUE
);
3328 if (LanguageList
!= NULL
)
3330 DestroyGenericList(LanguageList
, FALSE
);
3331 LanguageList
= NULL
;
3334 CONSOLE_SetStatusText(" ENTER = Reboot computer");
3338 CONSOLE_ConInKey(Ir
);
3340 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3349 SuccessPage(PINPUT_RECORD Ir
)
3351 MUIDisplayPage(SUCCESS_PAGE
);
3353 if (IsUnattendedSetup
)
3360 CONSOLE_ConInKey(Ir
);
3362 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3371 FlushPage(PINPUT_RECORD Ir
)
3373 MUIDisplayPage(FLUSH_PAGE
);
3379 PnpEventThread(IN LPVOID lpParameter
);
3389 NtQuerySystemTime(&Time
);
3391 Status
= RtlCreateUserThread(NtCurrentProcess(), NULL
, TRUE
, 0, 0, 0, PnpEventThread
, &SetupInf
, &hPnpThread
, NULL
);
3392 if (!NT_SUCCESS(Status
))
3393 hPnpThread
= INVALID_HANDLE_VALUE
;
3394 if (!CONSOLE_Init())
3396 PrintString("Unable to open the console\n\n");
3397 PrintString("The most common cause of this is using an USB keyboard\n");
3398 PrintString("USB keyboards are not fully supported yet\n");
3400 /* Raise a hard error (crash the system/BSOD) */
3401 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3405 /* Initialize global unicode strings */
3406 RtlInitUnicodeString(&SourcePath
, NULL
);
3407 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3408 RtlInitUnicodeString(&SourceRootDir
, NULL
);
3409 RtlInitUnicodeString(&InstallPath
, NULL
);
3410 RtlInitUnicodeString(&DestinationPath
, NULL
);
3411 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3412 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3413 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3415 /* Hide the cursor */
3416 CONSOLE_SetCursorType(TRUE
, FALSE
);
3419 while (Page
!= REBOOT_PAGE
)
3421 CONSOLE_ClearScreen();
3422 CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3429 Page
= SetupStartPage(&Ir
);
3433 Page
= LanguagePage(&Ir
);
3437 Page
= LicensePage(&Ir
);
3442 Page
= IntroPage(&Ir
);
3446 case INSTALL_INTRO_PAGE
:
3447 Page
= InstallIntroPage(&Ir
);
3451 case SCSI_CONTROLLER_PAGE
:
3452 Page
= ScsiControllerPage(&Ir
);
3457 case OEM_DRIVER_PAGE
:
3458 Page
= OemDriverPage(&Ir
);
3462 case DEVICE_SETTINGS_PAGE
:
3463 Page
= DeviceSettingsPage(&Ir
);
3466 case COMPUTER_SETTINGS_PAGE
:
3467 Page
= ComputerSettingsPage(&Ir
);
3470 case DISPLAY_SETTINGS_PAGE
:
3471 Page
= DisplaySettingsPage(&Ir
);
3474 case KEYBOARD_SETTINGS_PAGE
:
3475 Page
= KeyboardSettingsPage(&Ir
);
3478 case LAYOUT_SETTINGS_PAGE
:
3479 Page
= LayoutSettingsPage(&Ir
);
3482 case SELECT_PARTITION_PAGE
:
3483 Page
= SelectPartitionPage(&Ir
);
3486 case CREATE_PARTITION_PAGE
:
3487 Page
= CreatePartitionPage(&Ir
);
3490 case DELETE_PARTITION_PAGE
:
3491 Page
= DeletePartitionPage(&Ir
);
3494 case SELECT_FILE_SYSTEM_PAGE
:
3495 Page
= SelectFileSystemPage(&Ir
);
3498 case FORMAT_PARTITION_PAGE
:
3499 Page
= (PAGE_NUMBER
) FormatPartitionPage(&Ir
);
3502 case CHECK_FILE_SYSTEM_PAGE
:
3503 Page
= (PAGE_NUMBER
) CheckFileSystemPage(&Ir
);
3506 case INSTALL_DIRECTORY_PAGE
:
3507 Page
= InstallDirectoryPage(&Ir
);
3510 case PREPARE_COPY_PAGE
:
3511 Page
= PrepareCopyPage(&Ir
);
3514 case FILE_COPY_PAGE
:
3515 Page
= FileCopyPage(&Ir
);
3519 Page
= RegistryPage(&Ir
);
3522 case BOOT_LOADER_PAGE
:
3523 Page
= BootLoaderPage(&Ir
);
3526 case BOOT_LOADER_FLOPPY_PAGE
:
3527 Page
= BootLoaderFloppyPage(&Ir
);
3530 case BOOT_LOADER_HARDDISK_PAGE
:
3531 Page
= BootLoaderHarddiskPage(&Ir
);
3536 case REPAIR_INTRO_PAGE
:
3537 Page
= RepairIntroPage(&Ir
);
3541 Page
= SuccessPage(&Ir
);
3545 Page
= FlushPage(&Ir
);
3549 Page
= QuitPage(&Ir
);
3557 /// THE FOLLOWING DPRINT IS FOR THE SYSTEM REGRESSION TOOL
3558 /// DO NOT REMOVE!!!
3559 DPRINT1("SYSREG_CHECKPOINT:USETUP_COMPLETE\n");
3563 /* Avoid bugcheck */
3564 Time
.QuadPart
+= 50000000;
3565 NtDelayExecution(FALSE
, &Time
);
3568 NtShutdownSystem(ShutdownReboot
);
3569 NtTerminateProcess(NtCurrentProcess(), 0);
3576 NtProcessStartup(PPEB Peb
)
3578 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3580 ProcessHeap
= Peb
->ProcessHeap
;
3581 INF_SetHeap(ProcessHeap
);
3584 #endif /* __REACTOS__ */