ReactOS 0.4.15-dev-8100-g1887773
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_NEW_AUTOCREATE   0x80
 
#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
 

Enumerations

enum  { PartTypeData , PartTypeExtended }
 

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 SetupStartPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER LanguagePage (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 BOOLEAN IsPartitionLargeEnough (_In_ 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 CreatePartitionPage (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 BootLoaderSelectPage (PINPUT_RECORD Ir)
 
static BOOLEAN BootLoaderRemovableDiskPage (PINPUT_RECORD Ir)
 
static BOOLEAN BootLoaderHardDiskPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER BootLoaderInstallPage (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 enum { ... }  PartCreateType = PartTypeData
 
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 1848 of file usetup.c.

◆ PARTITION_NEW_AUTOCREATE

#define PARTITION_NEW_AUTOCREATE   0x80

Definition at line 83 of file usetup.c.

◆ PARTITION_SIZE_INPUT_FIELD_LENGTH

#define PARTITION_SIZE_INPUT_FIELD_LENGTH   9

Definition at line 1846 of file usetup.c.

Typedef Documentation

◆ COPYCONTEXT

◆ PCOPYCONTEXT

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PartTypeData 
PartTypeExtended 

Definition at line 77 of file usetup.c.

77 {
78 PartTypeData, // On MBR-disks, primary or logical partition
79 PartTypeExtended // MBR-disk container
@ PartTypeData
Definition: usetup.c:78
@ PartTypeExtended
Definition: usetup.c:79
static enum @64 PartCreateType

Function Documentation

◆ BootLoaderHardDiskPage()

static BOOLEAN BootLoaderHardDiskPage ( PINPUT_RECORD  Ir)
static

Definition at line 3802 of file usetup.c.

3803{
3805 WCHAR DestinationDevicePathBuffer[MAX_PATH];
3806
3807 if (USetupData.MBRInstallType == 2)
3808 {
3809 /* Step 1: Write the VBR */
3814 if (!NT_SUCCESS(Status))
3815 {
3818 return FALSE;
3819 }
3820
3821 /* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
3823 {
3824 RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
3825 L"\\Device\\Harddisk%d\\Partition0",
3826 SystemPartition->DiskEntry->DiskNumber);
3829 DestinationDevicePathBuffer);
3830 if (!NT_SUCCESS(Status))
3831 {
3832 DPRINT1("InstallMbrBootCodeToDisk() failed: Status 0x%lx\n", Status);
3834 return FALSE;
3835 }
3836 }
3837 }
3838 else
3839 {
3844 if (!NT_SUCCESS(Status))
3845 {
3848 return FALSE;
3849 }
3850 }
3851
3852 return TRUE;
3853}
LONG NTSTATUS
Definition: precomp.h:26
#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:1381
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
Definition: bootsup.c:831
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
@ ERROR_WRITE_BOOT
Definition: errorcode.h:28
@ ERROR_INSTALL_BOOTCODE
Definition: errorcode.h:35
Status
Definition: gdiplustypes.h:25
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 L(x)
Definition: ntvdm.h:50
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:501
WCHAR FileSystem[MAX_PATH+1]
Definition: partlist.h:60
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
LONG MBRInstallType
Definition: setuplib.h:113
UNICODE_STRING SystemRootPath
Definition: setuplib.h:100
UNICODE_STRING SourceRootPath
Definition: setuplib.h:82
UNICODE_STRING DestinationArcPath
Definition: setuplib.h:103
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
static USETUP_DATA USetupData
Definition: usetup.c:47
static PPARTENTRY SystemPartition
Definition: usetup.c:61
#define POPUP_WAIT_ENTER
Definition: usetup.h:123
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by BootLoaderInstallPage().

◆ BootLoaderInstallPage()

static PAGE_NUMBER BootLoaderInstallPage ( PINPUT_RECORD  Ir)
static

Definition at line 3868 of file usetup.c.

3869{
3870 WCHAR PathBuffer[MAX_PATH];
3871
3872 // /* We must have a supported system partition by now */
3873 // ASSERT(SystemPartition && SystemPartition->IsPartitioned && SystemPartition->PartitionNumber != 0);
3874
3876 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3877 L"\\Device\\Harddisk%lu\\Partition%lu\\",
3878 SystemPartition->DiskEntry->DiskNumber,
3881 DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
3882
3883 if (USetupData.MBRInstallType != 0)
3885
3886 switch (USetupData.MBRInstallType)
3887 {
3888 /* Skip installation */
3889 case 0:
3890 return SUCCESS_PAGE;
3891
3892 /* Install on removable disk */
3893 case 1:
3895
3896 /* Install on hard-disk (both MBR and VBR, or VBR only) */
3897 case 2:
3898 case 3:
3900
3901 default:
3902 return SUCCESS_PAGE;
3903 }
3904}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ULONG PartitionNumber
Definition: partlist.h:55
VOID MUIDisplayPage(IN ULONG page)
Definition: mui.c:170
static BOOLEAN BootLoaderRemovableDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3756
static BOOLEAN BootLoaderHardDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3802
@ SUCCESS_PAGE
Definition: usetup.h:114
@ QUIT_PAGE
Definition: usetup.h:115
@ BOOTLOADER_INSTALL_PAGE
Definition: usetup.h:111

Referenced by RunUSetup().

◆ BootLoaderRemovableDiskPage()

static BOOLEAN BootLoaderRemovableDiskPage ( PINPUT_RECORD  Ir)
static

Definition at line 3756 of file usetup.c.

3757{
3759
3760Retry:
3762 CONSOLE_Flush();
3764// CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
3765
3766 while (TRUE)
3767 {
3768 CONSOLE_ConInKey(Ir);
3769
3770 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3771 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3772 {
3773 if (ConfirmQuit(Ir))
3774 return FALSE;
3775
3776 break;
3777 }
3778 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3779 {
3782 if (!NT_SUCCESS(Status))
3783 {
3786
3787 /* TODO: Print error message */
3788 goto Retry;
3789 }
3790
3791 return TRUE;
3792 }
3793 }
3794
3795 goto Retry;
3796}
NTSTATUS InstallFatBootcodeToFloppy(IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1426
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
BOOL CONSOLE_Flush(VOID)
Definition: consup.c:175
VOID CONSOLE_ConInKey(OUT PINPUT_RECORD Buffer)
Definition: consup.c:70
VOID CONSOLE_ClearScreen(VOID)
Definition: consup.c:239
@ ERROR_NO_FLOPPY
Definition: errorcode.h:36
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
union _INPUT_RECORD::@3296 Event
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
union _KEY_EVENT_RECORD::@3295 uChar
WORD wVirtualKeyCode
Definition: wincon.h:242
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:436
@ BOOTLOADER_REMOVABLE_DISK_PAGE
Definition: usetup.h:112
#define VK_F3
Definition: winuser.h:2257

Referenced by BootLoaderInstallPage().

◆ BootLoaderSelectPage()

static PAGE_NUMBER BootLoaderSelectPage ( PINPUT_RECORD  Ir)
static

Definition at line 3602 of file usetup.c.

3603{
3604 USHORT Line = 12;
3605
3607
3608 /* We must have a supported system partition by now */
3610
3611 /*
3612 * If we repair an existing installation and we made it up to here,
3613 * this means a valid bootloader and boot entry have been found.
3614 * Thus, there is no need to re-install it: skip its installation.
3615 */
3616 if (RepairUpdateFlag)
3617 {
3619 goto Quit;
3620 }
3621
3622 /* For unattended setup, skip MBR installation or install on removable disk if needed */
3624 {
3625 if ((USetupData.MBRInstallType == 0) ||
3627 {
3628 goto Quit;
3629 }
3630 }
3631
3632 /*
3633 * We may install an MBR or VBR, but before that, check whether
3634 * we need to actually install the VBR on removable disk if the
3635 * system partition is not recognized.
3636 */
3637 if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
3639 {
3641 goto Quit;
3642 }
3643
3644 /* Is it an unattended install on hdd? */
3646 {
3647 if ((USetupData.MBRInstallType == 2) ||
3649 {
3650 goto Quit;
3651 }
3652 }
3653
3655 CONSOLE_InvertTextXY(8, Line, 60, 1);
3656
3657 while (TRUE)
3658 {
3659 CONSOLE_ConInKey(Ir);
3660
3661 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3662 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
3663 {
3664 CONSOLE_NormalTextXY(8, Line, 60, 1);
3665
3666 Line++;
3667 if (Line < 12)
3668 Line = 15;
3669
3670 if (Line > 15)
3671 Line = 12;
3672
3673 CONSOLE_InvertTextXY(8, Line, 60, 1);
3674 }
3675 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3676 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
3677 {
3678 CONSOLE_NormalTextXY(8, Line, 60, 1);
3679
3680 Line--;
3681 if (Line < 12)
3682 Line = 15;
3683
3684 if (Line > 15)
3685 Line = 12;
3686
3687 CONSOLE_InvertTextXY(8, Line, 60, 1);
3688 }
3689 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3690 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3691 {
3692 CONSOLE_NormalTextXY(8, Line, 60, 1);
3693
3694 Line = 12;
3695
3696 CONSOLE_InvertTextXY(8, Line, 60, 1);
3697 }
3698 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3699 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3700 {
3701 CONSOLE_NormalTextXY(8, Line, 60, 1);
3702
3703 Line = 15;
3704
3705 CONSOLE_InvertTextXY(8, Line, 60, 1);
3706 }
3707 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3708 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3709 {
3710 if (ConfirmQuit(Ir))
3711 return QUIT_PAGE;
3712
3713 break;
3714 }
3715 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3716 {
3717 if (Line == 12)
3718 {
3719 /* Install on both MBR and VBR */
3721 break;
3722 }
3723 else if (Line == 13)
3724 {
3725 /* Install on VBR only */
3727 break;
3728 }
3729 else if (Line == 14)
3730 {
3731 /* Install on removable disk */
3733 break;
3734 }
3735 else if (Line == 15)
3736 {
3737 /* Skip installation */
3739 break;
3740 }
3741
3743 }
3744 }
3745
3746Quit:
3747 /* Continue the installation; the bootloader is installed at the end */
3749}
VOID CONSOLE_InvertTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:276
VOID CONSOLE_NormalTextXY(IN SHORT x, IN SHORT y, IN SHORT col, IN SHORT row)
Definition: consup.c:298
VOID __cdecl CONSOLE_SetStatusText(IN LPCSTR fmt,...)
Definition: consup.c:480
#define ASSERT(a)
Definition: mode.c:44
@ PARTITION_STYLE_MBR
Definition: imports.h:201
#define IsRecognizedPartition(PartitionType)
Definition: ntdddisk.h:342
unsigned short USHORT
Definition: pedump.c:61
Definition: ncftp.h:79
BOOLEAN IsPartitioned
Definition: partlist.h:66
UCHAR PartitionType
Definition: partlist.h:53
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
#define STRING_PLEASEWAIT
Definition: mui.h:132
BOOLEAN IsUnattendedSetup
Definition: usetup.c:45
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:70
@ BOOTLOADER_SELECT_PAGE
Definition: usetup.h:105
@ INSTALL_DIRECTORY_PAGE
Definition: usetup.h:108
#define VK_UP
Definition: winuser.h:2225
#define VK_END
Definition: winuser.h:2222
#define VK_HOME
Definition: winuser.h:2223
#define VK_DOWN
Definition: winuser.h:2227

Referenced by RunUSetup().

◆ CheckFileSystemPage()

static PAGE_NUMBER CheckFileSystemPage ( PINPUT_RECORD  Ir)
static

Definition at line 2884 of file usetup.c.

2885{
2887 PPARTENTRY PartEntry;
2889
2890 if (PartitionList == NULL)
2891 {
2892 /* FIXME: show an error dialog */
2893 return QUIT_PAGE;
2894 }
2895
2896 if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry))
2897 {
2899 }
2900
2901 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2902
2903 DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
2904 PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a"));
2905
2907
2909 CONSOLE_SetTextXY(6, 10, Buffer);
2910
2913 Buffer);
2914
2915 /* Check the partition */
2916 Status = DoChkdsk(PartEntry);
2918 {
2919 /*
2920 * Partition checking is not supported with the current filesystem,
2921 * so disable FS checks on it.
2922 */
2923 PartEntry->NeedsCheck = FALSE;
2924
2926 sizeof(Buffer),
2927 "Setup is currently unable to check a partition formatted in %S.\n"
2928 "\n"
2929 " \x07 Press ENTER to continue Setup.\n"
2930 " \x07 Press F3 to quit Setup.",
2931 PartEntry->FileSystem);
2932
2936
2937 while (TRUE)
2938 {
2939 CONSOLE_ConInKey(Ir);
2940
2941 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2942 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2943 {
2944 if (ConfirmQuit(Ir))
2945 return QUIT_PAGE;
2946 else
2948 }
2949 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2950 {
2952 }
2953 }
2954 }
2955 else if (!NT_SUCCESS(Status))
2956 {
2957 DPRINT1("DoChkdsk() failed: Status 0x%08lx\n", Status);
2958
2960 sizeof(Buffer),
2961 "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
2962 Status);
2963
2966 Ir, POPUP_WAIT_ENTER);
2967 }
2968
2969 PartEntry->NeedsCheck = FALSE;
2971}
NTSTATUS DoChkdsk(IN PPARTENTRY PartEntry)
Definition: chkdsk.c:57
Definition: bufpool.h:45
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:320
VOID __cdecl CONSOLE_PrintTextXY(IN SHORT x, IN SHORT y, IN LPCSTR fmt,...)
Definition: consup.c:595
#define NULL
Definition: types.h:112
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
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
BOOLEAN GetNextUncheckedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:4057
VOID PartitionDescription(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:148
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
Definition: partlist.c:301
BOOLEAN NeedsCheck
Definition: partlist.h:74
#define STRING_CONTINUE
Definition: mui.h:149
#define STRING_HDDISK2
Definition: mui.h:174
#define STRING_QUITCONTINUE
Definition: mui.h:150
VOID PopupError(PCCH Text, PCCH Status, PINPUT_RECORD Ir, ULONG WaitEvent)
Definition: usetup.c:263
static PPARTLIST PartitionList
Definition: usetup.c:73
@ CHECK_FILE_SYSTEM_PAGE
Definition: usetup.h:104
#define POPUP_WAIT_NONE
Definition: usetup.h:121
#define VK_RETURN
Definition: winuser.h:2201
char CHAR
Definition: xmlstorage.h:175

Referenced by RunUSetup().

◆ ComputerSettingsPage()

static PAGE_NUMBER ComputerSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1416 of file usetup.c.

1417{
1418 GENERIC_LIST_UI ListUi;
1420
1422 DrawGenericList(&ListUi,
1423 2, 18,
1424 xScreen - 3,
1425 yScreen - 3);
1426
1427 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1428}
SHORT yScreen
Definition: consup.c:40
SHORT xScreen
Definition: consup.c:39
PGENERIC_LIST ComputerList
Definition: setuplib.h:119
VOID InitGenericListUi(IN OUT PGENERIC_LIST_UI ListUi, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: genlist.c:37
VOID DrawGenericList(IN PGENERIC_LIST_UI ListUi, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: genlist.c:326
static NTSTATUS NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:500
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1351
@ COMPUTER_SETTINGS_PAGE
Definition: usetup.h:91
@ DEVICE_SETTINGS_PAGE
Definition: usetup.h:90

Referenced by RunUSetup().

◆ ConfirmDeleteSystemPartitionPage()

static PAGE_NUMBER ConfirmDeleteSystemPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2159 of file usetup.c.

2160{
2162
2163 while (TRUE)
2164 {
2165 CONSOLE_ConInKey(Ir);
2166
2167 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2168 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2169 {
2170 if (ConfirmQuit(Ir))
2171 return QUIT_PAGE;
2172
2173 break;
2174 }
2175 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2176 {
2177 return DELETE_PARTITION_PAGE;
2178 }
2179 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2180 {
2181 return SELECT_PARTITION_PAGE;
2182 }
2183 }
2184
2186}
@ DELETE_PARTITION_PAGE
Definition: usetup.h:100
@ SELECT_PARTITION_PAGE
Definition: usetup.h:96
@ CONFIRM_DELETE_SYSTEM_PARTITION_PAGE
Definition: usetup.h:99
#define VK_ESCAPE
Definition: winuser.h:2214

Referenced by RunUSetup().

◆ ConfirmQuit()

static BOOL ConfirmQuit ( PINPUT_RECORD  Ir)
static

Definition at line 436 of file usetup.c.

437{
438 BOOL Result = FALSE;
440
441 while (TRUE)
442 {
444
445 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
446 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
447 {
448 Result = TRUE;
449 break;
450 }
451 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
452 {
453 Result = FALSE;
454 break;
455 }
456 }
457
458 return Result;
459}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_NOT_INSTALLED
Definition: setupapi.h:292
_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:409

Referenced by BootLoaderRemovableDiskPage(), BootLoaderSelectPage(), CheckFileSystemPage(), ConfirmDeleteSystemPartitionPage(), CreatePartitionPage(), DeletePartitionPage(), DeviceSettingsPage(), FormatPartitionPage(), HandleGenericList(), InstallDirectoryPage(), InstallIntroPage(), LanguagePage(), SelectFileSystemPage(), SelectPartitionPage(), UpgradeRepairPage(), and WelcomePage().

◆ CreatePartitionPage()

static PAGE_NUMBER CreatePartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2045 of file usetup.c.

2046{
2047 PPARTENTRY PartEntry;
2048 PDISKENTRY DiskEntry;
2049 ULONG uID;
2050 ULONG MaxSize;
2051 ULONGLONG MaxPartSize, PartSize;
2052 BOOLEAN Quit, Cancel;
2053 WCHAR InputBuffer[50];
2054 CHAR LineBuffer[100];
2055
2057 {
2058 /* FIXME: show an error dialog */
2059 return QUIT_PAGE;
2060 }
2061
2063 {
2067 }
2068 else // if (PartCreateType == PartTypeExtended)
2069 {
2071 }
2072
2073 CONSOLE_SetTextXY(6, 8, MUIGetString(uID));
2074
2075 PartEntry = CurrentPartition;
2076 DiskEntry = CurrentPartition->DiskEntry;
2077
2078 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2080 LineBuffer);
2081
2083
2085
2086 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
2087
2088 while (TRUE)
2089 {
2090 /* Retrieve the maximum size in MB (rounded up)
2091 * and cap it with what the user can enter */
2092 MaxSize = (ULONG)RoundingDivide(MaxPartSize, MB);
2093 MaxSize = min(MaxSize, PARTITION_MAXSIZE);
2094
2095 ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17,
2096 MaxSize, InputBuffer, &Quit, &Cancel);
2097 if (Quit)
2098 {
2099 if (ConfirmQuit(Ir))
2100 return QUIT_PAGE;
2101 break;
2102 }
2103 else if (Cancel)
2104 {
2105 return SELECT_PARTITION_PAGE;
2106 }
2107
2108 PartSize = _wcstoui64(InputBuffer, NULL, 10);
2109
2110 /* Retry if too small or too large */
2111 if ((PartSize < 1) || (PartSize > MaxSize))
2112 continue;
2113
2114 /*
2115 * If the input size, given in MB, specifies the maximum partition
2116 * size, it may slightly under- or over-estimate it due to rounding
2117 * error. In this case, use all of the unpartitioned disk space.
2118 * Otherwise, directly convert the size to bytes.
2119 */
2120 if (PartSize == MaxSize)
2121 PartSize = MaxPartSize;
2122 else // if (PartSize < MaxSize)
2123 PartSize *= MB;
2124 DPRINT("Partition size: %I64u bytes\n", PartSize);
2125
2126 ASSERT(PartSize <= MaxPartSize);
2127
2129 {
2132 PartSize);
2133 }
2134 else // if (PartCreateType == PartTypeExtended)
2135 {
2138 PartSize);
2139 }
2140
2141 return SELECT_PARTITION_PAGE;
2142 }
2143
2144 return CREATE_PARTITION_PAGE;
2145}
unsigned char BOOLEAN
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:230
void Cancel(int sigNum)
Definition: shell.c:481
#define min(a, b)
Definition: monoChain.cc:55
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:95
BOOLEAN CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes)
Definition: partlist.c:2869
BOOLEAN CreateExtendedPartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes)
Definition: partlist.c:2930
#define MB
Definition: setuplib.h:56
#define DPRINT
Definition: sndvol32.h:73
BOOLEAN LogicalPartition
Definition: partlist.h:63
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define STRING_CREATEPARTITION
Definition: mui.h:142
#define STRING_CHOOSE_NEW_EXTENDED_PARTITION
Definition: mui.h:139
#define STRING_HDDISK1
Definition: mui.h:173
#define STRING_CHOOSE_NEW_PARTITION
Definition: mui.h:138
#define STRING_HDPARTSIZE
Definition: mui.h:141
#define STRING_CHOOSE_NEW_LOGICAL_PARTITION
Definition: mui.h:140
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
#define PARTITION_MAXSIZE
Definition: usetup.c:1848
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1851
@ CREATE_PARTITION_PAGE
Definition: usetup.h:97
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
unsigned __int64 CDECL _wcstoui64(const wchar_t *nptr, wchar_t **endptr, int base)
Definition: wtoi64.c:200

