ReactOS  0.4.15-dev-5492-g47f3a4e
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 (IN PCSTR 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 BootLoaderInstallationPage (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 1883 of file usetup.c.

◆ PARTITION_SIZE_INPUT_FIELD_LENGTH

#define PARTITION_SIZE_INPUT_FIELD_LENGTH   9

Definition at line 1881 of file usetup.c.

Typedef Documentation

◆ COPYCONTEXT

◆ PCOPYCONTEXT

Function Documentation

◆ BootLoaderFloppyPage()

static PAGE_NUMBER BootLoaderFloppyPage ( PINPUT_RECORD  Ir)
static

Definition at line 4056 of file usetup.c.

4057 {
4058  NTSTATUS Status;
4059 
4061 
4062 // CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
4063 
4064  while (TRUE)
4065  {
4066  CONSOLE_ConInKey(Ir);
4067 
4068  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4069  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
4070  {
4071  if (ConfirmQuit(Ir))
4072  return QUIT_PAGE;
4073 
4074  break;
4075  }
4076  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4077  {
4078  Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
4079  &USetupData.DestinationArcPath);
4080  if (!NT_SUCCESS(Status))
4081  {
4084 
4085  /* TODO: Print error message */
4086  return BOOT_LOADER_FLOPPY_PAGE;
4087  }
4088 
4089  return SUCCESS_PAGE;
4090  }
4091  }
4092 
4093  return BOOT_LOADER_FLOPPY_PAGE;
4094 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
WORD wVirtualKeyCode
Definition: wincon.h:242
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
NTSTATUS InstallFatBootcodeToFloppy(IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1378
#define VK_F3
Definition: winuser.h:2247
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:237
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70

Referenced by RunUSetup().

◆ BootLoaderInstallationPage()

static PAGE_NUMBER BootLoaderInstallationPage ( PINPUT_RECORD  Ir)
static

Definition at line 4113 of file usetup.c.

4114 {
4115  NTSTATUS Status;
4116  WCHAR DestinationDevicePathBuffer[MAX_PATH];
4117 
4119 
4120  if (USetupData.MBRInstallType == 2)
4121  {
4122  /* Step 1: Write the VBR */
4123  Status = InstallVBRToPartition(&USetupData.SystemRootPath,
4124  &USetupData.SourceRootPath,
4125  &USetupData.DestinationArcPath,
4127  if (!NT_SUCCESS(Status))
4128  {
4131  return QUIT_PAGE;
4132  }
4133 
4134  /* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
4136  {
4137  RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
4138  L"\\Device\\Harddisk%d\\Partition0",
4139  SystemPartition->DiskEntry->DiskNumber);
4140  Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath,
4141  &USetupData.SourceRootPath,
4142  DestinationDevicePathBuffer);
4143  if (!NT_SUCCESS(Status))
4144  {
4145  DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", Status);
4147  return QUIT_PAGE;
4148  }
4149  }
4150  }
4151  else
4152  {
4153  Status = InstallVBRToPartition(&USetupData.SystemRootPath,
4154  &USetupData.SourceRootPath,
4155  &USetupData.DestinationArcPath,
4157  if (!NT_SUCCESS(Status))
4158  {
4161  return QUIT_PAGE;
4162  }
4163  }
4164 
4165  return SUCCESS_PAGE;
4166 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
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
#define L(x)
Definition: ntvdm.h:50
Status
Definition: gdiplustypes.h:24
struct _DISKENTRY * DiskEntry
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
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:60
static PPARTENTRY SystemPartition
Definition: usetup.c:61
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
Definition: bootsup.c:763
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:501
#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:1333

Referenced by RunUSetup().

◆ BootLoaderPage()

static PAGE_NUMBER BootLoaderPage ( PINPUT_RECORD  Ir)
static

Definition at line 3879 of file usetup.c.

3880 {
3881  USHORT Line = 12;
3882  WCHAR PathBuffer[MAX_PATH];
3883 
3885 
3886  /* We must have a supported system partition by now */
3888 
3889  RtlFreeUnicodeString(&USetupData.SystemRootPath);
3890  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3891  L"\\Device\\Harddisk%lu\\Partition%lu\\",
3892  SystemPartition->DiskEntry->DiskNumber,
3894  RtlCreateUnicodeString(&USetupData.SystemRootPath, PathBuffer);
3895  DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
3896 
3897  /* For unattended setup, skip MBR installation or install on floppy if needed */
3898  if (IsUnattendedSetup)
3899  {
3900  if ((USetupData.MBRInstallType == 0) ||
3901  (USetupData.MBRInstallType == 1))
3902  {
3903  goto Quit;
3904  }
3905  }
3906 
3907  /*
3908  * We may install an MBR or VBR, but before that, check whether
3909  * we need to actually install the VBR on floppy/removable media
3910  * if the system partition is not recognized.
3911  */
3912  if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
3914  {
3915  USetupData.MBRInstallType = 1;
3916  goto Quit;
3917  }
3918 
3919  /* Is it an unattended install on hdd? */
3920  if (IsUnattendedSetup)
3921  {
3922  if ((USetupData.MBRInstallType == 2) ||
3923  (USetupData.MBRInstallType == 3))
3924  {
3925  goto Quit;
3926  }
3927  }
3928 
3930  CONSOLE_InvertTextXY(8, Line, 60, 1);
3931 
3932  while (TRUE)
3933  {
3934  CONSOLE_ConInKey(Ir);
3935 
3936  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3937  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
3938  {
3939  CONSOLE_NormalTextXY(8, Line, 60, 1);
3940 
3941  Line++;
3942  if (Line < 12)
3943  Line = 15;
3944 
3945  if (Line > 15)
3946  Line = 12;
3947 
3948  CONSOLE_InvertTextXY(8, Line, 60, 1);
3949  }
3950  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3951  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
3952  {
3953  CONSOLE_NormalTextXY(8, Line, 60, 1);
3954 
3955  Line--;
3956  if (Line < 12)
3957  Line = 15;
3958 
3959  if (Line > 15)
3960  Line = 12;
3961 
3962  CONSOLE_InvertTextXY(8, Line, 60, 1);
3963  }
3964  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3965  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3966  {
3967  CONSOLE_NormalTextXY(8, Line, 60, 1);
3968 
3969  Line = 12;
3970 
3971  CONSOLE_InvertTextXY(8, Line, 60, 1);
3972  }
3973  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3974  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3975  {
3976  CONSOLE_NormalTextXY(8, Line, 60, 1);
3977 
3978  Line = 15;
3979 
3980  CONSOLE_InvertTextXY(8, Line, 60, 1);
3981  }
3982  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3983  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3984  {
3985  if (ConfirmQuit(Ir))
3986  return QUIT_PAGE;
3987 
3988  break;
3989  }
3990  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3991  {
3992  if (Line == 12)
3993  {
3994  /* Install on both MBR and VBR */
3995  USetupData.MBRInstallType = 2;
3996  break;
3997  }
3998  else if (Line == 13)
3999  {
4000  /* Install on VBR only */
4001  USetupData.MBRInstallType = 3;
4002  break;
4003  }
4004  else if (Line == 14)
4005  {
4006  /* Install on floppy */
4007  USetupData.MBRInstallType = 1;
4008  break;
4009  }
4010  else if (Line == 15)
4011  {
4012  /* Skip MBR installation */
4013  USetupData.MBRInstallType = 0;
4014  break;
4015  }
4016 
4017  return BOOT_LOADER_PAGE;
4018  }
4019  }
4020 
4021 Quit:
4022  switch (USetupData.MBRInstallType)
4023  {
4024  /* Skip MBR installation */
4025  case 0:
4026  return SUCCESS_PAGE;
4027 
4028  /* Install on floppy */
4029  case 1:
4030  return BOOT_LOADER_FLOPPY_PAGE;
4031 
4032  /* Install on both MBR and VBR or VBR only */
4033  case 2:
4034  case 3:
4036  }
4037 
4038  return BOOT_LOADER_PAGE;
4039 }
ULONG PartitionNumber
Definition: partlist.h:55
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#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:2217
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:298
WORD wVirtualKeyCode
Definition: wincon.h:242
#define VK_HOME
Definition: winuser.h:2213
#define L(x)
Definition: ntvdm.h:50
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:276
#define VK_UP
Definition: winuser.h:2215
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
UCHAR PartitionType
Definition: partlist.h:53
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IsRecognizedPartition(PartitionType)
Definition: ntdddisk.h:342
#define MAX_PATH
Definition: compat.h:34
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define VK_F3
Definition: winuser.h:2247
static PPARTENTRY SystemPartition
Definition: usetup.c:61
Definition: ncftp.h:79
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
#define DPRINT1
Definition: precomp.h:8
#define STRING_PLEASEWAIT
Definition: mui.h:132
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
#define VK_END
Definition: winuser.h:2212
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
BOOLEAN IsPartitioned
Definition: partlist.h:66

Referenced by RunUSetup().

◆ CheckFileSystemPage()

static PAGE_NUMBER CheckFileSystemPage ( PINPUT_RECORD  Ir)
static

Definition at line 3160 of file usetup.c.

3161 {
3162  NTSTATUS Status;
3163  PPARTENTRY PartEntry;
3164  CHAR Buffer[MAX_PATH];
3165 
3167 
3168  if (PartitionList == NULL)
3169  {
3170  /* FIXME: show an error dialog */
3171  return QUIT_PAGE;
3172  }
3173 
3174  if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry))
3175  {
3176  return INSTALL_DIRECTORY_PAGE;
3177  }
3178 
3179  ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
3180 
3181  DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
3182  PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a"));
3183 
3184  /* Check the partition */
3185  Status = DoChkdsk(PartEntry);
3187  {
3188  /*
3189  * Partition checking is not supported with the current filesystem,
3190  * so disable FS checks on it.
3191  */
3192  PartEntry->NeedsCheck = FALSE;
3193 
3195  sizeof(Buffer),
3196  "Setup is currently unable to check a partition formatted in %S.\n"
3197  "\n"
3198  " \x07 Press ENTER to continue Setup.\n"
3199  " \x07 Press F3 to quit Setup.",
3200  PartEntry->FileSystem);
3201 
3205 
3206  while (TRUE)
3207  {
3208  CONSOLE_ConInKey(Ir);
3209 
3210  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
3211  Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
3212  {
3213  if (ConfirmQuit(Ir))
3214  return QUIT_PAGE;
3215  else
3216  return CHECK_FILE_SYSTEM_PAGE;
3217  }
3218  else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
3219  {
3220  return CHECK_FILE_SYSTEM_PAGE;
3221  }
3222  }
3223  }
3224  else if (!NT_SUCCESS(Status))
3225  {
3226  DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", Status);
3227 
3229  sizeof(Buffer),
3230  "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
3231  Status);
3232 
3235  Ir, POPUP_WAIT_ENTER);
3236  }
3237 
3238  PartEntry->NeedsCheck = FALSE;
3239  return CHECK_FILE_SYSTEM_PAGE;
3240 }
return STATUS_NOT_SUPPORTED
ULONG PartitionNumber
Definition: partlist.h:55
#define POPUP_WAIT_NONE
Definition: usetup.h:123
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
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
#define VK_RETURN
Definition: winuser.h:2191
WORD wVirtualKeyCode
Definition: wincon.h:242
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
BOOLEAN GetNextUncheckedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:4094
Definition: bufpool.h:45
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
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
Status
Definition: gdiplustypes.h:24
UCHAR PartitionType
Definition: partlist.h:53
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:60
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2247
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
#define STRING_CONTINUE
Definition: mui.h:148
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
BOOLEAN NeedsCheck
Definition: partlist.h:77
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
NTSTATUS DoChkdsk(IN PPARTENTRY PartEntry)
Definition: chkdsk.c:57
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
#define STRING_QUITCONTINUE
Definition: mui.h:149
BOOLEAN IsPartitioned
Definition: partlist.h:66

