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

Go to the source code of this file.

Classes

struct  _COPYCONTEXT
 

Macros

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

Typedefs

typedef struct _COPYCONTEXT COPYCONTEXT
 
typedef struct _COPYCONTEXTPCOPYCONTEXT
 

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 LanguagePage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER SetupStartPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER WelcomePage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER LicensePage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER RepairIntroPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER UpgradeRepairPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER InstallIntroPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER DeviceSettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER HandleGenericList (PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
 
static PAGE_NUMBER ComputerSettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER DisplaySettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER KeyboardSettingsPage (PINPUT_RECORD Ir)
 
static PAGE_NUMBER LayoutSettingsPage (PINPUT_RECORD Ir)
 
static BOOL IsDiskSizeValid (PPARTENTRY PartEntry)
 
static PAGE_NUMBER SelectPartitionPage (PINPUT_RECORD Ir)
 
static VOID ShowPartitionSizeInputBox (SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
 
static PAGE_NUMBER 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 1839 of file usetup.c.

◆ PARTITION_SIZE_INPUT_FIELD_LENGTH

#define PARTITION_SIZE_INPUT_FIELD_LENGTH   9

Definition at line 1837 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
static enum @53 PartCreateType
@ PartTypeData
Definition: usetup.c:78
@ PartTypeExtended
Definition: usetup.c:79

Function Documentation

◆ BootLoaderHardDiskPage()

static BOOLEAN BootLoaderHardDiskPage ( PINPUT_RECORD  Ir)
static

Definition at line 3798 of file usetup.c.

3799{
3801 WCHAR DestinationDevicePathBuffer[MAX_PATH];
3802
3803 if (USetupData.MBRInstallType == 2)
3804 {
3805 /* Step 1: Write the VBR */
3810 if (!NT_SUCCESS(Status))
3811 {
3814 return FALSE;
3815 }
3816
3817 /* Step 2: Write the MBR if the disk containing the system partition is not a super-floppy */
3819 {
3820 RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
3821 L"\\Device\\Harddisk%d\\Partition0",
3822 SystemPartition->DiskEntry->DiskNumber);
3825 DestinationDevicePathBuffer);
3826 if (!NT_SUCCESS(Status))
3827 {
3828 DPRINT1("InstallMbrBootCodeToDisk() failed: Status 0x%lx\n", Status);
3830 return FALSE;
3831 }
3832 }
3833 }
3834 else
3835 {
3840 if (!NT_SUCCESS(Status))
3841 {
3844 return FALSE;
3845 }
3846 }
3847
3848 return TRUE;
3849}
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:1333
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
Definition: bootsup.c:763
#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 3864 of file usetup.c.

3865{
3866 WCHAR PathBuffer[MAX_PATH];
3867
3868 // /* We must have a supported system partition by now */
3869 // ASSERT(SystemPartition && SystemPartition->IsPartitioned && SystemPartition->PartitionNumber != 0);
3870
3872 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
3873 L"\\Device\\Harddisk%lu\\Partition%lu\\",
3874 SystemPartition->DiskEntry->DiskNumber,
3877 DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath);
3878
3879 if (USetupData.MBRInstallType != 0)
3881
3882 switch (USetupData.MBRInstallType)
3883 {
3884 /* Skip installation */
3885 case 0:
3886 return SUCCESS_PAGE;
3887
3888 /* Install on removable disk */
3889 case 1:
3891
3892 /* Install on hard-disk (both MBR and VBR, or VBR only) */
3893 case 2:
3894 case 3:
3896
3897 default:
3898 return SUCCESS_PAGE;
3899 }
3900}
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:3752
static BOOLEAN BootLoaderHardDiskPage(PINPUT_RECORD Ir)
Definition: usetup.c:3798
@ 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 3752 of file usetup.c.

3753{
3755
3756Retry:
3758 CONSOLE_Flush();
3760// CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
3761
3762 while (TRUE)
3763 {
3764 CONSOLE_ConInKey(Ir);
3765
3766 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3767 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3768 {
3769 if (ConfirmQuit(Ir))
3770 return FALSE;
3771
3772 break;
3773 }
3774 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3775 {
3778 if (!NT_SUCCESS(Status))
3779 {
3782
3783 /* TODO: Print error message */
3784 goto Retry;
3785 }
3786
3787 return TRUE;
3788 }
3789 }
3790
3791 goto Retry;
3792}
NTSTATUS InstallFatBootcodeToFloppy(IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1378
_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::@3277 Event
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
WORD wVirtualKeyCode
Definition: wincon.h:242
union _KEY_EVENT_RECORD::@3276 uChar
static BOOL ConfirmQuit(PINPUT_RECORD Ir)
Definition: usetup.c:433
@ BOOTLOADER_REMOVABLE_DISK_PAGE
Definition: usetup.h:112
#define VK_F3
Definition: winuser.h:2256

Referenced by BootLoaderInstallPage().

◆ BootLoaderSelectPage()

static PAGE_NUMBER BootLoaderSelectPage ( PINPUT_RECORD  Ir)
static

Definition at line 3598 of file usetup.c.

3599{
3600 USHORT Line = 12;
3601
3603
3604 /* We must have a supported system partition by now */
3606
3607 /*
3608 * If we repair an existing installation and we made it up to here,
3609 * this means a valid bootloader and boot entry have been found.
3610 * Thus, there is no need to re-install it: skip its installation.
3611 */
3612 if (RepairUpdateFlag)
3613 {
3615 goto Quit;
3616 }
3617
3618 /* For unattended setup, skip MBR installation or install on removable disk if needed */
3620 {
3621 if ((USetupData.MBRInstallType == 0) ||
3623 {
3624 goto Quit;
3625 }
3626 }
3627
3628 /*
3629 * We may install an MBR or VBR, but before that, check whether
3630 * we need to actually install the VBR on removable disk if the
3631 * system partition is not recognized.
3632 */
3633 if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) ||
3635 {
3637 goto Quit;
3638 }
3639
3640 /* Is it an unattended install on hdd? */
3642 {
3643 if ((USetupData.MBRInstallType == 2) ||
3645 {
3646 goto Quit;
3647 }
3648 }
3649
3651 CONSOLE_InvertTextXY(8, Line, 60, 1);
3652
3653 while (TRUE)
3654 {
3655 CONSOLE_ConInKey(Ir);
3656
3657 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3658 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
3659 {
3660 CONSOLE_NormalTextXY(8, Line, 60, 1);
3661
3662 Line++;
3663 if (Line < 12)
3664 Line = 15;
3665
3666 if (Line > 15)
3667 Line = 12;
3668
3669 CONSOLE_InvertTextXY(8, Line, 60, 1);
3670 }
3671 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3672 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
3673 {
3674 CONSOLE_NormalTextXY(8, Line, 60, 1);
3675
3676 Line--;
3677 if (Line < 12)
3678 Line = 15;
3679
3680 if (Line > 15)
3681 Line = 12;
3682
3683 CONSOLE_InvertTextXY(8, Line, 60, 1);
3684 }
3685 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3686 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3687 {
3688 CONSOLE_NormalTextXY(8, Line, 60, 1);
3689
3690 Line = 12;
3691
3692 CONSOLE_InvertTextXY(8, Line, 60, 1);
3693 }
3694 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3695 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3696 {
3697 CONSOLE_NormalTextXY(8, Line, 60, 1);
3698
3699 Line = 15;
3700
3701 CONSOLE_InvertTextXY(8, Line, 60, 1);
3702 }
3703 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3704 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3705 {
3706 if (ConfirmQuit(Ir))
3707 return QUIT_PAGE;
3708
3709 break;
3710 }
3711 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3712 {
3713 if (Line == 12)
3714 {
3715 /* Install on both MBR and VBR */
3717 break;
3718 }
3719 else if (Line == 13)
3720 {
3721 /* Install on VBR only */
3723 break;
3724 }
3725 else if (Line == 14)
3726 {
3727 /* Install on removable disk */
3729 break;
3730 }
3731 else if (Line == 15)
3732 {
3733 /* Skip installation */
3735 break;
3736 }
3737
3739 }
3740 }
3741
3742Quit:
3743 /* Continue the installation; the bootloader is installed at the end */
3745}
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:2224
#define VK_END
Definition: winuser.h:2221
#define VK_HOME
Definition: winuser.h:2222
#define VK_DOWN
Definition: winuser.h:2226

Referenced by RunUSetup().

◆ CheckFileSystemPage()

static PAGE_NUMBER CheckFileSystemPage ( PINPUT_RECORD  Ir)
static

Definition at line 2880 of file usetup.c.

2881{
2883 PPARTENTRY PartEntry;
2885
2886 if (PartitionList == NULL)
2887 {
2888 /* FIXME: show an error dialog */
2889 return QUIT_PAGE;
2890 }
2891
2892 if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry))
2893 {
2895 }
2896
2897 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2898
2899 DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
2900 PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a"));
2901
2903
2905 CONSOLE_SetTextXY(6, 10, Buffer);
2906
2909 Buffer);
2910
2911 /* Check the partition */
2912 Status = DoChkdsk(PartEntry);
2914 {
2915 /*
2916 * Partition checking is not supported with the current filesystem,
2917 * so disable FS checks on it.
2918 */
2919 PartEntry->NeedsCheck = FALSE;
2920
2922 sizeof(Buffer),
2923 "Setup is currently unable to check a partition formatted in %S.\n"
2924 "\n"
2925 " \x07 Press ENTER to continue Setup.\n"
2926 " \x07 Press F3 to quit Setup.",
2927 PartEntry->FileSystem);
2928
2932
2933 while (TRUE)
2934 {
2935 CONSOLE_ConInKey(Ir);
2936
2937 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2938 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2939 {
2940 if (ConfirmQuit(Ir))
2941 return QUIT_PAGE;
2942 else
2944 }
2945 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2946 {
2948 }
2949 }
2950 }
2951 else if (!NT_SUCCESS(Status))
2952 {
2953 DPRINT1("DoChkdsk() failed: Status 0x%08lx\n", Status);
2954
2956 sizeof(Buffer),
2957 "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n",
2958 Status);
2959
2962 Ir, POPUP_WAIT_ENTER);
2963 }
2964
2965 PartEntry->NeedsCheck = FALSE;
2967}
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:4051
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:77
#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:260
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:2200
char CHAR
Definition: xmlstorage.h:175