Referenced by RunUSetup().

◆ DeletePartitionPage()

static PAGE_NUMBER DeletePartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 2200 of file usetup.c.

2201{
2202 PPARTENTRY PartEntry;
2203 PDISKENTRY DiskEntry;
2204 CHAR LineBuffer[100];
2205
2207 {
2208 /* FIXME: show an error dialog */
2209 return QUIT_PAGE;
2210 }
2211
2212 PartEntry = CurrentPartition;
2213 DiskEntry = CurrentPartition->DiskEntry;
2214
2216
2217 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2218 CONSOLE_SetTextXY(6, 10, LineBuffer);
2219
2220 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2222 LineBuffer);
2223
2224 while (TRUE)
2225 {
2226 CONSOLE_ConInKey(Ir);
2227
2228 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2229 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2230 {
2231 if (ConfirmQuit(Ir))
2232 return QUIT_PAGE;
2233
2234 break;
2235 }
2236 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2237 {
2238 return SELECT_PARTITION_PAGE;
2239 }
2240 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
2241 {
2245 return SELECT_PARTITION_PAGE;
2246 }
2247 }
2248
2249 return DELETE_PARTITION_PAGE;
2250}
BOOLEAN DeletePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, OUT PPARTENTRY *FreeRegion OPTIONAL)
Definition: partlist.c:3091

Referenced by RunUSetup().

◆ DeviceSettingsPage()

static PAGE_NUMBER DeviceSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1219 of file usetup.c.

1220{
1221 static ULONG Line = 16;
1222
1223 /* Initialize the computer settings list */
1225 {
1228 {
1230 return QUIT_PAGE;
1231 }
1232 }
1233
1234 /* Initialize the display settings list */
1236 {
1239 {
1241 return QUIT_PAGE;
1242 }
1243 }
1244
1245 /* Initialize the keyboard settings list */
1247 {
1250 {
1252 return QUIT_PAGE;
1253 }
1254 }
1255
1256 /* Initialize the keyboard layout list */
1258 {
1261 {
1262 /* FIXME: report error */
1264 return QUIT_PAGE;
1265 }
1266 }
1267
1268 if (RepairUpdateFlag)
1269 return SELECT_PARTITION_PAGE;
1270
1271 // if (IsUnattendedSetup)
1272 // return SELECT_PARTITION_PAGE;
1273
1275
1280
1281 CONSOLE_InvertTextXY(24, Line, 48, 1);
1282
1283 while (TRUE)
1284 {
1285 CONSOLE_ConInKey(Ir);
1286
1287 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1288 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1289 {
1290 CONSOLE_NormalTextXY(24, Line, 48, 1);
1291
1292 if (Line == 14)
1293 Line = 16;
1294 else if (Line == 16)
1295 Line = 11;
1296 else
1297 Line++;
1298
1299 CONSOLE_InvertTextXY(24, Line, 48, 1);
1300 }
1301 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1302 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1303 {
1304 CONSOLE_NormalTextXY(24, Line, 48, 1);
1305
1306 if (Line == 11)
1307 Line = 16;
1308 else if (Line == 16)
1309 Line = 14;
1310 else
1311 Line--;
1312
1313 CONSOLE_InvertTextXY(24, Line, 48, 1);
1314 }
1315 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1316 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1317 {
1318 if (ConfirmQuit(Ir))
1319 return QUIT_PAGE;
1320
1321 break;
1322 }
1323 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1324 {
1325 if (Line == 11)
1327 else if (Line == 12)
1328 return DISPLAY_SETTINGS_PAGE;
1329 else if (Line == 13)
1331 else if (Line == 14)
1332 return LAYOUT_SETTINGS_PAGE;
1333 else if (Line == 16)
1334 return SELECT_PARTITION_PAGE;
1335 }
1336 }
1337
1338 return DEVICE_SETTINGS_PAGE;
1339}
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1072
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:524
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:708
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1209
@ ERROR_LOAD_KBLAYOUT
Definition: errorcode.h:32
@ ERROR_LOAD_KEYBOARD
Definition: errorcode.h:31
@ ERROR_LOAD_DISPLAY
Definition: errorcode.h:30
@ ERROR_LOAD_COMPUTER
Definition: errorcode.h:29
PGENERIC_LIST DisplayList
Definition: setuplib.h:120
PGENERIC_LIST LayoutList
Definition: setuplib.h:122
HINF SetupInf
Definition: setuplib.h:76
PGENERIC_LIST KeyboardList
Definition: setuplib.h:121
VOID DrawGenericListCurrentItem(IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc, IN SHORT Left, IN SHORT Top)
Definition: genlist.c:353
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:68
PCWSTR SelectedLanguageId
Definition: usetup.c:66
@ LAYOUT_SETTINGS_PAGE
Definition: usetup.h:94
@ DISPLAY_SETTINGS_PAGE
Definition: usetup.h:92
@ KEYBOARD_SETTINGS_PAGE
Definition: usetup.h:93

Referenced by RunUSetup().

◆ DisplaySettingsPage()

static PAGE_NUMBER DisplaySettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1442 of file usetup.c.

1443{
1444 GENERIC_LIST_UI ListUi;
1446
1448 DrawGenericList(&ListUi,
1449 2, 18,
1450 xScreen - 3,
1451 yScreen - 3);
1452
1453 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1454}

Referenced by RunUSetup().

◆ DrawBox()

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

Definition at line 173 of file usetup.c.

