ReactOS  0.4.15-dev-1200-gc3b3fcd
usetup.c File Reference
#include <usetup.h>
#include <math.h>
#include <ntstrsafe.h>
#include "bootsup.h"
#include "chkdsk.h"
#include "cmdcons.h"
#include "devinst.h"
#include "format.h"
#include <debug.h>
Include dependency graph for usetup.c:

Go to the source code of this file.

Classes

struct  _COPYCONTEXT
 

Macros

#define NDEBUG
 
#define PARTITION_SIZE_INPUT_FIELD_LENGTH   9
 
#define PARTITION_MAXSIZE   (pow(10, (PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)) - 1)
 

Typedefs

typedef struct _COPYCONTEXT COPYCONTEXT
 
typedef struct _COPYCONTEXTPCOPYCONTEXT
 

Functions

static VOID PrintString (char *fmt,...)
 
static VOID DrawBox (IN SHORT xLeft, IN SHORT yTop, IN SHORT Width, IN SHORT Height)
 
VOID PopupError (PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
 
static BOOL ConfirmQuit (PINPUT_RECORD Ir)
 
static VOID UpdateKBLayout (VOID)
 
static NTSTATUS NTAPI GetSettingDescription (IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
 
static NTSTATUS NTAPI GetNTOSInstallationName (IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
 
static PAGE_NUMBER LanguagePage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER SetupStartPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER WelcomePage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER LicensePage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER RepairIntroPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER UpgradeRepairPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER InstallIntroPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER DeviceSettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER HandleGenericList (PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
 
static PAGE_NUMBER ComputerSettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER DisplaySettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER KeyboardSettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER LayoutSettingsPage (PINPUT_RECORD Ir)
 
static BOOL IsDiskSizeValid (PPARTENTRY PartEntry)
 
static PAGE_NUMBER SelectPartitionPage (PINPUT_RECORD Ir)
 
static VOID ShowPartitionSizeInputBox (SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
 
static PAGE_NUMBER CreatePrimaryPartitionPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER CreateExtendedPartitionPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER CreateLogicalPartitionPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER DeletePartitionPage (PINPUT_RECORD Ir)
 
static VOID ResetFileSystemList (VOID)
 
static PAGE_NUMBER SelectFileSystemPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER FormatPartitionPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER CheckFileSystemPage (PINPUT_RECORD Ir)
 
static BOOLEAN IsValidPath (IN PCWSTR InstallDir)
 
static PAGE_NUMBER InstallDirectoryPage (PINPUT_RECORD Ir)
 
static VOID __cdecl USetupErrorRoutine (IN PUSETUP_DATA pSetupData,...)
 
static PAGE_NUMBER PrepareCopyPage (PINPUT_RECORD Ir)
 
static VOID SetupUpdateMemoryInfo (IN PCOPYCONTEXT CopyContext, IN BOOLEAN First)
 
static UINT CALLBACK FileCopyCallback (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static PAGE_NUMBER FileCopyPage (PINPUT_RECORD Ir)
 
static VOID __cdecl RegistryStatus (IN REGISTRY_STATUS RegStatus,...)
 
static PAGE_NUMBER RegistryPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER BootLoaderPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER BootLoaderFloppyPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER BootLoaderHarddiskVbrPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER BootLoaderHarddiskMbrPage (PINPUT_RECORD Ir)
 
ProgressTimeOutStringHandler

Handles the generation (displaying) of the timeout countdown to the screen dynamically.

Parameters
BarA pointer to a progress bar.
AlwaysUpdateConstantly update the progress bar (boolean type).
BufferA pointer to a string buffer.
cchBufferSizeThe buffer's size in number of characters.
Returns
TRUE or FALSE on function termination.
static BOOLEAN NTAPI ProgressTimeOutStringHandler (IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
 
ProgressCountdown

Displays and draws a red-coloured progress bar with a countdown. When the timeout is reached, the flush page is displayed for reboot.

Parameters
IrA pointer to an input keyboard record.
TimeOutInitial countdown value in seconds.
Returns
Nothing.
static VOID ProgressCountdown (IN PINPUT_RECORD Ir, IN LONG TimeOut)
 
static PAGE_NUMBER QuitPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER SuccessPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER FlushPage (PINPUT_RECORD Ir)
 
NTSTATUS RunUSetup (VOID)
 
VOID NTAPI NtProcessStartup (PPEB Peb)
 

Variables

HANDLE ProcessHeap
 
BOOLEAN IsUnattendedSetup = FALSE
 
static USETUP_DATA USetupData
 
static PPARTENTRY InstallPartition = NULL
 
static PPARTENTRY SystemPartition = NULL
 
PCWSTR SelectedLanguageId
 
static WCHAR DefaultLanguage [20]
 
static WCHAR DefaultKBLayout [20]
 
static BOOLEAN RepairUpdateFlag = FALSE
 
static PPARTLIST PartitionList = NULL
 
static PPARTENTRY CurrentPartition = NULL
 
static PFILE_SYSTEM_LIST FileSystemList = NULL
 
static PPARTENTRY TempPartition = NULL
 
static FORMATMACHINESTATE FormatState = Start
 
static PNTOS_INSTALLATION CurrentInstallation = NULL
 
static PGENERIC_LIST NtOsInstallsList = NULL
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 38 of file usetup.c.

◆ PARTITION_MAXSIZE

#define PARTITION_MAXSIZE   (pow(10, (PARTITION_SIZE_INPUT_FIELD_LENGTH - 1)) - 1)

Definition at line 1860 of file usetup.c.

◆ PARTITION_SIZE_INPUT_FIELD_LENGTH

#define PARTITION_SIZE_INPUT_FIELD_LENGTH   9

Definition at line 1858 of file usetup.c.

Typedef Documentation

◆ COPYCONTEXT

◆ PCOPYCONTEXT

Function Documentation

◆ BootLoaderFloppyPage()

static PAGE_NUMBER BootLoaderFloppyPage ( PINPUT_RECORD  Ir)
static

Definition at line 4556 of file usetup.c.

4557 {
4558  NTSTATUS Status;
4559 
4561 
4562 // CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
4563 
4564  while (TRUE)
4565  {
4566  CONSOLE_ConInKey(Ir);
4567 
4568  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4569  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
4570  {
4571  if (ConfirmQuit(Ir))
4572  return QUIT_PAGE;
4573 
4574  break;
4575  }
4576  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4577  {
4578  Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
4579  &USetupData.DestinationArcPath);
4580  if (!NT_SUCCESS(Status))
4581  {
4584 
4585  /* TODO: Print error message */
4586  return BOOT_LOADER_FLOPPY_PAGE;
4587  }
4588 
4589  return SUCCESS_PAGE;
4590  }
4591  }
4592 
4593  return BOOT_LOADER_FLOPPY_PAGE;
4594 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
WORD wVirtualKeyCode
Definition: wincon.h:242
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
NTSTATUS InstallFatBootcodeToFloppy(IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1257
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
Status
Definition: gdiplustypes.h:24
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
union _INPUT_RECORD::@3242 Event
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70

Referenced by RunUSetup().

◆ BootLoaderHarddiskMbrPage()

static PAGE_NUMBER BootLoaderHarddiskMbrPage ( PINPUT_RECORD  Ir)
static

Definition at line 4645 of file usetup.c.

4646 {
4647  NTSTATUS Status;
4648  WCHAR DestinationDevicePathBuffer[MAX_PATH];
4649 
4650  /* Step 1: Write the VBR */
4651  Status = InstallVBRToPartition(&USetupData.SystemRootPath,
4652  &USetupData.SourceRootPath,
4653  &USetupData.DestinationArcPath,
4655  if (!NT_SUCCESS(Status))
4656  {
4659  return QUIT_PAGE;
4660  }
4661 
4662  /* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
4664  {
4665  RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
4666  L"\\Device\\Harddisk%d\\Partition0",
4667  SystemPartition->DiskEntry->DiskNumber);
4668  Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath,
4669  &USetupData.SourceRootPath,
4670  DestinationDevicePathBuffer);
4671  if (!NT_SUCCESS(Status))
4672  {
4673  DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", Status);
4675  return QUIT_PAGE;
4676  }
4677  }
4678 
4679  return SUCCESS_PAGE;
4680 }
static USETUP_DATA USetupData
Definition: usetup.c:47
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:53
static PPARTENTRY SystemPartition
Definition: usetup.c:61
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
Definition: bootsup.c:741
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:680
#define DPRINT1
Definition: precomp.h:8
NTSTATUS InstallVBRToPartition(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath, IN PCWSTR FileSystemName)
Definition: bootsup.c:1209

Referenced by RunUSetup().

◆ BootLoaderHarddiskVbrPage()

static PAGE_NUMBER BootLoaderHarddiskVbrPage ( PINPUT_RECORD  Ir)
static

Definition at line 4611 of file usetup.c.

4612 {
4613  NTSTATUS Status;
4614 
4615  Status = InstallVBRToPartition(&USetupData.SystemRootPath,
4616  &USetupData.SourceRootPath,
4617  &USetupData.DestinationArcPath,
4619  if (!NT_SUCCESS(Status))
4620  {
4623  return QUIT_PAGE;
4624  }
4625 
4626  return SUCCESS_PAGE;
4627 }
static USETUP_DATA USetupData
Definition: usetup.c:47
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:53
static PPARTENTRY SystemPartition
Definition: usetup.c:61
Status
Definition: gdiplustypes.h:24
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
NTSTATUS InstallVBRToPartition(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath, IN PCWSTR FileSystemName)
Definition: bootsup.c:1209

Referenced by RunUSetup().

◆ BootLoaderPage()

static PAGE_NUMBER BootLoaderPage ( PINPUT_RECORD  Ir)
static

Definition at line 4332 of file usetup.c.

4333 {
4335  BOOLEAN InstallOnFloppy;
4336  USHORT Line = 12;
4337  WCHAR PathBuffer[MAX_PATH];
4338 
4340 
4342 
4343  RtlFreeUnicodeString(&USetupData.SystemRootPath);
4344  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
4345  L"\\Device\\Harddisk%lu\\Partition%lu\\",
4346  SystemPartition->DiskEntry->DiskNumber,
4348  RtlCreateUnicodeString(&USetupData.SystemRootPath, PathBuffer);
4349  DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
4350 
4352 
4353  /* For unattended setup, skip MBR installation or install on floppy if needed */
4354  if (IsUnattendedSetup)
4355  {
4356  if ((USetupData.MBRInstallType == 0) ||
4357  (USetupData.MBRInstallType == 1))
4358  {
4359  goto Quit;
4360  }
4361  }
4362 
4363  /*
4364  * We may install an MBR or VBR, but before that, check whether
4365  * we need to actually install the VBR on floppy.
4366  */
4368  {
4369  DPRINT("Error: system partition invalid (unused)\n");
4370  InstallOnFloppy = TRUE;
4371  }
4372  else if (PartitionType == PARTITION_OS2BOOTMGR)
4373  {
4374  /* OS/2 boot manager partition */
4375  DPRINT("Found OS/2 boot manager partition\n");
4376  InstallOnFloppy = TRUE;
4377  }
4378  else if (PartitionType == PARTITION_LINUX)
4379  {
4380  /* Linux partition */
4381  DPRINT("Found Linux native partition (ext2/ext3/ReiserFS/BTRFS/etc)\n");
4382  InstallOnFloppy = FALSE;
4383  }
4384  else if (PartitionType == PARTITION_IFS)
4385  {
4386  /* NTFS partition */
4387  DPRINT("Found NTFS partition\n");
4388 
4389  // FIXME: Make it FALSE when we'll support NTFS installation!
4390  InstallOnFloppy = TRUE;
4391  }
4392  else if ((PartitionType == PARTITION_FAT_12) ||
4398  {
4399  DPRINT("Found FAT partition\n");
4400  InstallOnFloppy = FALSE;
4401  }
4402  else
4403  {
4404  /* Unknown partition */
4405  DPRINT("Unknown partition found\n");
4406  InstallOnFloppy = TRUE;
4407  }
4408 
4409  /* We should install on floppy */
4410  if (InstallOnFloppy)
4411  {
4412  USetupData.MBRInstallType = 1;
4413  goto Quit;
4414  }
4415 
4416  /* Is it an unattended install on hdd? */
4417  if (IsUnattendedSetup)
4418  {
4419  if ((USetupData.MBRInstallType == 2) ||
4420  (USetupData.MBRInstallType == 3))
4421  {
4422  goto Quit;
4423  }
4424  }
4425 
4427  CONSOLE_InvertTextXY(8, Line, 60, 1);
4428 
4429  while (TRUE)
4430  {
4431  CONSOLE_ConInKey(Ir);
4432 
4433  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4434  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
4435  {
4436  CONSOLE_NormalTextXY(8, Line, 60, 1);
4437 
4438  Line++;
4439  if (Line < 12)
4440  Line = 15;
4441 
4442  if (Line > 15)
4443  Line = 12;
4444 
4445  CONSOLE_InvertTextXY(8, Line, 60, 1);
4446  }
4447  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4448  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
4449  {
4450  CONSOLE_NormalTextXY(8, Line, 60, 1);
4451 
4452  Line--;
4453  if (Line < 12)
4454  Line = 15;
4455 
4456  if (Line > 15)
4457  Line = 12;
4458 
4459  CONSOLE_InvertTextXY(8, Line, 60, 1);
4460  }
4461  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4462  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
4463  {
4464  CONSOLE_NormalTextXY(8, Line, 60, 1);
4465 
4466  Line = 12;
4467 
4468  CONSOLE_InvertTextXY(8, Line, 60, 1);
4469  }
4470  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4471  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
4472  {
4473  CONSOLE_NormalTextXY(8, Line, 60, 1);
4474 
4475  Line = 15;
4476 
4477  CONSOLE_InvertTextXY(8, Line, 60, 1);
4478  }
4479  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4480  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
4481  {
4482  if (ConfirmQuit(Ir))
4483  return QUIT_PAGE;
4484 
4485  break;
4486  }
4487  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4488  {
4489  if (Line == 12)
4490  {
4491  /* Install on both MBR and VBR */
4492  USetupData.MBRInstallType = 2;
4493  break;
4494  }
4495  else if (Line == 13)
4496  {
4497  /* Install on VBR only */
4498  USetupData.MBRInstallType = 3;
4499  break;
4500  }
4501  else if (Line == 14)
4502  {
4503  /* Install on floppy */
4504  USetupData.MBRInstallType = 1;
4505  break;
4506  }
4507  else if (Line == 15)
4508  {
4509  /* Skip MBR installation */
4510  USetupData.MBRInstallType = 0;
4511  break;
4512  }
4513 
4514  return BOOT_LOADER_PAGE;
4515  }
4516  }
4517 
4518 Quit:
4519  switch (USetupData.MBRInstallType)
4520  {
4521  /* Skip MBR installation */
4522  case 0:
4523  return SUCCESS_PAGE;
4524 
4525  /* Install on floppy */
4526  case 1:
4527  return BOOT_LOADER_FLOPPY_PAGE;
4528 
4529  /* Install on both MBR and VBR */
4530  case 2:
4532 
4533  /* Install on VBR only */
4534  case 3:
4536  }
4537 
4538  return BOOT_LOADER_PAGE;
4539 }
#define PARTITION_FAT32
Definition: disk.h:95
ULONG PartitionNumber
Definition: partlist.h:48
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define VK_DOWN
Definition: winuser.h:2202
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:289
WORD wVirtualKeyCode
Definition: wincon.h:242
#define PARTITION_XINT13
Definition: disk.h:97
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
#define VK_HOME
Definition: winuser.h:2198
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:267
#define VK_UP
Definition: winuser.h:2200
#define FALSE
Definition: types.h:117
#define PARTITION_HUGE
Definition: disk.h:92
unsigned char BOOLEAN
void DPRINT(...)
Definition: polytest.cpp:61
#define PARTITION_IFS
Definition: disk.h:93
UCHAR PartitionType
Definition: partlist.h:46
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define PARTITION_FAT_16
Definition: disk.h:90
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
static PPARTENTRY SystemPartition
Definition: usetup.c:61
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: ncftp.h:79
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
#define PARTITION_LINUX
Definition: partlist.c:36
#define DPRINT1
Definition: precomp.h:8
union _INPUT_RECORD::@3242 Event
CHAR PartitionType
Definition: part_xbox.c:32
#define PARTITION_FAT_12
Definition: disk.h:87
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define PARTITION_FAT32_XINT13
Definition: disk.h:96
#define VK_END
Definition: winuser.h:2197
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
BOOLEAN IsPartitioned
Definition: partlist.h:59
#define PARTITION_OS2BOOTMGR
Definition: disk.h:94

Referenced by RunUSetup().

◆ CheckFileSystemPage()

static PAGE_NUMBER CheckFileSystemPage ( PINPUT_RECORD  Ir)
static

Definition at line 3598 of file usetup.c.

3599 {
3600  NTSTATUS Status;
3601  PDISKENTRY DiskEntry;
3602  PPARTENTRY PartEntry;
3603  UNICODE_STRING PartitionRootPath;
3604  WCHAR PathBuffer[MAX_PATH];
3605  CHAR Buffer[MAX_PATH];
3606 
3607  if (PartitionList == NULL)
3608  {
3609  /* FIXME: show an error dialog */
3610  return QUIT_PAGE;
3611  }
3612 
3613  if (!GetNextUncheckedPartition(PartitionList, &DiskEntry, &PartEntry))
3614  {
3615  return INSTALL_DIRECTORY_PAGE;
3616  }
3617 
3618  ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
3619 
3621 
3623 
3624  DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
3625  PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a"));
3626 
3627  /* HACK: Do not try to check a partition with an unknown filesystem */
3628  if (!*PartEntry->FileSystem)
3629  {
3630  PartEntry->NeedsCheck = FALSE;
3631  return CHECK_FILE_SYSTEM_PAGE;
3632  }
3633 
3634  /* Set PartitionRootPath */
3635  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3636  L"\\Device\\Harddisk%lu\\Partition%lu",
3637  DiskEntry->DiskNumber,
3638  PartEntry->PartitionNumber);
3639  RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
3640  DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
3641 
3642  /* Check the partition */
3643  Status = ChkdskPartition(&PartitionRootPath, PartEntry->FileSystem);
3645  {
3646  /*
3647  * Partition checking is not supported with the current filesystem,
3648  * so disable FS checks on it.
3649  */
3650  PartEntry->NeedsCheck = FALSE;
3651 
3653  sizeof(Buffer),
3654  "Setup is currently unable to check a partition formatted in %S.\n"
3655  "\n"
3656  " \x07 Press ENTER to continue Setup.\n"
3657  " \x07 Press F3 to quit Setup.",
3658  PartEntry->FileSystem);
3659 
3663 
3664  while (TRUE)
3665  {
3666  CONSOLE_ConInKey(Ir);
3667 
3668  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
3669  Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
3670  {
3671  if (ConfirmQuit(Ir))
3672  return QUIT_PAGE;
3673  else
3674  return CHECK_FILE_SYSTEM_PAGE;
3675  }
3676  else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
3677  {
3678  return CHECK_FILE_SYSTEM_PAGE;
3679  }
3680  }
3681  }
3682  else if (!NT_SUCCESS(Status))
3683  {
3684  DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status);
3685  sprintf(Buffer, "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n", Status);
3688  Ir, POPUP_WAIT_ENTER);
3689  }
3690 
3691  PartEntry->NeedsCheck = FALSE;
3692  return CHECK_FILE_SYSTEM_PAGE;
3693 }
ULONG PartitionNumber
Definition: partlist.h:48
#define POPUP_WAIT_NONE
Definition: usetup.h:124
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:311
#define TRUE
Definition: types.h:120
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
VOID PopupError(PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
Definition: usetup.c:256
ULONG DiskNumber
Definition: partlist.h:104
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define VK_RETURN
Definition: winuser.h:2176
WORD wVirtualKeyCode
Definition: wincon.h:242
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS ChkdskPartition(IN PUNICODE_STRING DriveRoot, IN PCWSTR FileSystemName)
Definition: chkdsk.c:57
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN GetNextUncheckedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:4263
Definition: bufpool.h:45
#define STRING_CHECKINGPART
Definition: mui.h:127
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
UCHAR PartitionType
Definition: partlist.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:53
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
#define STRING_CONTINUE
Definition: mui.h:128
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
BOOLEAN NeedsCheck
Definition: partlist.h:70
#define DPRINT1
Definition: precomp.h:8
union _INPUT_RECORD::@3242 Event
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STRING_PLEASEWAIT
Definition: mui.h:111
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
#define STRING_QUITCONTINUE
Definition: mui.h:129
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by RunUSetup().

◆ ComputerSettingsPage()

static PAGE_NUMBER ComputerSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1384 of file usetup.c.

1385 {
1386  GENERIC_LIST_UI ListUi;
1388 
1389  InitGenericListUi(&ListUi, USetupData.ComputerList, GetSettingDescription);
1390  DrawGenericList(&ListUi,
1391  2, 18,
1392  xScreen - 3,
1393  yScreen - 3);
1394 
1395  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1396 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1318
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ ConfirmDeleteSystemPartitionPage()

static PAGE_NUMBER ConfirmDeleteSystemPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2542 of file usetup.c.

2543 {
2545 
2546  while (TRUE)
2547  {
2548  CONSOLE_ConInKey(Ir);
2549 
2550  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2551  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2552  {
2553  if (ConfirmQuit(Ir))
2554  return QUIT_PAGE;
2555 
2556  break;
2557  }
2558  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2559  {
2560  return DELETE_PARTITION_PAGE;
2561  }
2562  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2563  {
2564  return SELECT_PARTITION_PAGE;
2565  }
2566  }
2567 
2569 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_RETURN
Definition: winuser.h:2176
WORD wVirtualKeyCode
Definition: wincon.h:242
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
union _INPUT_RECORD::@3242 Event
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by RunUSetup().

◆ ConfirmQuit()

static BOOL ConfirmQuit ( PINPUT_RECORD  Ir)
static

Definition at line 429 of file usetup.c.

430 {
431  BOOL Result = FALSE;
433 
434  while (TRUE)
435  {
436  CONSOLE_ConInKey(Ir);
437 
438  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
439  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
440  {
441  Result = TRUE;
442  break;
443  }
444  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
445  {
446  Result = FALSE;
447  break;
448  }
449  }
450 
451  return Result;
452 }
#define POPUP_WAIT_NONE
Definition: usetup.h:124
#define TRUE
Definition: types.h:120
WORD wVirtualKeyCode
Definition: wincon.h:242
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
union _INPUT_RECORD::@3242 Event
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by BootLoaderFloppyPage(), BootLoaderPage(), CheckFileSystemPage(), ConfirmDeleteSystemPartitionPage(), CreateExtendedPartitionPage(), CreateLogicalPartitionPage(), CreatePrimaryPartitionPage(), DeletePartitionPage(), DeviceSettingsPage(), FormatPartitionPage(), HandleGenericList(), InstallDirectoryPage(), InstallIntroPage(), LanguagePage(), SelectFileSystemPage(), SelectPartitionPage(), UpgradeRepairPage(), and WelcomePage().

◆ CreateExtendedPartitionPage()

static PAGE_NUMBER CreateExtendedPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2219 of file usetup.c.

2220 {
2221  PPARTENTRY PartEntry;
2222  PDISKENTRY DiskEntry;
2223  BOOLEAN Quit;
2224  BOOLEAN Cancel;
2225  WCHAR InputBuffer[50];
2226  ULONG MaxSize;
2227  ULONGLONG PartSize;
2228  ULONGLONG DiskSize;
2230  PCHAR Unit;
2231 
2232  if (PartitionList == NULL || CurrentPartition == NULL)
2233  {
2234  /* FIXME: show an error dialog */
2235  return QUIT_PAGE;
2236  }
2237 
2238  PartEntry = CurrentPartition;
2239  DiskEntry = CurrentPartition->DiskEntry;
2240 
2242 
2244 
2245  DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
2246 #if 0
2247  if (DiskSize >= 10 * GB) /* 10 GB */
2248  {
2249  DiskSize = DiskSize / GB;
2251  }
2252  else
2253 #endif
2254  {
2255  DiskSize = DiskSize / MB;
2256  if (DiskSize == 0)
2257  DiskSize = 1;
2258 
2260  }
2261 
2262  if (DiskEntry->DriverName.Length > 0)
2263  {
2264  CONSOLE_PrintTextXY(6, 10,
2266  DiskSize,
2267  Unit,
2268  DiskEntry->DiskNumber,
2269  DiskEntry->Port,
2270  DiskEntry->Bus,
2271  DiskEntry->Id,
2272  &DiskEntry->DriverName,
2273  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2274  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2275  "RAW");
2276  }
2277  else
2278  {
2279  CONSOLE_PrintTextXY(6, 10,
2281  DiskSize,
2282  Unit,
2283  DiskEntry->DiskNumber,
2284  DiskEntry->Port,
2285  DiskEntry->Bus,
2286  DiskEntry->Id,
2287  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2288  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2289  "RAW");
2290  }
2291 
2293 
2294 #if 0
2295  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2296  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2297 #endif
2298 
2300 
2301  PartEntry = CurrentPartition;
2302  while (TRUE)
2303  {
2304  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2305 
2306  if (MaxSize > PARTITION_MAXSIZE)
2307  MaxSize = PARTITION_MAXSIZE;
2308 
2309  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2310  MaxSize, InputBuffer, &Quit, &Cancel);
2311 
2312  if (Quit)
2313  {
2314  if (ConfirmQuit(Ir))
2315  return QUIT_PAGE;
2316 
2317  break;
2318  }
2319  else if (Cancel)
2320  {
2321  return SELECT_PARTITION_PAGE;
2322  }
2323  else
2324  {
2325  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2326 
2327  if (PartSize < 1)
2328  {
2329  /* Too small */
2330  continue;
2331  }
2332 
2333  if (PartSize > MaxSize)
2334  {
2335  /* Too large */
2336  continue;
2337  }
2338 
2339  /* Convert to bytes */
2340  if (PartSize == MaxSize)
2341  {
2342  /* Use all of the unpartitioned disk space */
2343  SectorCount = PartEntry->SectorCount.QuadPart;
2344  }
2345  else
2346  {
2347  /* Calculate the sector count from the size in MB */
2348  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2349 
2350  /* But never get larger than the unpartitioned disk space */
2351  if (SectorCount > PartEntry->SectorCount.QuadPart)
2352  SectorCount = PartEntry->SectorCount.QuadPart;
2353  }
2354 
2355  DPRINT ("Partition size: %I64u bytes\n", PartSize);
2356 
2359  SectorCount);
2360 
2361  return SELECT_PARTITION_PAGE;
2362  }
2363  }
2364 
2366 }
signed char * PCHAR
Definition: retypes.h:7
#define STRING_HDDSIZE
Definition: mui.h:120
USHORT Id
Definition: partlist.h:108
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:311
#define STRING_CREATEPARTITION
Definition: mui.h:121
Unit
Definition: gdiplusenums.h:25
#define TRUE
Definition: types.h:120
USHORT Bus
Definition: partlist.h:107
ULARGE_INTEGER SectorCount
Definition: partlist.h:43
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:592
ULONG DiskNumber
Definition: partlist.h:104
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
_Check_return_ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define STRING_GB
Definition: mui.h:172
#define MB
Definition: setuplib.h:55
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1863
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define STRING_MB
Definition: mui.h:171
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
ULARGE_INTEGER SectorCount
Definition: partlist.h:90
void Cancel(int sigNum)
Definition: shell.c:481
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
ULONG BytesPerSector
Definition: partlist.h:88
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_HDINFOPARTCREATE_2
Definition: mui.h:153
UNICODE_STRING DriverName
Definition: partlist.h:116
uint64_t ULONGLONG
Definition: typedefs.h:67
CHAR InputBuffer[80]
Definition: conmgr.c:33
static PPARTLIST PartitionList
Definition: usetup.c:73
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
ULONG SectorCount
Definition: part_xbox.c:31
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
#define STRING_HDINFOPARTCREATE_1
Definition: mui.h:152
USHORT Port
Definition: partlist.h:106
#define PARTITION_MAXSIZE
Definition: usetup.c:1860
BOOLEAN CreateExtendedPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount)
Definition: partlist.c:3024
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define GB
Definition: setuplib.h:56
#define STRING_CHOOSE_NEW_EXTENDED_PARTITION
Definition: mui.h:118

Referenced by RunUSetup().

◆ CreateLogicalPartitionPage()

static PAGE_NUMBER CreateLogicalPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2380 of file usetup.c.

2381 {
2382  PPARTENTRY PartEntry;
2383  PDISKENTRY DiskEntry;
2384  BOOLEAN Quit;
2385  BOOLEAN Cancel;
2386  WCHAR InputBuffer[50];
2387  ULONG MaxSize;
2388  ULONGLONG PartSize;
2389  ULONGLONG DiskSize;
2391  PCHAR Unit;
2392 
2393  if (PartitionList == NULL || CurrentPartition == NULL)
2394  {
2395  /* FIXME: show an error dialog */
2396  return QUIT_PAGE;
2397  }
2398 
2399  PartEntry = CurrentPartition;
2400  DiskEntry = CurrentPartition->DiskEntry;
2401 
2403 
2405 
2406  DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
2407 #if 0
2408  if (DiskSize >= 10 * GB) /* 10 GB */
2409  {
2410  DiskSize = DiskSize / GB;
2412  }
2413  else
2414 #endif
2415  {
2416  DiskSize = DiskSize / MB;
2417  if (DiskSize == 0)
2418  DiskSize = 1;
2419 
2421  }
2422 
2423  if (DiskEntry->DriverName.Length > 0)
2424  {
2425  CONSOLE_PrintTextXY(6, 10,
2427  DiskSize,
2428  Unit,
2429  DiskEntry->DiskNumber,
2430  DiskEntry->Port,
2431  DiskEntry->Bus,
2432  DiskEntry->Id,
2433  &DiskEntry->DriverName,
2434  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2435  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2436  "RAW");
2437  }
2438  else
2439  {
2440  CONSOLE_PrintTextXY(6, 10,
2442  DiskSize,
2443  Unit,
2444  DiskEntry->DiskNumber,
2445  DiskEntry->Port,
2446  DiskEntry->Bus,
2447  DiskEntry->Id,
2448  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2449  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2450  "RAW");
2451  }
2452 
2454 
2455 #if 0
2456  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2457  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2458 #endif
2459 
2461 
2462  PartEntry = CurrentPartition;
2463  while (TRUE)
2464  {
2465  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2466 
2467  if (MaxSize > PARTITION_MAXSIZE)
2468  MaxSize = PARTITION_MAXSIZE;
2469 
2470  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2471  MaxSize, InputBuffer, &Quit, &Cancel);
2472 
2473  if (Quit)
2474  {
2475  if (ConfirmQuit(Ir))
2476  return QUIT_PAGE;
2477 
2478  break;
2479  }
2480  else if (Cancel)
2481  {
2482  return SELECT_PARTITION_PAGE;
2483  }
2484  else
2485  {
2486  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2487 
2488  if (PartSize < 1)
2489  {
2490  /* Too small */
2491  continue;
2492  }
2493 
2494  if (PartSize > MaxSize)
2495  {
2496  /* Too large */
2497  continue;
2498  }
2499 
2500  /* Convert to bytes */
2501  if (PartSize == MaxSize)
2502  {
2503  /* Use all of the unpartitioned disk space */
2504  SectorCount = PartEntry->SectorCount.QuadPart;
2505  }
2506  else
2507  {
2508  /* Calculate the sector count from the size in MB */
2509  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2510 
2511  /* But never get larger than the unpartitioned disk space */
2512  if (SectorCount > PartEntry->SectorCount.QuadPart)
2513  SectorCount = PartEntry->SectorCount.QuadPart;
2514  }
2515 
2516  DPRINT("Partition size: %I64u bytes\n", PartSize);
2517 
2520  SectorCount,
2521  FALSE);
2522 
2523  return SELECT_PARTITION_PAGE;
2524  }
2525  }
2526 
2528 }
signed char * PCHAR
Definition: retypes.h:7
#define STRING_HDDSIZE
Definition: mui.h:120
USHORT Id
Definition: partlist.h:108
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:311
#define STRING_CREATEPARTITION
Definition: mui.h:121
Unit
Definition: gdiplusenums.h:25
#define STRING_CHOOSE_NEW_LOGICAL_PARTITION
Definition: mui.h:119
#define TRUE
Definition: types.h:120
USHORT Bus
Definition: partlist.h:107
ULARGE_INTEGER SectorCount
Definition: partlist.h:43
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:592
ULONG DiskNumber
Definition: partlist.h:104
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
_Check_return_ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define STRING_GB
Definition: mui.h:172
#define MB
Definition: setuplib.h:55
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1863
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
#define STRING_MB
Definition: mui.h:171
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN CreateLogicalPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:3078
ULARGE_INTEGER SectorCount
Definition: partlist.h:90
void Cancel(int sigNum)
Definition: shell.c:481
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
ULONG BytesPerSector
Definition: partlist.h:88
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_HDINFOPARTCREATE_2
Definition: mui.h:153
UNICODE_STRING DriverName
Definition: partlist.h:116
uint64_t ULONGLONG
Definition: typedefs.h:67
CHAR InputBuffer[80]
Definition: conmgr.c:33
static PPARTLIST PartitionList
Definition: usetup.c:73
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
ULONG SectorCount
Definition: part_xbox.c:31
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
#define STRING_HDINFOPARTCREATE_1
Definition: mui.h:152
USHORT Port
Definition: partlist.h:106
#define PARTITION_MAXSIZE
Definition: usetup.c:1860
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define GB
Definition: setuplib.h:56

Referenced by RunUSetup().

◆ CreatePrimaryPartitionPage()

static PAGE_NUMBER CreatePrimaryPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2057 of file usetup.c.

2058 {
2059  PPARTENTRY PartEntry;
2060  PDISKENTRY DiskEntry;
2061  BOOLEAN Quit;
2062  BOOLEAN Cancel;
2063  WCHAR InputBuffer[50];
2064  ULONG MaxSize;
2065  ULONGLONG PartSize;
2066  ULONGLONG DiskSize;
2068  PCHAR Unit;
2069 
2070  if (PartitionList == NULL || CurrentPartition == NULL)
2071  {
2072  /* FIXME: show an error dialog */
2073  return QUIT_PAGE;
2074  }
2075 
2076  PartEntry = CurrentPartition;
2077  DiskEntry = CurrentPartition->DiskEntry;
2078 
2080 
2082 
2083  DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
2084 #if 0
2085  if (DiskSize >= 10 * GB) /* 10 GB */
2086  {
2087  DiskSize = DiskSize / GB;
2089  }
2090  else
2091 #endif
2092  {
2093  DiskSize = DiskSize / MB;
2094  if (DiskSize == 0)
2095  DiskSize = 1;
2096 
2098  }
2099 
2100  if (DiskEntry->DriverName.Length > 0)
2101  {
2102  CONSOLE_PrintTextXY(6, 10,
2104  DiskSize,
2105  Unit,
2106  DiskEntry->DiskNumber,
2107  DiskEntry->Port,
2108  DiskEntry->Bus,
2109  DiskEntry->Id,
2110  &DiskEntry->DriverName,
2111  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2112  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2113  "RAW");
2114  }
2115  else
2116  {
2117  CONSOLE_PrintTextXY(6, 10,
2119  DiskSize,
2120  Unit,
2121  DiskEntry->DiskNumber,
2122  DiskEntry->Port,
2123  DiskEntry->Bus,
2124  DiskEntry->Id,
2125  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2126  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2127  "RAW");
2128  }
2129 
2131 
2132 #if 0
2133  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2134  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2135 #endif
2136 
2138 
2139  PartEntry = CurrentPartition;
2140  while (TRUE)
2141  {
2142  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2143 
2144  if (MaxSize > PARTITION_MAXSIZE)
2145  MaxSize = PARTITION_MAXSIZE;
2146 
2147  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2148  MaxSize, InputBuffer, &Quit, &Cancel);
2149 
2150  if (Quit)
2151  {
2152  if (ConfirmQuit(Ir))
2153  return QUIT_PAGE;
2154 
2155  break;
2156  }
2157  else if (Cancel)
2158  {
2159  return SELECT_PARTITION_PAGE;
2160  }
2161  else
2162  {
2163  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2164 
2165  if (PartSize < 1)
2166  {
2167  /* Too small */
2168  continue;
2169  }
2170 
2171  if (PartSize > MaxSize)
2172  {
2173  /* Too large */
2174  continue;
2175  }
2176 
2177  /* Convert to bytes */
2178  if (PartSize == MaxSize)
2179  {
2180  /* Use all of the unpartitioned disk space */
2181  SectorCount = PartEntry->SectorCount.QuadPart;
2182  }
2183  else
2184  {
2185  /* Calculate the sector count from the size in MB */
2186  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2187 
2188  /* But never get larger than the unpartitioned disk space */
2189  if (SectorCount > PartEntry->SectorCount.QuadPart)
2190  SectorCount = PartEntry->SectorCount.QuadPart;
2191  }
2192 
2193  DPRINT ("Partition size: %I64u bytes\n", PartSize);
2194 
2197  SectorCount,
2198  FALSE);
2199 
2200  return SELECT_PARTITION_PAGE;
2201  }
2202  }
2203 
2205 }
signed char * PCHAR
Definition: retypes.h:7
#define STRING_HDDSIZE
Definition: mui.h:120
USHORT Id
Definition: partlist.h:108
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:311
#define STRING_CREATEPARTITION
Definition: mui.h:121
Unit
Definition: gdiplusenums.h:25
#define TRUE
Definition: types.h:120
USHORT Bus
Definition: partlist.h:107
ULARGE_INTEGER SectorCount
Definition: partlist.h:43
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:592
ULONG DiskNumber
Definition: partlist.h:104
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
#define STRING_CHOOSENEWPARTITION
Definition: mui.h:117
_Check_return_ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define STRING_GB
Definition: mui.h:172
#define MB
Definition: setuplib.h:55
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1863
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
#define STRING_MB
Definition: mui.h:171
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
ULARGE_INTEGER SectorCount
Definition: partlist.h:90
void Cancel(int sigNum)
Definition: shell.c:481
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
ULONG BytesPerSector
Definition: partlist.h:88
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_HDINFOPARTCREATE_2
Definition: mui.h:153
UNICODE_STRING DriverName
Definition: partlist.h:116
uint64_t ULONGLONG
Definition: typedefs.h:67
CHAR InputBuffer[80]
Definition: conmgr.c:33
static PPARTLIST PartitionList
Definition: usetup.c:73
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
ULONG SectorCount
Definition: part_xbox.c:31
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
BOOLEAN CreatePrimaryPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:2960
#define STRING_HDINFOPARTCREATE_1
Definition: mui.h:152
USHORT Port
Definition: partlist.h:106
#define PARTITION_MAXSIZE
Definition: usetup.c:1860
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define GB
Definition: setuplib.h:56

Referenced by RunUSetup().

◆ DeletePartitionPage()

static PAGE_NUMBER DeletePartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2583 of file usetup.c.

2584 {
2585  PPARTENTRY PartEntry;
2586  PDISKENTRY DiskEntry;
2587  ULONGLONG DiskSize;
2588  ULONGLONG PartSize;
2589  PCHAR Unit;
2590  CHAR PartTypeString[32];
2591 
2592  if (PartitionList == NULL || CurrentPartition == NULL)
2593  {
2594  /* FIXME: show an error dialog */
2595  return QUIT_PAGE;
2596  }
2597 
2598  PartEntry = CurrentPartition;
2599  DiskEntry = CurrentPartition->DiskEntry;
2600 
2602 
2603  /* Adjust partition type */
2605  PartTypeString,
2606  ARRAYSIZE(PartTypeString));
2607 
2608  PartSize = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
2609 #if 0
2610  if (PartSize >= 10 * GB) /* 10 GB */
2611  {
2612  PartSize = PartSize / GB;
2614  }
2615  else
2616 #endif
2617  if (PartSize >= 10 * MB) /* 10 MB */
2618  {
2619  PartSize = PartSize / MB;
2621  }
2622  else
2623  {
2624  PartSize = PartSize / KB;
2626  }
2627 
2628  if (*PartTypeString == '\0') // STRING_FORMATUNKNOWN ??
2629  {
2630  CONSOLE_PrintTextXY(6, 10,
2632  (PartEntry->DriveLetter == 0) ? '-' : (CHAR)PartEntry->DriveLetter,
2633  (PartEntry->DriveLetter == 0) ? '-' : ':',
2634  PartEntry->PartitionType,
2635  PartSize,
2636  Unit);
2637  }
2638  else
2639  {
2640  CONSOLE_PrintTextXY(6, 10,
2641  " %c%c %s %I64u %s",
2642  (PartEntry->DriveLetter == 0) ? '-' : (CHAR)PartEntry->DriveLetter,
2643  (PartEntry->DriveLetter == 0) ? '-' : ':',
2644  PartTypeString,
2645  PartSize,
2646  Unit);
2647  }
2648 
2649  DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
2650 #if 0
2651  if (DiskSize >= 10 * GB) /* 10 GB */
2652  {
2653  DiskSize = DiskSize / GB;
2655  }
2656  else
2657 #endif
2658  {
2659  DiskSize = DiskSize / MB;
2660  if (DiskSize == 0)
2661  DiskSize = 1;
2662 
2664  }
2665 
2666  if (DiskEntry->DriverName.Length > 0)
2667  {
2668  CONSOLE_PrintTextXY(6, 12,
2670  DiskSize,
2671  Unit,
2672  DiskEntry->DiskNumber,
2673  DiskEntry->Port,
2674  DiskEntry->Bus,
2675  DiskEntry->Id,
2676  &DiskEntry->DriverName,
2677  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2678  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2679  "RAW");
2680  }
2681  else
2682  {
2683  CONSOLE_PrintTextXY(6, 12,
2685  DiskSize,
2686  Unit,
2687  DiskEntry->DiskNumber,
2688  DiskEntry->Port,
2689  DiskEntry->Bus,
2690  DiskEntry->Id,
2691  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
2692  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
2693  "RAW");
2694  }
2695 
2696  while (TRUE)
2697  {
2698  CONSOLE_ConInKey(Ir);
2699 
2700  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2701  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2702  {
2703  if (ConfirmQuit(Ir))
2704  return QUIT_PAGE;
2705 
2706  break;
2707  }
2708  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2709  {
2710  return SELECT_PARTITION_PAGE;
2711  }
2712  else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
2713  {
2716  &CurrentPartition);
2717  return SELECT_PARTITION_PAGE;
2718  }
2719  }
2720 
2721  return DELETE_PARTITION_PAGE;
2722 }
signed char * PCHAR
Definition: retypes.h:7
WCHAR DriveLetter
Definition: partlist.h:51
USHORT Id
Definition: partlist.h:108
Unit
Definition: gdiplusenums.h:25
BOOLEAN DeletePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, OUT PPARTENTRY *FreeRegion OPTIONAL)
Definition: partlist.c:3221
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
USHORT Bus
Definition: partlist.h:107
ULARGE_INTEGER SectorCount
Definition: partlist.h:43
char CHAR
Definition: xmlstorage.h:175
#define STRING_HDINFOPARTDELETE_2
Definition: mui.h:156
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:592
#define STRING_KB
Definition: mui.h:170
ULONG DiskNumber
Definition: partlist.h:104
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
#define VK_ESCAPE
Definition: winuser.h:2189
WORD wVirtualKeyCode
Definition: wincon.h:242
#define STRING_GB
Definition: mui.h:172
#define MB
Definition: setuplib.h:55
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define STRING_HDINFOPARTDELETE_1
Definition: mui.h:155
#define STRING_MB
Definition: mui.h:171
smooth NULL
Definition: ftsmooth.c:416
ULARGE_INTEGER SectorCount
Definition: partlist.h:90
#define STRING_HDDINFOUNK2
Definition: mui.h:154
UCHAR PartitionType
Definition: partlist.h:46
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
ULONG BytesPerSector
Definition: partlist.h:88
UNICODE_STRING DriverName
Definition: partlist.h:116
uint64_t ULONGLONG
Definition: typedefs.h:67
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
USHORT Port
Definition: partlist.h:106
VOID GetPartTypeStringFromPartitionType(IN UCHAR partitionType, OUT PCHAR strPartType, IN ULONG cchPartType)
Definition: drivepage.c:237
union _INPUT_RECORD::@3242 Event
#define GB
Definition: setuplib.h:56
#define KB
Definition: setuplib.h:54
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by RunUSetup().

