ReactOS  0.4.15-dev-2776-g4130f0b
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 1877 of file usetup.c.

◆ PARTITION_SIZE_INPUT_FIELD_LENGTH

#define PARTITION_SIZE_INPUT_FIELD_LENGTH   9

Definition at line 1875 of file usetup.c.

Typedef Documentation

◆ COPYCONTEXT

◆ PCOPYCONTEXT

Function Documentation

◆ BootLoaderFloppyPage()

static PAGE_NUMBER BootLoaderFloppyPage ( PINPUT_RECORD  Ir)
static

Definition at line 4050 of file usetup.c.

4051 {
4052  NTSTATUS Status;
4053 
4055 
4056 // CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
4057 
4058  while (TRUE)
4059  {
4060  CONSOLE_ConInKey(Ir);
4061 
4062  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
4063  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
4064  {
4065  if (ConfirmQuit(Ir))
4066  return QUIT_PAGE;
4067 
4068  break;
4069  }
4070  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4071  {
4072  Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
4073  &USetupData.DestinationArcPath);
4074  if (!NT_SUCCESS(Status))
4075  {
4078 
4079  /* TODO: Print error message */
4080  return BOOT_LOADER_FLOPPY_PAGE;
4081  }
4082 
4083  return SUCCESS_PAGE;
4084  }
4085  }
4086 
4087  return BOOT_LOADER_FLOPPY_PAGE;
4088 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
WORD wVirtualKeyCode
Definition: wincon.h:242
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:1281
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
union _INPUT_RECORD::@3242 Event
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 4107 of file usetup.c.

4108 {
4109  NTSTATUS Status;
4110  WCHAR DestinationDevicePathBuffer[MAX_PATH];
4111 
4113 
4114  if (USetupData.MBRInstallType == 2)
4115  {
4116  /* Step 1: Write the VBR */
4117  Status = InstallVBRToPartition(&USetupData.SystemRootPath,
4118  &USetupData.SourceRootPath,
4119  &USetupData.DestinationArcPath,
4121  if (!NT_SUCCESS(Status))
4122  {
4125  return QUIT_PAGE;
4126  }
4127 
4128  /* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
4130  {
4131  RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
4132  L"\\Device\\Harddisk%d\\Partition0",
4133  SystemPartition->DiskEntry->DiskNumber);
4134  Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath,
4135  &USetupData.SourceRootPath,
4136  DestinationDevicePathBuffer);
4137  if (!NT_SUCCESS(Status))
4138  {
4139  DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", Status);
4141  return QUIT_PAGE;
4142  }
4143  }
4144  }
4145  else
4146  {
4147  Status = InstallVBRToPartition(&USetupData.SystemRootPath,
4148  &USetupData.SourceRootPath,
4149  &USetupData.DestinationArcPath,
4151  if (!NT_SUCCESS(Status))
4152  {
4155  return QUIT_PAGE;
4156  }
4157  }
4158 
4159  return SUCCESS_PAGE;
4160 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
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
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
static const WCHAR L[]
Definition: oid.c:1250
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
Definition: bootsup.c:764
#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:1233

Referenced by RunUSetup().

◆ BootLoaderPage()

static PAGE_NUMBER BootLoaderPage ( PINPUT_RECORD  Ir)
static

Definition at line 3873 of file usetup.c.

3874 {
3875  USHORT Line = 12;
3876  WCHAR PathBuffer[MAX_PATH];
3877 
3879 
3880  /* We must have a supported system partition by now */
3882 
3883  RtlFreeUnicodeString(&USetupData.SystemRootPath);
3884  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3885  L"\\Device\\Harddisk%lu\\Partition%lu\\",
3886  SystemPartition->DiskEntry->DiskNumber,
3888  RtlCreateUnicodeString(&USetupData.SystemRootPath, PathBuffer);
3889  DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
3890 
3891  /* For unattended setup, skip MBR installation or install on floppy if needed */
3892  if (IsUnattendedSetup)
3893  {
3894  if ((USetupData.MBRInstallType == 0) ||
3895  (USetupData.MBRInstallType == 1))
3896  {
3897  goto Quit;
3898  }
3899  }
3900 
3901  /*
3902  * We may install an MBR or VBR, but before that, check whether
3903  * we need to actually install the VBR on floppy/removable media
3904  * if the system partition is not recognized.
3905  */
3906  if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
3908  {
3909  USetupData.MBRInstallType = 1;
3910  goto Quit;
3911  }
3912 
3913  /* Is it an unattended install on hdd? */
3914  if (IsUnattendedSetup)
3915  {
3916  if ((USetupData.MBRInstallType == 2) ||
3917  (USetupData.MBRInstallType == 3))
3918  {
3919  goto Quit;
3920  }
3921  }
3922 
3924  CONSOLE_InvertTextXY(8, Line, 60, 1);
3925 
3926  while (TRUE)
3927  {
3928  CONSOLE_ConInKey(Ir);
3929 
3930  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3931  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
3932  {
3933  CONSOLE_NormalTextXY(8, Line, 60, 1);
3934 
3935  Line++;
3936  if (Line < 12)
3937  Line = 15;
3938 
3939  if (Line > 15)
3940  Line = 12;
3941 
3942  CONSOLE_InvertTextXY(8, Line, 60, 1);
3943  }
3944  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3945  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
3946  {
3947  CONSOLE_NormalTextXY(8, Line, 60, 1);
3948 
3949  Line--;
3950  if (Line < 12)
3951  Line = 15;
3952 
3953  if (Line > 15)
3954  Line = 12;
3955 
3956  CONSOLE_InvertTextXY(8, Line, 60, 1);
3957  }
3958  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3959  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3960  {
3961  CONSOLE_NormalTextXY(8, Line, 60, 1);
3962 
3963  Line = 12;
3964 
3965  CONSOLE_InvertTextXY(8, Line, 60, 1);
3966  }
3967  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3968  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3969  {
3970  CONSOLE_NormalTextXY(8, Line, 60, 1);
3971 
3972  Line = 15;
3973 
3974  CONSOLE_InvertTextXY(8, Line, 60, 1);
3975  }
3976  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3977  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3978  {
3979  if (ConfirmQuit(Ir))
3980  return QUIT_PAGE;
3981 
3982  break;
3983  }
3984  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3985  {
3986  if (Line == 12)
3987  {
3988  /* Install on both MBR and VBR */
3989  USetupData.MBRInstallType = 2;
3990  break;
3991  }
3992  else if (Line == 13)
3993  {
3994  /* Install on VBR only */
3995  USetupData.MBRInstallType = 3;
3996  break;
3997  }
3998  else if (Line == 14)
3999  {
4000  /* Install on floppy */
4001  USetupData.MBRInstallType = 1;
4002  break;
4003  }
4004  else if (Line == 15)
4005  {
4006  /* Skip MBR installation */
4007  USetupData.MBRInstallType = 0;
4008  break;
4009  }
4010 
4011  return BOOT_LOADER_PAGE;
4012  }
4013  }
4014 
4015 Quit:
4016  switch (USetupData.MBRInstallType)
4017  {
4018  /* Skip MBR installation */
4019  case 0:
4020  return SUCCESS_PAGE;
4021 
4022  /* Install on floppy */
4023  case 1:
4024  return BOOT_LOADER_FLOPPY_PAGE;
4025 
4026  /* Install on both MBR and VBR or VBR only */
4027  case 2:
4028  case 3:
4030  }
4031 
4032  return BOOT_LOADER_PAGE;
4033 }
ULONG PartitionNumber
Definition: partlist.h:55
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define VK_DOWN
Definition: winuser.h:2202
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:298
WORD wVirtualKeyCode
Definition: wincon.h:242
#define VK_HOME
Definition: winuser.h:2198
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:276
#define VK_UP
Definition: winuser.h:2200
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
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:2232
union _KEY_EVENT_RECORD::@3241 uChar
static PPARTENTRY SystemPartition
Definition: usetup.c:61
Definition: ncftp.h:79
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
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
union _INPUT_RECORD::@3242 Event
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define VK_END
Definition: winuser.h:2197
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 3154 of file usetup.c.

3155 {
3156  NTSTATUS Status;
3157  PPARTENTRY PartEntry;
3158  CHAR Buffer[MAX_PATH];
3159 
3161 
3162  if (PartitionList == NULL)
3163  {
3164  /* FIXME: show an error dialog */
3165  return QUIT_PAGE;
3166  }
3167 
3168  if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry))
3169  {
3170  return INSTALL_DIRECTORY_PAGE;
3171  }
3172 
3173  ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
3174 
3175  DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
3176  PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a"));
3177 
3178  /* Check the partition */
3179  Status = DoChkdsk(PartEntry);
3181  {
3182  /*
3183  * Partition checking is not supported with the current filesystem,
3184  * so disable FS checks on it.
3185  */
3186  PartEntry->NeedsCheck = FALSE;
3187 
3189  sizeof(Buffer),
3190  "Setup is currently unable to check a partition formatted in %S.\n"
3191  "\n"
3192  " \x07 Press ENTER to continue Setup.\n"
3193  " \x07 Press F3 to quit Setup.",
3194  PartEntry->FileSystem);
3195 
3199 
3200  while (TRUE)
3201  {
3202  CONSOLE_ConInKey(Ir);
3203 
3204  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
3205  Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
3206  {
3207  if (ConfirmQuit(Ir))
3208  return QUIT_PAGE;
3209  else
3210  return CHECK_FILE_SYSTEM_PAGE;
3211  }
3212  else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
3213  {
3214  return CHECK_FILE_SYSTEM_PAGE;
3215  }
3216  }
3217  }
3218  else if (!NT_SUCCESS(Status))
3219  {
3220  DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", Status);
3221 
3223  sizeof(Buffer),
3224  "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
3225  Status);
3226 
3229  Ir, POPUP_WAIT_ENTER);
3230  }
3231 
3232  PartEntry->NeedsCheck = FALSE;
3233  return CHECK_FILE_SYSTEM_PAGE;
3234 }
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:149
#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:2176
WORD wVirtualKeyCode
Definition: wincon.h:242
#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:230
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:2232
union _KEY_EVENT_RECORD::@3241 uChar
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
#define STRING_CONTINUE
Definition: mui.h:127
#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
union _INPUT_RECORD::@3242 Event
NTSTATUS DoChkdsk(IN PPARTENTRY PartEntry)
Definition: chkdsk.c:57
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
#define STRING_QUITCONTINUE
Definition: mui.h:128
BOOLEAN IsPartitioned
Definition: partlist.h:66