Referenced by RunUSetup().

◆ ComputerSettingsPage()

static PAGE_NUMBER ComputerSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1411 of file usetup.c.

1412{
1413 GENERIC_LIST_UI ListUi;
1415
1417 DrawGenericList(&ListUi,
1418 2, 18,
1419 xScreen - 3,
1420 yScreen - 3);
1421
1422 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1423}
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:495
static PAGE_NUMBER HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir)
Definition: usetup.c:1346
@ 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:2213

Referenced by RunUSetup().

◆ ConfirmQuit()

static BOOL ConfirmQuit ( PINPUT_RECORD  Ir)
static

Definition at line 433 of file usetup.c.

434{
435 BOOL Result = FALSE;
437
438 while (TRUE)
439 {
441
442 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
443 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
444 {
445 Result = TRUE;
446 break;
447 }
448 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
449 {
450 Result = FALSE;
451 break;
452 }
453 }
454
455 return Result;
456}
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 2036 of file usetup.c.

2037{
2038 PPARTENTRY PartEntry;
2039 PDISKENTRY DiskEntry;
2040 ULONG uID;
2041 BOOLEAN Quit;
2043 ULONG MaxSize;
2044 ULONGLONG PartSize;
2046 WCHAR InputBuffer[50];
2047 CHAR LineBuffer[100];
2048
2050 {
2051 /* FIXME: show an error dialog */
2052 return QUIT_PAGE;
2053 }
2054
2056 {
2060 }
2061 else // if (PartCreateType == PartTypeExtended)
2062 {
2064 }
2065
2066 CONSOLE_SetTextXY(6, 8, MUIGetString(uID));
2067
2068 PartEntry = CurrentPartition;
2069 DiskEntry = CurrentPartition->DiskEntry;
2070
2071 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2073 LineBuffer);
2074
2076
2078
2079 while (TRUE)
2080 {
2081 MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
2082 if (MaxSize > PARTITION_MAXSIZE)
2083 MaxSize = PARTITION_MAXSIZE;
2084
2085 ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
2086 MaxSize, InputBuffer, &Quit, &Cancel);
2087
2088 if (Quit)
2089 {
2090 if (ConfirmQuit(Ir))
2091 return QUIT_PAGE;
2092 break;
2093 }
2094 else if (Cancel)
2095 {
2096 return SELECT_PARTITION_PAGE;
2097 }
2098 else
2099 {
2100 PartSize = _wcstoui64(InputBuffer, NULL, 10);
2101
2102 /* Retry if too small or too large */
2103 if (PartSize < 1)
2104 continue;
2105 if (PartSize > MaxSize)
2106 continue;
2107
2108 /* Convert to bytes */
2109 if (PartSize == MaxSize)
2110 {
2111 /* Use all of the unpartitioned disk space */
2112 SectorCount = PartEntry->SectorCount.QuadPart;
2113 }
2114 else
2115 {
2116 /* Calculate the sector count from the size in MB */
2117 SectorCount = PartSize * MB / DiskEntry->BytesPerSector;
2118
2119 /* But never get larger than the unpartitioned disk space */
2120 if (SectorCount > PartEntry->SectorCount.QuadPart)
2121 SectorCount = PartEntry->SectorCount.QuadPart;
2122 }
2123
2124 DPRINT("Partition size: %I64u bytes\n", PartSize);
2125
2127 {
2131 FALSE);
2132 }
2133 else // if (PartCreateType == PartTypeExtended)
2134 {
2137 SectorCount);
2138 }
2139
2140 return SELECT_PARTITION_PAGE;
2141 }
2142 }
2143
2144 return CREATE_PARTITION_PAGE;
2145}
unsigned char BOOLEAN
void Cancel(int sigNum)
Definition: shell.c:481
ULONG SectorCount
Definition: part_xbox.c:31
BOOLEAN CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_ ULONGLONG SectorCount, _In_ BOOLEAN AutoCreate)
Definition: partlist.c:2862
BOOLEAN CreateExtendedPartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_ ULONGLONG SectorCount)
Definition: partlist.c:2924
#define MB
Definition: setuplib.h:56
#define DPRINT
Definition: sndvol32.h:71
ULONG BytesPerSector
Definition: partlist.h:95
ULARGE_INTEGER SectorCount
Definition: partlist.h:50
BOOLEAN LogicalPartition
Definition: partlist.h:63
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
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:1839
static VOID ShowPartitionSizeInputBox(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom, ULONG MaxSize, PWSTR InputBuffer, PBOOLEAN Quit, PBOOLEAN Cancel)
Definition: usetup.c:1842
@ 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:3085

Referenced by RunUSetup().

◆ DeviceSettingsPage()

static PAGE_NUMBER DeviceSettingsPage ( PINPUT_RECORD  Ir)
static

Definition at line 1214 of file usetup.c.

1215{
1216 static ULONG Line = 16;
1217
1218 /* Initialize the computer settings list */
1220 {
1223 {
1225 return QUIT_PAGE;
1226 }
1227 }
1228
1229 /* Initialize the display settings list */
1231 {
1234 {
1236 return QUIT_PAGE;
1237 }
1238 }
1239
1240 /* Initialize the keyboard settings list */
1242 {
1245 {
1247 return QUIT_PAGE;
1248 }
1249 }
1250
1251 /* Initialize the keyboard layout list */
1252 if (USetupData.LayoutList == NULL)
1253 {
1255 if (USetupData.LayoutList == NULL)
1256 {
1257 /* FIXME: report error */
1259 return QUIT_PAGE;
1260 }
1261 }
1262
1263 if (RepairUpdateFlag)
1264 return SELECT_PARTITION_PAGE;
1265
1266 // if (IsUnattendedSetup)
1267 // return SELECT_PARTITION_PAGE;
1268
1270
1275
1276 CONSOLE_InvertTextXY(24, Line, 48, 1);
1277
1278 while (TRUE)
1279 {
1280 CONSOLE_ConInKey(Ir);
1281
1282 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1283 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1284 {
1285 CONSOLE_NormalTextXY(24, Line, 48, 1);
1286
1287 if (Line == 14)
1288 Line = 16;
1289 else if (Line == 16)
1290 Line = 11;
1291 else
1292 Line++;
1293
1294 CONSOLE_InvertTextXY(24, Line, 48, 1);
1295 }
1296 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1297 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1298 {
1299 CONSOLE_NormalTextXY(24, Line, 48, 1);
1300
1301 if (Line == 11)
1302 Line = 16;
1303 else if (Line == 16)
1304 Line = 14;
1305 else
1306 Line--;
1307
1308 CONSOLE_InvertTextXY(24, Line, 48, 1);
1309 }
1310 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1311 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1312 {
1313 if (ConfirmQuit(Ir))
1314 return QUIT_PAGE;
1315
1316 break;
1317 }
1318 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1319 {
1320 if (Line == 11)
1322 else if (Line == 12)
1323 return DISPLAY_SETTINGS_PAGE;
1324 else if (Line == 13)
1326 else if (Line == 14)
1327 return LAYOUT_SETTINGS_PAGE;
1328 else if (Line == 16)
1329 return SELECT_PARTITION_PAGE;
1330 }
1331 }
1332
1333 return DEVICE_SETTINGS_PAGE;
1334}
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1093
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:1230
@ 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 1437 of file usetup.c.

1438{
1439 GENERIC_LIST_UI ListUi;
1441
1443 DrawGenericList(&ListUi,
1444 2, 18,
1445 xScreen - 3,
1446 yScreen - 3);
1447
1448 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1449}

Referenced by RunUSetup().

◆ DrawBox()

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

Definition at line 170 of file usetup.c.

174{
175 COORD coPos;
176 DWORD Written;
177
178 /* Draw upper left corner */
179 coPos.X = xLeft;
180 coPos.Y = yTop;
182 CharUpperLeftCorner, // '+',
183 1,
184 coPos,
185 &Written);
186
187 /* Draw upper edge */
188 coPos.X = xLeft + 1;
189 coPos.Y = yTop;
191 CharHorizontalLine, // '-',
192 Width - 2,
193 coPos,
194 &Written);
195
196 /* Draw upper right corner */
197 coPos.X = xLeft + Width - 1;
198 coPos.Y = yTop;
200 CharUpperRightCorner, // '+',
201 1,
202 coPos,
203 &Written);
204
205 /* Draw right edge, inner space and left edge */
206 for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
207 {
208 coPos.X = xLeft;
210 CharVerticalLine, // '|',
211 1,
212 coPos,
213 &Written);
214
215 coPos.X = xLeft + 1;
217 ' ',
218 Width - 2,
219 coPos,
220 &Written);
221
222 coPos.X = xLeft + Width - 1;
224 CharVerticalLine, // '|',
225 1,
226 coPos,
227 &Written);
228 }
229
230 /* Draw lower left corner */
231 coPos.X = xLeft;
232 coPos.Y = yTop + Height - 1;
234 CharLowerLeftCorner, // '+',
235 1,
236 coPos,
237 &Written);
238
239 /* Draw lower edge */
240 coPos.X = xLeft + 1;
241 coPos.Y = yTop + Height - 1;
243 CharHorizontalLine, // '-',
244 Width - 2,
245 coPos,
246 &Written);
247
248 /* Draw lower right corner */
249 coPos.X = xLeft + Width - 1;
250 coPos.Y = yTop + Height - 1;
252 CharLowerRightCorner, // '+',
253 1,
254 coPos,
255 &Written);
256}
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 3318 of file usetup.c.