◆ DeviceSettingsPage()

static PAGE_NUMBER DeviceSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1186 of file usetup.c.

1187 {
1188  static ULONG Line = 16;
1189 
1190  /* Initialize the computer settings list */
1191  if (USetupData.ComputerList == NULL)
1192  {
1193  USetupData.ComputerList = CreateComputerTypeList(USetupData.SetupInf);
1194  if (USetupData.ComputerList == NULL)
1195  {
1197  return QUIT_PAGE;
1198  }
1199  }
1200 
1201  /* Initialize the display settings list */
1202  if (USetupData.DisplayList == NULL)
1203  {
1204  USetupData.DisplayList = CreateDisplayDriverList(USetupData.SetupInf);
1205  if (USetupData.DisplayList == NULL)
1206  {
1208  return QUIT_PAGE;
1209  }
1210  }
1211 
1212  /* Initialize the keyboard settings list */
1213  if (USetupData.KeyboardList == NULL)
1214  {
1215  USetupData.KeyboardList = CreateKeyboardDriverList(USetupData.SetupInf);
1216  if (USetupData.KeyboardList == NULL)
1217  {
1219  return QUIT_PAGE;
1220  }
1221  }
1222 
1223  /* Initialize the keyboard layout list */
1224  if (USetupData.LayoutList == NULL)
1225  {
1227  if (USetupData.LayoutList == NULL)
1228  {
1229  /* FIXME: report error */
1231  return QUIT_PAGE;
1232  }
1233  }
1234 
1235  if (RepairUpdateFlag)
1236  return SELECT_PARTITION_PAGE;
1237 
1238  // if (IsUnattendedSetup)
1239  // return SELECT_PARTITION_PAGE;
1240 
1242 
1247 
1248  CONSOLE_InvertTextXY(24, Line, 48, 1);
1249 
1250  while (TRUE)
1251  {
1252  CONSOLE_ConInKey(Ir);
1253 
1254  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1255  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1256  {
1257  CONSOLE_NormalTextXY(24, Line, 48, 1);
1258 
1259  if (Line == 14)
1260  Line = 16;
1261  else if (Line == 16)
1262  Line = 11;
1263  else
1264  Line++;
1265 
1266  CONSOLE_InvertTextXY(24, Line, 48, 1);
1267  }
1268  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1269  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1270  {
1271  CONSOLE_NormalTextXY(24, Line, 48, 1);
1272 
1273  if (Line == 11)
1274  Line = 16;
1275  else if (Line == 16)
1276  Line = 14;
1277  else
1278  Line--;
1279 
1280  CONSOLE_InvertTextXY(24, Line, 48, 1);
1281  }
1282  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1283  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1284  {
1285  if (ConfirmQuit(Ir))
1286  return QUIT_PAGE;
1287 
1288  break;
1289  }
1290  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1291  {
1292  if (Line == 11)
1293  return COMPUTER_SETTINGS_PAGE;
1294  else if (Line == 12)
1295  return DISPLAY_SETTINGS_PAGE;
1296  else if (Line == 13)
1297  return KEYBOARD_SETTINGS_PAGE;
1298  else if (Line == 14)
1299  return LAYOUT_SETTINGS_PAGE;
1300  else if (Line == 16)
1301  return SELECT_PARTITION_PAGE;
1302  }
1303  }
1304 
1305  return DEVICE_SETTINGS_PAGE;
1306 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define VK_DOWN
Definition: winuser.h:2202
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1210
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:289
WORD wVirtualKeyCode
Definition: wincon.h:242
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:267
#define VK_UP
Definition: winuser.h:2200
smooth NULL
Definition: ftsmooth.c:416
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:699
VOID DrawGenericListCurrentItem(IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc, IN SHORT Left, IN SHORT Top)
Definition: genlist.c:353
PCWSTR SelectedLanguageId
Definition: usetup.c:66
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
Definition: ncftp.h:79
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:515
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
union _INPUT_RECORD::@3242 Event
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
unsigned int ULONG
Definition: retypes.h:1
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1073
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:68
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ DisplaySettingsPage()

static PAGE_NUMBER DisplaySettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1410 of file usetup.c.

1411 {
1412  GENERIC_LIST_UI ListUi;
1414 
1415  InitGenericListUi(&ListUi, USetupData.DisplayList, GetSettingDescription);
1416  DrawGenericList(&ListUi,
1417  2, 18,
1418  xScreen - 3,
1419  yScreen - 3);
1420 
1421  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1422 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1318
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ DrawBox()

static VOID DrawBox ( IN SHORT  xLeft,
IN SHORT  yTop,
IN SHORT  Width,
IN SHORT  Height 
)
static

Definition at line 166 of file usetup.c.

170 {
171  COORD coPos;
172  DWORD Written;
173 
174  /* Draw upper left corner */
175  coPos.X = xLeft;
176  coPos.Y = yTop;
178  0xDA, // '+',
179  1,
180  coPos,
181  &Written);
182 
183  /* Draw upper edge */
184  coPos.X = xLeft + 1;
185  coPos.Y = yTop;
187  0xC4, // '-',
188  Width - 2,
189  coPos,
190  &Written);
191 
192  /* Draw upper right corner */
193  coPos.X = xLeft + Width - 1;
194  coPos.Y = yTop;
196  0xBF, // '+',
197  1,
198  coPos,
199  &Written);
200 
201  /* Draw right edge, inner space and left edge */
202  for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
203  {
204  coPos.X = xLeft;
206  0xB3, // '|',
207  1,
208  coPos,
209  &Written);
210 
211  coPos.X = xLeft + 1;
213  ' ',
214  Width - 2,
215  coPos,
216  &Written);
217 
218  coPos.X = xLeft + Width - 1;
220  0xB3, // '|',
221  1,
222  coPos,
223  &Written);
224  }
225 
226  /* Draw lower left corner */
227  coPos.X = xLeft;
228  coPos.Y = yTop + Height - 1;
230  0xC0, // '+',
231  1,
232  coPos,
233  &Written);
234 
235  /* Draw lower edge */
236  coPos.X = xLeft + 1;
237  coPos.Y = yTop + Height - 1;
239  0xC4, // '-',
240  Width - 2,
241  coPos,
242  &Written);
243 
244  /* Draw lower right corner */
245  coPos.X = xLeft + Width - 1;
246  coPos.Y = yTop + Height - 1;
248  0xD9, // '+',
249  1,
250  coPos,
251  &Written);
252 }
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:557
HANDLE StdOutput
Definition: consup.c:37
ULONG X
Definition: bl.h:1340
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: bl.h:1338
ULONG Y
Definition: bl.h:1341