Referenced by RunUSetup().

◆ ComputerSettingsPage()

static PAGE_NUMBER ComputerSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1401 of file usetup.c.

1402 {
1403  GENERIC_LIST_UI ListUi;
1405 
1406  InitGenericListUi(&ListUi, USetupData.ComputerList, GetSettingDescription);
1407  DrawGenericList(&ListUi,
1408  2, 18,
1409  xScreen - 3,
1410  yScreen - 3);
1411 
1412  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1413 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1336
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 2427 of file usetup.c.

2428 {
2430 
2431  while (TRUE)
2432  {
2433  CONSOLE_ConInKey(Ir);
2434 
2435  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2436  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2437  {
2438  if (ConfirmQuit(Ir))
2439  return QUIT_PAGE;
2440 
2441  break;
2442  }
2443  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2444  {
2445  return DELETE_PARTITION_PAGE;
2446  }
2447  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2448  {
2449  return SELECT_PARTITION_PAGE;
2450  }
2451  }
2452 
2454 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_RETURN
Definition: winuser.h:2176
WORD wVirtualKeyCode
Definition: wincon.h:242
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
#define VK_F3
Definition: winuser.h:2232
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
union _INPUT_RECORD::@3242 Event
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c: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:2232
union _KEY_EVENT_RECORD::@3241 uChar
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
#define NULL
Definition: types.h:112
union _INPUT_RECORD::@3242 Event
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 2192 of file usetup.c.

2193 {
2194  PPARTENTRY PartEntry;
2195  PDISKENTRY DiskEntry;
2196  BOOLEAN Quit;
2197  BOOLEAN Cancel;
2198  ULONG MaxSize;
2199  ULONGLONG PartSize;
2201  WCHAR InputBuffer[50];
2202  CHAR LineBuffer[100];
2203 
2204  if (PartitionList == NULL || CurrentPartition == NULL)
2205  {
2206  /* FIXME: show an error dialog */
2207  return QUIT_PAGE;
2208  }
2209 
2210  PartEntry = CurrentPartition;
2211  DiskEntry = CurrentPartition->DiskEntry;
2212 
2214 
2216 
2217  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2219  LineBuffer);
2220 
2222 
2223 #if 0
2224  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2225  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2226 #endif
2227 
2229 
2230  PartEntry = CurrentPartition;
2231  while (TRUE)
2232  {
2233  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2234 
2235  if (MaxSize > PARTITION_MAXSIZE)
2236  MaxSize = PARTITION_MAXSIZE;
2237 
2238  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2239  MaxSize, InputBuffer, &Quit, &Cancel);
2240 
2241  if (Quit)
2242  {
2243  if (ConfirmQuit(Ir))
2244  return QUIT_PAGE;
2245 
2246  break;
2247  }
2248  else if (Cancel)
2249  {
2250  return SELECT_PARTITION_PAGE;
2251  }
2252  else
2253  {
2254  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2255 
2256  if (PartSize < 1)
2257  {
2258  /* Too small */
2259  continue;
2260  }
2261 
2262  if (PartSize > MaxSize)
2263  {
2264  /* Too large */
2265  continue;
2266  }
2267 
2268  /* Convert to bytes */
2269  if (PartSize == MaxSize)
2270  {
2271  /* Use all of the unpartitioned disk space */
2272  SectorCount = PartEntry->SectorCount.QuadPart;
2273  }
2274  else
2275  {
2276  /* Calculate the sector count from the size in MB */
2277  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2278 
2279  /* But never get larger than the unpartitioned disk space */
2280  if (SectorCount > PartEntry->SectorCount.QuadPart)
2281  SectorCount = PartEntry->SectorCount.QuadPart;
2282  }
2283 
2284  DPRINT ("Partition size: %I64u bytes\n", PartSize);
2285 
2288  SectorCount);
2289 
2290  return SELECT_PARTITION_PAGE;
2291  }
2292  }
2293 
2295 }
#define STRING_HDDSIZE
Definition: mui.h:120
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:121
#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
#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
_Check_return_ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define 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:1880
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
unsigned char BOOLEAN
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
_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:151
#define NULL
Definition: types.h:112
#define PARTITION_MAXSIZE
Definition: usetup.c:1877
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:111
#define DPRINT
Definition: sndvol32.h:71
#define STRING_CHOOSE_NEW_EXTENDED_PARTITION
Definition: mui.h:118

Referenced by RunUSetup().

◆ CreateLogicalPartitionPage()

static PAGE_NUMBER CreateLogicalPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2309 of file usetup.c.