3322{
3323 PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
3324 PFILEPATHS_W FilePathInfo;
3325 PCWSTR SrcFileName, DstFileName;
3326
3327 switch (Notification)
3328 {
3330 {
3331 CopyContext->TotalOperations = (ULONG)Param2;
3332 CopyContext->CompletedOperations = 0;
3333 ProgressSetStepCount(CopyContext->ProgressBar,
3334 CopyContext->TotalOperations);
3335 SetupUpdateMemoryInfo(CopyContext, TRUE);
3336 break;
3337 }
3338
3342 {
3343 FilePathInfo = (PFILEPATHS_W)Param1;
3344
3346 {
3347 /* Display delete message */
3348 ASSERT(Param2 == FILEOP_DELETE);
3349
3350 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3351 if (DstFileName) ++DstFileName;
3352 else DstFileName = FilePathInfo->Target;
3353
3355 DstFileName);
3356 }
3358 {
3359 /* Display move/rename message */
3360 ASSERT(Param2 == FILEOP_RENAME);
3361
3362 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
3363 if (SrcFileName) ++SrcFileName;
3364 else SrcFileName = FilePathInfo->Source;
3365
3366 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3367 if (DstFileName) ++DstFileName;
3368 else DstFileName = FilePathInfo->Target;
3369
3370 if (!wcsicmp(SrcFileName, DstFileName))
3371 Param2 = STRING_MOVING;
3372 else
3373 Param2 = STRING_RENAMING;
3374
3376 SrcFileName, DstFileName);
3377 }
3379 {
3380 static PCSTR s_pszCopying = NULL; /* Cached for speed */
3381
3382 /* Display copy message */
3383 ASSERT(Param2 == FILEOP_COPY);
3384
3385 /* NOTE: When extracting from CABs the Source is the CAB name */
3386 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
3387 if (DstFileName) ++DstFileName;
3388 else DstFileName = FilePathInfo->Target;
3389
3390 if (!s_pszCopying)
3391 s_pszCopying = MUIGetString(STRING_COPYING);
3392 CONSOLE_SetStatusText(s_pszCopying, DstFileName);
3393#ifdef __REACTOS__ /* HACK */
3394 DoWatchDestFileName(DstFileName);
3395#endif
3396 }
3397
3398 SetupUpdateMemoryInfo(CopyContext, FALSE);
3399 break;
3400 }
3401
3403 {
3404 FilePathInfo = (PFILEPATHS_W)Param1;
3405
3406 DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
3407 FilePathInfo->Target, FilePathInfo->Win32Error);
3408 return FILEOP_SKIP;
3409 }
3410
3414 {
3415 CopyContext->CompletedOperations++;
3416
3417 /* SYSREG checkpoint */
3418 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
3419 DPRINT1("CHECKPOINT:HALF_COPIED\n");
3420
3421 ProgressNextStep(CopyContext->ProgressBar);
3422 SetupUpdateMemoryInfo(CopyContext, FALSE);
3423 break;
3424 }
3425 }
3426
3427 return FILEOP_DOIT;
3428}
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:980
ULONG CompletedOperations
Definition: reactos.c:981
PPROGRESSBAR ProgressBar
Definition: usetup.c:3285
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:3290
_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 3444 of file usetup.c.

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

4181{
4183 return REBOOT_PAGE;
4184}
@ 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 2723 of file usetup.c.

2724{
2726 PPARTENTRY PartEntry;
2727 PDISKENTRY DiskEntry;
2728 PFILE_SYSTEM_ITEM SelectedFileSystem;
2729 WCHAR PathBuffer[MAX_PATH];
2731
2732 DPRINT("FormatPartitionPage()\n");
2733
2734 if (PartitionList == NULL || TempPartition == NULL)
2735 {
2736 /* FIXME: show an error dialog */
2737 return QUIT_PAGE;
2738 }
2739
2740 PartEntry = TempPartition;
2741 DiskEntry = TempPartition->DiskEntry;
2742
2743 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2744
2745 SelectedFileSystem = FileSystemList->Selected;
2746 ASSERT(SelectedFileSystem && SelectedFileSystem->FileSystem);
2747
2749
2751 CONSOLE_SetTextXY(6, 10, Buffer);
2752
2753 DiskDescription(DiskEntry, Buffer, ARRAYSIZE(Buffer));
2755 Buffer);
2756
2757 while (TRUE)
2758 {
2759 if (!IsUnattendedSetup)
2760 CONSOLE_ConInKey(Ir);
2761
2762 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2763 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2764 {
2765 if (ConfirmQuit(Ir))
2766 {
2767 /* Reset the filesystem list */
2769 return QUIT_PAGE;
2770 }
2771
2772 break;
2773 }
2774 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
2775 {
2776 /*
2777 * Remove the "Press ENTER to continue" message prompt when the ENTER
2778 * key is pressed as the user wants to begin the partition formatting.
2779 */
2782
2783 /* Format the partition */
2784 Status = DoFormat(PartEntry,
2785 SelectedFileSystem->FileSystem,
2786 SelectedFileSystem->QuickFormat);
2788 {
2790
2791 /* Reset the filesystem list */
2793 return QUIT_PAGE;
2794 }
2796 {
2797 /* FIXME: show an error dialog */
2798 // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
2799
2800 /* Reset the filesystem list */
2802 return QUIT_PAGE;
2803 }
2804 else if (Status == STATUS_NOT_SUPPORTED)
2805 {
2807 sizeof(Buffer),
2808 "Setup is currently unable to format a partition in %S.\n"
2809 "\n"
2810 " \x07 Press ENTER to continue Setup.\n"
2811 " \x07 Press F3 to quit Setup.",
2812 SelectedFileSystem->FileSystem);
2813
2817
2818 while (TRUE)
2819 {
2820 CONSOLE_ConInKey(Ir);
2821
2822 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
2823 Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
2824 {
2825 if (ConfirmQuit(Ir))
2826 {
2827 /* Reset the filesystem list */
2829 return QUIT_PAGE;
2830 }
2831 else
2832 {
2834 }
2835 }
2836 else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
2837 {
2839 }
2840 }
2841 }
2842 else if (!NT_SUCCESS(Status))
2843 {
2845 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
2846 L"\\Device\\Harddisk%lu\\Partition%lu",
2847 DiskEntry->DiskNumber,
2848 PartEntry->PartitionNumber);
2849
2850 DPRINT1("DoFormat() failed: Status 0x%08lx\n", Status);
2852
2853 /* Reset the filesystem list */
2855 return QUIT_PAGE;
2856 }
2857
2859 }
2860 }
2861
2862 return FORMAT_PARTITION_PAGE;
2863}
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:111
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:86
static VOID ResetFileSystemList(VOID)
Definition: usetup.c:2254
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:83
@ 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 506 of file usetup.c.

510{
512 PPARTENTRY PartEntry = NtOsInstall->PartEntry;
513
514 if (PartEntry && PartEntry->DriveLetter)
515 {
516 /* We have retrieved a partition that is mounted */
517 return RtlStringCchPrintfA(Buffer, cchBufferSize,
518 "%C:%S \"%S\"",
519 PartEntry->DriveLetter,
520 NtOsInstall->PathComponent,
521 NtOsInstall->InstallationName);
522 }
523 else
524 {
525 /* We failed somewhere, just show the NT path */
526 return RtlStringCchPrintfA(Buffer, cchBufferSize,
527 "%wZ \"%S\"",
528 &NtOsInstall->SystemNtPath,
529 NtOsInstall->InstallationName);
530 }
531}
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 495 of file usetup.c.

