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-05-27 19:33:07 +00:00
|
|
|
|
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
2006-11-10 21:00:24 +00:00
|
|
|
|
* Herv<EFBFBD> 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>
|
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"
|
2014-01-13 13:01:38 +00:00
|
|
|
|
#include "format.h"
|
|
|
|
|
#include "drivesup.h"
|
|
|
|
|
#include "settings.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
|
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
|
/* GLOBALS ******************************************************************/
|
|
|
|
|
|
2002-09-08 18:29:56 +00:00
|
|
|
|
HANDLE ProcessHeap;
|
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
|
|
|
|
UNICODE_STRING SourceRootPath;
|
2007-10-02 12:16:45 +00:00
|
|
|
|
UNICODE_STRING SourceRootDir;
|
2006-11-10 21:00:24 +00:00
|
|
|
|
UNICODE_STRING SourcePath;
|
2006-09-13 12:33:59 +00:00
|
|
|
|
BOOLEAN IsUnattendedSetup = FALSE;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
LONG UnattendDestinationDiskNumber;
|
|
|
|
|
LONG UnattendDestinationPartitionNumber;
|
2006-08-02 18:58:07 +00:00
|
|
|
|
LONG UnattendMBRInstallType = -1;
|
2006-10-22 18:40:37 +00:00
|
|
|
|
LONG UnattendFormatPartition = 0;
|
2007-08-27 18:40:02 +00:00
|
|
|
|
LONG AutoPartition = 0;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
WCHAR UnattendInstallationDirectory[MAX_PATH];
|
2007-12-25 20:24:19 +00:00
|
|
|
|
PWCHAR SelectedLanguageId;
|
2008-12-17 13:06:32 +00:00
|
|
|
|
WCHAR LocaleID[9];
|
2008-01-06 23:36:01 +00:00
|
|
|
|
WCHAR DefaultLanguage[20];
|
|
|
|
|
WCHAR DefaultKBLayout[20];
|
2007-06-30 19:37:43 +00:00
|
|
|
|
BOOLEAN RepairUpdateFlag = FALSE;
|
2007-12-06 16:25:57 +00:00
|
|
|
|
HANDLE hPnpThread = INVALID_HANDLE_VALUE;
|
2017-05-18 01:05:39 +00:00
|
|
|
|
|
2010-09-06 01:46:06 +00:00
|
|
|
|
PPARTLIST PartitionList = NULL;
|
2017-05-18 01:05:39 +00:00
|
|
|
|
PPARTENTRY TempPartition = NULL;
|
|
|
|
|
FORMATMACHINESTATE FormatState = Start;
|
|
|
|
|
|
2003-08-04 15:54:05 +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
|
|
|
|
/* LOCALS *******************************************************************/
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
2003-08-04 15:54:05 +00:00
|
|
|
|
static PFILE_SYSTEM_LIST FileSystemList = NULL;
|
2002-10-18 20:04:00 +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
|
|
|
|
static UNICODE_STRING InstallPath;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
|
/*
|
|
|
|
|
* Path to the system partition, where the boot manager resides.
|
|
|
|
|
* On x86 PCs, this is usually the active partition.
|
|
|
|
|
* On ARC, (u)EFI, ... platforms, this is a dedicated partition.
|
|
|
|
|
*
|
|
|
|
|
* For more information, see:
|
|
|
|
|
* https://en.wikipedia.org/wiki/System_partition_and_boot_partition
|
|
|
|
|
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
|
|
|
|
|
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
|
|
|
|
|
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
|
|
|
|
|
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
|
|
|
|
|
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
|
|
|
|
|
*/
|
|
|
|
|
static UNICODE_STRING SystemRootPath;
|
|
|
|
|
|
|
|
|
|
/* Path to the install directory inside the ReactOS boot partition */
|
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 UNICODE_STRING DestinationPath;
|
|
|
|
|
static UNICODE_STRING DestinationArcPath;
|
|
|
|
|
static UNICODE_STRING DestinationRootPath;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
static WCHAR DestinationDriveLetter; // FIXME: Is it really useful??
|
2014-04-09 21:49:30 +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
|
|
|
|
static HINF SetupInf;
|
2003-01-17 13:18:15 +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
|
|
|
|
static HSPFILEQ SetupFileQueue = NULL;
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2004-05-28 12:14:00 +00:00
|
|
|
|
static PGENERIC_LIST ComputerList = NULL;
|
|
|
|
|
static PGENERIC_LIST DisplayList = NULL;
|
|
|
|
|
static PGENERIC_LIST KeyboardList = NULL;
|
|
|
|
|
static PGENERIC_LIST LayoutList = NULL;
|
2007-12-13 16:15:43 +00:00
|
|
|
|
static PGENERIC_LIST LanguageList = NULL;
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
2010-04-26 15:10:23 +00:00
|
|
|
|
static LANGID LanguageId = 0;
|
|
|
|
|
|
2010-05-24 22:32:23 +00:00
|
|
|
|
static ULONG RequiredPartitionDiskSpace = ~0;
|
|
|
|
|
|
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
|
2002-09-08 18:29:56 +00:00
|
|
|
|
PrintString(char* fmt,...)
|
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
char buffer[512];
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/* draw upper left corner */
|
|
|
|
|
coPos.X = xLeft;
|
|
|
|
|
coPos.Y = yTop;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xDA, // '+',
|
|
|
|
|
1,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* draw upper edge */
|
|
|
|
|
coPos.X = xLeft + 1;
|
|
|
|
|
coPos.Y = yTop;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xC4, // '-',
|
|
|
|
|
Width - 2,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* draw upper right corner */
|
|
|
|
|
coPos.X = xLeft + Width - 1;
|
|
|
|
|
coPos.Y = yTop;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xBF, // '+',
|
|
|
|
|
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,
|
|
|
|
|
0xB3, // '|',
|
|
|
|
|
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,
|
|
|
|
|
0xB3, // '|',
|
|
|
|
|
1,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw lower left corner */
|
|
|
|
|
coPos.X = xLeft;
|
|
|
|
|
coPos.Y = yTop + Height - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xC0, // '+',
|
|
|
|
|
1,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* draw lower edge */
|
|
|
|
|
coPos.X = xLeft + 1;
|
|
|
|
|
coPos.Y = yTop + Height - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xC4, // '-',
|
|
|
|
|
Width - 2,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* draw lower right corner */
|
|
|
|
|
coPos.X = xLeft + Width - 1;
|
|
|
|
|
coPos.Y = yTop + Height - 1;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xD9, // '+',
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (LastLine != FALSE)
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (LastLine != FALSE)
|
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,
|
|
|
|
|
0xC3, // '+',
|
|
|
|
|
1,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
|
|
coPos.X = xLeft + 1;
|
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xC4, // '-',
|
|
|
|
|
Width - 2,
|
|
|
|
|
coPos,
|
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
|
|
coPos.X = xLeft + Width - 1;
|
|
|
|
|
FillConsoleOutputCharacterA(StdOutput,
|
|
|
|
|
0xB4, // '+',
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-10-06 19:22:42 +00:00
|
|
|
|
VOID
|
2004-05-26 20:58:37 +00:00
|
|
|
|
CheckUnattendedSetup(VOID)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
WCHAR UnattendInfPath[MAX_PATH];
|
|
|
|
|
INFCONTEXT Context;
|
|
|
|
|
HINF UnattendInf;
|
|
|
|
|
UINT ErrorLine;
|
|
|
|
|
INT IntValue;
|
|
|
|
|
PWCHAR Value;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2, SourcePath.Buffer, L"\\unattend.inf");
|
|
|
|
|
|
2017-05-24 16:37:49 +00:00
|
|
|
|
if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2017-05-23 22:30:54 +00:00
|
|
|
|
DPRINT("Does not exist: %S\n", UnattendInfPath);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Load 'unattend.inf' from install media. */
|
|
|
|
|
UnattendInf = SetupOpenInfFileW(UnattendInfPath,
|
|
|
|
|
NULL,
|
|
|
|
|
INF_STYLE_WIN4,
|
2010-04-26 15:10:23 +00:00
|
|
|
|
LanguageId,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
&ErrorLine);
|
|
|
|
|
|
|
|
|
|
if (UnattendInf == INVALID_HANDLE_VALUE)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("SetupOpenInfFileW() failed\n");
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Open 'Unattend' section */
|
|
|
|
|
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"Signature", &Context))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get pointer 'Signature' key */
|
|
|
|
|
if (!INF_GetData(&Context, NULL, &Value))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("INF_GetData() failed for key 'Signature'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Check 'Signature' string */
|
|
|
|
|
if (_wcsicmp(Value, L"$ReactOS$") != 0)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Signature not $ReactOS$\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Check if Unattend setup is enabled */
|
|
|
|
|
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context))
|
2006-09-13 12:33:59 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Can't find key 'UnattendSetupEnabled'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2006-09-13 12:33:59 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (!INF_GetData(&Context, NULL, &Value))
|
2006-09-13 12:33:59 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Can't read key 'UnattendSetupEnabled'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2006-09-13 12:33:59 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (_wcsicmp(Value, L"yes") != 0)
|
2006-09-13 12:33:59 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2006-09-13 12:33:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Search for 'DestinationDiskNumber' in the 'Unattend' section */
|
|
|
|
|
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (!SetupGetIntField(&Context, 1, &IntValue))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
UnattendDestinationDiskNumber = (LONG)IntValue;
|
|
|
|
|
|
|
|
|
|
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
|
|
|
|
|
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (!SetupGetIntField(&Context, 1, &IntValue))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
UnattendDestinationPartitionNumber = (LONG)IntValue;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2012-02-27 16:37:48 +00:00
|
|
|
|
/* Search for 'InstallationDirectory' in the 'Unattend' section */
|
|
|
|
|
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"InstallationDirectory", &Context))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2012-02-27 16:37:48 +00:00
|
|
|
|
DPRINT("SetupFindFirstLine() failed for key 'InstallationDirectory'\n");
|
2008-01-07 16:50:40 +00:00
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
2004-02-23 11:58:27 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get pointer 'InstallationDirectory' key */
|
|
|
|
|
if (!INF_GetData(&Context, NULL, &Value))
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
|
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
return;
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
wcscpy(UnattendInstallationDirectory, Value);
|
2003-10-06 19:22:42 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
IsUnattendedSetup = TRUE;
|
|
|
|
|
|
|
|
|
|
/* Search for 'MBRInstallType' in the 'Unattend' section */
|
|
|
|
|
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"MBRInstallType", &Context))
|
2006-08-02 18:58:07 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (SetupGetIntField(&Context, 1, &IntValue))
|
2006-10-22 18:40:37 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
UnattendMBRInstallType = IntValue;
|
2006-10-22 18:40:37 +00:00
|
|
|
|
}
|
2006-08-02 18:58:07 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* Search for 'FormatPartition' in the 'Unattend' section */
|
|
|
|
|
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context))
|
2006-08-02 18:58:07 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (SetupGetIntField(&Context, 1, &IntValue))
|
2006-10-22 18:40:37 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
UnattendFormatPartition = IntValue;
|
2006-10-22 18:40:37 +00:00
|
|
|
|
}
|
2006-08-02 18:58:07 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"AutoPartition", &Context))
|
2007-08-27 18:40:02 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (SetupGetIntField(&Context, 1, &IntValue))
|
2007-08-27 18:40:02 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
AutoPartition = IntValue;
|
2007-08-27 18:40:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2006-08-02 18:58:07 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
/* search for LocaleID in the 'Unattend' section*/
|
2016-02-29 20:58:32 +00:00
|
|
|
|
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"LocaleID", &Context))
|
2010-06-11 21:21:27 +00:00
|
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
|
if (INF_GetData(&Context, NULL, &Value))
|
2010-06-11 21:21:27 +00:00
|
|
|
|
{
|
|
|
|
|
LONG Id = wcstol(Value, NULL, 16);
|
|
|
|
|
swprintf(LocaleID,L"%08lx", Id);
|
|
|
|
|
}
|
2008-12-17 13:06:32 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
SetupCloseInfFile(UnattendInf);
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Running unattended setup\n");
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2008-01-09 09:40:47 +00:00
|
|
|
|
VOID
|
|
|
|
|
UpdateKBLayout(VOID)
|
2008-01-06 23:36:01 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PGENERIC_LIST_ENTRY ListEntry;
|
2008-01-09 09:40:47 +00:00
|
|
|
|
LPCWSTR pszNewLayout;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2008-01-09 09:40:47 +00:00
|
|
|
|
pszNewLayout = MUIDefaultKeyboardLayout();
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (LayoutList == NULL)
|
|
|
|
|
{
|
|
|
|
|
LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
|
2009-04-20 03:16:12 +00:00
|
|
|
|
if (LayoutList == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
return;
|
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-05-11 21:17:57 +00:00
|
|
|
|
ListEntry = GetFirstListEntry(LayoutList);
|
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)
|
|
|
|
|
{
|
2008-05-11 21:17:57 +00:00
|
|
|
|
while (ListEntry != NULL)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2008-05-11 21:17:57 +00:00
|
|
|
|
if (!wcscmp(pszNewLayout, GetListEntryUserData(ListEntry)))
|
2008-01-09 09:40:47 +00:00
|
|
|
|
{
|
2008-05-11 21:17:57 +00:00
|
|
|
|
SetCurrentListEntry(LayoutList, ListEntry);
|
2008-01-09 09:40:47 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2008-05-11 21:17:57 +00:00
|
|
|
|
ListEntry = GetNextListEntry(ListEntry);
|
2008-01-09 09:40:47 +00:00
|
|
|
|
}
|
2008-01-06 23:36:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
/*
|
|
|
|
|
* Displays the LanguagePage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages: IntroPage, QuitPage
|
|
|
|
|
*
|
2016-05-06 20:17:20 +00:00
|
|
|
|
* SIDEEFFECTS
|
|
|
|
|
* Init SelectedLanguageId
|
|
|
|
|
* Init LanguageId
|
|
|
|
|
*
|
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;
|
2011-11-26 18:27:42 +00:00
|
|
|
|
PWCHAR NewLanguageId;
|
|
|
|
|
BOOL RefreshPage = FALSE;
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Initialize the computer settings list */
|
|
|
|
|
if (LanguageList == NULL)
|
2007-12-13 16:15:43 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
|
|
|
|
|
if (LanguageList == NULL)
|
2007-12-13 16:15:43 +00:00
|
|
|
|
{
|
|
|
|
|
PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
|
2007-12-23 20:29:52 +00:00
|
|
|
|
return INTRO_PAGE;
|
2007-12-13 16:15:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-26 22:23:34 +00:00
|
|
|
|
/* Load the font */
|
|
|
|
|
SelectedLanguageId = DefaultLanguage;
|
|
|
|
|
SetConsoleCodePage();
|
2015-10-18 13:52:51 +00:00
|
|
|
|
UpdateKBLayout();
|
|
|
|
|
|
|
|
|
|
/* If there's just a single language in the list skip
|
|
|
|
|
* the language selection process altogether! */
|
|
|
|
|
if (GenericListHasSingleEntry(LanguageList))
|
2016-12-09 18:30:50 +00:00
|
|
|
|
{
|
|
|
|
|
LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
|
2015-10-18 13:52:51 +00:00
|
|
|
|
return INTRO_PAGE;
|
2016-12-09 18:30:50 +00:00
|
|
|
|
}
|
2011-11-26 22:23:34 +00:00
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
InitGenericListUi(&ListUi, LanguageList);
|
|
|
|
|
DrawGenericList(&ListUi,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2,
|
|
|
|
|
18,
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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 */
|
|
|
|
|
{
|
2008-05-11 21:17:57 +00:00
|
|
|
|
SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2010-04-26 15:10:23 +00:00
|
|
|
|
LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
|
|
|
|
|
|
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
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return INTRO_PAGE;
|
|
|
|
|
}
|
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)
|
|
|
|
|
{
|
|
|
|
|
NewLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
|
|
|
|
|
|
|
|
|
|
if (SelectedLanguageId != NewLanguageId)
|
|
|
|
|
{
|
|
|
|
|
/* Clear the language page */
|
|
|
|
|
MUIClearPage(LANGUAGE_PAGE);
|
|
|
|
|
|
|
|
|
|
SelectedLanguageId = NewLanguageId;
|
|
|
|
|
|
|
|
|
|
/* Load the font */
|
|
|
|
|
SetConsoleCodePage();
|
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return INTRO_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
|
|
|
|
|
* Init SourcePath
|
|
|
|
|
* Init SourceRootPath
|
|
|
|
|
* Init SourceRootDir
|
|
|
|
|
* Init SetupInf
|
|
|
|
|
* Init RequiredPartitionDiskSpace
|
|
|
|
|
* Init IsUnattendedSetup
|
|
|
|
|
* If unattended, init *List and sets the Codepage
|
2016-05-06 20:17:20 +00:00
|
|
|
|
* If unattended, init SelectedLanguageId
|
|
|
|
|
* If unattended, init 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
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
WCHAR FileNameBuffer[MAX_PATH];
|
|
|
|
|
INFCONTEXT Context;
|
|
|
|
|
PWCHAR Value;
|
|
|
|
|
UINT ErrorLine;
|
2008-12-17 13:54:50 +00:00
|
|
|
|
PGENERIC_LIST_ENTRY ListEntry;
|
2010-05-24 22:32:23 +00:00
|
|
|
|
INT IntValue;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get the source path and source root path */
|
|
|
|
|
Status = GetSourcePaths(&SourcePath,
|
|
|
|
|
&SourceRootPath,
|
|
|
|
|
&SourceRootDir);
|
|
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
2002-10-29 18:40:02 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status);
|
|
|
|
|
MUIDisplayError(ERROR_NO_SOURCE_DRIVE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2002-10-29 18:40:02 +00:00
|
|
|
|
}
|
2003-05-06 07:17:52 +00:00
|
|
|
|
#if 0
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2002-10-29 18:40:02 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath);
|
|
|
|
|
CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath);
|
|
|
|
|
CONSOLE_PrintTextXY(6, 17, "SourceRootDir: '%wZ'", &SourceRootDir);
|
2002-10-29 18:40:02 +00:00
|
|
|
|
}
|
2003-05-06 07:17:52 +00:00
|
|
|
|
#endif
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Load txtsetup.sif from install media. */
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2, SourcePath.Buffer, L"\\txtsetup.sif");
|
2008-01-07 16:50:40 +00:00
|
|
|
|
SetupInf = SetupOpenInfFileW(FileNameBuffer,
|
|
|
|
|
NULL,
|
|
|
|
|
INF_STYLE_WIN4,
|
2010-04-26 15:10:23 +00:00
|
|
|
|
LanguageId,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
&ErrorLine);
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (SetupInf == INVALID_HANDLE_VALUE)
|
2003-02-08 00:19:32 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_LOAD_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2003-02-08 00:19:32 +00:00
|
|
|
|
}
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Open 'Version' section */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!SetupFindFirstLineW(SetupInf, L"Version", L"Signature", &Context))
|
2003-02-08 00:19:32 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2003-02-08 00:19:32 +00:00
|
|
|
|
}
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get pointer 'Signature' key */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetData(&Context, NULL, &Value))
|
2003-02-08 00:19:32 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2003-02-08 00:19:32 +00:00
|
|
|
|
}
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Check 'Signature' string */
|
|
|
|
|
if (_wcsicmp(Value, L"$ReactOS$") != 0)
|
2002-11-13 18:25:18 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_SIGNATURE_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2002-11-13 18:25:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-05-24 22:32:23 +00:00
|
|
|
|
/* Open 'DiskSpaceRequirements' section */
|
|
|
|
|
if (!SetupFindFirstLineW(SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the 'FreeSysPartDiskSpace' value */
|
|
|
|
|
if (!SetupGetIntField(&Context, 1, &IntValue))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequiredPartitionDiskSpace = (ULONG)IntValue;
|
|
|
|
|
|
2017-05-15 19:41:18 +00:00
|
|
|
|
/* Start the PnP thread */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (hPnpThread != INVALID_HANDLE_VALUE)
|
2007-12-06 16:25:57 +00:00
|
|
|
|
{
|
2008-01-23 10:35:49 +00:00
|
|
|
|
NtResumeThread(hPnpThread, NULL);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
hPnpThread = INVALID_HANDLE_VALUE;
|
2007-12-06 16:25:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
CheckUnattendedSetup();
|
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
|
2007-12-23 20:29:52 +00:00
|
|
|
|
ComputerList = CreateComputerTypeList(SetupInf);
|
|
|
|
|
DisplayList = CreateDisplayDriverList(SetupInf);
|
|
|
|
|
KeyboardList = CreateKeyboardDriverList(SetupInf);
|
2008-01-06 23:36:01 +00:00
|
|
|
|
LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
|
|
|
|
|
LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
|
|
|
|
/* new part */
|
2017-05-15 16:22:18 +00:00
|
|
|
|
wcscpy(SelectedLanguageId, LocaleID);
|
2016-05-06 20:17:20 +00:00
|
|
|
|
LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
|
|
|
|
/* first we hack LanguageList */
|
|
|
|
|
ListEntry = GetFirstListEntry(LanguageList);
|
|
|
|
|
while (ListEntry != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry)))
|
|
|
|
|
{
|
|
|
|
|
DPRINT("found %S in LanguageList\n",GetListEntryUserData(ListEntry));
|
|
|
|
|
SetCurrentListEntry(LanguageList, ListEntry);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ListEntry = GetNextListEntry(ListEntry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* now LayoutList */
|
|
|
|
|
ListEntry = GetFirstListEntry(LayoutList);
|
|
|
|
|
while (ListEntry != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry)))
|
|
|
|
|
{
|
|
|
|
|
DPRINT("found %S in LayoutList\n",GetListEntryUserData(ListEntry));
|
|
|
|
|
SetCurrentListEntry(LayoutList, ListEntry);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ListEntry = GetNextListEntry(ListEntry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
/*
|
2015-12-06 20:14:29 +00:00
|
|
|
|
* Displays the IntroPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* InstallIntroPage (default)
|
|
|
|
|
* RepairIntroPage
|
|
|
|
|
* 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
|
|
|
|
|
IntroPage(PINPUT_RECORD Ir)
|
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayPage(START_PAGE);
|
|
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_ConInKey(Ir);
|
|
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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 */
|
|
|
|
|
{
|
|
|
|
|
return REPAIR_INTRO_PAGE;
|
|
|
|
|
}
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return INTRO_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:
|
|
|
|
|
* IntroPage (default)
|
|
|
|
|
*
|
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 */
|
|
|
|
|
{
|
|
|
|
|
return INTRO_PAGE;
|
|
|
|
|
}
|
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);
|
|
|
|
|
|
|
|
|
|
while(TRUE)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
|
|
|
|
|
{
|
|
|
|
|
return INTRO_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return REPAIR_INTRO_PAGE;
|
2002-09-19 16:21:15 +00:00
|
|
|
|
}
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
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
|
|
|
|
MUIDisplayPage(INSTALL_INTRO_PAGE);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (RepairUpdateFlag)
|
2007-06-30 19:37:43 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
//return SELECT_PARTITION_PAGE;
|
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
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)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return SELECT_PARTITION_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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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 */
|
|
|
|
|
{
|
|
|
|
|
return DEVICE_SETTINGS_PAGE;
|
|
|
|
|
// return SCSI_CONTROLLER_PAGE;
|
|
|
|
|
}
|
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)
|
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
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
|
2008-01-07 16:50:40 +00:00
|
|
|
|
SetTextXY(8, 10, "TEST device");
|
2004-06-23 14:09:55 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
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
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
ConInKey(Ir);
|
|
|
|
|
|
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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
|
|
|
|
}
|
|
|
|
|
#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
|
|
|
|
|
* Init ComputerList
|
|
|
|
|
* Init DisplayList
|
|
|
|
|
* Init KeyboardList
|
|
|
|
|
* Init LayoutList
|
|
|
|
|
*
|
|
|
|
|
* 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;
|
|
|
|
|
MUIDisplayPage(DEVICE_SETTINGS_PAGE);
|
|
|
|
|
|
|
|
|
|
/* Initialize the computer settings list */
|
|
|
|
|
if (ComputerList == NULL)
|
|
|
|
|
{
|
|
|
|
|
ComputerList = CreateComputerTypeList(SetupInf);
|
|
|
|
|
if (ComputerList == NULL)
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_LOAD_COMPUTER, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize the display settings list */
|
|
|
|
|
if (DisplayList == NULL)
|
|
|
|
|
{
|
|
|
|
|
DisplayList = CreateDisplayDriverList(SetupInf);
|
|
|
|
|
if (DisplayList == NULL)
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_LOAD_DISPLAY, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize the keyboard settings list */
|
|
|
|
|
if (KeyboardList == NULL)
|
|
|
|
|
{
|
|
|
|
|
KeyboardList = CreateKeyboardDriverList(SetupInf);
|
|
|
|
|
if (KeyboardList == NULL)
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_LOAD_KEYBOARD, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize the keyboard layout list */
|
|
|
|
|
if (LayoutList == NULL)
|
|
|
|
|
{
|
|
|
|
|
LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
|
|
|
|
|
if (LayoutList == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: report error */
|
|
|
|
|
MUIDisplayError(ERROR_LOAD_KBLAYOUT, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MUIDisplayPage(DEVICE_SETTINGS_PAGE);
|
|
|
|
|
|
|
|
|
|
|
2008-05-11 21:17:57 +00:00
|
|
|
|
CONSOLE_SetTextXY(25, 11, GetListEntryText(GetCurrentListEntry((ComputerList))));
|
|
|
|
|
CONSOLE_SetTextXY(25, 12, GetListEntryText(GetCurrentListEntry((DisplayList))));
|
|
|
|
|
CONSOLE_SetTextXY(25, 13, GetListEntryText(GetCurrentListEntry((KeyboardList))));
|
|
|
|
|
CONSOLE_SetTextXY(25, 14, GetListEntryText(GetCurrentListEntry((LayoutList))));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_InvertTextXY(24, Line, 48, 1);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (RepairUpdateFlag)
|
|
|
|
|
{
|
|
|
|
|
return SELECT_PARTITION_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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
|
|
|
|
}
|
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
|
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
|
RestoreGenericListState(ListUi->List);
|
|
|
|
|
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);
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
InitGenericListUi(&ListUi, ComputerList);
|
|
|
|
|
DrawGenericList(&ListUi,
|
2015-12-06 20:14:29 +00:00
|
|
|
|
2,
|
|
|
|
|
18,
|
|
|
|
|
xScreen - 3,
|
|
|
|
|
yScreen - 3);
|
|
|
|
|
|
|
|
|
|
SaveGenericListState(ComputerList);
|
|
|
|
|
|
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);
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
InitGenericListUi(&ListUi, DisplayList);
|
|
|
|
|
DrawGenericList(&ListUi,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2,
|
|
|
|
|
18,
|
|
|
|
|
xScreen - 3,
|
|
|
|
|
yScreen - 3);
|
|
|
|
|
|
|
|
|
|
SaveGenericListState(DisplayList);
|
|
|
|
|
|
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);
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
InitGenericListUi(&ListUi, KeyboardList);
|
|
|
|
|
DrawGenericList(&ListUi,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2,
|
|
|
|
|
18,
|
|
|
|
|
xScreen - 3,
|
|
|
|
|
yScreen - 3);
|
|
|
|
|
|
|
|
|
|
SaveGenericListState(KeyboardList);
|
|
|
|
|
|
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);
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
InitGenericListUi(&ListUi, LayoutList);
|
|
|
|
|
DrawGenericList(&ListUi,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
2,
|
2008-05-13 11:43:39 +00:00
|
|
|
|
18,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
xScreen - 3,
|
|
|
|
|
yScreen - 3);
|
|
|
|
|
|
|
|
|
|
SaveGenericListState(LayoutList);
|
|
|
|
|
|
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;
|
|
|
|
|
size = (size + 524288) / 1048576; /* in MBytes */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2014-12-27 12:33:59 +00:00
|
|
|
|
if (size < RequiredPartitionDiskSpace)
|
2010-05-24 20:53:32 +00:00
|
|
|
|
{
|
2016-11-05 14:55:55 +00:00
|
|
|
|
/* partition is too small so ask for another partition */
|
2014-12-27 12:33:59 +00:00
|
|
|
|
DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, 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
|
|
|
|
|
* Init DestinationDriveLetter (only if unattended or not free space is selected)
|
|
|
|
|
* 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
|
|
|
|
MUIDisplayPage(SELECT_PARTITION_PAGE);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
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
|
|
|
|
|
|
|
|
|
TempPartition = NULL;
|
|
|
|
|
FormatState = Start;
|
2002-09-19 16:21:15 +00:00
|
|
|
|
}
|
2003-08-12 15:56:21 +00:00
|
|
|
|
|
2017-05-15 19:41:18 +00:00
|
|
|
|
InitPartitionListUi(&ListUi, PartitionList,
|
|
|
|
|
2,
|
|
|
|
|
23,
|
|
|
|
|
xScreen - 3,
|
|
|
|
|
yScreen - 3);
|
|
|
|
|
DrawPartitionList(&ListUi);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (IsUnattendedSetup)
|
2003-08-20 20:07:33 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!SelectPartition(PartitionList, UnattendDestinationDiskNumber, UnattendDestinationPartitionNumber))
|
|
|
|
|
{
|
|
|
|
|
if (AutoPartition)
|
|
|
|
|
{
|
2015-07-04 16:04:09 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->LogicalPartition)
|
|
|
|
|
{
|
|
|
|
|
CreateLogicalPartition(PartitionList,
|
|
|
|
|
PartitionList->CurrentPartition->SectorCount.QuadPart,
|
|
|
|
|
TRUE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CreatePrimaryPartition(PartitionList,
|
|
|
|
|
PartitionList->CurrentPartition->SectorCount.QuadPart,
|
|
|
|
|
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??
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (!IsDiskSizeValid(PartitionList->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,
|
|
|
|
|
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
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter;
|
2014-04-17 21:32:35 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-15 19:41:18 +00:00
|
|
|
|
DrawPartitionList(&ListUi);
|
|
|
|
|
|
|
|
|
|
// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (!IsDiskSizeValid(PartitionList->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,
|
|
|
|
|
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
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter;
|
2014-04-17 21:32:35 +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
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Update status text */
|
2014-06-08 19:05:03 +00:00
|
|
|
|
if (PartitionList->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
|
|
|
|
}
|
2014-06-08 19:05:03 +00:00
|
|
|
|
else if (PartitionList->CurrentPartition->LogicalPartition)
|
2014-05-20 23:48:36 +00:00
|
|
|
|
{
|
2017-05-13 16:23:08 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->IsPartitioned)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
{
|
2017-05-13 16:23:08 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->IsPartitioned)
|
|
|
|
|
{
|
|
|
|
|
if (IsContainerPartition(PartitionList->CurrentPartition->PartitionType))
|
|
|
|
|
{
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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 */
|
|
|
|
|
{
|
2014-05-20 23:48:36 +00:00
|
|
|
|
if (IsContainerPartition(PartitionList->CurrentPartition->PartitionType))
|
2017-05-13 16:23:08 +00:00
|
|
|
|
continue; // return SELECT_PARTITION_PAGE;
|
2014-05-20 23:48:36 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (PartitionList->CurrentPartition == NULL ||
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartitionList->CurrentPartition->IsPartitioned == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2015-07-04 16:04:09 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->LogicalPartition)
|
|
|
|
|
{
|
|
|
|
|
CreateLogicalPartition(PartitionList,
|
|
|
|
|
0ULL,
|
|
|
|
|
TRUE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CreatePrimaryPartition(PartitionList,
|
|
|
|
|
0ULL,
|
|
|
|
|
TRUE);
|
|
|
|
|
}
|
2015-01-04 13:53:45 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2015-01-04 13:53:45 +00:00
|
|
|
|
if (!IsDiskSizeValid(PartitionList->CurrentPartition))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
|
|
|
|
RequiredPartitionDiskSpace);
|
|
|
|
|
return SELECT_PARTITION_PAGE; /* let the user select another partition */
|
2014-12-27 12:33:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter;
|
2014-04-09 21:49:30 +00:00
|
|
|
|
|
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 */
|
|
|
|
|
{
|
2014-06-08 19:05:03 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->LogicalPartition == FALSE)
|
2014-05-20 23:48:36 +00:00
|
|
|
|
{
|
2014-06-08 19:05:03 +00:00
|
|
|
|
Error = PrimaryPartitionCreationChecks(PartitionList);
|
|
|
|
|
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
|
|
|
|
{
|
2014-06-08 19:05:03 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->LogicalPartition == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2014-06-08 19:05:03 +00:00
|
|
|
|
Error = ExtendedPartitionCreationChecks(PartitionList);
|
|
|
|
|
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 */
|
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->LogicalPartition != FALSE)
|
2014-06-08 19:05:03 +00:00
|
|
|
|
{
|
|
|
|
|
Error = LogicalPartitionCreationChecks(PartitionList);
|
|
|
|
|
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 */
|
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (PartitionList->CurrentPartition->IsPartitioned == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_DELETE_SPACE, Ir, POPUP_WAIT_ANY_KEY);
|
|
|
|
|
return SELECT_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
|
|
|
|
if (PartitionList->CurrentPartition->BootIndicator ||
|
|
|
|
|
PartitionList->CurrentPartition == PartitionList->SystemPartition)
|
|
|
|
|
{
|
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
|
|
|
|
|
/* Restriction for MaxSize: pow(10, (PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)) - 1 */
|
|
|
|
|
#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));
|
|
|
|
|
iLeft = coPos.X + 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;
|
|
|
|
|
}
|
2015-05-04 20:50:51 +00:00
|
|
|
|
else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESCAPE */
|
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
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
|
|
|
|
BOOLEAN Quit;
|
|
|
|
|
BOOLEAN Cancel;
|
2018-05-19 11:30:20 +00:00
|
|
|
|
WCHAR InputBuffer[50];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
ULONG MaxSize;
|
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
|
ULONGLONG DiskSize;
|
2014-05-18 15:14:24 +00:00
|
|
|
|
ULONGLONG SectorCount;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PCHAR Unit;
|
|
|
|
|
|
|
|
|
|
if (PartitionList == NULL ||
|
|
|
|
|
PartitionList->CurrentDisk == NULL ||
|
|
|
|
|
PartitionList->CurrentPartition == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DiskEntry = PartitionList->CurrentDisk;
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
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
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
#if 0
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (DiskSize >= 10737418240) /* 10 GB */
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskSize / 1073741824;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_GB);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2003-08-04 15:54:05 +00:00
|
|
|
|
#endif
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskSize / 1048576;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (DiskSize == 0)
|
|
|
|
|
DiskSize = 1;
|
|
|
|
|
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_MB);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2003-08-04 15:54:05 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (DiskEntry->DriverName.Length > 0)
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
MUIGetString(STRING_HDINFOPARTCREATE),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id,
|
|
|
|
|
&DiskEntry->DriverName);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
MUIGetString(STRING_HDDINFOUNK1),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id);
|
2003-08-05 20:39:24 +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-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",
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / 1048576);
|
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
|
|
|
|
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
|
|
|
|
while (TRUE)
|
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / 1048576; /* 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-10-01 14:42:04 +00:00
|
|
|
|
if (Quit != FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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-10-01 14:42:04 +00:00
|
|
|
|
else if (Cancel != FALSE)
|
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 */
|
|
|
|
|
SectorCount = PartSize * 1048576 / 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,
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
|
|
|
|
BOOLEAN Quit;
|
|
|
|
|
BOOLEAN Cancel;
|
2018-05-19 11:30:20 +00:00
|
|
|
|
WCHAR InputBuffer[50];
|
2014-05-20 23:48:36 +00:00
|
|
|
|
ULONG MaxSize;
|
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
|
ULONGLONG DiskSize;
|
|
|
|
|
ULONGLONG SectorCount;
|
|
|
|
|
PCHAR Unit;
|
|
|
|
|
|
|
|
|
|
if (PartitionList == NULL ||
|
|
|
|
|
PartitionList->CurrentDisk == NULL ||
|
|
|
|
|
PartitionList->CurrentPartition == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DiskEntry = PartitionList->CurrentDisk;
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_EXTENDED_PARTITION));
|
|
|
|
|
|
|
|
|
|
DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
|
|
|
|
#if 0
|
|
|
|
|
if (DiskSize >= 10737418240) /* 10 GB */
|
|
|
|
|
{
|
|
|
|
|
DiskSize = DiskSize / 1073741824;
|
|
|
|
|
Unit = MUIGetString(STRING_GB);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
DiskSize = DiskSize / 1048576;
|
|
|
|
|
if (DiskSize == 0)
|
|
|
|
|
DiskSize = 1;
|
|
|
|
|
|
|
|
|
|
Unit = MUIGetString(STRING_MB);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DiskEntry->DriverName.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
|
|
|
|
MUIGetString(STRING_HDINFOPARTCREATE),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id,
|
|
|
|
|
&DiskEntry->DriverName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
|
|
|
|
MUIGetString(STRING_HDDINFOUNK1),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE));
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
|
|
|
|
PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / 1048576);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
|
|
|
|
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
|
|
|
|
while (TRUE)
|
|
|
|
|
{
|
|
|
|
|
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / 1048576; /* in MBytes (rounded) */
|
|
|
|
|
|
|
|
|
|
if (MaxSize > PARTITION_MAXSIZE)
|
|
|
|
|
MaxSize = PARTITION_MAXSIZE;
|
|
|
|
|
|
|
|
|
|
ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
|
|
|
|
|
MaxSize, InputBuffer, &Quit, &Cancel);
|
|
|
|
|
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (Quit != FALSE)
|
2014-05-20 23:48:36 +00:00
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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-10-01 14:42:04 +00:00
|
|
|
|
else if (Cancel != FALSE)
|
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 */
|
|
|
|
|
SectorCount = PartSize * 1048576 / DiskEntry->BytesPerSector;
|
|
|
|
|
|
|
|
|
|
/* 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,
|
|
|
|
|
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
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
|
|
|
|
BOOLEAN Quit;
|
|
|
|
|
BOOLEAN Cancel;
|
2018-05-19 11:30:20 +00:00
|
|
|
|
WCHAR InputBuffer[50];
|
2014-06-09 01:49:24 +00:00
|
|
|
|
ULONG MaxSize;
|
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
|
ULONGLONG DiskSize;
|
|
|
|
|
ULONGLONG SectorCount;
|
|
|
|
|
PCHAR Unit;
|
2014-06-08 19:05:03 +00:00
|
|
|
|
|
2014-06-09 01:49:24 +00:00
|
|
|
|
if (PartitionList == NULL ||
|
|
|
|
|
PartitionList->CurrentDisk == NULL ||
|
|
|
|
|
PartitionList->CurrentPartition == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DiskEntry = PartitionList->CurrentDisk;
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_LOGICAL_PARTITION));
|
|
|
|
|
|
|
|
|
|
DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
|
|
|
|
#if 0
|
|
|
|
|
if (DiskSize >= 10737418240) /* 10 GB */
|
|
|
|
|
{
|
|
|
|
|
DiskSize = DiskSize / 1073741824;
|
|
|
|
|
Unit = MUIGetString(STRING_GB);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
DiskSize = DiskSize / 1048576;
|
|
|
|
|
if (DiskSize == 0)
|
|
|
|
|
DiskSize = 1;
|
|
|
|
|
|
|
|
|
|
Unit = MUIGetString(STRING_MB);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DiskEntry->DriverName.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
|
|
|
|
MUIGetString(STRING_HDINFOPARTCREATE),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id,
|
|
|
|
|
&DiskEntry->DriverName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
|
|
|
|
MUIGetString(STRING_HDDINFOUNK1),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE));
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
|
|
|
|
PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / 1048576);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
|
|
|
|
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
|
|
|
|
while (TRUE)
|
|
|
|
|
{
|
|
|
|
|
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / 1048576; /* in MBytes (rounded) */
|
|
|
|
|
|
|
|
|
|
if (MaxSize > PARTITION_MAXSIZE)
|
|
|
|
|
MaxSize = PARTITION_MAXSIZE;
|
|
|
|
|
|
|
|
|
|
ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
|
|
|
|
|
MaxSize, InputBuffer, &Quit, &Cancel);
|
|
|
|
|
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (Quit != FALSE)
|
2014-06-09 01:49:24 +00:00
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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-10-01 14:42:04 +00:00
|
|
|
|
else if (Cancel != FALSE)
|
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 */
|
|
|
|
|
SectorCount = PartSize * 1048576 / DiskEntry->BytesPerSector;
|
|
|
|
|
|
|
|
|
|
/* 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,
|
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 */
|
|
|
|
|
{
|
|
|
|
|
if (ConfirmQuit(Ir) == TRUE)
|
|
|
|
|
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
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
|
|
|
|
ULONGLONG DiskSize;
|
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
|
PCHAR Unit;
|
2016-07-12 22:30:55 +00:00
|
|
|
|
CHAR PartTypeString[32];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (PartitionList == NULL ||
|
|
|
|
|
PartitionList->CurrentDisk == NULL ||
|
|
|
|
|
PartitionList->CurrentPartition == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2003-08-04 15:54:05 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DiskEntry = PartitionList->CurrentDisk;
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
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
|
|
|
|
|
2016-07-12 22:30:55 +00:00
|
|
|
|
GetPartTypeStringFromPartitionType(PartEntry->PartitionType,
|
|
|
|
|
PartTypeString,
|
|
|
|
|
ARRAYSIZE(PartTypeString));
|
2003-08-05 20:39:24 +00:00
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
2003-08-05 20:39:24 +00:00
|
|
|
|
#if 0
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (PartSize >= 10737418240) /* 10 GB */
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartSize / 1073741824;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_GB);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2003-08-04 15:54:05 +00:00
|
|
|
|
#endif
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (PartSize >= 10485760) /* 10 MB */
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartSize / 1048576;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_MB);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartSize / 1024;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_KB);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-12 22:30:55 +00:00
|
|
|
|
if (*PartTypeString == '\0') // STRING_FORMATUNKNOWN ??
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
MUIGetString(STRING_HDDINFOUNK2),
|
2014-05-18 15:14:24 +00:00
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
|
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : ':',
|
|
|
|
|
PartEntry->PartitionType,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
PartSize,
|
|
|
|
|
Unit);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 10,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
" %c%c %s %I64u %s",
|
2014-05-18 15:14:24 +00:00
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
|
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : ':',
|
2016-07-12 22:30:55 +00:00
|
|
|
|
PartTypeString,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
PartSize,
|
|
|
|
|
Unit);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2003-08-04 15:54:05 +00:00
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
2003-08-05 20:39:24 +00:00
|
|
|
|
#if 0
|
2014-05-18 15:14:24 +00:00
|
|
|
|
if (DiskSize >= 10737418240) /* 10 GB */
|
2003-08-05 20:39:24 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskSize / 1073741824;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_GB);
|
2003-08-05 20:39:24 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2003-08-05 20:39:24 +00:00
|
|
|
|
#endif
|
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskSize / 1048576;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (DiskSize == 0)
|
|
|
|
|
DiskSize = 1;
|
|
|
|
|
|
2008-02-19 21:31:09 +00:00
|
|
|
|
Unit = MUIGetString(STRING_MB);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DiskEntry->DriverName.Length > 0)
|
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 12,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
MUIGetString(STRING_HDINFOPARTDELETE),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id,
|
|
|
|
|
&DiskEntry->DriverName);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 12,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
MUIGetString(STRING_HDDINFOUNK3),
|
|
|
|
|
DiskSize,
|
|
|
|
|
Unit,
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id);
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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;
|
|
|
|
|
}
|
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
|
|
|
|
|
{
|
2010-06-11 21:21:27 +00:00
|
|
|
|
DeleteCurrentPartition(PartitionList);
|
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
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
/*
|
|
|
|
|
* Displays the SelectFileSystemPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* CheckFileSystemPage (At once if RepairUpdate is selected)
|
|
|
|
|
* CheckFileSystemPage (At once if Unattended and not UnattendFormatPartition)
|
|
|
|
|
* FormatPartitionPage (At once if Unattended and UnattendFormatPartition)
|
|
|
|
|
* SelectPartitionPage (If the user aborts)
|
|
|
|
|
* FormatPartitionPage (Default)
|
|
|
|
|
* QuitPage
|
|
|
|
|
*
|
|
|
|
|
* SIDEEFFECTS
|
|
|
|
|
* Sets PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType (via UpdatePartitionType)
|
2016-02-28 15:25:22 +00:00
|
|
|
|
* Calls CheckActiveSystemPartition()
|
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
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
|
|
|
|
ULONGLONG DiskSize;
|
|
|
|
|
ULONGLONG PartSize;
|
|
|
|
|
PCHAR DiskUnit;
|
|
|
|
|
PCHAR PartUnit;
|
2015-12-06 20:14:29 +00:00
|
|
|
|
CHAR PartTypeString[32];
|
2016-07-03 14:57:21 +00:00
|
|
|
|
FORMATMACHINESTATE PreviousFormatState;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DPRINT("SelectFileSystemPage()\n");
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (PartitionList == NULL ||
|
|
|
|
|
PartitionList->CurrentDisk == NULL ||
|
|
|
|
|
PartitionList->CurrentPartition == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
|
/* Find or set the active system partition */
|
2017-05-18 01:05:39 +00:00
|
|
|
|
CheckActiveSystemPartition(PartitionList);
|
2017-05-13 16:40:30 +00:00
|
|
|
|
if (PartitionList->SystemPartition == NULL)
|
2015-06-12 21:51:57 +00:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
{
|
2016-02-28 15:25:22 +00:00
|
|
|
|
if (PartitionList->CurrentPartition != PartitionList->SystemPartition)
|
2015-06-12 21:51:57 +00:00
|
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
|
TempPartition = PartitionList->SystemPartition;
|
|
|
|
|
TempPartition->NeedsCheck = TRUE;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
FormatState = FormatSystemPartition;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DPRINT1("FormatState: Start --> FormatSystemPartition\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
|
TempPartition = PartitionList->CurrentPartition;
|
|
|
|
|
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: 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
|
|
|
|
{
|
|
|
|
|
TempPartition = PartitionList->CurrentPartition;
|
|
|
|
|
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:
|
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;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DPRINT1("FormatState: FormatInstallPartition --> FormatOtherPartition\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
|
FormatState = FormatDone;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DPRINT1("FormatState: FormatInstallPartition --> FormatDone\n");
|
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2017-05-18 01:05:39 +00:00
|
|
|
|
}
|
2015-06-12 21:51:57 +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;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DPRINT1("FormatState: FormatOtherPartition --> FormatOtherPartition\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
|
FormatState = FormatDone;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DPRINT1("FormatState: FormatOtherPartition --> FormatDone\n");
|
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
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);
|
2015-06-12 21:51:57 +00:00
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
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;
|
2017-05-13 16:40:30 +00:00
|
|
|
|
DiskEntry = PartEntry->DiskEntry;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2017-05-13 16:23:08 +00:00
|
|
|
|
/* Adjust disk size */
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
|
|
|
|
if (DiskSize >= 10737418240) /* 10 GB */
|
2002-10-18 20:04:00 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskSize / 1073741824;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
DiskUnit = MUIGetString(STRING_GB);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
DiskSize = DiskSize / 1048576;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
DiskUnit = MUIGetString(STRING_MB);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
|
2017-05-13 16:23:08 +00:00
|
|
|
|
/* Adjust partition size */
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
|
|
|
|
if (PartSize >= 10737418240) /* 10 GB */
|
2002-10-18 20:04:00 +00:00
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartSize / 1073741824;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
PartUnit = MUIGetString(STRING_GB);
|
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
|
|
|
|
{
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartSize = PartSize / 1048576;
|
2008-02-19 21:31:09 +00:00
|
|
|
|
PartUnit = MUIGetString(STRING_MB);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
|
2017-05-13 16:23:08 +00:00
|
|
|
|
/* Adjust partition type */
|
2016-07-12 22:30:55 +00:00
|
|
|
|
GetPartTypeStringFromPartitionType(PartEntry->PartitionType,
|
|
|
|
|
PartTypeString,
|
|
|
|
|
ARRAYSIZE(PartTypeString));
|
2002-09-25 14:48:35 +00:00
|
|
|
|
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (PartEntry->AutoCreate != FALSE)
|
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
|
|
|
|
|
CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartEntry->PartitionNumber,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PartSize,
|
|
|
|
|
PartUnit,
|
2016-07-12 22:30:55 +00:00
|
|
|
|
PartTypeString);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2008-02-17 18:05:08 +00:00
|
|
|
|
CONSOLE_PrintTextXY(8, 10, MUIGetString(STRING_HDINFOPARTZEROED),
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskSize,
|
|
|
|
|
DiskUnit,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id,
|
|
|
|
|
&DiskEntry->DriverName);
|
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
else if (PartEntry->New != FALSE)
|
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:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetTextXY(6, 10, 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
|
|
|
|
|
2016-07-12 22:30:55 +00:00
|
|
|
|
if (*PartTypeString == '\0') // STRING_FORMATUNKNOWN ??
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(8, 10,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
MUIGetString(STRING_HDDINFOUNK4),
|
2014-05-18 15:14:24 +00:00
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
|
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : ':',
|
|
|
|
|
PartEntry->PartitionType,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
PartSize,
|
|
|
|
|
PartUnit);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(8, 10,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
"%c%c %s %I64u %s",
|
2014-05-18 15:14:24 +00:00
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
|
|
|
|
|
(PartEntry->DriveLetter == 0) ? '-' : ':',
|
2015-12-06 20:14:29 +00:00
|
|
|
|
PartTypeString,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PartSize,
|
|
|
|
|
PartUnit);
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-17 18:05:08 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 12, MUIGetString(STRING_HDINFOPARTEXISTS),
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
DiskSize,
|
|
|
|
|
DiskUnit,
|
|
|
|
|
DiskEntry->Port,
|
|
|
|
|
DiskEntry->Bus,
|
|
|
|
|
DiskEntry->Id,
|
|
|
|
|
&DiskEntry->DriverName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE);
|
|
|
|
|
|
|
|
|
|
if (FileSystemList == NULL)
|
|
|
|
|
{
|
[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
|
|
|
|
/* Create the file system list, and by default select the "FAT" file system */
|
2015-01-04 13:53:45 +00:00
|
|
|
|
FileSystemList = CreateFileSystemList(6, 26, PartEntry->New, L"FAT");
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (FileSystemList == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
2002-10-18 20:04:00 +00:00
|
|
|
|
}
|
2014-05-18 15:14:24 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
DrawFileSystemList(FileSystemList);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (RepairUpdateFlag)
|
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
|
|
|
|
return CHECK_FILE_SYSTEM_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
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (IsUnattendedSetup)
|
2002-10-18 20:04:00 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (UnattendFormatPartition)
|
|
|
|
|
{
|
[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
|
|
|
|
/*
|
|
|
|
|
* We use whatever currently selected file system we have
|
|
|
|
|
* (by default, this is "FAT", as per the initialization
|
|
|
|
|
* performed above). Note that it may be interesting to specify
|
|
|
|
|
* which file system to use in unattended installations, in the
|
|
|
|
|
* txtsetup.sif file.
|
|
|
|
|
*/
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return FORMAT_PARTITION_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return QUIT_PAGE;
|
2002-11-28 19:20:38 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
|
|
|
|
|
{
|
2017-05-18 01:05:39 +00:00
|
|
|
|
FormatState = Start;
|
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)
|
2017-05-13 16:23:08 +00:00
|
|
|
|
return SELECT_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
|
|
|
|
return FORMAT_PARTITION_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|
* Sets PartitionList->CurrentPartition->FormatState
|
|
|
|
|
* Sets DestinationRootPath
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
{
|
2015-06-12 21:51:57 +00:00
|
|
|
|
UNICODE_STRING PartitionRootPath;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
2015-01-04 13:53:45 +00:00
|
|
|
|
PDISKENTRY DiskEntry;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PPARTENTRY PartEntry;
|
[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;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
NTSTATUS Status;
|
2003-08-09 16:32:26 +00:00
|
|
|
|
|
2003-10-01 14:54:21 +00:00
|
|
|
|
#ifndef NDEBUG
|
2008-01-07 16:50:40 +00:00
|
|
|
|
ULONG Line;
|
|
|
|
|
ULONG i;
|
2016-05-12 15:30:49 +00:00
|
|
|
|
PPARTITION_INFORMATION PartitionInfo;
|
2003-10-01 14:54:21 +00:00
|
|
|
|
#endif
|
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;
|
2017-05-13 16:40:30 +00:00
|
|
|
|
DiskEntry = PartEntry->DiskEntry;
|
2003-08-09 16:32:26 +00:00
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
SelectedFileSystem = FileSystemList->Selected;
|
[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)
|
2006-10-22 18:40:37 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
CONSOLE_ConInKey(Ir);
|
2006-10-22 18:40:37 +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
|
|
|
|
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
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
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
|
2006-09-07 22:42:28 +00:00
|
|
|
|
{
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
if (!PreparePartitionForFormatting(PartEntry, SelectedFileSystem->FileSystem))
|
2015-06-12 21:51:57 +00:00
|
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
|
/* FIXME: show an error dialog */
|
2015-01-04 13:53:45 +00:00
|
|
|
|
return QUIT_PAGE;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
}
|
2006-09-07 22:42:28 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
#ifndef NDEBUG
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_PrintTextXY(6, 12,
|
2016-05-12 15:30:49 +00:00
|
|
|
|
"Cylinders: %I64u Tracks/Cyl: %lu Sectors/Trk: %lu Bytes/Sec: %lu %c",
|
|
|
|
|
DiskEntry->Cylinders,
|
|
|
|
|
DiskEntry->TracksPerCylinder,
|
|
|
|
|
DiskEntry->SectorsPerTrack,
|
|
|
|
|
DiskEntry->BytesPerSector,
|
|
|
|
|
DiskEntry->Dirty ? '*' : ' ');
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
Line = 13;
|
|
|
|
|
|
2016-05-12 15:30:49 +00:00
|
|
|
|
for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2016-05-12 15:30:49 +00:00
|
|
|
|
PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i];
|
|
|
|
|
|
|
|
|
|
CONSOLE_PrintTextXY(6, Line,
|
|
|
|
|
"%2u: %2lu %c %12I64u %12I64u %02x",
|
|
|
|
|
i,
|
|
|
|
|
PartitionInfo->PartitionNumber,
|
|
|
|
|
PartitionInfo->BootIndicator ? 'A' : '-',
|
|
|
|
|
PartitionInfo->StartingOffset.QuadPart / DiskEntry->BytesPerSector,
|
|
|
|
|
PartitionInfo->PartitionLength.QuadPart / DiskEntry->BytesPerSector,
|
|
|
|
|
PartitionInfo->PartitionType);
|
|
|
|
|
Line++;
|
2006-09-07 22:42:28 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
/* Commit the partition changes to the disk */
|
|
|
|
|
if (!WritePartitionsToDisk(PartitionList))
|
2015-01-04 13:53:45 +00:00
|
|
|
|
{
|
|
|
|
|
DPRINT("WritePartitionsToDisk() failed\n");
|
|
|
|
|
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
/* Set PartitionRootPath */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
swprintf(PathBuffer,
|
|
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu",
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
PartEntry->PartitionNumber);
|
|
|
|
|
RtlInitUnicodeString(&PartitionRootPath,
|
|
|
|
|
PathBuffer);
|
|
|
|
|
DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
|
2003-08-19 15:54:47 +00:00
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
/* Format the partition */
|
[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 (SelectedFileSystem->FileSystem)
|
2006-09-07 22:42:28 +00:00
|
|
|
|
{
|
2015-06-12 21:51:57 +00:00
|
|
|
|
Status = FormatPartition(&PartitionRootPath,
|
[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
|
|
|
|
SelectedFileSystem);
|
2006-09-07 22:42:28 +00:00
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
|
{
|
|
|
|
|
DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status);
|
2015-07-11 12:40:34 +00:00
|
|
|
|
MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
|
2006-09-07 22:42:28 +00:00
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:05:39 +00:00
|
|
|
|
PartEntry->FormatState = Formatted;
|
|
|
|
|
// PartEntry->FileSystem = FileSystem;
|
2015-01-04 13:53:45 +00:00
|
|
|
|
PartEntry->New = FALSE;
|
2006-09-07 22:42:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-02 22:18:06 +00:00
|
|
|
|
#ifndef NDEBUG
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(" Done. Press any key ...");
|
2006-09-07 22:42:28 +00:00
|
|
|
|
CONSOLE_ConInKey(Ir);
|
2004-06-02 22:18:06 +00:00
|
|
|
|
#endif
|
2003-08-18 17:39:26 +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)
|
|
|
|
|
{
|
[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 CurrentFileSystem;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
UNICODE_STRING PartitionRootPath;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
|
|
|
|
CHAR Buffer[MAX_PATH];
|
2015-06-12 21:51:57 +00:00
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
if (PartitionList == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-28 16:01:54 +00:00
|
|
|
|
if (!GetNextUncheckedPartition(PartitionList, &DiskEntry, &PartEntry))
|
2015-06-12 21:51:57 +00:00
|
|
|
|
{
|
|
|
|
|
return INSTALL_DIRECTORY_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set PartitionRootPath */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
swprintf(PathBuffer,
|
|
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu",
|
2015-06-12 21:51:57 +00:00
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
PartEntry->PartitionNumber);
|
|
|
|
|
RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
|
|
|
|
|
DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
|
2003-08-18 17:39:26 +00:00
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART));
|
2003-10-06 19:22:42 +00:00
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
2006-09-09 17:11:03 +00:00
|
|
|
|
|
[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
|
|
|
|
CurrentFileSystem = PartEntry->FileSystem;
|
2016-02-27 20:49:17 +00:00
|
|
|
|
DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystemName: %S\n",
|
|
|
|
|
PartEntry->PartitionType, (CurrentFileSystem ? CurrentFileSystem->FileSystemName : L"n/a"));
|
|
|
|
|
|
2016-11-05 14:55:55 +00:00
|
|
|
|
/* HACK: Do not try to check a partition with an unknown filesystem */
|
2015-06-15 20:47:30 +00:00
|
|
|
|
if (CurrentFileSystem == NULL)
|
|
|
|
|
{
|
|
|
|
|
PartEntry->NeedsCheck = FALSE;
|
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CurrentFileSystem->ChkdskFunc == NULL)
|
2002-09-25 14:48:35 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
sprintf(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.",
|
2015-06-12 21:51:57 +00:00
|
|
|
|
CurrentFileSystem->FileSystemName);
|
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
|
|
|
|
PartEntry->NeedsCheck = FALSE;
|
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2015-06-12 21:51:57 +00:00
|
|
|
|
Status = ChkdskPartition(&PartitionRootPath, CurrentFileSystem);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
|
{
|
|
|
|
|
DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status);
|
2016-03-02 00:51:48 +00:00
|
|
|
|
// sprintf(Buffer, "Setup failed to verify the selected partition.\n"
|
|
|
|
|
sprintf(Buffer, "ChkDsk detected some disk errors.\n"
|
2008-01-07 16:50:40 +00:00
|
|
|
|
"(Status 0x%08lx).\n", Status);
|
|
|
|
|
PopupError(Buffer,
|
2016-03-02 00:51:48 +00:00
|
|
|
|
// MUIGetString(STRING_REBOOTCOMPUTER),
|
|
|
|
|
MUIGetString(STRING_CONTINUE),
|
2008-01-07 16:50:40 +00:00
|
|
|
|
Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
|
2016-03-02 00:51:48 +00:00
|
|
|
|
// return QUIT_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
PartEntry->NeedsCheck = FALSE;
|
|
|
|
|
return CHECK_FILE_SYSTEM_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
2002-09-25 14:48:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-05-15 16:11:12 +00:00
|
|
|
|
static
|
|
|
|
|
VOID
|
|
|
|
|
BuildInstallPaths(PWCHAR InstallDir,
|
|
|
|
|
PDISKENTRY DiskEntry,
|
|
|
|
|
PPARTENTRY PartEntry)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
|
|
|
|
|
|
|
|
|
/* Create 'InstallPath' string */
|
|
|
|
|
RtlFreeUnicodeString(&InstallPath);
|
2016-02-28 15:25:22 +00:00
|
|
|
|
RtlCreateUnicodeString(&InstallPath, InstallDir);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
/* Create 'DestinationRootPath' string */
|
|
|
|
|
RtlFreeUnicodeString(&DestinationRootPath);
|
|
|
|
|
swprintf(PathBuffer,
|
|
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu",
|
|
|
|
|
DiskEntry->DiskNumber,
|
|
|
|
|
PartEntry->PartitionNumber);
|
|
|
|
|
RtlCreateUnicodeString(&DestinationRootPath, PathBuffer);
|
|
|
|
|
DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath);
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Create 'DestinationPath' string */
|
|
|
|
|
RtlFreeUnicodeString(&DestinationPath);
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
|
|
|
|
|
DestinationRootPath.Buffer, InstallDir);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
RtlCreateUnicodeString(&DestinationPath, PathBuffer);
|
|
|
|
|
|
|
|
|
|
/* Create 'DestinationArcPath' */
|
|
|
|
|
RtlFreeUnicodeString(&DestinationArcPath);
|
|
|
|
|
swprintf(PathBuffer,
|
|
|
|
|
L"multi(0)disk(0)rdisk(%lu)partition(%lu)",
|
|
|
|
|
DiskEntry->BiosDiskNumber,
|
2014-05-18 15:14:24 +00:00
|
|
|
|
PartEntry->PartitionNumber);
|
2017-05-23 22:30:54 +00:00
|
|
|
|
ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallDir);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
RtlCreateUnicodeString(&DestinationArcPath, PathBuffer);
|
2003-10-06 19:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
/*
|
|
|
|
|
* Displays the InstallDirectoryPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* PrepareCopyPage (As the direct result of InstallDirectoryPage1)
|
|
|
|
|
* 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)
|
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PDISKENTRY DiskEntry;
|
|
|
|
|
PPARTENTRY PartEntry;
|
|
|
|
|
WCHAR InstallDir[51];
|
2015-06-28 19:06:07 +00:00
|
|
|
|
WCHAR c;
|
2018-05-15 09:28:33 +00:00
|
|
|
|
ULONG Length, Pos;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2016-11-05 14:55:55 +00:00
|
|
|
|
/* We do not need the filesystem list any more */
|
2016-05-12 16:18:32 +00:00
|
|
|
|
if (FileSystemList != NULL)
|
|
|
|
|
{
|
|
|
|
|
DestroyFileSystemList(FileSystemList);
|
|
|
|
|
FileSystemList = NULL;
|
|
|
|
|
}
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (PartitionList == NULL ||
|
|
|
|
|
PartitionList->CurrentDisk == NULL ||
|
|
|
|
|
PartitionList->CurrentPartition == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: show an error dialog */
|
|
|
|
|
return QUIT_PAGE;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DiskEntry = PartitionList->CurrentDisk;
|
|
|
|
|
PartEntry = PartitionList->CurrentPartition;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
|
2012-02-27 16:37:48 +00:00
|
|
|
|
if (IsUnattendedSetup)
|
2018-05-15 16:11:12 +00:00
|
|
|
|
{
|
|
|
|
|
if (!IsValidPath(UnattendInstallationDirectory))
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: Log the error? */
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildInstallPaths(UnattendInstallationDirectory,
|
|
|
|
|
DiskEntry,
|
|
|
|
|
PartEntry);
|
|
|
|
|
|
|
|
|
|
return PREPARE_COPY_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wcscpy(InstallDir, L"\\ReactOS");
|
2002-09-25 14:48:35 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
Length = wcslen(InstallDir);
|
2018-05-15 09:28:33 +00:00
|
|
|
|
Pos = Length;
|
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
|
|
|
|
MUIDisplayPage(INSTALL_DIRECTORY_PAGE);
|
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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
|
|
|
|
|
|
|
|
|
BuildInstallPaths(InstallDir,
|
|
|
|
|
DiskEntry,
|
|
|
|
|
PartEntry);
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2003-08-24 10:36:07 +00:00
|
|
|
|
static BOOLEAN
|
2007-12-02 11:32:52 +00:00
|
|
|
|
AddSectionToCopyQueueCab(HINF InfFile,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
PWCHAR SectionName,
|
|
|
|
|
PWCHAR SourceCabinet,
|
|
|
|
|
PCUNICODE_STRING DestinationPath,
|
|
|
|
|
PINPUT_RECORD Ir)
|
2002-09-25 14:48:35 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
INFCONTEXT FilesContext;
|
|
|
|
|
INFCONTEXT DirContext;
|
|
|
|
|
PWCHAR FileKeyName;
|
|
|
|
|
PWCHAR FileKeyValue;
|
|
|
|
|
PWCHAR DirKeyValue;
|
|
|
|
|
PWCHAR TargetFileName;
|
|
|
|
|
|
|
|
|
|
/* Search for the SectionName section */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
char Buffer[128];
|
2008-02-12 14:52:36 +00:00
|
|
|
|
sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName);
|
|
|
|
|
PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER);
|
2010-06-11 21:21:27 +00:00
|
|
|
|
return FALSE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Enumerate the files in the section
|
|
|
|
|
* and add them to the file queue.
|
|
|
|
|
*/
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
/* Get source file name and target directory id */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetData(&FilesContext, &FileKeyName, &FileKeyValue))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("INF_GetData() failed\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get optional target file name */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetDataField(&FilesContext, 2, &TargetFileName))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
TargetFileName = NULL;
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* Lookup target directory */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("SetupFindFirstLine() failed\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("INF_GetData() failed\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!SetupQueueCopy(SetupFileQueue,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
SourceCabinet,
|
|
|
|
|
SourceRootPath.Buffer,
|
|
|
|
|
SourceRootDir.Buffer,
|
|
|
|
|
FileKeyName,
|
|
|
|
|
DirKeyValue,
|
|
|
|
|
TargetFileName))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("SetupQueueCopy() failed\n");
|
|
|
|
|
}
|
|
|
|
|
} while (SetupFindNextLine(&FilesContext, &FilesContext));
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2005-02-20 22:40:30 +00:00
|
|
|
|
}
|
2002-11-23 01:55:27 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2007-12-02 11:32:52 +00:00
|
|
|
|
static BOOLEAN
|
|
|
|
|
AddSectionToCopyQueue(HINF InfFile,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
PWCHAR SectionName,
|
|
|
|
|
PWCHAR SourceCabinet,
|
|
|
|
|
PCUNICODE_STRING DestinationPath,
|
|
|
|
|
PINPUT_RECORD Ir)
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
INFCONTEXT FilesContext;
|
|
|
|
|
INFCONTEXT DirContext;
|
|
|
|
|
PWCHAR FileKeyName;
|
|
|
|
|
PWCHAR FileKeyValue;
|
|
|
|
|
PWCHAR DirKeyValue;
|
|
|
|
|
PWCHAR TargetFileName;
|
2015-03-08 04:09:23 +00:00
|
|
|
|
ULONG Length;
|
|
|
|
|
WCHAR CompleteOrigDirName[512];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (SourceCabinet)
|
|
|
|
|
return AddSectionToCopyQueueCab(InfFile, L"SourceFiles", SourceCabinet, DestinationPath, Ir);
|
|
|
|
|
|
|
|
|
|
/* Search for the SectionName section */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
char Buffer[128];
|
2008-02-12 14:52:36 +00:00
|
|
|
|
sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName);
|
|
|
|
|
PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return FALSE;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/*
|
2010-06-11 21:21:27 +00:00
|
|
|
|
* Enumerate the files in the section
|
|
|
|
|
* and add them to the file queue.
|
|
|
|
|
*/
|
2008-01-07 16:50:40 +00:00
|
|
|
|
do
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get source file name and target directory id */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetData(&FilesContext, &FileKeyName, &FileKeyValue))
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("INF_GetData() failed\n");
|
|
|
|
|
break;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get target directory id */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetDataField(&FilesContext, 13, &FileKeyValue))
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("INF_GetData() failed\n");
|
|
|
|
|
break;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get optional target file name */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetDataField(&FilesContext, 11, &TargetFileName))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
TargetFileName = NULL;
|
|
|
|
|
else if (!*TargetFileName)
|
|
|
|
|
TargetFileName = NULL;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
2007-12-02 11:32:52 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Lookup target directory */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext))
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("SetupFindFirstLine() failed\n");
|
|
|
|
|
break;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("INF_GetData() failed\n");
|
|
|
|
|
break;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
if ((DirKeyValue[0] == UNICODE_NULL) || (DirKeyValue[0] == L'\\' && DirKeyValue[1] == UNICODE_NULL))
|
2015-03-08 04:09:23 +00:00
|
|
|
|
{
|
|
|
|
|
/* Installation path */
|
|
|
|
|
wcscpy(CompleteOrigDirName, SourceRootDir.Buffer);
|
|
|
|
|
}
|
|
|
|
|
else if (DirKeyValue[0] == L'\\')
|
|
|
|
|
{
|
|
|
|
|
/* Absolute path */
|
|
|
|
|
wcscpy(CompleteOrigDirName, DirKeyValue);
|
|
|
|
|
}
|
|
|
|
|
else // if (DirKeyValue[0] != L'\\')
|
|
|
|
|
{
|
|
|
|
|
/* Path relative to the installation path */
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName), 2,
|
|
|
|
|
SourceRootDir.Buffer, DirKeyValue);
|
2015-03-08 04:09:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove trailing backslash */
|
|
|
|
|
Length = wcslen(CompleteOrigDirName);
|
|
|
|
|
if ((Length > 0) && (CompleteOrigDirName[Length - 1] == L'\\'))
|
|
|
|
|
{
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CompleteOrigDirName[Length - 1] = UNICODE_NULL;
|
2015-03-08 04:09:23 +00:00
|
|
|
|
}
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!SetupQueueCopy(SetupFileQueue,
|
|
|
|
|
SourceCabinet,
|
|
|
|
|
SourceRootPath.Buffer,
|
2015-03-08 04:09:23 +00:00
|
|
|
|
CompleteOrigDirName,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
FileKeyName,
|
|
|
|
|
DirKeyValue,
|
|
|
|
|
TargetFileName))
|
2007-12-02 11:32:52 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* FIXME: Handle error! */
|
|
|
|
|
DPRINT1("SetupQueueCopy() failed\n");
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
} while (SetupFindNextLine(&FilesContext, &FilesContext));
|
2007-12-02 11:32:52 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return TRUE;
|
2007-12-02 11:32:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2005-02-20 22:40:30 +00:00
|
|
|
|
static BOOLEAN
|
|
|
|
|
PrepareCopyPageInfFile(HINF InfFile,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
PWCHAR SourceCabinet,
|
|
|
|
|
PINPUT_RECORD Ir)
|
2005-02-20 22:40:30 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
|
|
|
|
INFCONTEXT DirContext;
|
|
|
|
|
PWCHAR AdditionalSectionName = NULL;
|
2015-03-08 04:09:23 +00:00
|
|
|
|
PWCHAR DirKeyValue;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
ULONG Length;
|
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
|
|
/* Add common files */
|
|
|
|
|
if (!AddSectionToCopyQueue(InfFile, L"SourceDisksFiles", SourceCabinet, &DestinationPath, Ir))
|
2005-02-20 22:40:30 +00:00
|
|
|
|
return FALSE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
/* Add specific files depending of computer type */
|
|
|
|
|
if (SourceCabinet == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (!ProcessComputerFiles(InfFile, ComputerList, &AdditionalSectionName))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (AdditionalSectionName)
|
|
|
|
|
{
|
|
|
|
|
if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir))
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2005-02-20 22:40:30 +00:00
|
|
|
|
}
|
2005-05-08 04:07:56 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Create directories */
|
2002-11-23 01:55:27 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/*
|
2015-03-08 04:09:23 +00:00
|
|
|
|
* FIXME:
|
|
|
|
|
* - Install directories like '\reactos\test' are not handled yet.
|
|
|
|
|
* - Copying files to DestinationRootPath should be done from within
|
|
|
|
|
* the SystemPartitionFiles section.
|
|
|
|
|
* At the moment we check whether we specify paths like '\foo' or '\\' for that.
|
|
|
|
|
* For installing to DestinationPath specify just '\' .
|
|
|
|
|
*/
|
2002-10-29 18:40:02 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Get destination path */
|
|
|
|
|
wcscpy(PathBuffer, DestinationPath.Buffer);
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Remove trailing backslash */
|
|
|
|
|
Length = wcslen(PathBuffer);
|
2015-03-08 04:09:23 +00:00
|
|
|
|
if ((Length > 0) && (PathBuffer[Length - 1] == L'\\'))
|
2003-03-08 19:29:09 +00:00
|
|
|
|
{
|
2017-05-23 22:30:54 +00:00
|
|
|
|
PathBuffer[Length - 1] = UNICODE_NULL;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
}
|
2002-10-29 18:40:02 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Create the install directory */
|
|
|
|
|
Status = SetupCreateDirectory(PathBuffer);
|
|
|
|
|
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
|
2002-11-13 18:25:18 +00:00
|
|
|
|
{
|
2016-11-03 14:14:19 +00:00
|
|
|
|
DPRINT1("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_CREATE_INSTALL_DIR, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return FALSE;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
}
|
2002-10-29 18:40:02 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Search for the 'Directories' section */
|
|
|
|
|
if (!SetupFindFirstLineW(InfFile, L"Directories", NULL, &DirContext))
|
2002-10-29 18:40:02 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (SourceCabinet)
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_CABINET_SECTION, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
}
|
2007-12-15 14:24:02 +00:00
|
|
|
|
else
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER);
|
2003-08-24 10:36:07 +00:00
|
|
|
|
}
|
2008-02-08 04:14:09 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return FALSE;
|
2003-03-13 09:51:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Enumerate the directory values and create the subdirectories */
|
|
|
|
|
do
|
2003-03-13 09:51:11 +00:00
|
|
|
|
{
|
2015-03-08 04:09:23 +00:00
|
|
|
|
if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
DPRINT1("break\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-03-13 09:51:11 +00:00
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
if ((DirKeyValue[0] == UNICODE_NULL) || (DirKeyValue[0] == L'\\' && DirKeyValue[1] == UNICODE_NULL))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2015-03-08 04:09:23 +00:00
|
|
|
|
/* Installation path */
|
|
|
|
|
DPRINT("InstallationPath: '%S'\n", DirKeyValue);
|
|
|
|
|
|
|
|
|
|
wcscpy(PathBuffer, DestinationPath.Buffer);
|
|
|
|
|
|
|
|
|
|
DPRINT("FullPath: '%S'\n", PathBuffer);
|
|
|
|
|
}
|
|
|
|
|
else if (DirKeyValue[0] == L'\\')
|
|
|
|
|
{
|
|
|
|
|
/* Absolute path */
|
|
|
|
|
DPRINT("Absolute Path: '%S'\n", DirKeyValue);
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
|
|
|
|
|
DestinationRootPath.Buffer, DirKeyValue);
|
2015-03-08 04:09:23 +00:00
|
|
|
|
|
|
|
|
|
/* Remove trailing backslash */
|
|
|
|
|
Length = wcslen(PathBuffer);
|
|
|
|
|
if ((Length > 0) && (PathBuffer[Length - 1] == L'\\'))
|
|
|
|
|
{
|
2017-05-23 22:30:54 +00:00
|
|
|
|
PathBuffer[Length - 1] = UNICODE_NULL;
|
2015-03-08 04:09:23 +00:00
|
|
|
|
}
|
2002-11-13 18:25:18 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("FullPath: '%S'\n", PathBuffer);
|
2015-03-08 04:09:23 +00:00
|
|
|
|
|
|
|
|
|
Status = SetupCreateDirectory(PathBuffer);
|
|
|
|
|
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
|
|
|
|
|
{
|
|
|
|
|
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
|
|
|
|
|
MUIDisplayError(ERROR_CREATE_DIR, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
2015-03-08 04:09:23 +00:00
|
|
|
|
else // if (DirKeyValue[0] != L'\\')
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2015-03-08 04:09:23 +00:00
|
|
|
|
/* Path relative to the installation path */
|
|
|
|
|
DPRINT("RelativePath: '%S'\n", DirKeyValue);
|
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
|
|
|
|
|
DestinationPath.Buffer, DirKeyValue);
|
2015-03-08 04:09:23 +00:00
|
|
|
|
|
|
|
|
|
/* Remove trailing backslash */
|
|
|
|
|
Length = wcslen(PathBuffer);
|
|
|
|
|
if ((Length > 0) && (PathBuffer[Length - 1] == L'\\'))
|
|
|
|
|
{
|
2017-05-23 22:30:54 +00:00
|
|
|
|
PathBuffer[Length - 1] = UNICODE_NULL;
|
2015-03-08 04:09:23 +00:00
|
|
|
|
}
|
2003-03-08 19:29:09 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("FullPath: '%S'\n", PathBuffer);
|
2003-03-08 19:29:09 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
Status = SetupCreateDirectory(PathBuffer);
|
|
|
|
|
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
|
|
|
|
|
{
|
|
|
|
|
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
|
|
|
|
|
MUIDisplayError(ERROR_CREATE_DIR, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-08 04:09:23 +00:00
|
|
|
|
} while (SetupFindNextLine(&DirContext, &DirContext));
|
2002-09-25 14:48:35 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return TRUE;
|
2003-08-24 10:36:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
/*
|
|
|
|
|
* Displays the PrepareCopyPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* FileCopyPage(At once)
|
|
|
|
|
* QuitPage
|
|
|
|
|
*
|
|
|
|
|
* SIDEEFFECTS
|
|
|
|
|
* Inits SetupFileQueue
|
|
|
|
|
* Calls PrepareCopyPageInfFile
|
|
|
|
|
*
|
|
|
|
|
* RETURNS
|
|
|
|
|
* Number of the next page.
|
|
|
|
|
*/
|
2003-08-24 10:36:07 +00:00
|
|
|
|
static PAGE_NUMBER
|
|
|
|
|
PrepareCopyPage(PINPUT_RECORD Ir)
|
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
HINF InfHandle;
|
|
|
|
|
WCHAR PathBuffer[MAX_PATH];
|
|
|
|
|
INFCONTEXT CabinetsContext;
|
|
|
|
|
ULONG InfFileSize;
|
|
|
|
|
PWCHAR KeyValue;
|
|
|
|
|
UINT ErrorLine;
|
|
|
|
|
PVOID InfFileData;
|
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
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Create the file queue */
|
|
|
|
|
SetupFileQueue = SetupOpenFileQueue();
|
|
|
|
|
if (SetupFileQueue == NULL)
|
2003-08-24 10:36:07 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_COPY_QUEUE, Ir, POPUP_WAIT_ENTER);
|
2016-02-29 20:58:32 +00:00
|
|
|
|
return QUIT_PAGE;
|
2003-08-24 10:36:07 +00:00
|
|
|
|
}
|
2007-01-05 20:19:21 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir))
|
2003-08-24 10:36:07 +00:00
|
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
|
/* FIXME: show an error dialog */
|
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
|
|
|
|
/* Search for the 'Cabinets' section */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!SetupFindFirstLineW(SetupInf, L"Cabinets", NULL, &CabinetsContext))
|
2003-08-24 10:36:07 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return FILE_COPY_PAGE;
|
2003-08-24 10:36:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/*
|
2010-06-11 21:21:27 +00:00
|
|
|
|
* Enumerate the directory values in the 'Cabinets'
|
|
|
|
|
* section and parse their inf files.
|
|
|
|
|
*/
|
2008-01-07 16:50:40 +00:00
|
|
|
|
do
|
2003-08-24 10:36:07 +00:00
|
|
|
|
{
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!INF_GetData(&CabinetsContext, NULL, &KeyValue))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
break;
|
2003-08-24 10:36:07 +00:00
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
|
|
|
|
|
SourcePath.Buffer, KeyValue);
|
2003-08-24 10:36:07 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
CabinetInitialize();
|
|
|
|
|
CabinetSetEventHandlers(NULL, NULL, NULL);
|
|
|
|
|
CabinetSetCabinetName(PathBuffer);
|
|
|
|
|
|
|
|
|
|
if (CabinetOpen() == CAB_STATUS_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
DPRINT("Cabinet %S\n", CabinetGetCabinetName());
|
|
|
|
|
|
|
|
|
|
InfFileData = CabinetGetCabinetReservedArea(&InfFileSize);
|
|
|
|
|
if (InfFileData == NULL)
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_CABINET_SCRIPT, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
|
|
|
|
|
MUIDisplayError(ERROR_CABINET_MISSING, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfHandle = INF_OpenBufferedFileA((CHAR*) InfFileData,
|
|
|
|
|
InfFileSize,
|
|
|
|
|
(const CHAR*) NULL,
|
|
|
|
|
INF_STYLE_WIN4,
|
2010-04-26 15:10:23 +00:00
|
|
|
|
LanguageId,
|
2008-01-07 16:50:40 +00:00
|
|
|
|
&ErrorLine);
|
|
|
|
|
|
|
|
|
|
if (InfHandle == INVALID_HANDLE_VALUE)
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_INVALID_CABINET_INF, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CabinetCleanup();
|
|
|
|
|
|
|
|
|
|
if (!PrepareCopyPageInfFile(InfHandle, KeyValue, Ir))
|
|
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
|
/* FIXME: show an error dialog */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return QUIT_PAGE;
|
2003-08-24 10:36:07 +00:00
|
|
|
|
}
|
2010-06-11 21:21:27 +00:00
|
|
|
|
} while (SetupFindNextLine(&CabinetsContext, &CabinetsContext));
|
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
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2007-02-28 20:43:13 +00:00
|
|
|
|
VOID
|
|
|
|
|
NTAPI
|
|
|
|
|
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
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
PCOPYCONTEXT CopyContext;
|
2002-11-23 01:55:27 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
CopyContext = (PCOPYCONTEXT)Context;
|
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:
|
|
|
|
|
CopyContext->TotalOperations = (ULONG)Param2;
|
|
|
|
|
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;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
case SPFILENOTIFY_STARTCOPY:
|
|
|
|
|
/* Display copy message */
|
2010-05-24 21:43:51 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_COPYING), (PWSTR)Param1);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
SetupUpdateMemoryInfo(CopyContext, FALSE);
|
|
|
|
|
break;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
case SPFILENOTIFY_ENDCOPY:
|
|
|
|
|
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;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
}
|
2002-11-23 01:55:27 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return 0;
|
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
|
|
|
|
|
* Calls SetupCommitFileQueueW
|
|
|
|
|
* Calls SetupCloseFileQueue
|
|
|
|
|
*
|
|
|
|
|
* 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;
|
2009-08-02 17:38:27 +00:00
|
|
|
|
unsigned int mem_bar_width;
|
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.DestinationRootPath = DestinationRootPath.Buffer;
|
|
|
|
|
CopyContext.InstallPath = InstallPath.Buffer;
|
|
|
|
|
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
|
2009-08-02 17:38:27 +00:00
|
|
|
|
mem_bar_width = (xScreen - 26) / 5;
|
2008-07-30 15:12:09 +00:00
|
|
|
|
mem_bar_width -= mem_bar_width % 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,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
13 + mem_bar_width,
|
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 */
|
2008-07-30 15:12:09 +00:00
|
|
|
|
CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (mem_bar_width / 2),
|
2007-02-28 20:43:13 +00:00
|
|
|
|
40,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
(xScreen / 2) + (mem_bar_width / 2),
|
2007-02-28 20:43:13 +00:00
|
|
|
|
43,
|
2008-07-30 15:12:09 +00:00
|
|
|
|
(xScreen / 2)- (mem_bar_width / 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 */
|
2008-07-30 15:12:09 +00:00
|
|
|
|
CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - mem_bar_width,
|
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,
|
2010-06-11 21:21:27 +00:00
|
|
|
|
xScreen - 13 - mem_bar_width,
|
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 */
|
|
|
|
|
SetupCommitFileQueueW(NULL,
|
|
|
|
|
SetupFileQueue,
|
|
|
|
|
FileCopyCallback,
|
|
|
|
|
&CopyContext);
|
|
|
|
|
|
|
|
|
|
/* If we get here, we're done, so cleanup the queue and progress bar */
|
|
|
|
|
SetupCloseFileQueue(SetupFileQueue);
|
|
|
|
|
DestroyProgressBar(CopyContext.ProgressBar);
|
|
|
|
|
DestroyProgressBar(CopyContext.MemoryBars[0]);
|
|
|
|
|
DestroyProgressBar(CopyContext.MemoryBars[1]);
|
|
|
|
|
DestroyProgressBar(CopyContext.MemoryBars[2]);
|
|
|
|
|
|
|
|
|
|
/* Go display the next page */
|
|
|
|
|
return REGISTRY_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
/*
|
|
|
|
|
* Displays the RegistryPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* SuccessPage (if RepairUpdate)
|
|
|
|
|
* BootLoaderPage (default)
|
|
|
|
|
* QuitPage
|
|
|
|
|
*
|
|
|
|
|
* SIDEEFFECTS
|
|
|
|
|
* Calls SetInstallPathValue
|
|
|
|
|
* Calls NtInitializeRegistry
|
|
|
|
|
* 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
|
|
|
|
RegistryPage(PINPUT_RECORD Ir)
|
2002-09-25 14:48:35 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
INFCONTEXT InfContext;
|
|
|
|
|
PWSTR Action;
|
|
|
|
|
PWSTR File;
|
|
|
|
|
PWSTR Section;
|
|
|
|
|
BOOLEAN Delete;
|
|
|
|
|
NTSTATUS Status;
|
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
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (RepairUpdateFlag)
|
2007-06-30 19:37:43 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return SUCCESS_PAGE;
|
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 (!SetInstallPathValue(&DestinationPath))
|
2003-03-08 19:29:09 +00:00
|
|
|
|
{
|
2015-03-29 11:29:02 +00:00
|
|
|
|
DPRINT1("SetInstallPathValue() failed\n");
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_INITIALIZE_REGISTRY, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
}
|
2002-10-29 18:40:02 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Create the default hives */
|
|
|
|
|
Status = NtInitializeRegistry(CM_BOOT_FLAG_SETUP);
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
2003-03-08 19:29:09 +00:00
|
|
|
|
{
|
2015-03-29 11:29:02 +00:00
|
|
|
|
DPRINT1("NtInitializeRegistry() failed (Status %lx)\n", Status);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_CREATE_HIVE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
}
|
2002-11-26 15:33:06 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Update registry */
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_REGHIVEUPDATE));
|
2003-03-19 20:12:44 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!SetupFindFirstLineW(SetupInf, L"HiveInfs.Install", NULL, &InfContext))
|
2003-03-08 19:29:09 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT1("SetupFindFirstLine() failed\n");
|
|
|
|
|
MUIDisplayError(ERROR_FIND_REGISTRY, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2003-03-08 19:29:09 +00:00
|
|
|
|
}
|
2002-11-26 15:33:06 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
do
|
2003-03-19 20:12:44 +00:00
|
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
|
INF_GetDataField(&InfContext, 0, &Action);
|
|
|
|
|
INF_GetDataField(&InfContext, 1, &File);
|
|
|
|
|
INF_GetDataField(&InfContext, 2, &Section);
|
2003-03-19 20:12:44 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Action: %S File: %S Section %S\n", Action, File, Section);
|
2003-03-19 20:12:44 +00:00
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (Action == NULL)
|
|
|
|
|
break; // Hackfix
|
2010-04-28 11:35:34 +00:00
|
|
|
|
|
2016-02-29 20:58:32 +00:00
|
|
|
|
if (!_wcsicmp(Action, L"AddReg"))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
Delete = FALSE;
|
|
|
|
|
}
|
2016-02-29 20:58:32 +00:00
|
|
|
|
else if (!_wcsicmp(Action, L"DelReg"))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
Delete = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2002-10-29 18:40:02 +00:00
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_IMPORTFILE), File);
|
2003-01-17 13:18:15 +00:00
|
|
|
|
|
2010-04-26 15:10:23 +00:00
|
|
|
|
if (!ImportRegistryFile(File, Section, LanguageId, Delete))
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2015-03-29 11:29:02 +00:00
|
|
|
|
DPRINT1("Importing %S failed\n", File);
|
2003-01-17 13:18:15 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_IMPORT_HIVE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
2010-06-11 21:21:27 +00:00
|
|
|
|
} while (SetupFindNextLine(&InfContext, &InfContext));
|
2003-03-22 15:25:03 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Update display registry settings */
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYETTINGSUPDATE));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!ProcessDisplayRegistry(SetupInf, DisplayList))
|
2004-06-20 12:18:08 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2004-06-20 12:18:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 21:34:56 +00:00
|
|
|
|
/* Set the locale */
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_LOCALESETTINGSUPDATE));
|
2008-01-07 21:34:56 +00:00
|
|
|
|
if (!ProcessLocaleRegistry(LanguageList))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_UPDATE_LOCALESETTINGS, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-28 14:04:22 +00:00
|
|
|
|
/* Add keyboard layouts */
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_ADDKBLAYOUTS));
|
|
|
|
|
if (!AddKeyboardLayouts())
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_ADDING_KBLAYOUTS, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 13:50:49 +00:00
|
|
|
|
/* Set GeoID */
|
|
|
|
|
if (!SetGeoID(MUIGetGeoID()))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_UPDATE_GEOID, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (!IsUnattendedSetup)
|
|
|
|
|
{
|
|
|
|
|
/* Update keyboard layout settings */
|
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE));
|
|
|
|
|
if (!ProcessKeyboardLayoutRegistry(LayoutList))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_UPDATE_KBSETTINGS, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
2004-06-02 22:18:06 +00:00
|
|
|
|
}
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Add codepage information to registry */
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_CODEPAGEINFOUPDATE));
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!AddCodePage())
|
2008-01-07 14:51:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_ADDING_CODEPAGE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2008-01-07 14:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-09 21:49:30 +00:00
|
|
|
|
/* Set the default pagefile entry */
|
|
|
|
|
SetDefaultPagefile(DestinationDriveLetter);
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Update the mounted devices list */
|
|
|
|
|
SetMountedDeviceValues(PartitionList);
|
2005-09-15 17:19:31 +00:00
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_DONE));
|
2003-01-17 13:18:15 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
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
|
|
|
|
|
* Calls SetInstallPathValue
|
|
|
|
|
* Calls NtInitializeRegistry
|
|
|
|
|
* 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
|
|
|
|
UCHAR PartitionType;
|
|
|
|
|
BOOLEAN InstallOnFloppy;
|
|
|
|
|
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
|
|
|
|
|
2012-01-30 04:52:37 +00:00
|
|
|
|
RtlFreeUnicodeString(&SystemRootPath);
|
|
|
|
|
swprintf(PathBuffer,
|
|
|
|
|
L"\\Device\\Harddisk%lu\\Partition%lu",
|
2017-05-13 16:40:30 +00:00
|
|
|
|
PartitionList->SystemPartition->DiskEntry->DiskNumber,
|
2016-02-28 15:25:22 +00:00
|
|
|
|
PartitionList->SystemPartition->PartitionNumber);
|
|
|
|
|
RtlCreateUnicodeString(&SystemRootPath, PathBuffer);
|
[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
|
|
|
|
DPRINT1("SystemRootPath: %wZ\n", &SystemRootPath);
|
2012-01-30 04:52:37 +00:00
|
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
|
PartitionType = PartitionList->SystemPartition->PartitionType;
|
2003-01-30 14:41:45 +00:00
|
|
|
|
|
2009-07-16 09:09:26 +00:00
|
|
|
|
if (IsUnattendedSetup)
|
|
|
|
|
{
|
|
|
|
|
if (UnattendMBRInstallType == 0) /* skip MBR installation */
|
|
|
|
|
{
|
|
|
|
|
return SUCCESS_PAGE;
|
|
|
|
|
}
|
|
|
|
|
else if (UnattendMBRInstallType == 1) /* install on floppy */
|
|
|
|
|
{
|
|
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (PartitionType == PARTITION_ENTRY_UNUSED)
|
2004-06-23 14:09:55 +00:00
|
|
|
|
{
|
2016-02-28 15:25:22 +00:00
|
|
|
|
DPRINT("Error: system partition invalid (unused)\n");
|
2008-01-07 16:50:40 +00:00
|
|
|
|
InstallOnFloppy = TRUE;
|
2003-01-17 13:18:15 +00:00
|
|
|
|
}
|
2016-02-02 01:55:05 +00:00
|
|
|
|
else if (PartitionType == PARTITION_OS2BOOTMGR)
|
2003-01-17 13:18:15 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* OS/2 boot manager partition */
|
|
|
|
|
DPRINT("Found OS/2 boot manager partition\n");
|
|
|
|
|
InstallOnFloppy = TRUE;
|
2003-01-17 13:18:15 +00:00
|
|
|
|
}
|
2016-02-02 01:55:05 +00:00
|
|
|
|
else if (PartitionType == PARTITION_EXT2)
|
2003-01-17 13:18:15 +00:00
|
|
|
|
{
|
2016-02-28 15:25:22 +00:00
|
|
|
|
/* Linux EXT2 partition */
|
|
|
|
|
DPRINT("Found Linux EXT2 partition\n");
|
2016-02-02 01:55:05 +00:00
|
|
|
|
InstallOnFloppy = FALSE;
|
2003-01-17 13:18:15 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else if (PartitionType == PARTITION_IFS)
|
2003-03-08 19:29:09 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* NTFS partition */
|
|
|
|
|
DPRINT("Found NTFS partition\n");
|
2016-02-02 01:55:05 +00:00
|
|
|
|
|
|
|
|
|
// FIXME: Make it FALSE when we'll support NTFS installation!
|
2008-01-07 16:50:40 +00:00
|
|
|
|
InstallOnFloppy = TRUE;
|
2003-01-17 13:18:15 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else if ((PartitionType == PARTITION_FAT_12) ||
|
|
|
|
|
(PartitionType == PARTITION_FAT_16) ||
|
|
|
|
|
(PartitionType == PARTITION_HUGE) ||
|
|
|
|
|
(PartitionType == PARTITION_XINT13) ||
|
|
|
|
|
(PartitionType == PARTITION_FAT32) ||
|
|
|
|
|
(PartitionType == PARTITION_FAT32_XINT13))
|
2003-01-17 13:18:15 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DPRINT("Found FAT partition\n");
|
|
|
|
|
InstallOnFloppy = FALSE;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
}
|
2008-01-07 16:50:40 +00:00
|
|
|
|
else
|
2004-06-23 14:09:55 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
/* Unknown partition */
|
|
|
|
|
DPRINT("Unknown partition found\n");
|
|
|
|
|
InstallOnFloppy = TRUE;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
}
|
2003-01-17 13:18:15 +00:00
|
|
|
|
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (InstallOnFloppy != FALSE)
|
2004-06-23 14:09:55 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
2004-06-23 14:09:55 +00:00
|
|
|
|
}
|
2003-01-30 14:41:45 +00:00
|
|
|
|
|
2009-07-16 09:09:26 +00:00
|
|
|
|
/* Unattended install on hdd? */
|
|
|
|
|
if (IsUnattendedSetup && UnattendMBRInstallType == 2)
|
2006-08-02 18:58:07 +00:00
|
|
|
|
{
|
2010-09-05 17:09:18 +00:00
|
|
|
|
return BOOT_LOADER_HARDDISK_MBR_PAGE;
|
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++;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (Line<12)
|
2010-09-05 17:09:18 +00:00
|
|
|
|
Line=15;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2010-09-05 17:09:18 +00:00
|
|
|
|
if (Line>15)
|
2010-06-11 21:21:27 +00:00
|
|
|
|
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--;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
if (Line<12)
|
2010-09-05 17:09:18 +00:00
|
|
|
|
Line=15;
|
2010-06-11 21:21:27 +00:00
|
|
|
|
|
2010-09-05 17:09:18 +00:00
|
|
|
|
if (Line>15)
|
2010-06-11 21:21:27 +00:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
|
|
|
|
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
|
|
|
|
{
|
2017-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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)
|
|
|
|
|
{
|
2010-09-05 17:09:18 +00:00
|
|
|
|
return BOOT_LOADER_HARDDISK_MBR_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
else if (Line == 13)
|
|
|
|
|
{
|
2010-09-05 17:09:18 +00:00
|
|
|
|
return BOOT_LOADER_HARDDISK_VBR_PAGE;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
else if (Line == 14)
|
2010-09-05 17:09:18 +00:00
|
|
|
|
{
|
|
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
|
|
|
|
}
|
|
|
|
|
else if (Line == 15)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
2009-02-04 16:26:02 +00:00
|
|
|
|
return SUCCESS_PAGE;
|
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
|
|
|
|
|
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-10-01 14:42:04 +00:00
|
|
|
|
if (ConfirmQuit(Ir) != FALSE)
|
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-05-23 22:30:54 +00:00
|
|
|
|
if (DoesPathExist(NULL, L"\\Device\\Floppy0\\") == FALSE)
|
2008-01-07 16:50:40 +00:00
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_NO_FLOPPY, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return BOOT_LOADER_FLOPPY_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Status = InstallFatBootcodeToFloppy(&SourceRootPath, &DestinationArcPath);
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
|
{
|
|
|
|
|
/* Print error message */
|
|
|
|
|
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
|
|
|
|
/*
|
|
|
|
|
* Displays the BootLoaderHarddiskVbrPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* SuccessPage (At once)
|
|
|
|
|
* QuitPage
|
|
|
|
|
*
|
|
|
|
|
* SIDEEFFECTS
|
|
|
|
|
* Calls InstallVBRToPartition()
|
|
|
|
|
*
|
|
|
|
|
* RETURNS
|
|
|
|
|
* Number of the next page.
|
|
|
|
|
*/
|
2010-09-05 17:09:18 +00:00
|
|
|
|
static PAGE_NUMBER
|
|
|
|
|
BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir)
|
|
|
|
|
{
|
|
|
|
|
UCHAR PartitionType;
|
|
|
|
|
NTSTATUS Status;
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
|
PartitionType = PartitionList->SystemPartition->PartitionType;
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
2010-09-05 17:09:18 +00:00
|
|
|
|
Status = InstallVBRToPartition(&SystemRootPath,
|
|
|
|
|
&SourceRootPath,
|
|
|
|
|
&DestinationArcPath,
|
|
|
|
|
PartitionType);
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
|
{
|
|
|
|
|
MUIDisplayError(ERROR_WRITE_BOOT, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
2010-09-05 17:09:18 +00:00
|
|
|
|
return SUCCESS_PAGE;
|
|
|
|
|
}
|
2003-01-28 17:29:22 +00:00
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
/*
|
|
|
|
|
* Displays the BootLoaderHarddiskMbrPage.
|
|
|
|
|
*
|
|
|
|
|
* Next pages:
|
|
|
|
|
* SuccessPage (At once)
|
|
|
|
|
* QuitPage
|
|
|
|
|
*
|
|
|
|
|
* SIDEEFFECTS
|
|
|
|
|
* Calls InstallVBRToPartition()
|
|
|
|
|
* CallsInstallMbrBootCodeToDisk()
|
|
|
|
|
*
|
|
|
|
|
* RETURNS
|
|
|
|
|
* Number of the next page.
|
|
|
|
|
*/
|
2004-06-23 14:09:55 +00:00
|
|
|
|
static PAGE_NUMBER
|
2010-09-05 17:09:18 +00:00
|
|
|
|
BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
|
2004-06-23 14:09:55 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
UCHAR PartitionType;
|
|
|
|
|
NTSTATUS Status;
|
2010-09-04 20:56:19 +00:00
|
|
|
|
WCHAR DestinationDevicePathBuffer[MAX_PATH];
|
|
|
|
|
WCHAR SourceMbrPathBuffer[MAX_PATH];
|
[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
|
|
|
|
WCHAR DstPath[MAX_PATH];
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
2010-09-04 20:56:19 +00:00
|
|
|
|
/* Step 1: Write the VBR */
|
2016-02-28 15:25:22 +00:00
|
|
|
|
PartitionType = PartitionList->SystemPartition->PartitionType;
|
2010-09-05 17:09:18 +00:00
|
|
|
|
|
|
|
|
|
Status = InstallVBRToPartition(&SystemRootPath,
|
|
|
|
|
&SourceRootPath,
|
|
|
|
|
&DestinationArcPath,
|
|
|
|
|
PartitionType);
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
2003-01-17 13:18:15 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
MUIDisplayError(ERROR_WRITE_BOOT, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-04 20:56:19 +00:00
|
|
|
|
/* Step 2: Write the MBR */
|
|
|
|
|
swprintf(DestinationDevicePathBuffer,
|
|
|
|
|
L"\\Device\\Harddisk%d\\Partition0",
|
2017-05-13 16:40:30 +00:00
|
|
|
|
PartitionList->SystemPartition->DiskEntry->DiskNumber);
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(SourceMbrPathBuffer, ARRAYSIZE(SourceMbrPathBuffer), 2, SourceRootPath.Buffer, L"\\loader\\dosmbr.bin");
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
[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
|
|
|
|
if (IsThereAValidBootSector(DestinationDevicePathBuffer))
|
|
|
|
|
{
|
|
|
|
|
/* Save current MBR */
|
2017-05-23 22:30:54 +00:00
|
|
|
|
CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath.Buffer, L"\\mbr.old");
|
[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
|
|
|
|
|
|
|
|
|
DPRINT1("Save MBR: %S ==> %S\n", DestinationDevicePathBuffer, DstPath);
|
|
|
|
|
Status = SaveBootSector(DestinationDevicePathBuffer, DstPath, sizeof(PARTITION_SECTOR));
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
|
{
|
|
|
|
|
DPRINT1("SaveBootSector() failed (Status %lx)\n", Status);
|
|
|
|
|
// Don't care if we succeeded or not saving the old MBR, just go ahead.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-09 15:31:53 +00:00
|
|
|
|
DPRINT1("Install MBR bootcode: %S ==> %S\n",
|
|
|
|
|
SourceMbrPathBuffer, DestinationDevicePathBuffer);
|
2010-09-04 20:56:19 +00:00
|
|
|
|
Status = InstallMbrBootCodeToDisk(SourceMbrPathBuffer,
|
|
|
|
|
DestinationDevicePathBuffer);
|
2016-02-29 20:58:32 +00:00
|
|
|
|
if (!NT_SUCCESS(Status))
|
2010-09-04 20:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
|
|
|
|
|
Status);
|
|
|
|
|
MUIDisplayError(ERROR_INSTALL_BOOTCODE, Ir, POPUP_WAIT_ENTER);
|
|
|
|
|
return QUIT_PAGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SUCCESS_PAGE;
|
2002-09-25 14:48:35 +00:00
|
|
|
|
}
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
}
|
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 */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (FileSystemList != NULL)
|
2003-08-04 15:54:05 +00:00
|
|
|
|
{
|
2016-02-29 20:58:32 +00:00
|
|
|
|
DestroyFileSystemList(FileSystemList);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
FileSystemList = NULL;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
/* Destroy the computer settings list */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (ComputerList != NULL)
|
2004-05-28 12:14:00 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DestroyGenericList(ComputerList, TRUE);
|
|
|
|
|
ComputerList = NULL;
|
2004-05-28 12:14:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
/* Destroy the display settings list */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (DisplayList != NULL)
|
2004-05-28 12:14:00 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DestroyGenericList(DisplayList, TRUE);
|
|
|
|
|
DisplayList = NULL;
|
2004-05-28 12:14:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
/* Destroy the keyboard settings list */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (KeyboardList != NULL)
|
2004-05-28 12:14:00 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DestroyGenericList(KeyboardList, TRUE);
|
|
|
|
|
KeyboardList = NULL;
|
2004-05-28 12:14:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
/* Destroy the keyboard layout list */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (LayoutList != NULL)
|
2004-05-28 12:14:00 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DestroyGenericList(LayoutList, TRUE);
|
|
|
|
|
LayoutList = NULL;
|
2004-05-28 12:14:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
/* Destroy the languages list */
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (LanguageList != NULL)
|
2007-12-13 16:15:43 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
DestroyGenericList(LanguageList, FALSE);
|
|
|
|
|
LanguageList = NULL;
|
2007-12-13 16:15:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
CONSOLE_SetStatusText(MUIGetString(STRING_REBOOTCOMPUTER2));
|
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 == 0x0D) /* ENTER */
|
|
|
|
|
{
|
|
|
|
|
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)
|
2003-10-06 19:22:42 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
return FLUSH_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);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-12-06 16:25:57 +00:00
|
|
|
|
DWORD WINAPI
|
|
|
|
|
PnpEventThread(IN LPVOID lpParameter);
|
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The start routine and page management
|
|
|
|
|
*/
|
2006-11-10 21:00:24 +00:00
|
|
|
|
VOID
|
2006-08-31 12:35:39 +00:00
|
|
|
|
RunUSetup(VOID)
|
2002-09-08 18:29:56 +00:00
|
|
|
|
{
|
2008-01-07 16:50:40 +00:00
|
|
|
|
INPUT_RECORD Ir;
|
|
|
|
|
PAGE_NUMBER Page;
|
|
|
|
|
LARGE_INTEGER Time;
|
2011-05-27 20:50:17 +00:00
|
|
|
|
NTSTATUS Status;
|
2014-08-30 07:04:57 +00:00
|
|
|
|
BOOLEAN Old;
|
2008-01-07 16:50:40 +00:00
|
|
|
|
|
|
|
|
|
NtQuerySystemTime(&Time);
|
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
|
/* Create the PnP thread in suspended state */
|
2010-06-11 21:21:27 +00:00
|
|
|
|
Status = RtlCreateUserThread(NtCurrentProcess(),
|
|
|
|
|
NULL,
|
|
|
|
|
TRUE,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
PnpEventThread,
|
|
|
|
|
&SetupInf,
|
|
|
|
|
&hPnpThread,
|
|
|
|
|
NULL);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
|
hPnpThread = INVALID_HANDLE_VALUE;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
/* Raise a hard error (crash the system/BSOD) */
|
|
|
|
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
|
|
|
|
|
0,0,0,0,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize global unicode strings */
|
|
|
|
|
RtlInitUnicodeString(&SourcePath, NULL);
|
|
|
|
|
RtlInitUnicodeString(&SourceRootPath, NULL);
|
|
|
|
|
RtlInitUnicodeString(&SourceRootDir, NULL);
|
|
|
|
|
RtlInitUnicodeString(&InstallPath, NULL);
|
|
|
|
|
RtlInitUnicodeString(&DestinationPath, NULL);
|
|
|
|
|
RtlInitUnicodeString(&DestinationArcPath, NULL);
|
|
|
|
|
RtlInitUnicodeString(&DestinationRootPath, NULL);
|
|
|
|
|
RtlInitUnicodeString(&SystemRootPath, NULL);
|
|
|
|
|
|
|
|
|
|
/* Hide the cursor */
|
|
|
|
|
CONSOLE_SetCursorType(TRUE, FALSE);
|
|
|
|
|
|
|
|
|
|
Page = START_PAGE;
|
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();
|
|
|
|
|
|
|
|
|
|
//CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
|
|
|
|
|
//CONSOLE_Flush();
|
|
|
|
|
|
|
|
|
|
switch (Page)
|
|
|
|
|
{
|
|
|
|
|
/* Start page */
|
|
|
|
|
case START_PAGE:
|
|
|
|
|
Page = SetupStartPage(&Ir);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Language page */
|
|
|
|
|
case LANGUAGE_PAGE:
|
|
|
|
|
Page = LanguagePage(&Ir);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* License page */
|
|
|
|
|
case LICENSE_PAGE:
|
|
|
|
|
Page = LicensePage(&Ir);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Intro page */
|
|
|
|
|
case INTRO_PAGE:
|
|
|
|
|
Page = IntroPage(&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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
2010-09-05 17:09:18 +00:00
|
|
|
|
case BOOT_LOADER_HARDDISK_MBR_PAGE:
|
|
|
|
|
Page = BootLoaderHarddiskMbrPage(&Ir);
|
|
|
|
|
break;
|
2011-05-20 22:29:54 +00:00
|
|
|
|
|
2010-09-05 17:09:18 +00:00
|
|
|
|
case BOOT_LOADER_HARDDISK_VBR_PAGE:
|
|
|
|
|
Page = BootLoaderHarddiskVbrPage(&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
|
|
|
|
|
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
|
|
|
|
|
2014-12-20 21:58:22 +00:00
|
|
|
|
case RECOVERY_PAGE:
|
2008-01-07 16:50:40 +00:00
|
|
|
|
case REBOOT_PAGE:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-09-19 16:21:15 +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
|
|
|
|
/* Avoid bugcheck */
|
|
|
|
|
Time.QuadPart += 50000000;
|
|
|
|
|
NtDelayExecution(FALSE, &Time);
|
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);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
NtTerminateProcess(NtCurrentProcess(), 0);
|
2002-09-08 18:29:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-08-31 12:35:39 +00:00
|
|
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
|
NtProcessStartup(PPEB Peb)
|
|
|
|
|
{
|
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;
|
2011-02-20 16:50:38 +00:00
|
|
|
|
InfSetHeap(ProcessHeap);
|
2008-01-07 16:50:40 +00:00
|
|
|
|
RunUSetup();
|
2006-08-31 12:35:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 18:29:56 +00:00
|
|
|
|
/* EOF */
|