2310 {
2311  PPARTENTRY PartEntry;
2312  PDISKENTRY DiskEntry;
2313  BOOLEAN Quit;
2314  BOOLEAN Cancel;
2315  ULONG MaxSize;
2316  ULONGLONG PartSize;
2318  WCHAR InputBuffer[50];
2319  CHAR LineBuffer[100];
2320 
2321  if (PartitionList == NULL || CurrentPartition == NULL)
2322  {
2323  /* FIXME: show an error dialog */
2324  return QUIT_PAGE;
2325  }
2326 
2327  PartEntry = CurrentPartition;
2328  DiskEntry = CurrentPartition->DiskEntry;
2329 
2331 
2333 
2334  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2336  LineBuffer);
2337 
2339 
2340 #if 0
2341  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2342  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2343 #endif
2344 
2346 
2347  PartEntry = CurrentPartition;
2348  while (TRUE)
2349  {
2350  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2351 
2352  if (MaxSize > PARTITION_MAXSIZE)
2353  MaxSize = PARTITION_MAXSIZE;
2354 
2355  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2356  MaxSize, InputBuffer, &Quit, &Cancel);
2357 
2358  if (Quit)
2359  {
2360  if (ConfirmQuit(Ir))
2361  return QUIT_PAGE;
2362 
2363  break;
2364  }
2365  else if (Cancel)
2366  {
2367  return SELECT_PARTITION_PAGE;
2368  }
2369  else
2370  {
2371  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2372 
2373  if (PartSize < 1)
2374  {
2375  /* Too small */
2376  continue;
2377  }
2378 
2379  if (PartSize > MaxSize)
2380  {
2381  /* Too large */
2382  continue;
2383  }
2384 
2385  /* Convert to bytes */
2386  if (PartSize == MaxSize)
2387  {
2388  /* Use all of the unpartitioned disk space */
2389  SectorCount = PartEntry->SectorCount.QuadPart;
2390  }
2391  else
2392  {
2393  /* Calculate the sector count from the size in MB */
2394  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2395 
2396  /* But never get larger than the unpartitioned disk space */
2397  if (SectorCount > PartEntry->SectorCount.QuadPart)
2398  SectorCount = PartEntry->SectorCount.QuadPart;
2399  }
2400 
2401  DPRINT("Partition size: %I64u bytes\n", PartSize);
2402 
2405  SectorCount,
2406  FALSE);
2407 
2408  return SELECT_PARTITION_PAGE;
2409  }
2410  }
2411 
2413 }
#define STRING_HDDSIZE
Definition: mui.h:120
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:121
#define STRING_CHOOSE_NEW_LOGICAL_PARTITION
Definition: mui.h:119
#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
#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
_Check_return_ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define 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:1880
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:230
_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:151
#define NULL
Definition: types.h:112
#define PARTITION_MAXSIZE
Definition: usetup.c:1877
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define DPRINT
Definition: sndvol32.h:71

Referenced by RunUSetup().

◆ CreatePrimaryPartitionPage()

static PAGE_NUMBER CreatePrimaryPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2074 of file usetup.c.

2075 {
2076  PPARTENTRY PartEntry;
2077  PDISKENTRY DiskEntry;
2078  BOOLEAN Quit;
2079  BOOLEAN Cancel;
2080  ULONG MaxSize;
2081  ULONGLONG PartSize;
2083  WCHAR InputBuffer[50];
2084  CHAR LineBuffer[100];
2085 
2086  if (PartitionList == NULL || CurrentPartition == NULL)
2087  {
2088  /* FIXME: show an error dialog */
2089  return QUIT_PAGE;
2090  }
2091 
2092  PartEntry = CurrentPartition;
2093  DiskEntry = CurrentPartition->DiskEntry;
2094 
2096 
2098 
2099  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2101  LineBuffer);
2102 
2104 
2105 #if 0
2106  CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
2107  CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
2108 #endif
2109 
2111 
2112  PartEntry = CurrentPartition;
2113  while (TRUE)
2114  {
2115  MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2116 
2117  if (MaxSize > PARTITION_MAXSIZE)
2118  MaxSize = PARTITION_MAXSIZE;
2119 
2120  ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2121  MaxSize, InputBuffer, &Quit, &Cancel);
2122 
2123  if (Quit)
2124  {
2125  if (ConfirmQuit(Ir))
2126  return QUIT_PAGE;
2127 
2128  break;
2129  }
2130  else if (Cancel)
2131  {
2132  return SELECT_PARTITION_PAGE;
2133  }
2134  else
2135  {
2136  PartSize = _wcstoui64(InputBuffer, NULL, 10);
2137 
2138  if (PartSize < 1)
2139  {
2140  /* Too small */
2141  continue;
2142  }
2143 
2144  if (PartSize > MaxSize)
2145  {
2146  /* Too large */
2147  continue;
2148  }
2149 
2150  /* Convert to bytes */
2151  if (PartSize == MaxSize)
2152  {
2153  /* Use all of the unpartitioned disk space */
2154  SectorCount = PartEntry->SectorCount.QuadPart;
2155  }
2156  else
2157  {
2158  /* Calculate the sector count from the size in MB */
2159  SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2160 
2161  /* But never get larger than the unpartitioned disk space */
2162  if (SectorCount > PartEntry->SectorCount.QuadPart)
2163  SectorCount = PartEntry->SectorCount.QuadPart;
2164  }
2165 
2166  DPRINT ("Partition size: %I64u bytes\n", PartSize);
2167 
2170  SectorCount,
2171  FALSE);
2172 
2173  return SELECT_PARTITION_PAGE;
2174  }
2175  }
2176 
2178 }
#define STRING_HDDSIZE
Definition: mui.h:120
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:121
#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
#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:117
_Check_return_ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define 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:1880
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
_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:151
#define NULL
Definition: types.h:112
#define PARTITION_MAXSIZE
Definition: usetup.c:1877
unsigned int ULONG
Definition: retypes.h:1
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define DPRINT
Definition: sndvol32.h:71

Referenced by RunUSetup().

◆ DeletePartitionPage()

static PAGE_NUMBER DeletePartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2468 of file usetup.c.

2469 {
2470  PPARTENTRY PartEntry;
2471  PDISKENTRY DiskEntry;
2472  CHAR LineBuffer[100];
2473 
2474  if (PartitionList == NULL || CurrentPartition == NULL)
2475  {
2476  /* FIXME: show an error dialog */
2477  return QUIT_PAGE;
2478  }
2479 
2480  PartEntry = CurrentPartition;
2481  DiskEntry = CurrentPartition->DiskEntry;
2482 
2484 
2485  PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2486  CONSOLE_PrintTextXY(6, 10, " %s", LineBuffer);
2487 
2488  DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2490  LineBuffer);
2491 
2492  while (TRUE)
2493  {
2494  CONSOLE_ConInKey(Ir);
2495 
2496  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2497  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2498  {
2499  if (ConfirmQuit(Ir))
2500  return QUIT_PAGE;
2501 
2502  break;
2503  }
2504  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2505  {
2506  return SELECT_PARTITION_PAGE;
2507  }
2508  else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
2509  {
2512  &CurrentPartition);
2513  return SELECT_PARTITION_PAGE;
2514  }
2515  }
2516 
2517  return DELETE_PARTITION_PAGE;
2518 }
BOOLEAN DeletePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, OUT PPARTENTRY *FreeRegion OPTIONAL)
Definition: partlist.c:3047
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#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:2189
WORD wVirtualKeyCode
Definition: wincon.h:242
#define STRING_HDINFOPARTDELETE_1
Definition: mui.h:152
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
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:2232
union _KEY_EVENT_RECORD::@3241 uChar
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::@3242 Event
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 1204 of file usetup.c.