177{
178 COORD coPos;
179 DWORD Written;
180
181 /* Draw upper left corner */
182 coPos.X = xLeft;
183 coPos.Y = yTop;
185 CharUpperLeftCorner, // '+',
186 1,
187 coPos,
188 &Written);
189
190 /* Draw upper edge */
191 coPos.X = xLeft + 1;
192 coPos.Y = yTop;
194 CharHorizontalLine, // '-',
195 Width - 2,
196 coPos,
197 &Written);
198
199 /* Draw upper right corner */
200 coPos.X = xLeft + Width - 1;
201 coPos.Y = yTop;
203 CharUpperRightCorner, // '+',
204 1,
205 coPos,
206 &Written);
207
208 /* Draw right edge, inner space and left edge */
209 for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
210 {
211 coPos.X = xLeft;
213 CharVerticalLine, // '|',
214 1,
215 coPos,
216 &Written);
217
218 coPos.X = xLeft + 1;
220 ' ',
221 Width - 2,
222 coPos,
223 &Written);
224
225 coPos.X = xLeft + Width - 1;
227 CharVerticalLine, // '|',
228 1,
229 coPos,
230 &Written);
231 }
232
233 /* Draw lower left corner */
234 coPos.X = xLeft;
235 coPos.Y = yTop + Height - 1;
237 CharLowerLeftCorner, // '+',
238 1,
239 coPos,
240 &Written);
241
242 /* Draw lower edge */
243 coPos.X = xLeft + 1;
244 coPos.Y = yTop + Height - 1;
246 CharHorizontalLine, // '-',
247 Width - 2,
248 coPos,
249 &Written);
250
251 /* Draw lower right corner */
252 coPos.X = xLeft + Width - 1;
253 coPos.Y = yTop + Height - 1;
255 CharLowerRightCorner, // '+',
256 1,
257 coPos,
258 &Written);
259}
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:560
HANDLE StdOutput
Definition: consup.c:37
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: bl.h:1338
ULONG Y
Definition: bl.h:1340
ULONG X
Definition: bl.h:1339
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
CHAR CharHorizontalLine
Definition: mui.c:39
CHAR CharUpperRightCorner
Definition: mui.c:42
CHAR CharLowerRightCorner
Definition: mui.c:44
CHAR CharUpperLeftCorner
Definition: mui.c:41
CHAR CharVerticalLine
Definition: mui.c:40
CHAR CharLowerLeftCorner
Definition: mui.c:43

Referenced by PopupError(), and ShowPartitionSizeInputBox().

◆ FileCopyCallback()

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

Definition at line 3322 of file usetup.c.

3326{
3327 PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
3328 PFILEPATHS_W FilePathInfo;
3329 PCWSTR SrcFileName, DstFileName;
3330
3331 switch (Notification)
3332 {
3334 {
3335 CopyContext->TotalOperations = (ULONG)Param2;
3336 CopyContext->CompletedOperations = 0;
3337 ProgressSetStepCount(CopyContext->ProgressBar,
3338 CopyContext->TotalOperations);
3339 SetupUpdateMemoryInfo(CopyContext, TRUE);
3340 break;
3341 }
3342
3346 {
3347 FilePathInfo = (PFILEPATHS_W)Param1;
3348
3350 {
3351 /* Display delete message */
3352 ASSERT(Param2 == FILEOP_DELETE);
3353
3354 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3355 if (DstFileName) ++DstFileName;
3356 else DstFileName = FilePathInfo->Target;
3357
3359 DstFileName);
3360 }
3362 {
3363 /* Display move/rename message */
3364 ASSERT(Param2 == FILEOP_RENAME);
3365
3366 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
3367 if (SrcFileName) ++SrcFileName;
3368 else SrcFileName = FilePathInfo->Source;
3369
3370 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3371 if (DstFileName) ++DstFileName;
3372 else DstFileName = FilePathInfo->Target;
3373
3374 if (!wcsicmp(SrcFileName, DstFileName))
3375 Param2 = STRING_MOVING;
3376 else
3377 Param2 = STRING_RENAMING;
3378
3380 SrcFileName, DstFileName);
3381 }
3383 {
3384 static PCSTR s_pszCopying = NULL; /* Cached for speed */
3385
3386 /* Display copy message */
3387 ASSERT(Param2 == FILEOP_COPY);
3388
3389 /* NOTE: When extracting from CABs the Source is the CAB name */
3390 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3391 if (DstFileName) ++DstFileName;
3392 else DstFileName = FilePathInfo->Target;
3393
3394 if (!s_pszCopying)
3395 s_pszCopying = MUIGetString(STRING_COPYING);
3396 CONSOLE_SetStatusText(s_pszCopying, DstFileName);
3397#ifdef __REACTOS__ /* HACK */
3398 DoWatchDestFileName(DstFileName);
3399#endif
3400 }
3401
3402 SetupUpdateMemoryInfo(CopyContext, FALSE);
3403 break;
3404 }
3405
3407 {
3408 FilePathInfo = (PFILEPATHS_W)Param1;
3409
3410 DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
3411 FilePathInfo->Target, FilePathInfo->Win32Error);
3412 return FILEOP_SKIP;
3413 }
3414
3418 {
3419 CopyContext->CompletedOperations++;
3420
3421 /* SYSREG checkpoint */
3422 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
3423 DPRINT1("CHECKPOINT:HALF_COPIED\n");
3424
3425 ProgressNextStep(CopyContext->ProgressBar);
3426 SetupUpdateMemoryInfo(CopyContext, FALSE);
3427 break;
3428 }
3429 }
3430
3431 return FILEOP_DOIT;
3432}
VOID ProgressNextStep(IN PPROGRESSBAR Bar)
Definition: progress.c:361
VOID ProgressSetStepCount(IN PPROGRESSBAR Bar, IN ULONG StepCount)
Definition: progress.c:347
#define wcsrchr
Definition: compat.h:16
#define wcsicmp
Definition: compat.h:15
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define FILEOP_COPY
Definition: fileqsup.h:42
struct _FILEPATHS_W * PFILEPATHS_W
#define FILEOP_SKIP
Definition: fileqsup.h:49
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define SPFILENOTIFY_ENDCOPY
Definition: fileqsup.h:36
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
#define SPFILENOTIFY_COPYERROR
Definition: fileqsup.h:37
#define FILEOP_RENAME
Definition: fileqsup.h:43
#define SPFILENOTIFY_STARTRENAME
Definition: fileqsup.h:31
#define SPFILENOTIFY_ENDRENAME
Definition: fileqsup.h:32
#define FILEOP_DELETE
Definition: fileqsup.h:44
ULONG TotalOperations
Definition: reactos.c:981
ULONG CompletedOperations
Definition: reactos.c:982
PPROGRESSBAR ProgressBar
Definition: usetup.c:3289
UINT Win32Error
Definition: fileqsup.h:62
PCWSTR Source
Definition: fileqsup.h:61
PCWSTR Target
Definition: fileqsup.h:60
const uint16_t * PCWSTR
Definition: typedefs.h:57
const char * PCSTR
Definition: typedefs.h:52
#define STRING_COPYING
Definition: mui.h:155
#define STRING_MOVING
Definition: mui.h:153
#define STRING_DELETING
Definition: mui.h:152
#define STRING_RENAMING
Definition: mui.h:154
struct _COPYCONTEXT * PCOPYCONTEXT
static VOID SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, IN BOOLEAN First)
Definition: usetup.c:3294
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115

Referenced by FileCopyPage().

◆ FileCopyPage()

static PAGE_NUMBER FileCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 3448 of file usetup.c.

3449{
3450 COPYCONTEXT CopyContext;
3451 UINT MemBarWidth;
3452
3454
3455 /* Create context for the copy process */
3456 CopyContext.TotalOperations = 0;
3457 CopyContext.CompletedOperations = 0;
3458
3459 /* Create the progress bar as well */
3460 CopyContext.ProgressBar = CreateProgressBar(13,
3461 26,
3462 xScreen - 13,
3463 yScreen - 20,
3464 10,
3465 24,
3466 TRUE,
3468
3469 // fit memory bars to screen width, distribute them uniform
3470 MemBarWidth = (xScreen - 26) / 5;
3471 MemBarWidth -= MemBarWidth % 2; // make even
3472 /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
3473 /* Create the paged pool progress bar */
3474 CopyContext.MemoryBars[0] = CreateProgressBar(13,
3475 40,
3476 13 + MemBarWidth,
3477 43,
3478 13,
3479 44,
3480 FALSE,
3481 "Kernel Pool");
3482
3483 /* Create the non paged pool progress bar */
3484 CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (MemBarWidth / 2),
3485 40,
3486 (xScreen / 2) + (MemBarWidth / 2),
3487 43,
3488 (xScreen / 2)- (MemBarWidth / 2),
3489 44,
3490 FALSE,
3491 "Kernel Cache");
3492
3493 /* Create the global memory progress bar */
3494 CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - MemBarWidth,
3495 40,
3496 xScreen - 13,
3497 43,
3498 xScreen - 13 - MemBarWidth,
3499 44,
3500 FALSE,
3501 "Free Memory");
3502
3503 /* Do the file copying */
3504 DoFileCopy(&USetupData, FileCopyCallback, &CopyContext);
3505
3506 /* If we get here, we're done, so cleanup the progress bar */
3507 DestroyProgressBar(CopyContext.ProgressBar);
3508 DestroyProgressBar(CopyContext.MemoryBars[0]);
3509 DestroyProgressBar(CopyContext.MemoryBars[1]);
3510 DestroyProgressBar(CopyContext.MemoryBars[2]);
3511
3512 /* Create the $winnt$.inf file */
3514
3515 /* Go display the next page */
3516 return REGISTRY_PAGE;
3517}
BOOLEAN DoFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
Definition: install.c:826
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
VOID DestroyProgressBar(IN OUT PPROGRESSBAR Bar)
Definition: progress.c:339
unsigned int UINT
Definition: ndis.h:50
VOID InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:214
PPROGRESSBAR MemoryBars[4]
Definition: usetup.c:3290
#define STRING_SETUPCOPYINGFILES
Definition: mui.h:156
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: usetup.c:3322
@ FILE_COPY_PAGE
Definition: usetup.h:109
@ REGISTRY_PAGE
Definition: usetup.h:110

Referenced by RunUSetup().

◆ FlushPage()

static PAGE_NUMBER FlushPage ( PINPUT_RECORD  Ir)
static

Definition at line 4184 of file usetup.c.

4185{
4187 return REBOOT_PAGE;
4188}
@ FLUSH_PAGE
Definition: usetup.h:116
@ REBOOT_PAGE
Definition: usetup.h:117

Referenced by RunUSetup().

◆ FormatPartitionPage()

static PAGE_NUMBER FormatPartitionPage ( PINPUT_RECORD  Ir)
static

HACK!!

Definition at line 2727 of file usetup.c.

2728{
2730 PPARTENTRY PartEntry;
2731 PDISKENTRY DiskEntry;
2732 PFILE_SYSTEM_ITEM SelectedFileSystem;
2733 WCHAR PathBuffer[MAX_PATH];
2735
2736 DPRINT("FormatPartitionPage()\n");
2737
2738 if (PartitionList == NULL || TempPartition == NULL)
2739 {
2740 /* FIXME: show an error dialog */
2741 return QUIT_PAGE;
2742 }
2743
2744 PartEntry = TempPartition;
2745 DiskEntry = TempPartition->DiskEntry;
2746
2747 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2748
2749 SelectedFileSystem = FileSystemList->Selected;
2750 ASSERT(SelectedFileSystem && SelectedFileSystem->FileSystem);
2751
2753
2755 CONSOLE_SetTextXY(6, 10, Buffer);
2756
2757 DiskDescription(DiskEntry, Buffer, ARRAYSIZE(Buffer));
2759 Buffer);
2760
2761 while (TRUE)
2762 {
2763 if (!IsUnattendedSetup)
2764 CONSOLE_ConInKey(Ir);
2765
2766 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2767 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2768 {
2769 if (ConfirmQuit(Ir))
2770 {
2771 /* Reset the filesystem list */
2773 return QUIT_PAGE;
2774 }
2775
2776 break;
2777 }
2778 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
2779 {
2780 /*
2781 * Remove the "Press ENTER to continue" message prompt when the ENTER
2782 * key is pressed as the user wants to begin the partition formatting.
2783 */
2786
2787 /* Format the partition */
2788 Status = DoFormat(PartEntry,
2789 SelectedFileSystem->FileSystem,
2790 SelectedFileSystem->QuickFormat);
2792 {
2794
2795 /* Reset the filesystem list */
2797 return QUIT_PAGE;
2798 }
2800 {
2801 /* FIXME: show an error dialog */
2802 // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
2803
2804 /* Reset the filesystem list */
2806 return QUIT_PAGE;
2807 }
2808 else if (Status == STATUS_NOT_SUPPORTED)
2809 {
2811 sizeof(Buffer),
2812 "Setup is currently unable to format a partition in %S.\n"
2813 "\n"
2814 " \x07 Press ENTER to continue Setup.\n"
2815 " \x07 Press F3 to quit Setup.",
2816 SelectedFileSystem->FileSystem);
2817
2821
2822 while (TRUE)
2823 {
2824 CONSOLE_ConInKey(Ir);
2825
2826 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2827 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2828 {
2829 if (ConfirmQuit(Ir))
2830 {
2831 /* Reset the filesystem list */
2833 return QUIT_PAGE;
2834 }
2835 else
2836 {
2838 }
2839 }
2840 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2841 {
2843 }
2844 }
2845 }
2846 else if (!NT_SUCCESS(Status))
2847 {
2849 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
2850 L"\\Device\\Harddisk%lu\\Partition%lu",
2851 DiskEntry->DiskNumber,
2852 PartEntry->PartitionNumber);
2853
2854 DPRINT1("DoFormat() failed: Status 0x%08lx\n", Status);
2856
2857 /* Reset the filesystem list */
2859 return QUIT_PAGE;
2860 }
2861
2863 }
2864 }
2865
2866 return FORMAT_PARTITION_PAGE;
2867}
NTSTATUS DoFormat(IN PPARTENTRY PartEntry, IN PCWSTR FileSystemName, IN BOOLEAN QuickFormat)
Definition: format.c:92
#define TEXT_TYPE_REGULAR
Definition: consup.h:39
@ ERROR_WRITE_PTABLE
Definition: errorcode.h:51
@ ERROR_FORMATTING_PARTITION
Definition: errorcode.h:60
#define STATUS_PARTITION_FAILURE
Definition: ntstatus.h:604
ULONG DiskNumber
Definition: partlist.h:108
BOOLEAN QuickFormat
Definition: fslist.h:35
PCWSTR FileSystem
Definition: fslist.h:34
PFILE_SYSTEM_ITEM Selected
Definition: fslist.h:42
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
VOID MUIClearStyledText(IN ULONG Page, IN INT TextID, IN INT Flags)
Definition: mui.c:399
#define TEXT_ID_FORMAT_PROMPT
Definition: mui.h:129
static PPARTENTRY TempPartition
Definition: usetup.c:89
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2254
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:86
@ SELECT_FILE_SYSTEM_PAGE
Definition: usetup.h:102
@ FORMAT_PARTITION_PAGE
Definition: usetup.h:103
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:122