Referenced by RunUSetup().

◆ ComputerSettingsPage()

static PAGE_NUMBER ComputerSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1407 of file usetup.c.

1408 {
1409  GENERIC_LIST_UI ListUi;
1411 
1412  InitGenericListUi(&ListUi, USetupData.ComputerList, GetSettingDescription);
1413  DrawGenericList(&ListUi,
1414  2, 18,
1415  xScreen - 3,
1416  yScreen - 3);
1417 
1418  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1419 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
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:1342
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 2433 of file usetup.c.

2434 {
2436 
2437  while (TRUE)
2438  {
2439  CONSOLE_ConInKey(Ir);
2440 
2441  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2442  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2443  {
2444  if (ConfirmQuit(Ir))
2445  return QUIT_PAGE;
2446 
2447  break;
2448  }
2449  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2450  {
2451  return DELETE_PARTITION_PAGE;
2452  }
2453  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2454  {
2455  return SELECT_PARTITION_PAGE;
2456  }
2457  }
2458 
2460 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
#define VK_ESCAPE
Definition: winuser.h:2204
#define VK_RETURN
Definition: winuser.h:2191
WORD wVirtualKeyCode
Definition: wincon.h:242
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
#define VK_F3
Definition: winuser.h:2247
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

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:123
#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
_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:275
#define VK_F3
Definition: winuser.h:2247
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
#define NULL
Definition: types.h:112
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

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 2198 of file usetup.c.

2199 {
2200  PPARTENTRY PartEntry;
2201  PDISKENTRY DiskEntry;
2202  BOOLEAN Quit;
2203  BOOLEAN Cancel;
2204  ULONG MaxSize;
2205  ULONGLONG PartSize;
2207  WCHAR InputBuffer[50];
2208  CHAR LineBuffer[100];
2209 
2210  if (PartitionList == NULL || CurrentPartition == NULL)
2211  {
2212  /* FIXME: show an error dialog */
2213  return QUIT_PAGE;
2214  }
2215 
2216  PartEntry = CurrentPartition;
2217  DiskEntry = CurrentPartition->DiskEntry;
2218 
2220 
2222 
2223  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2225  LineBuffer);
2226 
2228 
2229 #if 0
2230  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2231  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2232 #endif
2233 
2235 
2236  PartEntry = CurrentPartition;
2237  while (TRUE)
2238  {
2239  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2240 
2241  if (MaxSize > PARTITION_MAXSIZE)
2242  MaxSize = PARTITION_MAXSIZE;
2243 
2244  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2245  MaxSize, InputBuffer, &Quit, &Cancel);
2246 
2247  if (Quit)
2248  {
2249  if (ConfirmQuit(Ir))
2250  return QUIT_PAGE;
2251 
2252  break;
2253  }
2254  else if (Cancel)
2255  {
2256  return SELECT_PARTITION_PAGE;
2257  }
2258  else
2259  {
2260  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2261 
2262  if (PartSize < 1)
2263  {
2264  /* Too small */
2265  continue;
2266  }
2267 
2268  if (PartSize > MaxSize)
2269  {
2270  /* Too large */
2271  continue;
2272  }
2273 
2274  /* Convert to bytes */
2275  if (PartSize == MaxSize)
2276  {
2277  /* Use all of the unpartitioned disk space */
2278  SectorCount = PartEntry->SectorCount.QuadPart;
2279  }
2280  else
2281  {
2282  /* Calculate the sector count from the size in MB */
2283  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2284 
2285  /* But never get larger than the unpartitioned disk space */
2286  if (SectorCount > PartEntry->SectorCount.QuadPart)
2287  SectorCount = PartEntry->SectorCount.QuadPart;
2288  }
2289 
2290  DPRINT ("Partition size: %I64u bytes\n", PartSize);
2291 
2294  SectorCount);
2295 
2296  return SELECT_PARTITION_PAGE;
2297  }
2298  }
2299 
2301 }
#define STRING_HDDSIZE
Definition: mui.h:141
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:320
#define STRING_CREATEPARTITION
Definition: mui.h:142
#define TRUE
Definition: types.h:120
ULARGE_INTEGER SectorCount
Definition: partlist.h:50
char CHAR
Definition: xmlstorage.h:175
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:601
__MINGW_EXTENSION _Check_return_ _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:301
#define MB
Definition: setuplib.h:56
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1886
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
unsigned char BOOLEAN
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
void Cancel(int sigNum)
Definition: shell.c:481
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
ULONG BytesPerSector
Definition: partlist.h:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
static PPARTLIST PartitionList
Definition: usetup.c:73
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
ULONG SectorCount
Definition: part_xbox.c:31
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
#define STRING_HDINFOPARTCREATE_1
Definition: mui.h:172
#define NULL
Definition: types.h:112
#define PARTITION_MAXSIZE
Definition: usetup.c:1883
BOOLEAN CreateExtendedPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount)
Definition: partlist.c:2850
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:132
#define DPRINT
Definition: sndvol32.h:71
#define STRING_CHOOSE_NEW_EXTENDED_PARTITION
Definition: mui.h:139

Referenced by RunUSetup().

◆ CreateLogicalPartitionPage()

static PAGE_NUMBER CreateLogicalPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2315 of file usetup.c.

2316 {
2317  PPARTENTRY PartEntry;
2318  PDISKENTRY DiskEntry;
2319  BOOLEAN Quit;
2320  BOOLEAN Cancel;
2321  ULONG MaxSize;
2322  ULONGLONG PartSize;
2324  WCHAR InputBuffer[50];
2325  CHAR LineBuffer[100];
2326 
2327  if (PartitionList == NULL || CurrentPartition == NULL)
2328  {
2329  /* FIXME: show an error dialog */
2330  return QUIT_PAGE;
2331  }
2332 
2333  PartEntry = CurrentPartition;
2334  DiskEntry = CurrentPartition->DiskEntry;
2335 
2337 
2339 
2340  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2342  LineBuffer);
2343 
2345 
2346 #if 0
2347  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2348  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2349 #endif
2350 
2352 
2353  PartEntry = CurrentPartition;
2354  while (TRUE)
2355  {
2356  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2357 
2358  if (MaxSize > PARTITION_MAXSIZE)
2359  MaxSize = PARTITION_MAXSIZE;
2360 
2361  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2362  MaxSize, InputBuffer, &Quit, &Cancel);
2363 
2364  if (Quit)
2365  {
2366  if (ConfirmQuit(Ir))
2367  return QUIT_PAGE;
2368 
2369  break;
2370  }
2371  else if (Cancel)
2372  {
2373  return SELECT_PARTITION_PAGE;
2374  }
2375  else
2376  {
2377  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2378 
2379  if (PartSize < 1)
2380  {
2381  /* Too small */
2382  continue;
2383  }
2384 
2385  if (PartSize > MaxSize)
2386  {
2387  /* Too large */
2388  continue;
2389  }
2390 
2391  /* Convert to bytes */
2392  if (PartSize == MaxSize)
2393  {
2394  /* Use all of the unpartitioned disk space */
2395  SectorCount = PartEntry->SectorCount.QuadPart;
2396  }
2397  else
2398  {
2399  /* Calculate the sector count from the size in MB */
2400  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2401 
2402  /* But never get larger than the unpartitioned disk space */
2403  if (SectorCount > PartEntry->SectorCount.QuadPart)
2404  SectorCount = PartEntry->SectorCount.QuadPart;
2405  }
2406 
2407  DPRINT("Partition size: %I64u bytes\n", PartSize);
2408 
2411  SectorCount,
2412  FALSE);
2413 
2414  return SELECT_PARTITION_PAGE;
2415  }
2416  }
2417 
2419 }
#define STRING_HDDSIZE
Definition: mui.h:141
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:320
#define STRING_CREATEPARTITION
Definition: mui.h:142
#define STRING_CHOOSE_NEW_LOGICAL_PARTITION
Definition: mui.h:140
#define TRUE
Definition: types.h:120
ULARGE_INTEGER SectorCount
Definition: partlist.h:50
char CHAR
Definition: xmlstorage.h:175
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:601
__MINGW_EXTENSION _Check_return_ _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:301
#define MB
Definition: setuplib.h:56
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1886
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
BOOLEAN CreateLogicalPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:2904
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
void Cancel(int sigNum)
Definition: shell.c:481
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
ULONG BytesPerSector
Definition: partlist.h:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
static PPARTLIST PartitionList
Definition: usetup.c:73
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
ULONG SectorCount
Definition: part_xbox.c:31
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
#define STRING_HDINFOPARTCREATE_1
Definition: mui.h:172
#define NULL
Definition: types.h:112
#define PARTITION_MAXSIZE
Definition: usetup.c:1883
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:132
#define DPRINT
Definition: sndvol32.h:71

