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
64 // SCSI_CONTROLLER_PAGE,
67 COMPUTER_SETTINGS_PAGE
,
68 DISPLAY_SETTINGS_PAGE
,
69 KEYBOARD_SETTINGS_PAGE
,
71 POINTER_SETTINGS_PAGE
,
73 SELECT_PARTITION_PAGE
,
74 CREATE_PARTITION_PAGE
,
75 DELETE_PARTITION_PAGE
,
77 SELECT_FILE_SYSTEM_PAGE
,
78 FORMAT_PARTITION_PAGE
,
79 CHECK_FILE_SYSTEM_PAGE
,
82 INSTALL_DIRECTORY_PAGE
,
86 BOOT_LOADER_FLOPPY_PAGE
,
87 BOOT_LOADER_HARDDISK_PAGE
,
96 REBOOT_PAGE
, /* virtual page */
97 } PAGE_NUMBER
, *PPAGE_NUMBER
;
99 typedef struct _COPYCONTEXT
101 ULONG TotalOperations
;
102 ULONG CompletedOperations
;
103 PPROGRESSBAR ProgressBar
;
104 } COPYCONTEXT
, *PCOPYCONTEXT
;
107 /* GLOBALS ******************************************************************/
110 UNICODE_STRING SourceRootPath
;
111 BOOLEAN IsUnattendedSetup
;
112 LONG UnattendDestinationDiskNumber
;
113 LONG UnattendDestinationPartitionNumber
;
114 WCHAR UnattendInstallationDirectory
[MAX_PATH
];
116 /* LOCALS *******************************************************************/
118 static PPARTLIST PartitionList
= NULL
;
120 static PFILE_SYSTEM_LIST FileSystemList
= NULL
;
123 static UNICODE_STRING SourcePath
;
125 static UNICODE_STRING InstallPath
;
127 /* Path to the install directory */
128 static UNICODE_STRING DestinationPath
;
129 static UNICODE_STRING DestinationArcPath
;
130 static UNICODE_STRING DestinationRootPath
;
132 /* Path to the active partition (boot manager) */
133 static UNICODE_STRING SystemRootPath
;
135 static HINF SetupInf
;
137 static HSPFILEQ SetupFileQueue
= NULL
;
139 static BOOLEAN WarnLinuxPartitions
= TRUE
;
141 static PGENERIC_LIST ComputerList
= NULL
;
142 static PGENERIC_LIST DisplayList
= NULL
;
143 static PGENERIC_LIST KeyboardList
= NULL
;
144 static PGENERIC_LIST LayoutList
= NULL
;
145 static PGENERIC_LIST PointerList
= NULL
;
148 /* FUNCTIONS ****************************************************************/
151 PrintString(char* fmt
,...)
155 UNICODE_STRING UnicodeString
;
156 ANSI_STRING AnsiString
;
159 vsprintf(buffer
, fmt
, ap
);
162 RtlInitAnsiString(&AnsiString
, buffer
);
163 RtlAnsiStringToUnicodeString(&UnicodeString
,
166 NtDisplayString(&UnicodeString
);
167 RtlFreeUnicodeString(&UnicodeString
);
172 PopupError(PCHAR Text
,
190 /* Count text lines and longest line */
196 p
= strchr(pnext
, '\n');
199 Length
= strlen(pnext
);
204 Length
= (ULONG
)(p
- pnext
);
209 if (Length
> MaxLength
)
212 if (LastLine
== TRUE
)
218 /* Check length of status line */
221 Length
= strlen(Status
);
222 if (Length
> MaxLength
)
226 GetScreenSize(&xScreen
, &yScreen
);
228 Width
= MaxLength
+ 4;
233 yTop
= (yScreen
- Height
) / 2;
234 xLeft
= (xScreen
- Width
) / 2;
237 /* Set screen attributes */
239 for (coPos
.Y
= yTop
; coPos
.Y
< yTop
+ Height
; coPos
.Y
++)
241 FillConsoleOutputAttribute(0x74,
247 /* draw upper left corner */
250 FillConsoleOutputCharacter(0xDA, // '+',
255 /* draw upper edge */
258 FillConsoleOutputCharacter(0xC4, // '-',
263 /* draw upper right corner */
264 coPos
.X
= xLeft
+ Width
- 1;
266 FillConsoleOutputCharacter(0xBF, // '+',
271 /* Draw right edge, inner space and left edge */
272 for (coPos
.Y
= yTop
+ 1; coPos
.Y
< yTop
+ Height
- 1; coPos
.Y
++)
275 FillConsoleOutputCharacter(0xB3, // '|',
281 FillConsoleOutputCharacter(' ',
286 coPos
.X
= xLeft
+ Width
- 1;
287 FillConsoleOutputCharacter(0xB3, // '|',
293 /* draw lower left corner */
295 coPos
.Y
= yTop
+ Height
- 1;
296 FillConsoleOutputCharacter(0xC0, // '+',
301 /* draw lower edge */
303 coPos
.Y
= yTop
+ Height
- 1;
304 FillConsoleOutputCharacter(0xC4, // '-',
309 /* draw lower right corner */
310 coPos
.X
= xLeft
+ Width
- 1;
311 coPos
.Y
= yTop
+ Height
- 1;
312 FillConsoleOutputCharacter(0xD9, // '+',
317 /* Print message text */
322 p
= strchr(pnext
, '\n');
325 Length
= strlen(pnext
);
330 Length
= (ULONG
)(p
- pnext
);
337 WriteConsoleOutputCharacters(pnext
,
342 if (LastLine
== TRUE
)
349 /* Print separator line and status text */
352 coPos
.Y
= yTop
+ Height
- 3;
354 FillConsoleOutputCharacter(0xC3, // '+',
360 FillConsoleOutputCharacter(0xC4, // '-',
365 coPos
.X
= xLeft
+ Width
- 1;
366 FillConsoleOutputCharacter(0xB4, // '+',
373 WriteConsoleOutputCharacters(Status
,
374 min(strlen(Status
), Width
- 4),
384 * FALSE: Don't quit setup.
387 ConfirmQuit(PINPUT_RECORD Ir
)
391 PopupError("ReactOS is not completely installed on your\n"
392 "computer. If you quit Setup now, you will need to\n"
393 "run Setup again to install ReactOS.\n"
395 " \x07 Press ENTER to continue Setup.\n"
396 " \x07 Press F3 to quit Setup.",
397 "F3= Quit ENTER = Continue");
403 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
404 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
409 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
421 CheckUnattendedSetup(VOID
)
423 WCHAR UnattendInfPath
[MAX_PATH
];
424 UNICODE_STRING FileName
;
432 if (DoesFileExist(SourcePath
.Buffer
, L
"unattend.inf") == FALSE
)
434 DPRINT("Does not exist: %S\\%S\n", SourcePath
.Buffer
, L
"unattend.inf");
435 IsUnattendedSetup
= FALSE
;
439 wcscpy(UnattendInfPath
, SourcePath
.Buffer
);
440 wcscat(UnattendInfPath
, L
"\\unattend.inf");
442 RtlInitUnicodeString(&FileName
,
445 /* Load 'unattend.inf' from install media. */
446 Status
= InfOpenFile(&UnattendInf
,
449 if (!NT_SUCCESS(Status
))
451 DPRINT("InfOpenFile() failed with status 0x%x\n", Status
);
455 /* Open 'Unattend' section */
456 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"Signature", &Context
))
458 DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
459 InfCloseFile(UnattendInf
);
463 /* Get pointer 'Signature' key */
464 if (!InfGetData(&Context
, NULL
, &Value
))
466 DPRINT("InfGetData() failed for key 'Signature'\n");
467 InfCloseFile(UnattendInf
);
471 /* Check 'Signature' string */
472 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
474 DPRINT("Signature not $ReactOS$\n");
475 InfCloseFile(UnattendInf
);
479 /* Search for 'DestinationDiskNumber' in the 'Unattend' section */
480 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationDiskNumber", &Context
))
482 DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
483 InfCloseFile(UnattendInf
);
486 if (!InfGetIntField(&Context
, 0, &IntValue
))
488 DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
489 InfCloseFile(UnattendInf
);
492 UnattendDestinationDiskNumber
= IntValue
;
494 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
495 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
497 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
498 InfCloseFile(UnattendInf
);
501 if (!InfGetIntField(&Context
, 0, &IntValue
))
503 DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
504 InfCloseFile(UnattendInf
);
507 UnattendDestinationPartitionNumber
= IntValue
;
509 /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
510 if (!InfFindFirstLine(UnattendInf
, L
"Unattend", L
"DestinationPartitionNumber", &Context
))
512 DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
513 InfCloseFile(UnattendInf
);
517 /* Get pointer 'InstallationDirectory' key */
518 if (!InfGetData(&Context
, NULL
, &Value
))
520 DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
521 InfCloseFile(UnattendInf
);
524 wcscpy(UnattendInstallationDirectory
, Value
);
526 InfCloseFile(UnattendInf
);
528 IsUnattendedSetup
= TRUE
;
530 DPRINT("Running unattended setup\n");
537 * Number of the next page.
540 StartPage(PINPUT_RECORD Ir
)
542 SYSTEM_DEVICE_INFORMATION Sdi
;
544 WCHAR FileNameBuffer
[MAX_PATH
];
545 UNICODE_STRING FileName
;
551 SetStatusText(" Please wait...");
554 /* Check whether a harddisk is available */
555 Status
= NtQuerySystemInformation (SystemDeviceInformation
,
557 sizeof(SYSTEM_DEVICE_INFORMATION
),
559 if (!NT_SUCCESS (Status
))
561 PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status
);
562 PopupError("Setup could not retrieve system drive information.\n",
563 "ENTER = Reboot computer");
568 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
575 if (Sdi
.NumberOfDisks
== 0)
577 PopupError("Setup could not find a harddisk.\n",
578 "ENTER = Reboot computer");
583 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
590 /* Get the source path and source root path */
591 Status
= GetSourcePaths(&SourcePath
,
593 if (!NT_SUCCESS(Status
))
595 PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status
);
596 PopupError("Setup could not find its source drive.\n",
597 "ENTER = Reboot computer");
602 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
611 PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath
);
612 PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath
);
616 /* Load txtsetup.sif from install media. */
617 wcscpy(FileNameBuffer
, SourceRootPath
.Buffer
);
618 wcscat(FileNameBuffer
, L
"\\reactos\\txtsetup.sif");
619 RtlInitUnicodeString(&FileName
,
622 Status
= InfOpenFile(&SetupInf
,
625 if (!NT_SUCCESS(Status
))
627 PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
628 "ENTER = Reboot computer");
634 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
641 /* Open 'Version' section */
642 if (!InfFindFirstLine (SetupInf
, L
"Version", L
"Signature", &Context
))
644 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
645 "ENTER = Reboot computer");
651 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
659 /* Get pointer 'Signature' key */
660 if (!InfGetData (&Context
, NULL
, &Value
))
662 PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
663 "ENTER = Reboot computer");
669 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
676 /* Check 'Signature' string */
677 if (_wcsicmp(Value
, L
"$ReactOS$") != 0)
679 PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
680 "ENTER = Reboot computer");
686 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
693 CheckUnattendedSetup();
705 IntroPage(PINPUT_RECORD Ir
)
707 SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup");
709 SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your");
710 SetTextXY(6, 12, "computer and prepares the second part of the setup.");
712 SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS.");
713 SetTextXY(8, 17, "\x07 Press L to view the licensing terms for ReactOS.");
714 SetTextXY(8, 19, "\x07 Press E to start the emergency console.");
715 SetTextXY(8, 21, "\x07 Press R to repair ReactOS.");
716 SetTextXY(8, 23, "\x07 Press F3 to quit without installing ReactOS.");
718 SetStatusText(" ENTER = Continue F3 = Quit");
720 if (IsUnattendedSetup
)
722 return INSTALL_INTRO_PAGE
;
729 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
730 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
732 if (ConfirmQuit(Ir
) == TRUE
)
736 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
738 return INSTALL_INTRO_PAGE
;
740 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'L') /* L */
744 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'E') /* E */
746 return EMERGENCY_INTRO_PAGE
;
748 else if (toupper(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
) == 'R') /* R */
750 return REPAIR_INTRO_PAGE
;
760 * Back to main setup page.
763 LicensePage(PINPUT_RECORD Ir
)
765 SetHighlightedTextXY(6, 8, "Licensing:");
767 SetTextXY(8, 11, "The ReactOS System is licensed under the terms of the");
768 SetTextXY(8, 12, "GNU GPL with parts containing code from other compatible");
769 SetTextXY(8, 13, "licenses such as the X11 or BSD and GNU LGPL licenses.");
770 SetTextXY(8, 14, "All software that is part of the ReactOS system is");
771 SetTextXY(8, 15, "therefore released under the GNU GPL as well as maintaining");
772 SetTextXY(8, 16, "the original license.");
774 SetTextXY(8, 18, "This software comes with NO WARRANTY or restrictions on usage");
775 SetTextXY(8, 19, "save applicable local and international law. The licensing of");
776 SetTextXY(8, 20, "ReactOS only covers distribution to third parties.");
778 SetTextXY(8, 22, "If for some reason you did not receive a copy of the");
779 SetTextXY(8, 23, "GNU General Public License with ReactOS please visit");
780 SetHighlightedTextXY(8, 25, "http://www.gnu.org/licenses/licenses.html");
782 SetStatusText("ENTER = Continue F3 = Quit");
788 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
789 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
791 if (ConfirmQuit(Ir
) == TRUE
)
795 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
805 EmergencyIntroPage(PINPUT_RECORD Ir
)
807 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
808 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
810 SetTextXY(6, 12, "The emergency console is not implemented yet.");
812 SetTextXY(8, 15, "\x07 Press ESC to return to the main page.");
814 SetTextXY(8, 17, "\x07 Press ENTER to reboot your computer.");
816 SetStatusText(" ESC = Main page ENTER = Reboot");
822 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
826 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
827 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
833 return REPAIR_INTRO_PAGE
;
838 RepairIntroPage(PINPUT_RECORD Ir
)
840 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
841 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
843 SetTextXY(6, 12, "The repair functions are not implemented yet.");
845 SetTextXY(8, 15, "\x07 Press ESC to return to the main page.");
847 SetTextXY(8, 17, "\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 ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
860 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
866 return REPAIR_INTRO_PAGE
;
871 InstallIntroPage(PINPUT_RECORD Ir
)
873 SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
874 SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
876 SetTextXY(6, 12, "The following limitations apply:");
877 SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
878 SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
879 SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
880 SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
881 SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
882 SetTextXY(8, 18, "- Setup supports FAT file systems only.");
883 SetTextXY(8, 19, "- File system checks are not implemented yet.");
886 SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
888 SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
891 SetStatusText(" ENTER = Continue F3 = Quit");
893 if (IsUnattendedSetup
)
895 return SELECT_PARTITION_PAGE
;
902 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
903 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
905 if (ConfirmQuit(Ir
) == TRUE
)
909 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
911 return DEVICE_SETTINGS_PAGE
;
912 // return SCSI_CONTROLLER_PAGE;
916 return INSTALL_INTRO_PAGE
;
922 ScsiControllerPage(PINPUT_RECORD Ir
)
924 SetTextXY(6, 8, "Setup detected the following mass storage devices:");
926 /* FIXME: print loaded mass storage driver descriptions */
928 SetTextXY(8, 10, "TEST device");
932 SetStatusText(" ENTER = Continue F3 = Quit");
938 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
939 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
941 if (ConfirmQuit(Ir
) == TRUE
)
945 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
947 return DEVICE_SETTINGS_PAGE
;
951 return SCSI_CONTROLLER_PAGE
;
957 DeviceSettingsPage(PINPUT_RECORD Ir
)
959 static ULONG Line
= 17;
961 /* Initialize the computer settings list */
962 if (ComputerList
== NULL
)
964 ComputerList
= CreateComputerTypeList(SetupInf
);
965 if (ComputerList
== NULL
)
967 /* FIXME: report error */
971 /* Initialize the display settings list */
972 if (DisplayList
== NULL
)
974 DisplayList
= CreateDisplayDriverList(SetupInf
);
975 if (DisplayList
== NULL
)
977 /* FIXME: report error */
981 /* Initialize the keyboard settings list */
982 if (KeyboardList
== NULL
)
984 KeyboardList
= CreateKeyboardDriverList(SetupInf
);
985 if (KeyboardList
== NULL
)
987 /* FIXME: report error */
991 /* Initialize the keyboard layout list */
992 if (LayoutList
== NULL
)
994 LayoutList
= CreateKeyboardLayoutList(SetupInf
);
995 if (LayoutList
== NULL
)
997 /* FIXME: report error */
998 PopupError("Setup failed to load the keyboard layout list.\n",
999 "ENTER = Reboot computer");
1005 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1013 /* Initialize the pointer settings list */
1014 if (PointerList
== NULL
)
1016 PointerList
= CreateMouseDriverList(SetupInf
);
1017 if (PointerList
== NULL
)
1019 /* FIXME: report error */
1023 SetTextXY(6, 8, "The list below shows the current device settings.");
1025 SetTextXY(8, 11, " Computer:");
1026 SetTextXY(8, 12, " Display:");
1027 SetTextXY(8, 13, " Keyboard:");
1028 SetTextXY(8, 14, "Keyboard layout:");
1029 SetTextXY(8, 15, " Pointer device:");
1031 SetTextXY(8, 17, " Accept:");
1033 SetTextXY(25, 11, GetGenericListEntry(ComputerList
)->Text
);
1034 SetTextXY(25, 12, GetGenericListEntry(DisplayList
)->Text
);
1035 SetTextXY(25, 13, GetGenericListEntry(KeyboardList
)->Text
);
1036 SetTextXY(25, 14, GetGenericListEntry(LayoutList
)->Text
);
1037 SetTextXY(25, 15, GetGenericListEntry(PointerList
)->Text
);
1039 SetTextXY(25, 17, "Accept these device settings");
1040 InvertTextXY (24, Line
, 48, 1);
1043 SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
1044 SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
1045 SetTextXY(6, 22, "settings.");
1047 SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
1048 SetTextXY(6, 25, "and press ENTER.");
1050 SetStatusText(" ENTER = Continue F3 = Quit");
1056 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1057 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1059 NormalTextXY (24, Line
, 48, 1);
1062 else if (Line
== 17)
1066 InvertTextXY (24, Line
, 48, 1);
1068 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1069 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1071 NormalTextXY (24, Line
, 48, 1);
1074 else if (Line
== 17)
1078 InvertTextXY (24, Line
, 48, 1);
1080 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1081 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1083 if (ConfirmQuit(Ir
) == TRUE
)
1087 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1090 return COMPUTER_SETTINGS_PAGE
;
1091 else if (Line
== 12)
1092 return DISPLAY_SETTINGS_PAGE
;
1093 else if (Line
== 13)
1094 return KEYBOARD_SETTINGS_PAGE
;
1095 else if (Line
== 14)
1096 return LAYOUT_SETTINGS_PAGE
;
1097 else if (Line
== 15)
1098 return POINTER_SETTINGS_PAGE
;
1099 else if (Line
== 17)
1100 return SELECT_PARTITION_PAGE
;
1104 return DEVICE_SETTINGS_PAGE
;
1109 ComputerSettingsPage(PINPUT_RECORD Ir
)
1114 SetTextXY(6, 8, "You want to change the type of computer to be installed.");
1116 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
1117 SetTextXY(8, 11, " Then press ENTER.");
1119 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1120 SetTextXY(8, 14, " the computer type.");
1122 GetScreenSize(&xScreen
, &yScreen
);
1124 DrawGenericList(ComputerList
,
1130 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1132 SaveGenericListState(ComputerList
);
1138 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1139 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1141 ScrollDownGenericList (ComputerList
);
1143 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1144 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1146 ScrollUpGenericList (ComputerList
);
1148 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1149 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1151 if (ConfirmQuit(Ir
) == TRUE
)
1155 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1156 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1158 RestoreGenericListState(ComputerList
);
1159 return DEVICE_SETTINGS_PAGE
;
1161 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1163 return DEVICE_SETTINGS_PAGE
;
1167 return COMPUTER_SETTINGS_PAGE
;
1172 DisplaySettingsPage(PINPUT_RECORD Ir
)
1177 SetTextXY(6, 8, "You want to change the type of display to be installed.");
1179 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
1180 SetTextXY(8, 11, " Then press ENTER.");
1182 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1183 SetTextXY(8, 14, " the display type.");
1185 GetScreenSize(&xScreen
, &yScreen
);
1187 DrawGenericList(DisplayList
,
1193 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1195 SaveGenericListState(DisplayList
);
1201 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1202 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1204 ScrollDownGenericList (DisplayList
);
1206 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1207 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1209 ScrollUpGenericList (DisplayList
);
1211 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1212 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1214 if (ConfirmQuit(Ir
) == TRUE
)
1220 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1221 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1223 RestoreGenericListState(DisplayList
);
1224 return DEVICE_SETTINGS_PAGE
;
1226 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1228 return DEVICE_SETTINGS_PAGE
;
1232 return DISPLAY_SETTINGS_PAGE
;
1237 KeyboardSettingsPage(PINPUT_RECORD Ir
)
1242 SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
1244 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
1245 SetTextXY(8, 11, " Then press ENTER.");
1247 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1248 SetTextXY(8, 14, " the keyboard type.");
1250 GetScreenSize(&xScreen
, &yScreen
);
1252 DrawGenericList(KeyboardList
,
1258 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1260 SaveGenericListState(KeyboardList
);
1266 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1267 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1269 ScrollDownGenericList (KeyboardList
);
1271 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1272 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1274 ScrollUpGenericList (KeyboardList
);
1276 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1277 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1279 if (ConfirmQuit(Ir
) == TRUE
)
1283 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1284 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1286 RestoreGenericListState(KeyboardList
);
1287 return DEVICE_SETTINGS_PAGE
;
1289 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1291 return DEVICE_SETTINGS_PAGE
;
1295 return DISPLAY_SETTINGS_PAGE
;
1300 LayoutSettingsPage(PINPUT_RECORD Ir
)
1305 SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
1307 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
1308 SetTextXY(8, 11, " layout. Then press ENTER.");
1310 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1311 SetTextXY(8, 14, " the keyboard layout.");
1313 GetScreenSize(&xScreen
, &yScreen
);
1315 DrawGenericList(LayoutList
,
1321 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1323 SaveGenericListState(LayoutList
);
1329 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1330 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1332 ScrollDownGenericList (LayoutList
);
1334 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1335 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1337 ScrollUpGenericList (LayoutList
);
1339 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1340 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1342 if (ConfirmQuit(Ir
) == TRUE
)
1346 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1347 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1349 RestoreGenericListState(LayoutList
);
1350 return DEVICE_SETTINGS_PAGE
;
1352 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1354 return DEVICE_SETTINGS_PAGE
;
1358 return DISPLAY_SETTINGS_PAGE
;
1363 PointerSettingsPage(PINPUT_RECORD Ir
)
1368 SetTextXY(6, 8, "You want to change the pointing device to be installed.");
1370 SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired pointing");
1371 SetTextXY(8, 11, " device. Then press ENTER.");
1373 SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
1374 SetTextXY(8, 14, " the pointing device.");
1376 GetScreenSize(&xScreen
, &yScreen
);
1378 DrawGenericList(PointerList
,
1384 SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
1386 SaveGenericListState(PointerList
);
1392 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1393 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1395 ScrollDownGenericList(PointerList
);
1397 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1398 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1400 ScrollUpGenericList(PointerList
);
1402 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1403 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1405 if (ConfirmQuit(Ir
) == TRUE
)
1409 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1410 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
1412 RestoreGenericListState(PointerList
);
1413 return DEVICE_SETTINGS_PAGE
;
1415 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
1417 return DEVICE_SETTINGS_PAGE
;
1421 return DISPLAY_SETTINGS_PAGE
;
1426 SelectPartitionPage(PINPUT_RECORD Ir
)
1431 SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
1432 SetTextXY(6, 9, "space for new partitions.");
1434 SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
1435 SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
1436 SetTextXY(8, 15, "\x07 Press C to create a new partition.");
1437 SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
1439 SetStatusText(" Please wait...");
1441 GetScreenSize(&xScreen
, &yScreen
);
1443 if (PartitionList
== NULL
)
1445 PartitionList
= CreatePartitionList (2,
1449 if (PartitionList
== NULL
)
1451 /* FIXME: show an error dialog */
1456 CheckActiveBootPartition (PartitionList
);
1458 DrawPartitionList (PartitionList
);
1460 /* Warn about partitions created by Linux Fdisk */
1461 if (WarnLinuxPartitions
== TRUE
&&
1462 CheckForLinuxFdiskPartitions (PartitionList
) == TRUE
)
1464 PopupError ("Setup found that at least one harddisk contains an incompatible\n"
1465 "partition table that can not be handled properly!\n"
1467 "Creating or deleting partitions can destroy the partiton table.\n"
1469 " \x07 Press F3 to quit Setup."
1470 " \x07 Press ENTER to continue.",
1471 "F3= Quit ENTER = Continue");
1476 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1477 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1481 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1483 WarnLinuxPartitions
= FALSE
;
1484 return SELECT_PARTITION_PAGE
;
1489 if (IsUnattendedSetup
)
1491 SelectPartition(PartitionList
,
1492 UnattendDestinationDiskNumber
,
1493 UnattendDestinationPartitionNumber
);
1494 return(SELECT_FILE_SYSTEM_PAGE
);
1499 /* Update status text */
1500 if (PartitionList
->CurrentPartition
== NULL
||
1501 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1503 SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
1507 SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
1512 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1513 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1515 if (ConfirmQuit(Ir
) == TRUE
)
1517 DestroyPartitionList (PartitionList
);
1518 PartitionList
= NULL
;
1523 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1524 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
1526 ScrollDownPartitionList (PartitionList
);
1528 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1529 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
1531 ScrollUpPartitionList (PartitionList
);
1533 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1535 if (PartitionList
->CurrentPartition
== NULL
||
1536 PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1538 CreateNewPartition (PartitionList
,
1543 return SELECT_FILE_SYSTEM_PAGE
;
1545 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_C
) /* C */
1547 if (PartitionList
->CurrentPartition
->Unpartitioned
== FALSE
)
1549 PopupError ("You can not create a new Partition inside\n"
1550 "of an already existing Partition!\n"
1552 " * Press any key to continue.",
1556 return SELECT_PARTITION_PAGE
;
1559 return CREATE_PARTITION_PAGE
;
1561 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
1563 if (PartitionList
->CurrentPartition
->Unpartitioned
== TRUE
)
1565 PopupError ("You can not delete unpartitioned disk space!\n"
1567 " * Press any key to continue.",
1571 return SELECT_PARTITION_PAGE
;
1574 return DELETE_PARTITION_PAGE
;
1578 return SELECT_PARTITION_PAGE
;
1583 DrawInputField(ULONG FieldLength
,
1593 memset(buf
, '_', sizeof(buf
));
1594 buf
[FieldLength
- strlen(FieldContent
)] = 0;
1595 strcat(buf
, FieldContent
);
1597 WriteConsoleOutputCharacters (buf
,
1603 #define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
1606 ShowPartitionSizeInputBox(SHORT Left
,
1631 /* draw upper left corner */
1634 FillConsoleOutputCharacter(0xDA, // '+',
1639 /* draw upper edge */
1642 FillConsoleOutputCharacter(0xC4, // '-',
1647 /* draw upper right corner */
1650 FillConsoleOutputCharacter(0xBF, // '+',
1655 /* draw left and right edge */
1656 for (i
= Top
+ 1; i
< Bottom
; i
++)
1660 FillConsoleOutputCharacter(0xB3, // '|',
1666 FillConsoleOutputCharacter(0xB3, //'|',
1672 /* draw lower left corner */
1675 FillConsoleOutputCharacter(0xC0, // '+',
1680 /* draw lower edge */
1683 FillConsoleOutputCharacter(0xC4, // '-',
1688 /* draw lower right corner */
1691 FillConsoleOutputCharacter(0xD9, // '+',
1699 strcpy (Buffer
, "Size of new partition:");
1700 iLeft
= coPos
.X
+ strlen (Buffer
) + 1;
1702 WriteConsoleOutputCharacters (Buffer
,
1706 sprintf (Buffer
, "MB (max. %lu MB)", MaxSize
);
1707 coPos
.X
= iLeft
+ PARTITION_SIZE_INPUT_FIELD_LENGTH
+ 1;
1709 WriteConsoleOutputCharacters (Buffer
,
1713 sprintf(Buffer
, "%d", MaxSize
);
1714 Index
= strlen(Buffer
);
1715 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1724 if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
1725 (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
1732 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
1736 else if (Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESCAPE */
1743 else if ((Ir
.Event
.KeyEvent
.wVirtualKeyCode
== VK_BACK
) && /* BACKSPACE */
1748 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1753 else if ((Ir
.Event
.KeyEvent
.uChar
.AsciiChar
!= 0x00) &&
1754 (Index
< PARTITION_SIZE_INPUT_FIELD_LENGTH
))
1756 ch
= Ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1757 if ((ch
>= '0') && (ch
<= '9'))
1762 DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH
,
1770 strcpy (InputBuffer
,
1776 CreatePartitionPage (PINPUT_RECORD Ir
)
1778 PDISKENTRY DiskEntry
;
1779 PPARTENTRY PartEntry
;
1784 CHAR InputBuffer
[50];
1790 if (PartitionList
== NULL
||
1791 PartitionList
->CurrentDisk
== NULL
||
1792 PartitionList
->CurrentPartition
== NULL
)
1794 /* FIXME: show an error dialog */
1798 DiskEntry
= PartitionList
->CurrentDisk
;
1799 PartEntry
= PartitionList
->CurrentPartition
;
1801 SetStatusText (" Please wait...");
1803 GetScreenSize (&xScreen
, &yScreen
);
1805 SetTextXY (6, 8, "You have chosen to create a new partition on");
1808 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
1810 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
1816 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
1822 if (DiskEntry
->DriverName
.Length
> 0)
1825 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
1828 DiskEntry
->DiskNumber
,
1832 &DiskEntry
->DriverName
);
1837 "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
1840 DiskEntry
->DiskNumber
,
1847 SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
1850 PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB",
1851 PartitionList
->CurrentPartition
->UnpartitionedLength
/ (1024*1024));
1854 SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit");
1856 PartEntry
= PartitionList
->CurrentPartition
;
1859 MaxSize
= (PartEntry
->UnpartitionedLength
+ (1 << 19)) >> 20; /* in MBytes (rounded) */
1860 ShowPartitionSizeInputBox (12, 14, xScreen
- 12, 17, /* left, top, right, bottom */
1861 MaxSize
, InputBuffer
, &Quit
, &Cancel
);
1864 if (ConfirmQuit (Ir
) == TRUE
)
1869 else if (Cancel
== TRUE
)
1871 return SELECT_PARTITION_PAGE
;
1875 PartSize
= atoi (InputBuffer
);
1882 if (PartSize
> MaxSize
)
1888 /* Convert to bytes */
1889 if (PartSize
== MaxSize
)
1891 /* Use all of the unpartitioned disk space */
1892 PartSize
= PartEntry
->UnpartitionedLength
;
1896 /* Round-up by cylinder size */
1897 PartSize
= ROUND_UP (PartSize
* 1024 * 1024,
1898 DiskEntry
->CylinderSize
);
1900 /* But never get larger than the unpartitioned disk space */
1901 if (PartSize
> PartEntry
->UnpartitionedLength
)
1902 PartSize
= PartEntry
->UnpartitionedLength
;
1905 DPRINT ("Partition size: %I64u bytes\n", PartSize
);
1907 CreateNewPartition (PartitionList
,
1911 return SELECT_PARTITION_PAGE
;
1915 return CREATE_PARTITION_PAGE
;
1920 DeletePartitionPage (PINPUT_RECORD Ir
)
1922 PDISKENTRY DiskEntry
;
1923 PPARTENTRY PartEntry
;
1929 if (PartitionList
== NULL
||
1930 PartitionList
->CurrentDisk
== NULL
||
1931 PartitionList
->CurrentPartition
== NULL
)
1933 /* FIXME: show an error dialog */
1937 DiskEntry
= PartitionList
->CurrentDisk
;
1938 PartEntry
= PartitionList
->CurrentPartition
;
1940 SetTextXY (6, 8, "You have chosen to delete the partition");
1942 /* Determine partition type */
1944 if (PartEntry
->New
== TRUE
)
1946 PartType
= "New (Unformatted)";
1948 else if (PartEntry
->Unpartitioned
== FALSE
)
1950 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
1951 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
1952 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
1953 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
1957 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
1958 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
1962 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
1964 PartType
= "NTFS"; /* FIXME: Not quite correct! */
1969 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
1971 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
1976 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0xA00000ULL
) /* 10 MB */
1978 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
1983 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 9)) >> 10;
1987 if (PartType
== NULL
)
1990 " %c%c Type %lu %I64u %s",
1991 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
1992 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
1993 PartEntry
->PartInfo
[0].PartitionType
,
2000 " %c%c %s %I64u %s",
2001 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2002 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2009 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2011 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2017 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2023 if (DiskEntry
->DriverName
.Length
> 0)
2026 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.",
2029 DiskEntry
->DiskNumber
,
2033 &DiskEntry
->DriverName
);
2038 "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).",
2041 DiskEntry
->DiskNumber
,
2047 SetTextXY (8, 18, "\x07 Press D to delete the partition.");
2048 SetTextXY (11, 19, "WARNING: All data on this partition will be lost!");
2050 SetTextXY (8, 21, "\x07 Press ESC to cancel.");
2052 SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit");
2058 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2059 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2061 if (ConfirmQuit (Ir
) == TRUE
)
2067 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
) /* ESC */
2069 return SELECT_PARTITION_PAGE
;
2071 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_D
) /* D */
2073 DeleteCurrentPartition (PartitionList
);
2075 return SELECT_PARTITION_PAGE
;
2079 return DELETE_PARTITION_PAGE
;
2084 SelectFileSystemPage (PINPUT_RECORD Ir
)
2086 PDISKENTRY DiskEntry
;
2087 PPARTENTRY PartEntry
;
2094 if (PartitionList
== NULL
||
2095 PartitionList
->CurrentDisk
== NULL
||
2096 PartitionList
->CurrentPartition
== NULL
)
2098 /* FIXME: show an error dialog */
2102 DiskEntry
= PartitionList
->CurrentDisk
;
2103 PartEntry
= PartitionList
->CurrentPartition
;
2105 /* adjust disk size */
2106 if (DiskEntry
->DiskSize
>= 0x280000000ULL
) /* 10 GB */
2108 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 29)) >> 30;
2113 DiskSize
= (DiskEntry
->DiskSize
+ (1 << 19)) >> 20;
2117 /* adjust partition size */
2118 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
>= 0x280000000ULL
) /* 10 GB */
2120 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 29)) >> 30;
2125 PartSize
= (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
+ (1 << 19)) >> 20;
2129 /* adjust partition type */
2130 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_12
) ||
2131 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT_16
) ||
2132 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_HUGE
) ||
2133 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_XINT13
))
2137 else if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
) ||
2138 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
))
2142 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_IFS
)
2144 PartType
= "NTFS"; /* FIXME: Not quite correct! */
2146 else if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2148 PartType
= "Unused";
2152 PartType
= "Unknown";
2155 if (PartEntry
->AutoCreate
== TRUE
)
2157 SetTextXY(6, 8, "Setup created a new partition on");
2160 PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
2161 PartEntry
->PartInfo
[0].PartitionNumber
,
2167 PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2168 DiskEntry
->DiskNumber
,
2174 &DiskEntry
->DriverName
);
2176 SetTextXY(6, 12, "This Partition will be formatted next.");
2179 PartEntry
->AutoCreate
= FALSE
;
2181 else if (PartEntry
->New
== TRUE
)
2183 SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition.");
2184 SetTextXY(6, 10, "This Partition will be formatted next.");
2188 SetTextXY(6, 8, "Setup install ReactOS onto Partition");
2190 if (PartType
== NULL
)
2193 "%c%c Type %lu %I64u %s",
2194 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2195 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2196 PartEntry
->PartInfo
[0].PartitionType
,
2204 (PartEntry
->DriveLetter
== 0) ? '-' : PartEntry
->DriveLetter
,
2205 (PartEntry
->DriveLetter
== 0) ? '-' : ':',
2211 PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
2212 DiskEntry
->DiskNumber
,
2218 &DiskEntry
->DriverName
);
2222 SetTextXY(6, 17, "Select a file system from the list below.");
2224 SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system.");
2225 SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
2226 SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
2228 if (FileSystemList
== NULL
)
2230 FileSystemList
= CreateFileSystemList (6, 26, PartEntry
->New
, FsFat
);
2231 if (FileSystemList
== NULL
)
2233 /* FIXME: show an error dialog */
2237 /* FIXME: Add file systems to list */
2239 DrawFileSystemList (FileSystemList
);
2241 SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit");
2243 if (IsUnattendedSetup
)
2245 return(CHECK_FILE_SYSTEM_PAGE
);
2252 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2253 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2255 if (ConfirmQuit (Ir
) == TRUE
)
2261 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2262 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_ESCAPE
)) /* ESC */
2264 return SELECT_PARTITION_PAGE
;
2266 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2267 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
2269 ScrollDownFileSystemList (FileSystemList
);
2271 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2272 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
2274 ScrollUpFileSystemList (FileSystemList
);
2276 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2278 if (FileSystemList
->CurrentFileSystem
== FsKeep
)
2280 return CHECK_FILE_SYSTEM_PAGE
;
2284 return FORMAT_PARTITION_PAGE
;
2289 return SELECT_FILE_SYSTEM_PAGE
;
2294 FormatPartitionPage (PINPUT_RECORD Ir
)
2296 WCHAR PathBuffer
[MAX_PATH
];
2297 PDISKENTRY DiskEntry
;
2298 PPARTENTRY PartEntry
;
2308 SetTextXY(6, 8, "Format partition");
2310 SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue.");
2312 SetStatusText(" ENTER = Continue F3 = Quit");
2315 if (PartitionList
== NULL
||
2316 PartitionList
->CurrentDisk
== NULL
||
2317 PartitionList
->CurrentPartition
== NULL
)
2319 /* FIXME: show an error dialog */
2323 DiskEntry
= PartitionList
->CurrentDisk
;
2324 PartEntry
= PartitionList
->CurrentPartition
;
2330 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2331 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2333 if (ConfirmQuit (Ir
) == TRUE
)
2339 else if (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_RETURN
) /* ENTER */
2341 SetStatusText (" Please wait ...");
2343 if (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_ENTRY_UNUSED
)
2345 switch (FileSystemList
->CurrentFileSystem
)
2348 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (4200ULL * 1024ULL))
2350 /* FAT12 CHS partition (disk is smaller than 4.1MB) */
2351 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_12
;
2353 else if (PartEntry
->PartInfo
[0].StartingOffset
.QuadPart
< (1024ULL * 255ULL * 63ULL * 512ULL))
2355 /* Partition starts below the 8.4GB boundary ==> CHS partition */
2357 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (32ULL * 1024ULL * 1024ULL))
2359 /* FAT16 CHS partition (partiton size < 32MB) */
2360 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT_16
;
2362 else if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2364 /* FAT16 CHS partition (partition size < 512MB) */
2365 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_HUGE
;
2369 /* FAT32 CHS partition (partition size >= 512MB) */
2370 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32
;
2375 /* Partition starts above the 8.4GB boundary ==> LBA partition */
2377 if (PartEntry
->PartInfo
[0].PartitionLength
.QuadPart
< (512ULL * 1024ULL * 1024ULL))
2379 /* FAT16 LBA partition (partition size < 512MB) */
2380 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_XINT13
;
2384 /* FAT32 LBA partition (partition size >= 512MB) */
2385 PartEntry
->PartInfo
[0].PartitionType
= PARTITION_FAT32_XINT13
;
2398 CheckActiveBootPartition (PartitionList
);
2402 "Disk: %I64u Cylinder: %I64u Track: %I64u",
2403 DiskEntry
->DiskSize
,
2404 DiskEntry
->CylinderSize
,
2405 DiskEntry
->TrackSize
);
2408 DiskEntry
= PartitionList
->CurrentDisk
;
2409 Entry
= DiskEntry
->PartListHead
.Flink
;
2410 while (Entry
!= &DiskEntry
->PartListHead
)
2412 PartEntry
= CONTAINING_RECORD(Entry
, PARTENTRY
, ListEntry
);
2414 if (PartEntry
->Unpartitioned
== FALSE
)
2417 for (i
= 0; i
< 4; i
++)
2419 PrintTextXY (6, Line
,
2420 "%2u: %2u %c %12I64u %12I64u %2u %c",
2422 PartEntry
->PartInfo
[i
].PartitionNumber
,
2423 PartEntry
->PartInfo
[i
].BootIndicator
? 'A' : '-',
2424 PartEntry
->PartInfo
[i
].StartingOffset
.QuadPart
,
2425 PartEntry
->PartInfo
[i
].PartitionLength
.QuadPart
,
2426 PartEntry
->PartInfo
[i
].PartitionType
,
2427 PartEntry
->PartInfo
[i
].RewritePartition
? '*' : ' ');
2435 Entry
= Entry
->Flink
;
2438 /* Restore the old entry */
2439 PartEntry
= PartitionList
->CurrentPartition
;
2442 if (WritePartitionsToDisk (PartitionList
) == FALSE
)
2444 DPRINT ("WritePartitionsToDisk() failed\n");
2446 PopupError ("Setup failed to write partition tables.\n",
2447 "ENTER = Reboot computer");
2453 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2460 /* Set DestinationRootPath */
2461 RtlFreeUnicodeString (&DestinationRootPath
);
2462 swprintf (PathBuffer
,
2463 L
"\\Device\\Harddisk%lu\\Partition%lu",
2464 PartitionList
->CurrentDisk
->DiskNumber
,
2465 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2466 RtlCreateUnicodeString (&DestinationRootPath
,
2468 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2471 /* Set SystemRootPath */
2472 RtlFreeUnicodeString (&SystemRootPath
);
2473 swprintf (PathBuffer
,
2474 L
"\\Device\\Harddisk%lu\\Partition%lu",
2475 PartitionList
->ActiveBootDisk
->DiskNumber
,
2476 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2477 RtlCreateUnicodeString (&SystemRootPath
,
2479 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2482 switch (FileSystemList
->CurrentFileSystem
)
2485 Status
= FormatPartition (&DestinationRootPath
);
2486 if (!NT_SUCCESS (Status
))
2488 DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status
);
2489 /* FIXME: show an error dialog */
2493 PartEntry
->New
= FALSE
;
2494 if (FileSystemList
!= NULL
)
2496 DestroyFileSystemList (FileSystemList
);
2497 FileSystemList
= NULL
;
2500 CheckActiveBootPartition (PartitionList
);
2502 /* FIXME: Install boot code. This is a hack! */
2503 if ((PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32_XINT13
) ||
2504 (PartEntry
->PartInfo
[0].PartitionType
== PARTITION_FAT32
))
2506 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2507 wcscat (PathBuffer
, L
"\\loader\\fat32.bin");
2509 DPRINT ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer
,
2510 DestinationRootPath
.Buffer
);
2511 Status
= InstallFat32BootCodeToDisk (PathBuffer
,
2512 DestinationRootPath
.Buffer
);
2513 if (!NT_SUCCESS (Status
))
2515 DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2516 /* FIXME: show an error dialog */
2522 wcscpy (PathBuffer
, SourceRootPath
.Buffer
);
2523 wcscat (PathBuffer
, L
"\\loader\\fat.bin");
2525 DPRINT ("Install FAT bootcode: %S ==> %S\n", PathBuffer
,
2526 DestinationRootPath
.Buffer
);
2527 Status
= InstallFat16BootCodeToDisk (PathBuffer
,
2528 DestinationRootPath
.Buffer
);
2529 if (!NT_SUCCESS (Status
))
2531 DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status
);
2532 /* FIXME: show an error dialog */
2546 SetStatusText (" Done. Press any key ...");
2550 return INSTALL_DIRECTORY_PAGE
;
2554 return FORMAT_PARTITION_PAGE
;
2559 CheckFileSystemPage(PINPUT_RECORD Ir
)
2561 WCHAR PathBuffer
[MAX_PATH
];
2563 SetTextXY(6, 8, "Check file system");
2565 SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
2567 SetStatusText(" Please wait ...");
2570 SetStatusText(" ENTER = Continue F3 = Quit");
2573 /* Set DestinationRootPath */
2574 RtlFreeUnicodeString (&DestinationRootPath
);
2575 swprintf (PathBuffer
,
2576 L
"\\Device\\Harddisk%lu\\Partition%lu",
2577 PartitionList
->CurrentDisk
->DiskNumber
,
2578 PartitionList
->CurrentPartition
->PartInfo
[0].PartitionNumber
);
2579 RtlCreateUnicodeString (&DestinationRootPath
,
2581 DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath
);
2583 /* Set SystemRootPath */
2584 RtlFreeUnicodeString (&SystemRootPath
);
2585 swprintf (PathBuffer
,
2586 L
"\\Device\\Harddisk%lu\\Partition%lu",
2587 PartitionList
->ActiveBootDisk
->DiskNumber
,
2588 PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionNumber
);
2589 RtlCreateUnicodeString (&SystemRootPath
,
2591 DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath
);
2594 if (IsUnattendedSetup
)
2596 return(INSTALL_DIRECTORY_PAGE
);
2603 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2604 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2606 if (ConfirmQuit(Ir
) == TRUE
)
2610 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2612 return(INSTALL_DIRECTORY_PAGE
);
2616 return(CHECK_FILE_SYSTEM_PAGE
);
2621 InstallDirectoryPage1(PWCHAR InstallDir
, PDISKENTRY DiskEntry
, PPARTENTRY PartEntry
)
2623 WCHAR PathBuffer
[MAX_PATH
];
2625 /* Create 'InstallPath' string */
2626 RtlFreeUnicodeString(&InstallPath
);
2627 RtlCreateUnicodeString(&InstallPath
,
2630 /* Create 'DestinationPath' string */
2631 RtlFreeUnicodeString(&DestinationPath
);
2633 DestinationRootPath
.Buffer
);
2634 if (InstallDir
[0] != L
'\\')
2637 wcscat(PathBuffer
, InstallDir
);
2638 RtlCreateUnicodeString(&DestinationPath
,
2641 /* Create 'DestinationArcPath' */
2642 RtlFreeUnicodeString(&DestinationArcPath
);
2643 swprintf(PathBuffer
,
2644 L
"multi(0)disk(0)rdisk(%lu)partition(%lu)",
2645 DiskEntry
->DiskNumber
,
2646 PartEntry
->PartInfo
[0].PartitionNumber
);
2647 if (InstallDir
[0] != L
'\\')
2650 wcscat(PathBuffer
, InstallDir
);
2651 RtlCreateUnicodeString(&DestinationArcPath
,
2654 return(PREPARE_COPY_PAGE
);
2659 InstallDirectoryPage(PINPUT_RECORD Ir
)
2661 PDISKENTRY DiskEntry
;
2662 PPARTENTRY PartEntry
;
2663 WCHAR InstallDir
[51];
2668 if (PartitionList
== NULL
||
2669 PartitionList
->CurrentDisk
== NULL
||
2670 PartitionList
->CurrentPartition
== NULL
)
2672 /* FIXME: show an error dialog */
2676 DiskEntry
= PartitionList
->CurrentDisk
;
2677 PartEntry
= PartitionList
->CurrentPartition
;
2679 /* Search for 'DefaultPath' in the 'SetupData' section */
2680 if (!InfFindFirstLine (SetupInf
, L
"SetupData", L
"DefaultPath", &Context
))
2682 PopupError("Setup failed to find the 'SetupData' section\n"
2683 "in TXTSETUP.SIF.\n",
2684 "ENTER = Reboot computer");
2690 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2697 /* Read the 'DefaultPath' data */
2698 if (InfGetData (&Context
, NULL
, &DefaultPath
))
2700 wcscpy(InstallDir
, DefaultPath
);
2704 wcscpy(InstallDir
, L
"\\ReactOS");
2706 Length
= wcslen(InstallDir
);
2708 SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
2709 SetTextXY(6, 9, "directory where you want ReactOS to be installed:");
2711 SetInputTextXY(8, 11, 51, InstallDir
);
2713 SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete");
2714 SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to");
2715 SetTextXY(6, 16, "be installed.");
2717 SetStatusText(" ENTER = Continue F3 = Quit");
2719 if (IsUnattendedSetup
)
2721 return(InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2728 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
2729 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
2731 if (ConfirmQuit(Ir
) == TRUE
)
2735 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2737 return (InstallDirectoryPage1 (InstallDir
, DiskEntry
, PartEntry
));
2739 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x08) /* BACKSPACE */
2744 InstallDir
[Length
] = 0;
2745 SetInputTextXY(8, 11, 51, InstallDir
);
2748 else if (isprint(Ir
->Event
.KeyEvent
.uChar
.AsciiChar
))
2752 InstallDir
[Length
] = (WCHAR
)Ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
2754 InstallDir
[Length
] = 0;
2755 SetInputTextXY(8, 11, 51, InstallDir
);
2760 return(INSTALL_DIRECTORY_PAGE
);
2765 AddSectionToCopyQueue(HINF InfFile
,
2767 PWCHAR SourceCabinet
,
2770 INFCONTEXT FilesContext
;
2771 INFCONTEXT DirContext
;
2773 PWCHAR FileKeyValue
;
2775 PWCHAR TargetFileName
;
2777 /* Search for the SectionName section */
2778 if (!InfFindFirstLine (InfFile
, SectionName
, NULL
, &FilesContext
))
2781 sprintf(Buffer
, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName
);
2782 PopupError(Buffer
, "ENTER = Reboot computer");
2788 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2796 * Enumerate the files in the section
2797 * and add them to the file queue.
2801 /* Get source file name and target directory id */
2802 if (!InfGetData (&FilesContext
, &FileKeyName
, &FileKeyValue
))
2804 /* FIXME: Handle error! */
2805 DPRINT1("InfGetData() failed\n");
2809 /* Get optional target file name */
2810 if (!InfGetDataField (&FilesContext
, 2, &TargetFileName
))
2811 TargetFileName
= NULL
;
2813 DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName
, FileKeyValue
);
2815 /* Lookup target directory */
2816 if (!InfFindFirstLine (InfFile
, L
"Directories", FileKeyValue
, &DirContext
))
2818 /* FIXME: Handle error! */
2819 DPRINT1("InfFindFirstLine() failed\n");
2823 if (!InfGetData (&DirContext
, NULL
, &DirKeyValue
))
2825 /* FIXME: Handle error! */
2826 DPRINT1("InfGetData() failed\n");
2830 if (!SetupQueueCopy(SetupFileQueue
,
2832 SourceRootPath
.Buffer
,
2838 /* FIXME: Handle error! */
2839 DPRINT1("SetupQueueCopy() failed\n");
2842 while (InfFindNextLine(&FilesContext
, &FilesContext
));
2848 PrepareCopyPageInfFile(HINF InfFile
,
2849 PWCHAR SourceCabinet
,
2852 WCHAR PathBuffer
[MAX_PATH
];
2853 INFCONTEXT DirContext
;
2854 PWCHAR AdditionalSectionName
;
2859 /* Add common files */
2860 if (!AddSectionToCopyQueue(InfFile
, L
"SourceFiles", SourceCabinet
, Ir
))
2863 /* Add specific files depending of computer type */
2864 if (SourceCabinet
== NULL
)
2866 if (!ProcessComputerFiles(InfFile
, ComputerList
, &AdditionalSectionName
))
2868 if (AdditionalSectionName
)
2870 if (!AddSectionToCopyQueue(InfFile
, AdditionalSectionName
, SourceCabinet
, Ir
))
2875 /* Create directories */
2879 * Install directories like '\reactos\test' are not handled yet.
2882 /* Get destination path */
2883 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2885 /* Remove trailing backslash */
2886 Length
= wcslen(PathBuffer
);
2887 if ((Length
> 0) && (PathBuffer
[Length
- 1] == '\\'))
2889 PathBuffer
[Length
- 1] = 0;
2892 /* Create the install directory */
2893 Status
= CreateDirectory(PathBuffer
);
2894 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2896 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2897 PopupError("Setup could not create the install directory.",
2898 "ENTER = Reboot computer");
2904 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2912 /* Search for the 'Directories' section */
2913 if (!InfFindFirstLine(InfFile
, L
"Directories", NULL
, &DirContext
))
2917 PopupError("Setup failed to find the 'Directories' section\n"
2918 "in the cabinet.\n", "ENTER = Reboot computer");
2922 PopupError("Setup failed to find the 'Directories' section\n"
2923 "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
2930 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2937 /* Enumerate the directory values and create the subdirectories */
2940 if (!InfGetData (&DirContext
, NULL
, &KeyValue
))
2946 if (KeyValue
[0] == L
'\\' && KeyValue
[1] != 0)
2948 DPRINT("Absolute Path: '%S'\n", KeyValue
);
2950 wcscpy(PathBuffer
, DestinationRootPath
.Buffer
);
2951 wcscat(PathBuffer
, KeyValue
);
2953 DPRINT("FullPath: '%S'\n", PathBuffer
);
2955 else if (KeyValue
[0] != L
'\\')
2957 DPRINT("RelativePath: '%S'\n", KeyValue
);
2958 wcscpy(PathBuffer
, DestinationPath
.Buffer
);
2959 wcscat(PathBuffer
, L
"\\");
2960 wcscat(PathBuffer
, KeyValue
);
2962 DPRINT("FullPath: '%S'\n", PathBuffer
);
2964 Status
= CreateDirectory(PathBuffer
);
2965 if (!NT_SUCCESS(Status
) && Status
!= STATUS_OBJECT_NAME_COLLISION
)
2967 DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer
, Status
);
2968 PopupError("Setup could not create install directories.",
2969 "ENTER = Reboot computer");
2975 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
2983 while (InfFindNextLine (&DirContext
, &DirContext
));
2990 PrepareCopyPage(PINPUT_RECORD Ir
)
2993 WCHAR PathBuffer
[MAX_PATH
];
2994 INFCONTEXT CabinetsContext
;
3001 SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
3003 SetStatusText(" Building the file copy list...");
3005 /* Create the file queue */
3006 SetupFileQueue
= SetupOpenFileQueue();
3007 if (SetupFileQueue
== NULL
)
3009 PopupError("Setup failed to open the copy file queue.\n",
3010 "ENTER = Reboot computer");
3016 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3023 if (!PrepareCopyPageInfFile(SetupInf
, NULL
, Ir
))
3028 /* Search for the 'Cabinets' section */
3029 if (!InfFindFirstLine (SetupInf
, L
"Cabinets", NULL
, &CabinetsContext
))
3031 return FILE_COPY_PAGE
;
3035 * Enumerate the directory values in the 'Cabinets'
3036 * section and parse their inf files.
3040 if (!InfGetData (&CabinetsContext
, NULL
, &KeyValue
))
3043 wcscpy(PathBuffer
, SourcePath
.Buffer
);
3044 wcscat(PathBuffer
, L
"\\");
3045 wcscat(PathBuffer
, KeyValue
);
3047 CabinetInitialize();
3048 CabinetSetEventHandlers(NULL
, NULL
, NULL
);
3049 CabinetSetCabinetName(PathBuffer
);
3051 if (CabinetOpen() == CAB_STATUS_SUCCESS
)
3053 DPRINT("Cabinet %S\n", CabinetGetCabinetName());
3055 InfFileData
= CabinetGetCabinetReservedArea(&InfFileSize
);
3056 if (InfFileData
== NULL
)
3058 PopupError("Cabinet has no setup script.\n",
3059 "ENTER = Reboot computer");
3065 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3074 DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
3076 PopupError("Cabinet not found.\n",
3077 "ENTER = Reboot computer");
3083 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3090 Status
= InfOpenBufferedFile(&InfHandle
,
3094 if (!NT_SUCCESS(Status
))
3096 PopupError("Cabinet has no valid inf file.\n",
3097 "ENTER = Reboot computer");
3103 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3112 if (!PrepareCopyPageInfFile(InfHandle
, KeyValue
, Ir
))
3117 while (InfFindNextLine (&CabinetsContext
, &CabinetsContext
));
3119 return FILE_COPY_PAGE
;
3124 FileCopyCallback(PVOID Context
,
3129 PCOPYCONTEXT CopyContext
;
3131 CopyContext
= (PCOPYCONTEXT
)Context
;
3133 switch (Notification
)
3135 case SPFILENOTIFY_STARTSUBQUEUE
:
3136 CopyContext
->TotalOperations
= (ULONG
)Param2
;
3137 ProgressSetStepCount(CopyContext
->ProgressBar
,
3138 CopyContext
->TotalOperations
);
3141 case SPFILENOTIFY_STARTCOPY
:
3142 /* Display copy message */
3143 PrintTextXYN(6, 16, 60, "Copying file: %S", (PWSTR
)Param1
);
3145 PrintTextXYN(6, 18, 60, "File %lu of %lu",
3146 CopyContext
->CompletedOperations
+ 1,
3147 CopyContext
->TotalOperations
);
3150 case SPFILENOTIFY_ENDCOPY
:
3151 CopyContext
->CompletedOperations
++;
3152 ProgressNextStep(CopyContext
->ProgressBar
);
3161 FileCopyPage(PINPUT_RECORD Ir
)
3163 COPYCONTEXT CopyContext
;
3167 SetStatusText(" Please wait...");
3169 SetTextXY(6, 8, "Copying files");
3171 GetScreenSize(&xScreen
, &yScreen
);
3173 CopyContext
.TotalOperations
= 0;
3174 CopyContext
.CompletedOperations
= 0;
3175 CopyContext
.ProgressBar
= CreateProgressBar(6,
3180 SetupCommitFileQueue(SetupFileQueue
,
3181 DestinationRootPath
.Buffer
,
3183 (PSP_FILE_CALLBACK
)FileCopyCallback
,
3186 SetupCloseFileQueue(SetupFileQueue
);
3188 DestroyProgressBar(CopyContext
.ProgressBar
);
3190 return REGISTRY_PAGE
;
3195 RegistryPage(PINPUT_RECORD Ir
)
3197 INFCONTEXT InfContext
;
3204 SetTextXY(6, 8, "Setup is updating the system configuration");
3206 SetStatusText(" Creating registry hives...");
3208 if (!SetInstallPathValue(&DestinationPath
))
3210 DPRINT("SetInstallPathValue() failed\n");
3211 PopupError("Setup failed to set the initialize the registry.",
3212 "ENTER = Reboot computer");
3218 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3225 /* Create the default hives */
3226 Status
= NtInitializeRegistry(TRUE
);
3227 if (!NT_SUCCESS(Status
))
3229 DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status
);
3230 PopupError("Setup failed to create the registry hives.",
3231 "ENTER = Reboot computer");
3237 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3244 /* Update registry */
3245 SetStatusText(" Updating registry hives...");
3247 if (!InfFindFirstLine(SetupInf
, L
"HiveInfs.Install", NULL
, &InfContext
))
3249 DPRINT1("InfFindFirstLine() failed\n");
3250 PopupError("Setup failed to find the registry data files.",
3251 "ENTER = Reboot computer");
3257 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3266 InfGetDataField (&InfContext
, 0, &Action
);
3267 InfGetDataField (&InfContext
, 1, &File
);
3268 InfGetDataField (&InfContext
, 2, &Section
);
3270 DPRINT("Action: %S File: %S Section %S\n", Action
, File
, Section
);
3272 if (!_wcsicmp (Action
, L
"AddReg"))
3276 else if (!_wcsicmp (Action
, L
"DelReg"))
3285 SetStatusText(" Importing %S...", File
);
3287 if (!ImportRegistryFile(File
, Section
, Delete
))
3289 DPRINT("Importing %S failed\n", File
);
3291 PopupError("Setup failed to import a hive file.",
3292 "ENTER = Reboot computer");
3298 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3305 while (InfFindNextLine (&InfContext
, &InfContext
));
3307 /* Update display registry settings */
3308 SetStatusText(" Updating display registry settings...");
3309 if (!ProcessDisplayRegistry(SetupInf
, DisplayList
))
3311 PopupError("Setup failed to update display registry settings.",
3312 "ENTER = Reboot computer");
3318 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3325 /* Update keyboard layout settings */
3326 SetStatusText(" Updating keyboard layout settings...");
3327 if (!ProcessKeyboardLayoutRegistry(LayoutList
))
3329 PopupError("Setup failed to update keyboard layout settings.",
3330 "ENTER = Reboot computer");
3336 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3343 /* Update mouse registry settings */
3344 SetStatusText(" Updating mouse registry settings...");
3345 if (!ProcessMouseRegistry(SetupInf
, PointerList
))
3347 PopupError("Setup failed to update mouse registry settings.",
3348 "ENTER = Reboot computer");
3354 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3361 SetStatusText(" Done...");
3363 return BOOT_LOADER_PAGE
;
3368 BootLoaderPage(PINPUT_RECORD Ir
)
3370 UCHAR PartitionType
;
3371 BOOLEAN InstallOnFloppy
;
3374 SetStatusText(" Please wait...");
3376 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3378 if (PartitionType
== PARTITION_ENTRY_UNUSED
)
3380 DPRINT("Error: active partition invalid (unused)\n");
3381 InstallOnFloppy
= TRUE
;
3383 else if (PartitionType
== 0x0A)
3385 /* OS/2 boot manager partition */
3386 DPRINT("Found OS/2 boot manager partition\n");
3387 InstallOnFloppy
= TRUE
;
3389 else if (PartitionType
== 0x83)
3391 /* Linux ext2 partition */
3392 DPRINT("Found Linux ext2 partition\n");
3393 InstallOnFloppy
= TRUE
;
3395 else if (PartitionType
== PARTITION_IFS
)
3397 /* NTFS partition */
3398 DPRINT("Found NTFS partition\n");
3399 InstallOnFloppy
= TRUE
;
3401 else if ((PartitionType
== PARTITION_FAT_12
) ||
3402 (PartitionType
== PARTITION_FAT_16
) ||
3403 (PartitionType
== PARTITION_HUGE
) ||
3404 (PartitionType
== PARTITION_XINT13
) ||
3405 (PartitionType
== PARTITION_FAT32
) ||
3406 (PartitionType
== PARTITION_FAT32_XINT13
))
3408 DPRINT("Found FAT partition\n");
3409 InstallOnFloppy
= FALSE
;
3413 /* Unknown partition */
3414 DPRINT("Unknown partition found\n");
3415 InstallOnFloppy
= TRUE
;
3418 if (InstallOnFloppy
== TRUE
)
3420 return BOOT_LOADER_FLOPPY_PAGE
;
3423 SetTextXY(6, 8, "Setup is installing the boot loader");
3425 SetTextXY(8, 12, "Install bootloader on the harddisk (MBR).");
3426 SetTextXY(8, 13, "Install bootloader on a floppy disk.");
3427 InvertTextXY (8, Line
, 48, 1);
3429 SetStatusText(" ENTER = Continue F3 = Quit");
3435 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3436 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_DOWN
)) /* DOWN */
3438 NormalTextXY (8, Line
, 48, 1);
3441 else if (Line
== 13)
3447 InvertTextXY (8, Line
, 48, 1);
3449 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3450 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_UP
)) /* UP */
3452 NormalTextXY (8, Line
, 48, 1);
3455 else if (Line
== 13)
3461 InvertTextXY (8, Line
, 48, 1);
3463 else if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3464 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3466 if (ConfirmQuit(Ir
) == TRUE
)
3470 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3474 return BOOT_LOADER_HARDDISK_PAGE
;
3476 else if (Line
== 13)
3478 return BOOT_LOADER_FLOPPY_PAGE
;
3481 return BOOT_LOADER_PAGE
;
3486 return BOOT_LOADER_PAGE
;
3491 BootLoaderFloppyPage(PINPUT_RECORD Ir
)
3495 SetTextXY(6, 8, "Setup cannot install the bootloader on your computers");
3496 SetTextXY(6, 9, "harddisk");
3498 SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and");
3499 SetTextXY(6, 14, "press ENTER.");
3502 SetStatusText(" ENTER = Continue F3 = Quit");
3503 // SetStatusText(" Please wait...");
3509 if ((Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x00) &&
3510 (Ir
->Event
.KeyEvent
.wVirtualKeyCode
== VK_F3
)) /* F3 */
3512 if (ConfirmQuit(Ir
) == TRUE
)
3516 else if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3518 if (DoesFileExist(L
"\\Device\\Floppy0", L
"\\") == FALSE
)
3520 PopupError("No disk in drive A:.",
3521 "ENTER = Continue");
3526 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3530 return BOOT_LOADER_FLOPPY_PAGE
;
3533 Status
= InstallFatBootcodeToFloppy(&SourceRootPath
,
3534 &DestinationArcPath
);
3535 if (!NT_SUCCESS(Status
))
3537 /* Print error message */
3538 return BOOT_LOADER_FLOPPY_PAGE
;
3541 return SUCCESS_PAGE
;
3545 return BOOT_LOADER_FLOPPY_PAGE
;
3550 BootLoaderHarddiskPage(PINPUT_RECORD Ir
)
3552 UCHAR PartitionType
;
3555 PartitionType
= PartitionList
->ActiveBootPartition
->PartInfo
[0].PartitionType
;
3556 if ((PartitionType
== PARTITION_FAT_12
) ||
3557 (PartitionType
== PARTITION_FAT_16
) ||
3558 (PartitionType
== PARTITION_HUGE
) ||
3559 (PartitionType
== PARTITION_XINT13
) ||
3560 (PartitionType
== PARTITION_FAT32
) ||
3561 (PartitionType
== PARTITION_FAT32_XINT13
))
3563 Status
= InstallFatBootcodeToPartition(&SystemRootPath
,
3565 &DestinationArcPath
,
3567 if (!NT_SUCCESS(Status
))
3569 PopupError("Setup failed to install the FAT bootcode on the system partition.",
3570 "ENTER = Reboot computer");
3576 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3583 return SUCCESS_PAGE
;
3587 PopupError("failed to install FAT bootcode on the system partition.",
3588 "ENTER = Reboot computer");
3594 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3601 return BOOT_LOADER_HARDDISK_PAGE
;
3606 QuitPage(PINPUT_RECORD Ir
)
3608 SetTextXY(10, 6, "ReactOS is not completely installed");
3610 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3611 SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
3613 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3615 SetStatusText(" Please wait ...");
3617 /* Destroy partition list */
3618 if (PartitionList
!= NULL
)
3620 DestroyPartitionList (PartitionList
);
3621 PartitionList
= NULL
;
3624 /* Destroy filesystem list */
3625 if (FileSystemList
!= NULL
)
3627 DestroyFileSystemList (FileSystemList
);
3628 FileSystemList
= NULL
;
3631 /* Destroy computer settings list */
3632 if (ComputerList
!= NULL
)
3634 DestroyGenericList(ComputerList
, TRUE
);
3635 ComputerList
= NULL
;
3638 /* Destroy display settings list */
3639 if (DisplayList
!= NULL
)
3641 DestroyGenericList(DisplayList
, TRUE
);
3645 /* Destroy keyboard settings list */
3646 if (KeyboardList
!= NULL
)
3648 DestroyGenericList(KeyboardList
, TRUE
);
3649 KeyboardList
= NULL
;
3652 /* Destroy keyboard layout list */
3653 if (LayoutList
!= NULL
)
3655 DestroyGenericList(LayoutList
, TRUE
);
3659 /* Destroy pointer device list */
3660 if (PointerList
!= NULL
)
3662 DestroyGenericList(PointerList
, TRUE
);
3666 SetStatusText(" ENTER = Reboot computer");
3672 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3681 SuccessPage(PINPUT_RECORD Ir
)
3683 SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully.");
3685 SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
3686 SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
3688 SetTextXY(10, 11, "Press ENTER to reboot your computer.");
3690 SetStatusText(" ENTER = Reboot computer");
3692 if (IsUnattendedSetup
)
3701 if (Ir
->Event
.KeyEvent
.uChar
.AsciiChar
== 0x0D) /* ENTER */
3710 FlushPage(PINPUT_RECORD Ir
)
3712 SetTextXY(10, 6, "The system is now making sure all data is stored on your disk");
3714 SetTextXY(10, 8, "This may take a minute");
3715 SetTextXY(10, 9, "When finished, your computer will reboot automatically");
3717 SetStatusText(" Flushing cache");
3727 OBJECT_ATTRIBUTES ObjectAttributes
;
3728 UNICODE_STRING UnicodeString
;
3729 HANDLE ReactOSInitEvent
;
3731 RtlRosInitUnicodeStringFromLiteral(&UnicodeString
, L
"\\ReactOSInitDone");
3732 InitializeObjectAttributes(&ObjectAttributes
,
3737 Status
= NtOpenEvent(&ReactOSInitEvent
,
3740 if (NT_SUCCESS(Status
))
3742 LARGE_INTEGER Timeout
;
3743 /* This will cause the boot screen image to go away (if displayed) */
3744 NtPulseEvent(ReactOSInitEvent
, NULL
);
3746 /* Wait for the display mode to be changed (if in graphics mode) */
3747 Timeout
.QuadPart
= -50000000LL; /* 5 second timeout */
3748 NtWaitForSingleObject(ReactOSInitEvent
, FALSE
, &Timeout
);
3750 NtClose(ReactOSInitEvent
);
3754 /* We don't really care if this fails */
3755 DPRINT1("USETUP: Failed to open ReactOS init notification event\n");
3761 NtProcessStartup(PPEB Peb
)
3767 RtlNormalizeProcessParams(Peb
->ProcessParameters
);
3769 ProcessHeap
= Peb
->ProcessHeap
;
3773 Status
= AllocConsole();
3774 if (!NT_SUCCESS(Status
))
3776 PrintString("AllocConsole() failed (Status = 0x%08lx)\n", Status
);
3778 /* Raise a hard error (crash the system/BSOD) */
3779 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
3784 /* Initialize global unicode strings */
3785 RtlInitUnicodeString(&SourcePath
, NULL
);
3786 RtlInitUnicodeString(&SourceRootPath
, NULL
);
3787 RtlInitUnicodeString(&InstallPath
, NULL
);
3788 RtlInitUnicodeString(&DestinationPath
, NULL
);
3789 RtlInitUnicodeString(&DestinationArcPath
, NULL
);
3790 RtlInitUnicodeString(&DestinationRootPath
, NULL
);
3791 RtlInitUnicodeString(&SystemRootPath
, NULL
);
3793 /* Hide the cursor */
3794 SetCursorType(TRUE
, FALSE
);
3797 while (Page
!= REBOOT_PAGE
)
3801 SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
3807 Page
= StartPage(&Ir
);
3812 Page
= LicensePage(&Ir
);
3817 Page
= IntroPage(&Ir
);
3821 case INSTALL_INTRO_PAGE
:
3822 Page
= InstallIntroPage(&Ir
);
3826 case SCSI_CONTROLLER_PAGE
:
3827 Page
= ScsiControllerPage(&Ir
);
3832 case OEM_DRIVER_PAGE
:
3833 Page
= OemDriverPage(&Ir
);
3837 case DEVICE_SETTINGS_PAGE
:
3838 Page
= DeviceSettingsPage(&Ir
);
3841 case COMPUTER_SETTINGS_PAGE
:
3842 Page
= ComputerSettingsPage(&Ir
);
3845 case DISPLAY_SETTINGS_PAGE
:
3846 Page
= DisplaySettingsPage(&Ir
);
3849 case KEYBOARD_SETTINGS_PAGE
:
3850 Page
= KeyboardSettingsPage(&Ir
);
3853 case LAYOUT_SETTINGS_PAGE
:
3854 Page
= LayoutSettingsPage(&Ir
);
3857 case POINTER_SETTINGS_PAGE
:
3858 Page
= PointerSettingsPage(&Ir
);
3861 case SELECT_PARTITION_PAGE
:
3862 Page
= SelectPartitionPage(&Ir
);
3865 case CREATE_PARTITION_PAGE
:
3866 Page
= CreatePartitionPage(&Ir
);
3869 case DELETE_PARTITION_PAGE
:
3870 Page
= DeletePartitionPage(&Ir
);
3873 case SELECT_FILE_SYSTEM_PAGE
:
3874 Page
= SelectFileSystemPage(&Ir
);
3877 case FORMAT_PARTITION_PAGE
:
3878 Page
= FormatPartitionPage(&Ir
);
3881 case CHECK_FILE_SYSTEM_PAGE
:
3882 Page
= CheckFileSystemPage(&Ir
);
3885 case INSTALL_DIRECTORY_PAGE
:
3886 Page
= InstallDirectoryPage(&Ir
);
3889 case PREPARE_COPY_PAGE
:
3890 Page
= PrepareCopyPage(&Ir
);
3893 case FILE_COPY_PAGE
:
3894 Page
= FileCopyPage(&Ir
);
3898 Page
= RegistryPage(&Ir
);
3901 case BOOT_LOADER_PAGE
:
3902 Page
= BootLoaderPage(&Ir
);
3905 case BOOT_LOADER_FLOPPY_PAGE
:
3906 Page
= BootLoaderFloppyPage(&Ir
);
3909 case BOOT_LOADER_HARDDISK_PAGE
:
3910 Page
= BootLoaderHarddiskPage(&Ir
);
3915 case REPAIR_INTRO_PAGE
:
3916 Page
= RepairIntroPage(&Ir
);
3920 /* Emergency pages */
3921 case EMERGENCY_INTRO_PAGE
:
3922 Page
= EmergencyIntroPage(&Ir
);
3927 Page
= SuccessPage(&Ir
);
3931 Page
= FlushPage(&Ir
);
3935 Page
= QuitPage(&Ir
);
3945 NtShutdownSystem(ShutdownReboot
);