499{
500 return RtlStringCchPrintfA(Buffer, cchBufferSize, "%S",
502}
_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 1346 of file usetup.c.

1349{
1350 while (TRUE)
1351 {
1352 CONSOLE_ConInKey(Ir);
1353
1354 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1355 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1356 {
1357 ScrollDownGenericList(ListUi);
1358 }
1359 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1360 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1361 {
1362 ScrollUpGenericList(ListUi);
1363 }
1364 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1365 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
1366 {
1368 }
1369 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1370 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
1371 {
1373 }
1374 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1375 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1376 {
1377 if (ConfirmQuit(Ir))
1378 return QUIT_PAGE;
1379 else
1380 RedrawGenericList(ListUi);
1381 }
1382 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1383 {
1385 return nextPage; // Use some "prevPage;" instead?
1386 }
1387 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
1388 {
1389 return nextPage;
1390 }
1391 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
1392 {
1393 /* a-z */
1395 }
1396 }
1397}
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:2220
#define VK_PRIOR
Definition: winuser.h:2219

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

◆ InstallDirectoryPage()

static PAGE_NUMBER InstallDirectoryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3027 of file usetup.c.

3028{
3030 ULONG Length, Pos;
3031 WCHAR c;
3032 WCHAR InstallDir[MAX_PATH];
3033
3034 /* We do not need the filesystem list anymore */
3036
3038 {
3039 /* FIXME: show an error dialog */
3040 return QUIT_PAGE;
3041 }
3042
3043 // if (IsUnattendedSetup)
3044 if (RepairUpdateFlag)
3045 wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
3048 else
3049 wcscpy(InstallDir, L"\\ReactOS");
3050
3051 /*
3052 * Check the validity of the predefined 'InstallDir'. If we are either
3053 * in unattended setup or in update/repair mode, and the installation path
3054 * is valid, just perform the installation. Otherwise (either in the case
3055 * of an invalid path, or we are in regular setup), display the UI and allow
3056 * the user to specify a new installation path.
3057 */
3058 if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
3059 {
3061 if (!NT_SUCCESS(Status))
3062 {
3063 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
3065 return QUIT_PAGE;
3066 }
3067
3068 /*
3069 * Check whether the user attempts to install ReactOS within the
3070 * installation source directory, or in a subdirectory thereof.
3071 * If so, fail with an error.
3072 */
3074 {
3077 }
3078
3079 return PREPARE_COPY_PAGE;
3080 }
3081
3082 Length = wcslen(InstallDir);
3083 Pos = Length;
3084
3086 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3087 CONSOLE_SetCursorXY(8 + Pos, 11);
3089
3090 while (TRUE)
3091 {
3092 CONSOLE_ConInKey(Ir);
3093
3094 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3095 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
3096 {
3098
3099 if (ConfirmQuit(Ir))
3100 return QUIT_PAGE;
3101
3103 break;
3104 }
3105 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3106 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DELETE)) /* DEL */
3107 {
3108 if (Pos < Length)
3109 {
3110 memmove(&InstallDir[Pos],
3111 &InstallDir[Pos + 1],
3112 (Length - Pos - 1) * sizeof(WCHAR));
3113 InstallDir[Length - 1] = UNICODE_NULL;
3114
3115 Length--;
3116 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3117 CONSOLE_SetCursorXY(8 + Pos, 11);
3118 }
3119 }
3120 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3121 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
3122 {
3123 Pos = 0;
3124 CONSOLE_SetCursorXY(8 + Pos, 11);
3125 }
3126 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3127 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
3128 {
3129 Pos = Length;
3130 CONSOLE_SetCursorXY(8 + Pos, 11);
3131 }
3132 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3133 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
3134 {
3135 if (Pos > 0)
3136 {
3137 Pos--;
3138 CONSOLE_SetCursorXY(8 + Pos, 11);
3139 }
3140 }
3141 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
3142 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
3143 {
3144 if (Pos < Length)
3145 {
3146 Pos++;
3147 CONSOLE_SetCursorXY(8 + Pos, 11);
3148 }
3149 }
3150 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
3151 {
3153
3154 /*
3155 * Check for the validity of the installation directory and pop up
3156 * an error if it is not the case. Then the user can fix its input.
3157 */
3158 if (!IsValidPath(InstallDir))
3159 {
3162 }
3163
3165 if (!NT_SUCCESS(Status))
3166 {
3167 DPRINT1("InitDestinationPaths() failed: Status 0x%lx\n", Status);
3169 return QUIT_PAGE;
3170 }
3171
3172 /*
3173 * Check whether the user attempts to install ReactOS within the
3174 * installation source directory, or in a subdirectory thereof.
3175 * If so, fail with an error.
3176 */
3178 {
3181 }
3182
3183 return PREPARE_COPY_PAGE;
3184 }
3185 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
3186 {
3187 if (Pos > 0)
3188 {
3189 if (Pos < Length)
3190 memmove(&InstallDir[Pos - 1],
3191 &InstallDir[Pos],
3192 (Length - Pos) * sizeof(WCHAR));
3193 InstallDir[Length - 1] = UNICODE_NULL;
3194
3195 Pos--;
3196 Length--;
3197 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3198 CONSOLE_SetCursorXY(8 + Pos, 11);
3199 }
3200 }
3201 else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar))
3202 {
3203 if (Length < 50)
3204 {
3206 if (iswalpha(c) || iswdigit(c) || c == '.' || c == '\\' || c == '-' || c == '_')
3207 {
3208 if (Pos < Length)
3209 memmove(&InstallDir[Pos + 1],
3210 &InstallDir[Pos],
3211 (Length - Pos) * sizeof(WCHAR));
3212 InstallDir[Length + 1] = UNICODE_NULL;
3213 InstallDir[Pos] = c;
3214
3215 Pos++;
3216 Length++;
3217 CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
3218 CONSOLE_SetCursorXY(8 + Pos, 11);
3219 }
3220 }
3221 }
3222 }
3223
3225}
#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:627
UNICODE_STRING SourcePath
Definition: setuplib.h:84
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:130
UNICODE_STRING DestinationPath
Definition: setuplib.h:104
static PPARTENTRY InstallPartition
Definition: usetup.c:50
static BOOLEAN IsValidPath(IN PCWSTR InstallDir)
Definition: usetup.c:2971
static PNTOS_INSTALLATION CurrentInstallation
Definition: usetup.c:91
@ PREPARE_COPY_PAGE
Definition: usetup.h:107
#define VK_LEFT
Definition: winuser.h:2223
#define VK_RIGHT
Definition: winuser.h:2225
#define VK_DELETE
Definition: winuser.h:2232

Referenced by RunUSetup().

◆ InstallIntroPage()

static PAGE_NUMBER InstallIntroPage ( PINPUT_RECORD  Ir)
static

Definition at line 1078 of file usetup.c.

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

Referenced by RunUSetup().

◆ IsDiskSizeValid()

static BOOL IsDiskSizeValid ( PPARTENTRY  PartEntry)
static

Definition at line 1505 of file usetup.c.

1506{
1508
1509 size = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector;
1510 size = (size + (512 * KB)) / MB; /* in MBytes */
1511
1513 {
1514 /* Partition is too small so ask for another one */
1515 DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, USetupData.RequiredPartitionDiskSpace);
1516 return FALSE;
1517 }
1518 else
1519 {
1520 return TRUE;
1521 }
1522}
GLsizeiptr size
Definition: glext.h:5919
#define KB
Definition: setuplib.h:55
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:129

Referenced by SelectPartitionPage().

◆ IsValidPath()

static BOOLEAN IsValidPath ( IN PCWSTR  InstallDir)
static

Definition at line 2971 of file usetup.c.

2973{
2974 UINT i, Length;
2975
2976 Length = wcslen(InstallDir);
2977
2978 // TODO: Add check for 8.3 too.
2979
2980 /* Path must be at least 2 characters long */
2981// if (Length < 2)
2982// return FALSE;
2983
2984 /* Path must start with a backslash */
2985// if (InstallDir[0] != L'\\')
2986// return FALSE;
2987
2988 /* Path must not end with a backslash */
2989 if (InstallDir[Length - 1] == L'\\')
2990 return FALSE;
2991
2992 /* Path must not contain whitespace characters */
2993 for (i = 0; i < Length; i++)
2994 {
2995 if (iswspace(InstallDir[i]))
2996 return FALSE;
2997 }
2998
2999 /* Path component must not end with a dot */
3000 for (i = 0; i < Length; i++)
3001 {
3002 if (InstallDir[i] == L'\\' && i > 0)
3003 {
3004 if (InstallDir[i - 1] == L'.')
3005 return FALSE;
3006 }
3007 }
3008
3009 if (InstallDir[Length - 1] == L'.')
3010 return FALSE;
3011
3012 return TRUE;
3013}
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 1463 of file usetup.c.

1464{
1465 GENERIC_LIST_UI ListUi;
1467
1469 DrawGenericList(&ListUi,
1470 2, 18,
1471 xScreen - 3,
1472 yScreen - 3);
1473
1474 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1475}

Referenced by RunUSetup().

◆ LanguagePage()

static PAGE_NUMBER LanguagePage ( PINPUT_RECORD  Ir)
static

Definition at line 547 of file usetup.c.

548{
549 GENERIC_LIST_UI ListUi;
550 PCWSTR NewLanguageId;
551 BOOL RefreshPage = FALSE;
552
553 /* Initialize the computer settings list */
555 {
558 {
559 PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
560 return WELCOME_PAGE;
561 }
562 }
563
566
567 /* Load the font */
570
571 /*
572 * If there is no language or just a single one in the list,
573 * skip the language selection process altogether.
574 */
576 {
578 return WELCOME_PAGE;
579 }
580
582 DrawGenericList(&ListUi,
583 2, 18,
584 xScreen - 3,
585 yScreen - 3);
586
588
590
591 while (TRUE)
592 {
594
595 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
596 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
597 {
598 ScrollDownGenericList(&ListUi);
599 RefreshPage = TRUE;
600 }
601 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
602 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
603 {
604 ScrollUpGenericList(&ListUi);
605 RefreshPage = TRUE;
606 }
607 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
608 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
609 {
611 RefreshPage = TRUE;
612 }
613 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
614 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
615 {
617 RefreshPage = TRUE;
618 }
619 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
620 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
621 {
622 if (ConfirmQuit(Ir))
623 return QUIT_PAGE;
624 else
625 RedrawGenericList(&ListUi);
626 }
627 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
628 {
630
633
635
637 {
639 }
640
641 /* Load the font */
643
644 return WELCOME_PAGE;
645 }
646 else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
647 {
648 /* a-z */
650 RefreshPage = TRUE;
651 }
652
653 if (RefreshPage)
654 {
656
657 NewLanguageId =
659
660 if (wcscmp(SelectedLanguageId, NewLanguageId))
661 {
662 /* Clear the language page */
664
665 SelectedLanguageId = NewLanguageId;
666
667 /* Load the font */
669
670 /* Redraw the list */
671 DrawGenericList(&ListUi,
672 2, 18,
673 xScreen - 3,
674 yScreen - 3);
675
676 /* Redraw language selection page in native language */
678 }
679
680 RefreshPage = FALSE;
681 }
682 }
683
684 return WELCOME_PAGE;
685}
ULONG GetDefaultLanguageIndex(VOID)
Definition: settings.c:1119
PGENERIC_LIST CreateLanguageList(IN HINF InfFile, OUT PWSTR DefaultLanguage)
Definition: settings.c:1180
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)
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:127
WORD LANGID
Definition: typedefs.h:81
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:460
@ 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 1489 of file usetup.c.

