[USETUP] Massage the USETUP interface code.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 15 May 2017 01:48:19 +0000 (01:48 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 23 Oct 2018 22:35:52 +0000 (00:35 +0200)
- 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).
- 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()
- Turn both CheckUnattendedSetup() and UpdateKBLayout() into static functions.
- Fix the code of ScsiControllerPage() so that it can be compiled if needed, and add a dummy OemDriverPage().

svn path=/branches/setup_improvements/; revision=74575

27 files changed:
base/setup/usetup/lang/bg-BG.h
base/setup/usetup/lang/bn-BD.h
base/setup/usetup/lang/cs-CZ.h
base/setup/usetup/lang/da-DK.h
base/setup/usetup/lang/de-DE.h
base/setup/usetup/lang/el-GR.h
base/setup/usetup/lang/en-US.h
base/setup/usetup/lang/es-ES.h
base/setup/usetup/lang/et-EE.h
base/setup/usetup/lang/fr-FR.h
base/setup/usetup/lang/he-IL.h
base/setup/usetup/lang/it-IT.h
base/setup/usetup/lang/ja-JP.h
base/setup/usetup/lang/lt-LT.h
base/setup/usetup/lang/ms-MY.h
base/setup/usetup/lang/nl-NL.h
base/setup/usetup/lang/pl-PL.h
base/setup/usetup/lang/pt-BR.h
base/setup/usetup/lang/ro-RO.h
base/setup/usetup/lang/ru-RU.h
base/setup/usetup/lang/sk-SK.h
base/setup/usetup/lang/sq-AL.h
base/setup/usetup/lang/sv-SE.h
base/setup/usetup/lang/tr-TR.h
base/setup/usetup/lang/uk-UA.h
base/setup/usetup/usetup.c
base/setup/usetup/usetup.h