Referenced by RunUSetup().

◆ GetNTOSInstallationName()

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

Definition at line 511 of file usetup.c.

515{
517 PPARTENTRY PartEntry = NtOsInstall->PartEntry;
518
519 if (PartEntry && PartEntry->DriveLetter)
520 {
521 /* We have retrieved a partition that is mounted */
522 return RtlStringCchPrintfA(Buffer, cchBufferSize,
523 "%C:%S \"%S\"",
524 PartEntry->DriveLetter,
525 NtOsInstall->PathComponent,
526 NtOsInstall->InstallationName);
527 }
528 else
529 {
530 /* We failed somewhere, just show the NT path */
531 return RtlStringCchPrintfA(Buffer, cchBufferSize,
532 "%wZ \"%S\"",
533 &NtOsInstall->SystemNtPath,
534 NtOsInstall->InstallationName);
535 }
536}
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
struct _NTOS_INSTALLATION * PNTOS_INSTALLATION
base of all file and directory entries
Definition: entries.h:83
WCHAR InstallationName[MAX_PATH]
Definition: osdetect.h:26
UNICODE_STRING SystemNtPath
Definition: osdetect.h:21
PPARTENTRY PartEntry
Definition: osdetect.h:25
PCWSTR PathComponent
Definition: osdetect.h:22
WCHAR DriveLetter
Definition: partlist.h:58

Referenced by UpgradeRepairPage().

◆ GetSettingDescription()

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

Definition at line 500 of file usetup.c.

504{
505 return RtlStringCchPrintfA(Buffer, cchBufferSize, "%S",
507}
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

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

1354{
1355 while (TRUE)
1356 {
1357 CONSOLE_ConInKey(Ir);
1358
1359 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1360 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1361 {
1362 ScrollDownGenericList(ListUi);
1363 }
1364 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1365 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1366 {
1367 ScrollUpGenericList(ListUi);
1368 }
1369 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1370 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1371 {
1373 }
1374 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1375 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1376 {
1378 }
1379 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1380 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1381 {
1382 if (ConfirmQuit(Ir))
1383 return QUIT_PAGE;
1384 else
1385 RedrawGenericList(ListUi);
1386 }
1387 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1388 {
1390 return nextPage; // Use some "prevPage;" instead?
1391 }
1392 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1393 {
1394 return nextPage;
1395 }
1396 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1397 {
1398 /* a-z */
1400 }
1401 }
1402}
VOID RedrawGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:511
VOID ScrollPageUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:454
VOID RestoreGenericListUiState(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:62
VOID GenericListKeyPress(IN PGENERIC_LIST_UI ListUi, IN CHAR AsciiChar)
Definition: genlist.c:525
VOID ScrollUpGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:404
VOID ScrollDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:376
VOID ScrollPageDownGenericList(IN PGENERIC_LIST_UI ListUi)
Definition: genlist.c:432
#define VK_NEXT
Definition: winuser.h:2221
#define VK_PRIOR
Definition: winuser.h:2220

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

◆ InstallDirectoryPage()

static PAGE_NUMBER InstallDirectoryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3031 of file usetup.c.

3032{
3034 ULONG Length, Pos;
3035 WCHAR c;
3036 WCHAR InstallDir[MAX_PATH];
3037
3038 /* We do not need the filesystem list anymore */
3040
3042 {
3043 /* FIXME: show an error dialog */
3044 return QUIT_PAGE;
3045 }
3046
3047 // if (IsUnattendedSetup)
3048 if (RepairUpdateFlag)
3049 wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
3052 else
3053 wcscpy(InstallDir, L"\\ReactOS");
3054
3055 /*
3056 * Check the validity of the predefined 'InstallDir'. If we are either
3057 * in unattended setup or in update/repair mode, and the installation path
3058 * is valid, just perform the installation. Otherwise (either in the case
3059 * of an invalid path, or we are in regular setup), display the UI and allow
3060 * the user to specify a new installation path.
3061 */
3062 if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
3063 {
3065 if (!NT_SUCCESS(Status))
3066 {
3067 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
3069 return QUIT_PAGE;
3070 }
3071
3072 /*
3073 * Check whether the user attempts to install ReactOS within the
3074 * installation source directory, or in a subdirectory thereof.
3075 * If so, fail with an error.
3076 */
3078 {
3081 }
3082
3083 return PREPARE_COPY_PAGE;
3084 }
3085
3086 Length = wcslen(InstallDir);
3087 Pos = Length;
3088
3090 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3091 CONSOLE_SetCursorXY(8 + Pos, 11);
3093
3094 while (TRUE)
3095 {
3096 CONSOLE_ConInKey(Ir);
3097
3098 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3099 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3100 {
3102
3103 if (ConfirmQuit(Ir))
3104 return QUIT_PAGE;
3105
3107 break;
3108 }
3109 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3110 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
3111 {
3112 if (Pos < Length)
3113 {
3114 memmove(&InstallDir[Pos],
3115 &InstallDir[Pos + 1],
3116 (Length - Pos - 1) * sizeof(WCHAR));
3117 InstallDir[Length - 1] = UNICODE_NULL;
3118
3119 Length--;
3120 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3121 CONSOLE_SetCursorXY(8 + Pos, 11);
3122 }
3123 }
3124 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3125 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3126 {
3127 Pos = 0;
3128 CONSOLE_SetCursorXY(8 + Pos, 11);
3129 }
3130 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3131 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3132 {
3133 Pos = Length;
3134 CONSOLE_SetCursorXY(8 + Pos, 11);
3135 }
3136 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3137 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
3138 {
3139 if (Pos > 0)
3140 {
3141 Pos--;
3142 CONSOLE_SetCursorXY(8 + Pos, 11);
3143 }
3144 }
3145 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3146 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
3147 {
3148 if (Pos < Length)
3149 {
3150 Pos++;
3151 CONSOLE_SetCursorXY(8 + Pos, 11);
3152 }
3153 }
3154 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3155 {
3157
3158 /*
3159 * Check for the validity of the installation directory and pop up
3160 * an error if it is not the case. Then the user can fix its input.
3161 */
3162 if (!IsValidPath(InstallDir))
3163 {
3166 }
3167
3169 if (!NT_SUCCESS(Status))
3170 {
3171 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
3173 return QUIT_PAGE;
3174 }
3175
3176 /*
3177 * Check whether the user attempts to install ReactOS within the
3178 * installation source directory, or in a subdirectory thereof.
3179 * If so, fail with an error.
3180 */
3182 {
3185 }
3186
3187 return PREPARE_COPY_PAGE;
3188 }
3189 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3190 {
3191 if (Pos > 0)
3192 {
3193 if (Pos < Length)
3194 memmove(&InstallDir[Pos - 1],
3195 &InstallDir[Pos],
3196 (Length - Pos) * sizeof(WCHAR));
3197 InstallDir[Length - 1] = UNICODE_NULL;
3198
3199 Pos--;
3200 Length--;
3201 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3202 CONSOLE_SetCursorXY(8 + Pos, 11);
3203 }
3204 }
3205 else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3206 {
3207 if (Length < 50)
3208 {
3210 if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
3211 {
3212 if (Pos < Length)
3213 memmove(&InstallDir[Pos + 1],
3214 &InstallDir[Pos],
3215 (Length - Pos) * sizeof(WCHAR));
3216 InstallDir[Length + 1] = UNICODE_NULL;
3217 InstallDir[Pos] = c;
3218
3219 Pos++;
3220 Length++;
3221 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3222 CONSOLE_SetCursorXY(8 + Pos, 11);
3223 }
3224 }
3225 }
3226 }
3227
3229}
#define isprint(c)
Definition: acclib.h:73
VOID CONSOLE_SetInputTextXY(IN SHORT x, IN SHORT y, IN SHORT len, IN LPCWSTR Text)
Definition: consup.c:357
VOID CONSOLE_SetCursorXY(IN SHORT x, IN SHORT y)
Definition: consup.c:227
VOID CONSOLE_SetCursorType(IN BOOL bInsert, IN BOOL bVisible)
Definition: consup.c:214
ush Pos
Definition: deflate.h:92
@ ERROR_SOURCE_DIR
Definition: errorcode.h:21
@ ERROR_DIRECTORY_NAME
Definition: errorcode.h:56
@ ERROR_NO_BUILD_PATH
Definition: errorcode.h:19
const GLubyte * c
Definition: glext.h:8905
#define iswdigit(_c)
Definition: ctype.h:667
#define iswalpha(_c)
Definition: ctype.h:664
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define c
Definition: ke_i.h:80
if(dx< 0)
Definition: linetemp.h:194
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:623
UNICODE_STRING SourcePath
Definition: setuplib.h:84
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:137
UNICODE_STRING DestinationPath
Definition: setuplib.h:104
static PPARTENTRY InstallPartition
Definition: usetup.c:50
static BOOLEAN IsValidPath(IN PCWSTR InstallDir)
Definition: usetup.c:2975
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:94
@ PREPARE_COPY_PAGE
Definition: usetup.h:107
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DELETE
Definition: winuser.h:2233

Referenced by RunUSetup().

◆ InstallIntroPage()

static PAGE_NUMBER InstallIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 1083 of file usetup.c.

1084{
1085 if (RepairUpdateFlag)
1086 {
1087#if 1 /* Old code that looks good */
1088
1089 // return SELECT_PARTITION_PAGE;
1090 return DEVICE_SETTINGS_PAGE;
1091
1092#else /* Possible new code? */
1093
1094 return DEVICE_SETTINGS_PAGE;
1095 // return SCSI_CONTROLLER_PAGE;
1096
1097#endif
1098 }
1099
1101 return SELECT_PARTITION_PAGE;
1102
1104
1105 while (TRUE)
1106 {
1107 CONSOLE_ConInKey(Ir);
1108
1109 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1110 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1111 {
1112 if (ConfirmQuit(Ir))
1113 return QUIT_PAGE;
1114
1115 break;
1116 }
1117 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1118 {
1119 return UPGRADE_REPAIR_PAGE;
1120 }
1121 }
1122
1123 return INSTALL_INTRO_PAGE;
1124}
@ UPGRADE_REPAIR_PAGE
Definition: usetup.h:88
@ INSTALL_INTRO_PAGE
Definition: usetup.h:82

Referenced by RunUSetup().

◆ IsPartitionLargeEnough()

static BOOLEAN IsPartitionLargeEnough ( _In_ PPARTENTRY  PartEntry)
static

Definition at line 1510 of file usetup.c.

1512{
1513 /* Retrieve the maximum size in MB (rounded up) */
1514 ULONGLONG PartSize = RoundingDivide(GetPartEntrySizeInBytes(PartEntry), MB);
1515
1517 {
1518 /* Partition is too small so ask for another one */
1519 DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n",
1521 return FALSE;
1522 }
1523 else
1524 {
1525 return TRUE;
1526 }
1527}
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:136

Referenced by SelectPartitionPage().

◆ IsValidPath()

static BOOLEAN IsValidPath ( IN PCWSTR  InstallDir)
static

Definition at line 2975 of file usetup.c.

2977{
2978 UINT i, Length;
2979
2980 Length = wcslen(InstallDir);
2981
2982 // TODO: Add check for 8.3 too.
2983
2984 /* Path must be at least 2 characters long */
2985// if (Length < 2)
2986// return FALSE;
2987
2988 /* Path must start with a backslash */
2989// if (InstallDir[0] != L'\\')
2990// return FALSE;
2991
2992 /* Path must not end with a backslash */
2993 if (InstallDir[Length - 1] == L'\\')
2994 return FALSE;
2995
2996 /* Path must not contain whitespace characters */
2997 for (i = 0; i < Length; i++)
2998 {
2999 if (iswspace(InstallDir[i]))
3000 return FALSE;
3001 }
3002
3003 /* Path component must not end with a dot */
3004 for (i = 0; i < Length; i++)
3005 {
3006 if (InstallDir[i] == L'\\' && i > 0)
3007 {
3008 if (InstallDir[i - 1] == L'.')
3009 return FALSE;
3010 }
3011 }
3012
3013 if (InstallDir[Length - 1] == L'.')
3014 return FALSE;
3015
3016 return TRUE;
3017}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define iswspace(_c)
Definition: ctype.h:669

Referenced by InstallDirectoryPage().

◆ KeyboardSettingsPage()

static PAGE_NUMBER KeyboardSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1468 of file usetup.c.

1469{
1470 GENERIC_LIST_UI ListUi;
1472
1474 DrawGenericList(&ListUi,
1475 2, 18,
1476 xScreen - 3,
1477 yScreen - 3);
1478
1479 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1480}

Referenced by RunUSetup().

◆ LanguagePage()

static PAGE_NUMBER LanguagePage ( PINPUT_RECORD  Ir)
static

Definition at line 655 of file usetup.c.

656{
657 GENERIC_LIST_UI ListUi;
658 PCWSTR NewLanguageId;
659 BOOL RefreshPage = FALSE;
660
661 /* Initialize the computer settings list */
663 {
666 {
667 PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
668 return WELCOME_PAGE;
669 }
670 }
671
674
675 /* Load the font */
678
679 /*
680 * If there is no language or just a single one in the list,
681 * skip the language selection process altogether.
682 */
684 {
686 return WELCOME_PAGE;
687 }
688
690 DrawGenericList(&ListUi,
691 2, 18,
692 xScreen - 3,
693 yScreen - 3);
694
696
698
699 while (TRUE)
700 {
702
703 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
704 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
705 {
706 ScrollDownGenericList(&ListUi);
707 RefreshPage = TRUE;
708 }
709 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
710 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
711 {
712 ScrollUpGenericList(&ListUi);
713 RefreshPage = TRUE;
714 }
715 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
716 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
717 {
719 RefreshPage = TRUE;
720 }
721 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
722 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
723 {
725 RefreshPage = TRUE;
726 }
727 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
728 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
729 {
730 if (ConfirmQuit(Ir))
731 return QUIT_PAGE;
732 else
733 RedrawGenericList(&ListUi);
734 }
735 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
736 {
738
741
743
745 {
747 }
748
749 /* Load the font */
751
752 return WELCOME_PAGE;
753 }
754 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
755 {
756 /* a-z */
758 RefreshPage = TRUE;
759 }
760
761 if (RefreshPage)
762 {
764
765 NewLanguageId =
767
768 if (wcscmp(SelectedLanguageId, NewLanguageId))
769 {
770 /* Clear the language page */
772
773 SelectedLanguageId = NewLanguageId;
774
775 /* Load the font */
777
778 /* Redraw the list */
779 DrawGenericList(&ListUi,
780 2, 18,
781 xScreen - 3,
782 yScreen - 3);
783
784 /* Redraw language selection page in native language */
786 }
787
788 RefreshPage = FALSE;
789 }
790 }
791
792 return WELCOME_PAGE;
793}
ULONG GetDefaultLanguageIndex(VOID)
Definition: settings.c:1098
PGENERIC_LIST CreateLanguageList(IN HINF InfFile, OUT PWSTR DefaultLanguage)
Definition: settings.c:1159
struct _GENENTRY * PGENENTRY
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
USHORT LANGID
Definition: mui.h:9
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
ULONG GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:140
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
PGENERIC_LIST LanguageList
Definition: setuplib.h:123
LANGID LanguageId
Definition: setuplib.h:134
VOID ScrollToPositionGenericList(IN PGENERIC_LIST_UI ListUi, IN ULONG uIndex)
Definition: genlist.c:476
VOID SetConsoleCodePage(VOID)
Definition: mui.c:537
VOID MUIClearPage(IN ULONG page)
Definition: mui.c:142
static WCHAR DefaultLanguage[20]
Definition: usetup.c:67
static VOID UpdateKBLayout(VOID)
Definition: usetup.c:463
@ WELCOME_PAGE
Definition: usetup.h:80
@ LANGUAGE_PAGE
Definition: usetup.h:79

Referenced by RunUSetup().

◆ LayoutSettingsPage()

static PAGE_NUMBER LayoutSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1494 of file usetup.c.

1495{
1496 GENERIC_LIST_UI ListUi;
1498
1500 DrawGenericList(&ListUi,
1501 2, 18,
1502 xScreen - 3,
1503 yScreen - 3);
1504
1505 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1506}

Referenced by RunUSetup().

◆ LicensePage()

static PAGE_NUMBER LicensePage ( PINPUT_RECORD  Ir)
static

Definition at line 854 of file usetup.c.

855{
857
858 while (TRUE)
859 {
861
862 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
863 {
864 return WELCOME_PAGE;
865 }
866 }
867
868 return LICENSE_PAGE;
869}
@ LICENSE_PAGE
Definition: usetup.h:81

Referenced by RunUSetup().

◆ NtProcessStartup()

VOID NTAPI NtProcessStartup ( PPEB  Peb)

Definition at line 4409 of file usetup.c.

4410{
4413
4415
4417
4419
4420 Status = RunUSetup();
4421
4422 if (NT_SUCCESS(Status))
4423 {
4424 /*
4425 * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
4426 * a protective waiting.
4427 * This wait is needed because, since we are started as SMSS.EXE,
4428 * the NT kernel explicitly waits 5 seconds for the initial process
4429 * SMSS.EXE to initialize (as a protective measure), and otherwise
4430 * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
4431 */
4432 Time.QuadPart += 50000000;
4434 }
4435 else
4436 {
4437 /* The installer failed to start: raise a hard error (crash the system/BSOD) */
4439 0, 0, NULL, 0, NULL);
4440 }
4441
4443}
PPEB Peb
Definition: dllmain.c:27
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
static PLARGE_INTEGER Time
Definition: time.c:105
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
#define NtCurrentProcess()
Definition: nt_native.h:1657
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:876
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:569
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:670
PVOID ProcessHeap
Definition: ntddk_ex.h:249
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
LONGLONG QuadPart
Definition: typedefs.h:114
HANDLE ProcessHeap
Definition: usetup.c:44
NTSTATUS RunUSetup(VOID)
Definition: usetup.c:4195

◆ PopupError()

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

Definition at line 263 of file usetup.c.

267{
268 SHORT yTop;
269 SHORT xLeft;
270 COORD coPos;
271 DWORD Written;
273 ULONG MaxLength;
274 ULONG Lines;
275 PCHAR p;
276 PCCH pnext;
277 BOOLEAN LastLine;
278 SHORT Width;
280
281 /* Count text lines and longest line */
282 MaxLength = 0;
283 Lines = 0;
284 pnext = Text;
285
286 while (TRUE)
287 {
288 p = strchr(pnext, '\n');
289
290 if (p == NULL)
291 {
292 Length = strlen(pnext);
293 LastLine = TRUE;
294 }
295 else
296 {
297 Length = (ULONG)(p - pnext);
298 LastLine = FALSE;
299 }
300
301 Lines++;
302
303 if (Length > MaxLength)
304 MaxLength = Length;
305
306 if (LastLine)
307 break;
308
309 pnext = p + 1;
310 }
311
312 /* Check length of status line */
313 if (Status != NULL)
314 {
316
317 if (Length > MaxLength)
318 MaxLength = Length;
319 }
320
321 Width = MaxLength + 4;
322 Height = Lines + 2;
323
324 if (Status != NULL)
325 Height += 2;
326
327 yTop = (yScreen - Height) / 2;
328 xLeft = (xScreen - Width) / 2;
329
330
331 /* Set screen attributes */
332 coPos.X = xLeft;
333 for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++)
334 {
337 Width,
338 coPos,
339 &Written);
340 }
341
342 DrawBox(xLeft, yTop, Width, Height);
343
344 /* Print message text */
345 coPos.Y = yTop + 1;
346 pnext = Text;
347 while (TRUE)
348 {
349 p = strchr(pnext, '\n');
350
351 if (p == NULL)
352 {
353 Length = strlen(pnext);
354 LastLine = TRUE;
355 }
356 else
357 {
358 Length = (ULONG)(p - pnext);
359 LastLine = FALSE;
360 }
361
362 if (Length != 0)
363 {
364 coPos.X = xLeft + 2;
366 pnext,
367 Length,
368 coPos,
369 &Written);
370 }
371
372 if (LastLine)
373 break;
374
375 coPos.Y++;
376 pnext = p + 1;
377 }
378
379 /* Print separator line and status text */
380 if (Status != NULL)
381 {
382 coPos.Y = yTop + Height - 3;
383 coPos.X = xLeft;
386 1,
387 coPos,
388 &Written);
389
390 coPos.X = xLeft + 1;
392 CharHorizontalLine, // '-',
393 Width - 2,
394 coPos,
395 &Written);
396
397 coPos.X = xLeft + Width - 1;
400 1,
401 coPos,
402 &Written);
403
404 coPos.Y++;
405 coPos.X = xLeft + 2;
407 Status,
408 min(strlen(Status), (SIZE_T)Width - 4),
409 coPos,
410 &Written);
411 }
412
413 if (WaitEvent == POPUP_WAIT_NONE)
414 return;
415
416 while (TRUE)
417 {
419
420 if (WaitEvent == POPUP_WAIT_ANY_KEY ||
421 Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
422 {
423 return;
424 }
425 }
426}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strchr(const char *String, int ch)
Definition: utclib.c:501
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:407
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
Definition: console.c:525
#define FOREGROUND_RED
Definition: blue.h:63
char * Text
Definition: combotst.c:136
#define BACKGROUND_WHITE
Definition: consup.h:31
GLfloat GLfloat p
Definition: glext.h:8902
CONST CHAR * PCCH
Definition: ntbasedef.h:392
short SHORT
Definition: pedump.c:59
ULONG_PTR SIZE_T
Definition: typedefs.h:80
char * PCHAR
Definition: typedefs.h:51
CHAR CharLeftHorizLineAndVertLine
Definition: mui.c:46
CHAR CharVertLineAndRightHorizLine
Definition: mui.c:45
static VOID DrawBox(IN SHORT xLeft, IN SHORT yTop, IN SHORT Width, IN SHORT Height)
Definition: usetup.c:173

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

