Author: hbelusca Date: Thu May 18 01:05:39 2017 New Revision: 74575
URL: http://svn.reactos.org/svn/reactos?rev=74575&view=rev Log: [USETUP]: Massage the USETUP interface code: - The "intro" page is renamed into the "Welcome" page, because its corresponding resource indeed is the welcome screen; - Because the "setup start" page can only be displayed once, move it out of the while-loop, and use its result as the initial value of the 'Page' variable. - Remove unneeded _PAGE_NUMBER_DEFINED guards; - Add a DPRINT in the RepairUpdateFlag case of RegistryPage() (because we don't implement yet a correct upgrading or repairing of the registry. - Use the previously-introduced 'PreparePartitionForFormatting()' function; set the FormatState of the newly-formatted partition to Formatted. - In InstallIntroPage(), display the page itself only if needed (i.e. after all the validation checks & repair/update or unattended checks are done). Similar modifications are done also in DeviceSettingsPage(), SelectPartitionPage() - Remove the hackish call to CreateFileSystemList() in SelectFileSystemPage(). - Turn both CheckUnattendedSetup() and UpdateKBLayout() into static functions. - Put large "case"-blocks into brackets. - Fix the code of ScsiControllerPage() so that it can be compiled if needed, and add a dummy OemDriverPage().
Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c branches/setup_improvements/base/setup/usetup/usetup.h
Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/us... ============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] Thu May 18 01:05:39 2017 @@ -413,7 +413,7 @@ }
-VOID +static VOID CheckUnattendedSetup(VOID) { WCHAR UnattendInfPath[MAX_PATH]; @@ -587,7 +587,7 @@ }
-VOID +static VOID UpdateKBLayout(VOID) { PGENERIC_LIST_ENTRY ListEntry; @@ -627,7 +627,7 @@ /* * Displays the LanguagePage. * - * Next pages: IntroPage, QuitPage + * Next pages: WelcomePage, QuitPage * * SIDEEFFECTS * Init SelectedLanguageId @@ -650,7 +650,7 @@ if (LanguageList == NULL) { PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE); - return INTRO_PAGE; + return WELCOME_PAGE; } }
@@ -664,7 +664,7 @@ if (GenericListHasSingleEntry(LanguageList)) { LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); - return INTRO_PAGE; + return WELCOME_PAGE; }
InitGenericListUi(&ListUi, LanguageList); @@ -728,7 +728,7 @@ /* Load the font */ SetConsoleCodePage();
- return INTRO_PAGE; + return WELCOME_PAGE; } else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) { @@ -759,7 +759,7 @@ } }
- return INTRO_PAGE; + return WELCOME_PAGE; }
@@ -932,7 +932,7 @@
/* - * Displays the IntroPage. + * Displays the WelcomePage. * * Next pages: * InstallIntroPage (default) @@ -944,9 +944,9 @@ * Number of the next page. */ static PAGE_NUMBER -IntroPage(PINPUT_RECORD Ir) -{ - MUIDisplayPage(START_PAGE); +WelcomePage(PINPUT_RECORD Ir) +{ + MUIDisplayPage(WELCOME_PAGE);
while (TRUE) { @@ -974,7 +974,7 @@ } }
- return INTRO_PAGE; + return WELCOME_PAGE; }
@@ -982,7 +982,7 @@ * Displays the License page. * * Next page: - * IntroPage (default) + * WelcomePage (default) * * RETURNS * Number of the next page. @@ -998,7 +998,7 @@
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { - return INTRO_PAGE; + return WELCOME_PAGE; } }
@@ -1043,7 +1043,7 @@ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */ { - return INTRO_PAGE; + return WELCOME_PAGE; } }
@@ -1065,8 +1065,6 @@ static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir) { - MUIDisplayPage(INSTALL_INTRO_PAGE); - if (RepairUpdateFlag) { //return SELECT_PARTITION_PAGE; @@ -1074,9 +1072,9 @@ }
if (IsUnattendedSetup) - { return SELECT_PARTITION_PAGE; - } + + MUIDisplayPage(INSTALL_INTRO_PAGE);
while (TRUE) { @@ -1105,19 +1103,20 @@ static PAGE_NUMBER ScsiControllerPage(PINPUT_RECORD Ir) { - SetTextXY(6, 8, "Setup detected the following mass storage devices:"); + // MUIDisplayPage(SCSI_CONTROLLER_PAGE); + + CONSOLE_SetTextXY(6, 8, "Setup detected the following mass storage devices:");
/* FIXME: print loaded mass storage driver descriptions */ #if 0 - SetTextXY(8, 10, "TEST device"); + CONSOLE_SetTextXY(8, 10, "TEST device"); #endif
- - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
while (TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1134,6 +1133,38 @@ }
return SCSI_CONTROLLER_PAGE; +} + +static PAGE_NUMBER +OemDriverPage(PINPUT_RECORD Ir) +{ + // MUIDisplayPage(OEM_DRIVER_PAGE); + + CONSOLE_SetTextXY(6, 8, "This is the OEM driver page!"); + + /* FIXME: Implement!! */ + + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); + + while (TRUE) + { + CONSOLE_ConInKey(Ir); + + if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ + { + if (ConfirmQuit(Ir) == TRUE) + return QUIT_PAGE; + + break; + } + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ + { + return DEVICE_SETTINGS_PAGE; + } + } + + return OEM_DRIVER_PAGE; } #endif
@@ -1163,7 +1194,6 @@ DeviceSettingsPage(PINPUT_RECORD Ir) { static ULONG Line = 16; - MUIDisplayPage(DEVICE_SETTINGS_PAGE);
/* Initialize the computer settings list */ if (ComputerList == NULL) @@ -1210,20 +1240,20 @@ } }
+ if (RepairUpdateFlag) + return SELECT_PARTITION_PAGE; + + // if (IsUnattendedSetup) + // return SELECT_PARTITION_PAGE; + MUIDisplayPage(DEVICE_SETTINGS_PAGE);
- - CONSOLE_SetTextXY(25, 11, GetListEntryText(GetCurrentListEntry((ComputerList)))); - CONSOLE_SetTextXY(25, 12, GetListEntryText(GetCurrentListEntry((DisplayList)))); - CONSOLE_SetTextXY(25, 13, GetListEntryText(GetCurrentListEntry((KeyboardList)))); - CONSOLE_SetTextXY(25, 14, GetListEntryText(GetCurrentListEntry((LayoutList)))); + CONSOLE_SetTextXY(25, 11, GetListEntryText(GetCurrentListEntry(ComputerList))); + CONSOLE_SetTextXY(25, 12, GetListEntryText(GetCurrentListEntry(DisplayList))); + CONSOLE_SetTextXY(25, 13, GetListEntryText(GetCurrentListEntry(KeyboardList))); + CONSOLE_SetTextXY(25, 14, GetListEntryText(GetCurrentListEntry(LayoutList)));
CONSOLE_InvertTextXY(24, Line, 48, 1); - - if (RepairUpdateFlag) - { - return SELECT_PARTITION_PAGE; - }
while (TRUE) { @@ -1511,8 +1541,6 @@ PARTLIST_UI ListUi; ULONG Error;
- MUIDisplayPage(SELECT_PARTITION_PAGE); - if (PartitionList == NULL) { PartitionList = CreatePartitionList(); @@ -1528,6 +1556,8 @@ return QUIT_PAGE; } } + + MUIDisplayPage(SELECT_PARTITION_PAGE);
InitPartitionListUi(&ListUi, PartitionList, 2, @@ -2564,23 +2594,8 @@ return QUIT_PAGE; }
-#if 0 - /*** HACK! ***/ - if (FileSystemList == NULL) - { - FileSystemList = CreateFileSystemList(6, 26, PartitionList->CurrentPartition->New, L"FAT"); - if (FileSystemList == NULL) - { - /* FIXME: show an error dialog */ - return QUIT_PAGE; - } - - /* FIXME: Add file systems to list */ - } -#endif - /* Find or set the active system partition */ - CheckActiveSystemPartition(PartitionList /*, FileSystemList*/); + CheckActiveSystemPartition(PartitionList); if (PartitionList->SystemPartition == NULL) { /* FIXME: show an error dialog */ @@ -2591,6 +2606,7 @@ switch (PartitionList->FormatState) { case Start: + { if (PartitionList->CurrentPartition != PartitionList->SystemPartition) { PartitionList->TempPartition = PartitionList->SystemPartition; @@ -2608,16 +2624,20 @@ DPRINT1("FormatState: Start --> FormatInstallPartition\n"); } break; + }
case FormatSystemPartition: + { PartitionList->TempPartition = PartitionList->CurrentPartition; PartitionList->TempPartition->NeedsCheck = TRUE;
PartitionList->FormatState = FormatInstallPartition; DPRINT1("FormatState: FormatSystemPartition --> FormatInstallPartition\n"); break; + }
case FormatInstallPartition: + { if (GetNextUnformattedPartition(PartitionList, NULL, &PartitionList->TempPartition)) @@ -2633,8 +2653,10 @@ return CHECK_FILE_SYSTEM_PAGE; } break; + }
case FormatOtherPartition: + { if (GetNextUnformattedPartition(PartitionList, NULL, &PartitionList->TempPartition)) @@ -2650,11 +2672,14 @@ return CHECK_FILE_SYSTEM_PAGE; } break; + }
default: - DPRINT1("FormatState: Invalid value %ld\n", PartitionList->FormatState); + { + DPRINT1("FormatState: Invalid value %ld\n", FormatState); /* FIXME: show an error dialog */ return QUIT_PAGE; + } }
PartEntry = PartitionList->TempPartition; @@ -2784,8 +2809,6 @@ /* FIXME: show an error dialog */ return QUIT_PAGE; } - - /* FIXME: Add file systems to list */ }
DrawFileSystemList(FileSystemList); @@ -2807,7 +2830,6 @@ * which file system to use in unattended installations, in the * txtsetup.sif file. */ - // PartEntry->FileSystem = GetFileSystemByName(FileSystemList, L"FAT"); return FORMAT_PARTITION_PAGE; }
@@ -2845,14 +2867,9 @@ else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */ { if (!FileSystemList->Selected->FileSystem) - { return SELECT_FILE_SYSTEM_PAGE; - } else - { - // PartEntry->FileSystem = FileSystemList->Selected; return FORMAT_PARTITION_PAGE; - } } }
@@ -2907,7 +2924,7 @@ PartEntry = PartitionList->TempPartition; DiskEntry = PartEntry->DiskEntry;
- SelectedFileSystem = FileSystemList->Selected; // PartEntry->FileSystem; // FIXME!!!! + SelectedFileSystem = FileSystemList->Selected;
while (TRUE) { @@ -2928,60 +2945,7 @@ { CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
- if (wcscmp(SelectedFileSystem->FileSystemName, L"FAT") == 0) - { - if (PartEntry->SectorCount.QuadPart < 8192) - { - /* FAT12 CHS partition (disk is smaller than 4.1MB) */ - SetPartitionType(PartEntry, PARTITION_FAT_12); - } - else if (PartEntry->StartSector.QuadPart < 1450560) - { - /* Partition starts below the 8.4GB boundary ==> CHS partition */ - - if (PartEntry->SectorCount.QuadPart < 65536) - { - /* FAT16 CHS partition (partition size < 32MB) */ - SetPartitionType(PartEntry, PARTITION_FAT_16); - } - else if (PartEntry->SectorCount.QuadPart < 1048576) - { - /* FAT16 CHS partition (partition size < 512MB) */ - SetPartitionType(PartEntry, PARTITION_HUGE); - } - else - { - /* FAT32 CHS partition (partition size >= 512MB) */ - SetPartitionType(PartEntry, PARTITION_FAT32); - } - } - else - { - /* Partition starts above the 8.4GB boundary ==> LBA partition */ - - if (PartEntry->SectorCount.QuadPart < 1048576) - { - /* FAT16 LBA partition (partition size < 512MB) */ - SetPartitionType(PartEntry, PARTITION_XINT13); - } - else - { - /* FAT32 LBA partition (partition size >= 512MB) */ - SetPartitionType(PartEntry, PARTITION_FAT32_XINT13); - } - } - } -#if 0 - else if (wcscmp(SelectedFileSystem->FileSystemName, L"EXT2") == 0) - { - SetPartitionType(PartEntry, PARTITION_EXT2); - } - else if (wcscmp(SelectedFileSystem->FileSystemName, L"NTFS") == 0) - { - SetPartitionType(PartEntry, PARTITION_IFS); - } -#endif - else if (!SelectedFileSystem->FileSystem) + if (!PreparePartitionForFormatting(PartEntry, SelectedFileSystem->FileSystem)) { /* FIXME: show an error dialog */ return QUIT_PAGE; @@ -3014,7 +2978,8 @@ } #endif
- if (WritePartitionsToDisk(PartitionList) == FALSE) + /* Commit the partition changes to the disk */ + if (!WritePartitionsToDisk(PartitionList)) { DPRINT("WritePartitionsToDisk() failed\n"); MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER); @@ -3030,6 +2995,7 @@ PathBuffer); DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
+ /* Format the partition */ if (SelectedFileSystem->FileSystem) { Status = FormatPartition(&PartitionRootPath, @@ -3041,6 +3007,8 @@ return QUIT_PAGE; }
+ PartEntry->FormatState = Formatted; + // PartEntry->FileSystem = FileSystem; PartEntry->New = FALSE; }
@@ -3185,7 +3153,7 @@ * Number of the next page. */ static PAGE_NUMBER -InstallDirectoryPage1(PWCHAR InstallDir, +InstallDirectoryPage1(PWSTR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEntry) { @@ -3985,6 +3953,8 @@
if (RepairUpdateFlag) { + // FIXME! + DPRINT1("FIXME: Updating / repairing the registry is NOT implemented yet!\n"); return SUCCESS_PAGE; }
@@ -4641,35 +4611,34 @@ /* Hide the cursor */ CONSOLE_SetCursorType(TRUE, FALSE);
- Page = START_PAGE; + /* Global Initialization page */ + CONSOLE_ClearScreen(); + CONSOLE_Flush(); + Page = SetupStartPage(&Ir); + while (Page != REBOOT_PAGE && Page != RECOVERY_PAGE) { CONSOLE_ClearScreen(); CONSOLE_Flush();
- //CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); - //CONSOLE_Flush(); + // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); + // CONSOLE_Flush();
switch (Page) { - /* Start page */ - case START_PAGE: - Page = SetupStartPage(&Ir); - break; - /* Language page */ case LANGUAGE_PAGE: Page = LanguagePage(&Ir); break;
+ /* Welcome page */ + case WELCOME_PAGE: + Page = WelcomePage(&Ir); + break; + /* License page */ case LICENSE_PAGE: Page = LicensePage(&Ir); - break; - - /* Intro page */ - case INTRO_PAGE: - Page = IntroPage(&Ir); break;
/* Install pages */
Modified: branches/setup_improvements/base/setup/usetup/usetup.h URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/us... ============================================================================== --- branches/setup_improvements/base/setup/usetup/usetup.h [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/usetup.h [iso-8859-1] Thu May 18 01:05:39 2017 @@ -112,17 +112,15 @@
#endif /* __REACTOS__ */
-#ifndef _PAGE_NUMBER_DEFINED -#define _PAGE_NUMBER_DEFINED typedef enum _PAGE_NUMBER { LANGUAGE_PAGE, - INTRO_PAGE, WELCOME_PAGE, LICENSE_PAGE, INSTALL_INTRO_PAGE,
// SCSI_CONTROLLER_PAGE, +// OEM_DRIVER_PAGE,
// REPAIR_INTRO_PAGE, UPGRADE_REPAIR_PAGE, @@ -159,7 +157,6 @@ REBOOT_PAGE, /* Virtual page */ RECOVERY_PAGE, /* Virtual page */ } PAGE_NUMBER, *PPAGE_NUMBER; -#endif
#define POPUP_WAIT_NONE 0 #define POPUP_WAIT_ANY_KEY 1