Referenced by RunUSetup().

◆ CreatePrimaryPartitionPage()

static PAGE_NUMBER CreatePrimaryPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2080 of file usetup.c.

2081 {
2082  PPARTENTRY PartEntry;
2083  PDISKENTRY DiskEntry;
2084  BOOLEAN Quit;
2085  BOOLEAN Cancel;
2086  ULONG MaxSize;
2087  ULONGLONG PartSize;
2089  WCHAR InputBuffer[50];
2090  CHAR LineBuffer[100];
2091 
2092  if (PartitionList == NULL || CurrentPartition == NULL)
2093  {
2094  /* FIXME: show an error dialog */
2095  return QUIT_PAGE;
2096  }
2097 
2098  PartEntry = CurrentPartition;
2099  DiskEntry = CurrentPartition->DiskEntry;
2100 
2102 
2104 
2105  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2107  LineBuffer);
2108 
2110 
2111 #if 0
2112  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2113  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2114 #endif
2115 
2117 
2118  PartEntry = CurrentPartition;
2119  while (TRUE)
2120  {
2121  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2122 
2123  if (MaxSize > PARTITION_MAXSIZE)
2124  MaxSize = PARTITION_MAXSIZE;
2125 
2126  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2127  MaxSize, InputBuffer, &Quit, &Cancel);
2128 
2129  if (Quit)
2130  {
2131  if (ConfirmQuit(Ir))
2132  return QUIT_PAGE;
2133 
2134  break;
2135  }
2136  else if (Cancel)
2137  {
2138  return SELECT_PARTITION_PAGE;
2139  }
2140  else
2141  {
2142  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2143 
2144  if (PartSize < 1)
2145  {
2146  /* Too small */
2147  continue;
2148  }
2149 
2150  if (PartSize > MaxSize)
2151  {
2152  /* Too large */
2153  continue;
2154  }
2155 
2156  /* Convert to bytes */
2157  if (PartSize == MaxSize)
2158  {
2159  /* Use all of the unpartitioned disk space */
2160  SectorCount = PartEntry->SectorCount.QuadPart;
2161  }
2162  else
2163  {
2164  /* Calculate the sector count from the size in MB */
2165  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2166 
2167  /* But never get larger than the unpartitioned disk space */
2168  if (SectorCount > PartEntry->SectorCount.QuadPart)
2169  SectorCount = PartEntry->SectorCount.QuadPart;
2170  }
2171 
2172  DPRINT ("Partition size: %I64u bytes\n", PartSize);
2173 
2176  SectorCount,
2177  FALSE);
2178 
2179  return SELECT_PARTITION_PAGE;
2180  }
2181  }
2182 
2184 }
#define STRING_HDDSIZE
Definition: mui.h:141
SHORT xScreen
Definition: consup.c:39
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:320
#define STRING_CREATEPARTITION
Definition: mui.h:142
#define TRUE
Definition: types.h:120
ULARGE_INTEGER SectorCount
Definition: partlist.h:50
char CHAR
Definition: xmlstorage.h:175
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:601
__MINGW_EXTENSION _Check_return_ _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:301
#define STRING_CHOOSENEWPARTITION
Definition: mui.h:138
#define MB
Definition: setuplib.h:56
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1886
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
void Cancel(int sigNum)
Definition: shell.c:481
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
ULONG BytesPerSector
Definition: partlist.h:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
static PPARTLIST PartitionList
Definition: usetup.c:73
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
ULONG SectorCount
Definition: part_xbox.c:31
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
BOOLEAN CreatePrimaryPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:2786
#define STRING_HDINFOPARTCREATE_1
Definition: mui.h:172
#define NULL
Definition: types.h:112
#define PARTITION_MAXSIZE
Definition: usetup.c:1883
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:132
#define DPRINT
Definition: sndvol32.h:71

Referenced by RunUSetup().

◆ DeletePartitionPage()

static PAGE_NUMBER DeletePartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2474 of file usetup.c.

2475 {
2476  PPARTENTRY PartEntry;
2477  PDISKENTRY DiskEntry;
2478  CHAR LineBuffer[100];
2479 
2480  if (PartitionList == NULL || CurrentPartition == NULL)
2481  {
2482  /* FIXME: show an error dialog */
2483  return QUIT_PAGE;
2484  }
2485 
2486  PartEntry = CurrentPartition;
2487  DiskEntry = CurrentPartition->DiskEntry;
2488 
2490 
2491  PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2492  CONSOLE_PrintTextXY(6, 10, " %s", LineBuffer);
2493 
2494  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2496  LineBuffer);
2497 
2498  while (TRUE)
2499  {
2500  CONSOLE_ConInKey(Ir);
2501 
2502  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2503  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2504  {
2505  if (ConfirmQuit(Ir))
2506  return QUIT_PAGE;
2507 
2508  break;
2509  }
2510  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2511  {
2512  return SELECT_PARTITION_PAGE;
2513  }
2514  else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
2515  {
2518  &CurrentPartition);
2519  return SELECT_PARTITION_PAGE;
2520  }
2521  }
2522 
2523  return DELETE_PARTITION_PAGE;
2524 }
BOOLEAN DeletePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, OUT PPARTENTRY *FreeRegion OPTIONAL)
Definition: partlist.c:3047
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:601
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:301
#define VK_ESCAPE
Definition: winuser.h:2204
WORD wVirtualKeyCode
Definition: wincon.h:242
#define STRING_HDINFOPARTDELETE_1
Definition: mui.h:173
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2247
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID PartitionDescription(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:148
#define NULL
Definition: types.h:112
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

Referenced by RunUSetup().

◆ DeviceSettingsPage()

static PAGE_NUMBER DeviceSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1210 of file usetup.c.

1211 {
1212  static ULONG Line = 16;
1213 
1214  /* Initialize the computer settings list */
1215  if (USetupData.ComputerList == NULL)
1216  {
1217  USetupData.ComputerList = CreateComputerTypeList(USetupData.SetupInf);
1218  if (USetupData.ComputerList == NULL)
1219  {
1221  return QUIT_PAGE;
1222  }
1223  }
1224 
1225  /* Initialize the display settings list */
1226  if (USetupData.DisplayList == NULL)
1227  {
1228  USetupData.DisplayList = CreateDisplayDriverList(USetupData.SetupInf);
1229  if (USetupData.DisplayList == NULL)
1230  {
1232  return QUIT_PAGE;
1233  }
1234  }
1235 
1236  /* Initialize the keyboard settings list */
1237  if (USetupData.KeyboardList == NULL)
1238  {
1239  USetupData.KeyboardList = CreateKeyboardDriverList(USetupData.SetupInf);
1240  if (USetupData.KeyboardList == NULL)
1241  {
1243  return QUIT_PAGE;
1244  }
1245  }
1246 
1247  /* Initialize the keyboard layout list */
1248  if (USetupData.LayoutList == NULL)
1249  {
1251  if (USetupData.LayoutList == NULL)
1252  {
1253  /* FIXME: report error */
1255  return QUIT_PAGE;
1256  }
1257  }
1258 
1259  if (RepairUpdateFlag)
1260  return SELECT_PARTITION_PAGE;
1261 
1262  // if (IsUnattendedSetup)
1263  // return SELECT_PARTITION_PAGE;
1264 
1266 
1271 
1272  CONSOLE_InvertTextXY(24, Line, 48, 1);
1273 
1274  while (TRUE)
1275  {
1276  CONSOLE_ConInKey(Ir);
1277 
1278  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1279  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1280  {
1281  CONSOLE_NormalTextXY(24, Line, 48, 1);
1282 
1283  if (Line == 14)
1284  Line = 16;
1285  else if (Line == 16)
1286  Line = 11;
1287  else
1288  Line++;
1289 
1290  CONSOLE_InvertTextXY(24, Line, 48, 1);
1291  }
1292  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1293  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1294  {
1295  CONSOLE_NormalTextXY(24, Line, 48, 1);
1296 
1297  if (Line == 11)
1298  Line = 16;
1299  else if (Line == 16)
1300  Line = 14;
1301  else
1302  Line--;
1303 
1304  CONSOLE_InvertTextXY(24, Line, 48, 1);
1305  }
1306  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1307  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1308  {
1309  if (ConfirmQuit(Ir))
1310  return QUIT_PAGE;
1311 
1312  break;
1313  }
1314  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1315  {
1316  if (Line == 11)
1317  return COMPUTER_SETTINGS_PAGE;
1318  else if (Line == 12)
1319  return DISPLAY_SETTINGS_PAGE;
1320  else if (Line == 13)
1321  return KEYBOARD_SETTINGS_PAGE;
1322  else if (Line == 14)
1323  return LAYOUT_SETTINGS_PAGE;
1324  else if (Line == 16)
1325  return SELECT_PARTITION_PAGE;
1326  }
1327  }
1328 
1329  return DEVICE_SETTINGS_PAGE;
1330 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
#define VK_DOWN
Definition: winuser.h:2217
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1230
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:298
WORD wVirtualKeyCode
Definition: wincon.h:242
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:276
#define VK_UP
Definition: winuser.h:2215
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:708
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:275
#define VK_F3
Definition: winuser.h:2247
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:237
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:524
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
#define NULL
Definition: types.h:112
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
unsigned int ULONG
Definition: retypes.h:1
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1093
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
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 1433 of file usetup.c.

1434 {
1435  GENERIC_LIST_UI ListUi;
1437 
1438  InitGenericListUi(&ListUi, USetupData.DisplayList, GetSettingDescription);
1439  DrawGenericList(&ListUi,
1440  2, 18,
1441  xScreen - 3,
1442  yScreen - 3);
1443 
1444  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1445 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
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:1342
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  CharUpperLeftCorner, // '+',
179  1,
180  coPos,
181  &Written);
182 
183  /* Draw upper edge */
184  coPos.X = xLeft + 1;
185  coPos.Y = yTop;
187  CharHorizontalLine, // '-',
188  Width - 2,
189  coPos,
190  &Written);
191 
192  /* Draw upper right corner */
193  coPos.X = xLeft + Width - 1;
194  coPos.Y = yTop;
196  CharUpperRightCorner, // '+',
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  CharVerticalLine, // '|',
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  CharVerticalLine, // '|',
221  1,
222  coPos,
223  &Written);
224  }
225 
226  /* Draw lower left corner */
227  coPos.X = xLeft;
228  coPos.Y = yTop + Height - 1;
230  CharLowerLeftCorner, // '+',
231  1,
232  coPos,
233  &Written);
234 
235  /* Draw lower edge */
236  coPos.X = xLeft + 1;
237  coPos.Y = yTop + Height - 1;
239  CharHorizontalLine, // '-',
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  CharLowerRightCorner, // '+',
249  1,
250  coPos,
251  &Written);
252 }
CHAR CharUpperRightCorner
Definition: mui.c:42
CHAR CharHorizontalLine
Definition: mui.c:39
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
CHAR CharVerticalLine
Definition: mui.c:40
CHAR CharLowerLeftCorner
Definition: mui.c:43
_In_ HFONT _Out_ PUINT Height
Definition: font.h:124
CHAR CharLowerRightCorner
Definition: mui.c:44
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:560
HANDLE StdOutput
Definition: consup.c:37
CHAR CharUpperLeftCorner
Definition: mui.c:41
ULONG X
Definition: bl.h:1339
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: bl.h:1337
ULONG Y
Definition: bl.h:1340

