3 * Copyright (C) 2002, 2003, 2004 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/usetup.c
23 * PURPOSE: Text-mode setup
24 * PROGRAMMER: Eric Kohl
25 * Casper S. Hornstrup (chorns@users.sourceforge.net)
30 #include <ntdll/rtl.h>
32 #include <ntos/minmax.h>
33 #include <reactos/resource.h>
34 #include <rosrtl/string.h>
41 #include "filequeue.h"
57 typedef enum _PAGE_NUMBER
65 // SCSI_CONTROLLER_PAGE,
68 COMPUTER_SETTINGS_PAGE
,
69 DISPLAY_SETTINGS_PAGE
,
70 KEYBOARD_SETTINGS_PAGE
,
72 POINTER_SETTINGS_PAGE
,
74 SELECT_PARTITION_PAGE
,
75 CREATE_PARTITION_PAGE
,
76 DELETE_PARTITION_PAGE
,
78 SELECT_FILE_SYSTEM_PAGE
,
79 FORMAT_PARTITION_PAGE
,
80 CHECK_FILE_SYSTEM_PAGE
,
83 INSTALL_DIRECTORY_PAGE
,
87 BOOT_LOADER_FLOPPY_PAGE
,
88 BOOT_LOADER_HARDDISK_PAGE
,
95 REBOOT_PAGE
, /* virtual page */
96 } PAGE_NUMBER
, *PPAGE_NUMBER
;
98 typedef struct _COPYCONTEXT
100 ULONG TotalOperations
;
101 ULONG CompletedOperations
;
102 PPROGRESSBAR ProgressBar
;
103 } COPYCONTEXT
, *PCOPYCONTEXT
;
106 /* GLOBALS ******************************************************************/
109 UNICODE_STRING SourceRootPath
;
110 BOOLEAN IsUnattendedSetup
;
111 LONG UnattendDestinationDiskNumber
;
112 LONG UnattendDestinationPartitionNumber
;
113 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
115 /* LOCALS *******************************************************************/
117 static PPARTLIST PartitionList
= NULL
;
119 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
122 static UNICODE_STRING SourcePath
;
124 static UNICODE_STRING InstallPath
;
126 /* Path to the install directory */
127 static UNICODE_STRING DestinationPath
;
128 static UNICODE_STRING DestinationArcPath
;
129 static UNICODE_STRING DestinationRootPath
;
131 /* Path to the active partition (boot manager) */
132 static UNICODE_STRING SystemRootPath
;
134 static HINF SetupInf
;
136 static HSPFILEQ SetupFileQueue
= NULL
;
138 static BOOLEAN WarnLinuxPartitions
= TRUE
;
140 static PGENERIC_LIST ComputerList
= NULL
;
141 static PGENERIC_LIST DisplayList
= NULL
;
142 static PGENERIC_LIST KeyboardList
= NULL
;
143 static PGENERIC_LIST LayoutList
= NULL
;
144 static PGENERIC_LIST PointerList
= NULL
;
147 /* FUNCTIONS ****************************************************************/
150 PrintString(char* fmt
,...)
154 UNICODE_STRING UnicodeString
;
155 ANSI_STRING AnsiString
;
158 vsprintf(buffer
, fmt
, ap
);
161 RtlInitAnsiString(&AnsiString
, buffer
);
162 RtlAnsiStringToUnicodeString(&UnicodeString
,
165 NtDisplayString(&UnicodeString
);
166 RtlFreeUnicodeString(&UnicodeString
);
171 PopupError(PCHAR Text
,
189 /* Count text lines and longest line */
195 p
= strchr(pnext
, '\n');
198 Length
= strlen(pnext
);
203 Length
= (ULONG
)(p
- pnext
);
208 if (Length
> MaxLength
)
211 if (LastLine
== TRUE
)
217 /* Check length of status line */
220 Length
= strlen(Status
);
221 if (Length
> MaxLength
)
225 GetScreenSize(&xScreen
, &yScreen
);
227 Width
= MaxLength
+ 4;
232 yTop
= (yScreen
- Height
) / 2;
233 xLeft
= (xScreen
- Width
) / 2;
236 /* Set screen attributes */
238 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
240 FillConsoleOutputAttribute(0x74,
246 /* draw upper left corner */
249 FillConsoleOutputCharacter(0xDA, // '+',
254 /* draw upper edge */
257 FillConsoleOutputCharacter(0xC4, // '-',
262 /* draw upper right corner */
263 coPos
.X
= xLeft
+ Width
- 1;
265 FillConsoleOutputCharacter(0xBF, // '+',
270 /* Draw right edge, inner space and left edge */
271 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
274 FillConsoleOutputCharacter(0xB3, // '|',
280 FillConsoleOutputCharacter(' ',
285 coPos
.X
= xLeft
+ Width
- 1;
286 FillConsoleOutputCharacter(0xB3, // '|',
292 /* draw lower left corner */
294 coPos
.Y
= yTop
+ Height
- 1;
295 FillConsoleOutputCharacter(0xC0, // '+',
300 /* draw lower edge */
302 coPos
.Y
= yTop
+ Height
- 1;
303 FillConsoleOutputCharacter(0xC4, // '-',
308 /* draw lower right corner */
309 coPos
.X
= xLeft
+ Width
- 1;
310 coPos
.Y
= yTop
+ Height
- 1;
311 FillConsoleOutputCharacter(0xD9, // '+',
316 /* Print message text */
321 p
= strchr(pnext
, '\n');
324 Length
= strlen(pnext
);
329 Length
= (ULONG
)(p
- pnext
);
336 WriteConsoleOutputCharacters(pnext
,
341 if (LastLine
== TRUE
)
348 /* Print separator line and status text */
351 coPos
.Y
= yTop
+ Height
- 3;
353 FillConsoleOutputCharacter(0xC3, // '+',
359 FillConsoleOutputCharacter(0xC4, // '-',
364 coPos
.X
= xLeft
+ Width
- 1;
365 FillConsoleOutputCharacter(0xB4, // '+',
372 WriteConsoleOutputCharacters(Status
,
373 min(strlen(Status
), Width
- 4),
383 * FALSE: Don't quit setup.
386 ConfirmQuit(PINPUT_RECORD Ir
)
390 PopupError("ReactOS is not completely installed on your\n"
391 "computer. If you quit Setup now, you will need to\n"
392 "run Setup again to install ReactOS.\n"
394 " \x07 Press ENTER to continue Setup.\n"
395 " \x07 Press F3 to quit Setup.",
396 "F3= Quit ENTER = Continue");
402 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
403 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
408 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
420 CheckUnattendedSetup(VOID
)
422 WCHAR UnattendInfPath
[MAX_PATH
];
423 UNICODE_STRING FileName
;
431 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
433 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
434 IsUnattendedSetup
= FALSE
;
438 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
439 wcscat(UnattendInfPath
, L
"\\unattend.inf");
441 RtlInitUnicodeString(&FileName
,
444 /* Load 'unattend.inf' from install media. */
445 Status
= InfOpenFile(&UnattendInf
,
448 if (!NT_SUCCESS(Status
))
450 DPRINT("InfOpenFile() failed with status 0x%x\n", Status
);
454 /* Open 'Unattend' section */
455 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
457 DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
458 InfCloseFile(UnattendInf
);
462 /* Get pointer 'Signature' key */
463 if (!InfGetData(&Context
, NULL
, &Value
))
465 DPRINT("InfGetData() failed for key 'Signature'\n");
466 InfCloseFile(UnattendInf
);
470 /* Check 'Signature' string */
471 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
473 DPRINT("Signature not $ReactOS$\n");
474 InfCloseFile(UnattendInf
);
478 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
479 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
481 DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
482 InfCloseFile(UnattendInf
);
485 if (!InfGetIntField(&Context
, 0, &IntValue
))
487 DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
488 InfCloseFile(UnattendInf
);
491 UnattendDestinationDiskNumber
= IntValue
;
493 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
494 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
496 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
497 InfCloseFile(UnattendInf
);
500 if (!InfGetIntField(&Context
, 0, &IntValue
))
502 DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
503 InfCloseFile(UnattendInf
);
506 UnattendDestinationPartitionNumber
= IntValue
;
508 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
509 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
511 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
512 InfCloseFile(UnattendInf
);
516 /* Get pointer 'InstallationDirectory' key */
517 if (!InfGetData(&Context
, NULL
, &Value
))
519 DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
520 InfCloseFile(UnattendInf
);
523 wcscpy(UnattendInstallationDirectory
, Value
);
525 InfCloseFile(UnattendInf
);
527 IsUnattendedSetup
= TRUE
;
529 DPRINT("Running unattended setup\n");
536 * Number of the next page.
539 StartPage(PINPUT_RECORD Ir
)
541 SYSTEM_DEVICE_INFORMATION Sdi
;
543 WCHAR FileNameBuffer
[MAX_PATH
];
544 UNICODE_STRING FileName
;
550 SetStatusText(" Please wait...");
553 /* Check whether a harddisk is available */
554 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
556 sizeof(SYSTEM_DEVICE_INFORMATION
),
558 if (!NT_SUCCESS (Status
))
560 PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
561 PopupError("Setup could not retrieve system drive information.\n",
562 "ENTER = Reboot computer");
567 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
574 if (Sdi
.NumberOfDisks
== 0)
576 PopupError("Setup could not find a harddisk.\n",
577 "ENTER = Reboot computer");
582 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
589 /* Get the source path and source root path */
590 Status
= GetSourcePaths(&SourcePath
,
592 if (!NT_SUCCESS(Status
))
594 PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status
);
595 PopupError("Setup could not find its source drive.\n",
596 "ENTER = Reboot computer");
601 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
610 PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
611 PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
615 /* Load txtsetup.sif from install media. */
616 wcscpy(FileNameBuffer
, SourceRootPath
.Buffer
);
617 wcscat(FileNameBuffer
, L
"\\reactos\\txtsetup.sif");
618 RtlInitUnicodeString(&FileName
,
621 Status
= InfOpenFile(&SetupInf
,
624 if (!NT_SUCCESS(Status
))
626 PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
627 "ENTER = Reboot computer");
633 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
640 /* Open 'Version' section */
641 if (!InfFindFirstLine (SetupInf
, L
"Version", L
"Signature", &Context
))
643 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
644 "ENTER = Reboot computer");
650 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
658 /* Get pointer 'Signature' key */
659 if (!InfGetData (&Context
, NULL
, &Value
))
661 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
662 "ENTER = Reboot computer");
668 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
675 /* Check 'Signature' string */
676 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
678 PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
679 "ENTER = Reboot computer");
685 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
692 CheckUnattendedSetup();
704 IntroPage(PINPUT_RECORD Ir
)
706 SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup");
708 SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your");
709 SetTextXY(6, 12, "computer and prepares the second part of the setup.");
711 SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS.");
712 SetTextXY(8, 17, "\x07 Press R to repair ReactOS.");
713 SetTextXY(8, 19, "\x07 Press L to view the ReactOS Licensing Terms and Conditions");
714 SetTextXY(8, 21, "\x07 Press F3 to quit without installing ReactOS.");
716 SetStatusText(" ENTER = Continue R = Repair F3 = Quit");
718 if (IsUnattendedSetup
)
720 return INSTALL_INTRO_PAGE
;
727 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
728 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
730 if (ConfirmQuit(Ir
) == TRUE
)
734 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
739 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
741 return REPAIR_INTRO_PAGE
;
744 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* R */
757 * Back to main setup page.
760 LicensePage(PINPUT_RECORD Ir
)
762 SetHighlightedTextXY(6, 8, "Licensing:");
764 SetTextXY(8, 11, "The ReactOS System is licensed under the terms of the");
765 SetTextXY(8, 12, "GNU GPL with parts containing code from other compatible");
766 SetTextXY(8, 13, "licenses such as the X11 or BSD and GNU LGPL licenses.");
767 SetTextXY(8, 14, "All software that is part of the ReactOS system is");
768 SetTextXY(8, 15, "therefore released under the GNU GPL as well as maintaining");
769 SetTextXY(8, 16, "the original license.");
771 SetTextXY(8, 18, "This software comes with NO WARRANTY or restrictions on usage");
772 SetTextXY(8, 19, "save applicable local and international law. The licensing of");
773 SetTextXY(8, 20, "ReactOS only covers distribution to third parties.");
775 SetTextXY(8, 22, "If for some reason you did not receive a copy of the");
776 SetTextXY(8, 23, "GNU General Public License with ReactOS please visit");
777 SetHighlightedTextXY(8, 25, "http://www.gnu.org/licenses/licenses.html");
779 SetStatusText(" ENTER = Return");
785 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
801 WarningPage(PINPUT_RECORD Ir
)
803 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Warranty Statement");
804 SetHighlightedTextXY(6, 8, "Warranty:");
806 SetTextXY(8, 11, "This is free software; see the source for copying conditions.");
807 SetTextXY(8, 12, "There is NO warranty; not even for MERCHANTABILITY or");
808 SetTextXY(8, 13, "FITNESS FOR A PARTICULAR PURPOSE");
810 SetTextXY(8, 15, "For more information on ReactOS, please visit:");
811 SetHighlightedTextXY(8, 16, "http://www.reactos.org");
813 SetStatusText(" F8 = Continue ESC = Exit");
819 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
820 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F8
)) /* F8 */
822 return INSTALL_INTRO_PAGE
;
825 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
826 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
836 RepairIntroPage(PINPUT_RECORD Ir
)
838 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
839 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
841 SetTextXY(6, 12, "The repair functions are not implemented yet.");
843 SetTextXY(8, 15, "\x07 Press R for the Recovery Console.");
845 SetTextXY(8, 17, "\x07 Press ESC to return to the main page.");
847 SetTextXY(8, 19, "\x07 Press ENTER to reboot your computer.");
849 SetStatusText(" ESC = Main page ENTER = Reboot");
855 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
859 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
863 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
864 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
870 return REPAIR_INTRO_PAGE
;
875 InstallIntroPage(PINPUT_RECORD Ir
)
877 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
879 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
880 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
882 SetTextXY(6, 12, "The following limitations apply:");
883 SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
884 SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
885 SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
886 SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
887 SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
888 SetTextXY(8, 18, "- Setup supports FAT file systems only.");
889 SetTextXY(8, 19, "- File system checks are not implemented yet.");
892 SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
894 SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
897 SetStatusText(" ENTER = Continue F3 = Quit");
899 if (IsUnattendedSetup
)
901 return SELECT_PARTITION_PAGE
;
908 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
909 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
911 if (ConfirmQuit(Ir
) == TRUE
)
915 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
917 return DEVICE_SETTINGS_PAGE
;
918 // return SCSI_CONTROLLER_PAGE;
922 return INSTALL_INTRO_PAGE
;
928 ScsiControllerPage(PINPUT_RECORD Ir
)
930 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
932 /* FIXME: print loaded mass storage driver descriptions */
934 SetTextXY(8, 10, "TEST device");
938 SetStatusText(" ENTER = Continue F3 = Quit");
944 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
945 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
947 if (ConfirmQuit(Ir
) == TRUE
)
951 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
953 return DEVICE_SETTINGS_PAGE
;
957 return SCSI_CONTROLLER_PAGE
;
963 DeviceSettingsPage(PINPUT_RECORD Ir
)
965 static ULONG Line
= 17;
967 /* Initialize the computer settings list */
968 if (ComputerList
== NULL
)
970 ComputerList
= CreateComputerTypeList(SetupInf
);
971 if (ComputerList
== NULL
)
973 /* FIXME: report error */
977 /* Initialize the display settings list */
978 if (DisplayList
== NULL
)
980 DisplayList
= CreateDisplayDriverList(SetupInf
);
981 if (DisplayList
== NULL
)
983 /* FIXME: report error */
987 /* Initialize the keyboard settings list */
988 if (KeyboardList
== NULL
)
990 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
991 if (KeyboardList
== NULL
)
993 /* FIXME: report error */
997 /* Initialize the keyboard layout list */
998 if (LayoutList
== NULL
)
1000 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
1001 if (LayoutList
== NULL
)
1003 /* FIXME: report error */
1004 PopupError("Setup failed to load the keyboard layout list.\n",
1005 "ENTER = Reboot computer");
1011 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1019 /* Initialize the pointer settings list */
1020 if (PointerList
== NULL
)
1022 PointerList
= CreateMouseDriverList(SetupInf
);
1023 if (PointerList
== NULL
)
1025 /* FIXME: report error */
1029 SetTextXY(6, 8, "The list below shows the current device settings.");
1031 SetTextXY(8, 11, " Computer:");
1032 SetTextXY(8, 12, " Display:");
1033 SetTextXY(8, 13, " Keyboard:");
1034 SetTextXY(8, 14, "Keyboard layout:");
1035 SetTextXY(8, 15, " Pointer device:");
1037 SetTextXY(8, 17, " Accept:");
1039 SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
1040 SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
1041 SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
1042 SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
1043 SetTextXY(25, 15, GetGenericListEntry(PointerList
)->Text
);
1045 SetTextXY(25, 17, "Accept these device settings");
1046 InvertTextXY (24, Line
, 48, 1);
1049 SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
1050 SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
1051 SetTextXY(6, 22, "settings.");
1053 SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
1054 SetTextXY(6, 25, "and press ENTER.");
1056 SetStatusText(" ENTER = Continue F3 = Quit");
1062 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1063 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1065 NormalTextXY (24, Line
, 48, 1);
1068 else if (Line
== 17)
1072 InvertTextXY (24, Line
, 48, 1);
1074 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1075 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1077 NormalTextXY (24, Line
, 48, 1);
1080 else if (Line
== 17)
1084 InvertTextXY (24, Line
, 48, 1);
1086 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1087 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1089 if (ConfirmQuit(Ir
) == TRUE
)
1093 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1096 return COMPUTER_SETTINGS_PAGE
;
1097 else if (Line
== 12)
1098 return DISPLAY_SETTINGS_PAGE
;
1099 else if (Line
== 13)
1100 return KEYBOARD_SETTINGS_PAGE
;
1101 else if (Line
== 14)
1102 return LAYOUT_SETTINGS_PAGE
;
1103 else if (Line
== 15)
1104 return POINTER_SETTINGS_PAGE
;
1105 else if (Line
== 17)
1106 return SELECT_PARTITION_PAGE
;
1110 return DEVICE_SETTINGS_PAGE
;
1115 ComputerSettingsPage(PINPUT_RECORD Ir
)
1120 SetTextXY(6, 8, "You want to change the type of computer to be installed.");
1122 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
1123 SetTextXY(8, 11, " Then press ENTER.");
1125 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1126 SetTextXY(8, 14, " the computer type.");
1128 GetScreenSize(&xScreen
, &yScreen
);
1130 DrawGenericList(ComputerList
,
1136 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1138 SaveGenericListState(ComputerList
);
1144 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1145 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1147 ScrollDownGenericList (ComputerList
);
1149 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1150 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1152 ScrollUpGenericList (ComputerList
);
1154 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1155 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1157 if (ConfirmQuit(Ir
) == TRUE
)
1161 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1162 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1164 RestoreGenericListState(ComputerList
);
1165 return DEVICE_SETTINGS_PAGE
;
1167 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1169 return DEVICE_SETTINGS_PAGE
;
1173 return COMPUTER_SETTINGS_PAGE
;
1178 DisplaySettingsPage(PINPUT_RECORD Ir
)
1183 SetTextXY(6, 8, "You want to change the type of display to be installed.");
1185 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
1186 SetTextXY(8, 11, " Then press ENTER.");
1188 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1189 SetTextXY(8, 14, " the display type.");
1191 GetScreenSize(&xScreen
, &yScreen
);
1193 DrawGenericList(DisplayList
,
1199 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1201 SaveGenericListState(DisplayList
);
1207 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1208 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1210 ScrollDownGenericList (DisplayList
);
1212 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1213 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1215 ScrollUpGenericList (DisplayList
);
1217 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1218 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1220 if (ConfirmQuit(Ir
) == TRUE
)
1226 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1227 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1229 RestoreGenericListState(DisplayList
);
1230 return DEVICE_SETTINGS_PAGE
;
1232 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1234 return DEVICE_SETTINGS_PAGE
;
1238 return DISPLAY_SETTINGS_PAGE
;
1243 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1248 SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
1250 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
1251 SetTextXY(8, 11, " Then press ENTER.");
1253 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1254 SetTextXY(8, 14, " the keyboard type.");
1256 GetScreenSize(&xScreen
, &yScreen
);
1258 DrawGenericList(KeyboardList
,
1264 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1266 SaveGenericListState(KeyboardList
);
1272 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1273 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1275 ScrollDownGenericList (KeyboardList
);
1277 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1278 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1280 ScrollUpGenericList (KeyboardList
);
1282 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1283 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1285 if (ConfirmQuit(Ir
) == TRUE
)
1289 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1290 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1292 RestoreGenericListState(KeyboardList
);
1293 return DEVICE_SETTINGS_PAGE
;
1295 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1297 return DEVICE_SETTINGS_PAGE
;
1301 return DISPLAY_SETTINGS_PAGE
;
1306 LayoutSettingsPage(PINPUT_RECORD Ir
)
1311 SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
1313 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
1314 SetTextXY(8, 11, " layout. Then press ENTER.");
1316 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1317 SetTextXY(8, 14, " the keyboard layout.");
1319 GetScreenSize(&xScreen
, &yScreen
);
1321 DrawGenericList(LayoutList
,
1327 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1329 SaveGenericListState(LayoutList
);
1335 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1336 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1338 ScrollDownGenericList (LayoutList
);
1340 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1341 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1343 ScrollUpGenericList (LayoutList
);
1345 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1346 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1348 if (ConfirmQuit(Ir
) == TRUE
)
1352 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1353 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1355 RestoreGenericListState(LayoutList
);
1356 return DEVICE_SETTINGS_PAGE
;
1358 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1360 return DEVICE_SETTINGS_PAGE
;
1364 return DISPLAY_SETTINGS_PAGE
;
1369 PointerSettingsPage(PINPUT_RECORD Ir
)
1374 SetTextXY(6, 8, "You want to change the pointing device to be installed.");
1376 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired pointing");
1377 SetTextXY(8, 11, " device. Then press ENTER.");
1379 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1380 SetTextXY(8, 14, " the pointing device.");
1382 GetScreenSize(&xScreen
, &yScreen
);
1384 DrawGenericList(PointerList
,
1390 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1392 SaveGenericListState(PointerList
);
1398 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1399 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1401 ScrollDownGenericList(PointerList
);
1403 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1404 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1406 ScrollUpGenericList(PointerList
);
1408 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1409 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1411 if (ConfirmQuit(Ir
) == TRUE
)
1415 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1416 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1418 RestoreGenericListState(PointerList
);
1419 return DEVICE_SETTINGS_PAGE
;
1421 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1423 return DEVICE_SETTINGS_PAGE
;
1427 return DISPLAY_SETTINGS_PAGE
;
1432 SelectPartitionPage(PINPUT_RECORD Ir
)
1437 SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
1438 SetTextXY(6, 9, "space for new partitions.");
1440 SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
1441 SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
1442 SetTextXY(8, 15, "\x07 Press C to create a new partition.");
1443 SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
1445 SetStatusText(" Please wait...");
1447 GetScreenSize(&xScreen
, &yScreen
);
1449 if (PartitionList
== NULL
)
1451 PartitionList
= CreatePartitionList (2,
1455 if (PartitionList
== NULL
)
1457 /* FIXME: show an error dialog */
1462 CheckActiveBootPartition (PartitionList
);
1464 DrawPartitionList (PartitionList
);
1466 /* Warn about partitions created by Linux Fdisk */
1467 if (WarnLinuxPartitions
== TRUE
&&
1468 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1470 PopupError ("Setup found that at least one harddisk contains an incompatible\n"
1471 "partition table that can not be handled properly!\n"
1473 "Creating or deleting partitions can destroy the partiton table.\n"
1475 " \x07 Press F3 to quit Setup."
1476 " \x07 Press ENTER to continue.",
1477 "F3= Quit ENTER = Continue");
1482 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1483 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1487 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1489 WarnLinuxPartitions
= FALSE
;
1490 return SELECT_PARTITION_PAGE
;
1495 if (IsUnattendedSetup
)
1497 SelectPartition(PartitionList
,
1498 UnattendDestinationDiskNumber
,
1499 UnattendDestinationPartitionNumber
);
1500 return(SELECT_FILE_SYSTEM_PAGE
);
1505 /* Update status text */
1506 if (PartitionList
->CurrentPartition
== NULL
||
1507 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1509 SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1513 SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1518 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1519 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1521 if (ConfirmQuit(Ir
) == TRUE
)
1523 DestroyPartitionList (PartitionList
);
1524 PartitionList
= NULL
;
1529 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1530 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1532 ScrollDownPartitionList (PartitionList
);
1534 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1535 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1537 ScrollUpPartitionList (PartitionList
);
1539 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1541 if (PartitionList
->CurrentPartition
== NULL
||
1542 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1544 CreateNewPartition (PartitionList
,
1549 return SELECT_FILE_SYSTEM_PAGE
;
1551 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_C
) /* C */
1553 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1555 PopupError ("You can not create a new Partition inside\n"
1556 "of an already existing Partition!\n"
1558 " * Press any key to continue.",
1562 return SELECT_PARTITION_PAGE
;
1565 return CREATE_PARTITION_PAGE
;
1567 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
1569 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1571 PopupError ("You can not delete unpartitioned disk space!\n"
1573 " * Press any key to continue.",
1577 return SELECT_PARTITION_PAGE
;
1580 return DELETE_PARTITION_PAGE
;
1584 return SELECT_PARTITION_PAGE
;
1589 DrawInputField(ULONG FieldLength
,
1599 memset(buf
, '_', sizeof(buf
));
1600 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1601 strcat(buf
, FieldContent
);
1603 WriteConsoleOutputCharacters (buf
,
1609 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1612 ShowPartitionSizeInputBox(SHORT Left
,
1637 /* draw upper left corner */
1640 FillConsoleOutputCharacter(0xDA, // '+',
1645 /* draw upper edge */
1648 FillConsoleOutputCharacter(0xC4, // '-',
1653 /* draw upper right corner */
1656 FillConsoleOutputCharacter(0xBF, // '+',
1661 /* draw left and right edge */
1662 for (i
= Top
+ 1; i
< Bottom
; i
++)
1666 FillConsoleOutputCharacter(0xB3, // '|',
1672 FillConsoleOutputCharacter(0xB3, //'|',
1678 /* draw lower left corner */
1681 FillConsoleOutputCharacter(0xC0, // '+',
1686 /* draw lower edge */
1689 FillConsoleOutputCharacter(0xC4, // '-',
1694 /* draw lower right corner */
1697 FillConsoleOutputCharacter(0xD9, // '+',
1705 strcpy (Buffer
, "Size of new partition:");
1706 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1708 WriteConsoleOutputCharacters (Buffer
,
1712 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1713 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1715 WriteConsoleOutputCharacters (Buffer
,
1719 sprintf(Buffer
, "%d", MaxSize
);
1720 Index
= strlen(Buffer
);
1721 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1730 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1731 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1738 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1742 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1749 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1754 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1759 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1760 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1762 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1763 if ((ch
>= '0') && (ch
<= '9'))
1768 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1776 strcpy (InputBuffer
,
1782 CreatePartitionPage (PINPUT_RECORD Ir
)
1784 PDISKENTRY DiskEntry
;
1785 PPARTENTRY PartEntry
;
1790 CHAR InputBuffer
[50];
1796 if (PartitionList
== NULL
||
1797 PartitionList
->CurrentDisk
== NULL
||
1798 PartitionList
->CurrentPartition
== NULL
)
1800 /* FIXME: show an error dialog */
1804 DiskEntry
= PartitionList
->CurrentDisk
;
1805 PartEntry
= PartitionList
->CurrentPartition
;
1807 SetStatusText (" Please wait...");
1809 GetScreenSize (&xScreen
, &yScreen
);
1811 SetTextXY (6, 8, "You have chosen to create a new partition on");
1814 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1816 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1822 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1828 if (DiskEntry
->DriverName
.Length
> 0)
1831 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1834 DiskEntry
->DiskNumber
,
1838 &DiskEntry
->DriverName
);
1843 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1846 DiskEntry
->DiskNumber
,
1853 SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1856 PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1857 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1860 SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1862 PartEntry
= PartitionList
->CurrentPartition
;
1865 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1866 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1867 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1870 if (ConfirmQuit (Ir
) == TRUE
)
1875 else if (Cancel
== TRUE
)
1877 return SELECT_PARTITION_PAGE
;
1881 PartSize
= atoi (InputBuffer
);
1888 if (PartSize
> MaxSize
)
1894 /* Convert to bytes */
1895 if (PartSize
== MaxSize
)
1897 /* Use all of the unpartitioned disk space */
1898 PartSize
= PartEntry
->UnpartitionedLength
;
1902 /* Round-up by cylinder size */
1903 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1904 DiskEntry
->CylinderSize
);
1906 /* But never get larger than the unpartitioned disk space */
1907 if (PartSize
> PartEntry
->UnpartitionedLength
)
1908 PartSize
= PartEntry
->UnpartitionedLength
;
1911 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1913 CreateNewPartition (PartitionList
,
1917 return SELECT_PARTITION_PAGE
;
1921 return CREATE_PARTITION_PAGE
;
1926 DeletePartitionPage (PINPUT_RECORD Ir
)
1928 PDISKENTRY DiskEntry
;
1929 PPARTENTRY PartEntry
;
1935 if (PartitionList
== NULL
||
1936 PartitionList
->CurrentDisk
== NULL
||
1937 PartitionList
->CurrentPartition
== NULL
)
1939 /* FIXME: show an error dialog */
1943 DiskEntry
= PartitionList
->CurrentDisk
;
1944 PartEntry
= PartitionList
->CurrentPartition
;
1946 SetTextXY (6, 8, "You have chosen to delete the partition");
1948 /* Determine partition type */
1950 if (PartEntry
->New
== TRUE
)
1952 PartType
= "New (Unformatted)";
1954 else if (PartEntry
->Unpartitioned
== FALSE
)
1956 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1957 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1958 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1959 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1963 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1964 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1968 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1970 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1975 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
1977 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1982 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000ULL
) /* 10 MB */
1984 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1989 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1993 if (PartType
== NULL
)
1996 " %c%c Type %lu %I64u %s",
1997 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1998 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1999 PartEntry
->PartInfo
[0].PartitionType
,
2006 " %c%c %s %I64u %s",
2007 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2008 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2015 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2017 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2023 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2029 if (DiskEntry
->DriverName
.Length
> 0)
2032 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
2035 DiskEntry
->DiskNumber
,
2039 &DiskEntry
->DriverName
);
2044 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
2047 DiskEntry
->DiskNumber
,
2053 SetTextXY (8, 18, "\x07 Press D to delete the partition.");
2054 SetTextXY (11, 19, "WARNING: All data on this partition will be lost!");
2056 SetTextXY (8, 21, "\x07 Press ESC to cancel.");
2058 SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit");
2064 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2065 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2067 if (ConfirmQuit (Ir
) == TRUE
)
2073 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
2075 return SELECT_PARTITION_PAGE
;
2077 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
2079 DeleteCurrentPartition (PartitionList
);
2081 return SELECT_PARTITION_PAGE
;
2085 return DELETE_PARTITION_PAGE
;
2090 SelectFileSystemPage (PINPUT_RECORD Ir
)
2092 PDISKENTRY DiskEntry
;
2093 PPARTENTRY PartEntry
;
2100 if (PartitionList
== NULL
||
2101 PartitionList
->CurrentDisk
== NULL
||
2102 PartitionList
->CurrentPartition
== NULL
)
2104 /* FIXME: show an error dialog */
2108 DiskEntry
= PartitionList
->CurrentDisk
;
2109 PartEntry
= PartitionList
->CurrentPartition
;
2111 /* adjust disk size */
2112 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2114 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2119 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2123 /* adjust partition size */
2124 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
2126 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
2131 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
2135 /* adjust partition type */
2136 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
2137 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
2138 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
2139 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
2143 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
2144 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
2148 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
2150 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2152 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2154 PartType
= "Unused";
2158 PartType
= "Unknown";
2161 if (PartEntry
->AutoCreate
== TRUE
)
2163 SetTextXY(6, 8, "Setup created a new partition on");
2166 PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2167 PartEntry
->PartInfo
[0].PartitionNumber
,
2173 PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2174 DiskEntry
->DiskNumber
,
2180 &DiskEntry
->DriverName
);
2182 SetTextXY(6, 12, "This Partition will be formatted next.");
2185 PartEntry
->AutoCreate
= FALSE
;
2187 else if (PartEntry
->New
== TRUE
)
2189 SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
2190 SetTextXY(6, 10, "This Partition will be formatted next.");
2194 SetTextXY(6, 8, "Setup install ReactOS onto Partition");
2196 if (PartType
== NULL
)
2199 "%c%c Type %lu %I64u %s",
2200 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2201 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2202 PartEntry
->PartInfo
[0].PartitionType
,
2210 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2211 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2217 PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2218 DiskEntry
->DiskNumber
,
2224 &DiskEntry
->DriverName
);
2228 SetTextXY(6, 17, "Select a file system from the list below.");
2230 SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system.");
2231 SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
2232 SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
2234 if (FileSystemList
== NULL
)
2236 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, FsFat
);
2237 if (FileSystemList
== NULL
)
2239 /* FIXME: show an error dialog */
2243 /* FIXME: Add file systems to list */
2245 DrawFileSystemList (FileSystemList
);
2247 SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit");
2249 if (IsUnattendedSetup
)
2251 return(CHECK_FILE_SYSTEM_PAGE
);
2258 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2259 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2261 if (ConfirmQuit (Ir
) == TRUE
)
2267 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2268 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2270 return SELECT_PARTITION_PAGE
;
2272 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2273 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2275 ScrollDownFileSystemList (FileSystemList
);
2277 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2278 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2280 ScrollUpFileSystemList (FileSystemList
);
2282 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2284 if (FileSystemList
->CurrentFileSystem
== FsKeep
)
2286 return CHECK_FILE_SYSTEM_PAGE
;
2290 return FORMAT_PARTITION_PAGE
;
2295 return SELECT_FILE_SYSTEM_PAGE
;
2300 FormatPartitionPage (PINPUT_RECORD Ir
)
2302 WCHAR PathBuffer
[MAX_PATH
];
2303 PDISKENTRY DiskEntry
;
2304 PPARTENTRY PartEntry
;
2314 SetTextXY(6, 8, "Format partition");
2316 SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue.");
2318 SetStatusText(" ENTER = Continue F3 = Quit");
2321 if (PartitionList
== NULL
||
2322 PartitionList
->CurrentDisk
== NULL
||
2323 PartitionList
->CurrentPartition
== NULL
)
2325 /* FIXME: show an error dialog */
2329 DiskEntry
= PartitionList
->CurrentDisk
;
2330 PartEntry
= PartitionList
->CurrentPartition
;
2336 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2337 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2339 if (ConfirmQuit (Ir
) == TRUE
)
2345 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2347 SetStatusText (" Please wait ...");
2349 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2351 switch (FileSystemList
->CurrentFileSystem
)
2354 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200ULL * 1024ULL))
2356 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2357 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2359 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024ULL * 255ULL * 63ULL * 512ULL))
2361 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2363 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32ULL * 1024ULL * 1024ULL))
2365 /* FAT16 CHS partition (partiton size < 32MB) */
2366 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2368 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2370 /* FAT16 CHS partition (partition size < 512MB) */
2371 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2375 /* FAT32 CHS partition (partition size >= 512MB) */
2376 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2381 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2383 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2385 /* FAT16 LBA partition (partition size < 512MB) */
2386 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2390 /* FAT32 LBA partition (partition size >= 512MB) */
2391 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2404 CheckActiveBootPartition (PartitionList
);
2408 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2409 DiskEntry
->DiskSize
,
2410 DiskEntry
->CylinderSize
,
2411 DiskEntry
->TrackSize
);
2414 DiskEntry
= PartitionList
->CurrentDisk
;
2415 Entry
= DiskEntry
->PartListHead
.Flink
;
2416 while (Entry
!= &DiskEntry
->PartListHead
)
2418 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2420 if (PartEntry
->Unpartitioned
== FALSE
)
2423 for (i
= 0; i
< 4; i
++)
2425 PrintTextXY (6, Line
,
2426 "%2u: %2u %c %12I64u %12I64u %2u %c",
2428 PartEntry
->PartInfo
[i
].PartitionNumber
,
2429 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2430 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2431 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2432 PartEntry
->PartInfo
[i
].PartitionType
,
2433 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2441 Entry
= Entry
->Flink
;
2444 /* Restore the old entry */
2445 PartEntry
= PartitionList
->CurrentPartition
;
2448 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2450 DPRINT ("WritePartitionsToDisk() failed\n");
2452 PopupError ("Setup failed to write partition tables.\n",
2453 "ENTER = Reboot computer");
2459 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2466 /* Set DestinationRootPath */
2467 RtlFreeUnicodeString (&DestinationRootPath
);
2468 swprintf (PathBuffer
,
2469 L
"\\Device\\Harddisk%lu\\Partition%lu",
2470 PartitionList
->CurrentDisk
->DiskNumber
,
2471 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2472 RtlCreateUnicodeString (&DestinationRootPath
,
2474 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2477 /* Set SystemRootPath */
2478 RtlFreeUnicodeString (&SystemRootPath
);
2479 swprintf (PathBuffer
,
2480 L
"\\Device\\Harddisk%lu\\Partition%lu",
2481 PartitionList
->ActiveBootDisk
->DiskNumber
,
2482 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2483 RtlCreateUnicodeString (&SystemRootPath
,
2485 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2488 switch (FileSystemList
->CurrentFileSystem
)
2491 Status
= FormatPartition (&DestinationRootPath
);
2492 if (!NT_SUCCESS (Status
))
2494 DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status
);
2495 /* FIXME: show an error dialog */
2499 PartEntry
->New
= FALSE
;
2500 if (FileSystemList
!= NULL
)
2502 DestroyFileSystemList (FileSystemList
);
2503 FileSystemList
= NULL
;
2506 CheckActiveBootPartition (PartitionList
);
2508 /* FIXME: Install boot code. This is a hack! */
2509 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
) ||
2510 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2512 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2513 wcscat (PathBuffer
, L
"\\loader\\fat32.bin");
2515 DPRINT ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2516 DestinationRootPath
.Buffer
);
2517 Status
= InstallFat32BootCodeToDisk (PathBuffer
,
2518 DestinationRootPath
.Buffer
);
2519 if (!NT_SUCCESS (Status
))
2521 DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2522 /* FIXME: show an error dialog */
2528 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2529 wcscat (PathBuffer
, L
"\\loader\\fat.bin");
2531 DPRINT ("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2532 DestinationRootPath
.Buffer
);
2533 Status
= InstallFat16BootCodeToDisk (PathBuffer
,
2534 DestinationRootPath
.Buffer
);
2535 if (!NT_SUCCESS (Status
))
2537 DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2538 /* FIXME: show an error dialog */
2552 SetStatusText (" Done. Press any key ...");
2556 return INSTALL_DIRECTORY_PAGE
;
2560 return FORMAT_PARTITION_PAGE
;
2565 CheckFileSystemPage(PINPUT_RECORD Ir
)
2567 WCHAR PathBuffer
[MAX_PATH
];
2569 SetTextXY(6, 8, "Check file system");
2571 SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
2573 SetStatusText(" Please wait ...");
2576 SetStatusText(" ENTER = Continue F3 = Quit");
2579 /* Set DestinationRootPath */
2580 RtlFreeUnicodeString (&DestinationRootPath
);
2581 swprintf (PathBuffer
,
2582 L
"\\Device\\Harddisk%lu\\Partition%lu",
2583 PartitionList
->CurrentDisk
->DiskNumber
,
2584 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2585 RtlCreateUnicodeString (&DestinationRootPath
,
2587 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2589 /* Set SystemRootPath */
2590 RtlFreeUnicodeString (&SystemRootPath
);
2591 swprintf (PathBuffer
,
2592 L
"\\Device\\Harddisk%lu\\Partition%lu",
2593 PartitionList
->ActiveBootDisk
->DiskNumber
,
2594 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2595 RtlCreateUnicodeString (&SystemRootPath
,
2597 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2600 if (IsUnattendedSetup
)
2602 return(INSTALL_DIRECTORY_PAGE
);
2609 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2610 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2612 if (ConfirmQuit(Ir
) == TRUE
)
2616 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2618 return(INSTALL_DIRECTORY_PAGE
);
2622 return(CHECK_FILE_SYSTEM_PAGE
);
2627 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2629 WCHAR PathBuffer
[MAX_PATH
];
2631 /* Create 'InstallPath' string */
2632 RtlFreeUnicodeString(&InstallPath
);
2633 RtlCreateUnicodeString(&InstallPath
,
2636 /* Create 'DestinationPath' string */
2637 RtlFreeUnicodeString(&DestinationPath
);
2639 DestinationRootPath
.Buffer
);
2640 if (InstallDir
[0] != L
'\\')
2643 wcscat(PathBuffer
, InstallDir
);
2644 RtlCreateUnicodeString(&DestinationPath
,
2647 /* Create 'DestinationArcPath' */
2648 RtlFreeUnicodeString(&DestinationArcPath
);
2649 swprintf(PathBuffer
,
2650 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2651 DiskEntry
->DiskNumber
,
2652 PartEntry
->PartInfo
[0].PartitionNumber
);
2653 if (InstallDir
[0] != L
'\\')
2656 wcscat(PathBuffer
, InstallDir
);
2657 RtlCreateUnicodeString(&DestinationArcPath
,
2660 return(PREPARE_COPY_PAGE
);
2665 InstallDirectoryPage(PINPUT_RECORD Ir
)
2667 PDISKENTRY DiskEntry
;
2668 PPARTENTRY PartEntry
;
2669 WCHAR InstallDir
[51];
2674 if (PartitionList
== NULL
||
2675 PartitionList
->CurrentDisk
== NULL
||
2676 PartitionList
->CurrentPartition
== NULL
)
2678 /* FIXME: show an error dialog */
2682 DiskEntry
= PartitionList
->CurrentDisk
;
2683 PartEntry
= PartitionList
->CurrentPartition
;
2685 /* Search for 'DefaultPath' in the 'SetupData' section */
2686 if (!InfFindFirstLine (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2688 PopupError("Setup failed to find the 'SetupData' section\n"
2689 "in TXTSETUP.SIF.\n",
2690 "ENTER = Reboot computer");
2696 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2703 /* Read the 'DefaultPath' data */
2704 if (InfGetData (&Context
, NULL
, &DefaultPath
))
2706 wcscpy(InstallDir
, DefaultPath
);
2710 wcscpy(InstallDir
, L
"\\ReactOS");
2712 Length
= wcslen(InstallDir
);
2714 SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
2715 SetTextXY(6, 9, "directory where you want ReactOS to be installed:");
2717 SetInputTextXY(8, 11, 51, InstallDir
);
2719 SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete");
2720 SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to");
2721 SetTextXY(6, 16, "be installed.");
2723 SetStatusText(" ENTER = Continue F3 = Quit");
2725 if (IsUnattendedSetup
)
2727 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2734 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2735 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2737 if (ConfirmQuit(Ir
) == TRUE
)
2741 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2743 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2745 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2750 InstallDir
[Length
] = 0;
2751 SetInputTextXY(8, 11, 51, InstallDir
);
2754 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2758 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2760 InstallDir
[Length
] = 0;
2761 SetInputTextXY(8, 11, 51, InstallDir
);
2766 return(INSTALL_DIRECTORY_PAGE
);
2771 AddSectionToCopyQueue(HINF InfFile
,
2773 PWCHAR SourceCabinet
,
2776 INFCONTEXT FilesContext
;
2777 INFCONTEXT DirContext
;
2779 PWCHAR FileKeyValue
;
2781 PWCHAR TargetFileName
;
2783 /* Search for the SectionName section */
2784 if (!InfFindFirstLine (InfFile
, SectionName
, NULL
, &FilesContext
))
2787 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2788 PopupError(Buffer
, "ENTER = Reboot computer");
2794 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2802 * Enumerate the files in the section
2803 * and add them to the file queue.
2807 /* Get source file name and target directory id */
2808 if (!InfGetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2810 /* FIXME: Handle error! */
2811 DPRINT1("InfGetData() failed\n");
2815 /* Get optional target file name */
2816 if (!InfGetDataField (&FilesContext
, 2, &TargetFileName
))
2817 TargetFileName
= NULL
;
2819 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2821 /* Lookup target directory */
2822 if (!InfFindFirstLine (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2824 /* FIXME: Handle error! */
2825 DPRINT1("InfFindFirstLine() failed\n");
2829 if (!InfGetData (&DirContext
, NULL
, &DirKeyValue
))
2831 /* FIXME: Handle error! */
2832 DPRINT1("InfGetData() failed\n");
2836 if (!SetupQueueCopy(SetupFileQueue
,
2838 SourceRootPath
.Buffer
,
2844 /* FIXME: Handle error! */
2845 DPRINT1("SetupQueueCopy() failed\n");
2848 while (InfFindNextLine(&FilesContext
, &FilesContext
));
2854 PrepareCopyPageInfFile(HINF InfFile
,
2855 PWCHAR SourceCabinet
,
2858 WCHAR PathBuffer
[MAX_PATH
];
2859 INFCONTEXT DirContext
;
2860 PWCHAR AdditionalSectionName
;
2865 /* Add common files */
2866 if (!AddSectionToCopyQueue(InfFile
, L
"SourceFiles", SourceCabinet
, Ir
))
2869 /* Add specific files depending of computer type */
2870 if (SourceCabinet
== NULL
)
2872 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
2874 if (AdditionalSectionName
)
2876 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, Ir
))
2881 /* Create directories */
2885 * Install directories like '\reactos\test' are not handled yet.
2888 /* Get destination path */
2889 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2891 /* Remove trailing backslash */
2892 Length
= wcslen(PathBuffer
);
2893 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2895 PathBuffer
[Length
- 1] = 0;
2898 /* Create the install directory */
2899 Status
= CreateDirectory(PathBuffer
);
2900 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2902 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2903 PopupError("Setup could not create the install directory.",
2904 "ENTER = Reboot computer");
2910 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2918 /* Search for the 'Directories' section */
2919 if (!InfFindFirstLine(InfFile
, L
"Directories", NULL
, &DirContext
))
2923 PopupError("Setup failed to find the 'Directories' section\n"
2924 "in the cabinet.\n", "ENTER = Reboot computer");
2928 PopupError("Setup failed to find the 'Directories' section\n"
2929 "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
2936 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2943 /* Enumerate the directory values and create the subdirectories */
2946 if (!InfGetData (&DirContext
, NULL
, &KeyValue
))
2952 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2954 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2956 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2957 wcscat(PathBuffer
, KeyValue
);
2959 DPRINT("FullPath: '%S'\n", PathBuffer
);
2961 else if (KeyValue
[0] != L
'\\')
2963 DPRINT("RelativePath: '%S'\n", KeyValue
);
2964 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2965 wcscat(PathBuffer
, L
"\\");
2966 wcscat(PathBuffer
, KeyValue
);
2968 DPRINT("FullPath: '%S'\n", PathBuffer
);
2970 Status
= CreateDirectory(PathBuffer
);
2971 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2973 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2974 PopupError("Setup could not create install directories.",
2975 "ENTER = Reboot computer");
2981 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2989 while (InfFindNextLine (&DirContext
, &DirContext
));
2996 PrepareCopyPage(PINPUT_RECORD Ir
)
2999 WCHAR PathBuffer
[MAX_PATH
];
3000 INFCONTEXT CabinetsContext
;
3007 SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
3009 SetStatusText(" Building the file copy list...");
3011 /* Create the file queue */
3012 SetupFileQueue
= SetupOpenFileQueue();
3013 if (SetupFileQueue
== NULL
)
3015 PopupError("Setup failed to open the copy file queue.\n",
3016 "ENTER = Reboot computer");
3022 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3029 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
3034 /* Search for the 'Cabinets' section */
3035 if (!InfFindFirstLine (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
3037 return FILE_COPY_PAGE
;
3041 * Enumerate the directory values in the 'Cabinets'
3042 * section and parse their inf files.
3046 if (!InfGetData (&CabinetsContext
, NULL
, &KeyValue
))
3049 wcscpy(PathBuffer
, SourcePath
.Buffer
);
3050 wcscat(PathBuffer
, L
"\\");
3051 wcscat(PathBuffer
, KeyValue
);
3053 CabinetInitialize();
3054 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
3055 CabinetSetCabinetName(PathBuffer
);
3057 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
3059 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
3061 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
3062 if (InfFileData
== NULL
)
3064 PopupError("Cabinet has no setup script.\n",
3065 "ENTER = Reboot computer");
3071 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3080 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
3082 PopupError("Cabinet not found.\n",
3083 "ENTER = Reboot computer");
3089 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3096 Status
= InfOpenBufferedFile(&InfHandle
,
3100 if (!NT_SUCCESS(Status
))
3102 PopupError("Cabinet has no valid inf file.\n",
3103 "ENTER = Reboot computer");
3109 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3118 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3123 while (InfFindNextLine (&CabinetsContext
, &CabinetsContext
));
3125 return FILE_COPY_PAGE
;
3130 FileCopyCallback(PVOID Context
,
3135 PCOPYCONTEXT CopyContext
;
3137 CopyContext
= (PCOPYCONTEXT
)Context
;
3139 switch (Notification
)
3141 case SPFILENOTIFY_STARTSUBQUEUE
:
3142 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3143 ProgressSetStepCount(CopyContext
->ProgressBar
,
3144 CopyContext
->TotalOperations
);
3147 case SPFILENOTIFY_STARTCOPY
:
3148 /* Display copy message */
3149 SetStatusText(" \xB3 Copying file: %S", (PWSTR
)Param1
);
3152 case SPFILENOTIFY_ENDCOPY
:
3153 CopyContext
->CompletedOperations
++;
3154 ProgressNextStep(CopyContext
->ProgressBar
);
3163 FileCopyPage(PINPUT_RECORD Ir
)
3165 COPYCONTEXT CopyContext
;
3169 SetStatusText(" \xB3 Please wait... ");
3171 SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS");
3172 SetTextXY(30, 13, "installation folder.");
3173 SetTextXY(20, 14, "This may take several minutes to complete.");
3175 GetScreenSize(&xScreen
, &yScreen
);
3176 CopyContext
.TotalOperations
= 0;
3177 CopyContext
.CompletedOperations
= 0;
3178 CopyContext
.ProgressBar
= CreateProgressBar(13,
3182 "Setup is copying files...");
3184 SetupCommitFileQueue(SetupFileQueue
,
3185 DestinationRootPath
.Buffer
,
3187 (PSP_FILE_CALLBACK
)FileCopyCallback
,
3190 SetupCloseFileQueue(SetupFileQueue
);
3192 DestroyProgressBar(CopyContext
.ProgressBar
);
3194 return REGISTRY_PAGE
;
3199 RegistryPage(PINPUT_RECORD Ir
)
3201 INFCONTEXT InfContext
;
3208 SetTextXY(6, 8, "Setup is updating the system configuration");
3210 SetStatusText(" Creating registry hives...");
3212 if (!SetInstallPathValue(&DestinationPath
))
3214 DPRINT("SetInstallPathValue() failed\n");
3215 PopupError("Setup failed to set the initialize the registry.",
3216 "ENTER = Reboot computer");
3222 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3229 /* Create the default hives */
3230 Status
= NtInitializeRegistry(TRUE
);
3231 if (!NT_SUCCESS(Status
))
3233 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3234 PopupError("Setup failed to create the registry hives.",
3235 "ENTER = Reboot computer");
3241 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3248 /* Update registry */
3249 SetStatusText(" Updating registry hives...");
3251 if (!InfFindFirstLine(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3253 DPRINT1("InfFindFirstLine() failed\n");
3254 PopupError("Setup failed to find the registry data files.",
3255 "ENTER = Reboot computer");
3261 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3270 InfGetDataField (&InfContext
, 0, &Action
);
3271 InfGetDataField (&InfContext
, 1, &File
);
3272 InfGetDataField (&InfContext
, 2, &Section
);
3274 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3276 if (!_wcsicmp (Action
, L
"AddReg"))
3280 else if (!_wcsicmp (Action
, L
"DelReg"))
3289 SetStatusText(" Importing %S...", File
);
3291 if (!ImportRegistryFile(File
, Section
, Delete
))
3293 DPRINT("Importing %S failed\n", File
);
3295 PopupError("Setup failed to import a hive file.",
3296 "ENTER = Reboot computer");
3302 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3309 while (InfFindNextLine (&InfContext
, &InfContext
));
3311 /* Update display registry settings */
3312 SetStatusText(" Updating display registry settings...");
3313 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3315 PopupError("Setup failed to update display registry settings.",
3316 "ENTER = Reboot computer");
3322 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3329 /* Update keyboard layout settings */
3330 SetStatusText(" Updating keyboard layout settings...");
3331 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3333 PopupError("Setup failed to update keyboard layout settings.",
3334 "ENTER = Reboot computer");
3340 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3347 /* Update mouse registry settings */
3348 SetStatusText(" Updating mouse registry settings...");
3349 if (!ProcessMouseRegistry(SetupInf
, PointerList
))
3351 PopupError("Setup failed to update mouse registry settings.",
3352 "ENTER = Reboot computer");
3358 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3365 SetStatusText(" Done...");
3367 return BOOT_LOADER_PAGE
;
3372 BootLoaderPage(PINPUT_RECORD Ir
)
3374 UCHAR PartitionType
;
3375 BOOLEAN InstallOnFloppy
;
3378 SetStatusText(" Please wait...");
3380 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3382 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3384 DPRINT("Error: active partition invalid (unused)\n");
3385 InstallOnFloppy
= TRUE
;
3387 else if (PartitionType
== 0x0A)
3389 /* OS/2 boot manager partition */
3390 DPRINT("Found OS/2 boot manager partition\n");
3391 InstallOnFloppy
= TRUE
;
3393 else if (PartitionType
== 0x83)
3395 /* Linux ext2 partition */
3396 DPRINT("Found Linux ext2 partition\n");
3397 InstallOnFloppy
= TRUE
;
3399 else if (PartitionType
== PARTITION_IFS
)
3401 /* NTFS partition */
3402 DPRINT("Found NTFS partition\n");
3403 InstallOnFloppy
= TRUE
;
3405 else if ((PartitionType
== PARTITION_FAT_12
) ||
3406 (PartitionType
== PARTITION_FAT_16
) ||
3407 (PartitionType
== PARTITION_HUGE
) ||
3408 (PartitionType
== PARTITION_XINT13
) ||
3409 (PartitionType
== PARTITION_FAT32
) ||
3410 (PartitionType
== PARTITION_FAT32_XINT13
))
3412 DPRINT("Found FAT partition\n");
3413 InstallOnFloppy
= FALSE
;
3417 /* Unknown partition */
3418 DPRINT("Unknown partition found\n");
3419 InstallOnFloppy
= TRUE
;
3422 if (InstallOnFloppy
== TRUE
)
3424 return BOOT_LOADER_FLOPPY_PAGE
;
3427 SetTextXY(6, 8, "Setup is installing the boot loader");
3429 SetTextXY(8, 12, "Install bootloader on the harddisk (MBR).");
3430 SetTextXY(8, 13, "Install bootloader on a floppy disk.");
3431 InvertTextXY (8, Line
, 48, 1);
3433 SetStatusText(" ENTER = Continue F3 = Quit");
3439 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3440 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3442 NormalTextXY (8, Line
, 48, 1);
3445 else if (Line
== 13)
3451 InvertTextXY (8, Line
, 48, 1);
3453 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3454 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3456 NormalTextXY (8, Line
, 48, 1);
3459 else if (Line
== 13)
3465 InvertTextXY (8, Line
, 48, 1);
3467 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3468 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3470 if (ConfirmQuit(Ir
) == TRUE
)
3474 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3478 return BOOT_LOADER_HARDDISK_PAGE
;
3480 else if (Line
== 13)
3482 return BOOT_LOADER_FLOPPY_PAGE
;
3485 return BOOT_LOADER_PAGE
;
3490 return BOOT_LOADER_PAGE
;
3495 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3499 SetTextXY(6, 8, "Setup cannot install the bootloader on your computers");
3500 SetTextXY(6, 9, "harddisk");
3502 SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and");
3503 SetTextXY(6, 14, "press ENTER.");
3506 SetStatusText(" ENTER = Continue F3 = Quit");
3507 // SetStatusText(" Please wait...");
3513 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3514 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3516 if (ConfirmQuit(Ir
) == TRUE
)
3520 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3522 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3524 PopupError("No disk in drive A:.",
3525 "ENTER = Continue");
3530 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3534 return BOOT_LOADER_FLOPPY_PAGE
;
3537 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3538 &DestinationArcPath
);
3539 if (!NT_SUCCESS(Status
))
3541 /* Print error message */
3542 return BOOT_LOADER_FLOPPY_PAGE
;
3545 return SUCCESS_PAGE
;
3549 return BOOT_LOADER_FLOPPY_PAGE
;
3554 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3556 UCHAR PartitionType
;
3559 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3560 if ((PartitionType
== PARTITION_FAT_12
) ||
3561 (PartitionType
== PARTITION_FAT_16
) ||
3562 (PartitionType
== PARTITION_HUGE
) ||
3563 (PartitionType
== PARTITION_XINT13
) ||
3564 (PartitionType
== PARTITION_FAT32
) ||
3565 (PartitionType
== PARTITION_FAT32_XINT13
))
3567 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3569 &DestinationArcPath
,
3571 if (!NT_SUCCESS(Status
))
3573 PopupError("Setup failed to install the FAT bootcode on the system partition.",
3574 "ENTER = Reboot computer");
3580 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3587 return SUCCESS_PAGE
;
3591 PopupError("failed to install FAT bootcode on the system partition.",
3592 "ENTER = Reboot computer");
3598 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3605 return BOOT_LOADER_HARDDISK_PAGE
;
3610 QuitPage(PINPUT_RECORD Ir
)
3612 SetTextXY(10, 6, "ReactOS is not completely installed");
3614 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3615 SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
3617 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3619 SetStatusText(" Please wait ...");
3621 /* Destroy partition list */
3622 if (PartitionList
!= NULL
)
3624 DestroyPartitionList (PartitionList
);
3625 PartitionList
= NULL
;
3628 /* Destroy filesystem list */
3629 if (FileSystemList
!= NULL
)
3631 DestroyFileSystemList (FileSystemList
);
3632 FileSystemList
= NULL
;
3635 /* Destroy computer settings list */
3636 if (ComputerList
!= NULL
)
3638 DestroyGenericList(ComputerList
, TRUE
);
3639 ComputerList
= NULL
;
3642 /* Destroy display settings list */
3643 if (DisplayList
!= NULL
)
3645 DestroyGenericList(DisplayList
, TRUE
);
3649 /* Destroy keyboard settings list */
3650 if (KeyboardList
!= NULL
)
3652 DestroyGenericList(KeyboardList
, TRUE
);
3653 KeyboardList
= NULL
;
3656 /* Destroy keyboard layout list */
3657 if (LayoutList
!= NULL
)
3659 DestroyGenericList(LayoutList
, TRUE
);
3663 /* Destroy pointer device list */
3664 if (PointerList
!= NULL
)
3666 DestroyGenericList(PointerList
, TRUE
);
3670 SetStatusText(" ENTER = Reboot computer");
3676 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3685 SuccessPage(PINPUT_RECORD Ir
)
3687 SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully.");
3689 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3690 SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
3692 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3694 SetStatusText(" ENTER = Reboot computer");
3696 if (IsUnattendedSetup
)
3705 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3714 FlushPage(PINPUT_RECORD Ir
)
3716 SetTextXY(10, 6, "The system is now making sure all data is stored on your disk");
3718 SetTextXY(10, 8, "This may take a minute");
3719 SetTextXY(10, 9, "When finished, your computer will reboot automatically");
3721 SetStatusText(" Flushing cache");
3731 OBJECT_ATTRIBUTES ObjectAttributes
;
3732 UNICODE_STRING UnicodeString
;
3733 HANDLE ReactOSInitEvent
;
3735 RtlRosInitUnicodeStringFromLiteral(&UnicodeString
, L
"\\ReactOSInitDone");
3736 InitializeObjectAttributes(&ObjectAttributes
,
3741 Status
= NtOpenEvent(&ReactOSInitEvent
,
3744 if (NT_SUCCESS(Status
))
3746 LARGE_INTEGER Timeout
;
3747 /* This will cause the boot screen image to go away (if displayed) */
3748 NtPulseEvent(ReactOSInitEvent
, NULL
);
3750 /* Wait for the display mode to be changed (if in graphics mode) */
3751 Timeout
.QuadPart
= -50000000LL; /* 5 second timeout */
3752 NtWaitForSingleObject(ReactOSInitEvent
, FALSE
, &Timeout
);
3754 NtClose(ReactOSInitEvent
);
3758 /* We don't really care if this fails */
3759 DPRINT1("USETUP: Failed to open ReactOS init notification event\n");
3765 NtProcessStartup(PPEB Peb
)
3771 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3773 ProcessHeap
= Peb
->ProcessHeap
;
3777 Status
= AllocConsole();
3778 if (!NT_SUCCESS(Status
))
3780 PrintString("AllocConsole() failed (Status = 0x%08lx)\n", Status
);
3782 /* Raise a hard error (crash the system/BSOD) */
3783 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3788 /* Initialize global unicode strings */
3789 RtlInitUnicodeString(&SourcePath
, NULL
);
3790 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3791 RtlInitUnicodeString(&InstallPath
, NULL
);
3792 RtlInitUnicodeString(&DestinationPath
, NULL
);
3793 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3794 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3795 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3797 /* Hide the cursor */
3798 SetCursorType(TRUE
, FALSE
);
3801 while (Page
!= REBOOT_PAGE
)
3805 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3811 Page
= StartPage(&Ir
);
3816 Page
= LicensePage(&Ir
);
3821 Page
= WarningPage(&Ir
);
3826 Page
= IntroPage(&Ir
);
3830 case INSTALL_INTRO_PAGE
:
3831 Page
= InstallIntroPage(&Ir
);
3835 case SCSI_CONTROLLER_PAGE
:
3836 Page
= ScsiControllerPage(&Ir
);
3841 case OEM_DRIVER_PAGE
:
3842 Page
= OemDriverPage(&Ir
);
3846 case DEVICE_SETTINGS_PAGE
:
3847 Page
= DeviceSettingsPage(&Ir
);
3850 case COMPUTER_SETTINGS_PAGE
:
3851 Page
= ComputerSettingsPage(&Ir
);
3854 case DISPLAY_SETTINGS_PAGE
:
3855 Page
= DisplaySettingsPage(&Ir
);
3858 case KEYBOARD_SETTINGS_PAGE
:
3859 Page
= KeyboardSettingsPage(&Ir
);
3862 case LAYOUT_SETTINGS_PAGE
:
3863 Page
= LayoutSettingsPage(&Ir
);
3866 case POINTER_SETTINGS_PAGE
:
3867 Page
= PointerSettingsPage(&Ir
);
3870 case SELECT_PARTITION_PAGE
:
3871 Page
= SelectPartitionPage(&Ir
);
3874 case CREATE_PARTITION_PAGE
:
3875 Page
= CreatePartitionPage(&Ir
);
3878 case DELETE_PARTITION_PAGE
:
3879 Page
= DeletePartitionPage(&Ir
);
3882 case SELECT_FILE_SYSTEM_PAGE
:
3883 Page
= SelectFileSystemPage(&Ir
);
3886 case FORMAT_PARTITION_PAGE
:
3887 Page
= FormatPartitionPage(&Ir
);
3890 case CHECK_FILE_SYSTEM_PAGE
:
3891 Page
= CheckFileSystemPage(&Ir
);
3894 case INSTALL_DIRECTORY_PAGE
:
3895 Page
= InstallDirectoryPage(&Ir
);
3898 case PREPARE_COPY_PAGE
:
3899 Page
= PrepareCopyPage(&Ir
);
3902 case FILE_COPY_PAGE
:
3903 Page
= FileCopyPage(&Ir
);
3907 Page
= RegistryPage(&Ir
);
3910 case BOOT_LOADER_PAGE
:
3911 Page
= BootLoaderPage(&Ir
);
3914 case BOOT_LOADER_FLOPPY_PAGE
:
3915 Page
= BootLoaderFloppyPage(&Ir
);
3918 case BOOT_LOADER_HARDDISK_PAGE
:
3919 Page
= BootLoaderHarddiskPage(&Ir
);
3924 case REPAIR_INTRO_PAGE
:
3925 Page
= RepairIntroPage(&Ir
);
3929 Page
= SuccessPage(&Ir
);
3933 Page
= FlushPage(&Ir
);
3937 Page
= QuitPage(&Ir
);
3947 NtShutdownSystem(ShutdownReboot
);
3948 NtTerminateProcess(NtCurrentProcess(), 0);