1490{
1491 GENERIC_LIST_UI ListUi;
1493
1495 DrawGenericList(&ListUi,
1496 2, 18,
1497 xScreen - 3,
1498 yScreen - 3);
1499
1500 return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
1501}

Referenced by RunUSetup().

◆ LicensePage()

static PAGE_NUMBER LicensePage ( PINPUT_RECORD  Ir)
static

Definition at line 849 of file usetup.c.

850{
852
853 while (TRUE)
854 {
856
857 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
858 {
859 return WELCOME_PAGE;
860 }
861 }
862
863 return LICENSE_PAGE;
864}
@ LICENSE_PAGE
Definition: usetup.h:81

Referenced by RunUSetup().

◆ NtProcessStartup()

VOID NTAPI NtProcessStartup ( PPEB  Peb)

Definition at line 4405 of file usetup.c.

4406{
4409
4411
4413
4415
4416 Status = RunUSetup();
4417
4418 if (NT_SUCCESS(Status))
4419 {
4420 /*
4421 * Avoid a bugcheck if RunUSetup() finishes too quickly by implementing
4422 * a protective waiting.
4423 * This wait is needed because, since we are started as SMSS.EXE,
4424 * the NT kernel explicitly waits 5 seconds for the initial process
4425 * SMSS.EXE to initialize (as a protective measure), and otherwise
4426 * bugchecks with the code SESSION5_INITIALIZATION_FAILED.
4427 */
4428 Time.QuadPart += 50000000;
4430 }
4431 else
4432 {
4433 /* The installer failed to start: raise a hard error (crash the system/BSOD) */
4435 0, 0, NULL, 0, NULL);
4436 }
4437
4439}
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:483
#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:4191

◆ PopupError()

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

Definition at line 260 of file usetup.c.

264{
265 SHORT yTop;
266 SHORT xLeft;
267 COORD coPos;
268 DWORD Written;
270 ULONG MaxLength;
271 ULONG Lines;
272 PCHAR p;
273 PCCH pnext;
274 BOOLEAN LastLine;
275 SHORT Width;
277
278 /* Count text lines and longest line */
279 MaxLength = 0;
280 Lines = 0;
281 pnext = Text;
282
283 while (TRUE)
284 {
285 p = strchr(pnext, '\n');
286
287 if (p == NULL)
288 {
289 Length = strlen(pnext);
290 LastLine = TRUE;
291 }
292 else
293 {
294 Length = (ULONG)(p - pnext);
295 LastLine = FALSE;
296 }
297
298 Lines++;
299
300 if (Length > MaxLength)
301 MaxLength = Length;
302
303 if (LastLine)
304 break;
305
306 pnext = p + 1;
307 }
308
309 /* Check length of status line */
310 if (Status != NULL)
311 {
313
314 if (Length > MaxLength)
315 MaxLength = Length;
316 }
317
318 Width = MaxLength + 4;
319 Height = Lines + 2;
320
321 if (Status != NULL)
322 Height += 2;
323
324 yTop = (yScreen - Height) / 2;
325 xLeft = (xScreen - Width) / 2;
326
327
328 /* Set screen attributes */
329 coPos.X = xLeft;
330 for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++)
331 {
334 Width,
335 coPos,
336 &Written);
337 }
338
339 DrawBox(xLeft, yTop, Width, Height);
340
341 /* Print message text */
342 coPos.Y = yTop + 1;
343 pnext = Text;
344 while (TRUE)
345 {
346 p = strchr(pnext, '\n');
347
348 if (p == NULL)
349 {
350 Length = strlen(pnext);
351 LastLine = TRUE;
352 }
353 else
354 {
355 Length = (ULONG)(p - pnext);
356 LastLine = FALSE;
357 }
358
359 if (Length != 0)
360 {
361 coPos.X = xLeft + 2;
363 pnext,
364 Length,
365 coPos,
366 &Written);
367 }
368
369 if (LastLine)
370 break;
371
372 coPos.Y++;
373 pnext = p + 1;
374 }
375
376 /* Print separator line and status text */
377 if (Status != NULL)
378 {
379 coPos.Y = yTop + Height - 3;
380 coPos.X = xLeft;
383 1,
384 coPos,
385 &Written);
386
387 coPos.X = xLeft + 1;
389 CharHorizontalLine, // '-',
390 Width - 2,
391 coPos,
392 &Written);
393
394 coPos.X = xLeft + Width - 1;
397 1,
398 coPos,
399 &Written);
400
401 coPos.Y++;
402 coPos.X = xLeft + 2;
404 Status,
405 min(strlen(Status), (SIZE_T)Width - 4),
406 coPos,
407 &Written);
408 }
409
410 if (WaitEvent == POPUP_WAIT_NONE)
411 return;
412
413 while (TRUE)
414 {
416
417 if (WaitEvent == POPUP_WAIT_ANY_KEY ||
418 Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
419 {
420 return;
421 }
422 }
423}
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
#define min(a, b)
Definition: monoChain.cc:55
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:170

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

◆ PrepareCopyPage()

static PAGE_NUMBER PrepareCopyPage ( PINPUT_RECORD  Ir)
static

Definition at line 3264 of file usetup.c.

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

Referenced by RunUSetup().

◆ PrintString()

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

Definition at line 151 of file usetup.c.

152{
153 CHAR buffer[512];
154 va_list ap;
157
158 va_start(ap, fmt);
160 va_end(ap);
161
166}
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 3974 of file usetup.c.

3977{
3979 ULONG StartTime, BarWidth, TimerDiv;
3980 LONG TimeElapsed;
3981 LONG TimerValue, OldTimerValue;
3983 PPROGRESSBAR ProgressBar;
3984 BOOLEAN RefreshProgress = TRUE;
3985
3986 /* Bail out if the timeout is already zero */
3987 if (TimeOut <= 0)
3988 return;
3989
3990 /* Create the timeout progress bar and set it up */
3991 ProgressBar = CreateProgressBarEx(13,
3992 26,
3993 xScreen - 13,
3994 yScreen - 20,
3995 10,
3996 24,
3997 TRUE,
3999 0,
4000 NULL,
4003
4004 BarWidth = max(1, ProgressBar->Width);
4005 TimerValue = TimeOut * BarWidth;
4006 ProgressSetStepCount(ProgressBar, TimerValue);
4007
4009 CONSOLE_Flush();
4010
4011 TimerDiv = 1000 / BarWidth;
4012 TimerDiv = max(1, TimerDiv);
4013 OldTimerValue = TimerValue;
4014 while (TRUE)
4015 {
4016 /* Decrease the timer */
4017
4018 /*
4019 * Compute how much time the previous operations took.
4020 * This allows us in particular to take account for any time
4021 * elapsed if something slowed down.
4022 */
4023 TimeElapsed = NtGetTickCount() - StartTime;
4024 if (TimeElapsed >= TimerDiv)
4025 {
4026 /* Increase StartTime by steps of 1 / ProgressBar->Width seconds */
4027 TimeElapsed /= TimerDiv;
4028 StartTime += (TimerDiv * TimeElapsed);
4029
4030 if (TimeElapsed <= TimerValue)
4031 TimerValue -= TimeElapsed;
4032 else
4033 TimerValue = 0;
4034
4035 RefreshProgress = TRUE;
4036 }
4037
4038 if (RefreshProgress)
4039 {
4040 ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
4041 RefreshProgress = FALSE;
4042 }
4043
4044 /* Stop when the timer reaches zero */
4045 if (TimerValue <= 0)
4046 break;
4047
4048 /* Check for user key presses */
4049
4050 /*
4051 * If the timer is used, use a passive wait of maximum 1 second
4052 * while monitoring for incoming console input events, so that
4053 * we are still able to display the timing count.
4054 */
4055
4056 /* Wait a maximum of 1 second for input events */
4057 TimeElapsed = NtGetTickCount() - StartTime;
4058 if (TimeElapsed < TimerDiv)
4059 {
4060 /* Convert the time to NT format */
4061 Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
4063 }
4064 else
4065 {
4067 }
4068
4069 /* Check whether the input event has been signaled, or a timeout happened */
4070 if (Status == STATUS_TIMEOUT)
4071 {
4072 continue;
4073 }
4074 if (Status != STATUS_WAIT_0)
4075 {
4076 /* An error happened, bail out */
4077 DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n", Status);
4078 break;
4079 }
4080
4081 /* Check for an ENTER key press */
4082 while (CONSOLE_ConInKeyPeek(Ir))
4083 {
4084 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
4085 {
4086 /* Found it, stop waiting */
4087 goto Exit;
4088 }
4089 }
4090 }
4091
4092Exit:
4093 /* Destroy the progress bar and quit */
4094 DestroyProgressBar(ProgressBar);
4095}
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:3927

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

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

Referenced by ProgressCountdown().

◆ QuitPage()

static PAGE_NUMBER QuitPage ( PINPUT_RECORD  Ir)
static

Definition at line 4111 of file usetup.c.

4112{
4114
4115 /* Destroy the NTOS installations list */
4116 if (NtOsInstallsList != NULL)
4117 {
4120 }
4121
4122 /* Destroy the partition list */
4123 if (PartitionList != NULL)
4124 {
4127 }
4128
4129 /* Reset the formatter machine state */
4132
4133 /* Destroy the filesystem list */
4135
4137
4138 /* Wait for maximum 15 seconds or an ENTER key before quitting */
4139 ProgressCountdown(Ir, 15);
4140 return FLUSH_PAGE;
4141}
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
VOID DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:1931
#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:3974
static FORMATMACHINESTATE FormatState
Definition: usetup.c:87
static PGENERIC_LIST NtOsInstallsList
Definition: usetup.c:92

Referenced by RunUSetup().

◆ RegistryPage()

static PAGE_NUMBER RegistryPage ( PINPUT_RECORD  Ir)
static

Definition at line 3561 of file usetup.c.

3562{
3563 ULONG Error;
3564
3566
3573 &s_SubstSettings);
3574 if (Error != ERROR_SUCCESS)
3575 {
3577 return QUIT_PAGE;
3578 }
3579 else
3580 {
3583 }
3584}
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:917
#define STRING_DONE
Definition: mui.h:163
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: usetup.c:3518