1205 {
1206  static ULONG Line = 16;
1207 
1208  /* Initialize the computer settings list */
1209  if (USetupData.ComputerList == NULL)
1210  {
1211  USetupData.ComputerList = CreateComputerTypeList(USetupData.SetupInf);
1212  if (USetupData.ComputerList == NULL)
1213  {
1215  return QUIT_PAGE;
1216  }
1217  }
1218 
1219  /* Initialize the display settings list */
1220  if (USetupData.DisplayList == NULL)
1221  {
1222  USetupData.DisplayList = CreateDisplayDriverList(USetupData.SetupInf);
1223  if (USetupData.DisplayList == NULL)
1224  {
1226  return QUIT_PAGE;
1227  }
1228  }
1229 
1230  /* Initialize the keyboard settings list */
1231  if (USetupData.KeyboardList == NULL)
1232  {
1233  USetupData.KeyboardList = CreateKeyboardDriverList(USetupData.SetupInf);
1234  if (USetupData.KeyboardList == NULL)
1235  {
1237  return QUIT_PAGE;
1238  }
1239  }
1240 
1241  /* Initialize the keyboard layout list */
1242  if (USetupData.LayoutList == NULL)
1243  {
1245  if (USetupData.LayoutList == NULL)
1246  {
1247  /* FIXME: report error */
1249  return QUIT_PAGE;
1250  }
1251  }
1252 
1253  if (RepairUpdateFlag)
1254  return SELECT_PARTITION_PAGE;
1255 
1256  // if (IsUnattendedSetup)
1257  // return SELECT_PARTITION_PAGE;
1258 
1260 
1265 
1266  CONSOLE_InvertTextXY(24, Line, 48, 1);
1267 
1268  while (TRUE)
1269  {
1270  CONSOLE_ConInKey(Ir);
1271 
1272  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1273  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1274  {
1275  CONSOLE_NormalTextXY(24, Line, 48, 1);
1276 
1277  if (Line == 14)
1278  Line = 16;
1279  else if (Line == 16)
1280  Line = 11;
1281  else
1282  Line++;
1283 
1284  CONSOLE_InvertTextXY(24, Line, 48, 1);
1285  }
1286  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1287  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1288  {
1289  CONSOLE_NormalTextXY(24, Line, 48, 1);
1290 
1291  if (Line == 11)
1292  Line = 16;
1293  else if (Line == 16)
1294  Line = 14;
1295  else
1296  Line--;
1297 
1298  CONSOLE_InvertTextXY(24, Line, 48, 1);
1299  }
1300  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1301  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1302  {
1303  if (ConfirmQuit(Ir))
1304  return QUIT_PAGE;
1305 
1306  break;
1307  }
1308  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1309  {
1310  if (Line == 11)
1311  return COMPUTER_SETTINGS_PAGE;
1312  else if (Line == 12)
1313  return DISPLAY_SETTINGS_PAGE;
1314  else if (Line == 13)
1315  return KEYBOARD_SETTINGS_PAGE;
1316  else if (Line == 14)
1317  return LAYOUT_SETTINGS_PAGE;
1318  else if (Line == 16)
1319  return SELECT_PARTITION_PAGE;
1320  }
1321  }
1322 
1323  return DEVICE_SETTINGS_PAGE;
1324 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define VK_DOWN
Definition: winuser.h:2202
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1215
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:2200
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:704
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:2232
union _KEY_EVENT_RECORD::@3241 uChar
Definition: ncftp.h:79
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:520
#define POPUP_WAIT_ENTER
Definition: usetup.h:125
#define NULL
Definition: types.h:112
union _INPUT_RECORD::@3242 Event
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
unsigned int ULONG
Definition: retypes.h:1
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1078
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 1427 of file usetup.c.

1428 {
1429  GENERIC_LIST_UI ListUi;
1431 
1432  InitGenericListUi(&ListUi, USetupData.DisplayList, GetSettingDescription);
1433  DrawGenericList(&ListUi,
1434  2, 18,
1435  xScreen - 3,
1436  yScreen - 3);
1437 
1438  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1439 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1336
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ DrawBox()

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

Definition at line 166 of file usetup.c.

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

Referenced by PopupError(), and ShowPartitionSizeInputBox().

◆ FileCopyCallback()

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

Definition at line 3585 of file usetup.c.

3589 {
3590  PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
3591  PFILEPATHS_W FilePathInfo;
3592  PCWSTR SrcFileName, DstFileName;
3593 
3594  switch (Notification)
3595  {
3597  {
3598  CopyContext->TotalOperations = (ULONG)Param2;
3599  CopyContext->CompletedOperations = 0;
3600  ProgressSetStepCount(CopyContext->ProgressBar,
3601  CopyContext->TotalOperations);
3602  SetupUpdateMemoryInfo(CopyContext, TRUE);
3603  break;
3604  }
3605 
3609  {
3610  FilePathInfo = (PFILEPATHS_W)Param1;
3611 
3613  {
3614  /* Display delete message */
3615  ASSERT(Param2 == FILEOP_DELETE);
3616 
3617  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3618  if (DstFileName) ++DstFileName;
3619  else DstFileName = FilePathInfo->Target;
3620 
3622  DstFileName);
3623  }
3625  {
3626  /* Display move/rename message */
3627  ASSERT(Param2 == FILEOP_RENAME);
3628 
3629  SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
3630  if (SrcFileName) ++SrcFileName;
3631  else SrcFileName = FilePathInfo->Source;
3632 
3633  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3634  if (DstFileName) ++DstFileName;
3635  else DstFileName = FilePathInfo->Target;
3636 
3637  if (!wcsicmp(SrcFileName, DstFileName))
3638  Param2 = STRING_MOVING;
3639  else
3640  Param2 = STRING_RENAMING;
3641 
3643  SrcFileName, DstFileName);
3644  }
3646  {
3647  /* Display copy message */
3648  ASSERT(Param2 == FILEOP_COPY);
3649 
3650  /* NOTE: When extracting from CABs the Source is the CAB name */
3651  DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3652  if (DstFileName) ++DstFileName;
3653  else DstFileName = FilePathInfo->Target;
3654 
3656  DstFileName);
3657 #ifdef __REACTOS__ /* HACK */
3658  DoWatchDestFileName(DstFileName);
3659 #endif
3660  }
3661 
3662  SetupUpdateMemoryInfo(CopyContext, FALSE);
3663  break;
3664  }
3665 
3667  {
3668  FilePathInfo = (PFILEPATHS_W)Param1;
3669 
3670  DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
3671  FilePathInfo->Target, FilePathInfo->Win32Error);
3672  return FILEOP_SKIP;
3673  }
3674 
3677  case SPFILENOTIFY_ENDCOPY:
3678  {
3679  CopyContext->CompletedOperations++;
3680 
3681  /* SYSREG checkpoint */
3682  if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
3683  DPRINT1("CHECKPOINT:HALF_COPIED\n");
3684 
3685  ProgressNextStep(CopyContext->ProgressBar);
3686  SetupUpdateMemoryInfo(CopyContext, FALSE);
3687  break;
3688  }
3689  }
3690 
3691  return FILEOP_DOIT;
3692 }
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:133
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define FALSE
Definition: types.h:117
VOID ProgressSetStepCount(IN PPROGRESSBAR Bar, IN ULONG StepCount)
Definition: progress.c:347
#define FILEOP_COPY
Definition: fileqsup.h:42
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define STRING_RENAMING
Definition: mui.h:132
#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:131
#define wcsicmp
Definition: compat.h:15
ULONG CompletedOperations
Definition: reactos.c:981
static const WCHAR L[]
Definition: oid.c:1250
#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:3557
#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:130
PPROGRESSBAR ProgressBar
Definition: usetup.c:3552
#define FILEOP_DELETE
Definition: fileqsup.h:44