Referenced by PopupError(), and ShowPartitionSizeInputBox().

◆ FileCopyCallback()

static UINT CALLBACK FileCopyCallback ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 4044 of file usetup.c.

4048 {
4049  PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
4050  PFILEPATHS_W FilePathInfo;
4051  PCWSTR SrcFileName, DstFileName;
4052 
4053  switch (Notification)
4054  {
4056  {
4057  CopyContext->TotalOperations = (ULONG)Param2;
4058  CopyContext->CompletedOperations = 0;
4059  ProgressSetStepCount(CopyContext->ProgressBar,
4060  CopyContext->TotalOperations);
4061  SetupUpdateMemoryInfo(CopyContext, TRUE);
4062  break;
4063  }
4064 
4068  {
4069  FilePathInfo = (PFILEPATHS_W)Param1;
4070 
4071  if (Notification == SPFILENOTIFY_STARTDELETE)
4072  {
4073  /* Display delete message */
4074  ASSERT(Param2 == FILEOP_DELETE);
4075 
4076  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
4077  if (DstFileName) ++DstFileName;
4078  else DstFileName = FilePathInfo->Target;
4079 
4081  DstFileName);
4082  }
4083  else if (Notification == SPFILENOTIFY_STARTRENAME)
4084  {
4085  /* Display move/rename message */
4086  ASSERT(Param2 == FILEOP_RENAME);
4087 
4088  SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
4089  if (SrcFileName) ++SrcFileName;
4090  else SrcFileName = FilePathInfo->Source;
4091 
4092  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
4093  if (DstFileName) ++DstFileName;
4094  else DstFileName = FilePathInfo->Target;
4095 
4096  if (!wcsicmp(SrcFileName, DstFileName))
4097  Param2 = STRING_MOVING;
4098  else
4099  Param2 = STRING_RENAMING;
4100 
4102  SrcFileName, DstFileName);
4103  }
4104  else if (Notification == SPFILENOTIFY_STARTCOPY)
4105  {
4106  /* Display copy message */
4107  ASSERT(Param2 == FILEOP_COPY);
4108 
4109  /* NOTE: When extracting from CABs the Source is the CAB name */
4110  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
4111  if (DstFileName) ++DstFileName;
4112  else DstFileName = FilePathInfo->Target;
4113 
4115  DstFileName);
4116 #ifdef __REACTOS__ /* HACK */
4117  DoWatchDestFileName(DstFileName);
4118 #endif
4119  }
4120 
4121  SetupUpdateMemoryInfo(CopyContext, FALSE);
4122  break;
4123  }
4124 
4126  {
4127  FilePathInfo = (PFILEPATHS_W)Param1;
4128 
4129  DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
4130  FilePathInfo->Target, FilePathInfo->Win32Error);
4131  return FILEOP_SKIP;
4132  }
4133 
4136  case SPFILENOTIFY_ENDCOPY:
4137  {
4138  CopyContext->CompletedOperations++;
4139 
4140  /* SYSREG checkpoint */
4141  if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
4142  DPRINT1("CHECKPOINT:HALF_COPIED\n");
4143 
4144  ProgressNextStep(CopyContext->ProgressBar);
4145  SetupUpdateMemoryInfo(CopyContext, FALSE);
4146  break;
4147  }
4148  }
4149 
4150  return FILEOP_DOIT;
4151 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FILEOP_RENAME
Definition: fileqsup.h:43
#define TRUE
Definition: types.h:120
ULONG TotalOperations
Definition: reactos.c:980
#define SPFILENOTIFY_ENDCOPY
Definition: fileqsup.h:36
UINT Win32Error
Definition: fileqsup.h:62
VOID ProgressNextStep(IN PPROGRESSBAR Bar)
Definition: progress.c:361
#define SPFILENOTIFY_STARTRENAME
Definition: fileqsup.h:31
#define SPFILENOTIFY_ENDRENAME
Definition: fileqsup.h:32
#define STRING_COPYING
Definition: mui.h:134
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define FALSE
Definition: types.h:117
VOID ProgressSetStepCount(IN PPROGRESSBAR Bar, IN ULONG StepCount)
Definition: progress.c:347
#define FILEOP_COPY
Definition: fileqsup.h:42
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define STRING_RENAMING
Definition: mui.h:133
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define SPFILENOTIFY_COPYERROR
Definition: fileqsup.h:37
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STRING_MOVING
Definition: mui.h:132
#define wcsicmp
Definition: compat.h:15
ULONG CompletedOperations
Definition: reactos.c:981
static const WCHAR L[]
Definition: oid.c:1250
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
#define wcsrchr
Definition: compat.h:16
PCWSTR Source
Definition: fileqsup.h:61
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
static VOID SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, IN BOOLEAN First)
Definition: usetup.c:4016
#define FILEOP_SKIP
Definition: fileqsup.h:49
PCWSTR Target
Definition: fileqsup.h:60
#define DPRINT1
Definition: precomp.h:8
struct _COPYCONTEXT * PCOPYCONTEXT
unsigned int ULONG
Definition: retypes.h:1
struct _FILEPATHS_W * PFILEPATHS_W
#define STRING_DELETING
Definition: mui.h:131
PPROGRESSBAR ProgressBar
Definition: usetup.c:4011
#define FILEOP_DELETE
Definition: fileqsup.h:44

