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
;
1682 DrawInputField(ULONG FieldLength
,
1693 memset(buf
, '_', sizeof(buf
));
1694 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1695 strcat(buf
, FieldContent
);
1697 WriteConsoleOutputCharacterA(StdOutput
,
1705 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1706 /* Restriction for MaxSize: pow(10, PARTITION_SIZE_INPUT_FIELD_LENGTH)-1 */
1707 #define PARTITION_MAXSIZE 999999
1710 ShowPartitionSizeInputBox(SHORT Left
,
1734 DrawBox(Left
, Top
, Right
- Left
+ 1, Bottom
- Top
+ 1);
1739 strcpy(Buffer
, MUIGetString(STRING_PARTITIONSIZE
));
1740 iLeft
= coPos
.X
+ strlen(Buffer
) + 1;
1743 WriteConsoleOutputCharacterA(StdOutput
,
1749 sprintf(Buffer
, MUIGetString(STRING_MAXSIZE
), MaxSize
);
1750 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1752 WriteConsoleOutputCharacterA(StdOutput
,
1758 sprintf(Buffer
, "%lu", MaxSize
);
1759 Index
= strlen(Buffer
);
1760 DrawInputField(PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1767 CONSOLE_ConInKey(&Ir
);
1769 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1770 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1778 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1782 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1790 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1796 DrawInputField(PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1801 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1802 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1804 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1806 if ((ch
>= '0') && (ch
<= '9'))
1812 DrawInputField(PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1820 strcpy(InputBuffer
, Buffer
);
1825 CreatePrimaryPartitionPage(PINPUT_RECORD Ir
)
1827 PDISKENTRY DiskEntry
;
1828 PPARTENTRY PartEntry
;
1831 CHAR InputBuffer
[50];
1835 ULONGLONG SectorCount
;
1839 if (PartitionList
== NULL
||
1840 PartitionList
->CurrentDisk
== NULL
||
1841 PartitionList
->CurrentPartition
== NULL
)
1843 /* FIXME: show an error dialog */
1847 DiskEntry
= PartitionList
->CurrentDisk
;
1848 PartEntry
= PartitionList
->CurrentPartition
;
1850 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
1852 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSENEWPARTITION
));
1854 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
1856 if (DiskSize
>= 10737418240) /* 10 GB */
1858 DiskSize
= DiskSize
/ 1073741824;
1859 Unit
= MUIGetString(STRING_GB
);
1864 DiskSize
= DiskSize
/ 1048576;
1868 Unit
= MUIGetString(STRING_MB
);
1871 if (DiskEntry
->DriverName
.Length
> 0)
1873 CONSOLE_PrintTextXY(6, 10,
1874 MUIGetString(STRING_HDINFOPARTCREATE
),
1877 DiskEntry
->DiskNumber
,
1881 &DiskEntry
->DriverName
);
1885 CONSOLE_PrintTextXY(6, 10,
1886 MUIGetString(STRING_HDDINFOUNK1
),
1889 DiskEntry
->DiskNumber
,
1895 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE
));
1898 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
1899 PartitionList
->CurrentPartition
->SectorCount
* DiskEntry
->BytesPerSector
/ 1048576);
1902 CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION
));
1904 PartEntry
= PartitionList
->CurrentPartition
;
1907 MaxSize
= (PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
) / 1048576; /* in MBytes (rounded) */
1909 if (MaxSize
> PARTITION_MAXSIZE
)
1910 MaxSize
= PARTITION_MAXSIZE
;
1912 ShowPartitionSizeInputBox(12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1913 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1917 if (ConfirmQuit (Ir
) == TRUE
)
1922 else if (Cancel
== TRUE
)
1924 return SELECT_PARTITION_PAGE
;
1928 PartSize
= atoi(InputBuffer
);
1936 if (PartSize
> MaxSize
)
1942 /* Convert to bytes */
1943 if (PartSize
== MaxSize
)
1945 /* Use all of the unpartitioned disk space */
1946 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
1950 /* Calculate the sector count from the size in MB */
1951 SectorCount
= PartSize
* 1048576 / DiskEntry
->BytesPerSector
;
1953 /* But never get larger than the unpartitioned disk space */
1954 if (SectorCount
> PartEntry
->SectorCount
.QuadPart
)
1955 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
1958 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1960 CreatePrimaryPartition(PartitionList
,
1964 Status
= WriteDirtyPartitions(PartitionList
);
1965 if (!NT_SUCCESS(Status
))
1967 DPRINT("WriteDirtyPartitions() failed\n");
1968 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
1972 return SELECT_PARTITION_PAGE
;
1976 return CREATE_PRIMARY_PARTITION_PAGE
;
1981 CreateExtendedPartitionPage(PINPUT_RECORD Ir
)
1983 PDISKENTRY DiskEntry
;
1984 PPARTENTRY PartEntry
;
1987 CHAR InputBuffer
[50];
1991 ULONGLONG SectorCount
;
1995 if (PartitionList
== NULL
||
1996 PartitionList
->CurrentDisk
== NULL
||
1997 PartitionList
->CurrentPartition
== NULL
)
1999 /* FIXME: show an error dialog */
2003 DiskEntry
= PartitionList
->CurrentDisk
;
2004 PartEntry
= PartitionList
->CurrentPartition
;
2006 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2008 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_EXTENDED_PARTITION
));
2010 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2012 if (DiskSize
>= 10737418240) /* 10 GB */
2014 DiskSize
= DiskSize
/ 1073741824;
2015 Unit
= MUIGetString(STRING_GB
);
2020 DiskSize
= DiskSize
/ 1048576;
2024 Unit
= MUIGetString(STRING_MB
);
2027 if (DiskEntry
->DriverName
.Length
> 0)
2029 CONSOLE_PrintTextXY(6, 10,
2030 MUIGetString(STRING_HDINFOPARTCREATE
),
2033 DiskEntry
->DiskNumber
,
2037 &DiskEntry
->DriverName
);
2041 CONSOLE_PrintTextXY(6, 10,
2042 MUIGetString(STRING_HDDINFOUNK1
),
2045 DiskEntry
->DiskNumber
,
2051 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE
));
2054 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2055 PartitionList
->CurrentPartition
->SectorCount
* DiskEntry
->BytesPerSector
/ 1048576);
2058 CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION
));
2060 PartEntry
= PartitionList
->CurrentPartition
;
2063 MaxSize
= (PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
) / 1048576; /* in MBytes (rounded) */
2065 if (MaxSize
> PARTITION_MAXSIZE
)
2066 MaxSize
= PARTITION_MAXSIZE
;
2068 ShowPartitionSizeInputBox(12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
2069 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
2073 if (ConfirmQuit (Ir
) == TRUE
)
2078 else if (Cancel
== TRUE
)
2080 return SELECT_PARTITION_PAGE
;
2084 PartSize
= atoi(InputBuffer
);
2092 if (PartSize
> MaxSize
)
2098 /* Convert to bytes */
2099 if (PartSize
== MaxSize
)
2101 /* Use all of the unpartitioned disk space */
2102 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2106 /* Calculate the sector count from the size in MB */
2107 SectorCount
= PartSize
* 1048576 / DiskEntry
->BytesPerSector
;
2109 /* But never get larger than the unpartitioned disk space */
2110 if (SectorCount
> PartEntry
->SectorCount
.QuadPart
)
2111 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2114 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
2116 CreateExtendedPartition(PartitionList
,
2119 Status
= WriteDirtyPartitions(PartitionList
);
2120 if (!NT_SUCCESS(Status
))
2122 DPRINT("WriteDirtyPartitions() failed\n");
2123 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2127 return SELECT_PARTITION_PAGE
;
2131 return CREATE_EXTENDED_PARTITION_PAGE
;
2136 CreateLogicalPartitionPage(PINPUT_RECORD Ir
)
2138 PDISKENTRY DiskEntry
;
2139 PPARTENTRY PartEntry
;
2142 CHAR InputBuffer
[50];
2146 ULONGLONG SectorCount
;
2150 if (PartitionList
== NULL
||
2151 PartitionList
->CurrentDisk
== NULL
||
2152 PartitionList
->CurrentPartition
== NULL
)
2154 /* FIXME: show an error dialog */
2158 DiskEntry
= PartitionList
->CurrentDisk
;
2159 PartEntry
= PartitionList
->CurrentPartition
;
2161 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2163 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_LOGICAL_PARTITION
));
2165 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2167 if (DiskSize
>= 10737418240) /* 10 GB */
2169 DiskSize
= DiskSize
/ 1073741824;
2170 Unit
= MUIGetString(STRING_GB
);
2175 DiskSize
= DiskSize
/ 1048576;
2179 Unit
= MUIGetString(STRING_MB
);
2182 if (DiskEntry
->DriverName
.Length
> 0)
2184 CONSOLE_PrintTextXY(6, 10,
2185 MUIGetString(STRING_HDINFOPARTCREATE
),
2188 DiskEntry
->DiskNumber
,
2192 &DiskEntry
->DriverName
);
2196 CONSOLE_PrintTextXY(6, 10,
2197 MUIGetString(STRING_HDDINFOUNK1
),
2200 DiskEntry
->DiskNumber
,
2206 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE
));
2209 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2210 PartitionList
->CurrentPartition
->SectorCount
* DiskEntry
->BytesPerSector
/ 1048576);
2213 CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION
));
2215 PartEntry
= PartitionList
->CurrentPartition
;
2218 MaxSize
= (PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
) / 1048576; /* in MBytes (rounded) */
2220 if (MaxSize
> PARTITION_MAXSIZE
)
2221 MaxSize
= PARTITION_MAXSIZE
;
2223 ShowPartitionSizeInputBox(12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
2224 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
2228 if (ConfirmQuit (Ir
) == TRUE
)
2233 else if (Cancel
== TRUE
)
2235 return SELECT_PARTITION_PAGE
;
2239 PartSize
= atoi(InputBuffer
);
2247 if (PartSize
> MaxSize
)
2253 /* Convert to bytes */
2254 if (PartSize
== MaxSize
)
2256 /* Use all of the unpartitioned disk space */
2257 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2261 /* Calculate the sector count from the size in MB */
2262 SectorCount
= PartSize
* 1048576 / DiskEntry
->BytesPerSector
;
2264 /* But never get larger than the unpartitioned disk space */
2265 if (SectorCount
> PartEntry
->SectorCount
.QuadPart
)
2266 SectorCount
= PartEntry
->SectorCount
.QuadPart
;
2269 DPRINT("Partition size: %I64u bytes\n", PartSize
);
2271 CreateLogicalPartition(PartitionList
,
2274 Status
= WriteDirtyPartitions(PartitionList
);
2275 if (!NT_SUCCESS(Status
))
2277 DPRINT("WriteDirtyPartitions() failed\n");
2278 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2282 return SELECT_PARTITION_PAGE
;
2286 return CREATE_LOGICAL_PARTITION_PAGE
;
2291 DeletePartitionPage(PINPUT_RECORD Ir
)
2293 PDISKENTRY DiskEntry
;
2294 PPARTENTRY PartEntry
;
2301 if (PartitionList
== NULL
||
2302 PartitionList
->CurrentDisk
== NULL
||
2303 PartitionList
->CurrentPartition
== NULL
)
2305 /* FIXME: show an error dialog */
2309 DiskEntry
= PartitionList
->CurrentDisk
;
2310 PartEntry
= PartitionList
->CurrentPartition
;
2312 MUIDisplayPage(DELETE_PARTITION_PAGE
);
2314 /* Determine partition type */
2316 if (PartEntry
->New
== TRUE
)
2318 PartType
= MUIGetString(STRING_UNFORMATTED
);
2320 else if (PartEntry
->IsPartitioned
== TRUE
)
2322 if ((PartEntry
->PartitionType
== PARTITION_FAT_12
) ||
2323 (PartEntry
->PartitionType
== PARTITION_FAT_16
) ||
2324 (PartEntry
->PartitionType
== PARTITION_HUGE
) ||
2325 (PartEntry
->PartitionType
== PARTITION_XINT13
))
2329 else if ((PartEntry
->PartitionType
== PARTITION_FAT32
) ||
2330 (PartEntry
->PartitionType
== PARTITION_FAT32_XINT13
))
2334 else if (PartEntry
->PartitionType
== PARTITION_EXT2
)
2338 else if (PartEntry
->PartitionType
== PARTITION_IFS
)
2340 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2342 else if (IsContainerPartition(PartEntry
->PartitionType
))
2344 PartType
= MUIGetString(STRING_EXTENDED_PARTITION
);
2348 PartSize
= PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2350 if (PartSize
>= 10737418240) /* 10 GB */
2352 PartSize
= PartSize
/ 1073741824;
2353 Unit
= MUIGetString(STRING_GB
);
2357 if (PartSize
>= 10485760) /* 10 MB */
2359 PartSize
= PartSize
/ 1048576;
2360 Unit
= MUIGetString(STRING_MB
);
2364 PartSize
= PartSize
/ 1024;
2365 Unit
= MUIGetString(STRING_KB
);
2368 if (PartType
== NULL
)
2370 CONSOLE_PrintTextXY(6, 10,
2371 MUIGetString(STRING_HDDINFOUNK2
),
2372 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2373 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2374 PartEntry
->PartitionType
,
2380 CONSOLE_PrintTextXY(6, 10,
2381 " %c%c %s %I64u %s",
2382 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2383 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2389 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2391 if (DiskSize
>= 10737418240) /* 10 GB */
2393 DiskSize
= DiskSize
/ 1073741824;
2394 Unit
= MUIGetString(STRING_GB
);
2399 DiskSize
= DiskSize
/ 1048576;
2403 Unit
= MUIGetString(STRING_MB
);
2406 if (DiskEntry
->DriverName
.Length
> 0)
2408 CONSOLE_PrintTextXY(6, 12,
2409 MUIGetString(STRING_HDINFOPARTDELETE
),
2412 DiskEntry
->DiskNumber
,
2416 &DiskEntry
->DriverName
);
2420 CONSOLE_PrintTextXY(6, 12,
2421 MUIGetString(STRING_HDDINFOUNK3
),
2424 DiskEntry
->DiskNumber
,
2432 CONSOLE_ConInKey(Ir
);
2434 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2435 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2437 if (ConfirmQuit(Ir
) == TRUE
)
2444 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
2446 return SELECT_PARTITION_PAGE
;
2448 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== 'D') /* D */
2450 DeleteCurrentPartition(PartitionList
);
2452 Status
= WriteDirtyPartitions(PartitionList
);
2453 if (!NT_SUCCESS(Status
))
2455 DPRINT("WriteDirtyPartitions() failed\n");
2456 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2460 return SELECT_PARTITION_PAGE
;
2464 return DELETE_PARTITION_PAGE
;
2469 SelectFileSystemPage(PINPUT_RECORD Ir
)
2471 PDISKENTRY DiskEntry
;
2472 PPARTENTRY PartEntry
;
2479 if (PartitionList
== NULL
||
2480 PartitionList
->CurrentDisk
== NULL
||
2481 PartitionList
->CurrentPartition
== NULL
)
2483 /* FIXME: show an error dialog */
2487 DiskEntry
= PartitionList
->CurrentDisk
;
2488 PartEntry
= PartitionList
->CurrentPartition
;
2490 /* adjust disk size */
2491 DiskSize
= DiskEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2492 if (DiskSize
>= 10737418240) /* 10 GB */
2494 DiskSize
= DiskSize
/ 1073741824;
2495 DiskUnit
= MUIGetString(STRING_GB
);
2499 DiskSize
= DiskSize
/ 1048576;
2500 DiskUnit
= MUIGetString(STRING_MB
);
2503 /* adjust partition size */
2504 PartSize
= PartEntry
->SectorCount
.QuadPart
* DiskEntry
->BytesPerSector
;
2505 if (PartSize
>= 10737418240) /* 10 GB */
2507 PartSize
= PartSize
/ 1073741824;
2508 PartUnit
= MUIGetString(STRING_GB
);
2512 PartSize
= PartSize
/ 1048576;
2513 PartUnit
= MUIGetString(STRING_MB
);
2516 /* adjust partition type */
2517 if ((PartEntry
->PartitionType
== PARTITION_FAT_12
) ||
2518 (PartEntry
->PartitionType
== PARTITION_FAT_16
) ||
2519 (PartEntry
->PartitionType
== PARTITION_HUGE
) ||
2520 (PartEntry
->PartitionType
== PARTITION_XINT13
))
2524 else if ((PartEntry
->PartitionType
== PARTITION_FAT32
) ||
2525 (PartEntry
->PartitionType
== PARTITION_FAT32_XINT13
))
2529 else if (PartEntry
->PartitionType
== PARTITION_EXT2
)
2533 else if (PartEntry
->PartitionType
== PARTITION_IFS
)
2535 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2537 else if (PartEntry
->PartitionType
== PARTITION_ENTRY_UNUSED
)
2539 PartType
= MUIGetString(STRING_FORMATUNUSED
);
2543 PartType
= MUIGetString(STRING_FORMATUNKNOWN
);
2546 if (PartEntry
->AutoCreate
== TRUE
)
2548 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NEWPARTITION
));
2551 CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2552 PartEntry
->PartitionNumber
,
2558 CONSOLE_PrintTextXY(8, 10, MUIGetString(STRING_HDINFOPARTZEROED
),
2559 DiskEntry
->DiskNumber
,
2565 &DiskEntry
->DriverName
);
2567 CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_PARTFORMAT
));
2570 PartEntry
->AutoCreate
= FALSE
;
2572 else if (PartEntry
->New
== TRUE
)
2574 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDPART
));
2575 CONSOLE_SetTextXY(6, 10, MUIGetString(STRING_PARTFORMAT
));
2579 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_INSTALLONPART
));
2581 if (PartType
== NULL
)
2583 CONSOLE_PrintTextXY(8, 10,
2584 MUIGetString(STRING_HDDINFOUNK4
),
2585 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2586 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2587 PartEntry
->PartitionType
,
2593 CONSOLE_PrintTextXY(8, 10,
2595 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2596 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2602 CONSOLE_PrintTextXY(6, 12, MUIGetString(STRING_HDINFOPARTEXISTS
),
2603 DiskEntry
->DiskNumber
,
2609 &DiskEntry
->DriverName
);
2612 MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE
);
2614 if (FileSystemList
== NULL
)
2616 FileSystemList
= CreateFileSystemList(6, 26, PartEntry
->New
, L
"FAT");
2617 if (FileSystemList
== NULL
)
2619 /* FIXME: show an error dialog */
2623 /* FIXME: Add file systems to list */
2626 DrawFileSystemList(FileSystemList
);
2628 if (RepairUpdateFlag
)
2630 return CHECK_FILE_SYSTEM_PAGE
;
2631 //return SELECT_PARTITION_PAGE;
2634 if (IsUnattendedSetup
)
2636 if (UnattendFormatPartition
)
2638 return FORMAT_PARTITION_PAGE
;
2641 return CHECK_FILE_SYSTEM_PAGE
;
2646 CONSOLE_ConInKey(Ir
);
2648 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2649 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2651 if (ConfirmQuit(Ir
) == TRUE
)
2658 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2659 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2661 return SELECT_PARTITION_PAGE
;
2663 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2664 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2666 ScrollDownFileSystemList(FileSystemList
);
2668 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2669 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2671 ScrollUpFileSystemList(FileSystemList
);
2673 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2675 if (!FileSystemList
->Selected
->FormatFunc
)
2677 return CHECK_FILE_SYSTEM_PAGE
;
2681 return FORMAT_PARTITION_PAGE
;
2686 return SELECT_FILE_SYSTEM_PAGE
;
2691 FormatPartitionPage(PINPUT_RECORD Ir
)
2693 WCHAR PathBuffer
[MAX_PATH
];
2694 PDISKENTRY DiskEntry
;
2695 PPARTENTRY PartEntry
;
2704 MUIDisplayPage(FORMAT_PARTITION_PAGE
);
2706 if (PartitionList
== NULL
||
2707 PartitionList
->CurrentDisk
== NULL
||
2708 PartitionList
->CurrentPartition
== NULL
)
2710 /* FIXME: show an error dialog */
2714 DiskEntry
= PartitionList
->CurrentDisk
;
2715 PartEntry
= PartitionList
->CurrentPartition
;
2719 if (!IsUnattendedSetup
)
2721 CONSOLE_ConInKey(Ir
);
2724 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2725 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2727 if (ConfirmQuit(Ir
) == TRUE
)
2734 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
|| IsUnattendedSetup
) /* ENTER */
2736 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2738 if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"FAT") == 0)
2740 if (PartEntry
->SectorCount
.QuadPart
< 8192)
2742 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2743 PartEntry
->PartitionType
= PARTITION_FAT_12
;
2745 else if (PartEntry
->StartSector
.QuadPart
< 1450560)
2747 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2749 if (PartEntry
->SectorCount
.QuadPart
< 65536)
2751 /* FAT16 CHS partition (partiton size < 32MB) */
2752 PartEntry
->PartitionType
= PARTITION_FAT_16
;
2754 else if (PartEntry
->SectorCount
.QuadPart
< 1048576)
2756 /* FAT16 CHS partition (partition size < 512MB) */
2757 PartEntry
->PartitionType
= PARTITION_HUGE
;
2761 /* FAT32 CHS partition (partition size >= 512MB) */
2762 PartEntry
->PartitionType
= PARTITION_FAT32
;
2767 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2769 if (PartEntry
->SectorCount
.QuadPart
< 1048576)
2771 /* FAT16 LBA partition (partition size < 512MB) */
2772 PartEntry
->PartitionType
= PARTITION_XINT13
;
2776 /* FAT32 LBA partition (partition size >= 512MB) */
2777 PartEntry
->PartitionType
= PARTITION_FAT32_XINT13
;
2781 DiskEntry
->LayoutBuffer
->PartitionEntry
[PartEntry
->PartitionIndex
].PartitionType
= PartEntry
->PartitionType
;
2784 else if (wcscmp(FileSystemList
->Selected
->FileSystem
, L
"EXT2") == 0)
2786 PartEntry
->PartitionType
= PARTITION_EXT2
;
2787 DiskEntry
->LayoutBuffer
->PartitionEntry
[PartEntry
->PartitionIndex
].PartitionType
= PartEntry
->PartitionType
;
2790 else if (!FileSystemList
->Selected
->FormatFunc
)
2794 CONSOLE_PrintTextXY(6, 12,
2795 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2796 DiskEntry
->DiskSize
,
2797 DiskEntry
->CylinderSize
,
2798 DiskEntry
->TrackSize
);
2801 DiskEntry
= PartitionList
->CurrentDisk
;
2802 Entry
= DiskEntry
->PartListHead
.Flink
;
2804 while (Entry
!= &DiskEntry
->PrimaryPartListHead
)
2806 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2808 if (PartEntry
->IsPartitioned
== TRUE
)
2810 CONSOLE_PrintTextXY(6, Line
,
2811 "%2u: %2u %c %12I64u %12I64u %2u %c",
2813 PartEntry
->PartitionNumber
,
2814 PartEntry
->BootIndicator
? 'A' : '-',
2815 PartEntry
->StartSector
.QuadPart
,
2816 PartEntry
->SectorCount
.QuadPart
,
2817 PartEntry
->PartitionType
,
2818 PartEntry
->Dirty
? '*' : ' ');
2822 Entry
= Entry
->Flink
;
2825 /* Restore the old entry */
2826 PartEntry
= PartitionList
->CurrentPartition
;
2829 CheckActiveBootPartition(PartitionList
);
2831 Status
= WriteDirtyPartitions(PartitionList
);
2832 if (!NT_SUCCESS(Status
))
2834 DPRINT("WriteDirtyPartitions() failed\n");
2835 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
2839 /* Set DestinationRootPath */
2840 RtlFreeUnicodeString(&DestinationRootPath
);
2841 swprintf(PathBuffer
,
2842 L
"\\Device\\Harddisk%lu\\Partition%lu",
2843 PartitionList
->CurrentDisk
->DiskNumber
,
2844 PartitionList
->CurrentPartition
->PartitionNumber
);
2845 RtlCreateUnicodeString(&DestinationRootPath
,
2847 DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2849 if (FileSystemList
->Selected
->FormatFunc
)
2851 Status
= FormatPartition(&DestinationRootPath
,
2852 FileSystemList
->Selected
);
2853 if (!NT_SUCCESS(Status
))
2855 DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status
);
2856 /* FIXME: show an error dialog */
2860 PartEntry
->New
= FALSE
;
2865 CONSOLE_SetStatusText(" Done. Press any key ...");
2866 CONSOLE_ConInKey(Ir
);
2869 DestroyFileSystemList(FileSystemList
);
2870 FileSystemList
= NULL
;
2871 return INSTALL_DIRECTORY_PAGE
;
2875 return FORMAT_PARTITION_PAGE
;
2880 CheckFileSystemPage(PINPUT_RECORD Ir
)
2882 PFILE_SYSTEM_ITEM CurrentFileSystem
;
2883 WCHAR PathBuffer
[MAX_PATH
];
2884 CHAR Buffer
[MAX_PATH
];
2887 /* FIXME: code duplicated in FormatPartitionPage */
2888 /* Set DestinationRootPath */
2889 RtlFreeUnicodeString(&DestinationRootPath
);
2890 swprintf(PathBuffer
,
2891 L
"\\Device\\Harddisk%lu\\Partition%lu",
2892 PartitionList
->CurrentDisk
->DiskNumber
,
2893 PartitionList
->CurrentPartition
->PartitionNumber
);
2894 RtlCreateUnicodeString(&DestinationRootPath
, PathBuffer
);
2895 DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2897 CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART
));
2899 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
2901 /* WRONG: first filesystem is not necesseraly the one of the current partition! */
2902 CurrentFileSystem
= CONTAINING_RECORD(FileSystemList
->ListHead
.Flink
, FILE_SYSTEM_ITEM
, ListEntry
);
2904 if (!CurrentFileSystem
->ChkdskFunc
)
2907 "Setup is currently unable to check a partition formatted in %S.\n"
2909 " \x07 Press ENTER to continue Setup.\n"
2910 " \x07 Press F3 to quit Setup.",
2911 CurrentFileSystem
->FileSystem
);
2914 MUIGetString(STRING_QUITCONTINUE
),
2915 NULL
, POPUP_WAIT_NONE
);
2919 CONSOLE_ConInKey(Ir
);
2921 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00 &&
2922 Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
) /* F3 */
2924 if (ConfirmQuit(Ir
))
2927 return CHECK_FILE_SYSTEM_PAGE
;
2929 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== VK_RETURN
) /* ENTER */
2931 return INSTALL_DIRECTORY_PAGE
;
2937 Status
= ChkdskPartition(&DestinationRootPath
, CurrentFileSystem
);
2938 if (!NT_SUCCESS(Status
))
2940 DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status
);
2941 sprintf(Buffer
, "Setup failed to verify the selected partition.\n"
2942 "(Status 0x%08lx).\n", Status
);
2945 MUIGetString(STRING_REBOOTCOMPUTER
),
2946 Ir
, POPUP_WAIT_ENTER
);
2951 return INSTALL_DIRECTORY_PAGE
;
2957 InstallDirectoryPage1(PWCHAR InstallDir
,
2958 PDISKENTRY DiskEntry
,
2959 PPARTENTRY PartEntry
)
2961 WCHAR PathBuffer
[MAX_PATH
];
2963 /* Create 'InstallPath' string */
2964 RtlFreeUnicodeString(&InstallPath
);
2965 RtlCreateUnicodeString(&InstallPath
,
2968 /* Create 'DestinationPath' string */
2969 RtlFreeUnicodeString(&DestinationPath
);
2970 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2972 if (InstallDir
[0] != L
'\\')
2973 wcscat(PathBuffer
, L
"\\");
2975 wcscat(PathBuffer
, InstallDir
);
2976 RtlCreateUnicodeString(&DestinationPath
, PathBuffer
);
2978 /* Create 'DestinationArcPath' */
2979 RtlFreeUnicodeString(&DestinationArcPath
);
2980 swprintf(PathBuffer
,
2981 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2982 DiskEntry
->BiosDiskNumber
,
2983 PartEntry
->PartitionNumber
);
2985 if (InstallDir
[0] != L
'\\')
2986 wcscat(PathBuffer
, L
"\\");
2988 wcscat(PathBuffer
, InstallDir
);
2989 RtlCreateUnicodeString(&DestinationArcPath
, PathBuffer
);
2991 return PREPARE_COPY_PAGE
;
2996 InstallDirectoryPage(PINPUT_RECORD Ir
)
2998 PDISKENTRY DiskEntry
;
2999 PPARTENTRY PartEntry
;
3000 WCHAR InstallDir
[51];
3003 if (PartitionList
== NULL
||
3004 PartitionList
->CurrentDisk
== NULL
||
3005 PartitionList
->CurrentPartition
== NULL
)
3007 /* FIXME: show an error dialog */
3011 DiskEntry
= PartitionList
->CurrentDisk
;
3012 PartEntry
= PartitionList
->CurrentPartition
;
3014 if (IsUnattendedSetup
)
3015 wcscpy(InstallDir
, UnattendInstallationDirectory
);
3017 wcscpy(InstallDir
, L
"\\ReactOS");
3019 Length
= wcslen(InstallDir
);
3020 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
3021 MUIDisplayPage(INSTALL_DIRECTORY_PAGE
);
3023 if (IsUnattendedSetup
)
3025 return InstallDirectoryPage1(InstallDir
,
3032 CONSOLE_ConInKey(Ir
);
3034 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3035 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3037 if (ConfirmQuit(Ir
) == TRUE
)
3042 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3044 return InstallDirectoryPage1(InstallDir
,
3048 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
3053 InstallDir
[Length
] = 0;
3054 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
3057 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
3061 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
3063 InstallDir
[Length
] = 0;
3064 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir
);
3069 return INSTALL_DIRECTORY_PAGE
;
3074 AddSectionToCopyQueueCab(HINF InfFile
,
3076 PWCHAR SourceCabinet
,
3077 PCUNICODE_STRING DestinationPath
,
3080 INFCONTEXT FilesContext
;
3081 INFCONTEXT DirContext
;
3083 PWCHAR FileKeyValue
;
3085 PWCHAR TargetFileName
;
3087 /* Search for the SectionName section */
3088 if (!SetupFindFirstLineW(InfFile
, SectionName
, NULL
, &FilesContext
))
3091 sprintf(Buffer
, MUIGetString(STRING_TXTSETUPFAILED
), SectionName
);
3092 PopupError(Buffer
, MUIGetString(STRING_REBOOTCOMPUTER
), Ir
, POPUP_WAIT_ENTER
);
3097 * Enumerate the files in the section
3098 * and add them to the file queue.
3102 /* Get source file name and target directory id */
3103 if (!INF_GetData(&FilesContext
, &FileKeyName
, &FileKeyValue
))
3105 /* FIXME: Handle error! */
3106 DPRINT1("INF_GetData() failed\n");
3110 /* Get optional target file name */
3111 if (!INF_GetDataField(&FilesContext
, 2, &TargetFileName
))
3112 TargetFileName
= NULL
;
3114 DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
3116 /* Lookup target directory */
3117 if (!SetupFindFirstLineW(InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
3119 /* FIXME: Handle error! */
3120 DPRINT1("SetupFindFirstLine() failed\n");
3124 if (!INF_GetData(&DirContext
, NULL
, &DirKeyValue
))
3126 /* FIXME: Handle error! */
3127 DPRINT1("INF_GetData() failed\n");
3131 if (!SetupQueueCopy(SetupFileQueue
,
3133 SourceRootPath
.Buffer
,
3134 SourceRootDir
.Buffer
,
3139 /* FIXME: Handle error! */
3140 DPRINT1("SetupQueueCopy() failed\n");
3142 } while (SetupFindNextLine(&FilesContext
, &FilesContext
));
3149 AddSectionToCopyQueue(HINF InfFile
,
3151 PWCHAR SourceCabinet
,
3152 PCUNICODE_STRING DestinationPath
,
3155 INFCONTEXT FilesContext
;
3156 INFCONTEXT DirContext
;
3158 PWCHAR FileKeyValue
;
3160 PWCHAR TargetFileName
;
3161 WCHAR CompleteOrigFileName
[512];
3164 return AddSectionToCopyQueueCab(InfFile
, L
"SourceFiles", SourceCabinet
, DestinationPath
, Ir
);
3166 /* Search for the SectionName section */
3167 if (!SetupFindFirstLineW(InfFile
, SectionName
, NULL
, &FilesContext
))
3170 sprintf(Buffer
, MUIGetString(STRING_TXTSETUPFAILED
), SectionName
);
3171 PopupError(Buffer
, MUIGetString(STRING_REBOOTCOMPUTER
), Ir
, POPUP_WAIT_ENTER
);
3176 * Enumerate the files in the section
3177 * and add them to the file queue.
3181 /* Get source file name and target directory id */
3182 if (!INF_GetData(&FilesContext
, &FileKeyName
, &FileKeyValue
))
3184 /* FIXME: Handle error! */
3185 DPRINT1("INF_GetData() failed\n");
3189 /* Get target directory id */
3190 if (!INF_GetDataField(&FilesContext
, 13, &FileKeyValue
))
3192 /* FIXME: Handle error! */
3193 DPRINT1("INF_GetData() failed\n");
3197 /* Get optional target file name */
3198 if (!INF_GetDataField(&FilesContext
, 11, &TargetFileName
))
3199 TargetFileName
= NULL
;
3200 else if (!*TargetFileName
)
3201 TargetFileName
= NULL
;
3203 DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
3205 /* Lookup target directory */
3206 if (!SetupFindFirstLineW(InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
3208 /* FIXME: Handle error! */
3209 DPRINT1("SetupFindFirstLine() failed\n");
3213 if (!INF_GetData(&DirContext
, NULL
, &DirKeyValue
))
3215 /* FIXME: Handle error! */
3216 DPRINT1("INF_GetData() failed\n");
3220 wcscpy(CompleteOrigFileName
, SourceRootDir
.Buffer
);
3221 wcscat(CompleteOrigFileName
, L
"\\");
3222 wcscat(CompleteOrigFileName
, DirKeyValue
);
3224 if (!SetupQueueCopy(SetupFileQueue
,
3226 SourceRootPath
.Buffer
,
3227 CompleteOrigFileName
,
3232 /* FIXME: Handle error! */
3233 DPRINT1("SetupQueueCopy() failed\n");
3235 } while (SetupFindNextLine(&FilesContext
, &FilesContext
));
3242 PrepareCopyPageInfFile(HINF InfFile
,
3243 PWCHAR SourceCabinet
,
3246 WCHAR PathBuffer
[MAX_PATH
];
3247 INFCONTEXT DirContext
;
3248 PWCHAR AdditionalSectionName
= NULL
;
3253 /* Add common files */
3254 if (!AddSectionToCopyQueue(InfFile
, L
"SourceDisksFiles", SourceCabinet
, &DestinationPath
, Ir
))
3257 /* Add specific files depending of computer type */
3258 if (SourceCabinet
== NULL
)
3260 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
3263 if (AdditionalSectionName
)
3265 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, &DestinationPath
, Ir
))
3270 /* Create directories */
3274 * Install directories like '\reactos\test' are not handled yet.
3277 /* Get destination path */
3278 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
3280 /* Remove trailing backslash */
3281 Length
= wcslen(PathBuffer
);
3282 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
3284 PathBuffer
[Length
- 1] = 0;
3287 /* Create the install directory */
3288 Status
= SetupCreateDirectory(PathBuffer
);
3289 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
3291 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
3292 MUIDisplayError(ERROR_CREATE_INSTALL_DIR
, Ir
, POPUP_WAIT_ENTER
);
3296 /* Search for the 'Directories' section */
3297 if (!SetupFindFirstLineW(InfFile
, L
"Directories", NULL
, &DirContext
))
3301 MUIDisplayError(ERROR_CABINET_SECTION
, Ir
, POPUP_WAIT_ENTER
);
3305 MUIDisplayError(ERROR_TXTSETUP_SECTION
, Ir
, POPUP_WAIT_ENTER
);
3311 /* Enumerate the directory values and create the subdirectories */
3314 if (!INF_GetData(&DirContext
, NULL
, &KeyValue
))
3320 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
3322 DPRINT("Absolute Path: '%S'\n", KeyValue
);
3324 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
3325 wcscat(PathBuffer
, KeyValue
);
3327 DPRINT("FullPath: '%S'\n", PathBuffer
);
3329 else if (KeyValue
[0] != L
'\\')
3331 DPRINT("RelativePath: '%S'\n", KeyValue
);
3332 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
3333 wcscat(PathBuffer
, L
"\\");
3334 wcscat(PathBuffer
, KeyValue
);
3336 DPRINT("FullPath: '%S'\n", PathBuffer
);
3338 Status
= SetupCreateDirectory(PathBuffer
);
3339 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
3341 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
3342 MUIDisplayError(ERROR_CREATE_DIR
, Ir
, POPUP_WAIT_ENTER
);
3346 } while (SetupFindNextLine (&DirContext
, &DirContext
));
3353 PrepareCopyPage(PINPUT_RECORD Ir
)
3356 WCHAR PathBuffer
[MAX_PATH
];
3357 INFCONTEXT CabinetsContext
;
3363 MUIDisplayPage(PREPARE_COPY_PAGE
);
3365 /* Create the file queue */
3366 SetupFileQueue
= SetupOpenFileQueue();
3367 if (SetupFileQueue
== NULL
)
3369 MUIDisplayError(ERROR_COPY_QUEUE
, Ir
, POPUP_WAIT_ENTER
);
3373 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
3378 /* Search for the 'Cabinets' section */
3379 if (!SetupFindFirstLineW(SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
3381 return FILE_COPY_PAGE
;
3385 * Enumerate the directory values in the 'Cabinets'
3386 * section and parse their inf files.
3390 if (!INF_GetData(&CabinetsContext
, NULL
, &KeyValue
))
3393 wcscpy(PathBuffer
, SourcePath
.Buffer
);
3394 wcscat(PathBuffer
, L
"\\");
3395 wcscat(PathBuffer
, KeyValue
);
3398 CabinetInitialize();
3399 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
3400 CabinetSetCabinetName(PathBuffer
);
3402 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
3404 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
3406 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
3407 if (InfFileData
== NULL
)
3409 MUIDisplayError(ERROR_CABINET_SCRIPT
, Ir
, POPUP_WAIT_ENTER
);
3415 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
3416 MUIDisplayError(ERROR_CABINET_MISSING
, Ir
, POPUP_WAIT_ENTER
);
3420 InfHandle
= INF_OpenBufferedFileA((CHAR
*) InfFileData
,
3427 if (InfHandle
== INVALID_HANDLE_VALUE
)
3429 MUIDisplayError(ERROR_INVALID_CABINET_INF
, Ir
, POPUP_WAIT_ENTER
);
3435 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3440 } while (SetupFindNextLine(&CabinetsContext
, &CabinetsContext
));
3442 return FILE_COPY_PAGE
;
3448 SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext
,
3451 SYSTEM_PERFORMANCE_INFORMATION PerfInfo
;
3453 /* Get the memory information from the system */
3454 NtQuerySystemInformation(SystemPerformanceInformation
,
3459 /* Check if this is initial setup */
3462 /* Set maximum limits to be total RAM pages */
3463 ProgressSetStepCount(CopyContext
->MemoryBars
[0], PerfInfo
.CommitLimit
);
3464 ProgressSetStepCount(CopyContext
->MemoryBars
[1], PerfInfo
.CommitLimit
);
3465 ProgressSetStepCount(CopyContext
->MemoryBars
[2], PerfInfo
.CommitLimit
);
3468 /* Set current values */
3469 ProgressSetStep(CopyContext
->MemoryBars
[0], PerfInfo
.PagedPoolPages
+ PerfInfo
.NonPagedPoolPages
);
3470 ProgressSetStep(CopyContext
->MemoryBars
[1], PerfInfo
.ResidentSystemCachePage
);
3471 ProgressSetStep(CopyContext
->MemoryBars
[2], PerfInfo
.AvailablePages
);
3477 FileCopyCallback(PVOID Context
,
3482 PCOPYCONTEXT CopyContext
;
3484 CopyContext
= (PCOPYCONTEXT
)Context
;
3486 switch (Notification
)
3488 case SPFILENOTIFY_STARTSUBQUEUE
:
3489 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3490 ProgressSetStepCount(CopyContext
->ProgressBar
,
3491 CopyContext
->TotalOperations
);
3492 SetupUpdateMemoryInfo(CopyContext
, TRUE
);
3495 case SPFILENOTIFY_STARTCOPY
:
3496 /* Display copy message */
3497 CONSOLE_SetStatusText(MUIGetString(STRING_COPYING
), (PWSTR
)Param1
);
3498 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
3501 case SPFILENOTIFY_ENDCOPY
:
3502 CopyContext
->CompletedOperations
++;
3504 /* SYSREG checkpoint */
3505 if (CopyContext
->TotalOperations
>> 1 == CopyContext
->CompletedOperations
)
3506 DPRINT1("CHECKPOINT:HALF_COPIED\n");
3508 ProgressNextStep(CopyContext
->ProgressBar
);
3509 SetupUpdateMemoryInfo(CopyContext
, FALSE
);
3519 FileCopyPage(PINPUT_RECORD Ir
)
3521 COPYCONTEXT CopyContext
;
3522 unsigned int mem_bar_width
;
3524 MUIDisplayPage(FILE_COPY_PAGE
);
3526 /* Create context for the copy process */
3527 CopyContext
.DestinationRootPath
= DestinationRootPath
.Buffer
;
3528 CopyContext
.InstallPath
= InstallPath
.Buffer
;
3529 CopyContext
.TotalOperations
= 0;
3530 CopyContext
.CompletedOperations
= 0;
3532 /* Create the progress bar as well */
3533 CopyContext
.ProgressBar
= CreateProgressBar(13,
3540 MUIGetString(STRING_SETUPCOPYINGFILES
));
3542 // fit memory bars to screen width, distribute them uniform
3543 mem_bar_width
= (xScreen
- 26) / 5;
3544 mem_bar_width
-= mem_bar_width
% 2; // make even
3545 /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
3546 /* Create the paged pool progress bar */
3547 CopyContext
.MemoryBars
[0] = CreateProgressBar(13,
3556 /* Create the non paged pool progress bar */
3557 CopyContext
.MemoryBars
[1] = CreateProgressBar((xScreen
/ 2)- (mem_bar_width
/ 2),
3559 (xScreen
/ 2) + (mem_bar_width
/ 2),
3561 (xScreen
/ 2)- (mem_bar_width
/ 2),
3566 /* Create the global memory progress bar */
3567 CopyContext
.MemoryBars
[2] = CreateProgressBar(xScreen
- 13 - mem_bar_width
,
3571 xScreen
- 13 - mem_bar_width
,
3576 /* Do the file copying */
3577 SetupCommitFileQueueW(NULL
,
3582 /* If we get here, we're done, so cleanup the queue and progress bar */
3583 SetupCloseFileQueue(SetupFileQueue
);
3584 DestroyProgressBar(CopyContext
.ProgressBar
);
3585 DestroyProgressBar(CopyContext
.MemoryBars
[0]);
3586 DestroyProgressBar(CopyContext
.MemoryBars
[1]);
3587 DestroyProgressBar(CopyContext
.MemoryBars
[2]);
3589 /* Go display the next page */
3590 return REGISTRY_PAGE
;
3595 RegistryPage(PINPUT_RECORD Ir
)
3597 INFCONTEXT InfContext
;
3604 MUIDisplayPage(REGISTRY_PAGE
);
3606 if (RepairUpdateFlag
)
3608 return SUCCESS_PAGE
;
3611 if (!SetInstallPathValue(&DestinationPath
))
3613 DPRINT("SetInstallPathValue() failed\n");
3614 MUIDisplayError(ERROR_INITIALIZE_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
3618 /* Create the default hives */
3620 Status
= NtInitializeRegistry(CM_BOOT_FLAG_SETUP
);
3621 if (!NT_SUCCESS(Status
))
3623 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3624 MUIDisplayError(ERROR_CREATE_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3628 RegInitializeRegistry();
3631 /* Update registry */
3632 CONSOLE_SetStatusText(MUIGetString(STRING_REGHIVEUPDATE
));
3634 if (!SetupFindFirstLineW(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3636 DPRINT1("SetupFindFirstLine() failed\n");
3637 MUIDisplayError(ERROR_FIND_REGISTRY
, Ir
, POPUP_WAIT_ENTER
);
3643 INF_GetDataField (&InfContext
, 0, &Action
);
3644 INF_GetDataField (&InfContext
, 1, &File
);
3645 INF_GetDataField (&InfContext
, 2, &Section
);
3647 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3652 if (!_wcsicmp (Action
, L
"AddReg"))
3656 else if (!_wcsicmp (Action
, L
"DelReg"))
3665 CONSOLE_SetStatusText(MUIGetString(STRING_IMPORTFILE
), File
);
3667 if (!ImportRegistryFile(File
, Section
, LanguageId
, Delete
))
3669 DPRINT("Importing %S failed\n", File
);
3671 MUIDisplayError(ERROR_IMPORT_HIVE
, Ir
, POPUP_WAIT_ENTER
);
3674 } while (SetupFindNextLine(&InfContext
, &InfContext
));
3676 /* Update display registry settings */
3677 CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYETTINGSUPDATE
));
3678 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3680 MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3684 /* Set the locale */
3685 CONSOLE_SetStatusText(MUIGetString(STRING_LOCALESETTINGSUPDATE
));
3686 if (!ProcessLocaleRegistry(LanguageList
))
3688 MUIDisplayError(ERROR_UPDATE_LOCALESETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3692 /* Add keyboard layouts */
3693 CONSOLE_SetStatusText(MUIGetString(STRING_ADDKBLAYOUTS
));
3694 if (!AddKeyboardLayouts())
3696 MUIDisplayError(ERROR_ADDING_KBLAYOUTS
, Ir
, POPUP_WAIT_ENTER
);
3702 if (!SetGeoID(MUIGetGeoID()))
3704 MUIDisplayError(ERROR_UPDATE_GEOID
, Ir
, POPUP_WAIT_ENTER
);
3708 if (!IsUnattendedSetup
)
3710 /* Update keyboard layout settings */
3711 CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE
));
3712 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3714 MUIDisplayError(ERROR_UPDATE_KBSETTINGS
, Ir
, POPUP_WAIT_ENTER
);
3719 /* Add codepage information to registry */
3720 CONSOLE_SetStatusText(MUIGetString(STRING_CODEPAGEINFOUPDATE
));
3723 MUIDisplayError(ERROR_ADDING_CODEPAGE
, Ir
, POPUP_WAIT_ENTER
);
3727 /* Set the default pagefile entry */
3728 SetDefaultPagefile(DestinationDriveLetter
);
3730 /* Update the mounted devices list */
3731 SetMountedDeviceValues(PartitionList
);
3733 CONSOLE_SetStatusText(MUIGetString(STRING_DONE
));
3735 return BOOT_LOADER_PAGE
;
3740 BootLoaderPage(PINPUT_RECORD Ir
)
3742 UCHAR PartitionType
;
3743 BOOLEAN InstallOnFloppy
;
3745 WCHAR PathBuffer
[MAX_PATH
];
3748 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT
));
3750 /* Find or set the active partition */
3751 CheckActiveBootPartition(PartitionList
);
3753 /* Update the partition table because we may have changed the active partition */
3754 Status
= WriteDirtyPartitions(PartitionList
);
3755 if (!NT_SUCCESS(Status
))
3757 DPRINT("WriteDirtyPartitions() failed\n");
3758 MUIDisplayError(ERROR_WRITE_PTABLE
, Ir
, POPUP_WAIT_ENTER
);
3762 RtlFreeUnicodeString(&SystemRootPath
);
3763 swprintf(PathBuffer
,
3764 L
"\\Device\\Harddisk%lu\\Partition%lu",
3765 PartitionList
->ActiveBootDisk
->DiskNumber
,
3766 PartitionList
->ActiveBootPartition
->PartitionNumber
);
3767 RtlCreateUnicodeString(&SystemRootPath
,
3769 DPRINT("SystemRootPath: %wZ\n", &SystemRootPath
);
3771 PartitionType
= PartitionList
->ActiveBootPartition
->PartitionType
;
3773 if (IsUnattendedSetup
)
3775 if (UnattendMBRInstallType
== 0) /* skip MBR installation */
3777 return SUCCESS_PAGE
;
3779 else if (UnattendMBRInstallType
== 1) /* install on floppy */
3781 return BOOT_LOADER_FLOPPY_PAGE
;
3785 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3787 DPRINT("Error: active partition invalid (unused)\n");
3788 InstallOnFloppy
= TRUE
;
3790 else if (PartitionType
== 0x0A)
3792 /* OS/2 boot manager partition */
3793 DPRINT("Found OS/2 boot manager partition\n");
3794 InstallOnFloppy
= TRUE
;
3796 else if (PartitionType
== 0x83)
3798 /* Linux ext2 partition */
3799 DPRINT("Found Linux ext2 partition\n");
3800 InstallOnFloppy
= TRUE
;
3802 else if (PartitionType
== PARTITION_IFS
)
3804 /* NTFS partition */
3805 DPRINT("Found NTFS partition\n");
3806 InstallOnFloppy
= TRUE
;
3808 else if ((PartitionType
== PARTITION_FAT_12
) ||
3809 (PartitionType
== PARTITION_FAT_16
) ||
3810 (PartitionType
== PARTITION_HUGE
) ||
3811 (PartitionType
== PARTITION_XINT13
) ||
3812 (PartitionType
== PARTITION_FAT32
) ||
3813 (PartitionType
== PARTITION_FAT32_XINT13
))
3815 DPRINT("Found FAT partition\n");
3816 InstallOnFloppy
= FALSE
;
3820 /* Unknown partition */
3821 DPRINT("Unknown partition found\n");
3822 InstallOnFloppy
= TRUE
;
3825 if (InstallOnFloppy
== TRUE
)
3827 return BOOT_LOADER_FLOPPY_PAGE
;
3830 /* Unattended install on hdd? */
3831 if (IsUnattendedSetup
&& UnattendMBRInstallType
== 2)
3833 return BOOT_LOADER_HARDDISK_MBR_PAGE
;
3836 MUIDisplayPage(BOOT_LOADER_PAGE
);
3837 CONSOLE_InvertTextXY(8, Line
, 60, 1);
3841 CONSOLE_ConInKey(Ir
);
3843 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3844 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3846 CONSOLE_NormalTextXY(8, Line
, 60, 1);
3855 CONSOLE_InvertTextXY(8, Line
, 60, 1);
3857 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3858 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3860 CONSOLE_NormalTextXY(8, Line
, 60, 1);
3869 CONSOLE_InvertTextXY(8, Line
, 60, 1);
3871 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3872 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3874 if (ConfirmQuit(Ir
) == TRUE
)
3879 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3883 return BOOT_LOADER_HARDDISK_MBR_PAGE
;
3885 else if (Line
== 13)
3887 return BOOT_LOADER_HARDDISK_VBR_PAGE
;
3889 else if (Line
== 14)
3891 return BOOT_LOADER_FLOPPY_PAGE
;
3893 else if (Line
== 15)
3895 return SUCCESS_PAGE
;
3898 return BOOT_LOADER_PAGE
;
3902 return BOOT_LOADER_PAGE
;
3907 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3911 MUIDisplayPage(BOOT_LOADER_FLOPPY_PAGE
);
3913 // SetStatusText(" Please wait...");
3917 CONSOLE_ConInKey(Ir
);
3919 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3920 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3922 if (ConfirmQuit(Ir
) == TRUE
)
3927 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3929 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3931 MUIDisplayError(ERROR_NO_FLOPPY
, Ir
, POPUP_WAIT_ENTER
);
3932 return BOOT_LOADER_FLOPPY_PAGE
;
3935 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
, &DestinationArcPath
);
3936 if (!NT_SUCCESS(Status
))
3938 /* Print error message */
3939 return BOOT_LOADER_FLOPPY_PAGE
;
3942 return SUCCESS_PAGE
;
3946 return BOOT_LOADER_FLOPPY_PAGE
;
3950 BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir
)
3952 UCHAR PartitionType
;
3955 PartitionType
= PartitionList
->ActiveBootPartition
->PartitionType
;
3957 Status
= InstallVBRToPartition(&SystemRootPath
,
3959 &DestinationArcPath
,
3961 if (!NT_SUCCESS(Status
))
3963 MUIDisplayError(ERROR_WRITE_BOOT
, Ir
, POPUP_WAIT_ENTER
);
3967 return SUCCESS_PAGE
;
3971 BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir
)
3973 UCHAR PartitionType
;
3975 WCHAR DestinationDevicePathBuffer
[MAX_PATH
];
3976 WCHAR SourceMbrPathBuffer
[MAX_PATH
];
3978 /* Step 1: Write the VBR */
3979 PartitionType
= PartitionList
->ActiveBootPartition
->PartitionType
;
3981 Status
= InstallVBRToPartition(&SystemRootPath
,
3983 &DestinationArcPath
,
3985 if (!NT_SUCCESS(Status
))
3987 MUIDisplayError(ERROR_WRITE_BOOT
, Ir
, POPUP_WAIT_ENTER
);
3991 /* Step 2: Write the MBR */
3992 swprintf(DestinationDevicePathBuffer
,
3993 L
"\\Device\\Harddisk%d\\Partition0",
3994 PartitionList
->ActiveBootDisk
->DiskNumber
);
3996 wcscpy(SourceMbrPathBuffer
, SourceRootPath
.Buffer
);
3997 wcscat(SourceMbrPathBuffer
, L
"\\loader\\dosmbr.bin");
3999 DPRINT("Install MBR bootcode: %S ==> %S\n",
4000 SourceMbrPathBuffer
, DestinationDevicePathBuffer
);
4002 Status
= InstallMbrBootCodeToDisk(SourceMbrPathBuffer
,
4003 DestinationDevicePathBuffer
);
4004 if (!NT_SUCCESS (Status
))
4006 DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
4008 MUIDisplayError(ERROR_INSTALL_BOOTCODE
, Ir
, POPUP_WAIT_ENTER
);
4012 return SUCCESS_PAGE
;
4017 QuitPage(PINPUT_RECORD Ir
)
4019 MUIDisplayPage(QUIT_PAGE
);
4021 /* Destroy partition list */
4022 if (PartitionList
!= NULL
)
4024 DestroyPartitionList (PartitionList
);
4025 PartitionList
= NULL
;
4028 /* Destroy filesystem list */
4029 if (FileSystemList
!= NULL
)
4031 DestroyFileSystemList (FileSystemList
);
4032 FileSystemList
= NULL
;
4035 /* Destroy computer settings list */
4036 if (ComputerList
!= NULL
)
4038 DestroyGenericList(ComputerList
, TRUE
);
4039 ComputerList
= NULL
;
4042 /* Destroy display settings list */
4043 if (DisplayList
!= NULL
)
4045 DestroyGenericList(DisplayList
, TRUE
);
4049 /* Destroy keyboard settings list */
4050 if (KeyboardList
!= NULL
)
4052 DestroyGenericList(KeyboardList
, TRUE
);
4053 KeyboardList
= NULL
;
4056 /* Destroy keyboard layout list */
4057 if (LayoutList
!= NULL
)
4059 DestroyGenericList(LayoutList
, TRUE
);
4063 if (LanguageList
!= NULL
)
4065 DestroyGenericList(LanguageList
, FALSE
);
4066 LanguageList
= NULL
;
4069 CONSOLE_SetStatusText(MUIGetString(STRING_REBOOTCOMPUTER2
));
4073 CONSOLE_ConInKey(Ir
);
4075 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
4084 SuccessPage(PINPUT_RECORD Ir
)
4086 MUIDisplayPage(SUCCESS_PAGE
);
4088 if (IsUnattendedSetup
)
4095 CONSOLE_ConInKey(Ir
);
4097 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
4106 FlushPage(PINPUT_RECORD Ir
)
4108 MUIDisplayPage(FLUSH_PAGE
);
4114 PnpEventThread(IN LPVOID lpParameter
);
4125 NtQuerySystemTime(&Time
);
4127 Status
= RtlCreateUserThread(NtCurrentProcess(),
4137 if (!NT_SUCCESS(Status
))
4138 hPnpThread
= INVALID_HANDLE_VALUE
;
4140 if (!CONSOLE_Init())
4142 PrintString(MUIGetString(STRING_CONSOLEFAIL1
));
4143 PrintString(MUIGetString(STRING_CONSOLEFAIL2
));
4144 PrintString(MUIGetString(STRING_CONSOLEFAIL3
));
4146 /* Raise a hard error (crash the system/BSOD) */
4147 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
4151 /* Initialize global unicode strings */
4152 RtlInitUnicodeString(&SourcePath
, NULL
);
4153 RtlInitUnicodeString(&SourceRootPath
, NULL
);
4154 RtlInitUnicodeString(&SourceRootDir
, NULL
);
4155 RtlInitUnicodeString(&InstallPath
, NULL
);
4156 RtlInitUnicodeString(&DestinationPath
, NULL
);
4157 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
4158 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
4159 RtlInitUnicodeString(&SystemRootPath
, NULL
);
4161 /* Hide the cursor */
4162 CONSOLE_SetCursorType(TRUE
, FALSE
);
4165 while (Page
!= REBOOT_PAGE
&& Page
!= RECOVERY_PAGE
)
4167 CONSOLE_ClearScreen();
4170 //CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4177 Page
= SetupStartPage(&Ir
);
4182 Page
= LanguagePage(&Ir
);
4187 Page
= LicensePage(&Ir
);
4192 Page
= IntroPage(&Ir
);
4196 case INSTALL_INTRO_PAGE
:
4197 Page
= InstallIntroPage(&Ir
);
4201 case SCSI_CONTROLLER_PAGE
:
4202 Page
= ScsiControllerPage(&Ir
);
4207 case OEM_DRIVER_PAGE
:
4208 Page
= OemDriverPage(&Ir
);
4212 case DEVICE_SETTINGS_PAGE
:
4213 Page
= DeviceSettingsPage(&Ir
);
4216 case COMPUTER_SETTINGS_PAGE
:
4217 Page
= ComputerSettingsPage(&Ir
);
4220 case DISPLAY_SETTINGS_PAGE
:
4221 Page
= DisplaySettingsPage(&Ir
);
4224 case KEYBOARD_SETTINGS_PAGE
:
4225 Page
= KeyboardSettingsPage(&Ir
);
4228 case LAYOUT_SETTINGS_PAGE
:
4229 Page
= LayoutSettingsPage(&Ir
);
4232 case SELECT_PARTITION_PAGE
:
4233 Page
= SelectPartitionPage(&Ir
);
4236 case CREATE_PRIMARY_PARTITION_PAGE
:
4237 Page
= CreatePrimaryPartitionPage(&Ir
);
4240 case CREATE_EXTENDED_PARTITION_PAGE
:
4241 Page
= CreateExtendedPartitionPage(&Ir
);
4244 case CREATE_LOGICAL_PARTITION_PAGE
:
4245 Page
= CreateLogicalPartitionPage(&Ir
);
4248 case DELETE_PARTITION_PAGE
:
4249 Page
= DeletePartitionPage(&Ir
);
4252 case SELECT_FILE_SYSTEM_PAGE
:
4253 Page
= SelectFileSystemPage(&Ir
);
4256 case FORMAT_PARTITION_PAGE
:
4257 Page
= (PAGE_NUMBER
) FormatPartitionPage(&Ir
);
4260 case CHECK_FILE_SYSTEM_PAGE
:
4261 Page
= (PAGE_NUMBER
) CheckFileSystemPage(&Ir
);
4264 case INSTALL_DIRECTORY_PAGE
:
4265 Page
= InstallDirectoryPage(&Ir
);
4268 case PREPARE_COPY_PAGE
:
4269 Page
= PrepareCopyPage(&Ir
);
4272 case FILE_COPY_PAGE
:
4273 Page
= FileCopyPage(&Ir
);
4277 Page
= RegistryPage(&Ir
);
4280 case BOOT_LOADER_PAGE
:
4281 Page
= BootLoaderPage(&Ir
);
4284 case BOOT_LOADER_FLOPPY_PAGE
:
4285 Page
= BootLoaderFloppyPage(&Ir
);
4288 case BOOT_LOADER_HARDDISK_MBR_PAGE
:
4289 Page
= BootLoaderHarddiskMbrPage(&Ir
);
4292 case BOOT_LOADER_HARDDISK_VBR_PAGE
:
4293 Page
= BootLoaderHarddiskVbrPage(&Ir
);
4297 case REPAIR_INTRO_PAGE
:
4298 Page
= RepairIntroPage(&Ir
);
4302 Page
= SuccessPage(&Ir
);
4306 Page
= FlushPage(&Ir
);
4310 Page
= QuitPage(&Ir
);
4319 if (Page
== RECOVERY_PAGE
)
4324 /* Avoid bugcheck */
4325 Time
.QuadPart
+= 50000000;
4326 NtDelayExecution(FALSE
, &Time
);
4329 RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE
, TRUE
, FALSE
, &Old
);
4330 NtShutdownSystem(ShutdownReboot
);
4331 RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE
, Old
, FALSE
, &Old
);
4332 NtTerminateProcess(NtCurrentProcess(), 0);
4339 NtProcessStartup(PPEB Peb
)
4341 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
4343 ProcessHeap
= Peb
->ProcessHeap
;
4344 InfSetHeap(ProcessHeap
);
4347 #endif /* __REACTOS__ */