index b6366ea..803de8a 100644 (file)
@@ -1629,7 +1629,7 @@ MUI_PAGE bgBGPages[] =
         bgBGLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         bgBGWelcomePageEntries
     },
     {
index 5a4d778..145c0e8 100644 (file)
@@ -1616,7 +1616,7 @@ MUI_PAGE bnBDPages[] =
         bnBDLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         bnBDWelcomePageEntries
     },
     {
index 4359652..10e5176 100644 (file)
@@ -1624,7 +1624,7 @@ MUI_PAGE csCZPages[] =
         csCZLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         csCZWelcomePageEntries
     },
     {
index febfb2b..9e1d724 100644 (file)
@@ -1630,7 +1630,7 @@ MUI_PAGE daDKPages[] =
         daDKLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         daDKWelcomePageEntries
     },
     {
index fda98fb..afc257b 100644 (file)
@@ -1620,7 +1620,7 @@ MUI_PAGE deDEPages[] =
         deDELanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         deDEWelcomePageEntries
     },
     {
index 58e624f..ec8edb6 100644 (file)
@@ -1633,7 +1633,7 @@ MUI_PAGE elGRPages[] =
         elGRLanguagePageEntries
     },
     {
-       START_PAGE,
+       WELCOME_PAGE,
        elGRWelcomePageEntries
     },
     {
index 9f3a633..b8b5665 100644 (file)
@@ -1616,7 +1616,7 @@ MUI_PAGE enUSPages[] =
         enUSLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         enUSWelcomePageEntries
     },
     {
index e52c7a5..5e43233 100644 (file)
@@ -1620,7 +1620,7 @@ MUI_PAGE esESPages[] =
         esESLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         esESWelcomePageEntries
     },
     {
index ee47d0e..e61b71a 100644 (file)
@@ -1614,7 +1614,7 @@ MUI_PAGE etEEPages[] =
         etEELanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         etEEWelcomePageEntries
     },
     {
index 51456c4..8363184 100644 (file)
@@ -1635,7 +1635,7 @@ MUI_PAGE frFRPages[] =
         frFRLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         frFRWelcomePageEntries
     },
     {
index 686ed20..8c3e4ce 100644 (file)
@@ -1617,7 +1617,7 @@ MUI_PAGE heILPages[] =
         heILLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         heILWelcomePageEntries
     },
     {
index 5ac3a4c..c95073e 100644 (file)
@@ -1623,7 +1623,7 @@ MUI_PAGE itITPages[] =
         itITLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         itITWelcomePageEntries
     },
     {
index d30be14..0cbb7c5 100644 (file)
@@ -1618,7 +1618,7 @@ MUI_PAGE jaJPPages[] =
         jaJPLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         jaJPWelcomePageEntries
     },
     {
index 697b19f..86b3bec 100644 (file)
@@ -1626,7 +1626,7 @@ MUI_PAGE ltLTPages[] =
         ltLTLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         ltLTWelcomePageEntries
     },
     {
index 2da4e91..7b76c4f 100644 (file)
@@ -1509,7 +1509,7 @@ MUI_PAGE msMYPages[] =
         msMYLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         msMYWelcomePageEntries
     },
     {
index 9f080ce..cfcc71f 100644 (file)
@@ -1644,7 +1644,7 @@ MUI_PAGE nlNLPages[] =
         nlNLLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         nlNLWelcomePageEntries
     },
     {
index c7c3269..1849b80 100644 (file)
@@ -1627,7 +1627,7 @@ MUI_PAGE plPLPages[] =
         plPLLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         plPLWelcomePageEntries
     },
     {
index 4372dc3..0d9f7b3 100644 (file)
@@ -1648,7 +1648,7 @@ MUI_PAGE ptBRPages[] =
         ptBRLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         ptBRWelcomePageEntries
     },
     {
index 422188d..457ba53 100644 (file)
@@ -1670,7 +1670,7 @@ MUI_PAGE roROPages[] =
         roROLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         roROWelcomePageEntries
     },
     {
index 98f16b0..52e9b81 100644 (file)
@@ -1617,7 +1617,7 @@ MUI_PAGE ruRUPages[] =
         ruRULanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         ruRUWelcomePageEntries
     },
     {
index be99ea5..d44fcb9 100644 (file)
@@ -1628,7 +1628,7 @@ MUI_PAGE skSKPages[] =
         skSKLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         skSKWelcomePageEntries
     },
     {
index bf157a9..13c7c10 100644 (file)
@@ -1621,7 +1621,7 @@ MUI_PAGE sqALPages[] =
         sqALLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         sqALWelcomePageEntries
     },
     {
index 38e766f..15c3f49 100644 (file)
@@ -1624,7 +1624,7 @@ MUI_PAGE svSEPages[] =
         svSELanguagePageEntries
     },
     {
-       START_PAGE,
+       WELCOME_PAGE,
        svSEWelcomePageEntries
     },
     {
index be2ce60..e61abbb 100644 (file)
@@ -1597,7 +1597,7 @@ MUI_PAGE trTRPages[] =
         trTRLanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         trTRWelcomePageEntries
     },
     {
index 7f69307..12f3ce1 100644 (file)
@@ -1624,7 +1624,7 @@ MUI_PAGE ukUAPages[] =
         ukUALanguagePageEntries
     },
     {
-        START_PAGE,
+        WELCOME_PAGE,
         ukUAWelcomePageEntries
     },
     {
index 3c7eb74..eea1687 100644 (file)
@@ -420,7 +420,7 @@ ConfirmQuit(PINPUT_RECORD Ir)
 }
 
 
-VOID
+static VOID
 CheckUnattendedSetup(VOID)
 {
     WCHAR UnattendInfPath[MAX_PATH];
@@ -593,7 +593,7 @@ CheckUnattendedSetup(VOID)
 }
 
 