Referenced by RunUSetup().

◆ RegistryStatus()

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

Definition at line 3518 of file usetup.c.

3519{
3520 /* WARNING: Please keep this lookup table in sync with the resources! */
3521 static const UINT StringIDs[] =
3522 {
3523 STRING_DONE, /* Success */
3524 STRING_REGHIVEUPDATE, /* RegHiveUpdate */
3525 STRING_IMPORTFILE, /* ImportRegHive */
3526 STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
3527 STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
3528 STRING_ADDKBLAYOUTS, /* KeybLayouts */
3529 STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
3530 STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
3531 };
3532
3533 va_list args;
3534
3535 if (RegStatus < ARRAYSIZE(StringIDs))
3536 {
3537 va_start(args, RegStatus);
3538 CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args);
3539 va_end(args);
3540 }
3541 else
3542 {
3543 CONSOLE_SetStatusText("Unknown status %d", RegStatus);
3544 }
3545}
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 880 of file usetup.c.

881{
883
884 while (TRUE)
885 {
887
888 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
889 {
890 return REBOOT_PAGE;
891 }
892 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
893 {
895 return INSTALL_INTRO_PAGE;
896 }
897 else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
898 {
899 return RECOVERY_PAGE;
900 }
901 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
902 {
903 return WELCOME_PAGE;
904 }
905 }
906
907 return REPAIR_INTRO_PAGE;
908}
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 4191 of file usetup.c.

