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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
42 /* GLOBALS ******************************************************************/
45 UNICODE_STRING SourceRootPath
;
46 UNICODE_STRING SourceRootDir
;
47 UNICODE_STRING SourcePath
;
48 BOOLEAN IsUnattendedSetup
= FALSE
;
49 LONG UnattendDestinationDiskNumber
;
50 LONG UnattendDestinationPartitionNumber
;
51 LONG UnattendMBRInstallType
= -1;
52 LONG UnattendFormatPartition
= 0;
53 LONG AutoPartition
= 0;
54 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
55 PWCHAR SelectedLanguageId
;
57 WCHAR DefaultLanguage
[20];
58 WCHAR DefaultKBLayout
[20];
59 BOOLEAN RepairUpdateFlag
= FALSE
;
60 HANDLE hPnpThread
= INVALID_HANDLE_VALUE
;
61 PPARTLIST PartitionList
= NULL
;
63 /* LOCALS *******************************************************************/
65 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
67 static UNICODE_STRING InstallPath
;
69 /* Path to the install directory */
70 static UNICODE_STRING DestinationPath
;
71 static UNICODE_STRING DestinationArcPath
;
72 static UNICODE_STRING DestinationRootPath
;
74 static WCHAR DestinationDriveLetter
;
76 /* Path to the active partition (boot manager) */
77 static UNICODE_STRING SystemRootPath
;
81 static HSPFILEQ SetupFileQueue
= NULL
;
83 static BOOLEAN WarnLinuxPartitions
= TRUE
;
85 static PGENERIC_LIST ComputerList
= NULL
;
86 static PGENERIC_LIST DisplayList
= NULL
;
87 static PGENERIC_LIST KeyboardList
= NULL
;
88 static PGENERIC_LIST LayoutList
= NULL
;
89 static PGENERIC_LIST LanguageList
= NULL
;
91 static LANGID LanguageId
= 0;
93 static ULONG RequiredPartitionDiskSpace
= ~0;
95 /* FUNCTIONS ****************************************************************/
98 PrintString(char* fmt
,...)
102 UNICODE_STRING UnicodeString
;
103 ANSI_STRING AnsiString
;
106 vsprintf(buffer
, fmt
, ap
);
109 RtlInitAnsiString(&AnsiString
, buffer
);
110 RtlAnsiStringToUnicodeString(&UnicodeString
, &AnsiString
, TRUE
);
111 NtDisplayString(&UnicodeString
);
112 RtlFreeUnicodeString(&UnicodeString
);
117 DrawBox(IN SHORT xLeft
,
125 /* draw upper left corner */
128 FillConsoleOutputCharacterA(StdOutput
,
134 /* draw upper edge */
137 FillConsoleOutputCharacterA(StdOutput
,
143 /* draw upper right corner */
144 coPos
.X
= xLeft
+ Width
- 1;
146 FillConsoleOutputCharacterA(StdOutput
,
152 /* Draw right edge, inner space and left edge */
153 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
156 FillConsoleOutputCharacterA(StdOutput
,
163 FillConsoleOutputCharacterA(StdOutput
,
169 coPos
.X
= xLeft
+ Width
- 1;
170 FillConsoleOutputCharacterA(StdOutput
,
177 /* draw lower left corner */
179 coPos
.Y
= yTop
+ Height
- 1;
180 FillConsoleOutputCharacterA(StdOutput
,
186 /* draw lower edge */
188 coPos
.Y
= yTop
+ Height
- 1;
189 FillConsoleOutputCharacterA(StdOutput
,
195 /* draw lower right corner */
196 coPos
.X
= xLeft
+ Width
- 1;
197 coPos
.Y
= yTop
+ Height
- 1;
198 FillConsoleOutputCharacterA(StdOutput
,
207 PopupError(PCCH Text
,
225 /* Count text lines and longest line */
232 p
= strchr(pnext
, '\n');
236 Length
= strlen(pnext
);
241 Length
= (ULONG
)(p
- pnext
);
247 if (Length
> MaxLength
)
250 if (LastLine
== TRUE
)
256 /* Check length of status line */
259 Length
= strlen(Status
);
261 if (Length
> MaxLength
)
265 Width
= MaxLength
+ 4;
271 yTop
= (yScreen
- Height
) / 2;
272 xLeft
= (xScreen
- Width
) / 2;
275 /* Set screen attributes */
277 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
279 FillConsoleOutputAttribute(StdOutput
,
280 FOREGROUND_RED
| BACKGROUND_WHITE
,
286 DrawBox(xLeft
, yTop
, Width
, Height
);
288 /* Print message text */
293 p
= strchr(pnext
, '\n');
297 Length
= strlen(pnext
);
302 Length
= (ULONG
)(p
- pnext
);
309 WriteConsoleOutputCharacterA(StdOutput
,
316 if (LastLine
== TRUE
)
323 /* Print separator line and status text */
326 coPos
.Y
= yTop
+ Height
- 3;
328 FillConsoleOutputCharacterA(StdOutput
,
335 FillConsoleOutputCharacterA(StdOutput
,
341 coPos
.X
= xLeft
+ Width
- 1;
342 FillConsoleOutputCharacterA(StdOutput
,
350 WriteConsoleOutputCharacterA(StdOutput
,
352 min(strlen(Status
), (SIZE_T
)Width
- 4),
357 if (WaitEvent
== POPUP_WAIT_NONE
)
362 CONSOLE_ConInKey(Ir
);
364 if (WaitEvent
== POPUP_WAIT_ANY_KEY
||
365 Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D)
377 * FALSE: Don't quit setup.
380 ConfirmQuit(PINPUT_RECORD Ir
)
383 MUIDisplayError(ERROR_NOT_INSTALLED
, NULL
, POPUP_WAIT_NONE
);
387 CONSOLE_ConInKey(Ir
);
389 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
390 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
395 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
407 CheckUnattendedSetup(VOID
)
409 WCHAR UnattendInfPath
[MAX_PATH
];
416 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
418 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
422 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
423 wcscat(UnattendInfPath
, L
"\\unattend.inf");
425 /* Load 'unattend.inf' from install media. */
426 UnattendInf
= SetupOpenInfFileW(UnattendInfPath
,
432 if (UnattendInf
== INVALID_HANDLE_VALUE
)
434 DPRINT("SetupOpenInfFileW() failed\n");
438 /* Open 'Unattend' section */
439 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
441 DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n");
442 SetupCloseInfFile(UnattendInf
);
446 /* Get pointer 'Signature' key */
447 if (!INF_GetData(&Context
, NULL
, &Value
))
449 DPRINT("INF_GetData() failed for key 'Signature'\n");
450 SetupCloseInfFile(UnattendInf
);
454 /* Check 'Signature' string */
455 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
457 DPRINT("Signature not $ReactOS$\n");
458 SetupCloseInfFile(UnattendInf
);
462 /* Check if Unattend setup is enabled */
463 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"UnattendSetupEnabled", &Context
))
465 DPRINT("Can't find key 'UnattendSetupEnabled'\n");
466 SetupCloseInfFile(UnattendInf
);
470 if (!INF_GetData(&Context
, NULL
, &Value
))
472 DPRINT("Can't read key 'UnattendSetupEnabled'\n");
473 SetupCloseInfFile(UnattendInf
);
477 if (_wcsicmp(Value
, L
"yes") != 0)
479 DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
480 SetupCloseInfFile(UnattendInf
);
484 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
485 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
487 DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n");
488 SetupCloseInfFile(UnattendInf
);
492 if (!SetupGetIntField(&Context
, 1, &IntValue
))
494 DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n");
495 SetupCloseInfFile(UnattendInf
);
499 UnattendDestinationDiskNumber
= (LONG
)IntValue
;
501 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
502 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
504 DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
505 SetupCloseInfFile(UnattendInf
);
509 if (!SetupGetIntField(&Context
, 1, &IntValue
))
511 DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n");
512 SetupCloseInfFile(UnattendInf
);
516 UnattendDestinationPartitionNumber
= IntValue
;
518 /* Search for 'InstallationDirectory' in the 'Unattend' section */
519 if (!SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"InstallationDirectory", &Context
))
521 DPRINT("SetupFindFirstLine() failed for key 'InstallationDirectory'\n");
522 SetupCloseInfFile(UnattendInf
);
526 /* Get pointer 'InstallationDirectory' key */
527 if (!INF_GetData(&Context
, NULL
, &Value
))
529 DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
530 SetupCloseInfFile(UnattendInf
);
534 wcscpy(UnattendInstallationDirectory
, Value
);
536 IsUnattendedSetup
= TRUE
;
538 /* Search for 'MBRInstallType' in the 'Unattend' section */
539 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"MBRInstallType", &Context
))
541 if (SetupGetIntField(&Context
, 1, &IntValue
))
543 UnattendMBRInstallType
= IntValue
;
547 /* Search for 'FormatPartition' in the 'Unattend' section */
548 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"FormatPartition", &Context
))
550 if (SetupGetIntField(&Context
, 1, &IntValue
))
552 UnattendFormatPartition
= IntValue
;
556 if (SetupFindFirstLineW(UnattendInf
, L
"Unattend", L
"AutoPartition", &Context
))
558 if (SetupGetIntField(&Context
, 1, &IntValue
))
560 AutoPartition
= IntValue
;
564 /* search for LocaleID in the 'Unattend' section*/
565 if (SetupFindFirstLineW (UnattendInf
, L
"Unattend", L
"LocaleID", &Context
))
567 if (INF_GetData (&Context
, NULL
, &Value
))
569 LONG Id
= wcstol(Value
, NULL
, 16);
570 swprintf(LocaleID
,L
"%08lx", Id
);
574 SetupCloseInfFile(UnattendInf
);
576 DPRINT("Running unattended setup\n");
583 PGENERIC_LIST_ENTRY ListEntry
;
584 LPCWSTR pszNewLayout
;
586 pszNewLayout
= MUIDefaultKeyboardLayout();
588 if (LayoutList
== NULL
)
590 LayoutList
= CreateKeyboardLayoutList(SetupInf
, DefaultKBLayout
);
591 if (LayoutList
== NULL
)
593 /* FIXME: Handle error! */
598 ListEntry
= GetFirstListEntry(LayoutList
);
600 /* Search for default layout (if provided) */
601 if (pszNewLayout
!= NULL
)
603 while (ListEntry
!= NULL
)
605 if (!wcscmp(pszNewLayout
, GetListEntryUserData(ListEntry
)))
607 SetCurrentListEntry(LayoutList
, ListEntry
);
611 ListEntry
= GetNextListEntry(ListEntry
);
618 LanguagePage(PINPUT_RECORD Ir
)
620 PWCHAR NewLanguageId
;
621 BOOL RefreshPage
= FALSE
;
623 /* Initialize the computer settings list */
624 if (LanguageList
== NULL
)
626 LanguageList
= CreateLanguageList(SetupInf
, DefaultLanguage
);
628 if (LanguageList
== NULL
)
630 PopupError("Setup failed to initialize available translations", NULL
, NULL
, POPUP_WAIT_NONE
);
636 SelectedLanguageId
= DefaultLanguage
;
637 SetConsoleCodePage();
639 DrawGenericList(LanguageList
,
645 ScrollToPositionGenericList (LanguageList
, GetDefaultLanguageIndex());
647 MUIDisplayPage(LANGUAGE_PAGE
);
651 CONSOLE_ConInKey(Ir
);
653 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
654 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
656 ScrollDownGenericList (LanguageList
);
659 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
660 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
662 ScrollUpGenericList(LanguageList
);
665 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
666 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_NEXT
)) /* PAGE DOWN */
668 ScrollPageDownGenericList(LanguageList
);
671 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
672 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_PRIOR
)) /* PAGE UP */
674 ScrollPageUpGenericList(LanguageList
);
677 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
678 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
680 if (ConfirmQuit(Ir
) == TRUE
)
683 RedrawGenericList(LanguageList
);
685 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
687 SelectedLanguageId
= (PWCHAR
)GetListEntryUserData(GetCurrentListEntry(LanguageList
));
689 LanguageId
= (LANGID
)(wcstol(SelectedLanguageId
, NULL
, 16) & 0xFFFF);
691 if (wcscmp(SelectedLanguageId
, DefaultLanguage
))
697 SetConsoleCodePage();
701 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
> 0x60) && (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
< 0x7b))
704 GenericListKeyPress(LanguageList
, Ir
->Event
.KeyEvent
.uChar
.AsciiChar
);
710 NewLanguageId
= (PWCHAR
)GetListEntryUserData(GetCurrentListEntry(LanguageList
));
712 if (SelectedLanguageId
!= NewLanguageId
)
714 /* Clear the language page */
715 MUIClearPage(LANGUAGE_PAGE
);
717 SelectedLanguageId
= NewLanguageId
;
720 SetConsoleCodePage();
722 /* Redraw language selection page in native language */
723 MUIDisplayPage(LANGUAGE_PAGE
);
737 * Number of the next page.
740 SetupStartPage(PINPUT_RECORD Ir
)
742 //SYSTEM_DEVICE_INFORMATION Sdi;
744 WCHAR FileNameBuffer
[MAX_PATH
];
749 PGENERIC_LIST_ENTRY ListEntry
;
752 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
755 /* Check whether a harddisk is available */
756 Status
= NtQuerySystemInformation(SystemDeviceInformation
,
758 sizeof(SYSTEM_DEVICE_INFORMATION
),
761 if (!NT_SUCCESS(Status
))
763 CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
764 MUIDisplayError(ERROR_DRIVE_INFORMATION
, Ir
, POPUP_WAIT_ENTER
);
768 if (Sdi
.NumberOfDisks
== 0)
770 MUIDisplayError(ERROR_NO_HDD
, Ir
, POPUP_WAIT_ENTER
);
775 /* Get the source path and source root path */
776 Status
= GetSourcePaths(&SourcePath
,
780 if (!NT_SUCCESS(Status
))
782 CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status
);
783 MUIDisplayError(ERROR_NO_SOURCE_DRIVE
, Ir
, POPUP_WAIT_ENTER
);
789 CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
790 CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
791 CONSOLE_PrintTextXY(6, 17, "SourceRootDir: '%wZ'", &SourceRootDir
);
795 /* Load txtsetup.sif from install media. */
796 wcscpy(FileNameBuffer
, SourcePath
.Buffer
);
797 wcscat(FileNameBuffer
, L
"\\txtsetup.sif");
799 SetupInf
= SetupOpenInfFileW(FileNameBuffer
,
805 if (SetupInf
== INVALID_HANDLE_VALUE
)
807 MUIDisplayError(ERROR_LOAD_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
811 /* Open 'Version' section */
812 if (!SetupFindFirstLineW(SetupInf
, L
"Version", L
"Signature", &Context
))
814 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
818 /* Get pointer 'Signature' key */
819 if (!INF_GetData(&Context
, NULL
, &Value
))
821 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
825 /* Check 'Signature' string */
826 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
828 MUIDisplayError(ERROR_SIGNATURE_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
832 /* Open 'DiskSpaceRequirements' section */
833 if (!SetupFindFirstLineW(SetupInf
, L
"DiskSpaceRequirements", L
"FreeSysPartDiskSpace", &Context
))
835 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
839 /* Get the 'FreeSysPartDiskSpace' value */
840 if (!SetupGetIntField(&Context
, 1, &IntValue
))
842 MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF
, Ir
, POPUP_WAIT_ENTER
);
846 RequiredPartitionDiskSpace
= (ULONG
)IntValue
;
848 /* Start PnP thread */
849 if (hPnpThread
!= INVALID_HANDLE_VALUE
)
851 NtResumeThread(hPnpThread
, NULL
);
852 hPnpThread
= INVALID_HANDLE_VALUE
;
855 CheckUnattendedSetup();
857 if (IsUnattendedSetup
)
860 //read options from inf
861 ComputerList
= CreateComputerTypeList(SetupInf
);
862 DisplayList
= CreateDisplayDriverList(SetupInf
);
863 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
864 LayoutList
= CreateKeyboardLayoutList(SetupInf
, DefaultKBLayout
);
865 LanguageList
= CreateLanguageList(SetupInf
, DefaultLanguage
);
868 wcscpy(SelectedLanguageId
,LocaleID
);
870 /* first we hack LanguageList */
871 ListEntry
= GetFirstListEntry(LanguageList
);
873 while (ListEntry
!= NULL
)
875 if (!wcsicmp(LocaleID
, GetListEntryUserData(ListEntry
)))
877 DPRINT("found %S in LanguageList\n",GetListEntryUserData(ListEntry
));
878 SetCurrentListEntry(LanguageList
, ListEntry
);
882 ListEntry
= GetNextListEntry(ListEntry
);
886 ListEntry
= GetFirstListEntry(LayoutList
);
888 while (ListEntry
!= NULL
)
890 if (!wcsicmp(LocaleID
, GetListEntryUserData(ListEntry
)))
892 DPRINT("found %S in LayoutList\n",GetListEntryUserData(ListEntry
));
893 SetCurrentListEntry(LayoutList
, ListEntry
);
897 ListEntry
= GetNextListEntry(ListEntry
);
900 SetConsoleCodePage();
902 return INSTALL_INTRO_PAGE
;
905 return LANGUAGE_PAGE
;
915 IntroPage(PINPUT_RECORD Ir
)
917 MUIDisplayPage(START_PAGE
);
921 CONSOLE_ConInKey(Ir
);
923 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
924 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
926 if (ConfirmQuit(Ir
) == TRUE
)
931 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
933 return INSTALL_INTRO_PAGE
;
935 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
937 return REPAIR_INTRO_PAGE
;
939 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* R */
952 * Back to main setup page.
955 LicensePage(PINPUT_RECORD Ir
)
957 MUIDisplayPage(LICENSE_PAGE
);
961 CONSOLE_ConInKey(Ir
);
963 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
974 RepairIntroPage(PINPUT_RECORD Ir
)
976 MUIDisplayPage(REPAIR_INTRO_PAGE
);
980 CONSOLE_ConInKey(Ir
);
982 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
986 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'U') /* U */
988 RepairUpdateFlag
= TRUE
;
989 return INSTALL_INTRO_PAGE
;
991 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
993 return RECOVERY_PAGE
;
995 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
996 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1002 return REPAIR_INTRO_PAGE
;
1007 InstallIntroPage(PINPUT_RECORD Ir
)
1009 MUIDisplayPage(INSTALL_INTRO_PAGE
);
1011 if (RepairUpdateFlag
)
1013 //return SELECT_PARTITION_PAGE;
1014 return DEVICE_SETTINGS_PAGE
;
1017 if (IsUnattendedSetup
)
1019 return SELECT_PARTITION_PAGE
;
1024 CONSOLE_ConInKey(Ir
);
1026 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1027 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1029 if (ConfirmQuit(Ir
) == TRUE
)
1034 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1036 return DEVICE_SETTINGS_PAGE
;
1037 // return SCSI_CONTROLLER_PAGE;
1041 return INSTALL_INTRO_PAGE
;
1047 ScsiControllerPage(PINPUT_RECORD Ir
)
1049 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
1051 /* FIXME: print loaded mass storage driver descriptions */
1053 SetTextXY(8, 10, "TEST device");
1057 SetStatusText(" ENTER = Continue F3 = Quit");
1063 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1064 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1066 if (ConfirmQuit(Ir
) == TRUE
)
1071 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1073 return DEVICE_SETTINGS_PAGE
;
1077 return SCSI_CONTROLLER_PAGE
;
1083 DeviceSettingsPage(PINPUT_RECORD Ir
)
1085 static ULONG Line
= 16;
1086 MUIDisplayPage(DEVICE_SETTINGS_PAGE
);
1088 /* Initialize the computer settings list */
1089 if (ComputerList
== NULL
)
1091 ComputerList
= CreateComputerTypeList(SetupInf
);
1092 if (ComputerList
== NULL
)
1094 MUIDisplayError(ERROR_LOAD_COMPUTER
, Ir
, POPUP_WAIT_ENTER
);
1099 /* Initialize the display settings list */
1100 if (DisplayList
== NULL
)
1102 DisplayList
= CreateDisplayDriverList(SetupInf
);
1103 if (DisplayList
== NULL
)
1105 MUIDisplayError(ERROR_LOAD_DISPLAY
, Ir
, POPUP_WAIT_ENTER
);
1110 /* Initialize the keyboard settings list */
1111 if (KeyboardList
== NULL
)
1113 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
1114 if (KeyboardList
== NULL
)
1116 MUIDisplayError(ERROR_LOAD_KEYBOARD
, Ir
, POPUP_WAIT_ENTER
);
1121 /* Initialize the keyboard layout list */
1122 if (LayoutList
== NULL
)
1124 LayoutList
= CreateKeyboardLayoutList(SetupInf
, DefaultKBLayout
);
1125 if (LayoutList
== NULL
)
1127 /* FIXME: report error */
1128 MUIDisplayError(ERROR_LOAD_KBLAYOUT
, Ir
, POPUP_WAIT_ENTER
);
1133 MUIDisplayPage(DEVICE_SETTINGS_PAGE
);
1136 CONSOLE_SetTextXY(25, 11, GetListEntryText(GetCurrentListEntry((ComputerList
))));
1137 CONSOLE_SetTextXY(25, 12, GetListEntryText(GetCurrentListEntry((DisplayList
))));
1138 CONSOLE_SetTextXY(25, 13, GetListEntryText(GetCurrentListEntry((KeyboardList
))));
1139 CONSOLE_SetTextXY(25, 14, GetListEntryText(GetCurrentListEntry((LayoutList
))));
1141 CONSOLE_InvertTextXY(24, Line
, 48, 1);
1143 if (RepairUpdateFlag
)
1145 return SELECT_PARTITION_PAGE
;
1150 CONSOLE_ConInKey(Ir
);
1152 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1153 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1155 CONSOLE_NormalTextXY(24, Line
, 48, 1);
1159 else if (Line
== 16)
1164 CONSOLE_InvertTextXY(24, Line
, 48, 1);
1166 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1167 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1169 CONSOLE_NormalTextXY(24, Line
, 48, 1);
1173 else if (Line
== 16)
1178 CONSOLE_InvertTextXY(24, Line
, 48, 1);
1180 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1181 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1183 if (ConfirmQuit(Ir
) == TRUE
)
1188 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1191 return COMPUTER_SETTINGS_PAGE
;
1192 else if (Line
== 12)
1193 return DISPLAY_SETTINGS_PAGE
;
1194 else if (Line
== 13)
1195 return KEYBOARD_SETTINGS_PAGE
;
1196 else if (Line
== 14)
1197 return LAYOUT_SETTINGS_PAGE
;
1198 else if (Line
== 16)
1199 return SELECT_PARTITION_PAGE
;
1203 return DEVICE_SETTINGS_PAGE
;
1208 ComputerSettingsPage(PINPUT_RECORD Ir
)
1210 MUIDisplayPage(COMPUTER_SETTINGS_PAGE
);
1212 DrawGenericList(ComputerList
,
1218 SaveGenericListState(ComputerList
);
1222 CONSOLE_ConInKey(Ir
);
1224 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1225 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1227 ScrollDownGenericList(ComputerList
);
1229 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1230 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1232 ScrollUpGenericList(ComputerList
);
1234 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1235 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1237 if (ConfirmQuit(Ir
) == TRUE
)
1242 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1243 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1245 RestoreGenericListState(ComputerList
);
1246 return DEVICE_SETTINGS_PAGE
;
1248 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1250 return DEVICE_SETTINGS_PAGE
;
1254 return COMPUTER_SETTINGS_PAGE
;
1259 DisplaySettingsPage(PINPUT_RECORD Ir
)
1261 MUIDisplayPage(DISPLAY_SETTINGS_PAGE
);
1263 DrawGenericList(DisplayList
,
1269 SaveGenericListState(DisplayList
);
1273 CONSOLE_ConInKey(Ir
);
1275 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1276 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1278 ScrollDownGenericList(DisplayList
);
1280 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1281 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1283 ScrollUpGenericList(DisplayList
);
1285 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1286 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1288 if (ConfirmQuit(Ir
) == TRUE
)
1295 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1296 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1298 RestoreGenericListState(DisplayList
);
1299 return DEVICE_SETTINGS_PAGE
;
1301 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1303 return DEVICE_SETTINGS_PAGE
;
1307 return DISPLAY_SETTINGS_PAGE
;
1312 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1314 MUIDisplayPage(KEYBOARD_SETTINGS_PAGE
);
1316 DrawGenericList(KeyboardList
,
1322 SaveGenericListState(KeyboardList
);
1326 CONSOLE_ConInKey(Ir
);
1328 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1329 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1331 ScrollDownGenericList(KeyboardList
);
1333 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1334 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1336 ScrollUpGenericList(KeyboardList
);
1338 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1339 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1341 if (ConfirmQuit(Ir
) == TRUE
)
1346 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1347 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1349 RestoreGenericListState(KeyboardList
);
1350 return DEVICE_SETTINGS_PAGE
;
1352 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1354 return DEVICE_SETTINGS_PAGE
;
1358 return KEYBOARD_SETTINGS_PAGE
;
1363 LayoutSettingsPage(PINPUT_RECORD Ir
)
1365 MUIDisplayPage(LAYOUT_SETTINGS_PAGE
);
1367 DrawGenericList(LayoutList
,
1373 SaveGenericListState(LayoutList
);
1377 CONSOLE_ConInKey(Ir
);
1379 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1380 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1382 ScrollDownGenericList(LayoutList
);
1384 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1385 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1387 ScrollUpGenericList(LayoutList
);
1389 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1390 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_NEXT
)) /* PAGE DOWN */
1392 ScrollPageDownGenericList(LayoutList
);
1394 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1395 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_PRIOR
)) /* PAGE UP */
1397 ScrollPageUpGenericList(LayoutList
);
1399 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1400 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1402 if (ConfirmQuit(Ir
) == TRUE
)
1407 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1408 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1410 RestoreGenericListState(LayoutList
);
1411 return DEVICE_SETTINGS_PAGE
;
1413 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1415 return DEVICE_SETTINGS_PAGE
;
1417 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
> 0x60) && (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
< 0x7b))
1420 GenericListKeyPress(LayoutList
, Ir
->Event
.KeyEvent
.uChar
.AsciiChar
);
1424 return LAYOUT_SETTINGS_PAGE
;
1429 IsDiskSizeValid(PPARTENTRY PartEntry
)
1433 size
= PartEntry
->SectorCount
.QuadPart
* PartEntry
->DiskEntry
->BytesPerSector
;
1434 size
= (size
+ 524288) / 1048576; /* in MBytes */
1436 if (size
< RequiredPartitionDiskSpace
)
1438 /* partition is too small so ask for another partion */
1439 DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size
, RequiredPartitionDiskSpace
);
1450 SelectPartitionPage(PINPUT_RECORD Ir
)
1454 MUIDisplayPage(SELECT_PARTITION_PAGE
);
1456 if (PartitionList
== NULL
)
1458 PartitionList
= CreatePartitionList(2,
1462 if (PartitionList
== NULL
)
1464 /* FIXME: show an error dialog */
1467 else if (IsListEmpty (&PartitionList
->DiskListHead
))
1469 MUIDisplayError(ERROR_NO_HDD
, Ir
, POPUP_WAIT_ENTER
);
1474 DrawPartitionList(PartitionList
);
1476 /* Warn about partitions created by Linux Fdisk */
1477 if (WarnLinuxPartitions
== TRUE
&&
1478 CheckForLinuxFdiskPartitions(PartitionList
) == TRUE
)
1480 MUIDisplayError(ERROR_WARN_PARTITION
, NULL
, POPUP_WAIT_NONE
);
1484 CONSOLE_ConInKey(Ir
);
1486 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1487 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1491 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1493 WarnLinuxPartitions
= FALSE
;
1494 return SELECT_PARTITION_PAGE
;
1499 if (IsUnattendedSetup
)
1501 if (!SelectPartition(PartitionList
, UnattendDestinationDiskNumber
, UnattendDestinationPartitionNumber
))
1505 CreatePrimaryPartition(PartitionList
,
1506 PartitionList
->CurrentPartition
->SectorCount
.QuadPart
,
1509 if (!IsDiskSizeValid(PartitionList
->CurrentPartition
))
1511 MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE
, Ir
, POPUP_WAIT_ANY_KEY
,
1512 RequiredPartitionDiskSpace
);
1513 return SELECT_PARTITION_PAGE
; /* let the user select another partition */
1516 DestinationDriveLetter
= (WCHAR
)PartitionList
->CurrentPartition
->DriveLetter
;
1518 return SELECT_FILE_SYSTEM_PAGE
;
1523 if (!IsDiskSizeValid(PartitionList
->CurrentPartition
))
1525 MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE
, Ir
, POPUP_WAIT_ANY_KEY
,
1526 RequiredPartitionDiskSpace
);
1527 return SELECT_PARTITION_PAGE
; /* let the user select another partition */
1530 DestinationDriveLetter
= (WCHAR
)PartitionList
->CurrentPartition
->DriveLetter
;
1532 return SELECT_FILE_SYSTEM_PAGE
;
1538 /* Update status text */
1539 if (PartitionList
->CurrentPartition
== NULL
)
1541 CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATEPARTITION
));
1543 else if (PartitionList
->CurrentPartition
->LogicalPartition
)
1545 if (PartitionList
->CurrentPartition
->IsPartitioned
)
1547 CONSOLE_SetStatusText(MUIGetString(STRING_DELETEPARTITION
));
1551 CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATELOGICAL
));
1556 if (PartitionList
->CurrentPartition
->IsPartitioned
)
1558 if (IsContainerPartition(PartitionList
->CurrentPartition
->PartitionType
))
1560 CONSOLE_SetStatusText(MUIGetString(STRING_DELETEPARTITION
));
1564 CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLDELETEPARTITION
));
1569 CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATEPARTITION
));
1573 CONSOLE_ConInKey(Ir
);
1575 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1576 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1578 if (ConfirmQuit(Ir
) == TRUE
)
1580 DestroyPartitionList(PartitionList
);
1581 PartitionList
= NULL
;
1587 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1588 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1590 if (ScrollDownPartitionList(PartitionList
))
1591 DrawPartitionList(PartitionList
);
1593 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1594 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1596 if (ScrollUpPartitionList(PartitionList
))
1597 DrawPartitionList(PartitionList
);
1599 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1601 if (IsContainerPartition(PartitionList
->CurrentPartition
->PartitionType
))
1602 continue; //return SELECT_PARTITION_PAGE;
1604 if (PartitionList
->CurrentPartition
== NULL
||
1605 PartitionList
->CurrentPartition
->IsPartitioned
== FALSE
)
1607 CreatePrimaryPartition(PartitionList
,
1612 if (!IsDiskSizeValid(PartitionList
->CurrentPartition
))
1614 MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE
, Ir
, POPUP_WAIT_ANY_KEY
,
1615 RequiredPartitionDiskSpace
);
1616 return SELECT_PARTITION_PAGE
; /* let the user select another partition */
1619 DestinationDriveLetter
= (WCHAR
)PartitionList
->CurrentPartition
->DriveLetter
;
1621 return SELECT_FILE_SYSTEM_PAGE
;
1623 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'P') /* P */
1625 if (PartitionList
->CurrentPartition
->LogicalPartition
== FALSE
)
1627 Error
= PrimaryPartitionCreationChecks(PartitionList
);
1628 if (Error
!= NOT_AN_ERROR
)
1630 MUIDisplayError(Error
, Ir
, POPUP_WAIT_ANY_KEY
);
1631 return SELECT_PARTITION_PAGE
;
1634 return CREATE_PRIMARY_PARTITION_PAGE
;
1637 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'E') /* E */
1639 if (PartitionList
->CurrentPartition
->LogicalPartition
== FALSE
)
1641 Error
= ExtendedPartitionCreationChecks(PartitionList
);
1642 if (Error
!= NOT_AN_ERROR
)
1644 MUIDisplayError(Error
, Ir
, POPUP_WAIT_ANY_KEY
);
1645 return SELECT_PARTITION_PAGE
;
1648 return CREATE_EXTENDED_PARTITION_PAGE
;
1651 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'L') /* L */
1653 if (PartitionList
->CurrentPartition
->LogicalPartition
== TRUE
)
1655 Error
= LogicalPartitionCreationChecks(PartitionList
);
1656 if (Error
!= NOT_AN_ERROR
)
1658 MUIDisplayError(Error
, Ir
, POPUP_WAIT_ANY_KEY
);
1659 return SELECT_PARTITION_PAGE
;
1662 return CREATE_LOGICAL_PARTITION_PAGE
;
1665 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
1667 if (PartitionList
->CurrentPartition
->IsPartitioned
== FALSE
)
1669 MUIDisplayError(ERROR_DELETE_SPACE
, Ir
, POPUP_WAIT_ANY_KEY
);
1670 return SELECT_PARTITION_PAGE
;
1673 return DELETE_PARTITION_PAGE
;
1677 return SELECT_PARTITION_PAGE
;
1681 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1682 /* Restriction for MaxSize: pow(10, PARTITION_SIZE_INPUT_FIELD_LENGTH)-1 */
1683 #define PARTITION_MAXSIZE 999999
1686 ShowPartitionSizeInputBox(SHORT Left
,
1699 WCHAR PartitionSizeBuffer
[100];
1711 DrawBox(Left
, Top
, Right
- Left
+ 1, Bottom
- Top
+ 1);
1716 strcpy(Buffer
, MUIGetString(STRING_PARTITIONSIZE
));
1717 iLeft
= coPos
.X
+ strlen(Buffer
) + 1;
1720 WriteConsoleOutputCharacterA(StdOutput
,
1726 sprintf(Buffer
, MUIGetString(STRING_MAXSIZE
), MaxSize
);
1727 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1729 WriteConsoleOutputCharacterA(StdOutput
,
1735 swprintf(PartitionSizeBuffer
, L
"%lu", MaxSize
);
1736 Index
= wcslen(PartitionSizeBuffer
);
1737 CONSOLE_SetInputTextXY(iLeft
,
1739 PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1740 PartitionSizeBuffer
);
1744 CONSOLE_ConInKey(&Ir
);
1746 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1747 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1752 PartitionSizeBuffer
[0] = 0;
1755 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1759 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1764 PartitionSizeBuffer
[0] = 0;
1767 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1771 PartitionSizeBuffer
[Index
] = 0;
1773 CONSOLE_SetInputTextXY(iLeft
,
1775 PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1776 PartitionSizeBuffer
);
1778 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1779 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1781 ch
= (WCHAR
)Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1783 if ((ch
>= L
'0') && (ch
<= L
'9'))
1785 PartitionSizeBuffer
[Index
] = ch
;
1787 PartitionSizeBuffer
[Index
] = 0;
1789 CONSOLE_SetInputTextXY(iLeft
,
1791 PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1792 PartitionSizeBuffer
);
1797 /* Convert UNICODE --> ANSI the poor man's way */
1798 sprintf(InputBuffer
, "%S", PartitionSizeBuffer
);
1803 CreatePrimaryPartitionPage(PINPUT_RECORD Ir
)
1805 PDISKENTRY DiskEntry
;
1806 PPARTENTRY PartEntry
;
1809 CHAR InputBuffer
[50];
1813 ULONGLONG SectorCount
;
1816 if (PartitionList
== NULL
||
1817 PartitionList
->CurrentDisk
== NULL
||
1818 PartitionList
->CurrentPartition
== NULL
)
1820 /* FIXME: show an error dialog */
1824 DiskEntry
= PartitionList
->CurrentDisk
;
1825 PartEntry
= PartitionList
->CurrentPartition
;
1827 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
1829 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSENEWPARTITION
));
1831 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
1833 if (DiskSize
>= 10737418240) /* 10 GB */
1835 DiskSize
= DiskSize
/ 1073741824;
1836 Unit
= MUIGetString(STRING_GB
);
1841 DiskSize
= DiskSize
/ 1048576;
1845 Unit
= MUIGetString(STRING_MB
);
1848 if (DiskEntry
->DriverName
.Length
> 0)
1850 CONSOLE_PrintTextXY(6, 10,
1851 MUIGetString(STRING_HDINFOPARTCREATE
),
1854 DiskEntry
->DiskNumber
,
1858 &DiskEntry
->DriverName
);
1862 CONSOLE_PrintTextXY(6, 10,
1863 MUIGetString(STRING_HDDINFOUNK1
),
1866 DiskEntry
->DiskNumber
,
1872 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE
));
1875 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
1876 PartitionList
->CurrentPartition
->SectorCount
* DiskEntry
->BytesPerSector
/ 1048576);
1879 CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION
));
1881 PartEntry
= PartitionList
->CurrentPartition
;
1884 MaxSize
= (PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
) / 1048576; /* in MBytes (rounded) */
1886 if (MaxSize
> PARTITION_MAXSIZE
)
1887 MaxSize
= PARTITION_MAXSIZE
;
1889 ShowPartitionSizeInputBox(12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1890 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1894 if (ConfirmQuit (Ir
) == TRUE
)
1899 else if (Cancel
== TRUE
)
1901 return SELECT_PARTITION_PAGE
;
1905 PartSize
= atoi(InputBuffer
);
1913 if (PartSize
> MaxSize
)
1919 /* Convert to bytes */
1920 if (PartSize
== MaxSize
)
1922 /* Use all of the unpartitioned disk space */
1923 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
1927 /* Calculate the sector count from the size in MB */
1928 SectorCount
= PartSize
* 1048576 / DiskEntry
->BytesPerSector
;
1930 /* But never get larger than the unpartitioned disk space */
1931 if (SectorCount
> PartEntry
->SectorCount
.QuadPart
)
1932 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
1935 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1937 CreatePrimaryPartition(PartitionList
,
1941 return SELECT_PARTITION_PAGE
;
1945 return CREATE_PRIMARY_PARTITION_PAGE
;
1950 CreateExtendedPartitionPage(PINPUT_RECORD Ir
)
1952 PDISKENTRY DiskEntry
;
1953 PPARTENTRY PartEntry
;
1956 CHAR InputBuffer
[50];
1960 ULONGLONG SectorCount
;
1963 if (PartitionList
== NULL
||
1964 PartitionList
->CurrentDisk
== NULL
||
1965 PartitionList
->CurrentPartition
== NULL
)
1967 /* FIXME: show an error dialog */
1971 DiskEntry
= PartitionList
->CurrentDisk
;
1972 PartEntry
= PartitionList
->CurrentPartition
;
1974 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
1976 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_EXTENDED_PARTITION
));
1978 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
1980 if (DiskSize
>= 10737418240) /* 10 GB */
1982 DiskSize
= DiskSize
/ 1073741824;
1983 Unit
= MUIGetString(STRING_GB
);
1988 DiskSize
= DiskSize
/ 1048576;
1992 Unit
= MUIGetString(STRING_MB
);
1995 if (DiskEntry
->DriverName
.Length
> 0)
1997 CONSOLE_PrintTextXY(6, 10,
1998 MUIGetString(STRING_HDINFOPARTCREATE
),
2001 DiskEntry
->DiskNumber
,
2005 &DiskEntry
->DriverName
);
2009 CONSOLE_PrintTextXY(6, 10,
2010 MUIGetString(STRING_HDDINFOUNK1
),
2013 DiskEntry
->DiskNumber
,
2019 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE
));
2022 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2023 PartitionList
->CurrentPartition
->SectorCount
* DiskEntry
->BytesPerSector
/ 1048576);
2026 CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION
));
2028 PartEntry
= PartitionList
->CurrentPartition
;
2031 MaxSize
= (PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
) / 1048576; /* in MBytes (rounded) */
2033 if (MaxSize
> PARTITION_MAXSIZE
)
2034 MaxSize
= PARTITION_MAXSIZE
;
2036 ShowPartitionSizeInputBox(12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
2037 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
2041 if (ConfirmQuit (Ir
) == TRUE
)
2046 else if (Cancel
== TRUE
)
2048 return SELECT_PARTITION_PAGE
;
2052 PartSize
= atoi(InputBuffer
);
2060 if (PartSize
> MaxSize
)
2066 /* Convert to bytes */
2067 if (PartSize
== MaxSize
)
2069 /* Use all of the unpartitioned disk space */
2070 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2074 /* Calculate the sector count from the size in MB */
2075 SectorCount
= PartSize
* 1048576 / DiskEntry
->BytesPerSector
;
2077 /* But never get larger than the unpartitioned disk space */
2078 if (SectorCount
> PartEntry
->SectorCount
.QuadPart
)
2079 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2082 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
2084 CreateExtendedPartition(PartitionList
,
2087 return SELECT_PARTITION_PAGE
;
2091 return CREATE_EXTENDED_PARTITION_PAGE
;
2096 CreateLogicalPartitionPage(PINPUT_RECORD Ir
)
2098 PDISKENTRY DiskEntry
;
2099 PPARTENTRY PartEntry
;
2102 CHAR InputBuffer
[50];
2106 ULONGLONG SectorCount
;
2109 if (PartitionList
== NULL
||
2110 PartitionList
->CurrentDisk
== NULL
||
2111 PartitionList
->CurrentPartition
== NULL
)
2113 /* FIXME: show an error dialog */
2117 DiskEntry
= PartitionList
->CurrentDisk
;
2118 PartEntry
= PartitionList
->CurrentPartition
;
2120 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2122 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_LOGICAL_PARTITION
));
2124 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2126 if (DiskSize
>= 10737418240) /* 10 GB */
2128 DiskSize
= DiskSize
/ 1073741824;
2129 Unit
= MUIGetString(STRING_GB
);
2134 DiskSize
= DiskSize
/ 1048576;
2138 Unit
= MUIGetString(STRING_MB
);
2141 if (DiskEntry
->DriverName
.Length
> 0)
2143 CONSOLE_PrintTextXY(6, 10,
2144 MUIGetString(STRING_HDINFOPARTCREATE
),
2147 DiskEntry
->DiskNumber
,
2151 &DiskEntry
->DriverName
);
2155 CONSOLE_PrintTextXY(6, 10,
2156 MUIGetString(STRING_HDDINFOUNK1
),
2159 DiskEntry
->DiskNumber
,
2165 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE
));
2168 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2169 PartitionList
->CurrentPartition
->SectorCount
* DiskEntry
->BytesPerSector
/ 1048576);
2172 CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION
));
2174 PartEntry
= PartitionList
->CurrentPartition
;
2177 MaxSize
= (PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
) / 1048576; /* in MBytes (rounded) */
2179 if (MaxSize
> PARTITION_MAXSIZE
)
2180 MaxSize
= PARTITION_MAXSIZE
;
2182 ShowPartitionSizeInputBox(12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
2183 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
2187 if (ConfirmQuit (Ir
) == TRUE
)
2192 else if (Cancel
== TRUE
)
2194 return SELECT_PARTITION_PAGE
;
2198 PartSize
= atoi(InputBuffer
);
2206 if (PartSize
> MaxSize
)
2212 /* Convert to bytes */
2213 if (PartSize
== MaxSize
)
2215 /* Use all of the unpartitioned disk space */
2216 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2220 /* Calculate the sector count from the size in MB */
2221 SectorCount
= PartSize
* 1048576 / DiskEntry
->BytesPerSector
;
2223 /* But never get larger than the unpartitioned disk space */
2224 if (SectorCount
> PartEntry
->SectorCount
.QuadPart
)
2225 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2228 DPRINT("Partition size: %I64u bytes\n", PartSize
);
2230 CreateLogicalPartition(PartitionList
,
2233 return SELECT_PARTITION_PAGE
;
2237 return CREATE_LOGICAL_PARTITION_PAGE
;
2242 DeletePartitionPage(PINPUT_RECORD Ir
)
2244 PDISKENTRY DiskEntry
;
2245 PPARTENTRY PartEntry
;
2251 if (PartitionList
== NULL
||
2252 PartitionList
->CurrentDisk
== NULL
||
2253 PartitionList
->CurrentPartition
== NULL
)
2255 /* FIXME: show an error dialog */
2259 DiskEntry
= PartitionList
->CurrentDisk
;
2260 PartEntry
= PartitionList
->CurrentPartition
;
2262 MUIDisplayPage(DELETE_PARTITION_PAGE
);
2264 /* Determine partition type */
2266 if (PartEntry
->New
== TRUE
)
2268 PartType
= MUIGetString(STRING_UNFORMATTED
);
2270 else if (PartEntry
->IsPartitioned
== TRUE
)
2272 if ((PartEntry
->PartitionType
== PARTITION_FAT_12
) ||
2273 (PartEntry
->PartitionType
== PARTITION_FAT_16
) ||
2274 (PartEntry
->PartitionType
== PARTITION_HUGE
) ||
2275 (PartEntry
->PartitionType
== PARTITION_XINT13
))
2279 else if ((PartEntry
->PartitionType
== PARTITION_FAT32
) ||
2280 (PartEntry
->PartitionType
== PARTITION_FAT32_XINT13
))
2284 else if (PartEntry
->PartitionType
== PARTITION_EXT2
)
2288 else if (PartEntry
->PartitionType
== PARTITION_IFS
)
2290 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2292 else if (IsContainerPartition(PartEntry
->PartitionType
))
2294 PartType
= MUIGetString(STRING_EXTENDED_PARTITION
);
2298 PartSize
= PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2300 if (PartSize
>= 10737418240) /* 10 GB */
2302 PartSize
= PartSize
/ 1073741824;
2303 Unit
= MUIGetString(STRING_GB
);
2307 if (PartSize
>= 10485760) /* 10 MB */
2309 PartSize
= PartSize
/ 1048576;
2310 Unit
= MUIGetString(STRING_MB
);
2314 PartSize
= PartSize
/ 1024;
2315 Unit
= MUIGetString(STRING_KB
);
2318 if (PartType
== NULL
)
2320 CONSOLE_PrintTextXY(6, 10,
2321 MUIGetString(STRING_HDDINFOUNK2
),
2322 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2323 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2324 PartEntry
->PartitionType
,
2330 CONSOLE_PrintTextXY(6, 10,
2331 " %c%c %s %I64u %s",
2332 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2333 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2339 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2341 if (DiskSize
>= 10737418240) /* 10 GB */
2343 DiskSize
= DiskSize
/ 1073741824;
2344 Unit
= MUIGetString(STRING_GB
);
2349 DiskSize
= DiskSize
/ 1048576;
2353 Unit
= MUIGetString(STRING_MB
);
2356 if (DiskEntry
->DriverName
.Length
> 0)
2358 CONSOLE_PrintTextXY(6, 12,
2359 MUIGetString(STRING_HDINFOPARTDELETE
),
2362 DiskEntry
->DiskNumber
,
2366 &DiskEntry
->DriverName
);
2370 CONSOLE_PrintTextXY(6, 12,
2371 MUIGetString(STRING_HDDINFOUNK3
),
2374 DiskEntry
->DiskNumber
,
2382 CONSOLE_ConInKey(Ir
);
2384 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2385 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2387 if (ConfirmQuit(Ir
) == TRUE
)
2394 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
2396 return SELECT_PARTITION_PAGE
;
2398 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
2400 DeleteCurrentPartition(PartitionList
);
2402 return SELECT_PARTITION_PAGE
;
2406 return DELETE_PARTITION_PAGE
;
2411 SelectFileSystemPage(PINPUT_RECORD Ir
)
2413 PDISKENTRY DiskEntry
;
2414 PPARTENTRY PartEntry
;
2421 if (PartitionList
== NULL
||
2422 PartitionList
->CurrentDisk
== NULL
||
2423 PartitionList
->CurrentPartition
== NULL
)
2425 /* FIXME: show an error dialog */
2429 DiskEntry
= PartitionList
->CurrentDisk
;
2430 PartEntry
= PartitionList
->CurrentPartition
;
2432 /* adjust disk size */
2433 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2434 if (DiskSize
>= 10737418240) /* 10 GB */
2436 DiskSize
= DiskSize
/ 1073741824;
2437 DiskUnit
= MUIGetString(STRING_GB
);
2441 DiskSize
= DiskSize
/ 1048576;
2442 DiskUnit
= MUIGetString(STRING_MB
);
2445 /* adjust partition size */
2446 PartSize
= PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2447 if (PartSize
>= 10737418240) /* 10 GB */
2449 PartSize
= PartSize
/ 1073741824;
2450 PartUnit
= MUIGetString(STRING_GB
);
2454 PartSize
= PartSize
/ 1048576;
2455 PartUnit
= MUIGetString(STRING_MB
);
2458 /* adjust partition type */
2459 if ((PartEntry
->PartitionType
== PARTITION_FAT_12
) ||
2460 (PartEntry
->PartitionType
== PARTITION_FAT_16
) ||
2461 (PartEntry
->PartitionType
== PARTITION_HUGE
) ||
2462 (PartEntry
->PartitionType
== PARTITION_XINT13
))
2466 else if ((PartEntry
->PartitionType
== PARTITION_FAT32
) ||
2467 (PartEntry
->PartitionType
== PARTITION_FAT32_XINT13
))
2471 else if (PartEntry
->PartitionType
== PARTITION_EXT2
)
2475 else if (PartEntry
->PartitionType
== PARTITION_IFS
)
2477 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2479 else if (PartEntry
->PartitionType
== PARTITION_ENTRY_UNUSED
)
2481 PartType
= MUIGetString(STRING_FORMATUNUSED
);
2485 PartType
= MUIGetString(STRING_FORMATUNKNOWN
);
2488 if (PartEntry
->AutoCreate
== TRUE
)
2490 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NEWPARTITION
));
2493 CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2494 PartEntry
->PartitionNumber
,
2500 CONSOLE_PrintTextXY(8, 10, MUIGetString(STRING_HDINFOPARTZEROED
),
2501 DiskEntry
->DiskNumber
,
2507 &DiskEntry
->DriverName
);
2509 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_PARTFORMAT
));
2512 PartEntry
->AutoCreate
= FALSE
;
2514 else if (PartEntry
->New
== TRUE
)
2516 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDPART
));
2517 CONSOLE_SetTextXY(6, 10, MUIGetString(STRING_PARTFORMAT
));
2521 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_INSTALLONPART
));
2523 if (PartType
== NULL
)
2525 CONSOLE_PrintTextXY(8, 10,
2526 MUIGetString(STRING_HDDINFOUNK4
),
2527 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2528 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2529 PartEntry
->PartitionType
,
2535 CONSOLE_PrintTextXY(8, 10,
2537 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2538 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2544 CONSOLE_PrintTextXY(6, 12, MUIGetString(STRING_HDINFOPARTEXISTS
),
2545 DiskEntry
->DiskNumber
,
2551 &DiskEntry
->DriverName
);
2554 MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE
);
2556 if (FileSystemList
== NULL
)
2558 FileSystemList
= CreateFileSystemList(6, 26, PartEntry
->New
, L
"FAT");
2559 if (FileSystemList
== NULL
)
2561 /* FIXME: show an error dialog */
2565 /* FIXME: Add file systems to list */
2568 DrawFileSystemList(FileSystemList
);
2570 if (RepairUpdateFlag
)
2572 return CHECK_FILE_SYSTEM_PAGE
;
2573 //return SELECT_PARTITION_PAGE;
2576 if (IsUnattendedSetup
)
2578 if (UnattendFormatPartition
)
2580 return FORMAT_PARTITION_PAGE
;
2583 return CHECK_FILE_SYSTEM_PAGE
;
2588 CONSOLE_ConInKey(Ir
);
2590 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2591 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2593 if (ConfirmQuit(Ir
) == TRUE
)
2600 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2601 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2603 return SELECT_PARTITION_PAGE
;
2605 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2606 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2608 ScrollDownFileSystemList(FileSystemList
);
2610 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2611 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2613 ScrollUpFileSystemList(FileSystemList
);
2615 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2617 if (!FileSystemList
->Selected
->FormatFunc
)
2619 return CHECK_FILE_SYSTEM_PAGE
;
2623 return FORMAT_PARTITION_PAGE
;
2628 return SELECT_FILE_SYSTEM_PAGE
;
2633 FormatPartitionPage(PINPUT_RECORD Ir
)
2635 WCHAR PathBuffer
[MAX_PATH
];
2636 PDISKENTRY DiskEntry
;
2637 PPARTENTRY PartEntry
;
2646 MUIDisplayPage(FORMAT_PARTITION_PAGE
);
2648 if (PartitionList
== NULL
||
2649 PartitionList
->CurrentDisk
== NULL
||
2650 PartitionList
->CurrentPartition
== NULL
)
2652 /* FIXME: show an error dialog */
2656 DiskEntry
= PartitionList
->CurrentDisk
;
2657 PartEntry
= PartitionList
->CurrentPartition
;
2661 if (!IsUnattendedSetup
)
2663 CONSOLE_ConInKey(Ir
);
2666 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2667 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2669 if (ConfirmQuit(Ir
) == TRUE
)
2676 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
|| IsUnattendedSetup
) /* ENTER */
2678 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2680 if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"FAT") == 0)
2682 if (PartEntry
->SectorCount
.QuadPart
< 8192)
2684 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2685 PartEntry
->PartitionType
= PARTITION_FAT_12
;
2687 else if (PartEntry
->StartSector
.QuadPart
< 1450560)
2689 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2691 if (PartEntry
->SectorCount
.QuadPart
< 65536)
2693 /* FAT16 CHS partition (partiton size < 32MB) */
2694 PartEntry
->PartitionType
= PARTITION_FAT_16
;
2696 else if (PartEntry
->SectorCount
.QuadPart
< 1048576)
2698 /* FAT16 CHS partition (partition size < 512MB) */
2699 PartEntry
->PartitionType
= PARTITION_HUGE
;
2703 /* FAT32 CHS partition (partition size >= 512MB) */
2704 PartEntry
->PartitionType
= PARTITION_FAT32
;
2709 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2711 if (PartEntry
->SectorCount
.QuadPart
< 1048576)
2713 /* FAT16 LBA partition (partition size < 512MB) */
2714 PartEntry
->PartitionType
= PARTITION_XINT13
;
2718 /* FAT32 LBA partition (partition size >= 512MB) */
2719 PartEntry
->PartitionType
= PARTITION_FAT32_XINT13
;
2723 DiskEntry
->LayoutBuffer
->PartitionEntry
[PartEntry
->PartitionIndex
].PartitionType
= PartEntry
->PartitionType
;
2726 else if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"EXT2") == 0)
2728 PartEntry
->PartitionType
= PARTITION_EXT2
;
2729 DiskEntry
->LayoutBuffer
->PartitionEntry
[PartEntry
->PartitionIndex
].PartitionType
= PartEntry
->PartitionType
;
2732 else if (!FileSystemList
->Selected
->FormatFunc
)
2736 CONSOLE_PrintTextXY(6, 12,
2737 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2738 DiskEntry
->DiskSize
,
2739 DiskEntry
->CylinderSize
,
2740 DiskEntry
->TrackSize
);
2743 DiskEntry
= PartitionList
->CurrentDisk
;
2744 Entry
= DiskEntry
->PartListHead
.Flink
;
2746 while (Entry
!= &DiskEntry
->PrimaryPartListHead
)
2748 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2750 if (PartEntry
->IsPartitioned
== TRUE
)
2752 CONSOLE_PrintTextXY(6, Line
,
2753 "%2u: %2u %c %12I64u %12I64u %2u %c",
2755 PartEntry
->PartitionNumber
,
2756 PartEntry
->BootIndicator
? 'A' : '-',
2757 PartEntry
->StartSector
.QuadPart
,
2758 PartEntry
->SectorCount
.QuadPart
,
2759 PartEntry
->PartitionType
,
2760 PartEntry
->Dirty
? '*' : ' ');
2764 Entry
= Entry
->Flink
;
2767 /* Restore the old entry */
2768 PartEntry
= PartitionList
->CurrentPartition
;
2771 CheckActiveBootPartition(PartitionList
);
2773 if (WritePartitionsToDisk(PartitionList
) == FALSE
)
2775 DPRINT("WritePartitionsToDisk() failed\n");
2776 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2780 /* Set DestinationRootPath */
2781 RtlFreeUnicodeString(&DestinationRootPath
);
2782 swprintf(PathBuffer
,
2783 L
"\\Device\\Harddisk%lu\\Partition%lu",
2784 PartitionList
->CurrentDisk
->DiskNumber
,
2785 PartitionList
->CurrentPartition
->PartitionNumber
);
2786 RtlCreateUnicodeString(&DestinationRootPath
,
2788 DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2790 if (FileSystemList
->Selected
->FormatFunc
)
2792 Status
= FormatPartition(&DestinationRootPath
,
2793 FileSystemList
->Selected
);
2794 if (!NT_SUCCESS(Status
))
2796 DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status
);
2797 /* FIXME: show an error dialog */
2801 PartEntry
->New
= FALSE
;
2806 CONSOLE_SetStatusText(" Done. Press any key ...");
2807 CONSOLE_ConInKey(Ir
);
2810 DestroyFileSystemList(FileSystemList
);
2811 FileSystemList
= NULL
;
2812 return INSTALL_DIRECTORY_PAGE
;
2816 return FORMAT_PARTITION_PAGE
;
2821 CheckFileSystemPage(PINPUT_RECORD Ir
)
2823 PFILE_SYSTEM_ITEM CurrentFileSystem
;
2824 WCHAR PathBuffer
[MAX_PATH
];
2825 CHAR Buffer
[MAX_PATH
];
2828 /* FIXME: code duplicated in FormatPartitionPage */
2829 /* Set DestinationRootPath */
2830 RtlFreeUnicodeString(&DestinationRootPath
);
2831 swprintf(PathBuffer
,
2832 L
"\\Device\\Harddisk%lu\\Partition%lu",
2833 PartitionList
->CurrentDisk
->DiskNumber
,
2834 PartitionList
->CurrentPartition
->PartitionNumber
);
2835 RtlCreateUnicodeString(&DestinationRootPath
, PathBuffer
);
2836 DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2838 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART
));
2840 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2842 /* WRONG: first filesystem is not necesseraly the one of the current partition! */
2843 CurrentFileSystem
= CONTAINING_RECORD(FileSystemList
->ListHead
.Flink
, FILE_SYSTEM_ITEM
, ListEntry
);
2845 if (!CurrentFileSystem
->ChkdskFunc
)
2848 "Setup is currently unable to check a partition formatted in %S.\n"
2850 " \x07 Press ENTER to continue Setup.\n"
2851 " \x07 Press F3 to quit Setup.",
2852 CurrentFileSystem
->FileSystem
);
2855 MUIGetString(STRING_QUITCONTINUE
),
2856 NULL
, POPUP_WAIT_NONE
);
2860 CONSOLE_ConInKey(Ir
);
2862 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00 &&
2863 Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
) /* F3 */
2865 if (ConfirmQuit(Ir
))
2868 return CHECK_FILE_SYSTEM_PAGE
;
2870 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== VK_RETURN
) /* ENTER */
2872 return INSTALL_DIRECTORY_PAGE
;
2878 Status
= ChkdskPartition(&DestinationRootPath
, CurrentFileSystem
);
2879 if (!NT_SUCCESS(Status
))
2881 DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status
);
2882 sprintf(Buffer
, "Setup failed to verify the selected partition.\n"
2883 "(Status 0x%08lx).\n", Status
);
2886 MUIGetString(STRING_REBOOTCOMPUTER
),
2887 Ir
, POPUP_WAIT_ENTER
);
2892 return INSTALL_DIRECTORY_PAGE
;
2898 InstallDirectoryPage1(PWCHAR InstallDir
,
2899 PDISKENTRY DiskEntry
,
2900 PPARTENTRY PartEntry
)
2902 WCHAR PathBuffer
[MAX_PATH
];
2904 /* Create 'InstallPath' string */
2905 RtlFreeUnicodeString(&InstallPath
);
2906 RtlCreateUnicodeString(&InstallPath
,
2909 /* Create 'DestinationPath' string */
2910 RtlFreeUnicodeString(&DestinationPath
);
2911 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2913 if (InstallDir
[0] != L
'\\')
2914 wcscat(PathBuffer
, L
"\\");
2916 wcscat(PathBuffer
, InstallDir
);
2917 RtlCreateUnicodeString(&DestinationPath
, PathBuffer
);
2919 /* Create 'DestinationArcPath' */
2920 RtlFreeUnicodeString(&DestinationArcPath
);
2921 swprintf(PathBuffer
,
2922 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2923 DiskEntry
->BiosDiskNumber
,
2924 PartEntry
->PartitionNumber
);
2926 if (InstallDir
[0] != L
'\\')
2927 wcscat(PathBuffer
, L
"\\");
2929 wcscat(PathBuffer
, InstallDir
);
2930 RtlCreateUnicodeString(&DestinationArcPath
, PathBuffer
);
2932 return PREPARE_COPY_PAGE
;
2937 InstallDirectoryPage(PINPUT_RECORD Ir
)
2939 PDISKENTRY DiskEntry
;
2940 PPARTENTRY PartEntry
;
2941 WCHAR InstallDir
[51];
2944 if (PartitionList
== NULL
||
2945 PartitionList
->CurrentDisk
== NULL
||
2946 PartitionList
->CurrentPartition
== NULL
)
2948 /* FIXME: show an error dialog */
2952 DiskEntry
= PartitionList
->CurrentDisk
;
2953 PartEntry
= PartitionList
->CurrentPartition
;
2955 if (IsUnattendedSetup
)
2956 wcscpy(InstallDir
, UnattendInstallationDirectory
);
2958 wcscpy(InstallDir
, L
"\\ReactOS");
2960 Length
= wcslen(InstallDir
);
2961 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
2962 MUIDisplayPage(INSTALL_DIRECTORY_PAGE
);
2964 // FIXME: Check the validity of the InstallDir; however what to do
2965 // if it is invalid but we are in unattended setup? (case of somebody
2966 // specified an invalid installation directory in the unattended file).
2968 if (IsUnattendedSetup
)
2970 return InstallDirectoryPage1(InstallDir
,
2977 CONSOLE_ConInKey(Ir
);
2979 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2980 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2982 if (ConfirmQuit(Ir
) == TRUE
)
2987 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2990 * Check for the validity of the installation directory and pop up
2991 * an error if it is not the case. Then the user can fix its input.
2993 if (!IsValidPath(InstallDir
, Length
))
2995 MUIDisplayError(ERROR_DIRECTORY_NAME
, Ir
, POPUP_WAIT_ENTER
);
2996 return INSTALL_DIRECTORY_PAGE
;
2998 return InstallDirectoryPage1(InstallDir
,
3002 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
3007 InstallDir
[Length
] = 0;
3008 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
3011 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
3015 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
3017 InstallDir
[Length
] = 0;
3018 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
3023 return INSTALL_DIRECTORY_PAGE
;
3028 AddSectionToCopyQueueCab(HINF InfFile
,
3030 PWCHAR SourceCabinet
,
3031 PCUNICODE_STRING DestinationPath
,
3034 INFCONTEXT FilesContext
;
3035 INFCONTEXT DirContext
;
3037 PWCHAR FileKeyValue
;
3039 PWCHAR TargetFileName
;
3041 /* Search for the SectionName section */
3042 if (!SetupFindFirstLineW(InfFile
, SectionName
, NULL
, &FilesContext
))
3045 sprintf(Buffer
, MUIGetString(STRING_TXTSETUPFAILED
), SectionName
);
3046 PopupError(Buffer
, MUIGetString(STRING_REBOOTCOMPUTER
), Ir
, POPUP_WAIT_ENTER
);
3051 * Enumerate the files in the section
3052 * and add them to the file queue.
3056 /* Get source file name and target directory id */
3057 if (!INF_GetData(&FilesContext
, &FileKeyName
, &FileKeyValue
))
3059 /* FIXME: Handle error! */
3060 DPRINT1("INF_GetData() failed\n");
3064 /* Get optional target file name */
3065 if (!INF_GetDataField(&FilesContext
, 2, &TargetFileName
))
3066 TargetFileName
= NULL
;
3068 DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
3070 /* Lookup target directory */
3071 if (!SetupFindFirstLineW(InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
3073 /* FIXME: Handle error! */
3074 DPRINT1("SetupFindFirstLine() failed\n");
3078 if (!INF_GetData(&DirContext
, NULL
, &DirKeyValue
))
3080 /* FIXME: Handle error! */
3081 DPRINT1("INF_GetData() failed\n");
3085 if (!SetupQueueCopy(SetupFileQueue
,
3087 SourceRootPath
.Buffer
,
3088 SourceRootDir
.Buffer
,
3093 /* FIXME: Handle error! */
3094 DPRINT1("SetupQueueCopy() failed\n");
3096 } while (SetupFindNextLine(&FilesContext
, &FilesContext
));
3103 AddSectionToCopyQueue(HINF InfFile
,
3105 PWCHAR SourceCabinet
,
3106 PCUNICODE_STRING DestinationPath
,
3109 INFCONTEXT FilesContext
;
3110 INFCONTEXT DirContext
;
3112 PWCHAR FileKeyValue
;
3114 PWCHAR TargetFileName
;
3116 WCHAR CompleteOrigDirName
[512];
3119 return AddSectionToCopyQueueCab(InfFile
, L
"SourceFiles", SourceCabinet
, DestinationPath
, Ir
);
3121 /* Search for the SectionName section */
3122 if (!SetupFindFirstLineW(InfFile
, SectionName
, NULL
, &FilesContext
))
3125 sprintf(Buffer
, MUIGetString(STRING_TXTSETUPFAILED
), SectionName
);
3126 PopupError(Buffer
, MUIGetString(STRING_REBOOTCOMPUTER
), Ir
, POPUP_WAIT_ENTER
);
3131 * Enumerate the files in the section
3132 * and add them to the file queue.
3136 /* Get source file name and target directory id */
3137 if (!INF_GetData(&FilesContext
, &FileKeyName
, &FileKeyValue
))
3139 /* FIXME: Handle error! */
3140 DPRINT1("INF_GetData() failed\n");
3144 /* Get target directory id */
3145 if (!INF_GetDataField(&FilesContext
, 13, &FileKeyValue
))
3147 /* FIXME: Handle error! */
3148 DPRINT1("INF_GetData() failed\n");
3152 /* Get optional target file name */
3153 if (!INF_GetDataField(&FilesContext
, 11, &TargetFileName
))
3154 TargetFileName
= NULL
;
3155 else if (!*TargetFileName
)
3156 TargetFileName
= NULL
;
3158 DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
3160 /* Lookup target directory */
3161 if (!SetupFindFirstLineW(InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
3163 /* FIXME: Handle error! */
3164 DPRINT1("SetupFindFirstLine() failed\n");
3168 if (!INF_GetData(&DirContext
, NULL
, &DirKeyValue
))
3170 /* FIXME: Handle error! */
3171 DPRINT1("INF_GetData() failed\n");
3175 if ((DirKeyValue
[0] == 0) || (DirKeyValue
[0] == L
'\\' && DirKeyValue
[1] == 0))
3177 /* Installation path */
3178 wcscpy(CompleteOrigDirName
, SourceRootDir
.Buffer
);
3180 else if (DirKeyValue
[0] == L
'\\')
3183 wcscpy(CompleteOrigDirName
, DirKeyValue
);
3185 else // if (DirKeyValue[0] != L'\\')
3187 /* Path relative to the installation path */
3188 wcscpy(CompleteOrigDirName
, SourceRootDir
.Buffer
);
3189 wcscat(CompleteOrigDirName
, L
"\\");
3190 wcscat(CompleteOrigDirName
, DirKeyValue
);
3193 /* Remove trailing backslash */
3194 Length
= wcslen(CompleteOrigDirName
);
3195 if ((Length
> 0) && (CompleteOrigDirName
[Length
- 1] == L
'\\'))
3197 CompleteOrigDirName
[Length
- 1] = 0;
3200 if (!SetupQueueCopy(SetupFileQueue
,
3202 SourceRootPath
.Buffer
,
3203 CompleteOrigDirName
,
3208 /* FIXME: Handle error! */
3209 DPRINT1("SetupQueueCopy() failed\n");
3211 } while (SetupFindNextLine(&FilesContext
, &FilesContext
));
3218 PrepareCopyPageInfFile(HINF InfFile
,
3219 PWCHAR SourceCabinet
,
3222 WCHAR PathBuffer
[MAX_PATH
];
3223 INFCONTEXT DirContext
;
3224 PWCHAR AdditionalSectionName
= NULL
;
3229 /* Add common files */
3230 if (!AddSectionToCopyQueue(InfFile
, L
"SourceDisksFiles", SourceCabinet
, &DestinationPath
, Ir
))
3233 /* Add specific files depending of computer type */
3234 if (SourceCabinet
== NULL
)
3236 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
3239 if (AdditionalSectionName
)
3241 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, &DestinationPath
, Ir
))
3246 /* Create directories */
3250 * - Install directories like '\reactos\test' are not handled yet.
3251 * - Copying files to DestinationRootPath should be done from within
3252 * the SystemPartitionFiles section.
3253 * At the moment we check whether we specify paths like '\foo' or '\\' for that.
3254 * For installing to DestinationPath specify just '\' .
3257 /* Get destination path */
3258 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
3260 /* Remove trailing backslash */
3261 Length
= wcslen(PathBuffer
);
3262 if ((Length
> 0) && (PathBuffer
[Length
- 1] == L
'\\'))
3264 PathBuffer
[Length
- 1] = 0;
3267 /* Create the install directory */
3268 Status
= SetupCreateDirectory(PathBuffer
);
3269 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
3271 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
3272 MUIDisplayError(ERROR_CREATE_INSTALL_DIR
, Ir
, POPUP_WAIT_ENTER
);
3276 /* Search for the 'Directories' section */
3277 if (!SetupFindFirstLineW(InfFile
, L
"Directories", NULL
, &DirContext
))
3281 MUIDisplayError(ERROR_CABINET_SECTION
, Ir
, POPUP_WAIT_ENTER
);
3285 MUIDisplayError(ERROR_TXTSETUP_SECTION
, Ir
, POPUP_WAIT_ENTER
);
3291 /* Enumerate the directory values and create the subdirectories */
3294 if (!INF_GetData(&DirContext
, NULL
, &DirKeyValue
))
3300 if ((DirKeyValue
[0] == 0) || (DirKeyValue
[0] == L
'\\' && DirKeyValue
[1] == 0))
3302 /* Installation path */
3303 DPRINT("InstallationPath: '%S'\n", DirKeyValue
);
3305 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
3307 DPRINT("FullPath: '%S'\n", PathBuffer
);
3309 else if (DirKeyValue
[0] == L
'\\')
3312 DPRINT("Absolute Path: '%S'\n", DirKeyValue
);
3314 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
3315 wcscat(PathBuffer
, DirKeyValue
);
3317 /* Remove trailing backslash */
3318 Length
= wcslen(PathBuffer
);
3319 if ((Length
> 0) && (PathBuffer
[Length
- 1] == L
'\\'))
3321 PathBuffer
[Length
- 1] = 0;
3324 DPRINT("FullPath: '%S'\n", PathBuffer
);
3326 Status
= SetupCreateDirectory(PathBuffer
);
3327 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
3329 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
3330 MUIDisplayError(ERROR_CREATE_DIR
, Ir
, POPUP_WAIT_ENTER
);
3334 else // if (DirKeyValue[0] != L'\\')
3336 /* Path relative to the installation path */
3337 DPRINT("RelativePath: '%S'\n", DirKeyValue
);
3339 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
3340 wcscat(PathBuffer
, L
"\\");
3341 wcscat(PathBuffer
, DirKeyValue
);
3343 /* Remove trailing backslash */
3344 Length
= wcslen(PathBuffer
);
3345 if ((Length
> 0) && (PathBuffer
[Length
- 1] == L
'\\'))
3347 PathBuffer
[Length
- 1] = 0;
3350 DPRINT("FullPath: '%S'\n", PathBuffer
);
3352 Status
= SetupCreateDirectory(PathBuffer
);
3353 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
3355 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
3356 MUIDisplayError(ERROR_CREATE_DIR
, Ir
, POPUP_WAIT_ENTER
);
3360 } while (SetupFindNextLine(&DirContext
, &DirContext
));
3367 PrepareCopyPage(PINPUT_RECORD Ir
)
3370 WCHAR PathBuffer
[MAX_PATH
];
3371 INFCONTEXT CabinetsContext
;
3377 MUIDisplayPage(PREPARE_COPY_PAGE
);
3379 /* Create the file queue */
3380 SetupFileQueue
= SetupOpenFileQueue();
3381 if (SetupFileQueue
== NULL
)
3383 MUIDisplayError(ERROR_COPY_QUEUE
, Ir
, POPUP_WAIT_ENTER
);
3387 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
3392 /* Search for the 'Cabinets' section */
3393 if (!SetupFindFirstLineW(SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
3395 return FILE_COPY_PAGE
;
3399 * Enumerate the directory values in the 'Cabinets'
3400 * section and parse their inf files.
3404 if (!INF_GetData(&CabinetsContext
, NULL
, &KeyValue
))
3407 wcscpy(PathBuffer
, SourcePath
.Buffer
);
3408 wcscat(PathBuffer
, L
"\\");
3409 wcscat(PathBuffer
, KeyValue
);
3412 CabinetInitialize();
3413 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
3414 CabinetSetCabinetName(PathBuffer
);
3416 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
3418 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
3420 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
3421 if (InfFileData
== NULL
)
3423 MUIDisplayError(ERROR_CABINET_SCRIPT
, Ir
, POPUP_WAIT_ENTER
);
3429 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
3430 MUIDisplayError(ERROR_CABINET_MISSING
, Ir
, POPUP_WAIT_ENTER
);
3434 InfHandle
= INF_OpenBufferedFileA((CHAR
*) InfFileData
,
3441 if (InfHandle
== INVALID_HANDLE_VALUE
)
3443 MUIDisplayError(ERROR_INVALID_CABINET_INF
, Ir
, POPUP_WAIT_ENTER
);
3449 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3454 } while (SetupFindNextLine(&CabinetsContext
, &CabinetsContext
));
3456 return FILE_COPY_PAGE
;
3462 SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext
,
3465 SYSTEM_PERFORMANCE_INFORMATION PerfInfo
;
3467 /* Get the memory information from the system */
3468 NtQuerySystemInformation(SystemPerformanceInformation
,
3473 /* Check if this is initial setup */
3476 /* Set maximum limits to be total RAM pages */
3477 ProgressSetStepCount(CopyContext
->MemoryBars
[0], PerfInfo
.CommitLimit
);
3478 ProgressSetStepCount(CopyContext
->MemoryBars
[1], PerfInfo
.CommitLimit
);
3479 ProgressSetStepCount(CopyContext
->MemoryBars
[2], PerfInfo
.CommitLimit
);
3482 /* Set current values */
3483 ProgressSetStep(CopyContext
->MemoryBars
[0], PerfInfo
.PagedPoolPages
+ PerfInfo
.NonPagedPoolPages
);
3484 ProgressSetStep(CopyContext
->MemoryBars
[1], PerfInfo
.ResidentSystemCachePage
);
3485 ProgressSetStep(CopyContext
->MemoryBars
[2], PerfInfo
.AvailablePages
);
3491 FileCopyCallback(PVOID Context
,
3496 PCOPYCONTEXT CopyContext
;
3498 CopyContext
= (PCOPYCONTEXT
)Context
;
3500 switch (Notification
)
3502 case SPFILENOTIFY_STARTSUBQUEUE
:
3503 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3504 ProgressSetStepCount(CopyContext
->ProgressBar
,
3505 CopyContext
->TotalOperations
);
3506 SetupUpdateMemoryInfo(CopyContext
, TRUE
);
3509 case SPFILENOTIFY_STARTCOPY
:
3510 /* Display copy message */
3511 CONSOLE_SetStatusText(MUIGetString(STRING_COPYING
), (PWSTR
)Param1
);
3512 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
3515 case SPFILENOTIFY_ENDCOPY
:
3516 CopyContext
->CompletedOperations
++;
3518 /* SYSREG checkpoint */
3519 if (CopyContext
->TotalOperations
>> 1 == CopyContext
->CompletedOperations
)
3520 DPRINT1("CHECKPOINT:HALF_COPIED\n");
3522 ProgressNextStep(CopyContext
->ProgressBar
);
3523 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
3533 FileCopyPage(PINPUT_RECORD Ir
)
3535 COPYCONTEXT CopyContext
;
3536 unsigned int mem_bar_width
;
3538 MUIDisplayPage(FILE_COPY_PAGE
);
3540 /* Create context for the copy process */
3541 CopyContext
.DestinationRootPath
= DestinationRootPath
.Buffer
;
3542 CopyContext
.InstallPath
= InstallPath
.Buffer
;
3543 CopyContext
.TotalOperations
= 0;
3544 CopyContext
.CompletedOperations
= 0;
3546 /* Create the progress bar as well */
3547 CopyContext
.ProgressBar
= CreateProgressBar(13,
3554 MUIGetString(STRING_SETUPCOPYINGFILES
));
3556 // fit memory bars to screen width, distribute them uniform
3557 mem_bar_width
= (xScreen
- 26) / 5;
3558 mem_bar_width
-= mem_bar_width
% 2; // make even
3559 /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
3560 /* Create the paged pool progress bar */
3561 CopyContext
.MemoryBars
[0] = CreateProgressBar(13,
3570 /* Create the non paged pool progress bar */
3571 CopyContext
.MemoryBars
[1] = CreateProgressBar((xScreen
/ 2)- (mem_bar_width
/ 2),
3573 (xScreen
/ 2) + (mem_bar_width
/ 2),
3575 (xScreen
/ 2)- (mem_bar_width
/ 2),
3580 /* Create the global memory progress bar */
3581 CopyContext
.MemoryBars
[2] = CreateProgressBar(xScreen
- 13 - mem_bar_width
,
3585 xScreen
- 13 - mem_bar_width
,
3590 /* Do the file copying */
3591 SetupCommitFileQueueW(NULL
,
3596 /* If we get here, we're done, so cleanup the queue and progress bar */
3597 SetupCloseFileQueue(SetupFileQueue
);
3598 DestroyProgressBar(CopyContext
.ProgressBar
);
3599 DestroyProgressBar(CopyContext
.MemoryBars
[0]);
3600 DestroyProgressBar(CopyContext
.MemoryBars
[1]);
3601 DestroyProgressBar(CopyContext
.MemoryBars
[2]);
3603 /* Go display the next page */
3604 return REGISTRY_PAGE
;
3609 RegistryPage(PINPUT_RECORD Ir
)
3611 INFCONTEXT InfContext
;
3618 MUIDisplayPage(REGISTRY_PAGE
);
3620 if (RepairUpdateFlag
)
3622 return SUCCESS_PAGE
;
3625 if (!SetInstallPathValue(&DestinationPath
))
3627 DPRINT1("SetInstallPathValue() failed\n");
3628 MUIDisplayError(ERROR_INITIALIZE_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
3632 /* Create the default hives */
3634 Status
= NtInitializeRegistry(CM_BOOT_FLAG_SETUP
);
3635 if (!NT_SUCCESS(Status
))
3637 DPRINT1("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3638 MUIDisplayError(ERROR_CREATE_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3642 RegInitializeRegistry();
3645 /* Update registry */
3646 CONSOLE_SetStatusText(MUIGetString(STRING_REGHIVEUPDATE
));
3648 if (!SetupFindFirstLineW(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3650 DPRINT1("SetupFindFirstLine() failed\n");
3651 MUIDisplayError(ERROR_FIND_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
3657 INF_GetDataField (&InfContext
, 0, &Action
);
3658 INF_GetDataField (&InfContext
, 1, &File
);
3659 INF_GetDataField (&InfContext
, 2, &Section
);
3661 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3666 if (!_wcsicmp (Action
, L
"AddReg"))
3670 else if (!_wcsicmp (Action
, L
"DelReg"))
3679 CONSOLE_SetStatusText(MUIGetString(STRING_IMPORTFILE
), File
);
3681 if (!ImportRegistryFile(File
, Section
, LanguageId
, Delete
))
3683 DPRINT1("Importing %S failed\n", File
);
3685 MUIDisplayError(ERROR_IMPORT_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3688 } while (SetupFindNextLine(&InfContext
, &InfContext
));
3690 /* Update display registry settings */
3691 CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYETTINGSUPDATE
));
3692 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3694 MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3698 /* Set the locale */
3699 CONSOLE_SetStatusText(MUIGetString(STRING_LOCALESETTINGSUPDATE
));
3700 if (!ProcessLocaleRegistry(LanguageList
))
3702 MUIDisplayError(ERROR_UPDATE_LOCALESETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3706 /* Add keyboard layouts */
3707 CONSOLE_SetStatusText(MUIGetString(STRING_ADDKBLAYOUTS
));
3708 if (!AddKeyboardLayouts())
3710 MUIDisplayError(ERROR_ADDING_KBLAYOUTS
, Ir
, POPUP_WAIT_ENTER
);
3716 if (!SetGeoID(MUIGetGeoID()))
3718 MUIDisplayError(ERROR_UPDATE_GEOID
, Ir
, POPUP_WAIT_ENTER
);
3722 if (!IsUnattendedSetup
)
3724 /* Update keyboard layout settings */
3725 CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE
));
3726 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3728 MUIDisplayError(ERROR_UPDATE_KBSETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3733 /* Add codepage information to registry */
3734 CONSOLE_SetStatusText(MUIGetString(STRING_CODEPAGEINFOUPDATE
));
3737 MUIDisplayError(ERROR_ADDING_CODEPAGE
, Ir
, POPUP_WAIT_ENTER
);
3741 /* Set the default pagefile entry */
3742 SetDefaultPagefile(DestinationDriveLetter
);
3744 /* Update the mounted devices list */
3745 SetMountedDeviceValues(PartitionList
);
3747 CONSOLE_SetStatusText(MUIGetString(STRING_DONE
));
3749 return BOOT_LOADER_PAGE
;
3754 BootLoaderPage(PINPUT_RECORD Ir
)
3756 UCHAR PartitionType
;
3757 BOOLEAN InstallOnFloppy
;
3759 WCHAR PathBuffer
[MAX_PATH
];
3761 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
3763 /* Find or set the active partition */
3764 CheckActiveBootPartition(PartitionList
);
3766 /* Update the partition table because we may have changed the active partition */
3767 if (WritePartitionsToDisk(PartitionList
) == FALSE
)
3769 DPRINT("WritePartitionsToDisk() failed\n");
3770 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
3774 RtlFreeUnicodeString(&SystemRootPath
);
3775 swprintf(PathBuffer
,
3776 L
"\\Device\\Harddisk%lu\\Partition%lu",
3777 PartitionList
->ActiveBootDisk
->DiskNumber
,
3778 PartitionList
->ActiveBootPartition
->PartitionNumber
);
3779 RtlCreateUnicodeString(&SystemRootPath
,
3781 DPRINT("SystemRootPath: %wZ\n", &SystemRootPath
);
3783 PartitionType
= PartitionList
->ActiveBootPartition
->PartitionType
;
3785 if (IsUnattendedSetup
)
3787 if (UnattendMBRInstallType
== 0) /* skip MBR installation */
3789 return SUCCESS_PAGE
;
3791 else if (UnattendMBRInstallType
== 1) /* install on floppy */
3793 return BOOT_LOADER_FLOPPY_PAGE
;
3797 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3799 DPRINT("Error: active partition invalid (unused)\n");
3800 InstallOnFloppy
= TRUE
;
3802 else if (PartitionType
== 0x0A)
3804 /* OS/2 boot manager partition */
3805 DPRINT("Found OS/2 boot manager partition\n");
3806 InstallOnFloppy
= TRUE
;
3808 else if (PartitionType
== 0x83)
3810 /* Linux ext2 partition */
3811 DPRINT("Found Linux ext2 partition\n");
3812 InstallOnFloppy
= TRUE
;
3814 else if (PartitionType
== PARTITION_IFS
)
3816 /* NTFS partition */
3817 DPRINT("Found NTFS partition\n");
3818 InstallOnFloppy
= TRUE
;
3820 else if ((PartitionType
== PARTITION_FAT_12
) ||
3821 (PartitionType
== PARTITION_FAT_16
) ||
3822 (PartitionType
== PARTITION_HUGE
) ||
3823 (PartitionType
== PARTITION_XINT13
) ||
3824 (PartitionType
== PARTITION_FAT32
) ||
3825 (PartitionType
== PARTITION_FAT32_XINT13
))
3827 DPRINT("Found FAT partition\n");
3828 InstallOnFloppy
= FALSE
;
3832 /* Unknown partition */
3833 DPRINT("Unknown partition found\n");
3834 InstallOnFloppy
= TRUE
;
3837 if (InstallOnFloppy
== TRUE
)
3839 return BOOT_LOADER_FLOPPY_PAGE
;
3842 /* Unattended install on hdd? */
3843 if (IsUnattendedSetup
&& UnattendMBRInstallType
== 2)
3845 return BOOT_LOADER_HARDDISK_MBR_PAGE
;
3848 MUIDisplayPage(BOOT_LOADER_PAGE
);
3849 CONSOLE_InvertTextXY(8, Line
, 60, 1);
3853 CONSOLE_ConInKey(Ir
);
3855 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3856 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3858 CONSOLE_NormalTextXY(8, Line
, 60, 1);
3867 CONSOLE_InvertTextXY(8, Line
, 60, 1);
3869 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3870 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3872 CONSOLE_NormalTextXY(8, Line
, 60, 1);
3881 CONSOLE_InvertTextXY(8, Line
, 60, 1);
3883 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3884 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3886 if (ConfirmQuit(Ir
) == TRUE
)
3891 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3895 return BOOT_LOADER_HARDDISK_MBR_PAGE
;
3897 else if (Line
== 13)
3899 return BOOT_LOADER_HARDDISK_VBR_PAGE
;
3901 else if (Line
== 14)
3903 return BOOT_LOADER_FLOPPY_PAGE
;
3905 else if (Line
== 15)
3907 return SUCCESS_PAGE
;
3910 return BOOT_LOADER_PAGE
;
3914 return BOOT_LOADER_PAGE
;
3919 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3923 MUIDisplayPage(BOOT_LOADER_FLOPPY_PAGE
);
3925 // SetStatusText(" Please wait...");
3929 CONSOLE_ConInKey(Ir
);
3931 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3932 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3934 if (ConfirmQuit(Ir
) == TRUE
)
3939 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3941 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3943 MUIDisplayError(ERROR_NO_FLOPPY
, Ir
, POPUP_WAIT_ENTER
);
3944 return BOOT_LOADER_FLOPPY_PAGE
;
3947 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
, &DestinationArcPath
);
3948 if (!NT_SUCCESS(Status
))
3950 /* Print error message */
3951 return BOOT_LOADER_FLOPPY_PAGE
;
3954 return SUCCESS_PAGE
;
3958 return BOOT_LOADER_FLOPPY_PAGE
;
3962 BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir
)
3964 UCHAR PartitionType
;
3967 PartitionType
= PartitionList
->ActiveBootPartition
->PartitionType
;
3969 Status
= InstallVBRToPartition(&SystemRootPath
,
3971 &DestinationArcPath
,
3973 if (!NT_SUCCESS(Status
))
3975 MUIDisplayError(ERROR_WRITE_BOOT
, Ir
, POPUP_WAIT_ENTER
);
3979 return SUCCESS_PAGE
;
3983 BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir
)
3985 UCHAR PartitionType
;
3987 WCHAR DestinationDevicePathBuffer
[MAX_PATH
];
3988 WCHAR SourceMbrPathBuffer
[MAX_PATH
];
3990 /* Step 1: Write the VBR */
3991 PartitionType
= PartitionList
->ActiveBootPartition
->PartitionType
;
3993 Status
= InstallVBRToPartition(&SystemRootPath
,
3995 &DestinationArcPath
,
3997 if (!NT_SUCCESS(Status
))
3999 MUIDisplayError(ERROR_WRITE_BOOT
, Ir
, POPUP_WAIT_ENTER
);
4003 /* Step 2: Write the MBR */
4004 swprintf(DestinationDevicePathBuffer
,
4005 L
"\\Device\\Harddisk%d\\Partition0",
4006 PartitionList
->ActiveBootDisk
->DiskNumber
);
4008 wcscpy(SourceMbrPathBuffer
, SourceRootPath
.Buffer
);
4009 wcscat(SourceMbrPathBuffer
, L
"\\loader\\dosmbr.bin");
4011 DPRINT("Install MBR bootcode: %S ==> %S\n",
4012 SourceMbrPathBuffer
, DestinationDevicePathBuffer
);
4014 Status
= InstallMbrBootCodeToDisk(SourceMbrPathBuffer
,
4015 DestinationDevicePathBuffer
);
4016 if (!NT_SUCCESS (Status
))
4018 DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
4020 MUIDisplayError(ERROR_INSTALL_BOOTCODE
, Ir
, POPUP_WAIT_ENTER
);
4024 return SUCCESS_PAGE
;
4029 QuitPage(PINPUT_RECORD Ir
)
4031 MUIDisplayPage(QUIT_PAGE
);
4033 /* Destroy partition list */
4034 if (PartitionList
!= NULL
)
4036 DestroyPartitionList (PartitionList
);
4037 PartitionList
= NULL
;
4040 /* Destroy filesystem list */
4041 if (FileSystemList
!= NULL
)
4043 DestroyFileSystemList (FileSystemList
);
4044 FileSystemList
= NULL
;
4047 /* Destroy computer settings list */
4048 if (ComputerList
!= NULL
)
4050 DestroyGenericList(ComputerList
, TRUE
);
4051 ComputerList
= NULL
;
4054 /* Destroy display settings list */
4055 if (DisplayList
!= NULL
)
4057 DestroyGenericList(DisplayList
, TRUE
);
4061 /* Destroy keyboard settings list */
4062 if (KeyboardList
!= NULL
)
4064 DestroyGenericList(KeyboardList
, TRUE
);
4065 KeyboardList
= NULL
;
4068 /* Destroy keyboard layout list */
4069 if (LayoutList
!= NULL
)
4071 DestroyGenericList(LayoutList
, TRUE
);
4075 if (LanguageList
!= NULL
)
4077 DestroyGenericList(LanguageList
, FALSE
);
4078 LanguageList
= NULL
;
4081 CONSOLE_SetStatusText(MUIGetString(STRING_REBOOTCOMPUTER2
));
4085 CONSOLE_ConInKey(Ir
);
4087 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
4096 SuccessPage(PINPUT_RECORD Ir
)
4098 MUIDisplayPage(SUCCESS_PAGE
);
4100 if (IsUnattendedSetup
)
4107 CONSOLE_ConInKey(Ir
);
4109 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
4118 FlushPage(PINPUT_RECORD Ir
)
4120 MUIDisplayPage(FLUSH_PAGE
);
4126 PnpEventThread(IN LPVOID lpParameter
);
4137 NtQuerySystemTime(&Time
);
4139 Status
= RtlCreateUserThread(NtCurrentProcess(),
4149 if (!NT_SUCCESS(Status
))
4150 hPnpThread
= INVALID_HANDLE_VALUE
;
4152 if (!CONSOLE_Init())
4154 PrintString(MUIGetString(STRING_CONSOLEFAIL1
));
4155 PrintString(MUIGetString(STRING_CONSOLEFAIL2
));
4156 PrintString(MUIGetString(STRING_CONSOLEFAIL3
));
4158 /* Raise a hard error (crash the system/BSOD) */
4159 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
4163 /* Initialize global unicode strings */
4164 RtlInitUnicodeString(&SourcePath
, NULL
);
4165 RtlInitUnicodeString(&SourceRootPath
, NULL
);
4166 RtlInitUnicodeString(&SourceRootDir
, NULL
);
4167 RtlInitUnicodeString(&InstallPath
, NULL
);
4168 RtlInitUnicodeString(&DestinationPath
, NULL
);
4169 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
4170 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
4171 RtlInitUnicodeString(&SystemRootPath
, NULL
);
4173 /* Hide the cursor */
4174 CONSOLE_SetCursorType(TRUE
, FALSE
);
4177 while (Page
!= REBOOT_PAGE
&& Page
!= RECOVERY_PAGE
)
4179 CONSOLE_ClearScreen();
4182 //CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4189 Page
= SetupStartPage(&Ir
);
4194 Page
= LanguagePage(&Ir
);
4199 Page
= LicensePage(&Ir
);
4204 Page
= IntroPage(&Ir
);
4208 case INSTALL_INTRO_PAGE
:
4209 Page
= InstallIntroPage(&Ir
);
4213 case SCSI_CONTROLLER_PAGE
:
4214 Page
= ScsiControllerPage(&Ir
);
4219 case OEM_DRIVER_PAGE
:
4220 Page
= OemDriverPage(&Ir
);
4224 case DEVICE_SETTINGS_PAGE
:
4225 Page
= DeviceSettingsPage(&Ir
);
4228 case COMPUTER_SETTINGS_PAGE
:
4229 Page
= ComputerSettingsPage(&Ir
);
4232 case DISPLAY_SETTINGS_PAGE
:
4233 Page
= DisplaySettingsPage(&Ir
);
4236 case KEYBOARD_SETTINGS_PAGE
:
4237 Page
= KeyboardSettingsPage(&Ir
);
4240 case LAYOUT_SETTINGS_PAGE
:
4241 Page
= LayoutSettingsPage(&Ir
);
4244 case SELECT_PARTITION_PAGE
:
4245 Page
= SelectPartitionPage(&Ir
);
4248 case CREATE_PRIMARY_PARTITION_PAGE
:
4249 Page
= CreatePrimaryPartitionPage(&Ir
);
4252 case CREATE_EXTENDED_PARTITION_PAGE
:
4253 Page
= CreateExtendedPartitionPage(&Ir
);
4256 case CREATE_LOGICAL_PARTITION_PAGE
:
4257 Page
= CreateLogicalPartitionPage(&Ir
);
4260 case DELETE_PARTITION_PAGE
:
4261 Page
= DeletePartitionPage(&Ir
);
4264 case SELECT_FILE_SYSTEM_PAGE
:
4265 Page
= SelectFileSystemPage(&Ir
);
4268 case FORMAT_PARTITION_PAGE
:
4269 Page
= (PAGE_NUMBER
) FormatPartitionPage(&Ir
);
4272 case CHECK_FILE_SYSTEM_PAGE
:
4273 Page
= (PAGE_NUMBER
) CheckFileSystemPage(&Ir
);
4276 case INSTALL_DIRECTORY_PAGE
:
4277 Page
= InstallDirectoryPage(&Ir
);
4280 case PREPARE_COPY_PAGE
:
4281 Page
= PrepareCopyPage(&Ir
);
4284 case FILE_COPY_PAGE
:
4285 Page
= FileCopyPage(&Ir
);
4289 Page
= RegistryPage(&Ir
);
4292 case BOOT_LOADER_PAGE
:
4293 Page
= BootLoaderPage(&Ir
);
4296 case BOOT_LOADER_FLOPPY_PAGE
:
4297 Page
= BootLoaderFloppyPage(&Ir
);
4300 case BOOT_LOADER_HARDDISK_MBR_PAGE
:
4301 Page
= BootLoaderHarddiskMbrPage(&Ir
);
4304 case BOOT_LOADER_HARDDISK_VBR_PAGE
:
4305 Page
= BootLoaderHarddiskVbrPage(&Ir
);
4309 case REPAIR_INTRO_PAGE
:
4310 Page
= RepairIntroPage(&Ir
);
4314 Page
= SuccessPage(&Ir
);
4318 Page
= FlushPage(&Ir
);
4322 Page
= QuitPage(&Ir
);
4331 if (Page
== RECOVERY_PAGE
)
4336 /* Avoid bugcheck */
4337 Time
.QuadPart
+= 50000000;
4338 NtDelayExecution(FALSE
, &Time
);
4341 RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE
, TRUE
, FALSE
, &Old
);
4342 NtShutdownSystem(ShutdownReboot
);
4343 RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE
, Old
, FALSE
, &Old
);
4344 NtTerminateProcess(NtCurrentProcess(), 0);
4351 NtProcessStartup(PPEB Peb
)
4353 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
4355 ProcessHeap
= Peb
->ProcessHeap
;
4356 InfSetHeap(ProcessHeap
);
4359 #endif /* __REACTOS__ */