Referenced by FileCopyPage().

◆ FileCopyPage()

static PAGE_NUMBER FileCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 4167 of file usetup.c.

4168 {
4169  COPYCONTEXT CopyContext;
4170  UINT MemBarWidth;
4171 
4173 
4174  /* Create context for the copy process */
4175  CopyContext.TotalOperations = 0;
4176  CopyContext.CompletedOperations = 0;
4177 
4178  /* Create the progress bar as well */
4179  CopyContext.ProgressBar = CreateProgressBar(13,
4180  26,
4181  xScreen - 13,
4182  yScreen - 20,
4183  10,
4184  24,
4185  TRUE,
4187 
4188  // fit memory bars to screen width, distribute them uniform
4189  MemBarWidth = (xScreen - 26) / 5;
4190  MemBarWidth -= MemBarWidth % 2; // make even
4191  /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
4192  /* Create the paged pool progress bar */
4193  CopyContext.MemoryBars[0] = CreateProgressBar(13,
4194  40,
4195  13 + MemBarWidth,
4196  43,
4197  13,
4198  44,
4199  FALSE,
4200  "Kernel Pool");
4201 
4202  /* Create the non paged pool progress bar */
4203  CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (MemBarWidth / 2),
4204  40,
4205  (xScreen / 2) + (MemBarWidth / 2),
4206  43,
4207  (xScreen / 2)- (MemBarWidth / 2),
4208  44,
4209  FALSE,
4210  "Kernel Cache");
4211 
4212  /* Create the global memory progress bar */
4213  CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - MemBarWidth,
4214  40,
4215  xScreen - 13,
4216  43,
4217  xScreen - 13 - MemBarWidth,
4218  44,
4219  FALSE,
4220  "Free Memory");
4221 
4222  /* Do the file copying */
4223  DoFileCopy(&USetupData, FileCopyCallback, &CopyContext);
4224 
4225  /* If we get here, we're done, so cleanup the progress bar */
4226  DestroyProgressBar(CopyContext.ProgressBar);
4227  DestroyProgressBar(CopyContext.MemoryBars[0]);
4228  DestroyProgressBar(CopyContext.MemoryBars[1]);
4229  DestroyProgressBar(CopyContext.MemoryBars[2]);
4230 
4231  /* Create the $winnt$.inf file */
4233 
4234  /* Go display the next page */
4235  return REGISTRY_PAGE;
4236 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
ULONG TotalOperations
Definition: reactos.c:980
VOID DestroyProgressBar(IN OUT PPROGRESSBAR Bar)
Definition: progress.c:339
VOID InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:214
BOOLEAN DoFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
Definition: install.c:818
#define FALSE
Definition: types.h:117
PPROGRESSBAR MemoryBars[4]
Definition: usetup.c:4012
ULONG CompletedOperations
Definition: reactos.c:981
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: usetup.c:4044
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
SHORT yScreen
Definition: consup.c:40
PPROGRESSBAR CreateProgressBar(IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN PCSTR DescriptionText OPTIONAL)
Definition: progress.c:317
unsigned int UINT
Definition: ndis.h:50
PPROGRESSBAR ProgressBar
Definition: usetup.c:4011
#define STRING_SETUPCOPYINGFILES
Definition: mui.h:135