-VOID
+static VOID
 UpdateKBLayout(VOID)
 {
     PGENERIC_LIST_ENTRY ListEntry;
@@ -633,7 +633,7 @@ UpdateKBLayout(VOID)
 /*
  * Displays the LanguagePage.
  *
- * Next pages: IntroPage, QuitPage
+ * Next pages: WelcomePage, QuitPage
  *
  * SIDEEFFECTS
  *  Init SelectedLanguageId
@@ -656,7 +656,7 @@ LanguagePage(PINPUT_RECORD Ir)
         if (LanguageList == NULL)
         {
            PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
-           return INTRO_PAGE;
+           return WELCOME_PAGE;
         }
     }
 
@@ -670,7 +670,7 @@ LanguagePage(PINPUT_RECORD Ir)
     if (GenericListHasSingleEntry(LanguageList))
     {
         LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
-        return INTRO_PAGE;
+        return WELCOME_PAGE;
     }
 
     InitGenericListUi(&ListUi, LanguageList);
@@ -734,7 +734,7 @@ LanguagePage(PINPUT_RECORD Ir)
             /* Load the font */
             SetConsoleCodePage();
 
-            return INTRO_PAGE;
+            return WELCOME_PAGE;
         }
         else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
         {
@@ -765,7 +765,7 @@ LanguagePage(PINPUT_RECORD Ir)
         }
     }
 
-    return INTRO_PAGE;
+    return WELCOME_PAGE;
 }
 
 
@@ -930,7 +930,7 @@ SetupStartPage(PINPUT_RECORD Ir)
 
 
 /*
- * Displays the IntroPage.
+ * Displays the WelcomePage.
  *
  * Next pages:
  *  InstallIntroPage (default)
@@ -942,9 +942,9 @@ SetupStartPage(PINPUT_RECORD Ir)
  *   Number of the next page.
  */
 static PAGE_NUMBER
-IntroPage(PINPUT_RECORD Ir)
+WelcomePage(PINPUT_RECORD Ir)
 {
-    MUIDisplayPage(START_PAGE);
+    MUIDisplayPage(WELCOME_PAGE);
 
     while (TRUE)
     {
@@ -972,7 +972,7 @@ IntroPage(PINPUT_RECORD Ir)
         }
     }
 
-    return INTRO_PAGE;
+    return WELCOME_PAGE;
 }
 
 
@@ -980,7 +980,7 @@ IntroPage(PINPUT_RECORD Ir)
  * Displays the License page.
  *
  * Next page:
- *  IntroPage (default)
+ *  WelcomePage (default)
  *
  * RETURNS
  *   Number of the next page.
@@ -996,7 +996,7 @@ LicensePage(PINPUT_RECORD Ir)
 
         if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)  /* ENTER */
         {
-            return INTRO_PAGE;
+            return WELCOME_PAGE;
         }
     }
 
@@ -1041,7 +1041,7 @@ RepairIntroPage(PINPUT_RECORD Ir)
         else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
                  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE))  /* ESC */
         {
-            return INTRO_PAGE;
+            return WELCOME_PAGE;
         }
     }
 
@@ -1063,8 +1063,6 @@ RepairIntroPage(PINPUT_RECORD Ir)
 static PAGE_NUMBER
 InstallIntroPage(PINPUT_RECORD Ir)
 {
-    MUIDisplayPage(INSTALL_INTRO_PAGE);
-
     if (RepairUpdateFlag)
     {
         //return SELECT_PARTITION_PAGE;
@@ -1072,9 +1070,9 @@ InstallIntroPage(PINPUT_RECORD Ir)
     }
 
     if (IsUnattendedSetup)
-    {
         return SELECT_PARTITION_PAGE;
-    }
+
+    MUIDisplayPage(INSTALL_INTRO_PAGE);
 
     while (TRUE)
     {
@@ -1103,19 +1101,20 @@ InstallIntroPage(PINPUT_RECORD Ir)
 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 */
@@ -1133,6 +1132,38 @@ ScsiControllerPage(PINPUT_RECORD Ir)
 
     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
 
 
@@ -1161,7 +1192,6 @@ static PAGE_NUMBER
 DeviceSettingsPage(PINPUT_RECORD Ir)
 {
     static ULONG Line = 16;
-    MUIDisplayPage(DEVICE_SETTINGS_PAGE);
 
     /* Initialize the computer settings list */
     if (ComputerList == NULL)
@@ -1208,20 +1238,20 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
         }
     }
 
-    MUIDisplayPage(DEVICE_SETTINGS_PAGE);
+    if (RepairUpdateFlag)
+        return SELECT_PARTITION_PAGE;
 
+    // if (IsUnattendedSetup)
+        // return SELECT_PARTITION_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))));
+    MUIDisplayPage(DEVICE_SETTINGS_PAGE);
 
-    CONSOLE_InvertTextXY(24, Line, 48, 1);
+    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)));
 