Referenced by PopupError(), and ShowPartitionSizeInputBox().

◆ FileCopyCallback()

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

Definition at line 3591 of file usetup.c.

3595 {
3596  PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
3597  PFILEPATHS_W FilePathInfo;
3598  PCWSTR SrcFileName, DstFileName;
3599 
3600  switch (Notification)
3601  {
3603  {
3604  CopyContext->TotalOperations = (ULONG)Param2;
3605  CopyContext->CompletedOperations = 0;
3606  ProgressSetStepCount(CopyContext->ProgressBar,
3607  CopyContext->TotalOperations);
3608  SetupUpdateMemoryInfo(CopyContext, TRUE);
3609  break;
3610  }
3611 
3615  {
3616  FilePathInfo = (PFILEPATHS_W)Param1;
3617 
3619  {
3620  /* Display delete message */
3621  ASSERT(Param2 == FILEOP_DELETE);
3622 
3623  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3624  if (DstFileName) ++DstFileName;
3625  else DstFileName = FilePathInfo->Target;
3626 
3628  DstFileName);
3629  }
3631  {
3632  /* Display move/rename message */
3633  ASSERT(Param2 == FILEOP_RENAME);
3634 
3635  SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
3636  if (SrcFileName) ++SrcFileName;
3637  else SrcFileName = FilePathInfo->Source;
3638 
3639  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3640  if (DstFileName) ++DstFileName;
3641  else DstFileName = FilePathInfo->Target;
3642 
3643  if (!wcsicmp(SrcFileName, DstFileName))
3644  Param2 = STRING_MOVING;
3645  else
3646  Param2 = STRING_RENAMING;
3647 
3649  SrcFileName, DstFileName);
3650  }
3652  {
3653  /* Display copy message */
3654  ASSERT(Param2 == FILEOP_COPY);
3655 
3656  /* NOTE: When extracting from CABs the Source is the CAB name */
3657  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3658  if (DstFileName) ++DstFileName;
3659  else DstFileName = FilePathInfo->Target;
3660 
3662  DstFileName);
3663 #ifdef __REACTOS__ /* HACK */
3664  DoWatchDestFileName(DstFileName);
3665 #endif
3666  }
3667 
3668  SetupUpdateMemoryInfo(CopyContext, FALSE);
3669  break;
3670  }
3671 
3673  {
3674  FilePathInfo = (PFILEPATHS_W)Param1;
3675 
3676  DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
3677  FilePathInfo->Target, FilePathInfo->Win32Error);
3678  return FILEOP_SKIP;
3679  }
3680 
3683  case SPFILENOTIFY_ENDCOPY:
3684  {
3685  CopyContext->CompletedOperations++;
3686 
3687  /* SYSREG checkpoint */
3688  if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
3689  DPRINT1("CHECKPOINT:HALF_COPIED\n");
3690 
3691  ProgressNextStep(CopyContext->ProgressBar);
3692  SetupUpdateMemoryInfo(CopyContext, FALSE);
3693  break;
3694  }
3695  }
3696 
3697  return FILEOP_DOIT;
3698 }
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:154
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define L(x)
Definition: ntvdm.h:50
#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
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define STRING_RENAMING
Definition: mui.h:153
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define ASSERT(a)
Definition: mode.c:44
#define SPFILENOTIFY_COPYERROR
Definition: fileqsup.h:37
#define STRING_MOVING
Definition: mui.h:152
#define wcsicmp
Definition: compat.h:15
ULONG CompletedOperations
Definition: reactos.c:981
#define wcsrchr
Definition: compat.h:16
PCWSTR Source
Definition: fileqsup.h:61
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:113
static VOID SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, IN BOOLEAN First)
Definition: usetup.c:3563
#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:151
PPROGRESSBAR ProgressBar
Definition: usetup.c:3558
#define FILEOP_DELETE
Definition: fileqsup.h:44

Referenced by FileCopyPage().

◆ FileCopyPage()

static PAGE_NUMBER FileCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 3714 of file usetup.c.

3715 {
3716  COPYCONTEXT CopyContext;
3717  UINT MemBarWidth;
3718 
3720 
3721  /* Create context for the copy process */
3722  CopyContext.TotalOperations = 0;
3723  CopyContext.CompletedOperations = 0;
3724 
3725  /* Create the progress bar as well */
3726  CopyContext.ProgressBar = CreateProgressBar(13,
3727  26,
3728  xScreen - 13,
3729  yScreen - 20,
3730  10,
3731  24,
3732  TRUE,
3734 
3735  // fit memory bars to screen width, distribute them uniform
3736  MemBarWidth = (xScreen - 26) / 5;
3737  MemBarWidth -= MemBarWidth % 2; // make even
3738  /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
3739  /* Create the paged pool progress bar */
3740  CopyContext.MemoryBars[0] = CreateProgressBar(13,
3741  40,
3742  13 + MemBarWidth,
3743  43,
3744  13,
3745  44,
3746  FALSE,
3747  "Kernel Pool");
3748 
3749  /* Create the non paged pool progress bar */
3750  CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (MemBarWidth / 2),
3751  40,
3752  (xScreen / 2) + (MemBarWidth / 2),
3753  43,
3754  (xScreen / 2)- (MemBarWidth / 2),
3755  44,
3756  FALSE,
3757  "Kernel Cache");
3758 
3759  /* Create the global memory progress bar */
3760  CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - MemBarWidth,
3761  40,
3762  xScreen - 13,
3763  43,
3764  xScreen - 13 - MemBarWidth,
3765  44,
3766  FALSE,
3767  "Free Memory");
3768 
3769  /* Do the file copying */
3770  DoFileCopy(&USetupData, FileCopyCallback, &CopyContext);
3771 
3772  /* If we get here, we're done, so cleanup the progress bar */
3773  DestroyProgressBar(CopyContext.ProgressBar);
3774  DestroyProgressBar(CopyContext.MemoryBars[0]);
3775  DestroyProgressBar(CopyContext.MemoryBars[1]);
3776  DestroyProgressBar(CopyContext.MemoryBars[2]);
3777 
3778  /* Create the $winnt$.inf file */
3780 
3781  /* Go display the next page */
3782  return REGISTRY_PAGE;
3783 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#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
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
PPROGRESSBAR MemoryBars[4]
Definition: usetup.c:3559
ULONG CompletedOperations
Definition: reactos.c:981
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: usetup.c:3591
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:3558
#define STRING_SETUPCOPYINGFILES
Definition: mui.h:155

Referenced by RunUSetup().

◆ FlushPage()

static PAGE_NUMBER FlushPage ( PINPUT_RECORD  Ir)
static

Definition at line 4446 of file usetup.c.