Referenced by RunUSetup().

◆ FlushPage()

static PAGE_NUMBER FlushPage ( PINPUT_RECORD  Ir)
static

Definition at line 4960 of file usetup.c.

4961 {
4963  return REBOOT_PAGE;
4964 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149

Referenced by RunUSetup().

◆ FormatPartitionPage()

static PAGE_NUMBER FormatPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 3391 of file usetup.c.

3392 {
3393  NTSTATUS Status;
3394  PPARTENTRY PartEntry;
3395  PDISKENTRY DiskEntry;
3396  PFILE_SYSTEM_ITEM SelectedFileSystem;
3397  UNICODE_STRING PartitionRootPath;
3398  WCHAR PathBuffer[MAX_PATH];
3399  CHAR Buffer[MAX_PATH];
3400 
3401 #ifndef NDEBUG
3402  ULONG Line;
3403  ULONG i;
3405 #endif
3406 
3407  DPRINT("FormatPartitionPage()\n");
3408 
3410 
3411  if (PartitionList == NULL || TempPartition == NULL)
3412  {
3413  /* FIXME: show an error dialog */
3414  return QUIT_PAGE;
3415  }
3416 
3417  PartEntry = TempPartition;
3418  DiskEntry = TempPartition->DiskEntry;
3419 
3420  ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
3421 
3422  SelectedFileSystem = FileSystemList->Selected;
3423  ASSERT(SelectedFileSystem && SelectedFileSystem->FileSystem);
3424 
3425  while (TRUE)
3426  {
3427  if (!IsUnattendedSetup)
3428  CONSOLE_ConInKey(Ir);
3429 
3430  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3431  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3432  {
3433  if (ConfirmQuit(Ir))
3434  {
3435  /* Reset the filesystem list */
3437  return QUIT_PAGE;
3438  }
3439 
3440  break;
3441  }
3442  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
3443  {
3444  /*
3445  * Remove the "Press ENTER to continue" message prompt when the ENTER
3446  * key is pressed as the user wants to begin the partition formatting.
3447  */
3450 
3451  if (!PreparePartitionForFormatting(PartEntry, SelectedFileSystem->FileSystem))
3452  {
3453  /* FIXME: show an error dialog */
3454 
3455  /* Reset the filesystem list */
3457 
3458  return QUIT_PAGE;
3459  }
3460 
3461 #ifndef NDEBUG
3462  CONSOLE_PrintTextXY(6, 12,
3463  "Cylinders: %I64u Tracks/Cyl: %lu Sectors/Trk: %lu Bytes/Sec: %lu %c",
3464  DiskEntry->Cylinders,
3465  DiskEntry->TracksPerCylinder,
3466  DiskEntry->SectorsPerTrack,
3467  DiskEntry->BytesPerSector,
3468  DiskEntry->Dirty ? '*' : ' ');
3469 
3470  Line = 13;
3471 
3472  for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++)
3473  {
3474  PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i];
3475 
3477  "%2u: %2lu %c %12I64u %12I64u %02x",
3478  i,
3479  PartitionInfo->PartitionNumber,
3480  PartitionInfo->BootIndicator ? 'A' : '-',
3481  PartitionInfo->StartingOffset.QuadPart / DiskEntry->BytesPerSector,
3482  PartitionInfo->PartitionLength.QuadPart / DiskEntry->BytesPerSector,
3483  PartitionInfo->PartitionType);
3484  Line++;
3485  }
3486 #endif
3487 
3488  /* Commit the partition changes to the disk */
3489  Status = WritePartitions(DiskEntry);
3490  if (!NT_SUCCESS(Status))
3491  {
3492  DPRINT1("WritePartitions(disk %lu) failed, Status 0x%08lx\n",
3493  DiskEntry->DiskNumber, Status);
3494 
3496 
3497  /* Reset the filesystem list */
3499 
3500  return QUIT_PAGE;
3501  }
3502 
3503  /* Set PartitionRootPath */
3504  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3505  L"\\Device\\Harddisk%lu\\Partition%lu",
3506  DiskEntry->DiskNumber,
3507  PartEntry->PartitionNumber);
3508  RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
3509  DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
3510 
3511  /* Format the partition */
3512  Status = FormatPartition(&PartitionRootPath,
3513  PartEntry->FileSystem,
3514  SelectedFileSystem->QuickFormat);
3516  {
3517  sprintf(Buffer,
3518  "Setup is currently unable to format a partition in %S.\n"
3519  "\n"
3520  " \x07 Press ENTER to continue Setup.\n"
3521  " \x07 Press F3 to quit Setup.",
3522  SelectedFileSystem->FileSystem /* PartEntry->FileSystem */);
3523 
3527 
3528  while (TRUE)
3529  {
3530  CONSOLE_ConInKey(Ir);
3531 
3532  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
3533  Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
3534  {
3535  if (ConfirmQuit(Ir))
3536  {
3537  /* Reset the filesystem list */
3539  return QUIT_PAGE;
3540  }
3541  else
3542  {
3543  return SELECT_FILE_SYSTEM_PAGE;
3544  }
3545  }
3546  else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
3547  {
3548  return SELECT_FILE_SYSTEM_PAGE;
3549  }
3550  }
3551  }
3552  else if (!NT_SUCCESS(Status))
3553  {
3554  DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status);
3556 
3557  /* Reset the filesystem list */
3559 
3560  return QUIT_PAGE;
3561  }
3562 
3563 //
3564 // TODO: Here, call a partlist.c function that update the actual FS name
3565 // and the label fields of the volume.
3566 //
3567  PartEntry->FormatState = Formatted;
3568  // PartEntry->FileSystem = FileSystem;
3569  PartEntry->New = FALSE;
3570 
3571 #ifndef NDEBUG
3572  CONSOLE_SetStatusText(" Done. Press any key ...");
3573  CONSOLE_ConInKey(Ir);
3574 #endif
3575 
3576  return SELECT_FILE_SYSTEM_PAGE;
3577  }
3578  }
3579 
3580  return FORMAT_PARTITION_PAGE;
3581 }
NTSTATUS FormatPartition(IN PUNICODE_STRING DriveRoot, IN PCWSTR FileSystemName, IN BOOLEAN QuickFormat)
Definition: format.c:89
ULONG PartitionNumber
Definition: partlist.h:48
#define TEXT_TYPE_REGULAR
Definition: consup.h:39
#define POPUP_WAIT_NONE
Definition: usetup.h:124
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2726
static PPARTENTRY TempPartition
Definition: usetup.c:82
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
char CHAR
Definition: xmlstorage.h:175
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:592
LONG NTSTATUS
Definition: precomp.h:26
PCWSTR FileSystem
Definition: fslist.h:34
VOID PopupError(PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
Definition: usetup.c:256
ULONG DiskNumber
Definition: partlist.h:104
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define TEXT_ID_FORMAT_PROMPT
Definition: mui.h:108
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:79
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:125
#define VK_RETURN
Definition: winuser.h:2176
WORD wVirtualKeyCode
Definition: wincon.h:242
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
FORMATSTATE FormatState
Definition: partlist.h:54
BOOLEAN Dirty
Definition: partlist.h:111
smooth NULL
Definition: ftsmooth.c:416
PARTITION_INFORMATION PartitionEntry[1]
Definition: ntdddisk.h:549
PFILE_SYSTEM_ITEM Selected
Definition: fslist.h:42
VOID MUIClearStyledText(IN ULONG Page, IN INT TextID, IN INT Flags)
Definition: mui.c:363
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
ULONG BytesPerSector
Definition: partlist.h:88
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:53
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: ncftp.h:79
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
ULONG SectorsPerTrack
Definition: partlist.h:87
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477
BOOLEAN QuickFormat
Definition: fslist.h:35
ULONGLONG Cylinders
Definition: partlist.h:85
BOOLEAN New
Definition: partlist.h:64
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
ULONG TracksPerCylinder
Definition: partlist.h:86
#define DPRINT1
Definition: precomp.h:8
union _INPUT_RECORD::@3242 Event
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
Definition: partlist.c:3793
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STRING_PLEASEWAIT
Definition: mui.h:111
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118
BOOLEAN PreparePartitionForFormatting(IN struct _PARTENTRY *PartEntry, IN PCWSTR FileSystemName)
Definition: fsutil.c:620
struct Line Line
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
#define STRING_QUITCONTINUE
Definition: mui.h:129
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by RunUSetup().

◆ GetNTOSInstallationName()

static NTSTATUS NTAPI GetNTOSInstallationName ( IN PGENERIC_LIST_ENTRY  Entry,
OUT PSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 502 of file usetup.c.

506 {
508  PPARTENTRY PartEntry = NtOsInstall->PartEntry;
509 
510  if (PartEntry && PartEntry->DriveLetter)
511  {
512  /* We have retrieved a partition that is mounted */
514  "%C:%S \"%S\"",
515  PartEntry->DriveLetter,
516  NtOsInstall->PathComponent,
517  NtOsInstall->InstallationName);
518  }
519  else
520  {
521  /* We failed somewhere, just show the NT path */
523  "%wZ \"%S\"",
524  &NtOsInstall->SystemNtPath,
525  NtOsInstall->InstallationName);
526  }
527 }
WCHAR DriveLetter
Definition: partlist.h:51
IN BOOLEAN OUT PSTR IN SIZE_T cchBufferSize
Definition: progress.h:34
PPARTENTRY PartEntry
Definition: osdetect.h:25
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1085
Definition: bufpool.h:45
WCHAR InstallationName[MAX_PATH]
Definition: osdetect.h:26
struct _NTOS_INSTALLATION * PNTOS_INSTALLATION
PCWSTR PathComponent
Definition: osdetect.h:22
base of all file and directory entries
Definition: entries.h:82
UNICODE_STRING SystemNtPath
Definition: osdetect.h:21