◆ PrepareCopyPage()

static PAGE_NUMBER PrepareCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 3268 of file usetup.c.

3269{
3270 // ERROR_NUMBER ErrorNumber;
3272
3274
3275 /* ErrorNumber = */ Success = PrepareFileCopy(&USetupData, NULL);
3276 if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
3277 {
3278 // MUIDisplayError(ErrorNumber, Ir, POPUP_WAIT_ENTER);
3279 return QUIT_PAGE;
3280 }
3281
3282 return FILE_COPY_PAGE;
3283}
BOOLEAN PrepareFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
Definition: install.c:684
@ Success
Definition: eventcreate.c:712

Referenced by RunUSetup().

◆ PrintString()

static VOID PrintString ( IN PCSTR  fmt,
  ... 
)
static

Definition at line 154 of file usetup.c.

155{
156 CHAR buffer[512];
157 va_list ap;
160
161 va_start(ap, fmt);
163 va_end(ap);
164
169}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
@ AnsiString
Definition: dnslib.h:19
GLuint buffer
Definition: glext.h:5915
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
NTSTATUS NTAPI NtDisplayString(PUNICODE_STRING String)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
Definition: dsound.c:943
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

Referenced by RunUSetup().

◆ ProgressCountdown()

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

Definition at line 3978 of file usetup.c.