4447 {
4449  return REBOOT_PAGE;
4450 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170

Referenced by RunUSetup().

◆ FormatPartitionPage()

static PAGE_NUMBER FormatPartitionPage ( PINPUT_RECORD  Ir)
static

HACK!!

Definition at line 3010 of file usetup.c.

3011 {
3012  NTSTATUS Status;
3013  PPARTENTRY PartEntry;
3014  PDISKENTRY DiskEntry;
3015  PFILE_SYSTEM_ITEM SelectedFileSystem;
3016  WCHAR PathBuffer[MAX_PATH];
3017  CHAR Buffer[MAX_PATH];
3018 
3019  DPRINT("FormatPartitionPage()\n");
3020 
3022 
3023  if (PartitionList == NULL || TempPartition == NULL)
3024  {
3025  /* FIXME: show an error dialog */
3026  return QUIT_PAGE;
3027  }
3028 
3029  PartEntry = TempPartition;
3030  DiskEntry = TempPartition->DiskEntry;
3031 
3032  ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
3033 
3034  SelectedFileSystem = FileSystemList->Selected;
3035  ASSERT(SelectedFileSystem && SelectedFileSystem->FileSystem);
3036 
3037  while (TRUE)
3038  {
3039  if (!IsUnattendedSetup)
3040  CONSOLE_ConInKey(Ir);
3041 
3042  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3043  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3044  {
3045  if (ConfirmQuit(Ir))
3046  {
3047  /* Reset the filesystem list */
3049  return QUIT_PAGE;
3050  }
3051 
3052  break;
3053  }
3054  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
3055  {
3056  /*
3057  * Remove the "Press ENTER to continue" message prompt when the ENTER
3058  * key is pressed as the user wants to begin the partition formatting.
3059  */
3062 
3063  /* Format the partition */
3064  Status = DoFormat(PartEntry,
3065  SelectedFileSystem->FileSystem,
3066  SelectedFileSystem->QuickFormat);
3068  {
3070 
3071  /* Reset the filesystem list */
3073  return QUIT_PAGE;
3074  }
3075  else if (Status == STATUS_UNRECOGNIZED_VOLUME)
3076  {
3077  /* FIXME: show an error dialog */
3078  // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
3079 
3080  /* Reset the filesystem list */
3082  return QUIT_PAGE;
3083  }
3084  else if (Status == STATUS_NOT_SUPPORTED)
3085  {
3087  sizeof(Buffer),
3088  "Setup is currently unable to format a partition in %S.\n"
3089  "\n"
3090  " \x07 Press ENTER to continue Setup.\n"
3091  " \x07 Press F3 to quit Setup.",
3092  SelectedFileSystem->FileSystem);
3093 
3097 
3098  while (TRUE)
3099  {
3100  CONSOLE_ConInKey(Ir);
3101 
3102  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
3103  Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
3104  {
3105  if (ConfirmQuit(Ir))
3106  {
3107  /* Reset the filesystem list */
3109  return QUIT_PAGE;
3110  }
3111  else
3112  {
3113  return SELECT_FILE_SYSTEM_PAGE;
3114  }
3115  }
3116  else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
3117  {
3118  return SELECT_FILE_SYSTEM_PAGE;
3119  }
3120  }
3121  }
3122  else if (!NT_SUCCESS(Status))
3123  {
3125  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3126  L"\\Device\\Harddisk%lu\\Partition%lu",
3127  DiskEntry->DiskNumber,
3128  PartEntry->PartitionNumber);
3129 
3130  DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status);
3132 
3133  /* Reset the filesystem list */
3135  return QUIT_PAGE;
3136  }
3137 
3138  return SELECT_FILE_SYSTEM_PAGE;
3139  }
3140  }
3141 
3142  return FORMAT_PARTITION_PAGE;
3143 }
return STATUS_NOT_SUPPORTED
ULONG PartitionNumber
Definition: partlist.h:55
#define TEXT_TYPE_REGULAR
Definition: consup.h:39
NTSTATUS DoFormat(IN PPARTENTRY PartEntry, IN PCWSTR FileSystemName, IN BOOLEAN QuickFormat)
Definition: format.c:92
#define POPUP_WAIT_NONE
Definition: usetup.h:123
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2528
static PPARTENTRY TempPartition
Definition: usetup.c:82
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#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
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:111
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define TEXT_ID_FORMAT_PROMPT
Definition: mui.h:129
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:79
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:124
#define VK_RETURN
Definition: winuser.h:2191
WORD wVirtualKeyCode
Definition: wincon.h:242
#define L(x)
Definition: ntvdm.h:50
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
PFILE_SYSTEM_ITEM Selected
Definition: fslist.h:42
VOID MUIClearStyledText(IN ULONG Page, IN INT TextID, IN INT Flags)
Definition: mui.c:399
Definition: bufpool.h:45
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
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
Status
Definition: gdiplustypes.h:24
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
#define ASSERT(a)
Definition: mode.c:44
__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:275
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2247
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:237
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
BOOLEAN QuickFormat
Definition: fslist.h:35
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define STRING_PLEASEWAIT
Definition: mui.h:132
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
#define DPRINT
Definition: sndvol32.h:71
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
#define STRING_QUITCONTINUE
Definition: mui.h:149
#define STATUS_PARTITION_FAILURE
Definition: ntstatus.h:604
BOOLEAN IsPartitioned
Definition: partlist.h:66

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:58
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
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
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
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 1342 of file usetup.c.

1345 {
1346  while (TRUE)
1347  {
1348  CONSOLE_ConInKey(Ir);
1349 
1350  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1351  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1352  {
1353  ScrollDownGenericList(ListUi);
1354  }
1355  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1356  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1357  {
1358  ScrollUpGenericList(ListUi);
1359  }
1360  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1361  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1362  {
1363  ScrollPageDownGenericList(ListUi);
1364  }
1365  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1366  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1367  {
1368  ScrollPageUpGenericList(ListUi);
1369  }
1370  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1371  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1372  {
1373  if (ConfirmQuit(Ir))
1374  return QUIT_PAGE;
1375  else
1376  RedrawGenericList(ListUi);
1377  }
1378  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1379  {
1380  RestoreGenericListUiState(ListUi);
1381  return nextPage; // Use some "prevPage;" instead?
1382  }
1383  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1384  {
1385  return nextPage;
1386  }
1387  else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1388  {
1389  /* a-z */
1391  }
1392  }
1393 }
#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:2217
#define VK_PRIOR
Definition: winuser.h:2210
#define VK_ESCAPE
Definition: winuser.h:2204
#define VK_NEXT
Definition: winuser.h:2211
WORD wVirtualKeyCode
Definition: wincon.h:242
VOID ScrollDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:376
#define VK_UP
Definition: winuser.h:2215
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:275
#define VK_F3
Definition: winuser.h:2247
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

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

◆ InstallDirectoryPage()

static PAGE_NUMBER InstallDirectoryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3300 of file usetup.c.