4192{
4194 INPUT_RECORD Ir;
4196 BOOLEAN Old;
4197
4199
4200 /* Tell the Cm this is a setup boot, and it has to behave accordingly */
4202 if (!NT_SUCCESS(Status))
4203 DPRINT1("NtInitializeRegistry() failed (Status 0x%08lx)\n", Status);
4204
4205 /* Initialize the user-mode PnP manager */
4207 if (!NT_SUCCESS(Status))
4208 {
4209 // PrintString(??);
4210 DPRINT1("The user-mode PnP manager could not initialize (Status 0x%08lx), expect unavailable devices!\n", Status);
4211 }
4212
4213 if (!CONSOLE_Init())
4214 {
4218
4219 /* We failed to initialize the video, just quit the installer */
4221 }
4222
4223 /* Initialize Setup, phase 0 */
4226
4227 /* Hide the cursor and clear the screen and keyboard buffer */
4230 CONSOLE_Flush();
4231
4232 /* Global Initialization page */
4233 Page = SetupStartPage(&Ir);
4234
4235 while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE)
4236 {
4238 CONSOLE_Flush();
4239
4240 // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup ");
4241
4242 switch (Page)
4243 {
4244 /* Language page */
4245 case LANGUAGE_PAGE:
4246 Page = LanguagePage(&Ir);
4247 break;
4248
4249 /* Welcome page */
4250 case WELCOME_PAGE:
4251 Page = WelcomePage(&Ir);
4252 break;
4253
4254 /* License page */
4255 case LICENSE_PAGE:
4256 Page = LicensePage(&Ir);
4257 break;
4258
4259 /* Install pages */
4260 case INSTALL_INTRO_PAGE:
4261 Page = InstallIntroPage(&Ir);
4262 break;
4263
4264#if 0
4265 case SCSI_CONTROLLER_PAGE:
4266 Page = ScsiControllerPage(&Ir);
4267 break;
4268
4269 case OEM_DRIVER_PAGE:
4270 Page = OemDriverPage(&Ir);
4271 break;
4272#endif
4273
4275 Page = DeviceSettingsPage(&Ir);
4276 break;
4277
4280 break;
4281
4284 break;
4285
4288 break;
4289
4291 Page = LayoutSettingsPage(&Ir);
4292 break;
4293
4294 /* Partitioning pages */
4297 break;
4298
4301 break;
4302
4305 break;
4306
4309 break;
4310
4311 /* Filesystem partition operations pages */
4314 break;
4315
4318 break;
4319
4322 break;
4323
4324 /* Bootloader selection page */
4327 break;
4328
4329 /* Installation pages */
4332 break;
4333
4334 case PREPARE_COPY_PAGE:
4335 Page = PrepareCopyPage(&Ir);
4336 break;
4337
4338 case FILE_COPY_PAGE:
4339 Page = FileCopyPage(&Ir);
4340 break;
4341
4342 case REGISTRY_PAGE:
4343 Page = RegistryPage(&Ir);
4344 break;
4345
4346 /* Bootloader installation page */
4348 // case BOOTLOADER_REMOVABLE_DISK_PAGE:
4350 break;
4351
4352 /* Repair pages */
4353 case REPAIR_INTRO_PAGE:
4354 Page = RepairIntroPage(&Ir);
4355 break;
4356
4358 Page = UpgradeRepairPage(&Ir);
4359 break;
4360
4361 case SUCCESS_PAGE:
4362 Page = SuccessPage(&Ir);
4363 break;
4364
4365 case FLUSH_PAGE:
4366 Page = FlushPage(&Ir);
4367 break;
4368
4369 case QUIT_PAGE:
4370 Page = QuitPage(&Ir);
4371 break;
4372
4373 /* Virtual pages */
4374 case SETUP_INIT_PAGE:
4375 case REBOOT_PAGE:
4376 case RECOVERY_PAGE:
4377 break;
4378
4379 default:
4380 break;
4381 }
4382 }
4383
4384 /* Terminate the user-mode PnP manager */
4386
4387 /* Setup has finished */
4389
4390 if (Page == RECOVERY_PAGE)
4392
4393 FreeConsole();
4394
4395 /* Reboot */
4399
4400 return STATUS_SUCCESS;
4401}
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:867
ERROR_NUMBER InitializeSetup(IN OUT PUSETUP_DATA pSetupData, IN ULONG InitPhase)
Definition: setuplib.c:784
#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:1214
static PAGE_NUMBER FlushPage(PINPUT_RECORD Ir)
Definition: usetup.c:4180
static PAGE_NUMBER DeletePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2200
static PAGE_NUMBER LicensePage(PINPUT_RECORD Ir)
Definition: usetup.c:849
static VOID __cdecl USetupErrorRoutine(IN PUSETUP_DATA pSetupData,...)
Definition: usetup.c:3231
static PAGE_NUMBER DisplaySettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1437
static PAGE_NUMBER ComputerSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1411
static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3444
static PAGE_NUMBER SelectFileSystemPage(PINPUT_RECORD Ir)
Definition: usetup.c:2282
static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1463
static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir)
Definition: usetup.c:547
static PAGE_NUMBER FormatPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2723
static PAGE_NUMBER BootLoaderSelectPage(PINPUT_RECORD Ir)
Definition: usetup.c:3598
static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3561
static PAGE_NUMBER LayoutSettingsPage(PINPUT_RECORD Ir)
Definition: usetup.c:1489
static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:1078
static PAGE_NUMBER SuccessPage(PINPUT_RECORD Ir)
Definition: usetup.c:4157
static PAGE_NUMBER BootLoaderInstallPage(PINPUT_RECORD Ir)
Definition: usetup.c:3864
static PAGE_NUMBER CheckFileSystemPage(PINPUT_RECORD Ir)
Definition: usetup.c:2880
static PAGE_NUMBER SelectPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:1543
static PAGE_NUMBER WelcomePage(PINPUT_RECORD Ir)
Definition: usetup.c:805
static PAGE_NUMBER ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2159
static PAGE_NUMBER QuitPage(PINPUT_RECORD Ir)
Definition: usetup.c:4111
static VOID PrintString(IN PCSTR fmt,...)
Definition: usetup.c:151
static PAGE_NUMBER CreatePartitionPage(PINPUT_RECORD Ir)
Definition: usetup.c:2036
static PAGE_NUMBER SetupStartPage(PINPUT_RECORD Ir)
Definition: usetup.c:712
static PAGE_NUMBER PrepareCopyPage(PINPUT_RECORD Ir)
Definition: usetup.c:3264
static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir)
Definition: usetup.c:880
static PAGE_NUMBER UpgradeRepairPage(PINPUT_RECORD Ir)
Definition: usetup.c:923
static PAGE_NUMBER InstallDirectoryPage(PINPUT_RECORD Ir)
Definition: usetup.c:3027
@ 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 {
2395 0LL, // SystemPartition->SectorCount.QuadPart,
2396 TRUE);
2398 }
2399
2400 /* Set it as such */
2402 {
2403 DPRINT1("SetActivePartition(0x%p) failed?!\n", SystemPartition);
2404 ASSERT(FALSE);
2405 }
2406
2407 /* Commit all partition changes to all the disks */
2409 {
2410 DPRINT("WritePartitionsToDisk() failed\n");
2412 return QUIT_PAGE;
2413 }
2414
2415 /*
2416 * In all cases, whether or not we are going to perform a formatting,
2417 * we must perform a filesystem check of both the system and the
2418 * installation partitions.
2419 */
2423
2424 /*
2425 * In case we just repair an existing installation, or make
2426 * an unattended setup without formatting, just go to the
2427 * filesystem check step.
2428 */
2429 if (RepairUpdateFlag)
2431
2434 }
2435
2436 // ASSERT(SystemPartition->IsPartitioned);
2437
2438 /* Reset the filesystem list for each partition that is to be formatted */
2440
2441 PreviousFormatState = FormatState;
2442 switch (FormatState)
2443 {
2444 case Start:
2445 {
2446 /*
2447 * We start by formatting the system partition in case it is new
2448 * (it didn't exist before) and is not the same as the installation
2449 * partition. Otherwise we just require a filesystem check on it,
2450 * and start by formatting the installation partition instead.
2451 */
2452
2454
2457 {
2460
2461 // TODO: Should we let the user using a custom file-system,
2462 // or should we always use FAT(32) for it?
2463 // For "compatibility", FAT(32) would be best indeed.
2464
2466 DPRINT1("FormatState: Start --> FormatSystemPartition\n");
2467 }
2468 else
2469 {
2472
2474 {
2475 /* The system partition is separate, so it had better be formatted! */
2478
2479 /* Require a filesystem check on the system partition too */
2481 }
2482
2484 DPRINT1("FormatState: Start --> FormatInstallPartition\n");
2485 }
2486 break;
2487 }
2488
2490 {
2493
2495 DPRINT1("FormatState: FormatSystemPartition --> FormatInstallPartition\n");
2496 break;
2497 }
2498
2501 {
2503 NULL,
2504 &TempPartition))
2505 {
2508
2510 DPRINT1("FormatState: FormatInstallPartition --> FormatOtherPartition\n");
2511 else
2512 DPRINT1("FormatState: FormatOtherPartition --> FormatOtherPartition\n");
2513 }
2514 else
2515 {
2517
2519 DPRINT1("FormatState: FormatInstallPartition --> FormatDone\n");
2520 else
2521 DPRINT1("FormatState: FormatOtherPartition --> FormatDone\n");
2522
2524 }
2525 break;
2526 }
2527
2528 case FormatDone:
2529 {
2530 DPRINT1("FormatState: FormatDone\n");
2532 }
2533
2534 default:
2535 {
2536 DPRINT1("FormatState: Invalid value %ld\n", FormatState);
2537 ASSERT(FALSE);
2538 return QUIT_PAGE;
2539 }
2540 }
2541
2542 PartEntry = TempPartition;
2543 DiskEntry = TempPartition->DiskEntry;
2544
2545 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
2546
2548
2549 if (PartEntry->AutoCreate)
2550 {
2551 PartEntry->AutoCreate = FALSE;
2552
2554 }
2555 else if (PartEntry->New)
2556 {
2557 switch (FormatState)
2558 {
2561 break;
2562
2565 break;
2566
2569 break;
2570
2571 default:
2572 ASSERT(FALSE);
2573 break;
2574 }
2575 }
2576 else
2577 {
2579 }
2580
2581 PartitionDescription(PartEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2582 CONSOLE_SetTextXY(6, 10, LineBuffer);
2583
2584 DiskDescription(DiskEntry, LineBuffer, ARRAYSIZE(LineBuffer));
2586 LineBuffer);
2587
2588 /* Show "This Partition will be formatted next" only if it is unformatted */
2589 if (PartEntry->New || PartEntry->FormatState == Unformatted)
2591
2593
2595 {
2597
2598 switch (USetupData.FsType)
2599 {
2600 /* 1 is for BtrFS */
2601 case 1:
2602 DefaultFs = L"BTRFS";
2603 break;
2604
2605 /* If we don't understand input, default to FAT */
2606 default:
2607 DefaultFs = L"FAT";
2608 break;
2609 }
2610 }
2611 else
2612 {
2613 /* By default select the "FAT" file system */
2614 DefaultFs = L"FAT";
2615 }
2616
2617 /* Create the file system list */
2618 // TODO: Display only the FSes compatible with the selected partition!
2620 PartEntry->New ||
2621 PartEntry->FormatState == Unformatted,
2622 DefaultFs);
2623 if (FileSystemList == NULL)
2624 {
2625 /* FIXME: show an error dialog */
2626 return QUIT_PAGE;
2627 }
2628
2630 {
2632 return FORMAT_PARTITION_PAGE;
2633 }
2634
2636
2637 while (TRUE)
2638 {
2639 CONSOLE_ConInKey(Ir);
2640
2641 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2642 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
2643 {
2644 if (ConfirmQuit(Ir))
2645 {
2646 /* Reset the filesystem list */
2648 return QUIT_PAGE;
2649 }
2650
2651 break;
2652 }
2653 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
2654 {
2655 /* Reset the formatter machine state */
2658
2659 /* Reset the filesystem list */
2661
2662 return SELECT_PARTITION_PAGE;
2663 }
2664 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2665 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
2666 {
2668 }
2669 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
2670 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
2671 {
2673 }
2674 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
2675 {
2677 {
2679
2680 /*
2681 * Skip formatting this partition. We will also ignore
2682 * filesystem checks on it, unless it is either the system
2683 * or the installation partition.
2684 */
2687 {
2688 PartEntry->NeedsCheck = FALSE;
2689 }
2690
2692 }
2693 else
2694 {
2695 /* Format this partition */
2696 return FORMAT_PARTITION_PAGE;
2697 }
2698 }
2699 }
2700
2701 FormatState = PreviousFormatState;
2702
2704}
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
@ FixedMedia
Definition: ntdddisk.h:388
BOOLEAN WritePartitionsToDisk(IN PPARTLIST List)
Definition: partlist.c:3801
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
Definition: partlist.c:3593
BOOLEAN GetNextUnformattedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:3992
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
Definition: partlist.c:3298
BOOLEAN AutoCreate
Definition: partlist.h:74
BOOLEAN New
Definition: partlist.h:71
FORMATSTATE FormatState
Definition: partlist.h:61
PPARTENTRY SystemPartition
Definition: partlist.h:163
LONG FsType
Definition: setuplib.h:116
LONG FormatPartition
Definition: setuplib.h:114
#define LL
Definition: tui.h:150
#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
@ CHANGE_SYSTEM_PARTITION
Definition: usetup.h:98

Referenced by RunUSetup().

◆ SelectPartitionPage()

static PAGE_NUMBER SelectPartitionPage ( PINPUT_RECORD  Ir)
static

Definition at line 1543 of file usetup.c.