3981{
3983 ULONG StartTime, BarWidth, TimerDiv;
3984 LONG TimeElapsed;
3985 LONG TimerValue, OldTimerValue;
3987 PPROGRESSBAR ProgressBar;
3988 BOOLEAN RefreshProgress = TRUE;
3989
3990 /* Bail out if the timeout is already zero */
3991 if (TimeOut <= 0)
3992 return;
3993
3994 /* Create the timeout progress bar and set it up */
3995 ProgressBar = CreateProgressBarEx(13,
3996 26,
3997 xScreen - 13,
3998 yScreen - 20,
3999 10,
4000 24,
4001 TRUE,
4003 0,
4004 NULL,
4007
4008 BarWidth = max(1, ProgressBar->Width);
4009 TimerValue = TimeOut * BarWidth;
4010 ProgressSetStepCount(ProgressBar, TimerValue);
4011
4013 CONSOLE_Flush();
4014
4015 TimerDiv = 1000 / BarWidth;
4016 TimerDiv = max(1, TimerDiv);
4017 OldTimerValue = TimerValue;
4018 while (TRUE)
4019 {
4020 /* Decrease the timer */
4021
4022 /*
4023 * Compute how much time the previous operations took.
4024 * This allows us in particular to take account for any time
4025 * elapsed if something slowed down.
4026 */
4027 TimeElapsed = NtGetTickCount() - StartTime;
4028 if (TimeElapsed >= TimerDiv)
4029 {
4030 /* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
4031 TimeElapsed /= TimerDiv;
4032 StartTime += (TimerDiv * TimeElapsed);
4033
4034 if (TimeElapsed <= TimerValue)
4035 TimerValue -= TimeElapsed;
4036 else
4037 TimerValue = 0;
4038
4039 RefreshProgress = TRUE;
4040 }
4041
4042 if (RefreshProgress)
4043 {
4044 ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
4045 RefreshProgress = FALSE;
4046 }
4047
4048 /* Stop when the timer reaches zero */
4049 if (TimerValue <= 0)
4050 break;
4051
4052 /* Check for user key presses */
4053
4054 /*
4055 * If the timer is used, use a passive wait of maximum 1 second
4056 * while monitoring for incoming console input events, so that
4057 * we are still able to display the timing count.
4058 */
4059
4060 /* Wait a maximum of 1 second for input events */
4061 TimeElapsed = NtGetTickCount() - StartTime;
4062 if (TimeElapsed < TimerDiv)
4063 {
4064 /* Convert the time to NT format */
4065 Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
4067 }
4068 else
4069 {
4071 }
4072
4073 /* Check whether the input event has been signaled, or a timeout happened */
4074 if (Status == STATUS_TIMEOUT)
4075 {
4076 continue;
4077 }
4078 if (Status != STATUS_WAIT_0)
4079 {
4080 /* An error happened, bail out */
4081 DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
4082 break;
4083 }
4084
4085 /* Check for an ENTER key press */
4086 while (CONSOLE_ConInKeyPeek(Ir))
4087 {
4088 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4089 {
4090 /* Found it, stop waiting */
4091 goto Exit;
4092 }
4093 }
4094 }
4095
4096Exit:
4097 /* Destroy the progress bar and quit */
4098 DestroyProgressBar(ProgressBar);
4099}
VOID ProgressSetStep(IN PPROGRESSBAR Bar, IN ULONG Step)
Definition: progress.c:368
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
#define BACKGROUND_BLUE
Definition: blue.h:65
BOOLEAN CONSOLE_ConInKeyPeek(OUT PINPUT_RECORD Buffer)
Definition: consup.c:89
HANDLE StdInput
Definition: consup.c:36
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define STATUS_WAIT_0
Definition: ntstatus.h:237
long LONG
Definition: pedump.c:60
static ULONG Timeout
Definition: ping.c:61
#define NtGetTickCount
Definition: rtlp.h:163
static void Exit(void)
Definition: sock.c:1330
SHORT Width
Definition: progress.h:48
#define max(a, b)
Definition: svc.c:63
static LARGE_INTEGER StartTime
Definition: sys_arch.c:13
#define STRING_REBOOTPROGRESSBAR
Definition: mui.h:188
static BOOLEAN NTAPI ProgressTimeOutStringHandler(IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
Definition: usetup.c:3931

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

3936{
3937 ULONG OldProgress = Bar->Progress;
3938
3939 if (Bar->StepCount == 0)
3940 {
3941 Bar->Progress = 0;
3942 }
3943 else
3944 {
3945 Bar->Progress = Bar->StepCount - Bar->CurrentStep;
3946 }
3947
3948 /* Build the progress string if it has changed */
3949 if (Bar->ProgressFormatText &&
3950 (AlwaysUpdate || (Bar->Progress != OldProgress)))
3951 {
3952 RtlStringCchPrintfA(Buffer, cchBufferSize,
3953 Bar->ProgressFormatText, Bar->Progress / max(1, Bar->Width) + 1);
3954
3955 return TRUE;
3956 }
3957
3958 return FALSE;
3959}
void Bar(void)
Definition: terminate.cpp:70

Referenced by ProgressCountdown().

◆ QuitPage()

static PAGE_NUMBER QuitPage ( PINPUT_RECORD  Ir)
static

Definition at line 4115 of file usetup.c.

4116{
4118
4119 /* Destroy the NTOS installations list */
4120 if (NtOsInstallsList != NULL)
4121 {
4124 }
4125
4126 /* Destroy the partition list */
4127 if (PartitionList != NULL)
4128 {
4131 }
4132
4133 /* Reset the formatter machine state */
4136
4137 /* Destroy the filesystem list */
4139
4141
4142 /* Wait for maximum 15 seconds or an ENTER key before quitting */
4143 ProgressCountdown(Ir, 15);
4144 return FLUSH_PAGE;
4145}
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
VOID DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:1951
#define STRING_REBOOTCOMPUTER2
Definition: mui.h:164
@ Start
Definition: partlist.h:33
static VOID ProgressCountdown(IN PINPUT_RECORD Ir, IN LONG TimeOut)
Definition: usetup.c:3978
static FORMATMACHINESTATE FormatState
Definition: usetup.c:90
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:95

Referenced by RunUSetup().

◆ RegistryPage()

static PAGE_NUMBER RegistryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3565 of file usetup.c.

3566{
3567 ULONG Error;
3568
3570
3577 &s_SubstSettings);
3578 if (Error != ERROR_SUCCESS)
3579 {
3581 return QUIT_PAGE;
3582 }
3583 else
3584 {
3587 }
3588}
BOOL Error
Definition: chkdsk.c:66
#define ERROR_SUCCESS
Definition: deptool.c:10
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:907
#define STRING_DONE
Definition: mui.h:163
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: usetup.c:3522

Referenced by RunUSetup().

◆ RegistryStatus()

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

Definition at line 3522 of file usetup.c.

3523{
3524 /* WARNING: Please keep this lookup table in sync with the resources! */
3525 static const UINT StringIDs[] =
3526 {
3527 STRING_DONE, /* Success */
3528 STRING_REGHIVEUPDATE, /* RegHiveUpdate */
3529 STRING_IMPORTFILE, /* ImportRegHive */
3530 STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
3531 STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
3532 STRING_ADDKBLAYOUTS, /* KeybLayouts */
3533 STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
3534 STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
3535 };
3536
3537 va_list args;
3538
3539 if (RegStatus < ARRAYSIZE(StringIDs))
3540 {
3541 va_start(args, RegStatus);
3542 CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
3543 va_end(args);
3544 }
3545 else
3546 {
3547 CONSOLE_SetStatusText("Unknown status %d", RegStatus);
3548 }
3549}
VOID CONSOLE_SetStatusTextV(IN LPCSTR fmt, IN va_list args)
Definition: consup.c:471
#define args
Definition: format.c:66
Definition: match.c:390
#define STRING_KEYBOARDSETTINGSUPDATE
Definition: mui.h:161
#define STRING_CODEPAGEINFOUPDATE
Definition: mui.h:162
#define STRING_LOCALESETTINGSUPDATE
Definition: mui.h:160
#define STRING_IMPORTFILE
Definition: mui.h:158
#define STRING_ADDKBLAYOUTS
Definition: mui.h:187
#define STRING_DISPLAYSETTINGSUPDATE
Definition: mui.h:159
#define STRING_REGHIVEUPDATE
Definition: mui.h:157

Referenced by RegistryPage().

◆ RepairIntroPage()

static PAGE_NUMBER RepairIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 885 of file usetup.c.

886{
888
889 while (TRUE)
890 {
892
893 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
894 {
895 return REBOOT_PAGE;
896 }
897 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
898 {
900 return INSTALL_INTRO_PAGE;
901 }
902 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
903 {
904 return RECOVERY_PAGE;
905 }
906 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
907 {
908 return WELCOME_PAGE;
909 }
910 }
911
912 return REPAIR_INTRO_PAGE;
913}
int toupper(int c)
Definition: utclib.c:881
@ REPAIR_INTRO_PAGE
Definition: usetup.h:87
@ RECOVERY_PAGE
Definition: usetup.h:118

Referenced by RunUSetup().

◆ ResetFileSystemList()

static VOID ResetFileSystemList ( VOID  )
static

Definition at line 2254 of file usetup.c.

2255{
2256 if (!FileSystemList)
2257 return;
2258
2261}
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 4195 of file usetup.c.

4196{
4198 INPUT_RECORD Ir;
4200 BOOLEAN Old;
4201
4203
4204 /* Tell the Cm this is a setup boot, and it has to behave accordingly */
4206 if (!NT_SUCCESS(Status))
4207 DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
4208
4209 /* Initialize the user-mode PnP manager */
4211 if (!NT_SUCCESS(Status))
4212 {
4213 // PrintString(??);
4214 DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
4215 }
4216
4217 if (!CONSOLE_Init())
4218 {
4222
4223 /* We failed to initialize the video, just quit the installer */
4225 }
4226
4227 /* Initialize Setup, phase 0 */
4230
4231 /* Hide the cursor and clear the screen and keyboard buffer */
4234 CONSOLE_Flush();
4235
4236 /* Global Initialization page */
4237 Page = SetupStartPage(&Ir);
4238
4239 while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
4240 {
4242 CONSOLE_Flush();
4243
4244 // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4245
4246 switch (Page)
4247 {
4248 /* Language page */
4249 case LANGUAGE_PAGE:
4250 Page = LanguagePage(&Ir);
4251 break;
4252
4253 /* Welcome page */
4254 case WELCOME_PAGE:
4255 Page = WelcomePage(&Ir);
4256 break;
4257
4258 /* License page */
4259 case LICENSE_PAGE:
4260 Page = LicensePage(&Ir);
4261 break;
4262
4263 /* Install pages */
4264 case INSTALL_INTRO_PAGE:
4265 Page = InstallIntroPage(&Ir);
4266 break;
4267
4268#if 0
4269 case SCSI_CONTROLLER_PAGE:
4270 Page = ScsiControllerPage(&Ir);
4271 break;
4272
4273 case OEM_DRIVER_PAGE:
4274 Page = OemDriverPage(&Ir);
4275 break;
4276#endif
4277
4279 Page = DeviceSettingsPage(&Ir);
4280 break;
4281
4284 break;
4285
4288 break;
4289
4292 break;
4293
4295 Page = LayoutSettingsPage(&Ir);
4296 break;
4297
4298 /* Partitioning pages */
4301 break;
4302
4305 break;
4306
4309 break;
4310
4313 break;
4314
4315 /* Filesystem partition operations pages */
4318 break;
4319
4322 break;
4323
4326 break;
4327
4328 /* Bootloader selection page */
4331 break;
4332
4333 /* Installation pages */
4336 break;
4337
4338 case PREPARE_COPY_PAGE:
4339 Page = PrepareCopyPage(&Ir);
4340 break;
4341
4342 case FILE_COPY_PAGE:
4343 Page = FileCopyPage(&Ir);
4344 break;
4345
4346 case REGISTRY_PAGE:
4347 Page = RegistryPage(&Ir);
4348 break;
4349
4350 /* Bootloader installation page */
4352 // case BOOTLOADER_REMOVABLE_DISK_PAGE:
4354 break;
4355
4356 /* Repair pages */
4357 case REPAIR_INTRO_PAGE:
4358 Page = RepairIntroPage(&Ir);
4359 break;
4360
4362 Page = UpgradeRepairPage(&Ir);
4363 break;
4364
4365 case SUCCESS_PAGE:
4366 Page = SuccessPage(&Ir);
4367 break;
4368
4369 case FLUSH_PAGE:
4370 Page = FlushPage(&Ir);
4371 break;
4372
4373 case QUIT_PAGE:
4374 Page = QuitPage(&Ir);
4375 break;
4376
4377 /* Virtual pages */
4378 case SETUP_INIT_PAGE:
4379 case REBOOT_PAGE:
4380 case RECOVERY_PAGE:
4381 break;
4382
4383 default:
4384 break;
4385 }
4386 }
4387
4388 /* Terminate the user-mode PnP manager */
4390
4391 /* Setup has finished */
4393
4394 if (Page == RECOVERY_PAGE)
4396
4397 FreeConsole();
4398
4399 /* Reboot */
4403
4404 return STATUS_SUCCESS;
4405}
BOOL WINAPI FreeConsole(VOID)
Definition: console.c:156
NTSTATUS InitializeUserModePnpManager(IN HINF *phSetupInf)
Definition: devinst.c:559
VOID TerminateUserModePnpManager(VOID)
Definition: devinst.c:690
VOID RecoveryConsole(VOID)
Definition: cmdcons.c:1160
BOOLEAN CONSOLE_Init(VOID)
Definition: consup.c:45
VOID InfSetHeap(PVOID Heap)
Definition: infrosgen.c:40
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
#define CM_BOOT_FLAG_SETUP
Definition: cmtypes.h:159
@ ShutdownReboot
Definition: extypes.h:177
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSTATUS NTAPI NtInitializeRegistry(IN USHORT Flag)
Definition: ntapi.c:1318
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
#define STATUS_APP_INIT_FAILURE
Definition: ntstatus.h:561
VOID FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:857
ERROR_NUMBER InitializeSetup(IN OUT PUSETUP_DATA pSetupData, IN ULONG InitPhase)
Definition: setuplib.c:780
#define STATUS_SUCCESS
Definition: shellext.h:65
PSETUP_ERROR_ROUTINE ErrorRoutine
Definition: setuplib.h:73
#define STRING_CONSOLEFAIL1
Definition: mui.h:165
#define STRING_CONSOLEFAIL3
Definition: mui.h:167
#define STRING_CONSOLEFAIL2
Definition: mui.h:166
static PAGE_NUMBER DeviceSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1219
static PAGE_NUMBER FlushPage(PINPUT_RECORD Ir)
Definition: usetup.c:4184
static PAGE_NUMBER DeletePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2200
static PAGE_NUMBER LicensePage(PINPUT_RECORD Ir)
Definition: usetup.c:854
static VOID __cdecl USetupErrorRoutine(IN PUSETUP_DATA pSetupData,...)
Definition: usetup.c:3235
static PAGE_NUMBER DisplaySettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1442
static PAGE_NUMBER ComputerSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1416
static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3448
static PAGE_NUMBER SelectFileSystemPage(PINPUT_RECORD Ir)
Definition: usetup.c:2282
static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1468
static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir)
Definition: usetup.c:655
static PAGE_NUMBER FormatPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2727
static PAGE_NUMBER BootLoaderSelectPage(PINPUT_RECORD Ir)
Definition: usetup.c:3602
static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3565
static PAGE_NUMBER LayoutSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1494
static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:1083
static PAGE_NUMBER SuccessPage(PINPUT_RECORD Ir)
Definition: usetup.c:4161
static PAGE_NUMBER BootLoaderInstallPage(PINPUT_RECORD Ir)
Definition: usetup.c:3868
static PAGE_NUMBER CheckFileSystemPage(PINPUT_RECORD Ir)
Definition: usetup.c:2884
static PAGE_NUMBER SelectPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:1548
static PAGE_NUMBER WelcomePage(PINPUT_RECORD Ir)
Definition: usetup.c:810
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2159
static PAGE_NUMBER QuitPage(PINPUT_RECORD Ir)
Definition: usetup.c:4115
static VOID PrintString(IN PCSTR fmt,...)
Definition: usetup.c:154
static PAGE_NUMBER CreatePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2045
static PAGE_NUMBER SetupStartPage(PINPUT_RECORD Ir)
Definition: usetup.c:563
static PAGE_NUMBER PrepareCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3268
static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:885
static PAGE_NUMBER UpgradeRepairPage(PINPUT_RECORD Ir)
Definition: usetup.c:928
static PAGE_NUMBER InstallDirectoryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3031
@ SETUP_INIT_PAGE
Definition: usetup.h:78
enum _PAGE_NUMBER PAGE_NUMBER

Referenced by NtProcessStartup().

◆ SelectFileSystemPage()

static PAGE_NUMBER SelectFileSystemPage ( PINPUT_RECORD  Ir)
static

Definition at line 2282 of file usetup.c.

2283{
2284 PPARTENTRY PartEntry;
2285 PDISKENTRY DiskEntry;
2286 FORMATMACHINESTATE PreviousFormatState;
2287 PCWSTR DefaultFs;
2288 CHAR LineBuffer[100];
2289
2290 DPRINT("SelectFileSystemPage()\n");
2291
2293 {
2294 /* FIXME: show an error dialog */
2295 return QUIT_PAGE;
2296 }
2297
2298 /* Find or set the active system partition when starting formatting */
2299 if (FormatState == Start)
2300 {
2301 /*
2302 * If we install on a fixed disk, try to find a supported system
2303 * partition on the system. Otherwise if we install on a removable disk
2304 * use the install partition as the system partition.
2305 */
2306 if (InstallPartition->DiskEntry->MediaType == FixedMedia)
2307 {
2309 FALSE,
2312 /* Use the original system partition as the old active partition hint */
2313 PartEntry = PartitionList->SystemPartition;
2314
2317 {
2318 DPRINT1("We are using a different system partition!!!!\n");
2319
2321
2322 {
2323 PPARTENTRY PartEntry; // Shadow variable
2324
2325 PartEntry = PartitionList->SystemPartition;
2326 DiskEntry = PartEntry->DiskEntry;
2327
2328 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2329 CONSOLE_SetTextXY(8, 10, LineBuffer);
2330
2331 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2333 LineBuffer);
2334
2335
2336 PartEntry = SystemPartition;
2337 DiskEntry = PartEntry->DiskEntry;
2338
2339 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2340 CONSOLE_SetTextXY(8, 23, LineBuffer);
2341 }
2342
2343 while (TRUE)
2344 {
2345 CONSOLE_ConInKey(Ir);
2346
2347 if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2348 {
2349 break;
2350 }
2351 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2352 {
2353 return SELECT_PARTITION_PAGE;
2354 }
2355 }
2356
2358 CONSOLE_Flush();
2359 }
2360 }
2361 else // if (InstallPartition->DiskEntry->MediaType == RemovableMedia)
2362 {
2364 /* Don't specify any old active partition hint */
2365 PartEntry = NULL;
2366 }
2367
2368 if (!SystemPartition)
2369 {
2370 /* FIXME: improve the error dialog */
2371 //
2372 // Error dialog should say that we cannot find a suitable
2373 // system partition and create one on the system. At this point,
2374 // it may be nice to ask the user whether he wants to continue,
2375 // or use an external drive as the system drive/partition
2376 // (e.g. floppy, USB drive, etc...)
2377 //
2378 PopupError("The ReactOS Setup could not find a supported system partition\n"
2379 "on your system or could not create a new one. Without such partition\n"
2380 "the Setup program cannot install ReactOS.\n"
2381 "Press ENTER to return to the partition selection list.",
2383 Ir, POPUP_WAIT_ENTER);
2384 return SELECT_PARTITION_PAGE;
2385 }
2386
2387 /*
2388 * If the system partition can be created in some
2389 * non-partitioned space, create it now.
2390 */
2392 {
2393 /* Automatically create the partition; it will be
2394 * formatted later with default parameters */
2395 // FIXME: Don't use the whole empty space, but a minimal size
2396 // specified from the TXTSETUP.SIF or unattended setup.
2399 0ULL);
2402 }
2403
2404 /* Set it as such */
2406 {
2407 DPRINT1("SetActivePartition(0x%p) failed?!\n", SystemPartition);
2408 ASSERT(FALSE);
2409 }
2410
2411 /* Commit all partition changes to all the disks */
2413 {
2414 DPRINT("WritePartitionsToDisk() failed\n");
2416 return QUIT_PAGE;
2417 }
2418
2419 /*
2420 * In all cases, whether or not we are going to perform a formatting,
2421 * we must perform a filesystem check of both the system and the
2422 * installation partitions.
2423 */
2427
2428 /*
2429 * In case we just repair an existing installation, or make
2430 * an unattended setup without formatting, just go to the
2431 * filesystem check step.
2432 */
2433 if (RepairUpdateFlag)
2435
2438 }
2439
2440 // ASSERT(SystemPartition->IsPartitioned);
2441
2442 /* Reset the filesystem list for each partition that is to be formatted */
2444
2445 PreviousFormatState = FormatState;
2446 switch (FormatState)
2447 {
2448 case Start:
2449 {
2450 /*
2451 * We start by formatting the system partition in case it is new
2452 * (it didn't exist before) and is not the same as the installation
2453 * partition. Otherwise we just require a filesystem check on it,
2454 * and start by formatting the installation partition instead.
2455 */
2456
2458
2461 {
2464
2465 // TODO: Should we let the user using a custom file-system,
2466 // or should we always use FAT(32) for it?
2467 // For "compatibility", FAT(32) would be best indeed.
2468
2470 DPRINT1("FormatState: Start --> FormatSystemPartition\n");
2471 }
2472 else
2473 {
2476
2478 {
2479 /* The system partition is separate, so it had better be formatted! */
2482
2483 /* Require a filesystem check on the system partition too */
2485 }
2486
2488 DPRINT1("FormatState: Start --> FormatInstallPartition\n");
2489 }
2490 break;
2491 }
2492
2494 {
2497
2499 DPRINT1("FormatState: FormatSystemPartition --> FormatInstallPartition\n");
2500 break;
2501 }
2502
2505 {
2507 NULL,
2508 &TempPartition))
2509 {
2512
2514 DPRINT1("FormatState: FormatInstallPartition --> FormatOtherPartition\n");
2515 else
2516 DPRINT1("FormatState: FormatOtherPartition --> FormatOtherPartition\n");
2517 }
2518 else
2519 {
2521
2523 DPRINT1("FormatState: FormatInstallPartition --> FormatDone\n");
2524 else
2525 DPRINT1("FormatState: FormatOtherPartition --> FormatDone\n");
2526
2528 }
2529 break;
2530 }
2531
2532 case FormatDone:
2533 {
2534 DPRINT1("FormatState: FormatDone\n");
2536 }
2537
2538 default:
2539 {
2540 DPRINT1("FormatState: Invalid value %ld\n", FormatState);
2541 ASSERT(FALSE);
2542 return QUIT_PAGE;
2543 }
2544 }
2545
2546 PartEntry = TempPartition;
2547 DiskEntry = TempPartition->DiskEntry;
2548
2549 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2550
2552
2553 if (PartEntry->New & PARTITION_NEW_AUTOCREATE)
2554 {
2555 PartEntry->New &= ~PARTITION_NEW_AUTOCREATE;
2556
2558 }
2559 else if (PartEntry->New)
2560 {
2561 switch (FormatState)
2562 {
2565 break;
2566
2569 break;
2570
2573 break;
2574
2575 default:
2576 ASSERT(FALSE);
2577 break;
2578 }
2579 }
2580 else
2581 {
2583 }
2584
2585 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2586 CONSOLE_SetTextXY(6, 10, LineBuffer);
2587
2588 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2590 LineBuffer);
2591
2592 /* Show "This Partition will be formatted next" only if it is unformatted */
2593 if (PartEntry->New || PartEntry->FormatState == Unformatted)
2595
2597
2599 {
2601
2602 switch (USetupData.FsType)
2603 {
2604 /* 1 is for BtrFS */
2605 case 1:
2606 DefaultFs = L"BTRFS";
2607 break;
2608
2609 /* If we don't understand input, default to FAT */
2610 default:
2611 DefaultFs = L"FAT";
2612 break;
2613 }
2614 }
2615 else
2616 {
2617 /* By default select the "FAT" file system */
2618 DefaultFs = L"FAT";
2619 }
2620
2621 /* Create the file system list */
2622 // TODO: Display only the FSes compatible with the selected partition!
2624 PartEntry->New ||
2625 PartEntry->FormatState == Unformatted,
2626 DefaultFs);
2627 if (FileSystemList == NULL)
2628 {
2629 /* FIXME: show an error dialog */
2630 return QUIT_PAGE;
2631 }
2632
2634 {
2636 return FORMAT_PARTITION_PAGE;
2637 }
2638
2640
2641 while (TRUE)
2642 {
2643 CONSOLE_ConInKey(Ir);
2644
2645 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2646 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2647 {
2648 if (ConfirmQuit(Ir))
2649 {
2650 /* Reset the filesystem list */
2652 return QUIT_PAGE;
2653 }
2654
2655 break;
2656 }
2657 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2658 {
2659 /* Reset the formatter machine state */
2662
2663 /* Reset the filesystem list */
2665
2666 return SELECT_PARTITION_PAGE;
2667 }
2668 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2669 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
2670 {
2672 }
2673 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2674 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
2675 {
2677 }
2678 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2679 {
2681 {
2683
2684 /*
2685 * Skip formatting this partition. We will also ignore
2686 * filesystem checks on it, unless it is either the system
2687 * or the installation partition.
2688 */
2691 {
2692 PartEntry->NeedsCheck = FALSE;
2693 }
2694
2696 }
2697 else
2698 {
2699 /* Format this partition */
2700 return FORMAT_PARTITION_PAGE;
2701 }
2702 }
2703 }
2704
2705 FormatState = PreviousFormatState;
2706
2708}
VOID ScrollUpFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:236
VOID DrawFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:167
VOID ScrollDownFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:225
PFILE_SYSTEM_LIST CreateFileSystemList(IN SHORT Left, IN SHORT Top, IN BOOLEAN ForceFormat, IN PCWSTR SelectFileSystem)
Definition: fslist.c:109
@ Preformatted
Definition: partlist.h:37
@ Formatted
Definition: partlist.h:38
@ Unformatted
Definition: partlist.h:34
#define ULL(a, b)
Definition: format_msg.c:27
@ FixedMedia
Definition: ntdddisk.h:388
BOOLEAN WritePartitionsToDisk(IN PPARTLIST List)
Definition: partlist.c:3807
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
Definition: partlist.c:3599
BOOLEAN GetNextUnformattedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:3998
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
Definition: partlist.c:3304
BOOLEAN New
Definition: partlist.h:71
FORMATSTATE FormatState
Definition: partlist.h:61
PPARTENTRY SystemPartition
Definition: partlist.h:160
LONG FsType
Definition: setuplib.h:116
LONG FormatPartition
Definition: setuplib.h:114
#define STRING_NONFORMATTEDSYSTEMPART
Definition: mui.h:146
#define STRING_NONFORMATTEDOTHERPART
Definition: mui.h:147
#define STRING_PARTFORMAT
Definition: mui.h:144
#define STRING_INSTALLONPART
Definition: mui.h:148
#define STRING_NEWPARTITION
Definition: mui.h:143
#define STRING_NONFORMATTEDPART
Definition: mui.h:145
@ FormatOtherPartition
Definition: partlist.h:36
@ FormatInstallPartition
Definition: partlist.h:35
@ FormatDone
Definition: partlist.h:37
@ FormatSystemPartition
Definition: partlist.h:34
enum _FORMATMACHINESTATE FORMATMACHINESTATE
#define PARTITION_NEW_AUTOCREATE
Definition: usetup.c:83
@ CHANGE_SYSTEM_PARTITION
Definition: usetup.h:98