Referenced by FileCopyPage().

◆ FileCopyPage()

static PAGE_NUMBER FileCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 3708 of file usetup.c.

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

Referenced by RunUSetup().

◆ FlushPage()

static PAGE_NUMBER FlushPage ( PINPUT_RECORD  Ir)
static

Definition at line 4440 of file usetup.c.

4441 {
4443  return REBOOT_PAGE;
4444 }
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149

Referenced by RunUSetup().

◆ FormatPartitionPage()

static PAGE_NUMBER FormatPartitionPage ( PINPUT_RECORD  Ir)
static

HACK!!

Definition at line 3004 of file usetup.c.

3005 {
3006  NTSTATUS Status;
3007  PPARTENTRY PartEntry;
3008  PDISKENTRY DiskEntry;
3009  PFILE_SYSTEM_ITEM SelectedFileSystem;
3010  WCHAR PathBuffer[MAX_PATH];
3011  CHAR Buffer[MAX_PATH];
3012 
3013  DPRINT("FormatPartitionPage()\n");
3014 
3016 
3017  if (PartitionList == NULL || TempPartition == NULL)
3018  {
3019  /* FIXME: show an error dialog */
3020  return QUIT_PAGE;
3021  }
3022 
3023  PartEntry = TempPartition;
3024  DiskEntry = TempPartition->DiskEntry;
3025 
3026  ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
3027 
3028  SelectedFileSystem = FileSystemList->Selected;
3029  ASSERT(SelectedFileSystem && SelectedFileSystem->FileSystem);
3030 
3031  while (TRUE)
3032  {
3033  if (!IsUnattendedSetup)
3034  CONSOLE_ConInKey(Ir);
3035 
3036  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3037  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3038  {
3039  if (ConfirmQuit(Ir))
3040  {
3041  /* Reset the filesystem list */
3043  return QUIT_PAGE;
3044  }
3045 
3046  break;
3047  }
3048  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
3049  {
3050  /*
3051  * Remove the "Press ENTER to continue" message prompt when the ENTER
3052  * key is pressed as the user wants to begin the partition formatting.
3053  */
3056 
3057  /* Format the partition */
3058  Status = DoFormat(PartEntry,
3059  SelectedFileSystem->FileSystem,
3060  SelectedFileSystem->QuickFormat);
3062  {
3064 
3065  /* Reset the filesystem list */
3067  return QUIT_PAGE;
3068  }
3069  else if (Status == STATUS_UNRECOGNIZED_VOLUME)
3070  {
3071  /* FIXME: show an error dialog */
3072  // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
3073 
3074  /* Reset the filesystem list */
3076  return QUIT_PAGE;
3077  }
3078  else if (Status == STATUS_NOT_SUPPORTED)
3079  {
3081  sizeof(Buffer),
3082  "Setup is currently unable to format a partition in %S.\n"
3083  "\n"
3084  " \x07 Press ENTER to continue Setup.\n"
3085  " \x07 Press F3 to quit Setup.",
3086  SelectedFileSystem->FileSystem);
3087 
3091 
3092  while (TRUE)
3093  {
3094  CONSOLE_ConInKey(Ir);
3095 
3096  if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
3097  Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
3098  {
3099  if (ConfirmQuit(Ir))
3100  {
3101  /* Reset the filesystem list */
3103  return QUIT_PAGE;
3104  }
3105  else
3106  {
3107  return SELECT_FILE_SYSTEM_PAGE;
3108  }
3109  }
3110  else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
3111  {
3112  return SELECT_FILE_SYSTEM_PAGE;
3113  }
3114  }
3115  }
3116  else if (!NT_SUCCESS(Status))
3117  {
3119  RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3120  L"\\Device\\Harddisk%lu\\Partition%lu",
3121  DiskEntry->DiskNumber,
3122  PartEntry->PartitionNumber);
3123 
3124  DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status);
3126 
3127  /* Reset the filesystem list */
3129  return QUIT_PAGE;
3130  }
3131 
3132  return SELECT_FILE_SYSTEM_PAGE;
3133  }
3134  }
3135 
3136  return FORMAT_PARTITION_PAGE;
3137 }
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:2522
static PPARTENTRY TempPartition
Definition: usetup.c:82
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
char CHAR
Definition: xmlstorage.h:175
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:108
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:79
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:124
#define VK_RETURN
Definition: winuser.h:2176
WORD wVirtualKeyCode
Definition: wincon.h:242
#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:378
Definition: bufpool.h:45
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
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:2232
union _KEY_EVENT_RECORD::@3241 uChar
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
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
union _INPUT_RECORD::@3242 Event
#define STRING_PLEASEWAIT
Definition: mui.h:111
#define DPRINT
Definition: sndvol32.h:71
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
#define STRING_QUITCONTINUE
Definition: mui.h:128
#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 1336 of file usetup.c.