-    if (RepairUpdateFlag)
-    {
-        return SELECT_PARTITION_PAGE;
-    }
+    CONSOLE_InvertTextXY(24, Line, 48, 1);
 
     while (TRUE)
     {
@@ -1509,8 +1539,6 @@ SelectPartitionPage(PINPUT_RECORD Ir)
     PARTLIST_UI ListUi;
     ULONG Error;
 
-    MUIDisplayPage(SELECT_PARTITION_PAGE);
-
     if (PartitionList == NULL)
     {
         PartitionList = CreatePartitionList();
@@ -1530,6 +1558,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
         FormatState = Start;
     }
 
+    MUIDisplayPage(SELECT_PARTITION_PAGE);
+
     InitPartitionListUi(&ListUi, PartitionList,
                         2,
                         23,
@@ -3180,9 +3210,8 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
 }
 
 
-static
-VOID
-BuildInstallPaths(PWCHAR InstallDir,
+static VOID
+BuildInstallPaths(PWSTR InstallDir,
                   PDISKENTRY DiskEntry,
                   PPARTENTRY PartEntry)
 {
@@ -4033,6 +4062,8 @@ RegistryPage(PINPUT_RECORD Ir)
 
     if (RepairUpdateFlag)
     {
+        // FIXME!
+        DPRINT1("FIXME: Updating / repairing the registry is NOT implemented yet!\n");
         return SUCCESS_PAGE;
     }
 
@@ -4872,37 +4903,36 @@ RunUSetup(VOID)
     /* 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 */
             case INSTALL_INTRO_PAGE:
                 Page = InstallIntroPage(&Ir);
index 97ac61a..2f548b5 100644 (file)
@@ -102,17 +102,17 @@ extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
 #define SetupGetMultiSzFieldW InfGetMultiSzField
 #define SetupGetStringFieldW InfGetStringField
 
-#ifndef _PAGE_NUMBER_DEFINED
-#define _PAGE_NUMBER_DEFINED
 typedef enum _PAGE_NUMBER
 {
-    START_PAGE,
     LANGUAGE_PAGE,
-    INTRO_PAGE,
+    WELCOME_PAGE,
     LICENSE_PAGE,
     INSTALL_INTRO_PAGE,
 
 //    SCSI_CONTROLLER_PAGE,
+//    OEM_DRIVER_PAGE,
+
+    REPAIR_INTRO_PAGE,
 
     DEVICE_SETTINGS_PAGE,
     COMPUTER_SETTINGS_PAGE,
@@ -140,15 +140,12 @@ typedef enum _PAGE_NUMBER
     BOOT_LOADER_HARDDISK_MBR_PAGE,
     BOOT_LOADER_HARDDISK_VBR_PAGE,
 
-    REPAIR_INTRO_PAGE,
-
     SUCCESS_PAGE,
     QUIT_PAGE,
     FLUSH_PAGE,
-    REBOOT_PAGE,               /* virtual page */
-    RECOVERY_PAGE,             /* virtual page */
+    REBOOT_PAGE,    /* Virtual page */
+    RECOVERY_PAGE,  /* Virtual page */
 } PAGE_NUMBER, *PPAGE_NUMBER;
-#endif
 
 #define POPUP_WAIT_NONE    0
 #define POPUP_WAIT_ANY_KEY 1