Referenced by RunUSetup().

◆ SelectPartitionPage()

static PAGE_NUMBER SelectPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 1548 of file usetup.c.

1549{
1550 PARTLIST_UI ListUi;
1551 ULONG Error;
1552
1553 if (PartitionList == NULL)
1554 {
1556 if (PartitionList == NULL)
1557 {
1559 return QUIT_PAGE;
1560 }
1562 {
1564 return QUIT_PAGE;
1565 }
1566
1567 /* Reset the formatter machine state */
1570 }
1571
1572 if (RepairUpdateFlag)
1573 {
1575
1576 /* Determine the selected installation disk & partition */
1580 if (!InstallPartition)
1581 {
1582 DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
1583 ASSERT(FALSE);
1584 }
1586
1588 }
1589
1591
1594 2, 21,
1595 xScreen - 3,
1596 yScreen - 3);
1597 DrawPartitionList(&ListUi);
1598
1600 {
1601 /* Determine the selected installation disk & partition */
1605 if (!InstallPartition)
1606 {
1608
1610 {
1613
1614 /* Automatically create the partition on the whole empty space;
1615 * it will be formatted later with default parameters */
1618 0ULL);
1620
1621// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
1623 {
1626 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1627 }
1628
1631 }
1632 }
1633 else
1634 {
1636
1637 DrawPartitionList(&ListUi); // FIXME: Doesn't make much sense...
1638
1639// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
1641 {
1644 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1645 }
1646
1648 }
1649 }
1650
1651 while (TRUE)
1652 {
1653 ULONG uID;
1654
1656
1657 /* Update status text */
1658 if (CurrentPartition == NULL)
1659 {
1660 // FIXME: If we get a NULL current partition, this means that
1661 // the current disk is of unrecognized type. So we should display
1662 // instead a status string to initialize the disk with one of
1663 // the recognized partitioning schemes (MBR, later: GPT, etc.)
1664 // For the time being we don't have that, so use instead another
1665 // known string.
1667 }
1668 else
1669 {
1671 {
1675 {
1677 }
1678 }
1679 else
1680 {
1684 }
1685 }
1687
1688 CONSOLE_ConInKey(Ir);
1689
1690 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1691 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1692 {
1693 if (ConfirmQuit(Ir))
1694 {
1697 return QUIT_PAGE;
1698 }
1699
1700 break;
1701 }
1702 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1703 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1704 {
1705 ScrollDownPartitionList(&ListUi);
1706 }
1707 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1708 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1709 {
1710 ScrollUpPartitionList(&ListUi);
1711 }
1712 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1713 {
1715
1717 continue; // return SELECT_PARTITION_PAGE;
1718
1719 /*
1720 * Check whether the user wants to install ReactOS on a disk that
1721 * is not recognized by the computer's firmware and if so, display
1722 * a warning since such disks may not be bootable.
1723 */
1724 if (CurrentPartition->DiskEntry->MediaType == FixedMedia &&
1725 !CurrentPartition->DiskEntry->BiosFound)
1726 {
1727 PopupError("The disk you have selected for installing ReactOS\n"
1728 "is not visible by the firmware of your computer,\n"
1729 "and so may not be bootable.\n"
1730 "Press ENTER to continue nonetheless.",
1732 Ir, POPUP_WAIT_ENTER);
1733 // return SELECT_PARTITION_PAGE;
1734 }
1735
1737 {
1739 if (Error != NOT_AN_ERROR)
1740 {
1742 return SELECT_PARTITION_PAGE;
1743 }
1744
1745 /* Automatically create the partition on the whole empty space;
1746 * it will be formatted later with default parameters */
1749 0ULL);
1751 }
1752
1754 {
1757 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1758 }
1759
1762 }
1763 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
1764 {
1766
1768 if (Error != NOT_AN_ERROR)
1769 {
1771 return SELECT_PARTITION_PAGE;
1772 }
1773
1775 return CREATE_PARTITION_PAGE;
1776 }
1777 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'E') /* E */
1778 {
1780
1782 {
1784 if (Error != NOT_AN_ERROR)
1785 {
1787 return SELECT_PARTITION_PAGE;
1788 }
1789
1791 return CREATE_PARTITION_PAGE;
1792 }
1793 }
1794 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
1795 {
1796 UNICODE_STRING CurrentPartitionU;
1797 WCHAR PathBuffer[MAX_PATH];
1798
1800
1801 /* Ignore deletion in case this is not a partitioned entry */
1803 {
1804 continue;
1805 }
1806
1807// TODO: Do something similar before trying to format the partition?
1808 if (!CurrentPartition->New &&
1811 {
1813
1814 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
1815 L"\\Device\\Harddisk%lu\\Partition%lu\\",
1816 CurrentPartition->DiskEntry->DiskNumber,
1818 RtlInitUnicodeString(&CurrentPartitionU, PathBuffer);
1819
1820 /*
1821 * Check whether the user attempts to delete the partition on which
1822 * the installation source is present. If so, fail with an error.
1823 */
1824 // &USetupData.SourceRootPath
1825 if (RtlPrefixUnicodeString(&CurrentPartitionU, &USetupData.SourcePath, TRUE))
1826 {
1828 return SELECT_PARTITION_PAGE;
1829 }
1830 }
1831
1834 {
1836 }
1837
1838 return DELETE_PARTITION_PAGE;
1839 }
1840 }
1841
1842 return SELECT_PARTITION_PAGE;
1843}
VOID DrawPartitionList(IN HWND hWndList, IN PPARTLIST List)
Definition: drivepage.c:591
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
@ NOT_AN_ERROR
Definition: errorcode.h:17
@ ERROR_DRIVE_INFORMATION
Definition: errorcode.h:27
@ ERROR_INSUFFICIENT_PARTITION_SIZE
Definition: errorcode.h:57
@ ERROR_SOURCE_PATH
Definition: errorcode.h:20
@ ERROR_NO_HDD
Definition: errorcode.h:22
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:316
ERROR_NUMBER ExtendedPartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2838
ERROR_NUMBER PartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2793
PPARTENTRY SelectPartition(IN PPARTLIST List, IN ULONG DiskNumber, IN ULONG PartitionNumber)
Definition: partlist.c:2203
PPARTLIST CreatePartitionList(VOID)
Definition: partlist.c:1867
BOOLEAN IsPartitionActive(IN PPARTENTRY PartEntry)
Definition: partlist.c:1788
VOID ScrollDownPartitionList(IN PPARTLIST_UI ListUi)
Definition: partlist.c:837
VOID ScrollUpPartitionList(IN PPARTLIST_UI ListUi)
Definition: partlist.c:850
VOID InitPartitionListUi(IN OUT PPARTLIST_UI ListUi, IN PPARTLIST List, IN PPARTENTRY CurrentEntry OPTIONAL, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
Definition: partlist.c:351
ULONG PartitionNumber
Definition: osdetect.h:24
PPARTENTRY CurrentPartition
Definition: partlist.h:56
LIST_ENTRY DiskListHead
Definition: partlist.h:162
LONG DestinationPartitionNumber
Definition: setuplib.h:111
LONG AutoPartition
Definition: setuplib.h:115
LONG DestinationDiskNumber
Definition: setuplib.h:110
#define STRING_DELETEPARTITION
Definition: mui.h:136
#define STRING_INSTALLCREATELOGICAL
Definition: mui.h:134
#define STRING_INSTALLDELETEPARTITION
Definition: mui.h:135
#define STRING_INSTALLCREATEPARTITION
Definition: mui.h:133
static BOOLEAN IsPartitionLargeEnough(_In_ PPARTENTRY PartEntry)
Definition: usetup.c:1510

Referenced by RunUSetup().

◆ SetupStartPage()

static PAGE_NUMBER SetupStartPage ( PINPUT_RECORD  Ir)
static

Definition at line 563 of file usetup.c.

564{
565 ULONG Error;
566 PGENERIC_LIST_ENTRY ListEntry;
568
570
571 /* Initialize Setup, phase 1 */
573 if (Error != ERROR_SUCCESS)
574 {
576 return QUIT_PAGE;
577 }
578
579 /* Initialize the user-mode PnP manager */
581 DPRINT1("The user-mode PnP manager could not initialize, expect unavailable devices!\n");
582
583 /* Wait for any immediate pending installations to finish */
585 DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
586
588
590 {
591 // TODO: Read options from inf
592 /* Load the hardware, language and keyboard layout lists */
593
597
599
600 /* new part */
604
606
607 /* first we hack LanguageList */
608 for (ListEntry = GetFirstListEntry(USetupData.LanguageList); ListEntry;
609 ListEntry = GetNextListEntry(ListEntry))
610 {
611 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
613 {
614 DPRINT("found %S in LanguageList\n", LocaleId);
616 break;
617 }
618 }
619
620 /* now LayoutList */
621 for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
622 ListEntry = GetNextListEntry(ListEntry))
623 {
624 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
626 {
627 DPRINT("found %S in LayoutList\n", LocaleId);
629 break;
630 }
631 }
632
634
635 return INSTALL_INTRO_PAGE;
636 }
637
638 return LANGUAGE_PAGE;
639}
DWORD Id
NTSTATUS WaitNoPendingInstallEvents(IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: devinst.c:514
BOOLEAN EnableUserModePnpManager(VOID)
Definition: devinst.c:521
VOID SetCurrentListEntry(IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:87
PGENERIC_LIST_ENTRY GetFirstListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:104
PGENERIC_LIST_ENTRY GetNextListEntry(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:114
VOID CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:28
Definition: genlist.h:11
WCHAR LocaleID[9]
Definition: setuplib.h:133
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
Definition: wdfpdo.h:437

Referenced by RunUSetup().

◆ SetupUpdateMemoryInfo()

static VOID SetupUpdateMemoryInfo ( IN PCOPYCONTEXT  CopyContext,
IN BOOLEAN  First 
)
static

Definition at line 3294 of file usetup.c.

3296{
3298
3299 /* Get the memory information from the system */
3301 &PerfInfo,
3302 sizeof(PerfInfo),
3303 NULL);
3304
3305 /* Check if this is initial setup */
3306 if (First)
3307 {
3308 /* Set maximum limits to be total RAM pages */
3309 ProgressSetStepCount(CopyContext->MemoryBars[0], PerfInfo.CommitLimit);
3310 ProgressSetStepCount(CopyContext->MemoryBars[1], PerfInfo.CommitLimit);
3311 ProgressSetStepCount(CopyContext->MemoryBars[2], PerfInfo.CommitLimit);
3312 }
3313
3314 /* Set current values */
3315 ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages + PerfInfo.NonPagedPoolPages);
3316 ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.ResidentSystemCachePage);
3317 ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages);
3318}
WCHAR First[]
Definition: FormatMessage.c:11
#define SystemPerformanceInformation
Definition: memtest.h:87
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)