1339 {
1340  while (TRUE)
1341  {
1342  CONSOLE_ConInKey(Ir);
1343 
1344  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1345  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1346  {
1347  ScrollDownGenericList(ListUi);
1348  }
1349  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1350  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1351  {
1352  ScrollUpGenericList(ListUi);
1353  }
1354  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1355  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1356  {
1357  ScrollPageDownGenericList(ListUi);
1358  }
1359  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1360  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1361  {
1362  ScrollPageUpGenericList(ListUi);
1363  }
1364  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1365  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1366  {
1367  if (ConfirmQuit(Ir))
1368  return QUIT_PAGE;
1369  else
1370  RedrawGenericList(ListUi);
1371  }
1372  else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1373  {
1374  RestoreGenericListUiState(ListUi);
1375  return nextPage; // Use some "prevPage;" instead?
1376  }
1377  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1378  {
1379  return nextPage;
1380  }
1381  else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1382  {
1383  /* a-z */
1385  }
1386  }
1387 }
#define TRUE
Definition: types.h:120
VOID RestoreGenericListUiState(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:62
VOID RedrawGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:511
#define VK_DOWN
Definition: winuser.h:2202
#define VK_PRIOR
Definition: winuser.h:2195
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_NEXT
Definition: winuser.h:2196
WORD wVirtualKeyCode
Definition: wincon.h:242
VOID ScrollDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:376
#define VK_UP
Definition: winuser.h:2200
VOID ScrollPageUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:454
VOID ScrollPageDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:432
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
#define VK_F3
Definition: winuser.h:2232
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
union _KEY_EVENT_RECORD::@3241 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
union _INPUT_RECORD::@3242 Event
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70

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

◆ InstallDirectoryPage()

static PAGE_NUMBER InstallDirectoryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3294 of file usetup.c.

3295 {
3296  NTSTATUS Status;
3297  ULONG Length, Pos;
3298  WCHAR c;
3299  WCHAR InstallDir[MAX_PATH];
3300 
3301  /* We do not need the filesystem list anymore */
3303 
3304  if (PartitionList == NULL || InstallPartition == NULL)
3305  {
3306  /* FIXME: show an error dialog */
3307  return QUIT_PAGE;
3308  }
3309 
3310  // if (IsUnattendedSetup)
3311  if (RepairUpdateFlag)
3312  wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
3313  else if (USetupData.InstallationDirectory[0])
3314  wcscpy(InstallDir, USetupData.InstallationDirectory);
3315  else
3316  wcscpy(InstallDir, L"\\ReactOS");
3317 
3318  /*
3319  * Check the validity of the predefined 'InstallDir'. If we are either
3320  * in unattended setup or in update/repair mode, and the installation path
3321  * is valid, just perform the installation. Otherwise (either in the case
3322  * of an invalid path, or we are in regular setup), display the UI and allow
3323  * the user to specify a new installation path.
3324  */
3325  if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
3326  {
3328  if (!NT_SUCCESS(Status))
3329  {
3330  DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
3332  return QUIT_PAGE;
3333  }
3334 
3335  /*
3336  * Check whether the user attempts to install ReactOS within the
3337  * installation source directory, or in a subdirectory thereof.
3338  * If so, fail with an error.
3339  */
3340  if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
3341  {
3343  return INSTALL_DIRECTORY_PAGE;
3344  }
3345 
3346  return PREPARE_COPY_PAGE;
3347  }
3348 
3349  Length = wcslen(InstallDir);
3350  Pos = Length;
3351 
3353  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3354  CONSOLE_SetCursorXY(8 + Pos, 11);
3356 
3357  while (TRUE)
3358  {
3359  CONSOLE_ConInKey(Ir);
3360 
3361  if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3362  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3363  {
3365 
3366  if (ConfirmQuit(Ir))
3367  return QUIT_PAGE;
3368 
3370  break;
3371  }
3372  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3373  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
3374  {
3375  if (Pos < Length)
3376  {
3377  memmove(&InstallDir[Pos],
3378  &InstallDir[Pos + 1],
3379  (Length - Pos - 1) * sizeof(WCHAR));
3380  InstallDir[Length - 1] = UNICODE_NULL;
3381 
3382  Length--;
3383  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3384  CONSOLE_SetCursorXY(8 + Pos, 11);
3385  }
3386  }
3387  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3388  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3389  {
3390  Pos = 0;
3391  CONSOLE_SetCursorXY(8 + Pos, 11);
3392  }
3393  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3394  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3395  {
3396  Pos = Length;
3397  CONSOLE_SetCursorXY(8 + Pos, 11);
3398  }
3399  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3400  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
3401  {
3402  if (Pos > 0)
3403  {
3404  Pos--;
3405  CONSOLE_SetCursorXY(8 + Pos, 11);
3406  }
3407  }
3408  else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3409  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
3410  {
3411  if (Pos < Length)
3412  {
3413  Pos++;
3414  CONSOLE_SetCursorXY(8 + Pos, 11);
3415  }
3416  }
3417  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3418  {
3420 
3421  /*
3422  * Check for the validity of the installation directory and pop up
3423  * an error if it is not the case. Then the user can fix its input.
3424  */
3425  if (!IsValidPath(InstallDir))
3426  {
3428  return INSTALL_DIRECTORY_PAGE;
3429  }
3430 
3432  if (!NT_SUCCESS(Status))
3433  {
3434  DPRINT1("InitDestinationPaths() failed. Status code: 0x%lx", Status);
3436  return QUIT_PAGE;
3437  }
3438 
3439  /*
3440  * Check whether the user attempts to install ReactOS within the
3441  * installation source directory, or in a subdirectory thereof.
3442  * If so, fail with an error.
3443  */
3444  if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
3445  {
3447  return INSTALL_DIRECTORY_PAGE;
3448  }
3449 
3450  return PREPARE_COPY_PAGE;
3451  }
3452  else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3453  {
3454  if (Pos > 0)
3455  {
3456  if (Pos < Length)
3457  memmove(&InstallDir[Pos - 1],
3458  &InstallDir[Pos],
3459  (Length - Pos) * sizeof(WCHAR));
3460  InstallDir[Length - 1] = UNICODE_NULL;
3461 
3462  Pos--;
3463  Length--;
3464  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3465  CONSOLE_SetCursorXY(8 + Pos, 11);
3466  }
3467  }
3468  else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3469  {
3470  if (Length < 50)
3471  {
3473  if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
3474  {
3475  if (Pos < Length)
3476  memmove(&InstallDir[Pos + 1],
3477  &InstallDir[Pos],
3478  (Length - Pos) * sizeof(WCHAR));
3479  InstallDir[Length + 1] = UNICODE_NULL;
3480  InstallDir[Pos] = c;
3481 
3482  Pos++;
3483  Length++;
3484  CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3485  CONSOLE_SetCursorXY(8 + Pos, 11);
3486  }
3487  }
3488  }
3489  }
3490 
3491  return INSTALL_DIRECTORY_PAGE;
3492 }
#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:2522
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define iswdigit(_c)
Definition: ctype.h:667
LONG NTSTATUS
Definition: precomp.h:26
static PPARTENTRY InstallPartition
Definition: usetup.c:50
ush Pos
Definition: deflate.h:92
#define VK_LEFT
Definition: winuser.h:2199
#define iswalpha(_c)
Definition: ctype.h:664
VOID CONSOLE_SetInputTextXY(IN SHORT x, IN SHORT y, IN SHORT len, IN LPCWSTR Text)
Definition: consup.c: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:3238
#define VK_HOME
Definition: winuser.h:2198
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
VOID CONSOLE_SetCursorType(IN BOOL bInsert, IN BOOL bVisible)
Definition: consup.c:214
#define VK_DELETE
Definition: winuser.h:2208
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:2232
union _KEY_EVENT_RECORD::@3241 uChar
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:429
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:216
#define VK_RIGHT
Definition: winuser.h:2201
#define POPUP_WAIT_ENTER
Definition: usetup.h: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
union _INPUT_RECORD::@3242 Event
#define isprint(c)
Definition: acclib.h:73
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
VOID CONSOLE_SetCursorXY(IN SHORT x, IN SHORT y)
Definition: consup.c:227
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:627
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:87
#define VK_END
Definition: winuser.h:2197
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 1068 of file usetup.c.

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

Referenced by RunUSetup().

◆ IsDiskSizeValid()

static BOOL IsDiskSizeValid ( PPARTENTRY  PartEntry)
static

Definition at line 1495 of file usetup.c.

1496 {
1497  ULONGLONG size;
1498 
1499  size = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector;
1500  size = (size + (512 * KB)) / MB; /* in MBytes */
1501 
1502  if (size < USetupData.RequiredPartitionDiskSpace)
1503  {
1504  /* Partition is too small so ask for another one */
1505  DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, USetupData.RequiredPartitionDiskSpace);
1506  return FALSE;
1507  }
1508  else
1509  {
1510  return TRUE;
1511  }
1512 }
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 3238 of file usetup.c.

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