Referenced by UpgradeRepairPage().

◆ GetSettingDescription()

static NTSTATUS NTAPI GetSettingDescription ( IN PGENERIC_LIST_ENTRY  Entry,
OUT PSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 491 of file usetup.c.

495 {
498 }
IN BOOLEAN OUT PSTR IN SIZE_T cchBufferSize
Definition: progress.h:34
IN UCHAR Value
Definition: halp.h:394
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1085
Definition: bufpool.h:45
base of all file and directory entries
Definition: entries.h:82

Referenced by ComputerSettingsPage(), DeviceSettingsPage(), DisplaySettingsPage(), KeyboardSettingsPage(), LanguagePage(), and LayoutSettingsPage().

◆ HandleGenericList()

static PAGE_NUMBER HandleGenericList ( PGENERIC_LIST_UI  ListUi,
PAGE_NUMBER  nextPage,
PINPUT_RECORD  Ir 
)
static

Definition at line 1318 of file usetup.c.

1321 {
1322  while (TRUE)
1323  {
1324  CONSOLE_ConInKey(Ir);
1325 
1326  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1327  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1328  {
1329  ScrollDownGenericList(ListUi);
1330  }
1331  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1332  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1333  {
1334  ScrollUpGenericList(ListUi);
1335  }
1336  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1337  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1338  {
1339  ScrollPageDownGenericList(ListUi);
1340  }
1341  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1342  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1343  {
1344  ScrollPageUpGenericList(ListUi);
1345  }
1346  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1347  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1348  {
1349  if (ConfirmQuit(Ir))
1350  return QUIT_PAGE;
1351  else
1352  RedrawGenericList(ListUi);
1353  }
1354  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1355  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
1356  {
1357  RestoreGenericListUiState(ListUi);
1358  return nextPage; // Use some "prevPage;" instead?
1359  }
1360  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1361  {
1362  return nextPage;
1363  }
1364  else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1365  {
1366  /* a-z */
1368  }
1369  }
1370 }
#define TRUE
Definition: types.h:120
VOID RestoreGenericListUiState(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:62
VOID RedrawGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:511
#define VK_DOWN
Definition: winuser.h:2202
#define VK_PRIOR
Definition: winuser.h:2195
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_NEXT
Definition: winuser.h:2196
WORD wVirtualKeyCode
Definition: wincon.h:242
VOID ScrollDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:376
#define VK_UP
Definition: winuser.h:2200
VOID ScrollPageUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:454
VOID ScrollPageDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:432
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define VK_F3
Definition: winuser.h:2232
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
union _INPUT_RECORD::@3242 Event
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by ComputerSettingsPage(), DisplaySettingsPage(), KeyboardSettingsPage(), and LayoutSettingsPage().

◆ InstallDirectoryPage()

static PAGE_NUMBER InstallDirectoryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3753 of file usetup.c.

3754 {
3755  NTSTATUS Status;
3756  ULONG Length, Pos;
3757  WCHAR c;
3758  WCHAR InstallDir[MAX_PATH];
3759 
3760  /* We do not need the filesystem list anymore */
3762 
3763  if (PartitionList == NULL || InstallPartition == NULL)
3764  {
3765  /* FIXME: show an error dialog */
3766  return QUIT_PAGE;
3767  }
3768 
3769  // if (IsUnattendedSetup)
3770  if (RepairUpdateFlag)
3771  wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
3772  else if (USetupData.InstallationDirectory[0])
3773  wcscpy(InstallDir, USetupData.InstallationDirectory);
3774  else
3775  wcscpy(InstallDir, L"\\ReactOS");
3776 
3777  /*
3778  * Check the validity of the predefined 'InstallDir'. If we are either
3779  * in unattended setup or in update/repair mode, and the installation path
3780  * is valid, just perform the installation. Otherwise (either in the case
3781  * of an invalid path, or we are in regular setup), display the UI and allow
3782  * the user to specify a new installation path.
3783  */
3784  if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
3785  {
3787  if (!NT_SUCCESS(Status))
3788  {
3789  DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
3791  return QUIT_PAGE;
3792  }
3793 
3794  /*
3795  * Check whether the user attempts to install ReactOS within the
3796  * installation source directory, or in a subdirectory thereof.
3797  * If so, fail with an error.
3798  */
3799  if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
3800  {
3802  return INSTALL_DIRECTORY_PAGE;
3803  }
3804 
3805  return PREPARE_COPY_PAGE;
3806  }
3807 
3808  Length = wcslen(InstallDir);
3809  Pos = Length;
3810 
3812  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3813  CONSOLE_SetCursorXY(8 + Pos, 11);
3815 
3816  while (TRUE)
3817  {
3818  CONSOLE_ConInKey(Ir);
3819 
3820  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3821  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3822  {
3824 
3825  if (ConfirmQuit(Ir))
3826  return QUIT_PAGE;
3827 
3829  break;
3830  }
3831  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3832  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
3833  {
3834  if (Pos < Length)
3835  {
3836  memmove(&InstallDir[Pos],
3837  &InstallDir[Pos + 1],
3838  (Length - Pos - 1) * sizeof(WCHAR));
3839  InstallDir[Length - 1] = UNICODE_NULL;
3840 
3841  Length--;
3842  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3843  CONSOLE_SetCursorXY(8 + Pos, 11);
3844  }
3845  }
3846  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3847  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3848  {
3849  Pos = 0;
3850  CONSOLE_SetCursorXY(8 + Pos, 11);
3851  }
3852  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3853  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3854  {
3855  Pos = Length;
3856  CONSOLE_SetCursorXY(8 + Pos, 11);
3857  }
3858  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3859  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
3860  {
3861  if (Pos > 0)
3862  {
3863  Pos--;
3864  CONSOLE_SetCursorXY(8 + Pos, 11);
3865  }
3866  }
3867  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3868  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
3869  {
3870  if (Pos < Length)
3871  {
3872  Pos++;
3873  CONSOLE_SetCursorXY(8 + Pos, 11);
3874  }
3875  }
3876  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3877  {
3879 
3880  /*
3881  * Check for the validity of the installation directory and pop up
3882  * an error if it is not the case. Then the user can fix its input.
3883  */
3884  if (!IsValidPath(InstallDir))
3885  {
3887  return INSTALL_DIRECTORY_PAGE;
3888  }
3889 
3891  if (!NT_SUCCESS(Status))
3892  {
3893  DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
3895  return QUIT_PAGE;
3896  }
3897 
3898  /*
3899  * Check whether the user attempts to install ReactOS within the
3900  * installation source directory, or in a subdirectory thereof.
3901  * If so, fail with an error.
3902  */
3903  if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
3904  {
3906  return INSTALL_DIRECTORY_PAGE;
3907  }
3908 
3909  return PREPARE_COPY_PAGE;
3910  }
3911  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3912  {
3913  if (Pos > 0)
3914  {
3915  if (Pos < Length)
3916  memmove(&InstallDir[Pos - 1],
3917  &InstallDir[Pos],
3918  (Length - Pos) * sizeof(WCHAR));
3919  InstallDir[Length - 1] = UNICODE_NULL;
3920 
3921  Pos--;
3922  Length--;
3923  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3924  CONSOLE_SetCursorXY(8 + Pos, 11);
3925  }
3926  }
3927  else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3928  {
3929  if (Length < 50)
3930  {
3932  if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
3933  {
3934  if (Pos < Length)
3935  memmove(&InstallDir[Pos + 1],
3936  &InstallDir[Pos],
3937  (Length - Pos) * sizeof(WCHAR));
3938  InstallDir[Length + 1] = UNICODE_NULL;
3939  InstallDir[Pos] = c;
3940 
3941  Pos++;
3942  Length++;
3943  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3944  CONSOLE_SetCursorXY(8 + Pos, 11);
3945  }
3946  }
3947  }
3948  }
3949 
3950  return INSTALL_DIRECTORY_PAGE;
3951 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static USETUP_DATA USetupData
Definition: usetup.c:47
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2726
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define iswdigit(_c)
Definition: ctype.h:667
LONG NTSTATUS
Definition: precomp.h:26
static PPARTENTRY InstallPartition
Definition: usetup.c:50
ush Pos
Definition: deflate.h:92
#define VK_LEFT
Definition: winuser.h:2199
#define iswalpha(_c)
Definition: ctype.h:664
VOID CONSOLE_SetInputTextXY(IN SHORT x, IN SHORT y, IN SHORT len, IN LPCWSTR Text)
Definition: consup.c:348
WORD wVirtualKeyCode
Definition: wincon.h:242
static BOOLEAN IsValidPath(IN PCWSTR InstallDir)
Definition: usetup.c:3697
#define VK_HOME
Definition: winuser.h:2198
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
VOID CONSOLE_SetCursorType(IN BOOL bInsert, IN BOOL bVisible)
Definition: consup.c:205
smooth NULL
Definition: ftsmooth.c:416
#define VK_DELETE
Definition: winuser.h:2208
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
const GLubyte * c
Definition: glext.h:8905
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
#define VK_RIGHT
Definition: winuser.h:2201
#define POPUP_WAIT_ENTER
Definition: usetup.h:126
PCWSTR PathComponent
Definition: osdetect.h:22
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
#define DPRINT1
Definition: precomp.h:8
union _INPUT_RECORD::@3242 Event
#define isprint(c)
Definition: acclib.h:73
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
VOID CONSOLE_SetCursorXY(IN SHORT x, IN SHORT y)
Definition: consup.c:218
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:624
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:87
#define VK_END
Definition: winuser.h:2197
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by RunUSetup().

◆ InstallIntroPage()

static PAGE_NUMBER InstallIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 1050 of file usetup.c.

1051 {
1052  if (RepairUpdateFlag)
1053  {
1054 #if 1 /* Old code that looks good */
1055 
1056  // return SELECT_PARTITION_PAGE;
1057  return DEVICE_SETTINGS_PAGE;
1058 
1059 #else /* Possible new code? */
1060 
1061  return DEVICE_SETTINGS_PAGE;
1062  // return SCSI_CONTROLLER_PAGE;
1063 
1064 #endif
1065  }
1066 
1067  if (IsUnattendedSetup)
1068  return SELECT_PARTITION_PAGE;
1069 
1071 
1072  while (TRUE)
1073  {
1074  CONSOLE_ConInKey(Ir);
1075 
1076  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1077  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1078  {
1079  if (ConfirmQuit(Ir))
1080  return QUIT_PAGE;
1081 
1082  break;
1083  }
1084  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1085  {
1086  return UPGRADE_REPAIR_PAGE;
1087  }
1088  }
1089 
1090  return INSTALL_INTRO_PAGE;
1091 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
WORD wVirtualKeyCode
Definition: wincon.h:242
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
union _INPUT_RECORD::@3242 Event
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by RunUSetup().

◆ IsDiskSizeValid()

static BOOL IsDiskSizeValid ( PPARTENTRY  PartEntry)
static

Definition at line 1478 of file usetup.c.

1479 {
1480  ULONGLONG size;
1481 
1482  size = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector;
1483  size = (size + (512 * KB)) / MB; /* in MBytes */
1484 
1485  if (size < USetupData.RequiredPartitionDiskSpace)
1486  {
1487  /* Partition is too small so ask for another one */
1488  DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, USetupData.RequiredPartitionDiskSpace);
1489  return FALSE;
1490  }
1491  else
1492  {
1493  return TRUE;
1494  }
1495 }
static USETUP_DATA USetupData
Definition: usetup.c:47
#define TRUE
Definition: types.h:120
ULARGE_INTEGER SectorCount
Definition: partlist.h:43
#define MB
Definition: setuplib.h:55
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
GLsizeiptr size
Definition: glext.h:5919
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
uint64_t ULONGLONG
Definition: typedefs.h:67
#define DPRINT1
Definition: precomp.h:8
#define KB
Definition: setuplib.h:54

Referenced by SelectPartitionPage().

◆ IsValidPath()

static BOOLEAN IsValidPath ( IN PCWSTR  InstallDir)
static

Definition at line 3697 of file usetup.c.

3699 {
3700  UINT i, Length;
3701 
3702  Length = wcslen(InstallDir);
3703 
3704  // TODO: Add check for 8.3 too.
3705 
3706  /* Path must be at least 2 characters long */
3707 // if (Length < 2)
3708 // return FALSE;
3709 
3710  /* Path must start with a backslash */
3711 // if (InstallDir[0] != L'\\')
3712 // return FALSE;
3713 
3714  /* Path must not end with a backslash */
3715  if (InstallDir[Length - 1] == L'\\')
3716  return FALSE;
3717 
3718  /* Path must not contain whitespace characters */
3719  for (i = 0; i < Length; i++)
3720  {
3721  if (iswspace(InstallDir[i]))
3722  return FALSE;
3723  }
3724 
3725  /* Path component must not end with a dot */
3726  for (i = 0; i < Length; i++)
3727  {
3728  if (InstallDir[i] == L'\\' && i > 0)
3729  {
3730  if (InstallDir[i - 1] == L'.')
3731  return FALSE;
3732  }
3733  }
3734 
3735  if (InstallDir[Length - 1] == L'.')
3736  return FALSE;
3737 
3738  return TRUE;
3739 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define iswspace(_c)
Definition: ctype.h:669
static const WCHAR L[]
Definition: oid.c:1250
unsigned int UINT
Definition: ndis.h:50
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by InstallDirectoryPage().

◆ KeyboardSettingsPage()

static PAGE_NUMBER KeyboardSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1436 of file usetup.c.

1437 {
1438  GENERIC_LIST_UI ListUi;
1440 
1441  InitGenericListUi(&ListUi, USetupData.KeyboardList, GetSettingDescription);
1442  DrawGenericList(&ListUi,
1443  2, 18,
1444  xScreen - 3,
1445  yScreen - 3);
1446 
1447  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1448 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1318
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ LanguagePage()

static PAGE_NUMBER LanguagePage ( PINPUT_RECORD  Ir)
static

Definition at line 543 of file usetup.c.

544 {
545  GENERIC_LIST_UI ListUi;
546  PCWSTR NewLanguageId;
547  BOOL RefreshPage = FALSE;
548 
549  /* Initialize the computer settings list */
550  if (USetupData.LanguageList == NULL)
551  {
552  USetupData.LanguageList = CreateLanguageList(USetupData.SetupInf, DefaultLanguage);
553  if (USetupData.LanguageList == NULL)
554  {
555  PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
556  return WELCOME_PAGE;
557  }
558  }
559 
561  USetupData.LanguageId = 0;
562 
563  /* Load the font */
565  UpdateKBLayout();
566 
567  /*
568  * If there is no language or just a single one in the list,
569  * skip the language selection process altogether.
570  */
571  if (GetNumberOfListEntries(USetupData.LanguageList) <= 1)
572  {
573  USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
574  return WELCOME_PAGE;
575  }
576 
577  InitGenericListUi(&ListUi, USetupData.LanguageList, GetSettingDescription);
578  DrawGenericList(&ListUi,
579  2, 18,
580  xScreen - 3,
581  yScreen - 3);
582 
584 
586 
587  while (TRUE)
588  {
589  CONSOLE_ConInKey(Ir);
590 
591  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
592  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
593  {
594  ScrollDownGenericList(&ListUi);
595  RefreshPage = TRUE;
596  }
597  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
598  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
599  {
600  ScrollUpGenericList(&ListUi);
601  RefreshPage = TRUE;
602  }
603  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
604  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
605  {
606  ScrollPageDownGenericList(&ListUi);
607  RefreshPage = TRUE;
608  }
609  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
610  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
611  {
612  ScrollPageUpGenericList(&ListUi);
613  RefreshPage = TRUE;
614  }
615  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
616  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
617  {
618  if (ConfirmQuit(Ir))
619  return QUIT_PAGE;
620  else
621  RedrawGenericList(&ListUi);
622  }
623  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
624  {
625  ASSERT(GetNumberOfListEntries(USetupData.LanguageList) >= 1);
626 
629 
630  USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
631 
633  {
634  UpdateKBLayout();
635  }
636 
637  /* Load the font */
639 
640  return WELCOME_PAGE;
641  }
642  else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
643  {
644  /* a-z */
646  RefreshPage = TRUE;
647  }
648 
649  if (RefreshPage)
650  {
651  ASSERT(GetNumberOfListEntries(USetupData.LanguageList) >= 1);
652 
653  NewLanguageId =
655 
656  if (wcscmp(SelectedLanguageId, NewLanguageId))
657  {
658  /* Clear the language page */
660 
661  SelectedLanguageId = NewLanguageId;
662 
663  /* Load the font */
665 
666  /* Redraw language selection page in native language */
668  }
669 
670  RefreshPage = FALSE;
671  }
672  }
673 
674  return WELCOME_PAGE;
675 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
static USETUP_DATA USetupData
Definition: usetup.c:47
ULONG GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:140
#define POPUP_WAIT_NONE
Definition: usetup.h:124
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
VOID PopupError(PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
Definition: usetup.c:256
VOID ScrollToPositionGenericList(IN PGENERIC_LIST_UI ListUi, IN ULONG uIndex)
Definition: genlist.c:476
PGENERIC_LIST CreateLanguageList(IN HINF InfFile, OUT PWSTR DefaultLanguage)
Definition: settings.c:1160
VOID RedrawGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:511
WORD LANGID
Definition: typedefs.h:81
#define VK_DOWN
Definition: winuser.h:2202
#define VK_PRIOR
Definition: winuser.h:2195
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
#define VK_NEXT
Definition: winuser.h:2196
WORD wVirtualKeyCode
Definition: wincon.h:242
VOID ScrollDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:376
static VOID UpdateKBLayout(VOID)
Definition: usetup.c:456
#define VK_UP
Definition: winuser.h:2200
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
VOID ScrollPageUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:454
VOID ScrollPageDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:432
smooth NULL
Definition: ftsmooth.c:416
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
VOID MUIClearPage(IN ULONG page)
Definition: mui.c:121
PCWSTR SelectedLanguageId
Definition: usetup.c:66
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define VK_F3
Definition: winuser.h:2232
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
union _KEY_EVENT_RECORD::@3241 uChar
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
ULONG GetDefaultLanguageIndex(VOID)
Definition: settings.c:1099
SHORT yScreen
Definition: consup.c:40
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
struct _GENENTRY * PGENENTRY
union _INPUT_RECORD::@3242 Event
static WCHAR DefaultLanguage[20]
Definition: usetup.c:67
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
VOID SetConsoleCodePage(VOID)
Definition: mui.c:456
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ LayoutSettingsPage()

static PAGE_NUMBER LayoutSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1462 of file usetup.c.

1463 {
1464  GENERIC_LIST_UI ListUi;
1466 
1467  InitGenericListUi(&ListUi, USetupData.LayoutList, GetSettingDescription);
1468  DrawGenericList(&ListUi,
1469  2, 18,
1470  xScreen - 3,
1471  yScreen - 3);
1472 
1473  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1474 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1318
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ LicensePage()

static PAGE_NUMBER LicensePage ( PINPUT_RECORD  Ir)
static

Definition at line 839 of file usetup.c.

840 {
842 
843  while (TRUE)
844  {
845  CONSOLE_ConInKey(Ir);
846 
847  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
848  {
849  return WELCOME_PAGE;
850  }
851  }
852 
853  return LICENSE_PAGE;
854 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
union _KEY_EVENT_RECORD::@3241 uChar
union _INPUT_RECORD::@3242 Event
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61

Referenced by RunUSetup().

◆ NtProcessStartup()

VOID NTAPI NtProcessStartup ( PPEB  Peb)

Definition at line 5196 of file usetup.c.

5197 {
5198  NTSTATUS Status;
5200 
5202 
5204 
5206 
5207  Status = RunUSetup();
5208 
5209  if (NT_SUCCESS(Status))
5210  {
5211  /*
5212  * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
5213  * a protective waiting.
5214  * This wait is needed because, since we are started as SMSS.EXE,
5215  * the NT kernel explicitly waits 5 seconds for the initial process
5216  * SMSS.EXE to initialize (as a protective measure), and otherwise
5217  * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
5218  */
5219  Time.QuadPart += 50000000;
5221  }
5222  else
5223  {
5224  /* The installer failed to start: raise a hard error (crash the system/BSOD) */
5226  0, 0, NULL, 0, NULL);
5227  }
5228 
5230 }
PPEB Peb
Definition: dllmain.c:27
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:553
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS RunUSetup(VOID)
Definition: usetup.c:4971
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1959
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
HANDLE ProcessHeap
Definition: usetup.c:44
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:879
#define NtCurrentProcess()
Definition: nt_native.h:1657
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
PVOID ProcessHeap
Definition: ntddk_ex.h:249
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:417
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:670
static PLARGE_INTEGER Time
Definition: time.c:105
LONGLONG QuadPart
Definition: typedefs.h:114

◆ PopupError()

VOID PopupError ( PCCH  Text,
PCCH  Status,
PINPUT_RECORD  Ir,
ULONG  WaitEvent 
)

Definition at line 256 of file usetup.c.

260 {
261  SHORT yTop;
262  SHORT xLeft;
263  COORD coPos;
264  DWORD Written;
265  ULONG Length;
266  ULONG MaxLength;
267  ULONG Lines;
268  PCHAR p;
269  PCCH pnext;
270  BOOLEAN LastLine;
271  SHORT Width;
272  SHORT Height;
273 
274  /* Count text lines and longest line */
275  MaxLength = 0;
276  Lines = 0;
277  pnext = Text;
278 
279  while (TRUE)
280  {
281  p = strchr(pnext, '\n');
282 
283  if (p == NULL)
284  {
285  Length = strlen(pnext);
286  LastLine = TRUE;
287  }
288  else
289  {
290  Length = (ULONG)(p - pnext);
291  LastLine = FALSE;
292  }
293 
294  Lines++;
295 
296  if (Length > MaxLength)
297  MaxLength = Length;
298 
299  if (LastLine)
300  break;
301 
302  pnext = p + 1;
303  }
304 
305  /* Check length of status line */
306  if (Status != NULL)
307  {
308  Length = strlen(Status);
309 
310  if (Length > MaxLength)
311  MaxLength = Length;
312  }
313 
314  Width = MaxLength + 4;
315  Height = Lines + 2;
316 
317  if (Status != NULL)
318  Height += 2;
319 
320  yTop = (yScreen - Height) / 2;
321  xLeft = (xScreen - Width) / 2;
322 
323 
324  /* Set screen attributes */
325  coPos.X = xLeft;
326  for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++)
327  {
330  Width,
331  coPos,
332  &Written);
333  }
334 
335  DrawBox(xLeft, yTop, Width, Height);
336 
337  /* Print message text */
338  coPos.Y = yTop + 1;
339  pnext = Text;
340  while (TRUE)
341  {
342  p = strchr(pnext, '\n');
343 
344  if (p == NULL)
345  {
346  Length = strlen(pnext);
347  LastLine = TRUE;
348  }
349  else
350  {
351  Length = (ULONG)(p - pnext);
352  LastLine = FALSE;
353  }
354 
355  if (Length != 0)
356  {
357  coPos.X = xLeft + 2;
359  pnext,
360  Length,
361  coPos,
362  &Written);
363  }
364 
365  if (LastLine)
366  break;
367 
368  coPos.Y++;
369  pnext = p + 1;
370  }
371 
372  /* Print separator line and status text */
373  if (Status != NULL)
374  {
375  coPos.Y = yTop + Height - 3;
376  coPos.X = xLeft;
378  0xC3, // '+',
379  1,
380  coPos,
381  &Written);
382 
383  coPos.X = xLeft + 1;
385  0xC4, // '-',
386  Width - 2,
387  coPos,
388  &Written);
389 
390  coPos.X = xLeft + Width - 1;
392  0xB4, // '+',
393  1,
394  coPos,
395  &Written);
396 
397  coPos.Y++;
398  coPos.X = xLeft + 2;
400  Status,
401  min(strlen(Status), (SIZE_T)Width - 4),
402  coPos,
403  &Written);
404  }
405 
406  if (WaitEvent == POPUP_WAIT_NONE)
407  return;
408 
409  while (TRUE)
410  {
411  CONSOLE_ConInKey(Ir);
412 
413  if (WaitEvent == POPUP_WAIT_ANY_KEY ||
414  Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
415  {
416  return;
417  }
418  }
419 }
signed char * PCHAR
Definition: retypes.h:7
#define POPUP_WAIT_NONE
Definition: usetup.h:124
SHORT xScreen
Definition: consup.c:39
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
Definition: console.c:522
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
#define FOREGROUND_RED
Definition: blue.h:63
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:125
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:557
#define FALSE
Definition: types.h:117
short SHORT
Definition: pedump.c:59
HANDLE StdOutput
Definition: consup.c:37
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:404
ULONG X
Definition: bl.h:1340
CONST CHAR * PCCH
Definition: ntbasedef.h:393
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
union _KEY_EVENT_RECORD::@3241 uChar
Status
Definition: gdiplustypes.h:24
Definition: bl.h:1338
SHORT yScreen
Definition: consup.c:40
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static VOID DrawBox(IN SHORT xLeft, IN SHORT yTop, IN SHORT Width, IN SHORT Height)
Definition: usetup.c:166
#define min(a, b)
Definition: monoChain.cc:55
#define BACKGROUND_WHITE
Definition: consup.h:31
char * strchr(const char *String, int ch)
Definition: utclib.c:501
union _INPUT_RECORD::@3242 Event
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
ULONG Y
Definition: bl.h:1341
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:61
char * Text
Definition: combotst.c:136

Referenced by CheckFileSystemPage(), FormatPartitionPage(), LanguagePage(), MUIClearPage(), MUIDisplayErrorV(), MUIDisplayPage(), MUIGetString(), SelectFileSystemPage(), and SelectPartitionPage().

◆ PrepareCopyPage()

static PAGE_NUMBER PrepareCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 3990 of file usetup.c.

3991 {
3992  // ERROR_NUMBER ErrorNumber;
3993  BOOLEAN Success;
3994 
3996 
3997  /* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
3998  if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
3999  {
4000  // MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
4001  return QUIT_PAGE;
4002  }
4003 
4004  return FILE_COPY_PAGE;
4005 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN PrepareFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
Definition: install.c:676

Referenced by RunUSetup().

◆ PrintString()

static VOID PrintString ( char fmt,
  ... 
)
static

Definition at line 147 of file usetup.c.

148 {
149  char buffer[512];
150  va_list ap;
153 
154  va_start(ap, fmt);
155  vsprintf(buffer, fmt, ap);
156  va_end(ap);
157 
162 }
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI NtDisplayString(PUNICODE_STRING String)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
Definition: dsound.c:943

Referenced by RunUSetup().

◆ ProgressCountdown()

static VOID ProgressCountdown ( IN PINPUT_RECORD  Ir,
IN LONG  TimeOut 
)
static

Definition at line 4754 of file usetup.c.

4757 {
4758  NTSTATUS Status;
4759  ULONG StartTime, BarWidth, TimerDiv;
4760  LONG TimeElapsed;
4761  LONG TimerValue, OldTimerValue;
4763  PPROGRESSBAR ProgressBar;
4764  BOOLEAN RefreshProgress = TRUE;
4765 
4766  /* Bail out if the timeout is already zero */
4767  if (TimeOut <= 0)
4768  return;
4769 
4770  /* Create the timeout progress bar and set it up */
4771  ProgressBar = CreateProgressBarEx(13,
4772  26,
4773  xScreen - 13,
4774  yScreen - 20,
4775  10,
4776  24,
4777  TRUE,
4779  0,
4780  NULL,
4783 
4784  BarWidth = max(1, ProgressBar->Width);
4785  TimerValue = TimeOut * BarWidth;
4786  ProgressSetStepCount(ProgressBar, TimerValue);
4787 
4789  CONSOLE_Flush();
4790 
4791  TimerDiv = 1000 / BarWidth;
4792  TimerDiv = max(1, TimerDiv);
4793  OldTimerValue = TimerValue;
4794  while (TRUE)
4795  {
4796  /* Decrease the timer */
4797 
4798  /*
4799  * Compute how much time the previous operations took.
4800  * This allows us in particular to take account for any time
4801  * elapsed if something slowed down.
4802  */
4803  TimeElapsed = NtGetTickCount() - StartTime;
4804  if (TimeElapsed >= TimerDiv)
4805  {
4806  /* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
4807  TimeElapsed /= TimerDiv;
4808  StartTime += (TimerDiv * TimeElapsed);
4809 
4810  if (TimeElapsed <= TimerValue)
4811  TimerValue -= TimeElapsed;
4812  else
4813  TimerValue = 0;
4814 
4815  RefreshProgress = TRUE;
4816  }
4817 
4818  if (RefreshProgress)
4819  {
4820  ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
4821  RefreshProgress = FALSE;
4822  }
4823 
4824  /* Stop when the timer reaches zero */
4825  if (TimerValue <= 0)
4826  break;
4827 
4828  /* Check for user key presses */
4829 
4830  /*
4831  * If the timer is used, use a passive wait of maximum 1 second
4832  * while monitoring for incoming console input events, so that
4833  * we are still able to display the timing count.
4834  */
4835 
4836  /* Wait a maximum of 1 second for input events */
4837  TimeElapsed = NtGetTickCount() - StartTime;
4838  if (TimeElapsed < TimerDiv)
4839  {
4840  /* Convert the time to NT Format */
4841  Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
4843  }
4844  else
4845  {
4847  }
4848 
4849  /* Check whether the input event has been signaled, or a timeout happened */
4850  if (Status == STATUS_TIMEOUT)
4851  {
4852  continue;
4853  }
4854  if (Status != STATUS_WAIT_0)
4855  {
4856  /* An error happened, bail out */
4857  DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
4858  break;
4859  }
4860 
4861  /* Check for an ENTER key press */
4862  while (CONSOLE_ConInKeyPeek(Ir))
4863  {
4864  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4865  {
4866  /* Found it, stop waiting */
4867  goto Exit;
4868  }
4869  }
4870  }
4871 
4872 Exit:
4873  /* Destroy the progress bar and quit */
4874  DestroyProgressBar(ProgressBar);
4875 }
#define max(a, b)
Definition: svc.c:63
#define LL
Definition: tui.h:84
SHORT xScreen
Definition: consup.c:39
#define TRUE
Definition: types.h:120
#define STRING_REBOOTPROGRESSBAR
Definition: mui.h:174
PPROGRESSBAR CreateProgressBarEx(IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN SHORT ProgressColour, IN ULONG StepCount, IN PCSTR DescriptionText OPTIONAL, IN PCSTR ProgressFormatText OPTIONAL, IN PUPDATE_PROGRESS UpdateProgressProc OPTIONAL)
Definition: progress.c:272
LONG NTSTATUS
Definition: precomp.h:26
HANDLE StdInput
Definition: consup.c:36
#define FOREGROUND_RED
Definition: blue.h:63
VOID ProgressSetStep(IN PPROGRESSBAR Bar, IN ULONG Step)
Definition: progress.c:368
VOID DestroyProgressBar(IN OUT PPROGRESSBAR Bar)
Definition: progress.c:339
static LARGE_INTEGER StartTime
Definition: sys_arch.c:18
BOOL CONSOLE_Flush(VOID)
Definition: consup.c:166
#define NtGetTickCount
Definition: rtlp.h:146
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define STATUS_WAIT_0
Definition: ntstatus.h:237
#define FALSE
Definition: types.h:117
VOID ProgressSetStepCount(IN PPROGRESSBAR Bar, IN ULONG StepCount)
Definition: progress.c:347
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN CONSOLE_ConInKeyPeek(OUT PINPUT_RECORD Buffer)
Definition: consup.c:80
SHORT Width
Definition: progress.h:48
static BOOLEAN NTAPI ProgressTimeOutStringHandler(IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:4707
static void Exit(void)
Definition: sock.c:1331
Status
Definition: gdiplustypes.h:24
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
SHORT yScreen
Definition: consup.c:40
static ULONG Timeout
Definition: ping.c:61
#define DPRINT1
Definition: precomp.h:8
#define BACKGROUND_BLUE
Definition: blue.h:65
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)

Referenced by QuitPage(), and SuccessPage().

◆ ProgressTimeOutStringHandler()

static BOOLEAN NTAPI ProgressTimeOutStringHandler ( IN PPROGRESSBAR  Bar,
IN BOOLEAN  AlwaysUpdate,
OUT PSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 4707 of file usetup.c.

4712 {
4713  ULONG OldProgress = Bar->Progress;
4714 
4715  if (Bar->StepCount == 0)
4716  {
4717  Bar->Progress = 0;
4718  }
4719  else
4720  {
4721  Bar->Progress = Bar->StepCount - Bar->CurrentStep;
4722  }
4723 
4724  /* Build the progress string if it has changed */
4725  if (Bar->ProgressFormatText &&
4726  (AlwaysUpdate || (Bar->Progress != OldProgress)))
4727  {
4729  Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
4730 
4731  return TRUE;
4732  }
4733 
4734  return FALSE;
4735 }
IN BOOLEAN OUT PSTR IN SIZE_T cchBufferSize
Definition: progress.h:34
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1085
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN AlwaysUpdate
Definition: progress.h:34

Referenced by ProgressCountdown().

◆ QuitPage()

static PAGE_NUMBER QuitPage ( PINPUT_RECORD  Ir)
static

Definition at line 4891 of file usetup.c.

4892 {
4894 
4895  /* Destroy the NTOS installations list */
4896  if (NtOsInstallsList != NULL)
4897  {
4900  }
4901 
4902  /* Destroy the partition list */
4903  if (PartitionList != NULL)
4904  {
4906  PartitionList = NULL;
4907  }
4908 
4909  /* Reset the formatter machine state */
4910  TempPartition = NULL;
4911  FormatState = Start;
4912 
4913  /* Destroy the filesystem list */
4915 
4917 
4918  /* Wait for maximum 15 seconds or an ENTER key before quitting */
4919  ProgressCountdown(Ir, 15);
4920  return FLUSH_PAGE;
4921 }
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2726
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
static PPARTENTRY TempPartition
Definition: usetup.c:82
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define STRING_REBOOTCOMPUTER2
Definition: mui.h:143
smooth NULL
Definition: ftsmooth.c:416
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:88
static VOID ProgressCountdown(IN PINPUT_RECORD Ir, IN LONG TimeOut)
Definition: usetup.c:4754
static FORMATMACHINESTATE FormatState
Definition: usetup.c:83
Definition: partlist.h:33
static PPARTLIST PartitionList
Definition: usetup.c:73
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
VOID DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:2108
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:477

Referenced by RunUSetup().

◆ RegistryPage()

static PAGE_NUMBER RegistryPage ( PINPUT_RECORD  Ir)
static

Definition at line 4285 of file usetup.c.

<