3301 {
3302  NTSTATUS Status;
3303  ULONG Length, Pos;
3304  WCHAR c;
3305  WCHAR InstallDir[MAX_PATH];
3306 
3307  /* We do not need the filesystem list anymore */
3309 
3310  if (PartitionList == NULL || InstallPartition == NULL)
3311  {
3312  /* FIXME: show an error dialog */
3313  return QUIT_PAGE;
3314  }
3315 
3316  // if (IsUnattendedSetup)
3317  if (RepairUpdateFlag)
3318  wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
3319  else if (USetupData.InstallationDirectory[0])
3320  wcscpy(InstallDir, USetupData.InstallationDirectory);
3321  else
3322  wcscpy(InstallDir, L"\\ReactOS");
3323 
3324  /*
3325  * Check the validity of the predefined 'InstallDir'. If we are either
3326  * in unattended setup or in update/repair mode, and the installation path
3327  * is valid, just perform the installation. Otherwise (either in the case
3328  * of an invalid path, or we are in regular setup), display the UI and allow
3329  * the user to specify a new installation path.
3330  */
3331  if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
3332  {
3334  if (!NT_SUCCESS(Status))
3335  {
3336  DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
3338  return QUIT_PAGE;
3339  }
3340 
3341  /*
3342  * Check whether the user attempts to install ReactOS within the
3343  * installation source directory, or in a subdirectory thereof.
3344  * If so, fail with an error.
3345  */
3346  if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
3347  {
3349  return INSTALL_DIRECTORY_PAGE;
3350  }
3351 
3352  return PREPARE_COPY_PAGE;
3353  }
3354 
3355  Length = wcslen(InstallDir);
3356  Pos = Length;
3357 
3359  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3360  CONSOLE_SetCursorXY(8 + Pos, 11);
3362 
3363  while (TRUE)
3364  {
3365  CONSOLE_ConInKey(Ir);
3366 
3367  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3368  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3369  {
3371 
3372  if (ConfirmQuit(Ir))
3373  return QUIT_PAGE;
3374 
3376  break;
3377  }
3378  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3379  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
3380  {
3381  if (Pos < Length)
3382  {
3383  memmove(&InstallDir[Pos],
3384  &InstallDir[Pos + 1],
3385  (Length - Pos - 1) * sizeof(WCHAR));
3386  InstallDir[Length - 1] = UNICODE_NULL;
3387 
3388  Length--;
3389  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3390  CONSOLE_SetCursorXY(8 + Pos, 11);
3391  }
3392  }
3393  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3394  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3395  {
3396  Pos = 0;
3397  CONSOLE_SetCursorXY(8 + Pos, 11);
3398  }
3399  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3400  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3401  {
3402  Pos = Length;
3403  CONSOLE_SetCursorXY(8 + Pos, 11);
3404  }
3405  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3406  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
3407  {
3408  if (Pos > 0)
3409  {
3410  Pos--;
3411  CONSOLE_SetCursorXY(8 + Pos, 11);
3412  }
3413  }
3414  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3415  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
3416  {
3417  if (Pos < Length)
3418  {
3419  Pos++;
3420  CONSOLE_SetCursorXY(8 + Pos, 11);
3421  }
3422  }
3423  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3424  {
3426 
3427  /*
3428  * Check for the validity of the installation directory and pop up
3429  * an error if it is not the case. Then the user can fix its input.
3430  */
3431  if (!IsValidPath(InstallDir))
3432  {
3434  return INSTALL_DIRECTORY_PAGE;
3435  }
3436 
3438  if (!NT_SUCCESS(Status))
3439  {
3440  DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
3442  return QUIT_PAGE;
3443  }
3444 
3445  /*
3446  * Check whether the user attempts to install ReactOS within the
3447  * installation source directory, or in a subdirectory thereof.
3448  * If so, fail with an error.
3449  */
3450  if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
3451  {
3453  return INSTALL_DIRECTORY_PAGE;
3454  }
3455 
3456  return PREPARE_COPY_PAGE;
3457  }
3458  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3459  {
3460  if (Pos > 0)
3461  {
3462  if (Pos < Length)
3463  memmove(&InstallDir[Pos - 1],
3464  &InstallDir[Pos],
3465  (Length - Pos) * sizeof(WCHAR));
3466  InstallDir[Length - 1] = UNICODE_NULL;
3467 
3468  Pos--;
3469  Length--;
3470  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3471  CONSOLE_SetCursorXY(8 + Pos, 11);
3472  }
3473  }
3474  else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3475  {
3476  if (Length < 50)
3477  {
3479  if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
3480  {
3481  if (Pos < Length)
3482  memmove(&InstallDir[Pos + 1],
3483  &InstallDir[Pos],
3484  (Length - Pos) * sizeof(WCHAR));
3485  InstallDir[Length + 1] = UNICODE_NULL;
3486  InstallDir[Pos] = c;
3487 
3488  Pos++;
3489  Length++;
3490  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3491  CONSOLE_SetCursorXY(8 + Pos, 11);
3492  }
3493  }
3494  }
3495  }
3496 
3497  return INSTALL_DIRECTORY_PAGE;
3498 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static USETUP_DATA USetupData
Definition: usetup.c:47
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2528
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#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:2214
#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:357
if(dx==0 &&dy==0)
Definition: linetemp.h:174
WORD wVirtualKeyCode
Definition: wincon.h:242
static BOOLEAN IsValidPath(IN PCWSTR InstallDir)
Definition: usetup.c:3244
#define VK_HOME
Definition: winuser.h:2213
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
VOID CONSOLE_SetCursorType(IN BOOL bInsert, IN BOOL bVisible)
Definition: consup.c:214
#define VK_DELETE
Definition: winuser.h:2223
Status
Definition: gdiplustypes.h:24
__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:275
static PPARTLIST PartitionList
Definition: usetup.c:73
#define VK_F3
Definition: winuser.h:2247
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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:237
#define VK_RIGHT
Definition: winuser.h:2216
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
PCWSTR PathComponent
Definition: osdetect.h:22
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
#define NULL
Definition: types.h:112
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
#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:227
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:627
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:87
#define VK_END
Definition: winuser.h:2212
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

Referenced by RunUSetup().

◆ InstallIntroPage()

static PAGE_NUMBER InstallIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 1074 of file usetup.c.

1075 {
1076  if (RepairUpdateFlag)
1077  {
1078 #if 1 /* Old code that looks good */
1079 
1080  // return SELECT_PARTITION_PAGE;
1081  return DEVICE_SETTINGS_PAGE;
1082 
1083 #else /* Possible new code? */
1084 
1085  return DEVICE_SETTINGS_PAGE;
1086  // return SCSI_CONTROLLER_PAGE;
1087 
1088 #endif
1089  }
1090 
1091  if (IsUnattendedSetup)
1092  return SELECT_PARTITION_PAGE;
1093 
1095 
1096  while (TRUE)
1097  {
1098  CONSOLE_ConInKey(Ir);
1099 
1100  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1101  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1102  {
1103  if (ConfirmQuit(Ir))
1104  return QUIT_PAGE;
1105 
1106  break;
1107  }
1108  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1109  {
1110  return UPGRADE_REPAIR_PAGE;
1111  }
1112  }
1113 
1114  return INSTALL_INTRO_PAGE;
1115 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
WORD wVirtualKeyCode
Definition: wincon.h:242
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
#define VK_F3
Definition: winuser.h:2247
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

Referenced by RunUSetup().

◆ IsDiskSizeValid()

static BOOL IsDiskSizeValid ( PPARTENTRY  PartEntry)
static

Definition at line 1501 of file usetup.c.

1502 {
1503  ULONGLONG size;
1504 
1505  size = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector;
1506  size = (size + (512 * KB)) / MB; /* in MBytes */
1507 
1508  if (size < USetupData.RequiredPartitionDiskSpace)
1509  {
1510  /* Partition is too small so ask for another one */
1511  DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, USetupData.RequiredPartitionDiskSpace);
1512  return FALSE;
1513  }
1514  else
1515  {
1516  return TRUE;
1517  }
1518 }
static USETUP_DATA USetupData
Definition: usetup.c:47
#define TRUE
Definition: types.h:120
ULARGE_INTEGER SectorCount
Definition: partlist.h:50
#define MB
Definition: setuplib.h:56
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:46
uint64_t ULONGLONG
Definition: typedefs.h:67
#define DPRINT1
Definition: precomp.h:8
#define KB
Definition: setuplib.h:55

Referenced by SelectPartitionPage().

◆ IsValidPath()

static BOOLEAN IsValidPath ( IN PCWSTR  InstallDir)
static

Definition at line 3244 of file usetup.c.

3246 {
3247  UINT i, Length;
3248 
3249  Length = wcslen(InstallDir);
3250 
3251  // TODO: Add check for 8.3 too.
3252 
3253  /* Path must be at least 2 characters long */
3254 // if (Length < 2)
3255 // return FALSE;
3256 
3257  /* Path must start with a backslash */
3258 // if (InstallDir[0] != L'\\')
3259 // return FALSE;
3260 
3261  /* Path must not end with a backslash */
3262  if (InstallDir[Length - 1] == L'\\')
3263  return FALSE;
3264 
3265  /* Path must not contain whitespace characters */
3266  for (i = 0; i < Length; i++)
3267  {
3268  if (iswspace(InstallDir[i]))
3269  return FALSE;
3270  }
3271 
3272  /* Path component must not end with a dot */
3273  for (i = 0; i < Length; i++)
3274  {
3275  if (InstallDir[i] == L'\\' && i > 0)
3276  {
3277  if (InstallDir[i - 1] == L'.')
3278  return FALSE;
3279  }
3280  }
3281 
3282  if (InstallDir[Length - 1] == L'.')
3283  return FALSE;
3284 
3285  return TRUE;
3286 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define iswspace(_c)
Definition: ctype.h:669
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
unsigned int UINT
Definition: ndis.h:50
_CRTIMP 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 1459 of file usetup.c.

1460 {
1461  GENERIC_LIST_UI ListUi;
1463 
1464  InitGenericListUi(&ListUi, USetupData.KeyboardList, GetSettingDescription);
1465  DrawGenericList(&ListUi,
1466  2, 18,
1467  xScreen - 3,
1468  yScreen - 3);
1469 
1470  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1471 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
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:1342
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 the list */
667  DrawGenericList(&ListUi,
668  2, 18,
669  xScreen - 3,
670  yScreen - 3);
671 
672  /* Redraw language selection page in native language */
674  }
675 
676  RefreshPage = FALSE;
677  }
678  }
679 
680  return WELCOME_PAGE;
681 }
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:123
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#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:1180
VOID RedrawGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:511
WORD LANGID
Definition: typedefs.h:81
#define VK_DOWN
Definition: winuser.h:2217
#define VK_PRIOR
Definition: winuser.h:2210
_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:2211
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:2215
#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
#define ASSERT(a)
Definition: mode.c:44
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:142
PCWSTR SelectedLanguageId
Definition: usetup.c:66
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
#define VK_F3
Definition: winuser.h:2247
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
ULONG GetDefaultLanguageIndex(VOID)
Definition: settings.c:1119
SHORT yScreen
Definition: consup.c:40
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define NULL
Definition: types.h:112
struct _GENENTRY * PGENENTRY
static WCHAR DefaultLanguage[20]
Definition: usetup.c:67
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
VOID SetConsoleCodePage(VOID)
Definition: mui.c:537
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 1485 of file usetup.c.

1486 {
1487  GENERIC_LIST_UI ListUi;
1489 
1490  InitGenericListUi(&ListUi, USetupData.LayoutList, GetSettingDescription);
1491  DrawGenericList(&ListUi,
1492  2, 18,
1493  xScreen - 3,
1494  yScreen - 3);
1495 
1496  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1497 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
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:1342
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 845 of file usetup.c.

846 {
848 
849  while (TRUE)
850  {
851  CONSOLE_ConInKey(Ir);
852 
853  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
854  {
855  return WELCOME_PAGE;
856  }
857  }
858 
859  return LICENSE_PAGE;
860 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

Referenced by RunUSetup().

◆ NtProcessStartup()

VOID NTAPI NtProcessStartup ( PPEB  Peb)

Definition at line 4681 of file usetup.c.

4682 {
4683  NTSTATUS Status;
4685 
4687 
4689 
4691 
4692  Status = RunUSetup();
4693 
4694  if (NT_SUCCESS(Status))
4695  {
4696  /*
4697  * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
4698  * a protective waiting.
4699  * This wait is needed because, since we are started as SMSS.EXE,
4700  * the NT kernel explicitly waits 5 seconds for the initial process
4701  * SMSS.EXE to initialize (as a protective measure), and otherwise
4702  * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
4703  */
4704  Time.QuadPart += 50000000;
4706  }
4707  else
4708  {
4709  /* The installer failed to start: raise a hard error (crash the system/BSOD) */
4711  0, 0, NULL, 0, NULL);
4712  }
4713 
4715 }
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:551
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS RunUSetup(VOID)
Definition: usetup.c:4457
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
#define FALSE
Definition: types.h:117
HANDLE ProcessHeap
Definition: usetup.c:44
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:876
#define NtCurrentProcess()
Definition: nt_native.h:1657
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PVOID ProcessHeap
Definition: ntddk_ex.h:249
#define NULL
Definition: types.h:112
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:472
#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;
379  1,
380  coPos,
381  &Written);
382 
383  coPos.X = xLeft + 1;
385  CharHorizontalLine, // '-',
386  Width - 2,
387  coPos,
388  &Written);
389 
390  coPos.X = xLeft + Width - 1;
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
CHAR CharHorizontalLine
Definition: mui.c:39
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define POPUP_WAIT_NONE
Definition: usetup.h:123
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:525
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
#define FOREGROUND_RED
Definition: blue.h:63
_In_ HFONT _Out_ PUINT Height
Definition: font.h:124
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:124
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:560
#define FALSE
Definition: types.h:117
short SHORT
Definition: pedump.c:59
HANDLE StdOutput
Definition: consup.c:37
unsigned char BOOLEAN
CHAR CharVertLineAndRightHorizLine
Definition: mui.c:45
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:407
ULONG X
Definition: bl.h:1339
Status
Definition: gdiplustypes.h:24
CONST CHAR * PCCH
Definition: ntbasedef.h:392
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
unsigned long DWORD
Definition: ntddk_ex.h:95
CHAR CharLeftHorizLineAndVertLine
Definition: mui.c:46
Definition: bl.h:1337
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 NULL
Definition: types.h:112
#define BACKGROUND_WHITE
Definition: consup.h:31
char * strchr(const char *String, int ch)
Definition: utclib.c:501
unsigned int ULONG
Definition: retypes.h:1
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
GLfloat GLfloat p
Definition: glext.h:8902
ULONG Y
Definition: bl.h:1340
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
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 3537 of file usetup.c.