1454 {
1455  GENERIC_LIST_UI ListUi;
1457 
1458  InitGenericListUi(&ListUi, USetupData.KeyboardList, GetSettingDescription);
1459  DrawGenericList(&ListUi,
1460  2, 18,
1461  xScreen - 3,
1462  yScreen - 3);
1463 
1464  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1465 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1336
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ LanguagePage()

static PAGE_NUMBER LanguagePage ( PINPUT_RECORD  Ir)
static

Definition at line 543 of file usetup.c.

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

1480 {
1481  GENERIC_LIST_UI ListUi;
1483 
1484  InitGenericListUi(&ListUi, USetupData.LayoutList, GetSettingDescription);
1485  DrawGenericList(&ListUi,
1486  2, 18,
1487  xScreen - 3,
1488  yScreen - 3);
1489 
1490  return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1491 }
static USETUP_DATA USetupData
Definition: usetup.c:47
SHORT xScreen
Definition: consup.c:39
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1336
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
SHORT yScreen
Definition: consup.c:40
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:491

Referenced by RunUSetup().

◆ LicensePage()

static PAGE_NUMBER LicensePage ( PINPUT_RECORD  Ir)
static

Definition at line 839 of file usetup.c.

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

Referenced by RunUSetup().

◆ NtProcessStartup()

VOID NTAPI NtProcessStartup ( PPEB  Peb)

Definition at line 4675 of file usetup.c.

4676 {
4677  NTSTATUS Status;
4679 
4681 
4683 
4685 
4686  Status = RunUSetup();
4687 
4688  if (NT_SUCCESS(Status))
4689  {
4690  /*
4691  * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
4692  * a protective waiting.
4693  * This wait is needed because, since we are started as SMSS.EXE,
4694  * the NT kernel explicitly waits 5 seconds for the initial process
4695  * SMSS.EXE to initialize (as a protective measure), and otherwise
4696  * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
4697  */
4698  Time.QuadPart += 50000000;
4700  }
4701  else
4702  {
4703  /* The installer failed to start: raise a hard error (crash the system/BSOD) */
4705  0, 0, NULL, 0, NULL);
4706  }
4707 
4709 }
PPEB Peb
Definition: dllmain.c:27
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:553
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS RunUSetup(VOID)
Definition: usetup.c:4451
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1959
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
#define FALSE
Definition: types.h:117
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;
378  0xC3, // '+',
379  1,
380  coPos,
381  &Written);
382 
383  coPos.X = xLeft + 1;
385  0xC4, // '-',
386  Width - 2,
387  coPos,
388  &Written);
389 
390  coPos.X = xLeft + Width - 1;
392  0xB4, // '+',
393  1,
394  coPos,
395  &Written);
396 
397  coPos.Y++;
398  coPos.X = xLeft + 2;
400  Status,
401  min(strlen(Status), (SIZE_T)Width - 4),
402  coPos,
403  &Written);
404  }
405 
406  if (WaitEvent == POPUP_WAIT_NONE)
407  return;
408 
409  while (TRUE)
410  {
411  CONSOLE_ConInKey(Ir);
412 
413  if (WaitEvent == POPUP_WAIT_ANY_KEY ||
414  Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
415  {
416  return;
417  }
418  }
419 }
signed char * PCHAR
Definition: retypes.h:7
_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:522
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
#define FOREGROUND_RED
Definition: blue.h:63
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:124
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:557
#define FALSE
Definition: types.h:117
short SHORT
Definition: pedump.c:59
HANDLE StdOutput
Definition: consup.c:37
unsigned char BOOLEAN
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:404
ULONG X
Definition: bl.h:1340
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
union _KEY_EVENT_RECORD::@3241 uChar
Definition: bl.h:1338
SHORT yScreen
Definition: consup.c:40
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static VOID DrawBox(IN SHORT xLeft, IN SHORT yTop, IN SHORT Width, IN SHORT Height)
Definition: usetup.c:166
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
#define BACKGROUND_WHITE
Definition: consup.h:31
char * strchr(const char *String, int ch)
Definition: utclib.c:501
union _INPUT_RECORD::@3242 Event
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
ULONG Y
Definition: bl.h:1341
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c: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 3531 of file usetup.c.

3532 {
3533  // ERROR_NUMBER ErrorNumber;
3534  BOOLEAN Success;
3535 
3537 
3538  /* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
3539  if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
3540  {
3541  // MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
3542  return QUIT_PAGE;
3543  }
3544 
3545  return FILE_COPY_PAGE;
3546 }
static USETUP_DATA USetupData
Definition: usetup.c:47
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
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 4234 of file usetup.c.

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

4192 {
4193  ULONG OldProgress = Bar->Progress;
4194 
4195  if (Bar->StepCount == 0)
4196  {
4197  Bar->Progress = 0;
4198  }
4199  else
4200  {
4201  Bar->Progress = Bar->StepCount - Bar->CurrentStep;
4202  }
4203 
4204  /* Build the progress string if it has changed */
4205  if (Bar->ProgressFormatText &&
4206  (AlwaysUpdate || (Bar->Progress != OldProgress)))
4207  {
4209  Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
4210 
4211  return TRUE;
4212  }
4213 
4214  return FALSE;
4215 }
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 4371 of file usetup.c.

4372 {
4374 
4375  /* Destroy the NTOS installations list */
4376  if (NtOsInstallsList != NULL)
4377  {
4380  }
4381 
4382  /* Destroy the partition list */
4383  if (PartitionList != NULL)
4384  {
4386  PartitionList = NULL;
4387  }
4388 
4389  /* Reset the formatter machine state */
4390  TempPartition = NULL;
4391  FormatState = Start;
4392 
4393  /* Destroy the filesystem list */
4395 
4397 
4398  /* Wait for maximum 15 seconds or an ENTER key before quitting */
4399  ProgressCountdown(Ir, 15);
4400  return FLUSH_PAGE;
4401 }
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2522
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
static PPARTENTRY TempPartition
Definition: usetup.c:82
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:149
#define TRUE
Definition: types.h:120
#define STRING_REBOOTCOMPUTER2
Definition: mui.h:142
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:88
static VOID ProgressCountdown(IN PINPUT_RECORD Ir, IN LONG TimeOut)
Definition: usetup.c:4234
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 3826 of file usetup.c.

3827 {
3828  ULONG Error;
3829 
3831 
3834  PartitionList,
3838  &s_SubstSettings);
3839  if (Error != ERROR_SUCCESS)
3840  {
3842  return QUIT_PAGE;
3843  }
3844  else
3845  {
3847  return BOOT_LOADER_PAGE;
3848  }
3849 }
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:149
static PPARTENTRY InstallPartition
Definition: usetup.c:50
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: usetup.c:3782
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
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:216
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:141
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 3782 of file usetup.c.

3783 {
3784  /* WARNING: Please keep this lookup table in sync with the resources! */
3785  static const UINT StringIDs[] =
3786  {
3787  STRING_DONE, /* Success */
3788  STRING_REGHIVEUPDATE, /* RegHiveUpdate */
3789  STRING_IMPORTFILE, /* ImportRegHive */
3790  STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
3791  STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
3792  STRING_ADDKBLAYOUTS, /* KeybLayouts */
3793  STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
3794  STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
3795  };
3796 
3797  va_list args;
3798 
3799  if (RegStatus < ARRAYSIZE(StringIDs))
3800  {
3801  va_start(args, RegStatus);
3802  CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
3803  va_end(args);
3804  }
3805  else
3806  {
3807  CONSOLE_SetStatusText("Unknown status %d", RegStatus);
3808  }
3809 }
#define args
Definition: format.c:66
#define STRING_DISPLAYSETTINGSUPDATE
Definition: mui.h:137
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:136
#define va_end(ap)
Definition: acmsvcex.h:90
#define STRING_KEYBOARDSETTINGSUPDATE
Definition: mui.h:139
char * va_list
Definition: acmsvcex.h:78
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
va_start(ap, x)
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:486
#define STRING_DONE
Definition: mui.h:141
unsigned int UINT
Definition: ndis.h:50
#define STRING_LOCALESETTINGSUPDATE
Definition: mui.h:138
#define STRING_CODEPAGEINFOUPDATE
Definition: mui.h:140
#define STRING_ADDKBLAYOUTS
Definition: mui.h:166
#define STRING_REGHIVEUPDATE
Definition: mui.h:135

Referenced by RegistryPage().

◆ RepairIntroPage()

static PAGE_NUMBER RepairIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 870 of file usetup.c.

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

Referenced by RunUSetup().

◆ ResetFileSystemList()

static VOID ResetFileSystemList ( VOID  )
static

Definition at line 2522 of file usetup.c.

2523 {
2524  if (!FileSystemList)
2525  return;
2526 
2528  FileSystemList = NULL;
2529 }
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 4451 of file usetup.c.

