2002-09-19 16:21:15 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
2004-02-23 11:58:27 +00:00
|
|
|
* Copyright (C) 2002, 2003, 2004 ReactOS Team
|
2002-09-08 18:29:56 +00:00
|
|
|
*
|
2002-09-19 16:21:15 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2002-09-08 18:29:56 +00:00
|
|
|
*
|
2002-09-19 16:21:15 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-09-08 18:29:56 +00:00
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-09-19 16:21:15 +00:00
|
|
|
*/
|
2002-10-29 18:40:02 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS text-mode setup
|
2018-05-15 17:47:52 +00:00
|
|
|
* FILE: base/setup/usetup/usetup.c
|
2002-10-29 18:40:02 +00:00
|
|
|
* PURPOSE: Text-mode setup
|
2018-01-07 00:35:48 +00:00
|
|
|
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
2019-02-24 16:52:33 +00:00
|
|
|
* Hervé Poussineau (hpoussin@reactos.org)
|
2002-09-08 18:29:56 +00:00
|
|
|
*/
|
2002-09-19 16:21:15 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <usetup.h>
|
2018-05-19 10:09:12 +00:00
|
|
|
#include <math.h>
|
2019-04-28 19:03:35 +00:00
|
|
|
#include <ntstrsafe.h>
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2014-01-13 13:01:38 +00:00
|
|
|
#include "bootsup.h"
|
|
|
|
#include "chkdsk.h"
|
2014-12-20 21:58:22 +00:00
|
|
|
#include "cmdcons.h"
|
2018-12-23 19:28:19 +00:00
|
|
|
#include "devinst.h"
|
2014-01-13 13:01:38 +00:00
|
|
|
#include "format.h"
|
|
|
|
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
2002-09-19 16:21:15 +00:00
|
|
|
|
2010-05-24 20:53:32 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
/* GLOBALS & LOCALS *********************************************************/
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2002-09-08 18:29:56 +00:00
|
|
|
HANDLE ProcessHeap;
|
2006-09-13 12:33:59 +00:00
|
|
|
BOOLEAN IsUnattendedSetup = FALSE;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
static USETUP_DATA USetupData;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2019-08-24 23:32:46 +00:00
|
|
|
/* The partition where to perform the installation */
|
2019-03-05 00:42:33 +00:00
|
|
|
static PPARTENTRY InstallPartition = NULL;
|
2019-08-24 23:32:46 +00:00
|
|
|
/*
|
|
|
|
* The system partition we will actually use. It can be different from
|
|
|
|
* PartitionList->SystemPartition in case we don't support it, or we install
|
|
|
|
* on a removable disk.
|
|
|
|
* We may indeed not support the original system partition in case we do not
|
|
|
|
* have write support on it. Please note that this situation is partly a HACK
|
|
|
|
* and MUST NEVER happen on architectures where real system partitions are
|
|
|
|
* mandatory (because then they are formatted in FAT FS and we support write
|
|
|
|
* operation on them).
|
|
|
|
*/
|
|
|
|
static PPARTENTRY SystemPartition = NULL;
|
2014-04-09 21:49:30 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
|
|
|
|
/* OTHER Stuff *****/
|
|
|
|
|
2017-12-29 18:09:56 +00:00
|
|
|
PCWSTR SelectedLanguageId;
|
2017-08-09 20:39:45 +00:00
|
|
|
static WCHAR DefaultLanguage[20]; // Copy of string inside LanguageList
|
|
|
|
static WCHAR DefaultKBLayout[20]; // Copy of string inside KeyboardList
|
|
|
|
|
|
|
|
static BOOLEAN RepairUpdateFlag = FALSE;
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Global partition list on the system */
|
2017-08-09 20:39:45 +00:00
|
|
|
static PPARTLIST PartitionList = NULL;
|
2019-02-25 19:29:16 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
/* Currently selected partition entry in the list */
|
|
|
|
static PPARTENTRY CurrentPartition = NULL;
|
|
|
|
|
|
|
|
/* List of supported file systems for the partition to be formatted */
|
2017-08-09 20:39:45 +00:00
|
|
|
static PFILE_SYSTEM_LIST FileSystemList = NULL;
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/* Machine state for the formatter */
|
|
|
|
static PPARTENTRY TempPartition = NULL;
|
2017-08-09 20:39:45 +00:00
|
|
|
static FORMATMACHINESTATE FormatState = Start;
|
|
|
|
|
|
|
|
/*****************************************************/
|
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
static PNTOS_INSTALLATION CurrentInstallation = NULL;
|
|
|
|
static PGENERIC_LIST NtOsInstallsList = NULL;
|
|
|
|
|
2020-02-14 01:47:20 +00:00
|
|
|
#ifdef __REACTOS__ /* HACK */
|
|
|
|
|
|
|
|
/* FONT SUBSTITUTION WORKAROUND *************************************************/
|
|
|
|
|
|
|
|
/* For font file check */
|
|
|
|
FONTSUBSTSETTINGS s_SubstSettings = { FALSE };
|
|
|
|
|
|
|
|
static void
|
|
|
|
DoWatchDestFileName(LPCWSTR FileName)
|
|
|
|
{
|
|
|
|
if (FileName[0] == 'm' || FileName[0] == 'M')
|
|
|
|
{
|
|
|
|
if (wcsicmp(FileName, L"mingliu.ttc") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("mingliu.ttc found\n");
|
|
|
|
s_SubstSettings.bFoundFontMINGLIU = TRUE;
|
|
|
|
}
|
|
|
|
else if (wcsicmp(FileName, L"msgothic.ttc") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("msgothic.ttc found\n");
|
|
|
|
s_SubstSettings.bFoundFontMSGOTHIC = TRUE;
|
|
|
|
}
|
|
|
|
else if (wcsicmp(FileName, L"msmincho.ttc") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("msmincho.ttc found\n");
|
|
|
|
s_SubstSettings.bFoundFontMSMINCHO = TRUE;
|
|
|
|
}
|
|
|
|
else if (wcsicmp(FileName, L"mssong.ttf") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("mssong.ttf found\n");
|
|
|
|
s_SubstSettings.bFoundFontMSSONG = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (wcsicmp(FileName, L"simsun.ttc") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("simsun.ttc found\n");
|
|
|
|
s_SubstSettings.bFoundFontSIMSUN = TRUE;
|
|
|
|
}
|
|
|
|
else if (wcsicmp(FileName, L"gulim.ttc") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("gulim.ttc found\n");
|
|
|
|
s_SubstSettings.bFoundFontGULIM = TRUE;
|
|
|
|
}
|
|
|
|
else if (wcsicmp(FileName, L"batang.ttc") == 0)
|
|
|
|
{
|
|
|
|
DPRINT("batang.ttc found\n");
|
|
|
|
s_SubstSettings.bFoundFontBATANG = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HACK */
|
2010-05-24 22:32:23 +00:00
|
|
|
|
2002-10-29 18:40:02 +00:00
|
|
|
/* FUNCTIONS ****************************************************************/
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2002-10-29 18:40:02 +00:00
|
|
|
static VOID
|
2020-11-04 22:20:03 +00:00
|
|
|
PrintString(IN PCSTR fmt,...)
|
2002-09-08 18:29:56 +00:00
|
|
|
{
|
2020-11-04 22:20:03 +00:00
|
|
|
CHAR buffer[512];
|
2008-01-07 16:50:40 +00:00
|
|
|
va_list ap;
|
|
|
|
UNICODE_STRING UnicodeString;
|
|
|
|
ANSI_STRING AnsiString;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vsprintf(buffer, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
RtlInitAnsiString(&AnsiString, buffer);
|
|
|
|
RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, TRUE);
|
|
|
|
NtDisplayString(&UnicodeString);
|
|
|
|
RtlFreeUnicodeString(&UnicodeString);
|
2002-09-08 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-10 21:00:24 +00:00
|
|
|
static VOID
|
2010-06-11 21:21:27 +00:00
|
|
|
DrawBox(IN SHORT xLeft,
|
|
|
|
IN SHORT yTop,
|
|
|
|
IN SHORT Width,
|
|
|
|
IN SHORT Height)
|
2006-11-10 21:00:24 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
COORD coPos;
|
|
|
|
DWORD Written;
|
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
/* Draw upper left corner */
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = xLeft;
|
|
|
|
coPos.Y = yTop;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharUpperLeftCorner, // '+',
|
2010-06-11 21:21:27 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
/* Draw upper edge */
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = xLeft + 1;
|
|
|
|
coPos.Y = yTop;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharHorizontalLine, // '-',
|
2010-06-11 21:21:27 +00:00
|
|
|
Width - 2,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
/* Draw upper right corner */
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = xLeft + Width - 1;
|
|
|
|
coPos.Y = yTop;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharUpperRightCorner, // '+',
|
2010-06-11 21:21:27 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
/* Draw right edge, inner space and left edge */
|
|
|
|
for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
|
|
|
|
{
|
|
|
|
coPos.X = xLeft;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharVerticalLine, // '|',
|
2010-06-11 21:21:27 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
coPos.X = xLeft + 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
' ',
|
|
|
|
Width - 2,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
coPos.X = xLeft + Width - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharVerticalLine, // '|',
|
2010-06-11 21:21:27 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
/* Draw lower left corner */
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = xLeft;
|
|
|
|
coPos.Y = yTop + Height - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharLowerLeftCorner, // '+',
|
2010-06-11 21:21:27 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
/* Draw lower edge */
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = xLeft + 1;
|
|
|
|
coPos.Y = yTop + Height - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharHorizontalLine, // '-',
|
2010-06-11 21:21:27 +00:00
|
|
|
Width - 2,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
/* Draw lower right corner */
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = xLeft + Width - 1;
|
|
|
|
coPos.Y = yTop + Height - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharLowerRightCorner, // '+',
|
2010-06-11 21:21:27 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2006-11-10 21:00:24 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
VOID
|
2008-01-09 09:40:47 +00:00
|
|
|
PopupError(PCCH Text,
|
2010-06-11 21:21:27 +00:00
|
|
|
PCCH Status,
|
|
|
|
PINPUT_RECORD Ir,
|
|
|
|
ULONG WaitEvent)
|
2002-11-13 18:25:18 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
SHORT yTop;
|
|
|
|
SHORT xLeft;
|
|
|
|
COORD coPos;
|
|
|
|
DWORD Written;
|
|
|
|
ULONG Length;
|
|
|
|
ULONG MaxLength;
|
|
|
|
ULONG Lines;
|
|
|
|
PCHAR p;
|
2008-01-09 09:40:47 +00:00
|
|
|
PCCH pnext;
|
2008-01-07 16:50:40 +00:00
|
|
|
BOOLEAN LastLine;
|
|
|
|
SHORT Width;
|
|
|
|
SHORT Height;
|
|
|
|
|
|
|
|
/* Count text lines and longest line */
|
|
|
|
MaxLength = 0;
|
|
|
|
Lines = 0;
|
|
|
|
pnext = Text;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
p = strchr(pnext, '\n');
|
|
|
|
|
|
|
|
if (p == NULL)
|
|
|
|
{
|
|
|
|
Length = strlen(pnext);
|
|
|
|
LastLine = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Length = (ULONG)(p - pnext);
|
|
|
|
LastLine = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Lines++;
|
|
|
|
|
|
|
|
if (Length > MaxLength)
|
|
|
|
MaxLength = Length;
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (LastLine)
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
pnext = p + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check length of status line */
|
|
|
|
if (Status != NULL)
|
|
|
|
{
|
|
|
|
Length = strlen(Status);
|
|
|
|
|
|
|
|
if (Length > MaxLength)
|
|
|
|
MaxLength = Length;
|
|
|
|
}
|
|
|
|
|
|
|
|
Width = MaxLength + 4;
|
|
|
|
Height = Lines + 2;
|
|
|
|
|
|
|
|
if (Status != NULL)
|
|
|
|
Height += 2;
|
|
|
|
|
|
|
|
yTop = (yScreen - Height) / 2;
|
|
|
|
xLeft = (xScreen - Width) / 2;
|
|
|
|
|
|
|
|
|
|
|
|
/* Set screen attributes */
|
|
|
|
coPos.X = xLeft;
|
|
|
|
for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++)
|
|
|
|
{
|
|
|
|
FillConsoleOutputAttribute(StdOutput,
|
|
|
|
FOREGROUND_RED | BACKGROUND_WHITE,
|
|
|
|
Width,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawBox(xLeft, yTop, Width, Height);
|
|
|
|
|
|
|
|
/* Print message text */
|
|
|
|
coPos.Y = yTop + 1;
|
|
|
|
pnext = Text;
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
p = strchr(pnext, '\n');
|
|
|
|
|
|
|
|
if (p == NULL)
|
|
|
|
{
|
|
|
|
Length = strlen(pnext);
|
|
|
|
LastLine = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Length = (ULONG)(p - pnext);
|
|
|
|
LastLine = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Length != 0)
|
|
|
|
{
|
|
|
|
coPos.X = xLeft + 2;
|
|
|
|
WriteConsoleOutputCharacterA(StdOutput,
|
|
|
|
pnext,
|
|
|
|
Length,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
}
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (LastLine)
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
coPos.Y++;
|
|
|
|
pnext = p + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print separator line and status text */
|
|
|
|
if (Status != NULL)
|
|
|
|
{
|
|
|
|
coPos.Y = yTop + Height - 3;
|
|
|
|
coPos.X = xLeft;
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharVertLineAndRightHorizLine, // '+',
|
2008-01-07 16:50:40 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
coPos.X = xLeft + 1;
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharHorizontalLine, // '-',
|
2008-01-07 16:50:40 +00:00
|
|
|
Width - 2,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
coPos.X = xLeft + Width - 1;
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
2022-10-07 22:46:00 +00:00
|
|
|
CharLeftHorizLineAndVertLine, // '+',
|
2008-01-07 16:50:40 +00:00
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
coPos.Y++;
|
|
|
|
coPos.X = xLeft + 2;
|
|
|
|
WriteConsoleOutputCharacterA(StdOutput,
|
|
|
|
Status,
|
|
|
|
min(strlen(Status), (SIZE_T)Width - 4),
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2003-03-08 19:29:09 +00:00
|
|
|
}
|
2006-08-31 12:35:39 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if (WaitEvent == POPUP_WAIT_NONE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if (WaitEvent == POPUP_WAIT_ANY_KEY ||
|
|
|
|
Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2002-11-13 18:25:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-08 18:29:56 +00:00
|
|
|
/*
|
|
|
|
* Confirm quit setup
|
|
|
|
* RETURNS
|
2008-01-07 16:50:40 +00:00
|
|
|
* TRUE: Quit setup.
|
|
|
|
* FALSE: Don't quit setup.
|
2002-09-08 18:29:56 +00:00
|
|
|
*/
|
|
|
|
static BOOL
|
|
|
|
ConfirmQuit(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
BOOL Result = FALSE;
|
|
|
|
MUIDisplayError(ERROR_NOT_INSTALLED, NULL, POPUP_WAIT_NONE);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2002-09-08 18:29:56 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
|
|
|
Result = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2015-05-04 20:50:51 +00:00
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
Result = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2002-09-08 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return Result;
|
2002-09-08 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
static VOID
|
2008-01-09 09:40:47 +00:00
|
|
|
UpdateKBLayout(VOID)
|
2008-01-06 23:36:01 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
PGENERIC_LIST_ENTRY ListEntry;
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
PCWSTR pszNewLayout;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
pszNewLayout = MUIDefaultKeyboardLayout(SelectedLanguageId);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
if (USetupData.LayoutList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.LayoutList = CreateKeyboardLayoutList(USetupData.SetupInf, SelectedLanguageId, DefaultKBLayout);
|
|
|
|
if (USetupData.LayoutList == NULL)
|
2009-04-20 03:16:12 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
return;
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
2008-01-09 09:40:47 +00:00
|
|
|
/* Search for default layout (if provided) */
|
|
|
|
if (pszNewLayout != NULL)
|
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
|
2017-12-29 18:09:56 +00:00
|
|
|
ListEntry = GetNextListEntry(ListEntry))
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-12-29 18:09:56 +00:00
|
|
|
if (!wcscmp(pszNewLayout, ((PGENENTRY)GetListEntryData(ListEntry))->Id))
|
2008-01-09 09:40:47 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
SetCurrentListEntry(USetupData.LayoutList, ListEntry);
|
2008-01-09 09:40:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-01-06 23:36:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2017-12-29 18:09:56 +00:00
|
|
|
static NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
GetSettingDescription(
|
|
|
|
IN PGENERIC_LIST_ENTRY Entry,
|
|
|
|
OUT PSTR Buffer,
|
|
|
|
IN SIZE_T cchBufferSize)
|
|
|
|
{
|
|
|
|
return RtlStringCchPrintfA(Buffer, cchBufferSize, "%S",
|
|
|
|
((PGENENTRY)GetListEntryData(Entry))->Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
GetNTOSInstallationName(
|
|
|
|
IN PGENERIC_LIST_ENTRY Entry,
|
|
|
|
OUT PSTR Buffer,
|
|
|
|
IN SIZE_T cchBufferSize)
|
|
|
|
{
|
|
|
|
PNTOS_INSTALLATION NtOsInstall = (PNTOS_INSTALLATION)GetListEntryData(Entry);
|
|
|
|
PPARTENTRY PartEntry = NtOsInstall->PartEntry;
|
|
|
|
|
|
|
|
if (PartEntry && PartEntry->DriveLetter)
|
|
|
|
{
|
|
|
|
/* We have retrieved a partition that is mounted */
|
|
|
|
return RtlStringCchPrintfA(Buffer, cchBufferSize,
|
2018-01-28 22:24:06 +00:00
|
|
|
"%C:%S \"%S\"",
|
2017-12-29 18:09:56 +00:00
|
|
|
PartEntry->DriveLetter,
|
|
|
|
NtOsInstall->PathComponent,
|
|
|
|
NtOsInstall->InstallationName);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We failed somewhere, just show the NT path */
|
|
|
|
return RtlStringCchPrintfA(Buffer, cchBufferSize,
|
|
|
|
"%wZ \"%S\"",
|
|
|
|
&NtOsInstall->SystemNtPath,
|
|
|
|
NtOsInstall->InstallationName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the LanguagePage.
|
|
|
|
*
|
2017-05-15 01:48:19 +00:00
|
|
|
* Next pages: WelcomePage, QuitPage
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
2016-05-06 20:17:20 +00:00
|
|
|
* SIDEEFFECTS
|
|
|
|
* Init SelectedLanguageId
|
2017-08-09 20:39:45 +00:00
|
|
|
* Init USetupData.LanguageId
|
2016-05-06 20:17:20 +00:00
|
|
|
*
|
2015-12-06 20:14:29 +00:00
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2007-12-13 16:15:43 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
LanguagePage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
GENERIC_LIST_UI ListUi;
|
2017-12-29 18:09:56 +00:00
|
|
|
PCWSTR NewLanguageId;
|
2011-11-26 18:27:42 +00:00
|
|
|
BOOL RefreshPage = FALSE;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
/* Initialize the computer settings list */
|
2018-01-05 01:51:51 +00:00
|
|
|
if (USetupData.LanguageList == NULL)
|
2007-12-13 16:15:43 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.LanguageList = CreateLanguageList(USetupData.SetupInf, DefaultLanguage);
|
|
|
|
if (USetupData.LanguageList == NULL)
|
2007-12-13 16:15:43 +00:00
|
|
|
{
|
|
|
|
PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2007-12-13 16:15:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-26 22:23:34 +00:00
|
|
|
SelectedLanguageId = DefaultLanguage;
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
USetupData.LanguageId = 0;
|
|
|
|
|
|
|
|
/* Load the font */
|
2011-11-26 22:23:34 +00:00
|
|
|
SetConsoleCodePage();
|
2015-10-18 13:52:51 +00:00
|
|
|
UpdateKBLayout();
|
|
|
|
|
2018-01-28 22:14:16 +00:00
|
|
|
/*
|
|
|
|
* If there is no language or just a single one in the list,
|
|
|
|
* skip the language selection process altogether.
|
|
|
|
*/
|
2018-01-05 01:51:51 +00:00
|
|
|
if (GetNumberOfListEntries(USetupData.LanguageList) <= 1)
|
2016-12-09 18:30:50 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2016-12-09 18:30:50 +00:00
|
|
|
}
|
2011-11-26 22:23:34 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
InitGenericListUi(&ListUi, USetupData.LanguageList, GetSettingDescription);
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawGenericList(&ListUi,
|
2017-12-29 18:09:56 +00:00
|
|
|
2, 18,
|
2008-01-07 16:50:40 +00:00
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
2007-12-13 16:15:43 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollToPositionGenericList(&ListUi, GetDefaultLanguageIndex());
|
2008-06-02 15:34:57 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(LANGUAGE_PAGE);
|
2007-12-13 16:15:43 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2007-12-13 16:15:43 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2007-12-13 16:15:43 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollDownGenericList(&ListUi);
|
2011-11-26 18:27:42 +00:00
|
|
|
RefreshPage = TRUE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollUpGenericList(&ListUi);
|
2011-11-26 18:27:42 +00:00
|
|
|
RefreshPage = TRUE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2008-05-14 14:01:06 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollPageDownGenericList(&ListUi);
|
2011-11-26 18:27:42 +00:00
|
|
|
RefreshPage = TRUE;
|
2008-05-14 14:01:06 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollPageUpGenericList(&ListUi);
|
2011-11-26 18:27:42 +00:00
|
|
|
RefreshPage = TRUE;
|
2008-05-14 14:01:06 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2014-01-19 09:47:27 +00:00
|
|
|
else
|
2017-05-15 16:22:18 +00:00
|
|
|
RedrawGenericList(&ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
ASSERT(GetNumberOfListEntries(USetupData.LanguageList) >= 1);
|
2018-01-28 22:14:16 +00:00
|
|
|
|
2017-12-29 18:09:56 +00:00
|
|
|
SelectedLanguageId =
|
2018-01-05 01:51:51 +00:00
|
|
|
((PGENENTRY)GetListEntryData(GetCurrentListEntry(USetupData.LanguageList)))->Id;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
|
2010-04-26 15:10:23 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if (wcscmp(SelectedLanguageId, DefaultLanguage))
|
|
|
|
{
|
|
|
|
UpdateKBLayout();
|
|
|
|
}
|
|
|
|
|
2011-11-26 18:27:42 +00:00
|
|
|
/* Load the font */
|
2008-01-21 13:33:52 +00:00
|
|
|
SetConsoleCodePage();
|
2008-01-19 14:51:12 +00:00
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2008-01-23 16:14:50 +00:00
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
|
|
|
|
{
|
|
|
|
/* a-z */
|
2017-05-15 16:22:18 +00:00
|
|
|
GenericListKeyPress(&ListUi, Ir->Event.KeyEvent.uChar.AsciiChar);
|
2011-11-26 18:27:42 +00:00
|
|
|
RefreshPage = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RefreshPage)
|
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
ASSERT(GetNumberOfListEntries(USetupData.LanguageList) >= 1);
|
2018-01-28 22:14:16 +00:00
|
|
|
|
2017-12-29 18:09:56 +00:00
|
|
|
NewLanguageId =
|
2018-01-05 01:51:51 +00:00
|
|
|
((PGENENTRY)GetListEntryData(GetCurrentListEntry(USetupData.LanguageList)))->Id;
|
2011-11-26 18:27:42 +00:00
|
|
|
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
if (wcscmp(SelectedLanguageId, NewLanguageId))
|
2011-11-26 18:27:42 +00:00
|
|
|
{
|
|
|
|
/* Clear the language page */
|
|
|
|
MUIClearPage(LANGUAGE_PAGE);
|
|
|
|
|
|
|
|
SelectedLanguageId = NewLanguageId;
|
|
|
|
|
|
|
|
/* Load the font */
|
|
|
|
SetConsoleCodePage();
|
|
|
|
|
2022-10-07 22:46:00 +00:00
|
|
|
/* Redraw the list */
|
|
|
|
DrawGenericList(&ListUi,
|
|
|
|
2, 18,
|
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
|
2011-11-26 18:27:42 +00:00
|
|
|
/* Redraw language selection page in native language */
|
|
|
|
MUIDisplayPage(LANGUAGE_PAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
RefreshPage = FALSE;
|
2008-01-23 16:14:50 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2007-12-13 16:15:43 +00:00
|
|
|
}
|
|
|
|
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2002-10-29 18:40:02 +00:00
|
|
|
/*
|
2002-11-02 23:17:06 +00:00
|
|
|
* Start page
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* LanguagePage (at once, default)
|
|
|
|
* InstallIntroPage (at once, if unattended)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
|
|
|
* Init Sdi
|
2017-08-09 20:39:45 +00:00
|
|
|
* Init USetupData.SourcePath
|
|
|
|
* Init USetupData.SourceRootPath
|
|
|
|
* Init USetupData.SourceRootDir
|
2018-01-05 01:51:51 +00:00
|
|
|
* Init USetupData.SetupInf
|
2017-08-09 20:39:45 +00:00
|
|
|
* Init USetupData.RequiredPartitionDiskSpace
|
2015-12-06 20:14:29 +00:00
|
|
|
* Init IsUnattendedSetup
|
|
|
|
* If unattended, init *List and sets the Codepage
|
2016-05-06 20:17:20 +00:00
|
|
|
* If unattended, init SelectedLanguageId
|
2017-08-09 20:39:45 +00:00
|
|
|
* If unattended, init USetupData.LanguageId
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
2002-10-29 18:40:02 +00:00
|
|
|
* RETURNS
|
2008-01-07 16:50:40 +00:00
|
|
|
* Number of the next page.
|
2002-10-29 18:40:02 +00:00
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2005-06-17 09:46:21 +00:00
|
|
|
SetupStartPage(PINPUT_RECORD Ir)
|
2002-10-29 18:40:02 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
ULONG Error;
|
2008-12-17 13:54:50 +00:00
|
|
|
PGENERIC_LIST_ENTRY ListEntry;
|
2017-12-29 18:09:56 +00:00
|
|
|
PCWSTR LocaleId;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-12-23 19:28:19 +00:00
|
|
|
MUIDisplayPage(SETUP_INIT_PAGE);
|
2002-11-13 18:25:18 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
/* Initialize Setup, phase 1 */
|
|
|
|
Error = InitializeSetup(&USetupData, 1);
|
2017-08-09 20:39:45 +00:00
|
|
|
if (Error != ERROR_SUCCESS)
|
2003-02-08 00:19:32 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ENTER);
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2003-02-08 00:19:32 +00:00
|
|
|
}
|
2002-11-13 18:25:18 +00:00
|
|
|
|
2018-12-23 19:28:19 +00:00
|
|
|
/* Initialize the user-mode PnP manager */
|
|
|
|
if (!EnableUserModePnpManager())
|
|
|
|
DPRINT1("The user-mode PnP manager could not initialize, expect unavailable devices!\n");
|
|
|
|
|
|
|
|
/* Wait for any immediate pending installations to finish */
|
|
|
|
if (WaitNoPendingInstallEvents(NULL) != STATUS_WAIT_0)
|
|
|
|
DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
|
2007-12-06 16:25:57 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
CheckUnattendedSetup(&USetupData);
|
2003-10-06 19:22:42 +00:00
|
|
|
|
2007-12-23 20:29:52 +00:00
|
|
|
if (IsUnattendedSetup)
|
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
// TODO: Read options from inf
|
2017-12-29 18:09:56 +00:00
|
|
|
/* Load the hardware, language and keyboard layout lists */
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.ComputerList = CreateComputerTypeList(USetupData.SetupInf);
|
|
|
|
USetupData.DisplayList = CreateDisplayDriverList(USetupData.SetupInf);
|
|
|
|
USetupData.KeyboardList = CreateKeyboardDriverList(USetupData.SetupInf);
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.LanguageList = CreateLanguageList(USetupData.SetupInf, DefaultLanguage);
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
|
|
/* new part */
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
SelectedLanguageId = DefaultLanguage;
|
2017-12-29 18:09:56 +00:00
|
|
|
wcscpy(DefaultLanguage, USetupData.LocaleID);
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.LayoutList = CreateKeyboardLayoutList(USetupData.SetupInf, SelectedLanguageId, DefaultKBLayout);
|
[SETUPLIB][USETUP][INPUT.CPL] MUI integration with setuplib.
[SETUPLIB] Copy the mui* files from usetup into the setuplib for later usage, and add mui.c to build.
svn path=/branches/setup_improvements/; revision=75711
[SETUPLIB][USETUP] Start massaging the MUI files and split up what concerns only the usetup "resources",
and what concerns general language parameters (in the setuplib).
It may be interesting to retrieve the language parameters
from INF file (e.g. intl.inf) (suggested by Giannis).
svn path=/branches/setup_improvements/; revision=75715
[SETUPLIB] Add the necessary headers to mui.c to be able to compile.
[USETUP] Comment out the languages that don't have any resources.
svn path=/branches/setup_improvements/; revision=75716
[SETUPLIB][USETUP] Adjust MUI and settings code.
- Re-enable settings code concerning language, keyboards & layout
in the setuplib, and remove the old code in usetup.
- Remove useless code in setuplib's mui.c.
- Rename usetup's MUI "LanguageList" into "ResourceList" so as to
avoid colliding with the "LanguageList" of setuplib.
- Add the magic CMakeLists line "add_definitions(${I18N_DEFS})" that
I forgot previously, that caused the "LanguageList" of setuplib to be empty!
The code compiles and works during my tests.
svn path=/branches/setup_improvements/; revision=75717
[SETUPLIB] Change some string pointer types & function prototypes so that the usetup-specific
"SelectedLanguageId" variable is not used in the library.
svn path=/branches/setup_improvements/; revision=75719
[SETUPLIB] Change some function prototypes so that the usetup-specific "SelectedLanguageId" variable is not used in the library.
Also, make AddEntriesFromInfSection(), DefaultProcessEntry() and the typedef PPROCESS_ENTRY_ROUTINE private again.
svn path=/branches/setup_improvements/; revision=75720
svn path=/branches/setup_improvements/; revision=75724
[USETUP] Code adaptations.
- Transform some do{}while() loops into while(){} ones, since the lists on which we work may only contain one single {NULL} element.
- Modify MUIGetOEMCodePage() call after r75719.
- Use PCWSTR where needed.
svn path=/branches/setup_improvements/; revision=75722
[USETUP] Adjust some MUI & settings calls, following the commits r75719, r75720 and r75721.
svn path=/branches/setup_improvements/; revision=75723
[INPUT.CPL] Adjust inclusion of "muifonts.h" (commit 3dbd44f) due to changes introduced in r75711 and r75715.
2017-08-30 11:28:52 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
/* first we hack LanguageList */
|
2018-01-05 01:51:51 +00:00
|
|
|
for (ListEntry = GetFirstListEntry(USetupData.LanguageList); ListEntry;
|
2017-12-29 18:09:56 +00:00
|
|
|
ListEntry = GetNextListEntry(ListEntry))
|
2010-06-11 21:21:27 +00:00
|
|
|
{
|
2017-12-29 18:09:56 +00:00
|
|
|
LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
|
|
|
|
if (!wcsicmp(USetupData.LocaleID, LocaleId))
|
2010-06-11 21:21:27 +00:00
|
|
|
{
|
2017-12-29 18:09:56 +00:00
|
|
|
DPRINT("found %S in LanguageList\n", LocaleId);
|
2018-01-05 01:51:51 +00:00
|
|
|
SetCurrentListEntry(USetupData.LanguageList, ListEntry);
|
2010-06-11 21:21:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now LayoutList */
|
2018-01-05 01:51:51 +00:00
|
|
|
for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
|
2017-12-29 18:09:56 +00:00
|
|
|
ListEntry = GetNextListEntry(ListEntry))
|
2010-06-11 21:21:27 +00:00
|
|
|
{
|
2017-12-29 18:09:56 +00:00
|
|
|
LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
|
|
|
|
if (!wcsicmp(USetupData.LocaleID, LocaleId))
|
2010-06-11 21:21:27 +00:00
|
|
|
{
|
2017-12-29 18:09:56 +00:00
|
|
|
DPRINT("found %S in LayoutList\n", LocaleId);
|
2018-01-05 01:51:51 +00:00
|
|
|
SetCurrentListEntry(USetupData.LayoutList, ListEntry);
|
2010-06-11 21:21:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetConsoleCodePage();
|
|
|
|
|
|
|
|
return INSTALL_INTRO_PAGE;
|
2007-12-23 20:29:52 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return LANGUAGE_PAGE;
|
2002-10-29 18:40:02 +00:00
|
|
|
}
|
2002-09-19 16:21:15 +00:00
|
|
|
|
|
|
|
|
2003-05-06 07:17:52 +00:00
|
|
|
/*
|
2017-05-15 01:48:19 +00:00
|
|
|
* Displays the WelcomePage.
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* InstallIntroPage (default)
|
|
|
|
* RepairIntroPage
|
2018-05-31 14:38:06 +00:00
|
|
|
* RecoveryPage
|
2015-12-06 20:14:29 +00:00
|
|
|
* LicensePage
|
|
|
|
* QuitPage
|
|
|
|
*
|
2003-05-06 07:17:52 +00:00
|
|
|
* RETURNS
|
2015-12-06 20:14:29 +00:00
|
|
|
* Number of the next page.
|
2003-05-06 07:17:52 +00:00
|
|
|
*/
|
|
|
|
static PAGE_NUMBER
|
2017-05-15 01:48:19 +00:00
|
|
|
WelcomePage(PINPUT_RECORD Ir)
|
2003-05-06 07:17:52 +00:00
|
|
|
{
|
2017-05-15 01:48:19 +00:00
|
|
|
MUIDisplayPage(WELCOME_PAGE);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
|
|
|
return INSTALL_INTRO_PAGE;
|
|
|
|
}
|
|
|
|
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
|
|
|
|
{
|
2018-05-31 14:38:06 +00:00
|
|
|
return RECOVERY_PAGE; // REPAIR_INTRO_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2017-05-15 19:41:18 +00:00
|
|
|
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'L') /* L */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
return LICENSE_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2003-05-06 07:17:52 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2004-07-14 16:24:00 +00:00
|
|
|
/*
|
2015-12-06 20:14:29 +00:00
|
|
|
* Displays the License page.
|
|
|
|
*
|
|
|
|
* Next page:
|
2017-05-15 01:48:19 +00:00
|
|
|
* WelcomePage (default)
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
2004-07-14 16:24:00 +00:00
|
|
|
* RETURNS
|
2015-12-06 20:14:29 +00:00
|
|
|
* Number of the next page.
|
2004-07-14 16:24:00 +00:00
|
|
|
*/
|
|
|
|
static PAGE_NUMBER
|
|
|
|
LicensePage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(LICENSE_PAGE);
|
2007-12-15 16:30:15 +00:00
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
while (TRUE)
|
2004-07-14 16:24:00 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2004-07-14 16:24:00 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2004-07-14 16:24:00 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return LICENSE_PAGE;
|
2004-07-14 16:24:00 +00:00
|
|
|
}
|
2002-09-19 16:21:15 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the RepairIntroPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* RebootPage (default)
|
|
|
|
* InstallIntroPage
|
|
|
|
* RecoveryPage
|
|
|
|
* IntroPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2003-05-06 07:17:52 +00:00
|
|
|
RepairIntroPage(PINPUT_RECORD Ir)
|
2002-09-08 18:29:56 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(REPAIR_INTRO_PAGE);
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
while (TRUE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
|
|
|
return REBOOT_PAGE;
|
|
|
|
}
|
|
|
|
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
|
|
|
|
{
|
|
|
|
RepairUpdateFlag = TRUE;
|
|
|
|
return INSTALL_INTRO_PAGE;
|
|
|
|
}
|
|
|
|
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
|
|
|
|
{
|
2014-12-20 21:58:22 +00:00
|
|
|
return RECOVERY_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2021-01-02 18:34:22 +00:00
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-05-15 01:48:19 +00:00
|
|
|
return WELCOME_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return REPAIR_INTRO_PAGE;
|
2002-09-19 16:21:15 +00:00
|
|
|
}
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
/*
|
|
|
|
* Displays the UpgradeRepairPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* RebootPage (default)
|
|
|
|
* InstallIntroPage
|
|
|
|
* RecoveryPage
|
|
|
|
* WelcomePage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
|
|
|
static PAGE_NUMBER
|
|
|
|
UpgradeRepairPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
|
|
|
GENERIC_LIST_UI ListUi;
|
|
|
|
|
|
|
|
/*** HACK!! ***/
|
|
|
|
if (PartitionList == NULL)
|
|
|
|
{
|
|
|
|
PartitionList = CreatePartitionList();
|
|
|
|
if (PartitionList == NULL)
|
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
MUIDisplayError(ERROR_DRIVE_INFORMATION, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
else if (IsListEmpty(&PartitionList->DiskListHead))
|
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_NO_HDD, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Reset the formatter machine state */
|
2018-05-31 14:38:06 +00:00
|
|
|
TempPartition = NULL;
|
|
|
|
FormatState = Start;
|
|
|
|
}
|
|
|
|
/**************/
|
|
|
|
|
|
|
|
NtOsInstallsList = CreateNTOSInstallationsList(PartitionList);
|
|
|
|
if (!NtOsInstallsList)
|
|
|
|
DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
|
2018-01-28 22:14:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If there is no available installation (or just a single one??) that can
|
|
|
|
* be updated in the list, just continue with the regular installation.
|
|
|
|
*/
|
2018-05-31 14:38:06 +00:00
|
|
|
if (!NtOsInstallsList || GetNumberOfListEntries(NtOsInstallsList) == 0)
|
|
|
|
{
|
|
|
|
RepairUpdateFlag = FALSE;
|
|
|
|
|
|
|
|
// return INSTALL_INTRO_PAGE;
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
// return SCSI_CONTROLLER_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
MUIDisplayPage(UPGRADE_REPAIR_PAGE);
|
|
|
|
|
2017-12-29 18:09:56 +00:00
|
|
|
InitGenericListUi(&ListUi, NtOsInstallsList, GetNTOSInstallationName);
|
2018-05-31 14:38:06 +00:00
|
|
|
DrawGenericList(&ListUi,
|
|
|
|
2, 23,
|
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
|
|
|
|
// return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00)
|
|
|
|
{
|
|
|
|
switch (Ir->Event.KeyEvent.wVirtualKeyCode)
|
|
|
|
{
|
|
|
|
case VK_DOWN: /* DOWN */
|
|
|
|
ScrollDownGenericList(&ListUi);
|
|
|
|
break;
|
|
|
|
case VK_UP: /* UP */
|
|
|
|
ScrollUpGenericList(&ListUi);
|
|
|
|
break;
|
|
|
|
case VK_NEXT: /* PAGE DOWN */
|
|
|
|
ScrollPageDownGenericList(&ListUi);
|
|
|
|
break;
|
|
|
|
case VK_PRIOR: /* PAGE UP */
|
|
|
|
ScrollPageUpGenericList(&ListUi);
|
|
|
|
break;
|
|
|
|
case VK_F3: /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2018-05-31 14:38:06 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
else
|
|
|
|
RedrawGenericList(&ListUi);
|
|
|
|
break;
|
|
|
|
}
|
2021-01-04 15:11:40 +00:00
|
|
|
#if 1
|
|
|
|
/* TODO: Temporarily kept until correct keyboard layout is in place.
|
|
|
|
* (Actual AsciiChar of ESCAPE should be 0x1B instead of 0.)
|
|
|
|
* Addendum to commit 8b94515b.
|
|
|
|
*/
|
|
|
|
case VK_ESCAPE: /* ESC */
|
|
|
|
{
|
|
|
|
RestoreGenericListUiState(&ListUi);
|
|
|
|
// return nextPage; // prevPage;
|
|
|
|
|
|
|
|
// return INSTALL_INTRO_PAGE;
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
// return SCSI_CONTROLLER_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2018-05-31 14:38:06 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-04 15:11:40 +00:00
|
|
|
#if 0
|
|
|
|
/* TODO: Restore this once correct keyboard layout is in place. */
|
2021-01-02 18:34:22 +00:00
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
|
|
|
{
|
|
|
|
RestoreGenericListUiState(&ListUi);
|
|
|
|
// return nextPage; // prevPage;
|
|
|
|
|
|
|
|
// return INSTALL_INTRO_PAGE;
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
// return SCSI_CONTROLLER_PAGE;
|
|
|
|
}
|
2021-01-04 15:11:40 +00:00
|
|
|
#endif
|
2018-05-31 14:38:06 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// switch (toupper(Ir->Event.KeyEvent.uChar.AsciiChar))
|
|
|
|
// if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
|
|
|
|
{
|
|
|
|
/* Retrieve the current installation */
|
2018-01-28 22:14:16 +00:00
|
|
|
ASSERT(GetNumberOfListEntries(NtOsInstallsList) >= 1);
|
|
|
|
|
2017-12-29 18:09:56 +00:00
|
|
|
CurrentInstallation =
|
|
|
|
(PNTOS_INSTALLATION)GetListEntryData(GetCurrentListEntry(NtOsInstallsList));
|
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
DPRINT1("Selected installation for repair: \"%S\" ; DiskNumber = %d , PartitionNumber = %d\n",
|
|
|
|
CurrentInstallation->InstallationName, CurrentInstallation->DiskNumber, CurrentInstallation->PartitionNumber);
|
|
|
|
|
|
|
|
RepairUpdateFlag = TRUE;
|
|
|
|
|
|
|
|
// return nextPage;
|
|
|
|
/***/return INSTALL_INTRO_PAGE;/***/
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) &&
|
|
|
|
(Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) /* a-z */
|
|
|
|
{
|
|
|
|
GenericListKeyPress(&ListUi, Ir->Event.KeyEvent.uChar.AsciiChar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return UPGRADE_REPAIR_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the InstallIntroPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* DeviceSettingsPage (At once if repair or update is selected)
|
|
|
|
* SelectPartitionPage (At once if unattended setup)
|
|
|
|
* DeviceSettingsPage (default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2002-09-19 16:21:15 +00:00
|
|
|
InstallIntroPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
if (RepairUpdateFlag)
|
2007-06-30 19:37:43 +00:00
|
|
|
{
|
2018-05-31 14:38:06 +00:00
|
|
|
#if 1 /* Old code that looks good */
|
|
|
|
|
|
|
|
// return SELECT_PARTITION_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
return DEVICE_SETTINGS_PAGE;
|
2018-05-31 14:38:06 +00:00
|
|
|
|
|
|
|
#else /* Possible new code? */
|
|
|
|
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
// return SCSI_CONTROLLER_PAGE;
|
|
|
|
|
|
|
|
#endif
|
2007-06-30 19:37:43 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if (IsUnattendedSetup)
|
|
|
|
return SELECT_PARTITION_PAGE;
|
2017-05-15 01:48:19 +00:00
|
|
|
|
|
|
|
MUIDisplayPage(INSTALL_INTRO_PAGE);
|
2003-10-06 19:22:42 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2002-09-08 18:29:56 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
2018-05-31 14:38:06 +00:00
|
|
|
return UPGRADE_REPAIR_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return INSTALL_INTRO_PAGE;
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-23 14:09:55 +00:00
|
|
|
#if 0
|
|
|
|
static PAGE_NUMBER
|
|
|
|
ScsiControllerPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-05-15 01:48:19 +00:00
|
|
|
// MUIDisplayPage(SCSI_CONTROLLER_PAGE);
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 8, "Setup detected the following mass storage devices:");
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
/* FIXME: print loaded mass storage driver descriptions */
|
2004-06-23 14:09:55 +00:00
|
|
|
#if 0
|
2017-05-15 01:48:19 +00:00
|
|
|
CONSOLE_SetTextXY(8, 10, "TEST device");
|
2004-06-23 14:09:55 +00:00
|
|
|
#endif
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2004-06-23 14:09:55 +00:00
|
|
|
{
|
2017-05-15 01:48:19 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
}
|
2004-06-23 14:09:55 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return SCSI_CONTROLLER_PAGE;
|
2004-06-23 14:09:55 +00:00
|
|
|
}
|
2017-05-15 01:48:19 +00:00
|
|
|
|
|
|
|
static PAGE_NUMBER
|
|
|
|
OemDriverPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
|
|
|
// MUIDisplayPage(OEM_DRIVER_PAGE);
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 8, "This is the OEM driver page!");
|
|
|
|
|
|
|
|
/* FIXME: Implement!! */
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2017-05-15 01:48:19 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OEM_DRIVER_PAGE;
|
|
|
|
}
|
2004-06-23 14:09:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the DeviceSettingsPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SelectPartitionPage (At once if repair or update is selected)
|
|
|
|
* ComputerSettingsPage
|
|
|
|
* DisplaySettingsPage
|
|
|
|
* KeyboardSettingsPage
|
|
|
|
* LayoutsettingsPage
|
|
|
|
* SelectPartitionPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2018-01-05 01:51:51 +00:00
|
|
|
* Init USetupData.ComputerList
|
|
|
|
* Init USetupData.DisplayList
|
|
|
|
* Init USetupData.KeyboardList
|
|
|
|
* Init USetupData.LayoutList
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-05-26 20:58:37 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
DeviceSettingsPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
static ULONG Line = 16;
|
|
|
|
|
|
|
|
/* Initialize the computer settings list */
|
2018-01-05 01:51:51 +00:00
|
|
|
if (USetupData.ComputerList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.ComputerList = CreateComputerTypeList(USetupData.SetupInf);
|
|
|
|
if (USetupData.ComputerList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_LOAD_COMPUTER, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the display settings list */
|
2018-01-05 01:51:51 +00:00
|
|
|
if (USetupData.DisplayList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.DisplayList = CreateDisplayDriverList(USetupData.SetupInf);
|
|
|
|
if (USetupData.DisplayList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_LOAD_DISPLAY, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the keyboard settings list */
|
2018-01-05 01:51:51 +00:00
|
|
|
if (USetupData.KeyboardList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.KeyboardList = CreateKeyboardDriverList(USetupData.SetupInf);
|
|
|
|
if (USetupData.KeyboardList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_LOAD_KEYBOARD, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the keyboard layout list */
|
2018-01-05 01:51:51 +00:00
|
|
|
if (USetupData.LayoutList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-01-05 01:51:51 +00:00
|
|
|
USetupData.LayoutList = CreateKeyboardLayoutList(USetupData.SetupInf, SelectedLanguageId, DefaultKBLayout);
|
|
|
|
if (USetupData.LayoutList == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
/* FIXME: report error */
|
|
|
|
MUIDisplayError(ERROR_LOAD_KBLAYOUT, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
if (RepairUpdateFlag)
|
|
|
|
return SELECT_PARTITION_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
// if (IsUnattendedSetup)
|
|
|
|
// return SELECT_PARTITION_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
MUIDisplayPage(DEVICE_SETTINGS_PAGE);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
DrawGenericListCurrentItem(USetupData.ComputerList, GetSettingDescription, 25, 11);
|
|
|
|
DrawGenericListCurrentItem(USetupData.DisplayList , GetSettingDescription, 25, 12);
|
|
|
|
DrawGenericListCurrentItem(USetupData.KeyboardList, GetSettingDescription, 25, 13);
|
|
|
|
DrawGenericListCurrentItem(USetupData.LayoutList , GetSettingDescription, 25, 14);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
CONSOLE_InvertTextXY(24, Line, 48, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_NormalTextXY(24, Line, 48, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if (Line == 14)
|
|
|
|
Line = 16;
|
|
|
|
else if (Line == 16)
|
|
|
|
Line = 11;
|
|
|
|
else
|
|
|
|
Line++;
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_InvertTextXY(24, Line, 48, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_NormalTextXY(24, Line, 48, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if (Line == 11)
|
|
|
|
Line = 16;
|
|
|
|
else if (Line == 16)
|
|
|
|
Line = 14;
|
|
|
|
else
|
|
|
|
Line--;
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_InvertTextXY(24, Line, 48, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
|
|
|
if (Line == 11)
|
|
|
|
return COMPUTER_SETTINGS_PAGE;
|
|
|
|
else if (Line == 12)
|
|
|
|
return DISPLAY_SETTINGS_PAGE;
|
|
|
|
else if (Line == 13)
|
|
|
|
return KEYBOARD_SETTINGS_PAGE;
|
|
|
|
else if (Line == 14)
|
|
|
|
return LAYOUT_SETTINGS_PAGE;
|
|
|
|
else if (Line == 16)
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Handles generic selection lists.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* GenericList: The list to handle.
|
|
|
|
* nextPage: The page it needs to jump to after this page.
|
|
|
|
* Ir: The PINPUT_RECORD
|
|
|
|
*/
|
2004-05-26 20:58:37 +00:00
|
|
|
static PAGE_NUMBER
|
2017-05-15 16:22:18 +00:00
|
|
|
HandleGenericList(PGENERIC_LIST_UI ListUi,
|
2015-12-06 20:14:29 +00:00
|
|
|
PAGE_NUMBER nextPage,
|
|
|
|
PINPUT_RECORD Ir)
|
2004-05-26 20:58:37 +00:00
|
|
|
{
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollDownGenericList(ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollUpGenericList(ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
2016-02-29 20:58:32 +00:00
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
|
2015-12-06 20:14:29 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollPageDownGenericList(ListUi);
|
2015-12-06 20:14:29 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollPageUpGenericList(ListUi);
|
2015-12-06 20:14:29 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
2016-02-29 20:58:32 +00:00
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2017-05-15 16:22:18 +00:00
|
|
|
else
|
|
|
|
RedrawGenericList(ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2021-01-02 18:34:22 +00:00
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-12-29 18:09:56 +00:00
|
|
|
RestoreGenericListUiState(ListUi);
|
2017-05-15 16:22:18 +00:00
|
|
|
return nextPage; // Use some "prevPage;" instead?
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
2015-12-06 20:14:29 +00:00
|
|
|
return nextPage;
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
|
|
|
|
{
|
|
|
|
/* a-z */
|
2017-05-15 16:22:18 +00:00
|
|
|
GenericListKeyPress(ListUi, Ir->Event.KeyEvent.uChar.AsciiChar);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the ComputerSettingsPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* DeviceSettingsPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
|
|
|
static PAGE_NUMBER
|
|
|
|
ComputerSettingsPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
GENERIC_LIST_UI ListUi;
|
2015-12-06 20:14:29 +00:00
|
|
|
MUIDisplayPage(COMPUTER_SETTINGS_PAGE);
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
InitGenericListUi(&ListUi, USetupData.ComputerList, GetSettingDescription);
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawGenericList(&ListUi,
|
2017-12-29 18:09:56 +00:00
|
|
|
2, 18,
|
2015-12-06 20:14:29 +00:00
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
|
2015-12-06 20:14:29 +00:00
|
|
|
}
|
2017-05-23 22:30:54 +00:00
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the DisplaySettingsPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* DeviceSettingsPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-05-26 20:58:37 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
DisplaySettingsPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
GENERIC_LIST_UI ListUi;
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(DISPLAY_SETTINGS_PAGE);
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
InitGenericListUi(&ListUi, USetupData.DisplayList, GetSettingDescription);
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawGenericList(&ListUi,
|
2017-12-29 18:09:56 +00:00
|
|
|
2, 18,
|
2008-01-07 16:50:40 +00:00
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the KeyboardSettingsPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* DeviceSettingsPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-05-26 20:58:37 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
KeyboardSettingsPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
GENERIC_LIST_UI ListUi;
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(KEYBOARD_SETTINGS_PAGE);
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
InitGenericListUi(&ListUi, USetupData.KeyboardList, GetSettingDescription);
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawGenericList(&ListUi,
|
2017-12-29 18:09:56 +00:00
|
|
|
2, 18,
|
2008-01-07 16:50:40 +00:00
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the LayoutSettingsPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* DeviceSettingsPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-05-26 20:58:37 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
LayoutSettingsPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
GENERIC_LIST_UI ListUi;
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(LAYOUT_SETTINGS_PAGE);
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
InitGenericListUi(&ListUi, USetupData.LayoutList, GetSettingDescription);
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawGenericList(&ListUi,
|
2017-12-29 18:09:56 +00:00
|
|
|
2, 18,
|
2008-01-07 16:50:40 +00:00
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
|
2004-05-26 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
|
|
static BOOL
|
|
|
|
IsDiskSizeValid(PPARTENTRY PartEntry)
|
2010-05-24 20:53:32 +00:00
|
|
|
{
|
2014-12-27 12:33:59 +00:00
|
|
|
ULONGLONG size;
|
2010-09-13 16:34:15 +00:00
|
|
|
|
2014-12-27 12:33:59 +00:00
|
|
|
size = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector;
|
2017-08-08 14:05:20 +00:00
|
|
|
size = (size + (512 * KB)) / MB; /* in MBytes */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (size < USetupData.RequiredPartitionDiskSpace)
|
2010-05-24 20:53:32 +00:00
|
|
|
{
|
[USETUP] Implement work-in-progress code that allows verifying whether registry hives validity.
Implement work-in-progress code that, when upgrading an existing
ReactOS installation, verifies whether the (existing) system registry
hives are valid (by loading & unloading them, this allows using the
built-in repair functionality if needed), or not.
If a given hive cannot be repaired successfully, it is backed up
(with a '.brk' extension, "brk" as "broken"), then is marked up for
recreation.
When all hives have been checked, if there are any hive that needs
to be recreated, we recreate its hive file, mount it, but we do *NOT*
mount the other valid existing hives for update. We create instead
dummy registry hives so that we can actually use, as the update code,
the same one as the one used when fully creating the registry hives
for a clean installation (of course, this choice can be improved later on).
The update code (i.e. the same as the registry clean-install one) then
adds the registry keys & values, either putting them in the dummy
registry hives (the ones that we don't want to recreate) or in the
registry hive that is recreated.
At the end, the (re)created registry hives are flushed back to disk,
and a copy of them (under a '.sav' extension) are created, so that they
can be used for restoration purposes if 2nd-stage (and up) goes berserk.
Extra fixes:
- Use the correct structure member field when initializing the
'InstallDir' variable, when performing an upgrade.
- CreateNestedKey() should be better analysed to see whether it correctly
creates the full registry path compatible with volatile/non-volatile keys
(under inspection).
svn path=/branches/setup_improvements/; revision=75010
2017-06-12 00:09:16 +00:00
|
|
|
/* Partition is too small so ask for another one */
|
2017-08-09 20:39:45 +00:00
|
|
|
DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, USetupData.RequiredPartitionDiskSpace);
|
2010-05-24 20:53:32 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2004-05-26 20:58:37 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the SelectPartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SelectFileSystemPage (At once if unattended)
|
|
|
|
* SelectFileSystemPage (Default if free space is selected)
|
|
|
|
* CreatePrimaryPartitionPage
|
|
|
|
* CreateExtendedPartitionPage
|
|
|
|
* CreateLogicalPartitionPage
|
|
|
|
* ConfirmDeleteSystemPartitionPage (if the selected partition is the system partition, aka with the boot flag set)
|
|
|
|
* DeletePartitionPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
|
|
|
* Set InstallShortcut (only if not unattended + free space is selected)
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2002-10-18 20:04:00 +00:00
|
|
|
SelectPartitionPage(PINPUT_RECORD Ir)
|
2002-09-08 18:29:56 +00:00
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
PARTLIST_UI ListUi;
|
2014-05-20 23:48:36 +00:00
|
|
|
ULONG Error;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if (PartitionList == NULL)
|
2002-09-19 16:21:15 +00:00
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
PartitionList = CreatePartitionList();
|
2008-01-07 16:50:40 +00:00
|
|
|
if (PartitionList == NULL)
|
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
MUIDisplayError(ERROR_DRIVE_INFORMATION, Ir, POPUP_WAIT_ENTER);
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2016-02-29 20:58:32 +00:00
|
|
|
else if (IsListEmpty(&PartitionList->DiskListHead))
|
2014-03-09 14:19:56 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_NO_HDD, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2017-05-18 01:05:39 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Reset the formatter machine state */
|
2017-05-18 01:05:39 +00:00
|
|
|
TempPartition = NULL;
|
|
|
|
FormatState = Start;
|
2002-09-19 16:21:15 +00:00
|
|
|
}
|
2003-08-12 15:56:21 +00:00
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
if (RepairUpdateFlag)
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentInstallation);
|
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
/* Determine the selected installation disk & partition */
|
2019-03-05 00:42:33 +00:00
|
|
|
InstallPartition = SelectPartition(PartitionList,
|
|
|
|
CurrentInstallation->DiskNumber,
|
|
|
|
CurrentInstallation->PartitionNumber);
|
|
|
|
if (!InstallPartition)
|
2018-05-31 14:38:06 +00:00
|
|
|
{
|
|
|
|
DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
|
|
|
|
ASSERT(FALSE);
|
|
|
|
}
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(!IsContainerPartition(InstallPartition->PartitionType));
|
2018-05-31 14:38:06 +00:00
|
|
|
|
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
|
|
|
}
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
MUIDisplayPage(SELECT_PARTITION_PAGE);
|
|
|
|
|
2017-05-15 19:41:18 +00:00
|
|
|
InitPartitionListUi(&ListUi, PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
|
|
|
2, 23,
|
2017-05-15 19:41:18 +00:00
|
|
|
xScreen - 3,
|
|
|
|
yScreen - 3);
|
|
|
|
DrawPartitionList(&ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if (IsUnattendedSetup)
|
2003-08-20 20:07:33 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
/* Determine the selected installation disk & partition */
|
|
|
|
InstallPartition = SelectPartition(PartitionList,
|
|
|
|
USetupData.DestinationDiskNumber,
|
|
|
|
USetupData.DestinationPartitionNumber);
|
|
|
|
if (!InstallPartition)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition = ListUi.CurrentPartition;
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (USetupData.AutoPartition)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition != NULL);
|
|
|
|
ASSERT(!IsContainerPartition(CurrentPartition->PartitionType));
|
|
|
|
|
|
|
|
if (CurrentPartition->LogicalPartition)
|
2015-07-04 16:04:09 +00:00
|
|
|
{
|
|
|
|
CreateLogicalPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
|
|
|
CurrentPartition->SectorCount.QuadPart,
|
2015-07-04 16:04:09 +00:00
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CreatePrimaryPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
|
|
|
CurrentPartition->SectorCount.QuadPart,
|
2015-07-04 16:04:09 +00:00
|
|
|
TRUE);
|
|
|
|
}
|
2014-12-27 12:33:59 +00:00
|
|
|
|
2017-05-15 19:41:18 +00:00
|
|
|
// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
|
2019-03-05 00:42:33 +00:00
|
|
|
if (!IsDiskSizeValid(CurrentPartition))
|
2010-05-24 20:53:32 +00:00
|
|
|
{
|
2014-12-27 12:33:59 +00:00
|
|
|
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.RequiredPartitionDiskSpace);
|
2010-05-24 20:53:32 +00:00
|
|
|
return SELECT_PARTITION_PAGE; /* let the user select another partition */
|
|
|
|
}
|
2003-08-20 20:07:33 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
InstallPartition = CurrentPartition;
|
2010-06-11 21:21:27 +00:00
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(!IsContainerPartition(InstallPartition->PartitionType));
|
|
|
|
|
|
|
|
DrawPartitionList(&ListUi); // FIXME: Doesn't make much sense...
|
2017-05-15 19:41:18 +00:00
|
|
|
|
|
|
|
// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
|
2019-03-05 00:42:33 +00:00
|
|
|
if (!IsDiskSizeValid(InstallPartition))
|
2010-05-24 20:53:32 +00:00
|
|
|
{
|
2014-12-27 12:33:59 +00:00
|
|
|
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.RequiredPartitionDiskSpace);
|
2010-05-24 20:53:32 +00:00
|
|
|
return SELECT_PARTITION_PAGE; /* let the user select another partition */
|
|
|
|
}
|
2014-12-27 12:33:59 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2003-08-20 20:07:33 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2003-10-06 19:22:42 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition = ListUi.CurrentPartition;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
/* Update status text */
|
2019-03-05 00:42:33 +00:00
|
|
|
if (CurrentPartition == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATEPARTITION));
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2019-03-05 00:42:33 +00:00
|
|
|
else if (CurrentPartition->LogicalPartition)
|
2014-05-20 23:48:36 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
if (CurrentPartition->IsPartitioned)
|
2017-05-13 16:23:08 +00:00
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_DELETEPARTITION));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATELOGICAL));
|
|
|
|
}
|
2014-05-20 23:48:36 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else
|
2007-08-26 18:19:23 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
if (CurrentPartition->IsPartitioned)
|
2017-05-13 16:23:08 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
if (IsContainerPartition(CurrentPartition->PartitionType))
|
2017-05-13 16:23:08 +00:00
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_DELETEPARTITION));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLDELETEPARTITION));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATEPARTITION));
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2007-08-27 20:03:06 +00:00
|
|
|
{
|
2010-06-11 21:21:27 +00:00
|
|
|
DestroyPartitionList(PartitionList);
|
2008-01-07 16:50:40 +00:00
|
|
|
PartitionList = NULL;
|
|
|
|
return QUIT_PAGE;
|
2007-08-27 20:03:06 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
break;
|
2007-08-26 18:19:23 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
ScrollDownPartitionList(&ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
ScrollUpPartitionList(&ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition != NULL);
|
|
|
|
|
|
|
|
if (IsContainerPartition(CurrentPartition->PartitionType))
|
2017-05-13 16:23:08 +00:00
|
|
|
continue; // return SELECT_PARTITION_PAGE;
|
2014-05-20 23:48:36 +00:00
|
|
|
|
[SETUPLIB][USETUP] Improve disk HW numbering, removable disk support, and "super-floppy" partitioning.
Nowadays more and more people try to install ReactOS from removable
drives (e.g. USB sticks) onto fixed HDDs, or try to install it into
USB sticks too.
Both fixed and removable drives, as well as partitions on these, are
represented in NT using the same device name format:
\Device\HarddiskM\PartitionN ,
with an increasing disk number M. Using this number for building the
corresponding firmware-specific ARC multi(x)disk(y)rdisk(z) path used
by the NT/ROS loader (FreeLdr, ...) is then prone to error since there
may have been removable drives inserted and accounted for in the
calculation of the disk number. These drives must be correctly
subtracted in order to generate the correct ARC path, valid once all
the removable drives have been ejected (which should also be the
situation seen from the BIOS when booting up, except of course if you
boot on a USB stick).
This problem is now solved. Note that it matters only for the disks
that have also been enumerated by the firmware (BIOS; Int 13h). We
don't have to care about the other drives, since the ARC path will be
of a different format and will not use the disk number (instead, the
SCSI coordinates are used).
We also try to enumerate all the disks found in all the possible disk
adapters and controllers enumerated in the Hardware registry tree
(and that are visible by FreeLdr) in order to cover all.
Finally, we detect whether a disk reports as a "super-floppy", i.e.
an unpartitioned disk with a valid VBR. This is indeed how a standard
floppy disk looks like, or how USB sticks are partitioned on Windows.
Such disk is reported has having only one single partition starting at
the beginning of the disk, with partition number == 0, its type being
FAT16 non-bootable.
This allows us to forbid creating any new partitions on such disks.
Note that accessing either \Device\HarddiskN\Partition0 or Partition1
on such a disk returns the same data.
Note also that on the contrary, regular MBR-partitioned disks would
report at least four partitions entries, instead of just one.
The other improvements are:
- Do *NOT* write any MBR on a disk partitioned as "super-floppy".
CORE-13703
- Fix the computed disk identifier, of format: %08x-%08x-%c .
The numbers are respectively the checksum of the first sector, and
the disk signature. The terminating letter is A or X, depending
whether the first sector ends with 0x55AA/0xAA55 or not (see also
commit 5053f1f5).
- Warn if the user attempts to install ReactOS on a disk that is not
visible by the firmware of his computer, because it may not be
bootable.
2019-03-11 23:13:25 +00:00
|
|
|
/*
|
|
|
|
* Check whether the user wants to install ReactOS on a disk that
|
|
|
|
* is not recognized by the computer's firmware and if so, display
|
|
|
|
* a warning since such disks may not be bootable.
|
|
|
|
*/
|
|
|
|
if (CurrentPartition->DiskEntry->MediaType == FixedMedia &&
|
|
|
|
!CurrentPartition->DiskEntry->BiosFound)
|
|
|
|
{
|
|
|
|
PopupError("The disk you have selected for installing ReactOS\n"
|
|
|
|
"is not visible by the firmware of your computer,\n"
|
|
|
|
"and so may not be bootable.\n"
|
|
|
|
"Press ENTER to continue nonetheless.",
|
|
|
|
MUIGetString(STRING_CONTINUE),
|
|
|
|
Ir, POPUP_WAIT_ENTER);
|
|
|
|
// return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (CurrentPartition->IsPartitioned == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
if (CurrentPartition->LogicalPartition)
|
2015-07-04 16:04:09 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
Error = LogicalPartitionCreationChecks(CurrentPartition);
|
2018-11-18 18:07:23 +00:00
|
|
|
if (Error != NOT_AN_ERROR)
|
|
|
|
{
|
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
|
2015-07-04 16:04:09 +00:00
|
|
|
CreateLogicalPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
2015-07-04 16:04:09 +00:00
|
|
|
0ULL,
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
Error = PrimaryPartitionCreationChecks(CurrentPartition);
|
2018-11-18 18:07:23 +00:00
|
|
|
if (Error != NOT_AN_ERROR)
|
|
|
|
{
|
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
|
2015-07-04 16:04:09 +00:00
|
|
|
CreatePrimaryPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
2015-07-04 16:04:09 +00:00
|
|
|
0ULL,
|
|
|
|
TRUE);
|
|
|
|
}
|
2015-01-04 13:53:45 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (!IsDiskSizeValid(CurrentPartition))
|
2015-01-04 13:53:45 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.RequiredPartitionDiskSpace);
|
2015-01-04 13:53:45 +00:00
|
|
|
return SELECT_PARTITION_PAGE; /* let the user select another partition */
|
2014-12-27 12:33:59 +00:00
|
|
|
}
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
InstallPartition = CurrentPartition;
|
2015-01-04 13:53:45 +00:00
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2014-05-20 23:48:36 +00:00
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'P') /* P */
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition != NULL);
|
|
|
|
|
|
|
|
if (CurrentPartition->LogicalPartition == FALSE)
|
2014-05-20 23:48:36 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
Error = PrimaryPartitionCreationChecks(CurrentPartition);
|
2014-06-08 19:05:03 +00:00
|
|
|
if (Error != NOT_AN_ERROR)
|
|
|
|
{
|
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
2014-05-20 23:48:36 +00:00
|
|
|
|
2014-06-08 19:05:03 +00:00
|
|
|
return CREATE_PRIMARY_PARTITION_PAGE;
|
|
|
|
}
|
2014-05-20 23:48:36 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'E') /* E */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition != NULL);
|
|
|
|
|
|
|
|
if (CurrentPartition->LogicalPartition == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
Error = ExtendedPartitionCreationChecks(CurrentPartition);
|
2014-06-08 19:05:03 +00:00
|
|
|
if (Error != NOT_AN_ERROR)
|
|
|
|
{
|
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CREATE_EXTENDED_PARTITION_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2014-06-08 19:05:03 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition != NULL);
|
|
|
|
|
|
|
|
if (CurrentPartition->LogicalPartition)
|
2014-06-08 19:05:03 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
Error = LogicalPartitionCreationChecks(CurrentPartition);
|
2014-06-08 19:05:03 +00:00
|
|
|
if (Error != NOT_AN_ERROR)
|
|
|
|
{
|
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2014-06-08 19:05:03 +00:00
|
|
|
return CREATE_LOGICAL_PARTITION_PAGE;
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
UNICODE_STRING CurrentPartitionU;
|
2019-02-25 19:29:16 +00:00
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
2017-08-25 14:38:12 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition != NULL);
|
|
|
|
|
|
|
|
if (CurrentPartition->IsPartitioned == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_DELETE_SPACE, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
// TODO: Do something similar before trying to format the partition?
|
2019-03-05 00:42:33 +00:00
|
|
|
if (!CurrentPartition->New &&
|
|
|
|
!IsContainerPartition(CurrentPartition->PartitionType) &&
|
|
|
|
CurrentPartition->FormatState != Unformatted)
|
2017-08-25 14:38:12 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
ASSERT(CurrentPartition->PartitionNumber != 0);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu\\",
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition->DiskEntry->DiskNumber,
|
|
|
|
CurrentPartition->PartitionNumber);
|
|
|
|
RtlInitUnicodeString(&CurrentPartitionU, PathBuffer);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check whether the user attempts to delete the partition on which
|
|
|
|
* the installation source is present. If so, fail with an error.
|
|
|
|
*/
|
|
|
|
// &USetupData.SourceRootPath
|
2019-03-05 00:42:33 +00:00
|
|
|
if (RtlPrefixUnicodeString(&CurrentPartitionU, &USetupData.SourcePath, TRUE))
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
2019-02-13 16:13:48 +00:00
|
|
|
MUIDisplayError(ERROR_SOURCE_PATH, Ir, POPUP_WAIT_ENTER);
|
2019-02-25 19:29:16 +00:00
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
2017-08-25 14:38:12 +00:00
|
|
|
}
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (CurrentPartition == PartitionList->SystemPartition ||
|
2019-08-24 23:32:46 +00:00
|
|
|
IsPartitionActive(CurrentPartition))
|
[USETUP]
- bootsup.c/.h, usetup.c: Save the old MBR sector in the system partition (this makes easier to restore the old one).
- fslist.c/.h, usetup.h: Fix header inclusion order.
- partlist.c/.h, usetup.c: On BIOS-PC architectures, the system partition can be formatted in any FS as long as it is the active partition (on the contrary, on architectures where such system partition is required, it is formatted in FAT). We currently do not have write support for all FSes out there (apart for FAT until now), so do a "clever" "trick" to work around this problem: on initialized disks, find the active partition and check its FS. If we support write access to this FS then we're OK, otherwise we change the (active) system partition for the one on which we are going to install ReactOS (which is, by construction, formatted with a FS on which we support write access).
The MBR (resp. the VBR) of the disk (resp. of the system partition) are always saved into files, making easy for people to boot on them (using FreeLdr) or restoring them.
CORE-10898
svn path=/trunk/; revision=70837
2016-03-01 15:00:56 +00:00
|
|
|
{
|
2015-08-09 13:14:00 +00:00
|
|
|
return CONFIRM_DELETE_SYSTEM_PARTITION_PAGE;
|
[USETUP]
- bootsup.c/.h, usetup.c: Save the old MBR sector in the system partition (this makes easier to restore the old one).
- fslist.c/.h, usetup.h: Fix header inclusion order.
- partlist.c/.h, usetup.c: On BIOS-PC architectures, the system partition can be formatted in any FS as long as it is the active partition (on the contrary, on architectures where such system partition is required, it is formatted in FAT). We currently do not have write support for all FSes out there (apart for FAT until now), so do a "clever" "trick" to work around this problem: on initialized disks, find the active partition and check its FS. If we support write access to this FS then we're OK, otherwise we change the (active) system partition for the one on which we are going to install ReactOS (which is, by construction, formatted with a FS on which we support write access).
The MBR (resp. the VBR) of the disk (resp. of the system partition) are always saved into files, making easy for people to boot on them (using FreeLdr) or restoring them.
CORE-10898
svn path=/trunk/; revision=70837
2016-03-01 15:00:56 +00:00
|
|
|
}
|
2015-08-09 13:14:00 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return DELETE_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return SELECT_PARTITION_PAGE;
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2018-05-19 10:09:12 +00:00
|
|
|
#define PARTITION_SIZE_INPUT_FIELD_LENGTH 9
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Restriction for MaxSize */
|
2018-05-19 10:09:12 +00:00
|
|
|
#define PARTITION_MAXSIZE (pow(10, (PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)) - 1)
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
|
|
|
static VOID
|
2003-08-05 20:39:24 +00:00
|
|
|
ShowPartitionSizeInputBox(SHORT Left,
|
2010-06-11 21:21:27 +00:00
|
|
|
SHORT Top,
|
|
|
|
SHORT Right,
|
|
|
|
SHORT Bottom,
|
|
|
|
ULONG MaxSize,
|
2018-05-19 11:30:20 +00:00
|
|
|
PWSTR InputBuffer,
|
2010-06-11 21:21:27 +00:00
|
|
|
PBOOLEAN Quit,
|
|
|
|
PBOOLEAN Cancel)
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
INPUT_RECORD Ir;
|
|
|
|
COORD coPos;
|
|
|
|
DWORD Written;
|
2016-02-02 02:23:56 +00:00
|
|
|
CHAR Buffer[128];
|
2018-05-19 11:30:20 +00:00
|
|
|
INT Length, Pos;
|
2015-05-04 20:50:51 +00:00
|
|
|
WCHAR ch;
|
2008-01-07 16:50:40 +00:00
|
|
|
SHORT iLeft;
|
|
|
|
SHORT iTop;
|
|
|
|
|
|
|
|
if (Quit != NULL)
|
|
|
|
*Quit = FALSE;
|
|
|
|
|
|
|
|
if (Cancel != NULL)
|
|
|
|
*Cancel = FALSE;
|
|
|
|
|
|
|
|
DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1);
|
|
|
|
|
|
|
|
/* Print message */
|
|
|
|
coPos.X = Left + 2;
|
|
|
|
coPos.Y = Top + 2;
|
2010-06-11 21:21:27 +00:00
|
|
|
strcpy(Buffer, MUIGetString(STRING_PARTITIONSIZE));
|
2021-06-29 16:50:15 +00:00
|
|
|
iLeft = coPos.X + (USHORT)strlen(Buffer) + 1;
|
2008-01-07 16:50:40 +00:00
|
|
|
iTop = coPos.Y;
|
|
|
|
|
|
|
|
WriteConsoleOutputCharacterA(StdOutput,
|
|
|
|
Buffer,
|
2015-05-04 20:50:51 +00:00
|
|
|
strlen(Buffer),
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
sprintf(Buffer, MUIGetString(STRING_MAXSIZE), MaxSize);
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1;
|
|
|
|
coPos.Y = iTop;
|
|
|
|
WriteConsoleOutputCharacterA(StdOutput,
|
|
|
|
Buffer,
|
2015-05-04 20:50:51 +00:00
|
|
|
strlen(Buffer),
|
2008-01-07 16:50:40 +00:00
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
2018-05-19 11:30:20 +00:00
|
|
|
swprintf(InputBuffer, L"%lu", MaxSize);
|
|
|
|
Length = wcslen(InputBuffer);
|
2018-05-15 09:28:33 +00:00
|
|
|
Pos = Length;
|
2015-05-04 20:50:51 +00:00
|
|
|
CONSOLE_SetInputTextXY(iLeft,
|
|
|
|
iTop,
|
|
|
|
PARTITION_SIZE_INPUT_FIELD_LENGTH,
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(iLeft + Length, iTop);
|
|
|
|
CONSOLE_SetCursorType(TRUE, TRUE);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_ConInKey(&Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir.Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
|
|
|
if (Quit != NULL)
|
|
|
|
*Quit = TRUE;
|
|
|
|
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer[0] = UNICODE_NULL;
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2015-05-04 20:50:51 +00:00
|
|
|
else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-08-24 23:32:46 +00:00
|
|
|
else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
if (Cancel != NULL)
|
|
|
|
*Cancel = TRUE;
|
|
|
|
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer[0] = UNICODE_NULL;
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2018-05-15 09:28:33 +00:00
|
|
|
else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir.Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
Pos = 0;
|
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
|
|
|
else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir.Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
|
|
|
|
{
|
|
|
|
Pos = Length;
|
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
|
|
|
else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir.Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
|
|
|
|
{
|
|
|
|
if (Pos > 0)
|
|
|
|
{
|
|
|
|
Pos--;
|
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2018-05-15 09:28:33 +00:00
|
|
|
else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir.Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
if (Pos < Length)
|
|
|
|
{
|
|
|
|
Pos++;
|
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir.Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
|
|
|
|
{
|
|
|
|
if (Pos < Length)
|
|
|
|
{
|
2018-05-19 11:30:20 +00:00
|
|
|
memmove(&InputBuffer[Pos],
|
|
|
|
&InputBuffer[Pos + 1],
|
2018-05-15 09:28:33 +00:00
|
|
|
(Length - Pos - 1) * sizeof(WCHAR));
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer[Length - 1] = UNICODE_NULL;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-05-15 09:28:33 +00:00
|
|
|
Length--;
|
|
|
|
CONSOLE_SetInputTextXY(iLeft,
|
|
|
|
iTop,
|
|
|
|
PARTITION_SIZE_INPUT_FIELD_LENGTH,
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_BACK) /* BACKSPACE */
|
|
|
|
{
|
|
|
|
if (Pos > 0)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
if (Pos < Length)
|
2018-05-19 11:30:20 +00:00
|
|
|
memmove(&InputBuffer[Pos - 1],
|
|
|
|
&InputBuffer[Pos],
|
2018-05-15 09:28:33 +00:00
|
|
|
(Length - Pos) * sizeof(WCHAR));
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer[Length - 1] = UNICODE_NULL;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-05-15 09:28:33 +00:00
|
|
|
Pos--;
|
|
|
|
Length--;
|
2015-05-04 20:50:51 +00:00
|
|
|
CONSOLE_SetInputTextXY(iLeft,
|
|
|
|
iTop,
|
|
|
|
PARTITION_SIZE_INPUT_FIELD_LENGTH,
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Ir.Event.KeyEvent.uChar.AsciiChar != 0x00)
|
|
|
|
{
|
2018-05-19 10:09:12 +00:00
|
|
|
if (Length < PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)
|
2018-05-15 09:28:33 +00:00
|
|
|
{
|
|
|
|
ch = (WCHAR)Ir.Event.KeyEvent.uChar.AsciiChar;
|
|
|
|
|
|
|
|
if ((ch >= L'0') && (ch <= L'9'))
|
|
|
|
{
|
|
|
|
if (Pos < Length)
|
2018-05-19 11:30:20 +00:00
|
|
|
memmove(&InputBuffer[Pos + 1],
|
|
|
|
&InputBuffer[Pos],
|
2018-05-15 09:28:33 +00:00
|
|
|
(Length - Pos) * sizeof(WCHAR));
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer[Length + 1] = UNICODE_NULL;
|
|
|
|
InputBuffer[Pos] = ch;
|
2018-05-15 09:28:33 +00:00
|
|
|
|
|
|
|
Pos++;
|
|
|
|
Length++;
|
|
|
|
CONSOLE_SetInputTextXY(iLeft,
|
|
|
|
iTop,
|
|
|
|
PARTITION_SIZE_INPUT_FIELD_LENGTH,
|
2018-05-19 11:30:20 +00:00
|
|
|
InputBuffer);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(iLeft + Pos, iTop);
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the CreatePrimaryPartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SelectPartitionPage
|
|
|
|
* SelectFileSystemPage (default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
static PAGE_NUMBER
|
2014-05-20 23:48:36 +00:00
|
|
|
CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
PPARTENTRY PartEntry;
|
2019-03-05 00:42:33 +00:00
|
|
|
PDISKENTRY DiskEntry;
|
2008-01-07 16:50:40 +00:00
|
|
|
BOOLEAN Quit;
|
|
|
|
BOOLEAN Cancel;
|
|
|
|
ULONG MaxSize;
|
|
|
|
ULONGLONG PartSize;
|
2014-05-18 15:14:24 +00:00
|
|
|
ULONGLONG SectorCount;
|
2021-01-23 18:49:25 +00:00
|
|
|
WCHAR InputBuffer[50];
|
|
|
|
CHAR LineBuffer[100];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (PartitionList == NULL || CurrentPartition == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
2003-08-05 20:39:24 +00:00
|
|
|
}
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
|
|
|
DiskEntry = CurrentPartition->DiskEntry;
|
2003-08-05 20:39:24 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2003-08-05 20:39:24 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSENEWPARTITION));
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(6, 10, MUIGetString(STRING_HDINFOPARTCREATE_1),
|
|
|
|
LineBuffer);
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE));
|
2003-08-05 20:39:24 +00:00
|
|
|
|
|
|
|
#if 0
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
2003-08-05 20:39:24 +00:00
|
|
|
#endif
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
2008-01-07 16:50:40 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
2017-08-08 14:05:20 +00:00
|
|
|
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
|
2008-06-17 18:42:20 +00:00
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
if (MaxSize > PARTITION_MAXSIZE)
|
|
|
|
MaxSize = PARTITION_MAXSIZE;
|
2008-06-17 18:42:20 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
|
|
|
|
MaxSize, InputBuffer, &Quit, &Cancel);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (Quit)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2016-05-12 16:18:32 +00:00
|
|
|
|
|
|
|
break;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2017-08-09 20:39:45 +00:00
|
|
|
else if (Cancel)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-19 11:30:20 +00:00
|
|
|
PartSize = _wcstoui64(InputBuffer, NULL, 10);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if (PartSize < 1)
|
|
|
|
{
|
|
|
|
/* Too small */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (PartSize > MaxSize)
|
|
|
|
{
|
|
|
|
/* Too large */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert to bytes */
|
|
|
|
if (PartSize == MaxSize)
|
|
|
|
{
|
|
|
|
/* Use all of the unpartitioned disk space */
|
2014-05-18 15:14:24 +00:00
|
|
|
SectorCount = PartEntry->SectorCount.QuadPart;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
/* Calculate the sector count from the size in MB */
|
2017-08-08 14:05:20 +00:00
|
|
|
SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
/* But never get larger than the unpartitioned disk space */
|
2014-05-18 15:14:24 +00:00
|
|
|
if (SectorCount > PartEntry->SectorCount.QuadPart)
|
|
|
|
SectorCount = PartEntry->SectorCount.QuadPart;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DPRINT ("Partition size: %I64u bytes\n", PartSize);
|
|
|
|
|
2014-05-20 23:48:36 +00:00
|
|
|
CreatePrimaryPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
2014-05-20 23:48:36 +00:00
|
|
|
SectorCount,
|
|
|
|
FALSE);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2015-01-04 13:53:45 +00:00
|
|
|
return SELECT_PARTITION_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-20 23:48:36 +00:00
|
|
|
return CREATE_PRIMARY_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the CreateExtendedPartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SelectPartitionPage (default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2014-05-20 23:48:36 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
|
|
|
PPARTENTRY PartEntry;
|
2019-03-05 00:42:33 +00:00
|
|
|
PDISKENTRY DiskEntry;
|
2014-05-20 23:48:36 +00:00
|
|
|
BOOLEAN Quit;
|
|
|
|
BOOLEAN Cancel;
|
|
|
|
ULONG MaxSize;
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
ULONGLONG SectorCount;
|
2021-01-23 18:49:25 +00:00
|
|
|
WCHAR InputBuffer[50];
|
|
|
|
CHAR LineBuffer[100];
|
2014-05-20 23:48:36 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (PartitionList == NULL || CurrentPartition == NULL)
|
2014-05-20 23:48:36 +00:00
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
|
|
|
DiskEntry = CurrentPartition->DiskEntry;
|
2014-05-20 23:48:36 +00:00
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_EXTENDED_PARTITION));
|
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(6, 10, MUIGetString(STRING_HDINFOPARTCREATE_1),
|
|
|
|
LineBuffer);
|
2014-05-20 23:48:36 +00:00
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE));
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
2014-05-20 23:48:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
2014-05-20 23:48:36 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
2017-08-08 14:05:20 +00:00
|
|
|
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
|
2014-05-20 23:48:36 +00:00
|
|
|
|
|
|
|
if (MaxSize > PARTITION_MAXSIZE)
|
|
|
|
MaxSize = PARTITION_MAXSIZE;
|
|
|
|
|
|
|
|
ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
|
|
|
|
MaxSize, InputBuffer, &Quit, &Cancel);
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (Quit)
|
2014-05-20 23:48:36 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2014-05-20 23:48:36 +00:00
|
|
|
return QUIT_PAGE;
|
2016-05-12 16:18:32 +00:00
|
|
|
|
|
|
|
break;
|
2014-05-20 23:48:36 +00:00
|
|
|
}
|
2017-08-09 20:39:45 +00:00
|
|
|
else if (Cancel)
|
2014-05-20 23:48:36 +00:00
|
|
|
{
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-19 11:30:20 +00:00
|
|
|
PartSize = _wcstoui64(InputBuffer, NULL, 10);
|
2014-05-20 23:48:36 +00:00
|
|
|
|
|
|
|
if (PartSize < 1)
|
|
|
|
{
|
|
|
|
/* Too small */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (PartSize > MaxSize)
|
|
|
|
{
|
|
|
|
/* Too large */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert to bytes */
|
|
|
|
if (PartSize == MaxSize)
|
|
|
|
{
|
|
|
|
/* Use all of the unpartitioned disk space */
|
|
|
|
SectorCount = PartEntry->SectorCount.QuadPart;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Calculate the sector count from the size in MB */
|
2017-08-08 14:05:20 +00:00
|
|
|
SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
|
2014-05-20 23:48:36 +00:00
|
|
|
|
|
|
|
/* But never get larger than the unpartitioned disk space */
|
|
|
|
if (SectorCount > PartEntry->SectorCount.QuadPart)
|
|
|
|
SectorCount = PartEntry->SectorCount.QuadPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
DPRINT ("Partition size: %I64u bytes\n", PartSize);
|
|
|
|
|
|
|
|
CreateExtendedPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
2014-05-20 23:48:36 +00:00
|
|
|
SectorCount);
|
|
|
|
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CREATE_EXTENDED_PARTITION_PAGE;
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
}
|
2003-08-04 15:54:05 +00:00
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the CreateLogicalPartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SelectFileSystemPage (default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2014-06-08 19:05:03 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2014-06-09 01:49:24 +00:00
|
|
|
PPARTENTRY PartEntry;
|
2019-03-05 00:42:33 +00:00
|
|
|
PDISKENTRY DiskEntry;
|
2014-06-09 01:49:24 +00:00
|
|
|
BOOLEAN Quit;
|
|
|
|
BOOLEAN Cancel;
|
|
|
|
ULONG MaxSize;
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
ULONGLONG SectorCount;
|
2021-01-23 18:49:25 +00:00
|
|
|
WCHAR InputBuffer[50];
|
|
|
|
CHAR LineBuffer[100];
|
2014-06-08 19:05:03 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (PartitionList == NULL || CurrentPartition == NULL)
|
2014-06-09 01:49:24 +00:00
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
|
|
|
DiskEntry = CurrentPartition->DiskEntry;
|
2014-06-09 01:49:24 +00:00
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_LOGICAL_PARTITION));
|
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(6, 10, MUIGetString(STRING_HDINFOPARTCREATE_1),
|
|
|
|
LineBuffer);
|
2014-06-09 01:49:24 +00:00
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE));
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
2014-06-09 01:49:24 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
2014-06-09 01:49:24 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
2017-08-08 14:05:20 +00:00
|
|
|
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
|
2014-06-09 01:49:24 +00:00
|
|
|
|
|
|
|
if (MaxSize > PARTITION_MAXSIZE)
|
|
|
|
MaxSize = PARTITION_MAXSIZE;
|
|
|
|
|
|
|
|
ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
|
|
|
|
MaxSize, InputBuffer, &Quit, &Cancel);
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (Quit)
|
2014-06-09 01:49:24 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2014-06-09 01:49:24 +00:00
|
|
|
return QUIT_PAGE;
|
2016-05-12 16:18:32 +00:00
|
|
|
|
|
|
|
break;
|
2014-06-09 01:49:24 +00:00
|
|
|
}
|
2017-08-09 20:39:45 +00:00
|
|
|
else if (Cancel)
|
2014-06-09 01:49:24 +00:00
|
|
|
{
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-19 11:30:20 +00:00
|
|
|
PartSize = _wcstoui64(InputBuffer, NULL, 10);
|
2014-06-09 01:49:24 +00:00
|
|
|
|
|
|
|
if (PartSize < 1)
|
|
|
|
{
|
|
|
|
/* Too small */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (PartSize > MaxSize)
|
|
|
|
{
|
|
|
|
/* Too large */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert to bytes */
|
|
|
|
if (PartSize == MaxSize)
|
|
|
|
{
|
|
|
|
/* Use all of the unpartitioned disk space */
|
|
|
|
SectorCount = PartEntry->SectorCount.QuadPart;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Calculate the sector count from the size in MB */
|
2017-08-08 14:05:20 +00:00
|
|
|
SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
|
2014-06-09 01:49:24 +00:00
|
|
|
|
|
|
|
/* But never get larger than the unpartitioned disk space */
|
|
|
|
if (SectorCount > PartEntry->SectorCount.QuadPart)
|
|
|
|
SectorCount = PartEntry->SectorCount.QuadPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
DPRINT("Partition size: %I64u bytes\n", PartSize);
|
|
|
|
|
|
|
|
CreateLogicalPartition(PartitionList,
|
2019-03-05 00:42:33 +00:00
|
|
|
CurrentPartition,
|
2015-07-04 16:04:09 +00:00
|
|
|
SectorCount,
|
|
|
|
FALSE);
|
2014-06-09 01:49:24 +00:00
|
|
|
|
2015-01-04 13:53:45 +00:00
|
|
|
return SELECT_PARTITION_PAGE;
|
2014-06-09 01:49:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CREATE_LOGICAL_PARTITION_PAGE;
|
2014-06-08 19:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the ConfirmDeleteSystemPartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* DeletePartitionPage (default)
|
|
|
|
* SelectPartitionPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2015-08-09 13:14:00 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
|
|
|
MUIDisplayPage(CONFIRM_DELETE_SYSTEM_PARTITION_PAGE);
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2015-08-09 13:14:00 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
|
|
|
{
|
|
|
|
return DELETE_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
|
|
|
{
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-12 16:18:32 +00:00
|
|
|
return CONFIRM_DELETE_SYSTEM_PARTITION_PAGE;
|
2015-08-09 13:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the DeletePartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SelectPartitionPage (default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-08-04 15:54:05 +00:00
|
|
|
static PAGE_NUMBER
|
2010-06-11 21:21:27 +00:00
|
|
|
DeletePartitionPage(PINPUT_RECORD Ir)
|
2003-08-04 15:54:05 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
PPARTENTRY PartEntry;
|
2019-03-05 00:42:33 +00:00
|
|
|
PDISKENTRY DiskEntry;
|
2021-01-23 18:49:25 +00:00
|
|
|
CHAR LineBuffer[100];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (PartitionList == NULL || CurrentPartition == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
2003-08-05 20:39:24 +00:00
|
|
|
}
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
PartEntry = CurrentPartition;
|
|
|
|
DiskEntry = CurrentPartition->DiskEntry;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(DELETE_PARTITION_PAGE);
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(6, 10, " %s", LineBuffer);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(6, 12, MUIGetString(STRING_HDINFOPARTDELETE_1),
|
|
|
|
LineBuffer);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
|
|
|
{
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
2019-06-28 13:45:32 +00:00
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
DeletePartition(PartitionList,
|
|
|
|
CurrentPartition,
|
|
|
|
&CurrentPartition);
|
2008-01-07 16:50:40 +00:00
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DELETE_PARTITION_PAGE;
|
2003-08-04 15:54:05 +00:00
|
|
|
}
|
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
static VOID
|
|
|
|
ResetFileSystemList(VOID)
|
|
|
|
{
|
|
|
|
if (!FileSystemList)
|
|
|
|
return;
|
|
|
|
|
|
|
|
DestroyFileSystemList(FileSystemList);
|
|
|
|
FileSystemList = NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the SelectFileSystemPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* CheckFileSystemPage (At once if RepairUpdate is selected)
|
2017-08-09 20:39:45 +00:00
|
|
|
* CheckFileSystemPage (At once if Unattended and not USetupData.FormatPartition)
|
|
|
|
* FormatPartitionPage (At once if Unattended and USetupData.FormatPartition)
|
2015-12-06 20:14:29 +00:00
|
|
|
* SelectPartitionPage (If the user aborts)
|
|
|
|
* FormatPartitionPage (Default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2018-11-18 18:07:23 +00:00
|
|
|
* Calls UpdatePartitionType()
|
2019-08-25 00:08:23 +00:00
|
|
|
* Calls FindSupportedSystemPartition()
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2010-06-11 21:21:27 +00:00
|
|
|
SelectFileSystemPage(PINPUT_RECORD Ir)
|
2002-09-25 14:48:35 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
PPARTENTRY PartEntry;
|
2019-03-05 00:42:33 +00:00
|
|
|
PDISKENTRY DiskEntry;
|
2016-07-03 14:57:21 +00:00
|
|
|
FORMATMACHINESTATE PreviousFormatState;
|
2019-02-25 19:29:16 +00:00
|
|
|
PCWSTR DefaultFs;
|
2021-01-23 18:49:25 +00:00
|
|
|
CHAR LineBuffer[100];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
DPRINT("SelectFileSystemPage()\n");
|
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (PartitionList == NULL || InstallPartition == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Find or set the active system partition when starting formatting */
|
|
|
|
if (FormatState == Start)
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
2019-08-25 00:08:23 +00:00
|
|
|
/*
|
|
|
|
* If we install on a fixed disk, try to find a supported system
|
|
|
|
* partition on the system. Otherwise if we install on a removable disk
|
|
|
|
* use the install partition as the system partition.
|
|
|
|
*/
|
|
|
|
if (InstallPartition->DiskEntry->MediaType == FixedMedia)
|
|
|
|
{
|
|
|
|
SystemPartition = FindSupportedSystemPartition(PartitionList,
|
|
|
|
FALSE,
|
|
|
|
InstallPartition->DiskEntry,
|
|
|
|
InstallPartition);
|
|
|
|
/* Use the original system partition as the old active partition hint */
|
|
|
|
PartEntry = PartitionList->SystemPartition;
|
|
|
|
|
|
|
|
if ( SystemPartition && PartitionList->SystemPartition &&
|
|
|
|
(SystemPartition != PartitionList->SystemPartition) )
|
|
|
|
{
|
|
|
|
DPRINT1("We are using a different system partition!!!!\n");
|
|
|
|
|
|
|
|
MUIDisplayPage(CHANGE_SYSTEM_PARTITION);
|
|
|
|
|
|
|
|
{
|
|
|
|
PPARTENTRY PartEntry; // Shadow variable
|
|
|
|
|
|
|
|
PartEntry = PartitionList->SystemPartition;
|
|
|
|
DiskEntry = PartEntry->DiskEntry;
|
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_SetTextXY(8, 10, LineBuffer);
|
2019-08-25 00:08:23 +00:00
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(8, 14, MUIGetString(STRING_HDINFOPARTCREATE_1),
|
|
|
|
LineBuffer);
|
2019-08-25 00:08:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
PartEntry = SystemPartition;
|
|
|
|
DiskEntry = PartEntry->DiskEntry;
|
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_SetTextXY(8, 23, LineBuffer);
|
2019-08-25 00:08:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
|
|
|
{
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CONSOLE_ClearScreen();
|
|
|
|
CONSOLE_Flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // if (InstallPartition->DiskEntry->MediaType == RemovableMedia)
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
2019-08-25 00:08:23 +00:00
|
|
|
SystemPartition = InstallPartition;
|
|
|
|
/* Don't specify any old active partition hint */
|
|
|
|
PartEntry = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!SystemPartition)
|
|
|
|
{
|
|
|
|
/* FIXME: improve the error dialog */
|
2019-02-25 19:29:16 +00:00
|
|
|
//
|
|
|
|
// Error dialog should say that we cannot find a suitable
|
|
|
|
// system partition and create one on the system. At this point,
|
|
|
|
// it may be nice to ask the user whether he wants to continue,
|
|
|
|
// or use an external drive as the system drive/partition
|
|
|
|
// (e.g. floppy, USB drive, etc...)
|
|
|
|
//
|
2019-08-25 00:08:23 +00:00
|
|
|
PopupError("The ReactOS Setup could not find a supported system partition\n"
|
|
|
|
"on your system or could not create a new one. Without such partition\n"
|
|
|
|
"the Setup program cannot install ReactOS.\n"
|
|
|
|
"Press ENTER to return to the partition selection list.",
|
|
|
|
MUIGetString(STRING_CONTINUE),
|
|
|
|
Ir, POPUP_WAIT_ENTER);
|
|
|
|
return SELECT_PARTITION_PAGE;
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the system partition can be created in some
|
|
|
|
* non-partitioned space, create it now.
|
|
|
|
*/
|
2019-08-24 23:32:46 +00:00
|
|
|
if (!SystemPartition->IsPartitioned)
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
CreatePrimaryPartition(PartitionList,
|
|
|
|
SystemPartition,
|
|
|
|
0LL, // SystemPartition->SectorCount.QuadPart,
|
|
|
|
TRUE);
|
|
|
|
ASSERT(SystemPartition->IsPartitioned);
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
|
|
|
|
2019-08-25 00:08:23 +00:00
|
|
|
/* Set it as such */
|
|
|
|
if (!SetActivePartition(PartitionList, SystemPartition, PartEntry))
|
|
|
|
{
|
|
|
|
DPRINT1("SetActivePartition(0x%p) failed?!\n", SystemPartition);
|
|
|
|
ASSERT(FALSE);
|
|
|
|
}
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Commit all partition changes to all the disks */
|
|
|
|
if (!WritePartitionsToDisk(PartitionList))
|
|
|
|
{
|
|
|
|
DPRINT("WritePartitionsToDisk() failed\n");
|
|
|
|
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* In all cases, whether or not we are going to perform a formatting,
|
|
|
|
* we must perform a filesystem check of both the system and the
|
|
|
|
* installation partitions.
|
|
|
|
*/
|
2019-03-05 00:42:33 +00:00
|
|
|
InstallPartition->NeedsCheck = TRUE;
|
2019-08-24 23:32:46 +00:00
|
|
|
if (SystemPartition != InstallPartition)
|
|
|
|
SystemPartition->NeedsCheck = TRUE;
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In case we just repair an existing installation, or make
|
|
|
|
* an unattended setup without formatting, just go to the
|
|
|
|
* filesystem check step.
|
|
|
|
*/
|
|
|
|
if (RepairUpdateFlag)
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
|
|
|
|
|
|
|
if (IsUnattendedSetup && !USetupData.FormatPartition)
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2015-06-12 21:51:57 +00:00
|
|
|
}
|
|
|
|
|
2019-08-24 23:32:46 +00:00
|
|
|
// ASSERT(SystemPartition->IsPartitioned);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/* Reset the filesystem list for each partition that is to be formatted */
|
|
|
|
ResetFileSystemList();
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
PreviousFormatState = FormatState;
|
|
|
|
switch (FormatState)
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
|
|
|
case Start:
|
2017-05-18 01:05:39 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
/*
|
|
|
|
* We start by formatting the system partition in case it is new
|
|
|
|
* (it didn't exist before) and is not the same as the installation
|
|
|
|
* partition. Otherwise we just require a filesystem check on it,
|
|
|
|
* and start by formatting the installation partition instead.
|
|
|
|
*/
|
|
|
|
|
2019-08-24 23:32:46 +00:00
|
|
|
ASSERT(SystemPartition->IsPartitioned);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
2019-08-24 23:32:46 +00:00
|
|
|
if ((SystemPartition != InstallPartition) &&
|
|
|
|
(SystemPartition->FormatState == Unformatted))
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
2019-08-24 23:32:46 +00:00
|
|
|
TempPartition = SystemPartition;
|
2017-05-18 01:05:39 +00:00
|
|
|
TempPartition->NeedsCheck = TRUE;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
// TODO: Should we let the user using a custom file-system,
|
|
|
|
// or should we always use FAT(32) for it?
|
|
|
|
// For "compatibility", FAT(32) would be best indeed.
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = FormatSystemPartition;
|
2015-06-12 21:51:57 +00:00
|
|
|
DPRINT1("FormatState: Start --> FormatSystemPartition\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
TempPartition = InstallPartition;
|
2017-05-18 01:05:39 +00:00
|
|
|
TempPartition->NeedsCheck = TRUE;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
2019-08-24 23:32:46 +00:00
|
|
|
if (SystemPartition != InstallPartition)
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
|
|
|
/* The system partition is separate, so it had better be formatted! */
|
2019-08-24 23:32:46 +00:00
|
|
|
ASSERT((SystemPartition->FormatState == Preformatted) ||
|
|
|
|
(SystemPartition->FormatState == Formatted));
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/* Require a filesystem check on the system partition too */
|
2019-08-24 23:32:46 +00:00
|
|
|
SystemPartition->NeedsCheck = TRUE;
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = FormatInstallPartition;
|
2015-06-12 21:51:57 +00:00
|
|
|
DPRINT1("FormatState: Start --> FormatInstallPartition\n");
|
|
|
|
}
|
|
|
|
break;
|
2017-05-18 01:05:39 +00:00
|
|
|
}
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
|
|
case FormatSystemPartition:
|
2017-05-18 01:05:39 +00:00
|
|
|
{
|
2019-03-05 00:42:33 +00:00
|
|
|
TempPartition = InstallPartition;
|
2017-05-18 01:05:39 +00:00
|
|
|
TempPartition->NeedsCheck = TRUE;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = FormatInstallPartition;
|
2015-06-12 21:51:57 +00:00
|
|
|
DPRINT1("FormatState: FormatSystemPartition --> FormatInstallPartition\n");
|
|
|
|
break;
|
2017-05-18 01:05:39 +00:00
|
|
|
}
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
|
|
case FormatInstallPartition:
|
2019-02-25 19:29:16 +00:00
|
|
|
case FormatOtherPartition:
|
2017-05-18 01:05:39 +00:00
|
|
|
{
|
2015-06-12 21:51:57 +00:00
|
|
|
if (GetNextUnformattedPartition(PartitionList,
|
2017-05-13 16:40:30 +00:00
|
|
|
NULL,
|
2017-05-18 01:05:39 +00:00
|
|
|
&TempPartition))
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = FormatOtherPartition;
|
|
|
|
TempPartition->NeedsCheck = TRUE;
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
if (FormatState == FormatInstallPartition)
|
|
|
|
DPRINT1("FormatState: FormatInstallPartition --> FormatOtherPartition\n");
|
|
|
|
else
|
|
|
|
DPRINT1("FormatState: FormatOtherPartition --> FormatOtherPartition\n");
|
2015-06-12 21:51:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = FormatDone;
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
if (FormatState == FormatInstallPartition)
|
|
|
|
DPRINT1("FormatState: FormatInstallPartition --> FormatDone\n");
|
|
|
|
else
|
|
|
|
DPRINT1("FormatState: FormatOtherPartition --> FormatDone\n");
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
|
|
|
}
|
|
|
|
break;
|
2017-05-18 01:05:39 +00:00
|
|
|
}
|
2015-06-12 21:51:57 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
case FormatDone:
|
2017-05-18 01:05:39 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
DPRINT1("FormatState: FormatDone\n");
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2017-05-18 01:05:39 +00:00
|
|
|
}
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
|
|
default:
|
2017-05-18 01:05:39 +00:00
|
|
|
{
|
|
|
|
DPRINT1("FormatState: Invalid value %ld\n", FormatState);
|
2019-08-24 23:32:46 +00:00
|
|
|
ASSERT(FALSE);
|
2015-06-12 21:51:57 +00:00
|
|
|
return QUIT_PAGE;
|
2017-05-18 01:05:39 +00:00
|
|
|
}
|
2015-06-12 21:51:57 +00:00
|
|
|
}
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
PartEntry = TempPartition;
|
2019-03-05 00:42:33 +00:00
|
|
|
DiskEntry = TempPartition->DiskEntry;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2019-02-24 18:04:57 +00:00
|
|
|
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
|
|
|
|
|
2017-08-25 14:38:12 +00:00
|
|
|
MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE);
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (PartEntry->AutoCreate)
|
2002-10-18 20:04:00 +00:00
|
|
|
{
|
2008-02-16 18:58:05 +00:00
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NEWPARTITION));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
#if 0
|
2021-01-23 18:49:25 +00:00
|
|
|
PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_SetTextXY(8, 10, LineBuffer);
|
2008-01-07 16:50:40 +00:00
|
|
|
#endif
|
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(8, 10, MUIGetString(STRING_HDINFOPARTCREATE_1),
|
|
|
|
LineBuffer);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_PARTFORMAT));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
PartEntry->AutoCreate = FALSE;
|
2002-10-18 20:04:00 +00:00
|
|
|
}
|
2017-08-09 20:39:45 +00:00
|
|
|
else if (PartEntry->New)
|
2002-10-18 20:04:00 +00:00
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
switch (FormatState)
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
|
|
|
case FormatSystemPartition:
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDSYSTEMPART));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FormatInstallPartition:
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDPART));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FormatOtherPartition:
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDOTHERPART));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2019-08-24 23:32:46 +00:00
|
|
|
ASSERT(FALSE);
|
2015-06-12 21:51:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(8, 10, MUIGetString(STRING_HDINFOPARTCREATE_1),
|
|
|
|
LineBuffer);
|
2019-08-24 23:32:46 +00:00
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_PARTFORMAT));
|
2002-10-18 20:04:00 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else
|
2002-10-18 20:04:00 +00:00
|
|
|
{
|
2015-01-04 13:53:45 +00:00
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_INSTALLONPART));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2021-01-23 18:49:25 +00:00
|
|
|
PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_SetTextXY(8, 10, LineBuffer);
|
|
|
|
|
|
|
|
DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
|
|
|
|
CONSOLE_PrintTextXY(6, 12, MUIGetString(STRING_HDINFOPARTDELETE_1),
|
|
|
|
LineBuffer);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
ASSERT(FileSystemList == NULL);
|
|
|
|
|
|
|
|
if (IsUnattendedSetup)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
ASSERT(USetupData.FormatPartition);
|
2018-12-28 19:34:48 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
switch (USetupData.FsType)
|
2018-12-28 19:34:48 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
/* 1 is for BtrFS */
|
|
|
|
case 1:
|
|
|
|
DefaultFs = L"BTRFS";
|
|
|
|
break;
|
2018-12-28 19:34:48 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* If we don't understand input, default to FAT */
|
|
|
|
default:
|
|
|
|
DefaultFs = L"FAT";
|
|
|
|
break;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2002-10-18 20:04:00 +00:00
|
|
|
}
|
2019-02-25 19:29:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* By default select the "FAT" file system */
|
|
|
|
DefaultFs = L"FAT";
|
|
|
|
}
|
2014-05-18 15:14:24 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Create the file system list */
|
|
|
|
// TODO: Display only the FSes compatible with the selected partition!
|
|
|
|
FileSystemList = CreateFileSystemList(6, 26,
|
|
|
|
PartEntry->New ||
|
|
|
|
PartEntry->FormatState == Unformatted,
|
|
|
|
DefaultFs);
|
|
|
|
if (FileSystemList == NULL)
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if (IsUnattendedSetup)
|
2002-10-18 20:04:00 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
ASSERT(USetupData.FormatPartition);
|
|
|
|
return FORMAT_PARTITION_PAGE;
|
2002-10-18 20:04:00 +00:00
|
|
|
}
|
|
|
|
|
2017-05-21 23:17:24 +00:00
|
|
|
DrawFileSystemList(FileSystemList);
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
while (TRUE)
|
2003-08-09 16:32:26 +00:00
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
2002-11-28 19:20:38 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-01-02 18:34:22 +00:00
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Reset the formatter machine state */
|
|
|
|
TempPartition = NULL;
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = Start;
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
|
|
|
{
|
2010-06-11 21:21:27 +00:00
|
|
|
ScrollDownFileSystemList(FileSystemList);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
|
|
|
{
|
2010-06-11 21:21:27 +00:00
|
|
|
ScrollUpFileSystemList(FileSystemList);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
|
|
|
{
|
[SETUPLIB][USETUP] Introduce a 'SetupLib' library. CORE-13544
- Create the beginnings of a "setuplib" library, whose aim is to be shared between the (currently existing) 1st-stage text-mode installer, and the (future) 1st-stage GUI installer.
- Finish to split the GenList and PartList codes into their UI part, which remain in usetup, and their algorithmic part, which go into setuplib.
- Move SetMountedDeviceValue into the PartList module.
- Split the FileSystem list code into its UI and the algorithmic part (which goes into setuplib under the name fsutil.c).
* The algo part is meant to be able to manage the filesystems available on the running system, similarly to what is mostly done (in scattered form) in fmifs, format, chkdsk / autochk codes...
It also manages the partition filesystem recognition, using OS routines.
* The UI part manages the FS list as it appears on screen, showing only the possible FSes that can be used to format the selected partition (a bit similar to what we do in the shell32's drive.c, etc...).
- Adapt the calling code to these changes.
- Remove some "host" code that was dating back from the dark old times.
svn path=/branches/setup_improvements/; revision=74570
svn path=/branches/setup_improvements/; revision=74659
2017-05-17 23:37:41 +00:00
|
|
|
if (!FileSystemList->Selected->FileSystem)
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
|
|
|
ASSERT(!TempPartition->New && TempPartition->FormatState != Unformatted);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip formatting this partition. We will also ignore
|
|
|
|
* filesystem checks on it, unless it is either the system
|
|
|
|
* or the installation partition.
|
|
|
|
*/
|
2019-08-24 23:32:46 +00:00
|
|
|
if (TempPartition != SystemPartition &&
|
2019-03-05 00:42:33 +00:00
|
|
|
TempPartition != InstallPartition)
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
|
|
|
PartEntry->NeedsCheck = FALSE;
|
|
|
|
}
|
|
|
|
|
2017-05-13 16:23:08 +00:00
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
|
|
|
/* Format this partition */
|
2008-01-07 16:50:40 +00:00
|
|
|
return FORMAT_PARTITION_PAGE;
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
FormatState = PreviousFormatState;
|
2016-07-03 14:57:21 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
|
|
|
|
2003-05-06 07:17:52 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the FormatPartitionPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* InstallDirectoryPage (At once if IsUnattendedSetup or InstallShortcut)
|
|
|
|
* SelectPartitionPage (At once)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2019-03-05 00:42:33 +00:00
|
|
|
* Sets InstallPartition->FormatState
|
2017-08-09 20:39:45 +00:00
|
|
|
* Sets USetupData.DestinationRootPath
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2017-05-15 16:22:18 +00:00
|
|
|
static PAGE_NUMBER
|
2010-06-11 21:21:27 +00:00
|
|
|
FormatPartitionPage(PINPUT_RECORD Ir)
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
{
|
2017-12-23 19:17:38 +00:00
|
|
|
NTSTATUS Status;
|
2008-01-07 16:50:40 +00:00
|
|
|
PPARTENTRY PartEntry;
|
2019-03-05 00:42:33 +00:00
|
|
|
PDISKENTRY DiskEntry;
|
[SETUPLIB][USETUP] Introduce a 'SetupLib' library. CORE-13544
- Create the beginnings of a "setuplib" library, whose aim is to be shared between the (currently existing) 1st-stage text-mode installer, and the (future) 1st-stage GUI installer.
- Finish to split the GenList and PartList codes into their UI part, which remain in usetup, and their algorithmic part, which go into setuplib.
- Move SetMountedDeviceValue into the PartList module.
- Split the FileSystem list code into its UI and the algorithmic part (which goes into setuplib under the name fsutil.c).
* The algo part is meant to be able to manage the filesystems available on the running system, similarly to what is mostly done (in scattered form) in fmifs, format, chkdsk / autochk codes...
It also manages the partition filesystem recognition, using OS routines.
* The UI part manages the FS list as it appears on screen, showing only the possible FSes that can be used to format the selected partition (a bit similar to what we do in the shell32's drive.c, etc...).
- Adapt the calling code to these changes.
- Remove some "host" code that was dating back from the dark old times.
svn path=/branches/setup_improvements/; revision=74570
svn path=/branches/setup_improvements/; revision=74659
2017-05-17 23:37:41 +00:00
|
|
|
PFILE_SYSTEM_ITEM SelectedFileSystem;
|
2017-12-23 19:17:38 +00:00
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
|
|
|
CHAR Buffer[MAX_PATH];
|
2003-08-09 16:32:26 +00:00
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
DPRINT("FormatPartitionPage()\n");
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(FORMAT_PARTITION_PAGE);
|
2003-08-09 16:32:26 +00:00
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
if (PartitionList == NULL || TempPartition == NULL)
|
2003-08-09 16:32:26 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
2003-08-09 16:32:26 +00:00
|
|
|
}
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
PartEntry = TempPartition;
|
2019-03-05 00:42:33 +00:00
|
|
|
DiskEntry = TempPartition->DiskEntry;
|
2003-08-09 16:32:26 +00:00
|
|
|
|
2019-02-24 18:04:57 +00:00
|
|
|
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
SelectedFileSystem = FileSystemList->Selected;
|
2019-02-24 18:04:57 +00:00
|
|
|
ASSERT(SelectedFileSystem && SelectedFileSystem->FileSystem);
|
[SETUPLIB][USETUP] Introduce a 'SetupLib' library. CORE-13544
- Create the beginnings of a "setuplib" library, whose aim is to be shared between the (currently existing) 1st-stage text-mode installer, and the (future) 1st-stage GUI installer.
- Finish to split the GenList and PartList codes into their UI part, which remain in usetup, and their algorithmic part, which go into setuplib.
- Move SetMountedDeviceValue into the PartList module.
- Split the FileSystem list code into its UI and the algorithmic part (which goes into setuplib under the name fsutil.c).
* The algo part is meant to be able to manage the filesystems available on the running system, similarly to what is mostly done (in scattered form) in fmifs, format, chkdsk / autochk codes...
It also manages the partition filesystem recognition, using OS routines.
* The UI part manages the FS list as it appears on screen, showing only the possible FSes that can be used to format the selected partition (a bit similar to what we do in the shell32's drive.c, etc...).
- Adapt the calling code to these changes.
- Remove some "host" code that was dating back from the dark old times.
svn path=/branches/setup_improvements/; revision=74570
svn path=/branches/setup_improvements/; revision=74659
2017-05-17 23:37:41 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
if (!IsUnattendedSetup)
|
|
|
|
CONSOLE_ConInKey(Ir);
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2019-02-25 19:29:16 +00:00
|
|
|
{
|
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
|
2006-09-07 22:42:28 +00:00
|
|
|
{
|
[USETUP] Implement resource ID text based strings for MUI (#2193)
CORE-12683
Supersedes PR #612.
* [USETUP] Implement the internal MUI routines for text manipulation based on its ID and implement text resource based IDs
USETUP (the 1st stage text mode setup module) bases upon MUI (Multilingual User Interface) sub-component of USETUP which is responsible for the ability into translating the MUI pages (each page having corresponding properties like X, Y coordinates, text flags and text string buffer) in various languages.
The only problem, as of now, is that whenever you want to modify a certain property of a page, such as removing a text from the said page in the screen, you've got to rely on using CONSOLE_* specific functions and calling with hardcoded parameters, namely the coordinates.
This can become a problem as not every localized (translated) MUI page has the same properties for each language and this could lead to various issues. Therefore, assigning each entry with an ID you can remove a text by only giving its ID (and the entry page number) without having the need to specify the coordinates
as the internal MUI routine, MUIGetEntry(), automatically retrieves the entry with respective data fields.
The following commit implements:
- MUIGetEntry()
- MUIClearText()
- MUIClearStyledText()
- MUISetText()
- MUISetStyledText()
- Now the X and Y coordinate members of MUI_ENTRY are of SHORT integer type, for the sake of the general code as most of the coordination values, even the COORD structure itself, has the coordination points as SHORTs and not BYTEs.
The following MUI functions will be used to manipulate text based resources depending on their ID from the corresponding MUI entry.
* [USETUP] Make CONSOLE_ClearTextXY function public so that we can use across other files.
* [USETUP] Implement the IDs for each text MUI entry in locale files.
This mechanism follows the same principle of resource IDs in Win32 applications. Static text is merely a resource that doesn't get changed programmatically for whole of its lifetime whereas dynamic resources can change during the lifetime of the program depending on the algorithm (for example, hide that piece of text and set another one, etc.).
* [USETUP] Remove the "Press ENTER to continue" message prompt when the partition formatting begins.
2020-01-19 16:58:13 +00:00
|
|
|
/*
|
|
|
|
* Remove the "Press ENTER to continue" message prompt when the ENTER
|
|
|
|
* key is pressed as the user wants to begin the partition formatting.
|
2020-11-24 01:26:52 +00:00
|
|
|
*/
|
[USETUP] Implement resource ID text based strings for MUI (#2193)
CORE-12683
Supersedes PR #612.
* [USETUP] Implement the internal MUI routines for text manipulation based on its ID and implement text resource based IDs
USETUP (the 1st stage text mode setup module) bases upon MUI (Multilingual User Interface) sub-component of USETUP which is responsible for the ability into translating the MUI pages (each page having corresponding properties like X, Y coordinates, text flags and text string buffer) in various languages.
The only problem, as of now, is that whenever you want to modify a certain property of a page, such as removing a text from the said page in the screen, you've got to rely on using CONSOLE_* specific functions and calling with hardcoded parameters, namely the coordinates.
This can become a problem as not every localized (translated) MUI page has the same properties for each language and this could lead to various issues. Therefore, assigning each entry with an ID you can remove a text by only giving its ID (and the entry page number) without having the need to specify the coordinates
as the internal MUI routine, MUIGetEntry(), automatically retrieves the entry with respective data fields.
The following commit implements:
- MUIGetEntry()
- MUIClearText()
- MUIClearStyledText()
- MUISetText()
- MUISetStyledText()
- Now the X and Y coordinate members of MUI_ENTRY are of SHORT integer type, for the sake of the general code as most of the coordination values, even the COORD structure itself, has the coordination points as SHORTs and not BYTEs.
The following MUI functions will be used to manipulate text based resources depending on their ID from the corresponding MUI entry.
* [USETUP] Make CONSOLE_ClearTextXY function public so that we can use across other files.
* [USETUP] Implement the IDs for each text MUI entry in locale files.
This mechanism follows the same principle of resource IDs in Win32 applications. Static text is merely a resource that doesn't get changed programmatically for whole of its lifetime whereas dynamic resources can change during the lifetime of the program depending on the algorithm (for example, hide that piece of text and set another one, etc.).
* [USETUP] Remove the "Press ENTER to continue" message prompt when the partition formatting begins.
2020-01-19 16:58:13 +00:00
|
|
|
MUIClearStyledText(FORMAT_PARTITION_PAGE, TEXT_ID_FORMAT_PROMPT, TEXT_TYPE_REGULAR);
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
/* Format the partition */
|
|
|
|
Status = DoFormat(PartEntry,
|
|
|
|
SelectedFileSystem->FileSystem,
|
|
|
|
SelectedFileSystem->QuickFormat);
|
|
|
|
if (Status == STATUS_PARTITION_FAILURE)
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
2015-01-04 13:53:45 +00:00
|
|
|
return QUIT_PAGE;
|
2015-06-12 21:51:57 +00:00
|
|
|
}
|
2020-11-24 01:26:52 +00:00
|
|
|
else if (Status == STATUS_UNRECOGNIZED_VOLUME)
|
2015-01-04 13:53:45 +00:00
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
// MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
2015-01-04 13:53:45 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2020-11-24 01:26:52 +00:00
|
|
|
else if (Status == STATUS_NOT_SUPPORTED)
|
2006-09-07 22:42:28 +00:00
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
RtlStringCbPrintfA(Buffer,
|
|
|
|
sizeof(Buffer),
|
|
|
|
"Setup is currently unable to format a partition in %S.\n"
|
|
|
|
"\n"
|
|
|
|
" \x07 Press ENTER to continue Setup.\n"
|
|
|
|
" \x07 Press F3 to quit Setup.",
|
|
|
|
SelectedFileSystem->FileSystem);
|
2019-02-25 19:29:16 +00:00
|
|
|
|
|
|
|
PopupError(Buffer,
|
|
|
|
MUIGetString(STRING_QUITCONTINUE),
|
|
|
|
NULL, POPUP_WAIT_NONE);
|
|
|
|
|
|
|
|
while (TRUE)
|
2017-12-23 19:17:38 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2017-12-23 19:17:38 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
|
|
|
|
Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
|
|
|
|
{
|
|
|
|
if (ConfirmQuit(Ir))
|
2017-12-23 19:17:38 +00:00
|
|
|
{
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
|
|
|
return QUIT_PAGE;
|
2017-12-23 19:17:38 +00:00
|
|
|
}
|
2019-02-25 19:29:16 +00:00
|
|
|
else
|
2017-12-23 19:17:38 +00:00
|
|
|
{
|
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
|
|
|
}
|
|
|
|
}
|
2019-02-25 19:29:16 +00:00
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
|
|
|
|
{
|
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
|
|
|
}
|
2017-12-23 19:17:38 +00:00
|
|
|
}
|
2019-02-25 19:29:16 +00:00
|
|
|
}
|
|
|
|
else if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
/** HACK!! **/
|
|
|
|
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu",
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
PartEntry->PartitionNumber);
|
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status);
|
|
|
|
MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
|
|
|
|
|
|
|
|
/* Reset the filesystem list */
|
|
|
|
ResetFileSystemList();
|
|
|
|
return QUIT_PAGE;
|
2006-09-07 22:42:28 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2006-09-07 22:42:28 +00:00
|
|
|
}
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
}
|
|
|
|
|
2006-09-07 22:42:28 +00:00
|
|
|
return FORMAT_PARTITION_PAGE;
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the CheckFileSystemPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* InstallDirectoryPage (At once)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
|
|
|
* Inits or reloads FileSystemList
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2017-05-15 16:22:18 +00:00
|
|
|
static PAGE_NUMBER
|
2002-09-25 14:48:35 +00:00
|
|
|
CheckFileSystemPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2017-12-23 19:17:38 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
PPARTENTRY PartEntry;
|
2008-01-07 16:50:40 +00:00
|
|
|
CHAR Buffer[MAX_PATH];
|
|
|
|
|
2021-02-22 15:48:03 +00:00
|
|
|
MUIDisplayPage(CHECK_FILE_SYSTEM_PAGE);
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
if (PartitionList == NULL)
|
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry))
|
2015-06-12 21:51:57 +00:00
|
|
|
{
|
|
|
|
return INSTALL_DIRECTORY_PAGE;
|
|
|
|
}
|
|
|
|
|
2019-02-24 18:04:57 +00:00
|
|
|
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
|
|
|
|
|
2019-02-24 16:52:33 +00:00
|
|
|
DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
|
|
|
|
PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a"));
|
2016-02-27 20:49:17 +00:00
|
|
|
|
2019-02-24 16:52:33 +00:00
|
|
|
/* Check the partition */
|
2020-11-24 01:26:52 +00:00
|
|
|
Status = DoChkdsk(PartEntry);
|
2017-12-23 19:17:38 +00:00
|
|
|
if (Status == STATUS_NOT_SUPPORTED)
|
2002-09-25 14:48:35 +00:00
|
|
|
{
|
2019-02-24 16:52:33 +00:00
|
|
|
/*
|
|
|
|
* Partition checking is not supported with the current filesystem,
|
|
|
|
* so disable FS checks on it.
|
|
|
|
*/
|
|
|
|
PartEntry->NeedsCheck = FALSE;
|
|
|
|
|
2019-04-28 19:03:35 +00:00
|
|
|
RtlStringCbPrintfA(Buffer,
|
|
|
|
sizeof(Buffer),
|
|
|
|
"Setup is currently unable to check a partition formatted in %S.\n"
|
|
|
|
"\n"
|
|
|
|
" \x07 Press ENTER to continue Setup.\n"
|
|
|
|
" \x07 Press F3 to quit Setup.",
|
|
|
|
PartEntry->FileSystem);
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2006-09-09 17:11:03 +00:00
|
|
|
PopupError(Buffer,
|
2008-02-12 14:52:36 +00:00
|
|
|
MUIGetString(STRING_QUITCONTINUE),
|
2008-01-07 16:50:40 +00:00
|
|
|
NULL, POPUP_WAIT_NONE);
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
|
|
|
|
Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
|
|
|
|
{
|
|
|
|
if (ConfirmQuit(Ir))
|
|
|
|
return QUIT_PAGE;
|
|
|
|
else
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
|
|
|
|
{
|
2015-06-12 21:51:57 +00:00
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
2017-12-23 19:17:38 +00:00
|
|
|
else if (!NT_SUCCESS(Status))
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", Status);
|
|
|
|
|
|
|
|
RtlStringCbPrintfA(Buffer,
|
|
|
|
sizeof(Buffer),
|
|
|
|
"ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
|
|
|
|
Status);
|
|
|
|
|
2017-12-23 19:17:38 +00:00
|
|
|
PopupError(Buffer,
|
|
|
|
MUIGetString(STRING_CONTINUE),
|
|
|
|
Ir, POPUP_WAIT_ENTER);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2017-12-23 19:17:38 +00:00
|
|
|
|
|
|
|
PartEntry->NeedsCheck = FALSE;
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-05 00:56:23 +00:00
|
|
|
static BOOLEAN
|
|
|
|
IsValidPath(
|
|
|
|
IN PCWSTR InstallDir)
|
|
|
|
{
|
|
|
|
UINT i, Length;
|
|
|
|
|
|
|
|
Length = wcslen(InstallDir);
|
|
|
|
|
|
|
|
// TODO: Add check for 8.3 too.
|
|
|
|
|
|
|
|
/* Path must be at least 2 characters long */
|
|
|
|
// if (Length < 2)
|
|
|
|
// return FALSE;
|
|
|
|
|
|
|
|
/* Path must start with a backslash */
|
|
|
|
// if (InstallDir[0] != L'\\')
|
|
|
|
// return FALSE;
|
|
|
|
|
|
|
|
/* Path must not end with a backslash */
|
|
|
|
if (InstallDir[Length - 1] == L'\\')
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Path must not contain whitespace characters */
|
|
|
|
for (i = 0; i < Length; i++)
|
|
|
|
{
|
|
|
|
if (iswspace(InstallDir[i]))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Path component must not end with a dot */
|
|
|
|
for (i = 0; i < Length; i++)
|
|
|
|
{
|
|
|
|
if (InstallDir[i] == L'\\' && i > 0)
|
|
|
|
{
|
|
|
|
if (InstallDir[i - 1] == L'.')
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (InstallDir[Length - 1] == L'.')
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the InstallDirectoryPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
2018-05-31 14:38:06 +00:00
|
|
|
* PrepareCopyPage
|
2015-12-06 20:14:29 +00:00
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2002-09-25 14:48:35 +00:00
|
|
|
InstallDirectoryPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2019-02-13 14:22:28 +00:00
|
|
|
NTSTATUS Status;
|
2019-03-05 00:42:33 +00:00
|
|
|
ULONG Length, Pos;
|
|
|
|
WCHAR c;
|
|
|
|
WCHAR InstallDir[MAX_PATH];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-06-30 19:02:35 +00:00
|
|
|
/* We do not need the filesystem list anymore */
|
2019-02-25 19:29:16 +00:00
|
|
|
ResetFileSystemList();
|
2015-06-12 21:51:57 +00:00
|
|
|
|
2019-03-05 00:42:33 +00:00
|
|
|
if (PartitionList == NULL || InstallPartition == NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
return QUIT_PAGE;
|
2003-08-04 15:54:05 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
// if (IsUnattendedSetup)
|
|
|
|
if (RepairUpdateFlag)
|
2017-06-30 19:02:35 +00:00
|
|
|
wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
|
2017-08-09 20:39:45 +00:00
|
|
|
else if (USetupData.InstallationDirectory[0])
|
|
|
|
wcscpy(InstallDir, USetupData.InstallationDirectory);
|
2017-06-30 19:02:35 +00:00
|
|
|
else
|
|
|
|
wcscpy(InstallDir, L"\\ReactOS");
|
2018-05-15 16:11:12 +00:00
|
|
|
|
2017-06-30 19:02:35 +00:00
|
|
|
/*
|
|
|
|
* Check the validity of the predefined 'InstallDir'. If we are either
|
|
|
|
* in unattended setup or in update/repair mode, and the installation path
|
|
|
|
* is valid, just perform the installation. Otherwise (either in the case
|
|
|
|
* of an invalid path, or we are in regular setup), display the UI and allow
|
|
|
|
* the user to specify a new installation path.
|
|
|
|
*/
|
|
|
|
if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
|
|
|
|
{
|
2019-08-24 23:32:46 +00:00
|
|
|
Status = InitDestinationPaths(&USetupData, InstallDir, InstallPartition);
|
2019-02-13 14:22:28 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2019-08-24 23:32:46 +00:00
|
|
|
DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
|
2019-02-13 16:13:48 +00:00
|
|
|
MUIDisplayError(ERROR_NO_BUILD_PATH, Ir, POPUP_WAIT_ENTER);
|
2019-02-13 14:22:28 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2018-05-15 16:11:12 +00:00
|
|
|
|
2017-08-25 14:38:12 +00:00
|
|
|
/*
|
|
|
|
* Check whether the user attempts to install ReactOS within the
|
|
|
|
* installation source directory, or in a subdirectory thereof.
|
|
|
|
* If so, fail with an error.
|
|
|
|
*/
|
|
|
|
if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
|
|
|
|
{
|
2019-02-13 16:13:48 +00:00
|
|
|
MUIDisplayError(ERROR_SOURCE_DIR, Ir, POPUP_WAIT_ENTER);
|
2017-08-25 14:38:12 +00:00
|
|
|
return INSTALL_DIRECTORY_PAGE;
|
|
|
|
}
|
|
|
|
|
2018-05-15 16:11:12 +00:00
|
|
|
return PREPARE_COPY_PAGE;
|
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
Length = wcslen(InstallDir);
|
2018-05-15 09:28:33 +00:00
|
|
|
Pos = Length;
|
2017-06-30 19:02:35 +00:00
|
|
|
|
|
|
|
MUIDisplayPage(INSTALL_DIRECTORY_PAGE);
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
|
|
|
CONSOLE_SetCursorType(TRUE, TRUE);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2002-09-25 14:48:35 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2010-06-11 21:21:27 +00:00
|
|
|
return QUIT_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, TRUE);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2018-05-15 09:28:33 +00:00
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
|
|
|
|
{
|
|
|
|
if (Pos < Length)
|
|
|
|
{
|
|
|
|
memmove(&InstallDir[Pos],
|
|
|
|
&InstallDir[Pos + 1],
|
|
|
|
(Length - Pos - 1) * sizeof(WCHAR));
|
|
|
|
InstallDir[Length - 1] = UNICODE_NULL;
|
|
|
|
|
|
|
|
Length--;
|
|
|
|
CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
|
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
|
|
|
|
{
|
|
|
|
Pos = 0;
|
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
|
|
|
|
{
|
|
|
|
Pos = Length;
|
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
|
|
|
|
{
|
|
|
|
if (Pos > 0)
|
|
|
|
{
|
|
|
|
Pos--;
|
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
|
|
|
|
{
|
|
|
|
if (Pos < Length)
|
|
|
|
{
|
|
|
|
Pos++;
|
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
|
|
|
}
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
|
|
|
|
2015-03-30 23:32:32 +00:00
|
|
|
/*
|
|
|
|
* Check for the validity of the installation directory and pop up
|
|
|
|
* an error if it is not the case. Then the user can fix its input.
|
|
|
|
*/
|
2018-05-15 16:11:12 +00:00
|
|
|
if (!IsValidPath(InstallDir))
|
2015-03-30 23:32:32 +00:00
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_DIRECTORY_NAME, Ir, POPUP_WAIT_ENTER);
|
|
|
|
return INSTALL_DIRECTORY_PAGE;
|
|
|
|
}
|
2018-05-15 16:11:12 +00:00
|
|
|
|
2019-08-24 23:32:46 +00:00
|
|
|
Status = InitDestinationPaths(&USetupData, InstallDir, InstallPartition);
|
2019-02-13 14:22:28 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2019-08-24 23:32:46 +00:00
|
|
|
DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
|
2019-02-13 16:13:48 +00:00
|
|
|
MUIDisplayError(ERROR_NO_BUILD_PATH, Ir, POPUP_WAIT_ENTER);
|
2019-02-13 14:22:28 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2018-05-15 16:11:12 +00:00
|
|
|
|
2017-08-25 14:38:12 +00:00
|
|
|
/*
|
|
|
|
* Check whether the user attempts to install ReactOS within the
|
|
|
|
* installation source directory, or in a subdirectory thereof.
|
|
|
|
* If so, fail with an error.
|
|
|
|
*/
|
|
|
|
if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
|
|
|
|
{
|
2019-02-13 16:13:48 +00:00
|
|
|
MUIDisplayError(ERROR_SOURCE_DIR, Ir, POPUP_WAIT_ENTER);
|
2017-08-25 14:38:12 +00:00
|
|
|
return INSTALL_DIRECTORY_PAGE;
|
|
|
|
}
|
|
|
|
|
2018-05-15 16:11:12 +00:00
|
|
|
return PREPARE_COPY_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
|
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
if (Pos > 0)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
if (Pos < Length)
|
|
|
|
memmove(&InstallDir[Pos - 1],
|
|
|
|
&InstallDir[Pos],
|
|
|
|
(Length - Pos) * sizeof(WCHAR));
|
|
|
|
InstallDir[Length - 1] = UNICODE_NULL;
|
|
|
|
|
|
|
|
Pos--;
|
2008-01-07 16:50:40 +00:00
|
|
|
Length--;
|
|
|
|
CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
|
|
|
|
{
|
|
|
|
if (Length < 50)
|
|
|
|
{
|
2015-06-28 19:06:07 +00:00
|
|
|
c = (WCHAR)Ir->Event.KeyEvent.uChar.AsciiChar;
|
|
|
|
if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
|
|
|
|
{
|
2018-05-15 09:28:33 +00:00
|
|
|
if (Pos < Length)
|
|
|
|
memmove(&InstallDir[Pos + 1],
|
|
|
|
&InstallDir[Pos],
|
|
|
|
(Length - Pos) * sizeof(WCHAR));
|
|
|
|
InstallDir[Length + 1] = UNICODE_NULL;
|
|
|
|
InstallDir[Pos] = c;
|
|
|
|
|
|
|
|
Pos++;
|
2015-06-28 19:06:07 +00:00
|
|
|
Length++;
|
|
|
|
CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
|
2018-05-15 09:28:33 +00:00
|
|
|
CONSOLE_SetCursorXY(8 + Pos, 11);
|
2015-06-28 19:06:07 +00:00
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
return INSTALL_DIRECTORY_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2018-10-28 21:51:33 +00:00
|
|
|
// PSETUP_ERROR_ROUTINE
|
|
|
|
static VOID
|
|
|
|
__cdecl
|
|
|
|
USetupErrorRoutine(
|
|
|
|
IN PUSETUP_DATA pSetupData,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
INPUT_RECORD Ir;
|
|
|
|
va_list arg_ptr;
|
|
|
|
|
|
|
|
va_start(arg_ptr, pSetupData);
|
|
|
|
|
|
|
|
if (pSetupData->LastErrorNumber >= ERROR_SUCCESS &&
|
|
|
|
pSetupData->LastErrorNumber < ERROR_LAST_ERROR_CODE)
|
|
|
|
{
|
|
|
|
// Note: the "POPUP_WAIT_ENTER" actually depends on the LastErrorNumber...
|
|
|
|
MUIDisplayErrorV(pSetupData->LastErrorNumber, &Ir, POPUP_WAIT_ENTER, arg_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end(arg_ptr);
|
|
|
|
}
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the PrepareCopyPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* FileCopyPage(At once)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2018-01-07 00:35:48 +00:00
|
|
|
* Calls PrepareFileCopy
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-08-24 10:36:07 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
PrepareCopyPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2018-01-07 00:35:48 +00:00
|
|
|
// ERROR_NUMBER ErrorNumber;
|
|
|
|
BOOLEAN Success;
|
2003-08-24 10:36:07 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(PREPARE_COPY_PAGE);
|
2003-08-24 10:36:07 +00:00
|
|
|
|
2018-01-07 00:35:48 +00:00
|
|
|
/* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
|
|
|
|
if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
|
2003-08-24 10:36:07 +00:00
|
|
|
{
|
2018-01-07 00:35:48 +00:00
|
|
|
// MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2003-08-24 10:36:07 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return FILE_COPY_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
|
|
|
|
2018-01-05 01:08:59 +00:00
|
|
|
typedef struct _COPYCONTEXT
|
|
|
|
{
|
|
|
|
ULONG TotalOperations;
|
|
|
|
ULONG CompletedOperations;
|
|
|
|
PPROGRESSBAR ProgressBar;
|
|
|
|
PPROGRESSBAR MemoryBars[4];
|
|
|
|
} COPYCONTEXT, *PCOPYCONTEXT;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2018-01-05 01:08:59 +00:00
|
|
|
static VOID
|
2007-02-28 20:43:13 +00:00
|
|
|
SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext,
|
2010-06-11 21:21:27 +00:00
|
|
|
IN BOOLEAN First)
|
2007-02-28 20:43:13 +00:00
|
|
|
{
|
|
|
|
SYSTEM_PERFORMANCE_INFORMATION PerfInfo;
|
|
|
|
|
|
|
|
/* Get the memory information from the system */
|
|
|
|
NtQuerySystemInformation(SystemPerformanceInformation,
|
|
|
|
&PerfInfo,
|
|
|
|
sizeof(PerfInfo),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Check if this is initial setup */
|
|
|
|
if (First)
|
|
|
|
{
|
|
|
|
/* Set maximum limits to be total RAM pages */
|
|
|
|
ProgressSetStepCount(CopyContext->MemoryBars[0], PerfInfo.CommitLimit);
|
|
|
|
ProgressSetStepCount(CopyContext->MemoryBars[1], PerfInfo.CommitLimit);
|
|
|
|
ProgressSetStepCount(CopyContext->MemoryBars[2], PerfInfo.CommitLimit);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current values */
|
2009-02-18 16:35:14 +00:00
|
|
|
ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages + PerfInfo.NonPagedPoolPages);
|
|
|
|
ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.ResidentSystemCachePage);
|
2007-02-28 20:43:13 +00:00
|
|
|
ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages);
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
static UINT
|
|
|
|
CALLBACK
|
2002-11-23 01:55:27 +00:00
|
|
|
FileCopyCallback(PVOID Context,
|
2010-06-11 21:21:27 +00:00
|
|
|
UINT Notification,
|
|
|
|
UINT_PTR Param1,
|
|
|
|
UINT_PTR Param2)
|
2002-11-23 01:55:27 +00:00
|
|
|
{
|
2018-01-05 01:08:59 +00:00
|
|
|
PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
|
|
|
|
PFILEPATHS_W FilePathInfo;
|
|
|
|
PCWSTR SrcFileName, DstFileName;
|
2002-11-23 01:55:27 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
switch (Notification)
|
2003-03-08 19:29:09 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
case SPFILENOTIFY_STARTSUBQUEUE:
|
2018-01-05 01:08:59 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CopyContext->TotalOperations = (ULONG)Param2;
|
2018-01-05 01:08:59 +00:00
|
|
|
CopyContext->CompletedOperations = 0;
|
2008-01-07 16:50:40 +00:00
|
|
|
ProgressSetStepCount(CopyContext->ProgressBar,
|
2008-03-20 18:28:37 +00:00
|
|
|
CopyContext->TotalOperations);
|
2008-01-07 16:50:40 +00:00
|
|
|
SetupUpdateMemoryInfo(CopyContext, TRUE);
|
|
|
|
break;
|
2018-01-05 01:08:59 +00:00
|
|
|
}
|
2003-03-08 19:29:09 +00:00
|
|
|
|
2018-01-05 01:08:59 +00:00
|
|
|
case SPFILENOTIFY_STARTDELETE:
|
|
|
|
case SPFILENOTIFY_STARTRENAME:
|
2008-01-07 16:50:40 +00:00
|
|
|
case SPFILENOTIFY_STARTCOPY:
|
2018-01-05 01:08:59 +00:00
|
|
|
{
|
|
|
|
FilePathInfo = (PFILEPATHS_W)Param1;
|
|
|
|
|
|
|
|
if (Notification == SPFILENOTIFY_STARTDELETE)
|
|
|
|
{
|
|
|
|
/* Display delete message */
|
|
|
|
ASSERT(Param2 == FILEOP_DELETE);
|
|
|
|
|
|
|
|
DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
|
|
|
|
if (DstFileName) ++DstFileName;
|
|
|
|
else DstFileName = FilePathInfo->Target;
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_DELETING),
|
|
|
|
DstFileName);
|
|
|
|
}
|
|
|
|
else if (Notification == SPFILENOTIFY_STARTRENAME)
|
|
|
|
{
|
|
|
|
/* Display move/rename message */
|
|
|
|
ASSERT(Param2 == FILEOP_RENAME);
|
|
|
|
|
|
|
|
SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
|
|
|
|
if (SrcFileName) ++SrcFileName;
|
|
|
|
else SrcFileName = FilePathInfo->Source;
|
|
|
|
|
|
|
|
DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
|
|
|
|
if (DstFileName) ++DstFileName;
|
|
|
|
else DstFileName = FilePathInfo->Target;
|
|
|
|
|
2018-01-15 17:48:51 +00:00
|
|
|
if (!wcsicmp(SrcFileName, DstFileName))
|
|
|
|
Param2 = STRING_MOVING;
|
|
|
|
else
|
|
|
|
Param2 = STRING_RENAMING;
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(Param2),
|
2018-01-05 01:08:59 +00:00
|
|
|
SrcFileName, DstFileName);
|
|
|
|
}
|
|
|
|
else if (Notification == SPFILENOTIFY_STARTCOPY)
|
|
|
|
{
|
2023-02-24 01:19:53 +00:00
|
|
|
static PCSTR s_pszCopying = NULL; /* Cached for speed */
|
|
|
|
|
2018-01-05 01:08:59 +00:00
|
|
|
/* Display copy message */
|
|
|
|
ASSERT(Param2 == FILEOP_COPY);
|
|
|
|
|
2018-01-15 17:48:51 +00:00
|
|
|
/* NOTE: When extracting from CABs the Source is the CAB name */
|
|
|
|
DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
|
|
|
|
if (DstFileName) ++DstFileName;
|
|
|
|
else DstFileName = FilePathInfo->Target;
|
2018-01-05 01:08:59 +00:00
|
|
|
|
2023-02-24 01:19:53 +00:00
|
|
|
if (!s_pszCopying)
|
|
|
|
s_pszCopying = MUIGetString(STRING_COPYING);
|
|
|
|
CONSOLE_SetStatusText(s_pszCopying, DstFileName);
|
2020-02-14 01:47:20 +00:00
|
|
|
#ifdef __REACTOS__ /* HACK */
|
|
|
|
DoWatchDestFileName(DstFileName);
|
|
|
|
#endif
|
2018-01-05 01:08:59 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
SetupUpdateMemoryInfo(CopyContext, FALSE);
|
|
|
|
break;
|
2018-01-05 01:08:59 +00:00
|
|
|
}
|
2003-03-08 19:29:09 +00:00
|
|
|
|
2018-01-15 17:48:51 +00:00
|
|
|
case SPFILENOTIFY_COPYERROR:
|
|
|
|
{
|
|
|
|
FilePathInfo = (PFILEPATHS_W)Param1;
|
|
|
|
|
|
|
|
DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
|
|
|
|
FilePathInfo->Target, FilePathInfo->Win32Error);
|
|
|
|
return FILEOP_SKIP;
|
|
|
|
}
|
|
|
|
|
2018-01-05 01:08:59 +00:00
|
|
|
case SPFILENOTIFY_ENDDELETE:
|
|
|
|
case SPFILENOTIFY_ENDRENAME:
|
2008-01-07 16:50:40 +00:00
|
|
|
case SPFILENOTIFY_ENDCOPY:
|
2018-01-05 01:08:59 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CopyContext->CompletedOperations++;
|
2012-03-03 23:04:10 +00:00
|
|
|
|
|
|
|
/* SYSREG checkpoint */
|
|
|
|
if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
|
|
|
|
DPRINT1("CHECKPOINT:HALF_COPIED\n");
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
ProgressNextStep(CopyContext->ProgressBar);
|
|
|
|
SetupUpdateMemoryInfo(CopyContext, FALSE);
|
|
|
|
break;
|
2018-01-05 01:08:59 +00:00
|
|
|
}
|
2003-03-08 19:29:09 +00:00
|
|
|
}
|
2002-11-23 01:55:27 +00:00
|
|
|
|
2018-01-05 01:08:59 +00:00
|
|
|
return FILEOP_DOIT;
|
2002-11-23 01:55:27 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the FileCopyPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* RegistryPage(At once)
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2018-01-07 00:35:48 +00:00
|
|
|
* Calls DoFileCopy
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2017-05-15 16:22:18 +00:00
|
|
|
static PAGE_NUMBER
|
2002-09-25 14:48:35 +00:00
|
|
|
FileCopyPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2007-02-28 20:43:13 +00:00
|
|
|
COPYCONTEXT CopyContext;
|
2018-01-05 01:08:59 +00:00
|
|
|
UINT MemBarWidth;
|
2007-02-28 20:43:13 +00:00
|
|
|
|
2007-12-19 14:29:39 +00:00
|
|
|
MUIDisplayPage(FILE_COPY_PAGE);
|
2007-02-28 20:43:13 +00:00
|
|
|
|
|
|
|
/* Create context for the copy process */
|
|
|
|
CopyContext.TotalOperations = 0;
|
|
|
|
CopyContext.CompletedOperations = 0;
|
|
|
|
|
|
|
|
/* Create the progress bar as well */
|
|
|
|
CopyContext.ProgressBar = CreateProgressBar(13,
|
|
|
|
26,
|
|
|
|
xScreen - 13,
|
|
|
|
yScreen - 20,
|
|
|
|
10,
|
|
|
|
24,
|
|
|
|
TRUE,
|
2008-02-08 04:14:09 +00:00
|
|
|
MUIGetString(STRING_SETUPCOPYINGFILES));
|
2007-02-28 20:43:13 +00:00
|
|
|
|
2008-07-30 15:12:09 +00:00
|
|
|
// fit memory bars to screen width, distribute them uniform
|
2018-01-05 01:08:59 +00:00
|
|
|
MemBarWidth = (xScreen - 26) / 5;
|
|
|
|
MemBarWidth -= MemBarWidth % 2; // make even
|
2008-07-30 14:15:41 +00:00
|
|
|
/* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
|
2007-02-28 20:43:13 +00:00
|
|
|
/* Create the paged pool progress bar */
|
|
|
|
CopyContext.MemoryBars[0] = CreateProgressBar(13,
|
|
|
|
40,
|
2018-01-05 01:08:59 +00:00
|
|
|
13 + MemBarWidth,
|
2007-02-28 20:43:13 +00:00
|
|
|
43,
|
2010-06-11 21:21:27 +00:00
|
|
|
13,
|
2007-02-28 20:43:13 +00:00
|
|
|
44,
|
|
|
|
FALSE,
|
2009-02-18 16:35:14 +00:00
|
|
|
"Kernel Pool");
|
2007-02-28 20:43:13 +00:00
|
|
|
|
|
|
|
/* Create the non paged pool progress bar */
|
2018-01-05 01:08:59 +00:00
|
|
|
CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (MemBarWidth / 2),
|
2007-02-28 20:43:13 +00:00
|
|
|
40,
|
2018-01-05 01:08:59 +00:00
|
|
|
(xScreen / 2) + (MemBarWidth / 2),
|
2007-02-28 20:43:13 +00:00
|
|
|
43,
|
2018-01-05 01:08:59 +00:00
|
|
|
(xScreen / 2)- (MemBarWidth / 2),
|
2007-02-28 20:43:13 +00:00
|
|
|
44,
|
|
|
|
FALSE,
|
2009-02-18 16:35:14 +00:00
|
|
|
"Kernel Cache");
|
2007-02-28 20:43:13 +00:00
|
|
|
|
|
|
|
/* Create the global memory progress bar */
|
2018-01-05 01:08:59 +00:00
|
|
|
CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - MemBarWidth,
|
2007-02-28 20:43:13 +00:00
|
|
|
40,
|
2010-06-11 21:21:27 +00:00
|
|
|
xScreen - 13,
|
2007-02-28 20:43:13 +00:00
|
|
|
43,
|
2018-01-05 01:08:59 +00:00
|
|
|
xScreen - 13 - MemBarWidth,
|
2007-02-28 20:43:13 +00:00
|
|
|
44,
|
|
|
|
FALSE,
|
2008-07-30 14:15:41 +00:00
|
|
|
"Free Memory");
|
2007-02-28 20:43:13 +00:00
|
|
|
|
|
|
|
/* Do the file copying */
|
2018-01-07 00:35:48 +00:00
|
|
|
DoFileCopy(&USetupData, FileCopyCallback, &CopyContext);
|
2007-02-28 20:43:13 +00:00
|
|
|
|
2018-01-07 00:35:48 +00:00
|
|
|
/* If we get here, we're done, so cleanup the progress bar */
|
2007-02-28 20:43:13 +00:00
|
|
|
DestroyProgressBar(CopyContext.ProgressBar);
|
|
|
|
DestroyProgressBar(CopyContext.MemoryBars[0]);
|
|
|
|
DestroyProgressBar(CopyContext.MemoryBars[1]);
|
|
|
|
DestroyProgressBar(CopyContext.MemoryBars[2]);
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
/* Create the $winnt$.inf file */
|
|
|
|
InstallSetupInfFile(&USetupData);
|
|
|
|
|
2007-02-28 20:43:13 +00:00
|
|
|
/* Go display the next page */
|
|
|
|
return REGISTRY_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2017-09-03 16:17:27 +00:00
|
|
|
static VOID
|
|
|
|
__cdecl
|
|
|
|
RegistryStatus(IN REGISTRY_STATUS RegStatus, ...)
|
|
|
|
{
|
|
|
|
/* WARNING: Please keep this lookup table in sync with the resources! */
|
|
|
|
static const UINT StringIDs[] =
|
|
|
|
{
|
|
|
|
STRING_DONE, /* Success */
|
|
|
|
STRING_REGHIVEUPDATE, /* RegHiveUpdate */
|
|
|
|
STRING_IMPORTFILE, /* ImportRegHive */
|
|
|
|
STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
|
|
|
|
STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
|
|
|
|
STRING_ADDKBLAYOUTS, /* KeybLayouts */
|
|
|
|
STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
|
|
|
|
STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
|
|
|
|
};
|
|
|
|
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
if (RegStatus < ARRAYSIZE(StringIDs))
|
|
|
|
{
|
|
|
|
va_start(args, RegStatus);
|
|
|
|
CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
|
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText("Unknown status %d", RegStatus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the RegistryPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SuccessPage (if RepairUpdate)
|
|
|
|
* BootLoaderPage (default)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2017-09-03 16:17:27 +00:00
|
|
|
* Calls UpdateRegistry
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2003-01-17 13:18:15 +00:00
|
|
|
RegistryPage(PINPUT_RECORD Ir)
|
2002-09-25 14:48:35 +00:00
|
|
|
{
|
2017-09-03 16:17:27 +00:00
|
|
|
ULONG Error;
|
2003-03-19 20:12:44 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(REGISTRY_PAGE);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2018-01-07 00:35:48 +00:00
|
|
|
Error = UpdateRegistry(&USetupData,
|
2017-09-03 16:17:27 +00:00
|
|
|
RepairUpdateFlag,
|
|
|
|
PartitionList,
|
2019-08-24 23:32:46 +00:00
|
|
|
InstallPartition->DriveLetter,
|
2017-09-03 16:17:27 +00:00
|
|
|
SelectedLanguageId,
|
2020-02-14 01:47:20 +00:00
|
|
|
RegistryStatus,
|
|
|
|
&s_SubstSettings);
|
2017-09-03 16:17:27 +00:00
|
|
|
if (Error != ERROR_SUCCESS)
|
2003-03-08 19:29:09 +00:00
|
|
|
{
|
2017-09-03 16:17:27 +00:00
|
|
|
MUIDisplayError(Error, Ir, POPUP_WAIT_ENTER);
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2003-03-08 19:29:09 +00:00
|
|
|
}
|
2017-09-03 16:17:27 +00:00
|
|
|
else
|
[USETUP] Implement work-in-progress code that allows verifying whether registry hives validity.
Implement work-in-progress code that, when upgrading an existing
ReactOS installation, verifies whether the (existing) system registry
hives are valid (by loading & unloading them, this allows using the
built-in repair functionality if needed), or not.
If a given hive cannot be repaired successfully, it is backed up
(with a '.brk' extension, "brk" as "broken"), then is marked up for
recreation.
When all hives have been checked, if there are any hive that needs
to be recreated, we recreate its hive file, mount it, but we do *NOT*
mount the other valid existing hives for update. We create instead
dummy registry hives so that we can actually use, as the update code,
the same one as the one used when fully creating the registry hives
for a clean installation (of course, this choice can be improved later on).
The update code (i.e. the same as the registry clean-install one) then
adds the registry keys & values, either putting them in the dummy
registry hives (the ones that we don't want to recreate) or in the
registry hive that is recreated.
At the end, the (re)created registry hives are flushed back to disk,
and a copy of them (under a '.sav' extension) are created, so that they
can be used for restoration purposes if 2nd-stage (and up) goes berserk.
Extra fixes:
- Use the correct structure member field when initializing the
'InstallDir' variable, when performing an upgrade.
- CreateNestedKey() should be better analysed to see whether it correctly
creates the full registry path compatible with volatile/non-volatile keys
(under inspection).
svn path=/branches/setup_improvements/; revision=75010
2017-06-12 00:09:16 +00:00
|
|
|
{
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_DONE));
|
|
|
|
return BOOT_LOADER_PAGE;
|
|
|
|
}
|
2003-01-17 13:18:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the BootLoaderPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SuccessPage (if RepairUpdate)
|
|
|
|
* BootLoaderHarddiskMbrPage
|
|
|
|
* BootLoaderHarddiskVbrPage
|
|
|
|
* BootLoaderFloppyPage
|
|
|
|
* SuccessPage
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
* Calls RegInitializeRegistry
|
2015-12-06 20:14:29 +00:00
|
|
|
* Calls ImportRegistryFile
|
|
|
|
* Calls SetDefaultPagefile
|
|
|
|
* Calls SetMountedDeviceValues
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2003-01-17 13:18:15 +00:00
|
|
|
BootLoaderPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
USHORT Line = 12;
|
2012-01-30 04:52:37 +00:00
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
/* We must have a supported system partition by now */
|
|
|
|
ASSERT(SystemPartition && SystemPartition->IsPartitioned && SystemPartition->PartitionNumber != 0);
|
2019-02-24 18:04:57 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
RtlFreeUnicodeString(&USetupData.SystemRootPath);
|
2017-09-03 20:05:11 +00:00
|
|
|
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
2017-05-31 02:19:08 +00:00
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu\\",
|
2019-08-24 23:32:46 +00:00
|
|
|
SystemPartition->DiskEntry->DiskNumber,
|
|
|
|
SystemPartition->PartitionNumber);
|
2017-08-09 20:39:45 +00:00
|
|
|
RtlCreateUnicodeString(&USetupData.SystemRootPath, PathBuffer);
|
|
|
|
DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
|
2012-01-30 04:52:37 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
/* For unattended setup, skip MBR installation or install on floppy if needed */
|
2009-07-16 09:09:26 +00:00
|
|
|
if (IsUnattendedSetup)
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if ((USetupData.MBRInstallType == 0) ||
|
|
|
|
(USetupData.MBRInstallType == 1))
|
2009-07-16 09:09:26 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
goto Quit;
|
2009-07-16 09:09:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
/*
|
|
|
|
* We may install an MBR or VBR, but before that, check whether
|
2021-01-31 19:19:19 +00:00
|
|
|
* we need to actually install the VBR on floppy/removable media
|
|
|
|
* if the system partition is not recognized.
|
2017-08-09 20:39:45 +00:00
|
|
|
*/
|
2021-01-31 19:19:19 +00:00
|
|
|
if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
|
|
|
|
!IsRecognizedPartition(SystemPartition->PartitionType))
|
2004-06-23 14:09:55 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
USetupData.MBRInstallType = 1;
|
|
|
|
goto Quit;
|
2004-06-23 14:09:55 +00:00
|
|
|
}
|
2003-01-30 14:41:45 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
/* Is it an unattended install on hdd? */
|
|
|
|
if (IsUnattendedSetup)
|
2006-08-02 18:58:07 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if ((USetupData.MBRInstallType == 2) ||
|
|
|
|
(USetupData.MBRInstallType == 3))
|
|
|
|
{
|
|
|
|
goto Quit;
|
|
|
|
}
|
2006-08-02 18:58:07 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(BOOT_LOADER_PAGE);
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_InvertTextXY(8, Line, 60, 1);
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2004-06-23 14:09:55 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_ConInKey(Ir);
|
2007-01-05 20:19:21 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_NormalTextXY(8, Line, 60, 1);
|
2005-11-11 20:07:05 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
Line++;
|
2017-08-09 20:29:07 +00:00
|
|
|
if (Line < 12)
|
|
|
|
Line = 15;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
if (Line > 15)
|
|
|
|
Line = 12;
|
2007-01-05 20:19:21 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_InvertTextXY(8, Line, 60, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_NormalTextXY(8, Line, 60, 1);
|
2005-11-11 20:07:05 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
Line--;
|
2017-08-09 20:29:07 +00:00
|
|
|
if (Line < 12)
|
|
|
|
Line = 15;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
2017-08-09 20:29:07 +00:00
|
|
|
if (Line > 15)
|
|
|
|
Line = 12;
|
2005-11-11 20:07:05 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_InvertTextXY(8, Line, 60, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2019-01-19 17:44:13 +00:00
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
|
|
|
|
{
|
|
|
|
CONSOLE_NormalTextXY(8, Line, 60, 1);
|
|
|
|
|
|
|
|
Line = 12;
|
|
|
|
|
|
|
|
CONSOLE_InvertTextXY(8, Line, 60, 1);
|
|
|
|
}
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
|
|
|
|
{
|
|
|
|
CONSOLE_NormalTextXY(8, Line, 60, 1);
|
|
|
|
|
|
|
|
Line = 15;
|
2021-09-13 01:33:14 +00:00
|
|
|
|
2019-01-19 17:44:13 +00:00
|
|
|
CONSOLE_InvertTextXY(8, Line, 60, 1);
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2015-05-04 20:50:51 +00:00
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
if (Line == 12)
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
/* Install on both MBR and VBR */
|
|
|
|
USetupData.MBRInstallType = 2;
|
|
|
|
break;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Line == 13)
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
/* Install on VBR only */
|
|
|
|
USetupData.MBRInstallType = 3;
|
|
|
|
break;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
else if (Line == 14)
|
2010-09-05 17:09:18 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
/* Install on floppy */
|
|
|
|
USetupData.MBRInstallType = 1;
|
|
|
|
break;
|
2010-09-05 17:09:18 +00:00
|
|
|
}
|
|
|
|
else if (Line == 15)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
/* Skip MBR installation */
|
|
|
|
USetupData.MBRInstallType = 0;
|
|
|
|
break;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2003-01-30 14:41:45 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return BOOT_LOADER_PAGE;
|
|
|
|
}
|
2004-06-23 14:09:55 +00:00
|
|
|
}
|
2003-01-30 14:41:45 +00:00
|
|
|
|
2017-08-09 20:39:45 +00:00
|
|
|
Quit:
|
|
|
|
switch (USetupData.MBRInstallType)
|
|
|
|
{
|
|
|
|
/* Skip MBR installation */
|
|
|
|
case 0:
|
|
|
|
return SUCCESS_PAGE;
|
|
|
|
|
|
|
|
/* Install on floppy */
|
|
|
|
case 1:
|
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
|
|
|
|
2021-04-07 08:11:07 +00:00
|
|
|
/* Install on both MBR and VBR or VBR only */
|
2017-08-09 20:39:45 +00:00
|
|
|
case 2:
|
|
|
|
case 3:
|
2021-04-07 08:11:07 +00:00
|
|
|
return BOOT_LOADER_INSTALLATION_PAGE;
|
2017-08-09 20:39:45 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
return BOOT_LOADER_PAGE;
|
2004-06-23 14:09:55 +00:00
|
|
|
}
|
2003-01-30 14:41:45 +00:00
|
|
|
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the BootLoaderFloppyPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SuccessPage (At once)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
|
|
|
* Calls InstallFatBootcodeToFloppy()
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-06-23 14:09:55 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
BootLoaderFloppyPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
NTSTATUS Status;
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(BOOT_LOADER_FLOPPY_PAGE);
|
2003-01-30 14:41:45 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
// CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
while (TRUE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
{
|
2017-08-09 20:39:45 +00:00
|
|
|
if (ConfirmQuit(Ir))
|
2008-01-07 16:50:40 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2015-05-04 20:50:51 +00:00
|
|
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
2017-09-03 16:19:59 +00:00
|
|
|
Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
|
|
|
|
&USetupData.DestinationArcPath);
|
2008-01-07 16:50:40 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2017-09-03 16:19:59 +00:00
|
|
|
if (Status == STATUS_DEVICE_NOT_READY)
|
|
|
|
MUIDisplayError(ERROR_NO_FLOPPY, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
|
|
|
/* TODO: Print error message */
|
2008-01-07 16:50:40 +00:00
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return SUCCESS_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
2004-06-23 14:09:55 +00:00
|
|
|
}
|
2003-01-30 14:41:45 +00:00
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
2021-04-07 08:11:07 +00:00
|
|
|
* Displays the BootLoaderInstallationPage.
|
2015-12-06 20:14:29 +00:00
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* SuccessPage (At once)
|
|
|
|
* QuitPage
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
2021-04-07 08:11:07 +00:00
|
|
|
* Calls InstallVBRToPartition() if VBR installation is chosen.
|
|
|
|
* Otherwise both InstallVBRToPartition() and InstallMbrBootCodeToDisk()
|
|
|
|
* are called if both MBR and VBR installation is chosen.
|
2021-09-13 01:33:14 +00:00
|
|
|
*
|
2015-12-06 20:14:29 +00:00
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-06-23 14:09:55 +00:00
|
|
|
static PAGE_NUMBER
|
2021-04-07 08:11:07 +00:00
|
|
|
BootLoaderInstallationPage(PINPUT_RECORD Ir)
|
2004-06-23 14:09:55 +00:00
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
NTSTATUS Status;
|
2010-09-04 20:56:19 +00:00
|
|
|
WCHAR DestinationDevicePathBuffer[MAX_PATH];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2021-04-07 08:11:07 +00:00
|
|
|
MUIDisplayPage(BOOT_LOADER_INSTALLATION_PAGE);
|
|
|
|
|
|
|
|
if (USetupData.MBRInstallType == 2)
|
2003-01-17 13:18:15 +00:00
|
|
|
{
|
2021-04-07 08:11:07 +00:00
|
|
|
/* Step 1: Write the VBR */
|
|
|
|
Status = InstallVBRToPartition(&USetupData.SystemRootPath,
|
|
|
|
&USetupData.SourceRootPath,
|
|
|
|
&USetupData.DestinationArcPath,
|
|
|
|
SystemPartition->FileSystem);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
MUIDisplayError(ERROR_WRITE_BOOT, Ir, POPUP_WAIT_ENTER,
|
|
|
|
SystemPartition->FileSystem);
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2021-04-07 08:11:07 +00:00
|
|
|
/* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
|
|
|
|
if (!IsSuperFloppy(SystemPartition->DiskEntry))
|
|
|
|
{
|
|
|
|
RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
|
|
|
|
L"\\Device\\Harddisk%d\\Partition0",
|
|
|
|
SystemPartition->DiskEntry->DiskNumber);
|
|
|
|
Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath,
|
|
|
|
&USetupData.SourceRootPath,
|
|
|
|
DestinationDevicePathBuffer);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", Status);
|
|
|
|
MUIDisplayError(ERROR_INSTALL_BOOTCODE, Ir, POPUP_WAIT_ENTER, L"MBR");
|
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-09-04 20:56:19 +00:00
|
|
|
{
|
2021-04-07 08:11:07 +00:00
|
|
|
Status = InstallVBRToPartition(&USetupData.SystemRootPath,
|
|
|
|
&USetupData.SourceRootPath,
|
|
|
|
&USetupData.DestinationArcPath,
|
|
|
|
SystemPartition->FileSystem);
|
[SETUPLIB][USETUP] Improve disk HW numbering, removable disk support, and "super-floppy" partitioning.
Nowadays more and more people try to install ReactOS from removable
drives (e.g. USB sticks) onto fixed HDDs, or try to install it into
USB sticks too.
Both fixed and removable drives, as well as partitions on these, are
represented in NT using the same device name format:
\Device\HarddiskM\PartitionN ,
with an increasing disk number M. Using this number for building the
corresponding firmware-specific ARC multi(x)disk(y)rdisk(z) path used
by the NT/ROS loader (FreeLdr, ...) is then prone to error since there
may have been removable drives inserted and accounted for in the
calculation of the disk number. These drives must be correctly
subtracted in order to generate the correct ARC path, valid once all
the removable drives have been ejected (which should also be the
situation seen from the BIOS when booting up, except of course if you
boot on a USB stick).
This problem is now solved. Note that it matters only for the disks
that have also been enumerated by the firmware (BIOS; Int 13h). We
don't have to care about the other drives, since the ARC path will be
of a different format and will not use the disk number (instead, the
SCSI coordinates are used).
We also try to enumerate all the disks found in all the possible disk
adapters and controllers enumerated in the Hardware registry tree
(and that are visible by FreeLdr) in order to cover all.
Finally, we detect whether a disk reports as a "super-floppy", i.e.
an unpartitioned disk with a valid VBR. This is indeed how a standard
floppy disk looks like, or how USB sticks are partitioned on Windows.
Such disk is reported has having only one single partition starting at
the beginning of the disk, with partition number == 0, its type being
FAT16 non-bootable.
This allows us to forbid creating any new partitions on such disks.
Note that accessing either \Device\HarddiskN\Partition0 or Partition1
on such a disk returns the same data.
Note also that on the contrary, regular MBR-partitioned disks would
report at least four partitions entries, instead of just one.
The other improvements are:
- Do *NOT* write any MBR on a disk partitioned as "super-floppy".
CORE-13703
- Fix the computed disk identifier, of format: %08x-%08x-%c .
The numbers are respectively the checksum of the first sector, and
the disk signature. The terminating letter is A or X, depending
whether the first sector ends with 0x55AA/0xAA55 or not (see also
commit 5053f1f5).
- Warn if the user attempts to install ReactOS on a disk that is not
visible by the firmware of his computer, because it may not be
bootable.
2019-03-11 23:13:25 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2021-04-07 08:11:07 +00:00
|
|
|
MUIDisplayError(ERROR_WRITE_BOOT, Ir, POPUP_WAIT_ENTER,
|
|
|
|
SystemPartition->FileSystem);
|
[SETUPLIB][USETUP] Improve disk HW numbering, removable disk support, and "super-floppy" partitioning.
Nowadays more and more people try to install ReactOS from removable
drives (e.g. USB sticks) onto fixed HDDs, or try to install it into
USB sticks too.
Both fixed and removable drives, as well as partitions on these, are
represented in NT using the same device name format:
\Device\HarddiskM\PartitionN ,
with an increasing disk number M. Using this number for building the
corresponding firmware-specific ARC multi(x)disk(y)rdisk(z) path used
by the NT/ROS loader (FreeLdr, ...) is then prone to error since there
may have been removable drives inserted and accounted for in the
calculation of the disk number. These drives must be correctly
subtracted in order to generate the correct ARC path, valid once all
the removable drives have been ejected (which should also be the
situation seen from the BIOS when booting up, except of course if you
boot on a USB stick).
This problem is now solved. Note that it matters only for the disks
that have also been enumerated by the firmware (BIOS; Int 13h). We
don't have to care about the other drives, since the ARC path will be
of a different format and will not use the disk number (instead, the
SCSI coordinates are used).
We also try to enumerate all the disks found in all the possible disk
adapters and controllers enumerated in the Hardware registry tree
(and that are visible by FreeLdr) in order to cover all.
Finally, we detect whether a disk reports as a "super-floppy", i.e.
an unpartitioned disk with a valid VBR. This is indeed how a standard
floppy disk looks like, or how USB sticks are partitioned on Windows.
Such disk is reported has having only one single partition starting at
the beginning of the disk, with partition number == 0, its type being
FAT16 non-bootable.
This allows us to forbid creating any new partitions on such disks.
Note that accessing either \Device\HarddiskN\Partition0 or Partition1
on such a disk returns the same data.
Note also that on the contrary, regular MBR-partitioned disks would
report at least four partitions entries, instead of just one.
The other improvements are:
- Do *NOT* write any MBR on a disk partitioned as "super-floppy".
CORE-13703
- Fix the computed disk identifier, of format: %08x-%08x-%c .
The numbers are respectively the checksum of the first sector, and
the disk signature. The terminating letter is A or X, depending
whether the first sector ends with 0x55AA/0xAA55 or not (see also
commit 5053f1f5).
- Warn if the user attempts to install ReactOS on a disk that is not
visible by the firmware of his computer, because it may not be
bootable.
2019-03-11 23:13:25 +00:00
|
|
|
return QUIT_PAGE;
|
|
|
|
}
|
2010-09-04 20:56:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return SUCCESS_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
}
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
|
|
|
2018-08-22 09:10:18 +00:00
|
|
|
/**
|
|
|
|
* @name ProgressTimeOutStringHandler
|
|
|
|
*
|
|
|
|
* Handles the generation (displaying) of the timeout
|
|
|
|
* countdown to the screen dynamically.
|
|
|
|
*
|
|
|
|
* @param Bar
|
|
|
|
* A pointer to a progress bar.
|
|
|
|
*
|
|
|
|
* @param AlwaysUpdate
|
|
|
|
* Constantly update the progress bar (boolean type).
|
|
|
|
*
|
|
|
|
* @param Buffer
|
|
|
|
* A pointer to a string buffer.
|
|
|
|
*
|
|
|
|
* @param cchBufferSize
|
|
|
|
* The buffer's size in number of characters.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* TRUE or FALSE on function termination.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
BOOLEAN NTAPI
|
|
|
|
ProgressTimeOutStringHandler(
|
|
|
|
IN PPROGRESSBAR Bar,
|
|
|
|
IN BOOLEAN AlwaysUpdate,
|
|
|
|
OUT PSTR Buffer,
|
|
|
|
IN SIZE_T cchBufferSize)
|
|
|
|
{
|
|
|
|
ULONG OldProgress = Bar->Progress;
|
|
|
|
|
|
|
|
if (Bar->StepCount == 0)
|
|
|
|
{
|
|
|
|
Bar->Progress = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Bar->Progress = Bar->StepCount - Bar->CurrentStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Build the progress string if it has changed */
|
|
|
|
if (Bar->ProgressFormatText &&
|
|
|
|
(AlwaysUpdate || (Bar->Progress != OldProgress)))
|
|
|
|
{
|
|
|
|
RtlStringCchPrintfA(Buffer, cchBufferSize,
|
2018-09-09 13:50:27 +00:00
|
|
|
Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
|
2018-08-22 09:10:18 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name ProgressCountdown
|
|
|
|
*
|
|
|
|
* Displays and draws a red-coloured progress bar with a countdown.
|
|
|
|
* When the timeout is reached, the flush page is displayed for reboot.
|
|
|
|
*
|
|
|
|
* @param Ir
|
|
|
|
* A pointer to an input keyboard record.
|
|
|
|
*
|
|
|
|
* @param TimeOut
|
|
|
|
* Initial countdown value in seconds.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* Nothing.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static VOID
|
|
|
|
ProgressCountdown(
|
|
|
|
IN PINPUT_RECORD Ir,
|
|
|
|
IN LONG TimeOut)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
2018-09-09 13:50:27 +00:00
|
|
|
ULONG StartTime, BarWidth, TimerDiv;
|
2018-08-22 09:10:18 +00:00
|
|
|
LONG TimeElapsed;
|
2018-09-09 13:50:27 +00:00
|
|
|
LONG TimerValue, OldTimerValue;
|
2018-08-22 09:10:18 +00:00
|
|
|
LARGE_INTEGER Timeout;
|
|
|
|
PPROGRESSBAR ProgressBar;
|
|
|
|
BOOLEAN RefreshProgress = TRUE;
|
|
|
|
|
|
|
|
/* Bail out if the timeout is already zero */
|
|
|
|
if (TimeOut <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Create the timeout progress bar and set it up */
|
|
|
|
ProgressBar = CreateProgressBarEx(13,
|
|
|
|
26,
|
|
|
|
xScreen - 13,
|
|
|
|
yScreen - 20,
|
|
|
|
10,
|
|
|
|
24,
|
|
|
|
TRUE,
|
|
|
|
FOREGROUND_RED | BACKGROUND_BLUE,
|
2018-09-09 13:50:27 +00:00
|
|
|
0,
|
2018-08-22 09:10:18 +00:00
|
|
|
NULL,
|
|
|
|
MUIGetString(STRING_REBOOTPROGRESSBAR),
|
|
|
|
ProgressTimeOutStringHandler);
|
|
|
|
|
2018-09-09 13:50:27 +00:00
|
|
|
BarWidth = max(1, ProgressBar->Width);
|
|
|
|
TimerValue = TimeOut * BarWidth;
|
|
|
|
ProgressSetStepCount(ProgressBar, TimerValue);
|
|
|
|
|
2018-08-22 09:10:18 +00:00
|
|
|
StartTime = NtGetTickCount();
|
|
|
|
CONSOLE_Flush();
|
|
|
|
|
2018-09-09 13:50:27 +00:00
|
|
|
TimerDiv = 1000 / BarWidth;
|
|
|
|
TimerDiv = max(1, TimerDiv);
|
2018-08-22 09:10:18 +00:00
|
|
|
OldTimerValue = TimerValue;
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
/* Decrease the timer */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compute how much time the previous operations took.
|
|
|
|
* This allows us in particular to take account for any time
|
|
|
|
* elapsed if something slowed down.
|
|
|
|
*/
|
|
|
|
TimeElapsed = NtGetTickCount() - StartTime;
|
2018-09-09 13:50:27 +00:00
|
|
|
if (TimeElapsed >= TimerDiv)
|
2018-08-22 09:10:18 +00:00
|
|
|
{
|
2018-09-09 13:50:27 +00:00
|
|
|
/* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
|
|
|
|
TimeElapsed /= TimerDiv;
|
|
|
|
StartTime += (TimerDiv * TimeElapsed);
|
2018-08-22 09:10:18 +00:00
|
|
|
|
|
|
|
if (TimeElapsed <= TimerValue)
|
|
|
|
TimerValue -= TimeElapsed;
|
|
|
|
else
|
|
|
|
TimerValue = 0;
|
|
|
|
|
|
|
|
RefreshProgress = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RefreshProgress)
|
|
|
|
{
|
|
|
|
ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
|
|
|
|
RefreshProgress = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Stop when the timer reaches zero */
|
|
|
|
if (TimerValue <= 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Check for user key presses */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the timer is used, use a passive wait of maximum 1 second
|
|
|
|
* while monitoring for incoming console input events, so that
|
|
|
|
* we are still able to display the timing count.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Wait a maximum of 1 second for input events */
|
|
|
|
TimeElapsed = NtGetTickCount() - StartTime;
|
2018-09-09 13:50:27 +00:00
|
|
|
if (TimeElapsed < TimerDiv)
|
2018-08-22 09:10:18 +00:00
|
|
|
{
|
2020-11-24 01:26:52 +00:00
|
|
|
/* Convert the time to NT format */
|
2018-09-09 13:50:27 +00:00
|
|
|
Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
|
2018-08-22 09:10:18 +00:00
|
|
|
Status = NtWaitForSingleObject(StdInput, FALSE, &Timeout);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Status = STATUS_TIMEOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check whether the input event has been signaled, or a timeout happened */
|
|
|
|
if (Status == STATUS_TIMEOUT)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (Status != STATUS_WAIT_0)
|
|
|
|
{
|
|
|
|
/* An error happened, bail out */
|
|
|
|
DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for an ENTER key press */
|
|
|
|
while (CONSOLE_ConInKeyPeek(Ir))
|
|
|
|
{
|
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
{
|
|
|
|
/* Found it, stop waiting */
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
/* Destroy the progress bar and quit */
|
|
|
|
DestroyProgressBar(ProgressBar);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the QuitPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* FlushPage (At once)
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
|
|
|
* Destroy the Lists
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2002-09-19 16:21:15 +00:00
|
|
|
QuitPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(QUIT_PAGE);
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
/* Destroy the NTOS installations list */
|
|
|
|
if (NtOsInstallsList != NULL)
|
|
|
|
{
|
|
|
|
DestroyGenericList(NtOsInstallsList, TRUE);
|
|
|
|
NtOsInstallsList = NULL;
|
|
|
|
}
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
/* Destroy the partition list */
|
2008-01-07 16:50:40 +00:00
|
|
|
if (PartitionList != NULL)
|
2003-08-04 15:54:05 +00:00
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
DestroyPartitionList(PartitionList);
|
2008-01-07 16:50:40 +00:00
|
|
|
PartitionList = NULL;
|
2003-08-04 15:54:05 +00:00
|
|
|
}
|
2018-01-05 01:51:51 +00:00
|
|
|
|
2019-02-25 19:29:16 +00:00
|
|
|
/* Reset the formatter machine state */
|
2017-05-18 01:05:39 +00:00
|
|
|
TempPartition = NULL;
|
|
|
|
FormatState = Start;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
/* Destroy the filesystem list */
|
2019-02-25 19:29:16 +00:00
|
|
|
ResetFileSystemList();
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_REBOOTCOMPUTER2));
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2018-08-22 09:10:18 +00:00
|
|
|
/* Wait for maximum 15 seconds or an ENTER key before quitting */
|
|
|
|
ProgressCountdown(Ir, 15);
|
|
|
|
return FLUSH_PAGE;
|
2002-09-08 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the SuccessPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* FlushPage (At once)
|
|
|
|
*
|
|
|
|
* SIDEEFFECTS
|
|
|
|
* Destroy the Lists
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2003-03-24 19:12:10 +00:00
|
|
|
static PAGE_NUMBER
|
2002-09-08 18:29:56 +00:00
|
|
|
SuccessPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(SUCCESS_PAGE);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
if (IsUnattendedSetup)
|
|
|
|
return FLUSH_PAGE;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
2018-08-22 09:10:18 +00:00
|
|
|
/* Wait for maximum 15 seconds or an ENTER key before quitting */
|
|
|
|
ProgressCountdown(Ir, 15);
|
|
|
|
return FLUSH_PAGE;
|
2002-09-08 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* Displays the FlushPage.
|
|
|
|
*
|
|
|
|
* Next pages:
|
|
|
|
* RebootPage (At once)
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Number of the next page.
|
|
|
|
*/
|
2004-01-20 23:39:06 +00:00
|
|
|
static PAGE_NUMBER
|
|
|
|
FlushPage(PINPUT_RECORD Ir)
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
MUIDisplayPage(FLUSH_PAGE);
|
|
|
|
return REBOOT_PAGE;
|
2004-01-20 23:39:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
/*
|
|
|
|
* The start routine and page management
|
|
|
|
*/
|
2017-06-09 16:37:53 +00:00
|
|
|
NTSTATUS
|
2006-08-31 12:35:39 +00:00
|
|
|
RunUSetup(VOID)
|
2002-09-08 18:29:56 +00:00
|
|
|
{
|
2017-06-09 16:37:53 +00:00
|
|
|
NTSTATUS Status;
|
2008-01-07 16:50:40 +00:00
|
|
|
INPUT_RECORD Ir;
|
|
|
|
PAGE_NUMBER Page;
|
2014-08-30 07:04:57 +00:00
|
|
|
BOOLEAN Old;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-06-09 16:37:53 +00:00
|
|
|
InfSetHeap(ProcessHeap);
|
|
|
|
|
|
|
|
/* Tell the Cm this is a setup boot, and it has to behave accordingly */
|
|
|
|
Status = NtInitializeRegistry(CM_BOOT_FLAG_SETUP);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-12-23 19:28:19 +00:00
|
|
|
/* Initialize the user-mode PnP manager */
|
|
|
|
Status = InitializeUserModePnpManager(&USetupData.SetupInf);
|
2008-01-07 16:50:40 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2018-12-23 19:28:19 +00:00
|
|
|
{
|
|
|
|
// PrintString(??);
|
|
|
|
DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
if (!CONSOLE_Init())
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
PrintString(MUIGetString(STRING_CONSOLEFAIL1));
|
|
|
|
PrintString(MUIGetString(STRING_CONSOLEFAIL2));
|
|
|
|
PrintString(MUIGetString(STRING_CONSOLEFAIL3));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2017-06-09 16:37:53 +00:00
|
|
|
/* We failed to initialize the video, just quit the installer */
|
|
|
|
return STATUS_APP_INIT_FAILURE;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
/* Initialize Setup, phase 0 */
|
|
|
|
InitializeSetup(&USetupData, 0);
|
2018-10-28 21:51:33 +00:00
|
|
|
USetupData.ErrorRoutine = USetupErrorRoutine;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2018-12-23 19:28:19 +00:00
|
|
|
/* Hide the cursor and clear the screen and keyboard buffer */
|
2008-01-07 16:50:40 +00:00
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
2017-05-15 01:48:19 +00:00
|
|
|
CONSOLE_ClearScreen();
|
|
|
|
CONSOLE_Flush();
|
2018-12-23 19:28:19 +00:00
|
|
|
|
|
|
|
/* Global Initialization page */
|
2017-05-15 01:48:19 +00:00
|
|
|
Page = SetupStartPage(&Ir);
|
|
|
|
|
2014-12-20 21:58:22 +00:00
|
|
|
while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
|
2008-01-07 16:50:40 +00:00
|
|
|
{
|
|
|
|
CONSOLE_ClearScreen();
|
|
|
|
CONSOLE_Flush();
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
// CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
switch (Page)
|
|
|
|
{
|
|
|
|
/* Language page */
|
|
|
|
case LANGUAGE_PAGE:
|
|
|
|
Page = LanguagePage(&Ir);
|
|
|
|
break;
|
|
|
|
|
2017-05-15 01:48:19 +00:00
|
|
|
/* Welcome page */
|
|
|
|
case WELCOME_PAGE:
|
|
|
|
Page = WelcomePage(&Ir);
|
|
|
|
break;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
/* License page */
|
|
|
|
case LICENSE_PAGE:
|
|
|
|
Page = LicensePage(&Ir);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Install pages */
|
|
|
|
case INSTALL_INTRO_PAGE:
|
|
|
|
Page = InstallIntroPage(&Ir);
|
|
|
|
break;
|
2002-09-19 16:21:15 +00:00
|
|
|
|
2004-06-23 14:09:55 +00:00
|
|
|
#if 0
|
2008-01-07 16:50:40 +00:00
|
|
|
case SCSI_CONTROLLER_PAGE:
|
|
|
|
Page = ScsiControllerPage(&Ir);
|
|
|
|
break;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case OEM_DRIVER_PAGE:
|
|
|
|
Page = OemDriverPage(&Ir);
|
|
|
|
break;
|
2002-09-19 16:21:15 +00:00
|
|
|
#endif
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case DEVICE_SETTINGS_PAGE:
|
|
|
|
Page = DeviceSettingsPage(&Ir);
|
|
|
|
break;
|
2004-05-26 20:58:37 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case COMPUTER_SETTINGS_PAGE:
|
|
|
|
Page = ComputerSettingsPage(&Ir);
|
|
|
|
break;
|
2004-05-26 20:58:37 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case DISPLAY_SETTINGS_PAGE:
|
|
|
|
Page = DisplaySettingsPage(&Ir);
|
|
|
|
break;
|
2004-05-26 20:58:37 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case KEYBOARD_SETTINGS_PAGE:
|
|
|
|
Page = KeyboardSettingsPage(&Ir);
|
|
|
|
break;
|
2004-05-26 20:58:37 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case LAYOUT_SETTINGS_PAGE:
|
|
|
|
Page = LayoutSettingsPage(&Ir);
|
|
|
|
break;
|
2004-05-26 20:58:37 +00:00
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
/* Partitioning pages */
|
2008-01-07 16:50:40 +00:00
|
|
|
case SELECT_PARTITION_PAGE:
|
|
|
|
Page = SelectPartitionPage(&Ir);
|
|
|
|
break;
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2014-05-20 23:48:36 +00:00
|
|
|
case CREATE_PRIMARY_PARTITION_PAGE:
|
|
|
|
Page = CreatePrimaryPartitionPage(&Ir);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CREATE_EXTENDED_PARTITION_PAGE:
|
|
|
|
Page = CreateExtendedPartitionPage(&Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2014-06-08 19:05:03 +00:00
|
|
|
case CREATE_LOGICAL_PARTITION_PAGE:
|
|
|
|
Page = CreateLogicalPartitionPage(&Ir);
|
|
|
|
break;
|
|
|
|
|
2015-08-09 13:14:00 +00:00
|
|
|
case CONFIRM_DELETE_SYSTEM_PARTITION_PAGE:
|
|
|
|
Page = ConfirmDeleteSystemPartitionPage(&Ir);
|
|
|
|
break;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case DELETE_PARTITION_PAGE:
|
|
|
|
Page = DeletePartitionPage(&Ir);
|
|
|
|
break;
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
/* Filesystem partition operations pages */
|
2008-01-07 16:50:40 +00:00
|
|
|
case SELECT_FILE_SYSTEM_PAGE:
|
|
|
|
Page = SelectFileSystemPage(&Ir);
|
|
|
|
break;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case FORMAT_PARTITION_PAGE:
|
2017-05-15 16:22:18 +00:00
|
|
|
Page = FormatPartitionPage(&Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case CHECK_FILE_SYSTEM_PAGE:
|
2017-05-15 16:22:18 +00:00
|
|
|
Page = CheckFileSystemPage(&Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
/* Installation pages */
|
2008-01-07 16:50:40 +00:00
|
|
|
case INSTALL_DIRECTORY_PAGE:
|
|
|
|
Page = InstallDirectoryPage(&Ir);
|
|
|
|
break;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case PREPARE_COPY_PAGE:
|
|
|
|
Page = PrepareCopyPage(&Ir);
|
|
|
|
break;
|
2002-09-08 18:29:56 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case FILE_COPY_PAGE:
|
|
|
|
Page = FileCopyPage(&Ir);
|
|
|
|
break;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case REGISTRY_PAGE:
|
|
|
|
Page = RegistryPage(&Ir);
|
|
|
|
break;
|
2003-01-17 13:18:15 +00:00
|
|
|
|
2020-11-24 01:26:52 +00:00
|
|
|
/* Bootloader installation pages */
|
2008-01-07 16:50:40 +00:00
|
|
|
case BOOT_LOADER_PAGE:
|
|
|
|
Page = BootLoaderPage(&Ir);
|
|
|
|
break;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case BOOT_LOADER_FLOPPY_PAGE:
|
|
|
|
Page = BootLoaderFloppyPage(&Ir);
|
|
|
|
break;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2021-04-07 08:11:07 +00:00
|
|
|
case BOOT_LOADER_INSTALLATION_PAGE:
|
|
|
|
Page = BootLoaderInstallationPage(&Ir);
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
/* Repair pages */
|
|
|
|
case REPAIR_INTRO_PAGE:
|
|
|
|
Page = RepairIntroPage(&Ir);
|
|
|
|
break;
|
2002-10-29 18:40:02 +00:00
|
|
|
|
2018-05-31 14:38:06 +00:00
|
|
|
case UPGRADE_REPAIR_PAGE:
|
|
|
|
Page = UpgradeRepairPage(&Ir);
|
|
|
|
break;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case SUCCESS_PAGE:
|
|
|
|
Page = SuccessPage(&Ir);
|
|
|
|
break;
|
2002-09-19 16:21:15 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case FLUSH_PAGE:
|
|
|
|
Page = FlushPage(&Ir);
|
|
|
|
break;
|
2004-01-20 23:39:06 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
case QUIT_PAGE:
|
|
|
|
Page = QuitPage(&Ir);
|
|
|
|
break;
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2018-12-23 20:00:56 +00:00
|
|
|
/* Virtual pages */
|
|
|
|
case SETUP_INIT_PAGE:
|
2008-01-07 16:50:40 +00:00
|
|
|
case REBOOT_PAGE:
|
2018-12-23 20:00:56 +00:00
|
|
|
case RECOVERY_PAGE:
|
2008-01-07 16:50:40 +00:00
|
|
|
break;
|
2019-08-25 03:07:31 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2008-01-07 16:50:40 +00:00
|
|
|
}
|
2002-09-19 16:21:15 +00:00
|
|
|
}
|
|
|
|
|
2018-12-23 19:28:19 +00:00
|
|
|
/* Terminate the user-mode PnP manager */
|
|
|
|
TerminateUserModePnpManager();
|
|
|
|
|
2018-01-05 01:51:51 +00:00
|
|
|
/* Setup has finished */
|
|
|
|
FinishSetup(&USetupData);
|
2017-08-09 20:39:45 +00:00
|
|
|
|
2014-12-20 21:58:22 +00:00
|
|
|
if (Page == RECOVERY_PAGE)
|
|
|
|
RecoveryConsole();
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
FreeConsole();
|
2007-03-13 16:08:49 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
/* Reboot */
|
2014-08-30 07:04:57 +00:00
|
|
|
RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, TRUE, FALSE, &Old);
|
2008-01-07 16:50:40 +00:00
|
|
|
NtShutdownSystem(ShutdownReboot);
|
2014-08-30 07:04:57 +00:00
|
|
|
RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, Old, FALSE, &Old);
|
2017-06-09 16:37:53 +00:00
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
2002-09-08 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
2006-08-31 12:35:39 +00:00
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
NtProcessStartup(PPEB Peb)
|
|
|
|
{
|
2017-06-09 16:37:53 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
LARGE_INTEGER Time;
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
RtlNormalizeProcessParams(Peb->ProcessParameters);
|
2006-08-31 12:35:39 +00:00
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
ProcessHeap = Peb->ProcessHeap;
|
2017-06-09 16:37:53 +00:00
|
|
|
|
|
|
|
NtQuerySystemTime(&Time);
|
|
|
|
|
|
|
|
Status = RunUSetup();
|
|
|
|
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
|
|
|
|
* a protective waiting.
|
|
|
|
* This wait is needed because, since we are started as SMSS.EXE,
|
|
|
|
* the NT kernel explicitly waits 5 seconds for the initial process
|
|
|
|
* SMSS.EXE to initialize (as a protective measure), and otherwise
|
|
|
|
* bugchecks with the code SESSION5_INITIALIZATION_FAILED.
|
|
|
|
*/
|
|
|
|
Time.QuadPart += 50000000;
|
|
|
|
NtDelayExecution(FALSE, &Time);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* The installer failed to start: raise a hard error (crash the system/BSOD) */
|
|
|
|
Status = NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
|
|
|
|
0, 0, NULL, 0, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
NtTerminateProcess(NtCurrentProcess(), Status);
|
2006-08-31 12:35:39 +00:00
|
|
|
}
|
|
|
|
|
2002-09-08 18:29:56 +00:00
|
|
|
/* EOF */
|