3538 {
3539  // ERROR_NUMBER ErrorNumber;
3540  BOOLEAN Success;
3541 
3543 
3544  /* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
3545  if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
3546  {
3547  // MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
3548  return QUIT_PAGE;
3549  }
3550 
3551  return FILE_COPY_PAGE;
3552 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
unsigned char BOOLEAN
#define NULL
Definition: types.h:112
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 ( IN PCSTR  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 }
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
GLuint buffer
Definition: glext.h:5915
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64
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)
va_start(ap, x)
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
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 4240 of file usetup.c.

4243 {
4244  NTSTATUS Status;
4245  ULONG StartTime, BarWidth, TimerDiv;
4246  LONG TimeElapsed;
4247  LONG TimerValue, OldTimerValue;
4249  PPROGRESSBAR ProgressBar;
4250  BOOLEAN RefreshProgress = TRUE;
4251 
4252  /* Bail out if the timeout is already zero */
4253  if (TimeOut <= 0)
4254  return;
4255 
4256  /* Create the timeout progress bar and set it up */
4257  ProgressBar = CreateProgressBarEx(13,
4258  26,
4259  xScreen - 13,
4260  yScreen - 20,
4261  10,
4262  24,
4263  TRUE,
4265  0,
4266  NULL,
4269 
4270  BarWidth = max(1, ProgressBar->Width);
4271  TimerValue = TimeOut * BarWidth;
4272  ProgressSetStepCount(ProgressBar, TimerValue);
4273 
4275  CONSOLE_Flush();
4276 
4277  TimerDiv = 1000 / BarWidth;
4278  TimerDiv = max(1, TimerDiv);
4279  OldTimerValue = TimerValue;
4280  while (TRUE)
4281  {
4282  /* Decrease the timer */
4283 
4284  /*
4285  * Compute how much time the previous operations took.
4286  * This allows us in particular to take account for any time
4287  * elapsed if something slowed down.
4288  */
4289  TimeElapsed = NtGetTickCount() - StartTime;
4290  if (TimeElapsed >= TimerDiv)
4291  {
4292  /* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
4293  TimeElapsed /= TimerDiv;
4294  StartTime += (TimerDiv * TimeElapsed);
4295 
4296  if (TimeElapsed <= TimerValue)
4297  TimerValue -= TimeElapsed;
4298  else
4299  TimerValue = 0;
4300 
4301  RefreshProgress = TRUE;
4302  }
4303 
4304  if (RefreshProgress)
4305  {
4306  ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
4307  RefreshProgress = FALSE;
4308  }
4309 
4310  /* Stop when the timer reaches zero */
4311  if (TimerValue <= 0)
4312  break;
4313 
4314  /* Check for user key presses */
4315 
4316  /*
4317  * If the timer is used, use a passive wait of maximum 1 second
4318  * while monitoring for incoming console input events, so that
4319  * we are still able to display the timing count.
4320  */
4321 
4322  /* Wait a maximum of 1 second for input events */
4323  TimeElapsed = NtGetTickCount() - StartTime;
4324  if (TimeElapsed < TimerDiv)
4325  {
4326  /* Convert the time to NT format */
4327  Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
4329  }
4330  else
4331  {
4333  }
4334 
4335  /* Check whether the input event has been signaled, or a timeout happened */
4336  if (Status == STATUS_TIMEOUT)
4337  {
4338  continue;
4339  }
4340  if (Status != STATUS_WAIT_0)
4341  {
4342  /* An error happened, bail out */
4343  DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
4344  break;
4345  }
4346 
4347  /* Check for an ENTER key press */
4348  while (CONSOLE_ConInKeyPeek(Ir))
4349  {
4350  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4351  {
4352  /* Found it, stop waiting */
4353  goto Exit;
4354  }
4355  }
4356  }
4357 
4358 Exit:
4359  /* Destroy the progress bar and quit */
4360  DestroyProgressBar(ProgressBar);
4361 }
#define max(a, b)
Definition: svc.c:63
#define LL
Definition: tui.h:150
SHORT xScreen
Definition: consup.c:39
#define TRUE
Definition: types.h:120
#define STRING_REBOOTPROGRESSBAR
Definition: mui.h:188
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:175
#define NtGetTickCount
Definition: rtlp.h:163
#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
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
Status
Definition: gdiplustypes.h:24
BOOLEAN CONSOLE_ConInKeyPeek(OUT PINPUT_RECORD Buffer)
Definition: consup.c:89
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:4193
static void Exit(void)
Definition: sock.c:1331
SHORT yScreen
Definition: consup.c:40
static ULONG Timeout
Definition: ping.c:61
#define NULL
Definition: types.h:112
#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 4193 of file usetup.c.

4198 {
4199  ULONG OldProgress = Bar->Progress;
4200 
4201  if (Bar->StepCount == 0)
4202  {
4203  Bar->Progress = 0;
4204  }
4205  else
4206  {
4207  Bar->Progress = Bar->StepCount - Bar->CurrentStep;
4208  }
4209 
4210  /* Build the progress string if it has changed */
4211  if (Bar->ProgressFormatText &&
4212  (AlwaysUpdate || (Bar->Progress != OldProgress)))
4213  {
4215  Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
4216 
4217  return TRUE;
4218  }
4219 
4220  return FALSE;
4221 }
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
void Bar(void)
Definition: terminate.cpp:70
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 4377 of file usetup.c.

4378 {
4380 
4381  /* Destroy the NTOS installations list */
4382  if (NtOsInstallsList != NULL)
4383  {
4386  }
4387 
4388  /* Destroy the partition list */
4389  if (PartitionList != NULL)
4390  {
4392  PartitionList = NULL;
4393  }
4394 
4395  /* Reset the formatter machine state */
4396  TempPartition = NULL;
4397  FormatState = Start;
4398 
4399  /* Destroy the filesystem list */
4401 
4403 
4404  /* Wait for maximum 15 seconds or an ENTER key before quitting */
4405  ProgressCountdown(Ir, 15);
4406  return FLUSH_PAGE;
4407 }
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2528
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:170
#define TRUE
Definition: types.h:120
#define STRING_REBOOTCOMPUTER2
Definition: mui.h:163
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:88
static VOID ProgressCountdown(IN PINPUT_RECORD Ir, IN LONG TimeOut)
Definition: usetup.c:4240
static FORMATMACHINESTATE FormatState
Definition: usetup.c:83
Definition: partlist.h:33
static PPARTLIST PartitionList
Definition: usetup.c:73
VOID DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:1931
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
#define NULL
Definition: types.h:112

Referenced by RunUSetup().

◆ RegistryPage()

static PAGE_NUMBER RegistryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3832 of file usetup.c.

3833 {
3834  ULONG Error;
3835 
3837 
3840  PartitionList,
3844  &s_SubstSettings);
3845  if (Error != ERROR_SUCCESS)
3846  {
3848  return QUIT_PAGE;
3849  }
3850  else
3851  {
3853  return BOOT_LOADER_PAGE;
3854  }
3855 }
WCHAR DriveLetter
Definition: partlist.h:58
static USETUP_DATA USetupData
Definition: usetup.c:47
#define ERROR_SUCCESS
Definition: deptool.c:10
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
static PPARTENTRY InstallPartition
Definition: usetup.c:50
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: usetup.c:3788
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
PCWSTR SelectedLanguageId
Definition: usetup.c:66
BOOL Error
Definition: chkdsk.c:66
static PPARTLIST PartitionList
Definition: usetup.c:73
ERROR_NUMBER UpdateRegistry(IN OUT PUSETUP_DATA pSetupData, IN BOOLEAN RepairUpdateFlag, IN PPARTLIST PartitionList, IN WCHAR DestinationDriveLetter, IN PCWSTR SelectedLanguageId, IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
Definition: setuplib.c:917
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
#define STRING_DONE
Definition: mui.h:162
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
unsigned int ULONG
Definition: retypes.h:1

Referenced by RunUSetup().

◆ RegistryStatus()

static VOID __cdecl RegistryStatus ( IN REGISTRY_STATUS  RegStatus,
  ... 
)
static

Definition at line 3788 of file usetup.c.

3789 {
3790  /* WARNING: Please keep this lookup table in sync with the resources! */
3791  static const UINT StringIDs[] =
3792  {
3793  STRING_DONE, /* Success */
3794  STRING_REGHIVEUPDATE, /* RegHiveUpdate */
3795  STRING_IMPORTFILE, /* ImportRegHive */
3796  STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
3797  STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
3798  STRING_ADDKBLAYOUTS, /* KeybLayouts */
3799  STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
3800  STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
3801  };
3802 
3803  va_list args;
3804 
3805  if (RegStatus < ARRAYSIZE(StringIDs))
3806  {
3807  va_start(args, RegStatus);
3808  CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
3809  va_end(args);
3810  }
3811  else
3812  {
3813  CONSOLE_SetStatusText("Unknown status %d", RegStatus);
3814  }
3815 }
#define args
Definition: format.c:66
#define STRING_DISPLAYSETTINGSUPDATE
Definition: mui.h:158
VOID CONSOLE_SetStatusTextV(IN LPCSTR fmt, IN va_list args)
Definition: consup.c:477
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
Definition: match.c:390
#define STRING_IMPORTFILE
Definition: mui.h:157
#define va_end(ap)
Definition: acmsvcex.h:90
#define STRING_KEYBOARDSETTINGSUPDATE
Definition: mui.h:160
char * va_list
Definition: acmsvcex.h:78
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
va_start(ap, x)
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
#define STRING_DONE
Definition: mui.h:162
unsigned int UINT
Definition: ndis.h:50
#define STRING_LOCALESETTINGSUPDATE
Definition: mui.h:159
#define STRING_CODEPAGEINFOUPDATE
Definition: mui.h:161
#define STRING_ADDKBLAYOUTS
Definition: mui.h:187
#define STRING_REGHIVEUPDATE
Definition: mui.h:156

Referenced by RegistryPage().

◆ RepairIntroPage()

static PAGE_NUMBER RepairIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 876 of file usetup.c.

877 {
879 
880  while (TRUE)
881  {
882  CONSOLE_ConInKey(Ir);
883 
884  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
885  {
886  return REBOOT_PAGE;
887  }
888  else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
889  {
891  return INSTALL_INTRO_PAGE;
892  }
893  else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
894  {
895  return RECOVERY_PAGE;
896  }
897  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
898  {
899  return WELCOME_PAGE;
900  }
901  }
902 
903  return REPAIR_INTRO_PAGE;
904 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
#define TRUE
Definition: types.h:120
#define VK_ESCAPE
Definition: winuser.h:2204
WORD wVirtualKeyCode
Definition: wincon.h:242
int toupper(int c)
Definition: utclib.c:881
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
union _INPUT_RECORD::@3240 Event
union _KEY_EVENT_RECORD::@3239 uChar
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

Referenced by RunUSetup().

◆ ResetFileSystemList()

static VOID ResetFileSystemList ( VOID  )
static

Definition at line 2528 of file usetup.c.

2529 {
2530  if (!FileSystemList)
2531  return;
2532 
2534  FileSystemList = NULL;
2535 }
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:79
#define NULL
Definition: types.h:112
VOID DestroyFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:149

Referenced by FormatPartitionPage(), InstallDirectoryPage(), QuitPage(), and SelectFileSystemPage().

◆ RunUSetup()

NTSTATUS RunUSetup ( VOID  )

Definition at line 4457 of file usetup.c.

4458 {
4459  NTSTATUS Status;
4460  INPUT_RECORD Ir;
4461  PAGE_NUMBER Page;
4462  BOOLEAN Old;
4463 
4465 
4466  /* Tell the Cm this is a setup boot, and it has to behave accordingly */
4468  if (!NT_SUCCESS(Status))
4469  DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
4470 
4471  /* Initialize the user-mode PnP manager */
4473  if (!NT_SUCCESS(Status))
4474  {
4475  // PrintString(??);
4476  DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
4477  }
4478 
4479  if (!CONSOLE_Init())
4480  {
4484 
4485  /* We failed to initialize the video, just quit the installer */
4486  return STATUS_APP_INIT_FAILURE;
4487  }
4488 
4489  /* Initialize Setup, phase 0 */
4491  USetupData.ErrorRoutine = USetupErrorRoutine;
4492 
4493  /* Hide the cursor and clear the screen and keyboard buffer */
4496  CONSOLE_Flush();
4497 
4498  /* Global Initialization page */
4499  Page = SetupStartPage(&Ir);
4500 
4501  while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
4502  {
4504  CONSOLE_Flush();
4505 
4506  // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4507 
4508  switch (Page)
4509  {
4510  /* Language page */
4511  case LANGUAGE_PAGE:
4512  Page = LanguagePage(&Ir);
4513  break;
4514 
4515  /* Welcome page */
4516  case WELCOME_PAGE:
4517  Page = WelcomePage(&Ir);
4518  break;
4519 
4520  /* License page */
4521  case LICENSE_PAGE:
4522  Page = LicensePage(&Ir);
4523  break;
4524 
4525  /* Install pages */
4526  case INSTALL_INTRO_PAGE:
4527  Page = InstallIntroPage(&Ir);
4528  break;
4529 
4530 #if 0
4531  case SCSI_CONTROLLER_PAGE:
4532  Page = ScsiControllerPage(&Ir);
4533  break;
4534 
4535  case OEM_DRIVER_PAGE:
4536  Page = OemDriverPage(&Ir);
4537  break;
4538 #endif
4539 
4540  case DEVICE_SETTINGS_PAGE:
4541  Page = DeviceSettingsPage(&Ir);
4542  break;
4543 
4545  Page = ComputerSettingsPage(&Ir);
4546  break;
4547 
4548  case DISPLAY_SETTINGS_PAGE:
4549  Page = DisplaySettingsPage(&Ir);
4550  break;
4551 
4553  Page = KeyboardSettingsPage(&Ir);
4554  break;
4555 
4556  case LAYOUT_SETTINGS_PAGE:
4557  Page = LayoutSettingsPage(&Ir);
4558  break;
4559 
4560  /* Partitioning pages */
4561  case SELECT_PARTITION_PAGE:
4562  Page = SelectPartitionPage(&Ir);
4563  break;
4564 
4567  break;
4568 
4571  break;
4572 
4575  break;
4576 
4579  break;
4580 
4581  case DELETE_PARTITION_PAGE:
4582  Page = DeletePartitionPage(&Ir);
4583  break;
4584 
4585  /* Filesystem partition operations pages */
4587  Page = SelectFileSystemPage(&Ir);
4588  break;
4589 
4590  case FORMAT_PARTITION_PAGE:
4591  Page = FormatPartitionPage(&Ir);
4592  break;
4593 
4595  Page = CheckFileSystemPage(&Ir);
4596  break;
4597 
4598  /* Installation pages */
4600  Page = InstallDirectoryPage(&Ir);
4601  break;
4602 
4603  case PREPARE_COPY_PAGE:
4604  Page = PrepareCopyPage(&Ir);
4605  break;
4606 
4607  case FILE_COPY_PAGE:
4608  Page = FileCopyPage(&Ir);
4609  break;
4610 
4611  case REGISTRY_PAGE:
4612  Page = RegistryPage(&Ir);
4613  break;
4614 
4615  /* Bootloader installation pages */
4616  case BOOT_LOADER_PAGE:
4617  Page = BootLoaderPage(&Ir);
4618  break;
4619 
4621  Page = BootLoaderFloppyPage(&Ir);
4622  break;
4623 
4626  break;
4627 
4628  /* Repair pages */
4629  case REPAIR_INTRO_PAGE:
4630  Page = RepairIntroPage(&Ir);
4631  break;
4632 
4633  case UPGRADE_REPAIR_PAGE:
4634  Page = UpgradeRepairPage(&Ir);
4635  break;
4636 
4637  case SUCCESS_PAGE:
4638  Page = SuccessPage(&Ir);
4639  break;
4640 
4641  case FLUSH_PAGE:
4642  Page = FlushPage(&Ir);
4643  break;
4644 
4645  case QUIT_PAGE:
4646  Page = QuitPage(&Ir);
4647  break;
4648 
4649  /* Virtual pages */
4650  case SETUP_INIT_PAGE:
4651  case REBOOT_PAGE:
4652  case RECOVERY_PAGE:
4653  break;
4654 
4655  default:
4656  break;
4657  }
4658  }
4659 
4660  /* Terminate the user-mode PnP manager */
4662 
4663  /* Setup has finished */
4665 
4666  if (Page == RECOVERY_PAGE)
4667  RecoveryConsole();
4668 
4669  FreeConsole();
4670 
4671  /* Reboot */
4675 
4676  return STATUS_SUCCESS;
4677 }
VOID RecoveryConsole(VOID)
Definition: cmdcons.c:1160
VOID FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:867
static USETUP_DATA USetupData
Definition: usetup.c:47
#define STRING_CONSOLEFAIL2
Definition: mui.h:165
static PAGE_NUMBER BootLoaderPage(PINPUT_RECORD Ir)
Definition: usetup.c:3879
#define STATUS_APP_INIT_FAILURE
Definition: ntstatus.h:561
#define TRUE
Definition: types.h:120
static PAGE_NUMBER InstallDirectoryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3300
static PAGE_NUMBER SetupStartPage(PINPUT_RECORD Ir)
Definition: usetup.c:708
VOID InfSetHeap(PVOID Heap)
Definition: infrosgen.c:40
#define STRING_CONSOLEFAIL3
Definition: mui.h:166
LONG NTSTATUS
Definition: precomp.h:26
static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:876
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:1074
BOOL CONSOLE_Flush(VOID)
Definition: consup.c:175
static PAGE_NUMBER BootLoaderInstallationPage(PINPUT_RECORD Ir)
Definition: usetup.c:4113
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2433
static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1459
static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir)
Definition: usetup.c:543
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1295
#define FALSE
Definition: types.h:117
static PAGE_NUMBER FormatPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:3010
NTSTATUS NTAPI NtInitializeRegistry(IN USHORT Flag)
Definition: ntapi.c:1318
static PAGE_NUMBER BootLoaderFloppyPage(PINPUT_RECORD Ir)
Definition: usetup.c:4056