4452 {
4453  NTSTATUS Status;
4454  INPUT_RECORD Ir;
4455  PAGE_NUMBER Page;
4456  BOOLEAN Old;
4457 
4459 
4460  /* Tell the Cm this is a setup boot, and it has to behave accordingly */
4462  if (!NT_SUCCESS(Status))
4463  DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
4464 
4465  /* Initialize the user-mode PnP manager */
4467  if (!NT_SUCCESS(Status))
4468  {
4469  // PrintString(??);
4470  DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
4471  }
4472 
4473  if (!CONSOLE_Init())
4474  {
4478 
4479  /* We failed to initialize the video, just quit the installer */
4480  return STATUS_APP_INIT_FAILURE;
4481  }
4482 
4483  /* Initialize Setup, phase 0 */
4485  USetupData.ErrorRoutine = USetupErrorRoutine;
4486 
4487  /* Hide the cursor and clear the screen and keyboard buffer */
4490  CONSOLE_Flush();
4491 
4492  /* Global Initialization page */
4493  Page = SetupStartPage(&Ir);
4494 
4495  while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
4496  {
4498  CONSOLE_Flush();
4499 
4500  // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4501 
4502  switch (Page)
4503  {
4504  /* Language page */
4505  case LANGUAGE_PAGE:
4506  Page = LanguagePage(&Ir);
4507  break;
4508 
4509  /* Welcome page */
4510  case WELCOME_PAGE:
4511  Page = WelcomePage(&Ir);
4512  break;
4513 
4514  /* License page */
4515  case LICENSE_PAGE:
4516  Page = LicensePage(&Ir);
4517  break;
4518 
4519  /* Install pages */
4520  case INSTALL_INTRO_PAGE:
4521  Page = InstallIntroPage(&Ir);
4522  break;
4523 
4524 #if 0
4525  case SCSI_CONTROLLER_PAGE:
4526  Page = ScsiControllerPage(&Ir);
4527  break;
4528 
4529  case OEM_DRIVER_PAGE:
4530  Page = OemDriverPage(&Ir);
4531  break;
4532 #endif
4533 
4534  case DEVICE_SETTINGS_PAGE:
4535  Page = DeviceSettingsPage(&Ir);
4536  break;
4537 
4539  Page = ComputerSettingsPage(&Ir);
4540  break;
4541 
4542  case DISPLAY_SETTINGS_PAGE:
4543  Page = DisplaySettingsPage(&Ir);
4544  break;
4545 
4547  Page = KeyboardSettingsPage(&Ir);
4548  break;
4549 
4550  case LAYOUT_SETTINGS_PAGE:
4551  Page = LayoutSettingsPage(&Ir);
4552  break;
4553 
4554  /* Partitioning pages */
4555  case SELECT_PARTITION_PAGE:
4556  Page = SelectPartitionPage(&Ir);
4557  break;
4558 
4561  break;
4562 
4565  break;
4566 
4569  break;
4570 
4573  break;
4574 
4575  case DELETE_PARTITION_PAGE:
4576  Page = DeletePartitionPage(&Ir);
4577  break;
4578 
4579  /* Filesystem partition operations pages */
4581  Page = SelectFileSystemPage(&Ir);
4582  break;
4583 
4584  case FORMAT_PARTITION_PAGE:
4585  Page = FormatPartitionPage(&Ir);
4586  break;
4587 
4589  Page = CheckFileSystemPage(&Ir);
4590  break;
4591 
4592  /* Installation pages */
4594  Page = InstallDirectoryPage(&Ir);
4595  break;
4596 
4597  case PREPARE_COPY_PAGE:
4598  Page = PrepareCopyPage(&Ir);
4599  break;
4600 
4601  case FILE_COPY_PAGE:
4602  Page = FileCopyPage(&Ir);
4603  break;
4604 
4605  case REGISTRY_PAGE:
4606  Page = RegistryPage(&Ir);
4607  break;
4608 
4609  /* Bootloader installation pages */
4610  case BOOT_LOADER_PAGE:
4611  Page = BootLoaderPage(&Ir);
4612  break;
4613 
4615  Page = BootLoaderFloppyPage(&Ir);
4616  break;
4617 
4620  break;
4621 
4622  /* Repair pages */
4623  case REPAIR_INTRO_PAGE:
4624  Page = RepairIntroPage(&Ir);
4625  break;
4626 
4627  case UPGRADE_REPAIR_PAGE:
4628  Page = UpgradeRepairPage(&Ir);
4629  break;
4630 
4631  case SUCCESS_PAGE:
4632  Page = SuccessPage(&Ir);
4633  break;
4634 
4635  case FLUSH_PAGE:
4636  Page = FlushPage(&Ir);
4637  break;
4638 
4639  case QUIT_PAGE:
4640  Page = QuitPage(&Ir);
4641  break;
4642 
4643  /* Virtual pages */
4644  case SETUP_INIT_PAGE:
4645  case REBOOT_PAGE:
4646  case RECOVERY_PAGE:
4647  break;
4648 
4649  default:
4650  break;
4651  }
4652  }
4653 
4654  /* Terminate the user-mode PnP manager */
4656 
4657  /* Setup has finished */
4659 
4660  if (Page == RECOVERY_PAGE)
4661  RecoveryConsole();
4662 
4663  FreeConsole();
4664 
4665  /* Reboot */
4669 
4670  return STATUS_SUCCESS;
4671 }
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:144
static PAGE_NUMBER BootLoaderPage(PINPUT_RECORD Ir)
Definition: usetup.c:3873
#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:3294
static PAGE_NUMBER SetupStartPage(PINPUT_RECORD Ir)
Definition: usetup.c:702
VOID InfSetHeap(PVOID Heap)
Definition: infrosgen.c:40
#define STRING_CONSOLEFAIL3
Definition: mui.h:145
LONG NTSTATUS
Definition: precomp.h:26
static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:870
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:1068
BOOL CONSOLE_Flush(VOID)
Definition: consup.c:175
static PAGE_NUMBER BootLoaderInstallationPage(PINPUT_RECORD Ir)
Definition: usetup.c:4107
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2427
static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1453
static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir)
Definition: usetup.c:543
#define FALSE
Definition: types.h:117
static PAGE_NUMBER FormatPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:3004
NTSTATUS NTAPI NtInitializeRegistry(IN USHORT Flag)
Definition: ntapi.c:1318
static PAGE_NUMBER BootLoaderFloppyPage(PINPUT_RECORD Ir)
Definition: usetup.c:4050
VOID CONSOLE_ClearScreen(VOID)
Definition: consup.c:239
static VOID PrintString(IN PCSTR fmt,...)
Definition: usetup.c:147
ERROR_NUMBER InitializeSetup(IN OUT PUSETUP_DATA pSetupData, IN ULONG InitPhase)
Definition: setuplib.c:784
enum _PAGE_NUMBER PAGE_NUMBER
unsigned char BOOLEAN
static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3826
VOID CONSOLE_SetCursorType(IN BOOL bInsert, IN BOOL bVisible)
Definition: consup.c:214
HANDLE ProcessHeap
Definition: usetup.c:44
NTSTATUS InitializeUserModePnpManager(IN HINF *phSetupInf)
Definition: devinst.c:559
PFN_NUMBER Page
Definition: section.c:4757
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:230
static PAGE_NUMBER DisplaySettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1427
static PAGE_NUMBER FlushPage(PINPUT_RECORD Ir)
Definition: usetup.c:4440
static PAGE_NUMBER CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2074
Status
Definition: gdiplustypes.h:24
static VOID __cdecl USetupErrorRoutine(IN PUSETUP_DATA pSetupData,...)
Definition: usetup.c:3498
BOOL WINAPI FreeConsole(VOID)
Definition: console.c:153
static PAGE_NUMBER ComputerSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1401
BOOLEAN CONSOLE_Init(VOID)
Definition: consup.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32