1544{
1545 PARTLIST_UI ListUi;
1546 ULONG Error;
1547
1548 if (PartitionList == NULL)
1549 {
1551 if (PartitionList == NULL)
1552 {
1554 return QUIT_PAGE;
1555 }
1557 {
1559 return QUIT_PAGE;
1560 }
1561
1562 /* Reset the formatter machine state */
1565 }
1566
1567 if (RepairUpdateFlag)
1568 {
1570
1571 /* Determine the selected installation disk & partition */
1575 if (!InstallPartition)
1576 {
1577 DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
1578 ASSERT(FALSE);
1579 }
1581
1583 }
1584
1586
1589 2, 21,
1590 xScreen - 3,
1591 yScreen - 3);
1592 DrawPartitionList(&ListUi);
1593
1595 {
1596 /* Determine the selected installation disk & partition */
1600 if (!InstallPartition)
1601 {
1603
1605 {
1608
1612 TRUE);
1613
1614// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
1616 {
1619 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1620 }
1621
1624 }
1625 }
1626 else
1627 {
1629
1630 DrawPartitionList(&ListUi); // FIXME: Doesn't make much sense...
1631
1632// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
1634 {
1637 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1638 }
1639
1641 }
1642 }
1643
1644 while (TRUE)
1645 {
1646 ULONG uID;
1647
1649
1650 /* Update status text */
1651 if (CurrentPartition == NULL)
1652 {
1653 // FIXME: If we get a NULL current partition, this means that
1654 // the current disk is of unrecognized type. So we should display
1655 // instead a status string to initialize the disk with one of
1656 // the recognized partitioning schemes (MBR, later: GPT, etc.)
1657 // For the time being we don't have that, so use instead another
1658 // known string.
1660 }
1661 else
1662 {
1664 {
1668 {
1670 }
1671 }
1672 else
1673 {
1677 }
1678 }
1680
1681 CONSOLE_ConInKey(Ir);
1682
1683 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1684 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1685 {
1686 if (ConfirmQuit(Ir))
1687 {
1690 return QUIT_PAGE;
1691 }
1692
1693 break;
1694 }
1695 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1696 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
1697 {
1698 ScrollDownPartitionList(&ListUi);
1699 }
1700 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1701 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
1702 {
1703 ScrollUpPartitionList(&ListUi);
1704 }
1705 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1706 {
1708
1710 continue; // return SELECT_PARTITION_PAGE;
1711
1712 /*
1713 * Check whether the user wants to install ReactOS on a disk that
1714 * is not recognized by the computer's firmware and if so, display
1715 * a warning since such disks may not be bootable.
1716 */
1717 if (CurrentPartition->DiskEntry->MediaType == FixedMedia &&
1718 !CurrentPartition->DiskEntry->BiosFound)
1719 {
1720 PopupError("The disk you have selected for installing ReactOS\n"
1721 "is not visible by the firmware of your computer,\n"
1722 "and so may not be bootable.\n"
1723 "Press ENTER to continue nonetheless.",
1725 Ir, POPUP_WAIT_ENTER);
1726 // return SELECT_PARTITION_PAGE;
1727 }
1728
1730 {
1732 if (Error != NOT_AN_ERROR)
1733 {
1735 return SELECT_PARTITION_PAGE;
1736 }
1737
1740 0ULL,
1741 TRUE);
1742 }
1743
1745 {
1748 return SELECT_PARTITION_PAGE; /* let the user select another partition */
1749 }
1750
1753 }
1754 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
1755 {
1757
1759 if (Error != NOT_AN_ERROR)
1760 {
1762 return SELECT_PARTITION_PAGE;
1763 }
1764
1766 return CREATE_PARTITION_PAGE;
1767 }
1768 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'E') /* E */
1769 {
1771
1773 {
1775 if (Error != NOT_AN_ERROR)
1776 {
1778 return SELECT_PARTITION_PAGE;
1779 }
1780
1782 return CREATE_PARTITION_PAGE;
1783 }
1784 }
1785 else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
1786 {
1787 UNICODE_STRING CurrentPartitionU;
1788 WCHAR PathBuffer[MAX_PATH];
1789
1791
1792 /* Ignore deletion in case this is not a partitioned entry */
1794 {
1795 continue;
1796 }
1797
1798// TODO: Do something similar before trying to format the partition?
1799 if (!CurrentPartition->New &&
1802 {
1804
1805 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
1806 L"\\Device\\Harddisk%lu\\Partition%lu\\",
1807 CurrentPartition->DiskEntry->DiskNumber,
1809 RtlInitUnicodeString(&CurrentPartitionU, PathBuffer);
1810
1811 /*
1812 * Check whether the user attempts to delete the partition on which
1813 * the installation source is present. If so, fail with an error.
1814 */
1815 // &USetupData.SourceRootPath
1816 if (RtlPrefixUnicodeString(&CurrentPartitionU, &USetupData.SourcePath, TRUE))
1817 {
1819 return SELECT_PARTITION_PAGE;
1820 }
1821 }
1822
1825 {
1827 }
1828
1829 return DELETE_PARTITION_PAGE;
1830 }
1831 }
1832
1833 return SELECT_PARTITION_PAGE;
1834}
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
#define ULL(a, b)
Definition: format_msg.c:27
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:2831
ERROR_NUMBER PartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2786
PPARTENTRY SelectPartition(IN PPARTLIST List, IN ULONG DiskNumber, IN ULONG PartitionNumber)
Definition: partlist.c:2183
PPARTLIST CreatePartitionList(VOID)
Definition: partlist.c:1847
BOOLEAN IsPartitionActive(IN PPARTENTRY PartEntry)
Definition: partlist.c:1768
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:165
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 BOOL IsDiskSizeValid(PPARTENTRY PartEntry)
Definition: usetup.c:1505

Referenced by RunUSetup().

◆ SetupStartPage()

static PAGE_NUMBER SetupStartPage ( PINPUT_RECORD  Ir)
static

Definition at line 712 of file usetup.c.

713{
714 ULONG Error;
715 PGENERIC_LIST_ENTRY ListEntry;
717
719
720 /* Initialize Setup, phase 1 */
722 if (Error != ERROR_SUCCESS)
723 {
725 return QUIT_PAGE;
726 }
727
728 /* Initialize the user-mode PnP manager */
730 DPRINT1("The user-mode PnP manager could not initialize, expect unavailable devices!\n");
731
732 /* Wait for any immediate pending installations to finish */
734 DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
735
737
739 {
740 // TODO: Read options from inf
741 /* Load the hardware, language and keyboard layout lists */
742
746
748
749 /* new part */
753
755
756 /* first we hack LanguageList */
757 for (ListEntry = GetFirstListEntry(USetupData.LanguageList); ListEntry;
758 ListEntry = GetNextListEntry(ListEntry))
759 {
760 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
762 {
763 DPRINT("found %S in LanguageList\n", LocaleId);
765 break;
766 }
767 }
768
769 /* now LayoutList */
770 for (ListEntry = GetFirstListEntry(USetupData.LayoutList); ListEntry;
771 ListEntry = GetNextListEntry(ListEntry))
772 {
773 LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
775 {
776 DPRINT("found %S in LayoutList\n", LocaleId);
778 break;
779 }
780 }
781
783
784 return INSTALL_INTRO_PAGE;
785 }
786
787 return LANGUAGE_PAGE;
788}
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:126
_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 3290 of file usetup.c.

3292{
3294
3295 /* Get the memory information from the system */
3297 &PerfInfo,
3298 sizeof(PerfInfo),
3299 NULL);
3300
3301 /* Check if this is initial setup */
3302 if (First)
3303 {
3304 /* Set maximum limits to be total RAM pages */
3305 ProgressSetStepCount(CopyContext->MemoryBars[0], PerfInfo.CommitLimit);
3306 ProgressSetStepCount(CopyContext->MemoryBars[1], PerfInfo.CommitLimit);
3307 ProgressSetStepCount(CopyContext->MemoryBars[2], PerfInfo.CommitLimit);
3308 }
3309
3310 /* Set current values */
3311 ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages + PerfInfo.NonPagedPoolPages);
3312 ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.ResidentSystemCachePage);
3313 ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages);
3314}
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 1842 of file usetup.c.

1850{
1851 INPUT_RECORD Ir;
1852 COORD coPos;
1853 DWORD Written;
1854 CHAR Buffer[128];
1855 INT Length, Pos;
1856 WCHAR ch;
1857 SHORT iLeft;
1858 SHORT iTop;
1859
1860 if (Quit != NULL)
1861 *Quit = FALSE;
1862
1863 if (Cancel != NULL)
1864 *Cancel = FALSE;
1865
1866 DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1);
1867
1868 /* Print message */
1869 coPos.X = Left + 2;
1870 coPos.Y = Top + 2;
1872 iLeft = coPos.X + (USHORT)strlen(Buffer) + 1;
1873 iTop = coPos.Y;
1874
1876 Buffer,
1877 strlen(Buffer),
1878 coPos,
1879 &Written);
1880
1882 coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1;
1883 coPos.Y = iTop;
1885 Buffer,
1886 strlen(Buffer),
1887 coPos,
1888 &Written);
1889
1890 swprintf(InputBuffer, L"%lu", MaxSize);
1892 Pos = Length;
1894 iTop,
1896 InputBuffer);
1897 CONSOLE_SetCursorXY(iLeft + Length, iTop);
1899
1900 while (TRUE)
1901 {
1902 CONSOLE_ConInKey(&Ir);
1903
1904 if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1905 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
1906 {
1907 if (Quit != NULL)
1908 *Quit = TRUE;
1909
1912 break;
1913 }
1914 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
1915 {
1917 break;
1918 }
1919 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
1920 {
1921 if (Cancel != NULL)
1922 *Cancel = TRUE;
1923
1926 break;
1927 }
1928 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1929 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_HOME)) /* HOME */
1930 {
1931 Pos = 0;
1932 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1933 }
1934 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1935 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_END)) /* END */
1936 {
1937 Pos = Length;
1938 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1939 }
1940 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1941 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_LEFT)) /* LEFT */
1942 {
1943 if (Pos > 0)
1944 {
1945 Pos--;
1946 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1947 }
1948 }
1949 else if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) &&
1950 (Ir.Event.KeyEvent.wVirtualKeyCode == VK_RIGHT)) /* RIGHT */
1951 {
1952 if (Pos < Length)
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_DELETE)) /* DEL */
1960 {
1961 if (Pos < Length)
1962 {
1964 &InputBuffer[Pos + 1],
1965 (Length - Pos - 1) * sizeof(WCHAR));
1967
1968 Length--;
1970 iTop,
1972 InputBuffer);
1973 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1974 }
1975 }
1976 else if (Ir.Event.KeyEvent.wVirtualKeyCode == VK_BACK) /* BACKSPACE */
1977 {
1978 if (Pos > 0)
1979 {
1980 if (Pos < Length)
1981 memmove(&InputBuffer[Pos - 1],
1982 &InputBuffer[Pos],
1983 (Length - Pos) * sizeof(WCHAR));
1985
1986 Pos--;
1987 Length--;
1989 iTop,
1991 InputBuffer);
1992 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
1993 }
1994 }
1995 else if (Ir.Event.KeyEvent.uChar.AsciiChar != 0x00)
1996 {
1998 {
2000
2001 if ((ch >= L'0') && (ch <= L'9'))
2002 {
2003 if (Pos < Length)
2004 memmove(&InputBuffer[Pos + 1],
2005 &InputBuffer[Pos],
2006 (Length - Pos) * sizeof(WCHAR));
2008 InputBuffer[Pos] = ch;
2009
2010 Pos++;
2011 Length++;
2013 iTop,
2015 InputBuffer);
2016 CONSOLE_SetCursorXY(iLeft + Pos, iTop);
2017 }
2018 }
2019 }
2020 }
2021}
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