Referenced by FileCopyCallback().

◆ ShowPartitionSizeInputBox()

static VOID ShowPartitionSizeInputBox ( SHORT  Left,
SHORT  Top,
SHORT  Right,
SHORT  Bottom,
ULONG  MaxSize,
PWSTR  InputBuffer,
PBOOLEAN  Quit,
PBOOLEAN  Cancel 
)
static

Definition at line 1851 of file usetup.c.

1859{
1860 INPUT_RECORD Ir;
1861 COORD coPos;
1862 DWORD Written;
1863 CHAR Buffer[128];
1864 INT Length, Pos;
1865 WCHAR ch;
1866 SHORT iLeft;
1867 SHORT iTop;
1868
1869 if (Quit != NULL)
1870 *Quit = FALSE;
1871
1872 if (Cancel != NULL)
1873 *Cancel = FALSE;
1874
1875 DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1);
1876
1877 /* Print message */
1878 coPos.X = Left + 2;
1879 coPos.Y = Top + 2;
1881 iLeft = coPos.X + (USHORT)strlen(Buffer) + 1;
1882 iTop = coPos.Y;
1883
1885 Buffer,
1886 strlen(Buffer),
1887 coPos,
1888 &Written);
1889
1891 coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1;
1892 coPos.Y = iTop;
1894 Buffer,
1895 strlen(Buffer),
1896 coPos,
1897 &Written);
1898
1899 swprintf(InputBuffer, L"%lu", MaxSize);
1901 Pos = Length;
1903 iTop,
1905 InputBuffer);
1906 CONSOLE_SetCursorXY(iLeft + Length, iTop);
1908
1909 while (TRUE)
1910 {
1911 CONSOLE_ConInKey(&Ir);
1912
1913 if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1914 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1915 {
1916 if (Quit != NULL)
1917 *Quit = TRUE;
1918
1921 break;
1922 }
1923 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1924 {
1926 break;
1927 }
1928 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1929 {
1930 if (Cancel != NULL)
1931 *Cancel = TRUE;
1932
1935 break;
1936 }
1937 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1938 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
1939 {
1940 Pos = 0;
1941 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1942 }
1943 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1944 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
1945 {
1946 Pos = Length;
1947 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1948 }
1949 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1950 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
1951 {
1952 if (Pos > 0)
1953 {
1954 Pos--;
1955 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1956 }
1957 }
1958 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1959 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
1960 {
1961 if (Pos < Length)
1962 {
1963 Pos++;
1964 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1965 }
1966 }
1967 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1968 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
1969 {
1970 if (Pos < Length)
1971 {
1973 &InputBuffer[Pos + 1],
1974 (Length - Pos - 1) * sizeof(WCHAR));
1976
1977 Length--;
1979 iTop,
1981 InputBuffer);
1982 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1983 }
1984 }
1985 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_BACK) /* BACKSPACE */
1986 {
1987 if (Pos > 0)
1988 {
1989 if (Pos < Length)
1990 memmove(&InputBuffer[Pos - 1],
1991 &InputBuffer[Pos],
1992 (Length - Pos) * sizeof(WCHAR));
1994
1995 Pos--;
1996 Length--;
1998 iTop,
2000 InputBuffer);
2001 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
2002 }
2003 }
2004 else if (Ir.Event.KeyEvent.uChar.AsciiChar != 0x00)
2005 {
2007 {
2009
2010 if ((ch >= L'0') && (ch <= L'9'))
2011 {
2012 if (Pos < Length)
2013 memmove(&InputBuffer[Pos + 1],
2014 &InputBuffer[Pos],
2015 (Length - Pos) * sizeof(WCHAR));
2017 InputBuffer[Pos] = ch;
2018
2019 Pos++;
2020 Length++;
2022 iTop,
2024 InputBuffer);
2025 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
2026 }
2027 }
2028 }
2029 }
2030}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
#define swprintf
Definition: precomp.h:40
#define sprintf(buf, format,...)
Definition: sprintf.c:55
int32_t INT
Definition: typedefs.h:58
#define STRING_MAXSIZE
Definition: mui.h:179
#define STRING_PARTITIONSIZE
Definition: mui.h:137
#define PARTITION_SIZE_INPUT_FIELD_LENGTH
Definition: usetup.c:1846
#define VK_BACK
Definition: winuser.h:2198

Referenced by CreatePartitionPage().

◆ SuccessPage()

static PAGE_NUMBER SuccessPage ( PINPUT_RECORD  Ir)
<