- Show the selected boot options as NTLDR does (in light blue under the "For troubleshooting... press F8" message).- The different safe modes are now mutually exclusive, as they must be.
- They can be coupled to the "boot logging", "vga mode" and "debugging" modes, enlarging possibilities (contrary to NTLDR. However you'll remark that these combinations are allowed when set with msconfig...).
- Since the safe modes come by default with boot logging, don't show "Boot Logging" when one of the safe modes is selected, but instead show the corresponding safe mode name.
- Modify the needed functions.
svn path=/trunk/; revision=58008
ULONG SelectedMenuItem;
if (!UiDisplayMenu("Please choose a boot method:", "",
+ FALSE,
CustomBootMenuList,
CustomBootMenuCount,
0, -1,
if (!UiDisplayMenu("Please select the operating system to start:",
"For troubleshooting and advanced startup options for "
"ReactOS, press F8.",
+ TRUE,
OperatingSystemDisplayNames,
OperatingSystemCount,
DefaultOperatingSystem,
#pragma once
VOID DoOptionsMenu(VOID);
+VOID DisplayBootTimeOptions(VOID);
VOID AppendBootTimeOptions(PCHAR BootOptions);
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiShowMessageBoxesInSection(PCSTR SectionName); // Displays all the message boxes in a given section
-VOID UiEscapeString(PCHAR String); // Processes a string and changes all occurances of "\n" to '\n'
+VOID UiEscapeString(PCHAR String); // Processes a string and changes all occurrences of "\n" to '\n'
BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length);
UCHAR UiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value
{
PCSTR MenuHeader;
PCSTR MenuFooter;
+ BOOLEAN ShowBootOptions;
- PCSTR *MenuItemList;
+ PCSTR* MenuItemList;
ULONG MenuItemCount;
LONG MenuTimeRemaining;
ULONG SelectedMenuItem;
typedef BOOLEAN (*UiMenuKeyPressFilterCallback)(ULONG KeyPress);
-BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
+BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
///////////////////////////////////////////////////////////////////////////////////////
//
VOID (*FadeInBackdrop)(VOID);
VOID (*FadeOut)(VOID);
- BOOLEAN (*DisplayMenu)(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
+ BOOLEAN (*DisplayMenu)(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
VOID (*DrawMenu)(PUI_MENU_INFO MenuInfo);
} UIVTBL, *PUIVTBL;
// Menu Functions
//
///////////////////////////////////////////////////////////////////////////////////////
-BOOLEAN GuiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem);
+BOOLEAN GuiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem);
extern const UIVTBL GuiVtbl;
//
///////////////////////////////////////////////////////////////////////////////////////
-BOOLEAN NoUiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
+BOOLEAN NoUiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
VOID NoUiDrawMenu(PUI_MENU_INFO MenuInfo);
VOID NTAPI TuiDrawMenuBox(PUI_MENU_INFO MenuInfo);
VOID NTAPI TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber);
ULONG NTAPI TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter);
-BOOLEAN TuiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
+BOOLEAN TuiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
/* Definitions for corners, depending on HORIZ and VERT */
#define UL (0xda)
NULL,
+ "Start ReactOS normally",
#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
"Custom Boot",
#endif
" +peloader\n"
"NOTE: all letters must be lowercase, no spaces allowed.";
-enum OptionMenuItems
+//
+// The boot options are mutually exclusive.
+//
+enum BootOption
{
- SAFE_MODE = 0,
- SAFE_MODE_WITH_NETWORKING = 1,
- SAFE_MODE_WITH_COMMAND_PROMPT = 2,
+ NO_OPTION = 0,
- SEPARATOR1 = 3,
+ SAFE_MODE,
+ SAFE_MODE_WITH_NETWORKING,
+ SAFE_MODE_WITH_COMMAND_PROMPT,
- ENABLE_BOOT_LOGGING = 4,
- ENABLE_VGA_MODE = 5,
- LAST_KNOWN_GOOD_CONFIGURATION = 6,
- DIRECTORY_SERVICES_RESTORE_MODE = 7,
- DEBUGGING_MODE = 8,
- FREELDR_DEBUGGING = 9,
-
- SEPARATOR2 = 10,
-
-#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
- CUSTOM_BOOT = 11,
-#endif
-#ifdef HAS_OPTION_MENU_REBOOT
- REBOOT = 12,
-#endif
+ LAST_KNOWN_GOOD_CONFIGURATION,
+ DIRECTORY_SERVICES_RESTORE_MODE,
};
ULONG OptionsMenuItemCount = sizeof(OptionsMenuList) / sizeof(OptionsMenuList[0]);
-BOOLEAN SafeMode = FALSE;
-BOOLEAN SafeModeWithNetworking = FALSE;
-BOOLEAN SafeModeWithCommandPrompt = FALSE;
-BOOLEAN BootLogging = FALSE;
-BOOLEAN VgaMode = FALSE;
-BOOLEAN LastKnownGoodConfiguration = FALSE;
-BOOLEAN DirectoryServicesRepairMode = FALSE;
-BOOLEAN DebuggingMode = FALSE;
+static enum BootOption BootOptionChoice = NO_OPTION;
+static BOOLEAN BootLogging = FALSE;
+static BOOLEAN VgaMode = FALSE;
+static BOOLEAN DebuggingMode = FALSE;
VOID DoOptionsMenu(VOID)
{
CHAR DebugChannelString[100];
if (!UiDisplayMenu("Select an option:", "",
+ TRUE,
OptionsMenuList,
OptionsMenuItemCount,
0, -1,
switch (SelectedMenuItem)
{
- case SAFE_MODE:
- SafeMode = TRUE;
- BootLogging = TRUE;
- break;
- case SAFE_MODE_WITH_NETWORKING:
- SafeModeWithNetworking = TRUE;
- BootLogging = TRUE;
- break;
- case SAFE_MODE_WITH_COMMAND_PROMPT:
- SafeModeWithCommandPrompt = TRUE;
- BootLogging = TRUE;
- break;
- //case SEPARATOR1:
- // break;
- case ENABLE_BOOT_LOGGING:
- BootLogging = TRUE;
- break;
- case ENABLE_VGA_MODE:
- VgaMode = TRUE;
- break;
- case LAST_KNOWN_GOOD_CONFIGURATION:
- LastKnownGoodConfiguration = TRUE;
- break;
- case DIRECTORY_SERVICES_RESTORE_MODE:
- DirectoryServicesRepairMode = TRUE;
- break;
- case DEBUGGING_MODE:
- DebuggingMode = TRUE;
- break;
- case FREELDR_DEBUGGING:
- DebugChannelString[0]=0;
- if (UiEditBox(FrldrDbgMsg, DebugChannelString, 100))
- DbgParseDebugChannels(DebugChannelString);
- break;
- //case SEPARATOR2:
- // break;
+ case 0: // Safe Mode
+ BootOptionChoice = SAFE_MODE;
+ BootLogging = TRUE;
+ break;
+ case 1: // Safe Mode with Networking
+ BootOptionChoice = SAFE_MODE_WITH_NETWORKING;
+ BootLogging = TRUE;
+ break;
+ case 2: // Safe Mode with Command Prompt
+ BootOptionChoice = SAFE_MODE_WITH_COMMAND_PROMPT;
+ BootLogging = TRUE;
+ break;
+ // case 3: // Separator
+ // break;
+ case 4: // Enable Boot Logging
+ BootLogging = TRUE;
+ break;
+ case 5: // Enable VGA Mode
+ VgaMode = TRUE;
+ break;
+ case 6: // Last Known Good Configuration
+ BootOptionChoice = LAST_KNOWN_GOOD_CONFIGURATION;
+ break;
+ case 7: // Directory Services Restore Mode
+ BootOptionChoice = DIRECTORY_SERVICES_RESTORE_MODE;
+ break;
+ case 8: // Debugging Mode
+ DebuggingMode = TRUE;
+ break;
+ case 9: // FreeLdr debugging
+ DebugChannelString[0] = 0;
+ if (UiEditBox(FrldrDbgMsg,
+ DebugChannelString,
+ sizeof(DebugChannelString) / sizeof(DebugChannelString[0])))
+ {
+ DbgParseDebugChannels(DebugChannelString);
+ }
+ break;
+ // case 10: // Separator
+ // break;
+ case 11: // Start ReactOS normally
+ // Reset all the parameters to their default values.
+ BootOptionChoice = NO_OPTION;
+ BootLogging = FALSE;
+ VgaMode = FALSE;
+ DebuggingMode = FALSE;
+ break;
#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
- case CUSTOM_BOOT:
- OptionMenuCustomBoot();
- break;
+ case 12: // Custom Boot
+ OptionMenuCustomBoot();
+ break;
#endif
#ifdef HAS_OPTION_MENU_REBOOT
- case REBOOT:
- OptionMenuReboot();
- break;
+ case 13: // Reboot
+ OptionMenuReboot();
+ break;
#endif
}
}
+VOID DisplayBootTimeOptions(VOID)
+{
+ CHAR BootOptions[260] = "";
+
+ switch (BootOptionChoice)
+ {
+ case SAFE_MODE:
+ strcat(BootOptions, OptionsMenuList[0]);
+ break;
+
+ case SAFE_MODE_WITH_NETWORKING:
+ strcat(BootOptions, OptionsMenuList[1]);
+ break;
+
+ case SAFE_MODE_WITH_COMMAND_PROMPT:
+ strcat(BootOptions, OptionsMenuList[2]);
+ break;
+
+ case LAST_KNOWN_GOOD_CONFIGURATION:
+ strcat(BootOptions, OptionsMenuList[6]);
+ break;
+
+ case DIRECTORY_SERVICES_RESTORE_MODE:
+ strcat(BootOptions, OptionsMenuList[7]);
+ break;
+
+ default:
+ break;
+ }
+
+ if (BootLogging)
+ {
+ if ( (BootOptionChoice != SAFE_MODE) &&
+ (BootOptionChoice != SAFE_MODE_WITH_NETWORKING) &&
+ (BootOptionChoice != SAFE_MODE_WITH_COMMAND_PROMPT) )
+ {
+ if (BootOptionChoice != NO_OPTION)
+ {
+ strcat(BootOptions, ", ");
+ }
+ strcat(BootOptions, OptionsMenuList[4]);
+ }
+ }
+
+ if (VgaMode)
+ {
+ if ((BootOptionChoice != NO_OPTION) ||
+ BootLogging)
+ {
+ strcat(BootOptions, ", ");
+ }
+ strcat(BootOptions, OptionsMenuList[5]);
+ }
+
+ if (DebuggingMode)
+ {
+ if ((BootOptionChoice != NO_OPTION) ||
+ BootLogging || VgaMode)
+ {
+ strcat(BootOptions, ", ");
+ }
+ strcat(BootOptions, OptionsMenuList[8]);
+ }
+
+ /* Display the chosen boot options */
+ UiDrawText(0,
+ UiScreenHeight - 2,
+ BootOptions,
+ ATTR(COLOR_LIGHTBLUE, UiMenuBgColor));
+}
+
VOID AppendBootTimeOptions(PCHAR BootOptions)
{
- if (SafeMode)
- strcat(BootOptions, " /SAFEBOOT:MINIMAL /SOS"); //FIXME: NOGUIBOOT should also be specified
+ switch (BootOptionChoice)
+ {
+ case SAFE_MODE:
+ strcat(BootOptions, " /SAFEBOOT:MINIMAL /SOS"); //FIXME: NOGUIBOOT should also be specified
+ break;
+
+ case SAFE_MODE_WITH_NETWORKING:
+ strcat(BootOptions, " /SAFEBOOT:NETWORK /SOS"); //FIXME: NOGUIBOOT should also be specified
+ break;
+
+ case SAFE_MODE_WITH_COMMAND_PROMPT:
+ strcat(BootOptions, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); //FIXME: NOGUIBOOT should also be specified
+ break;
- if (SafeModeWithNetworking)
- strcat(BootOptions, " /SAFEBOOT:NETWORK /SOS"); //FIXME: NOGUIBOOT should also be specified
+ case LAST_KNOWN_GOOD_CONFIGURATION:
+ DbgPrint("Last known good configuration is not supported yet!\n");
+ break;
- if (SafeModeWithCommandPrompt)
- strcat(BootOptions, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); //FIXME: NOGUIBOOT should also be specified
+ case DIRECTORY_SERVICES_RESTORE_MODE:
+ strcat(BootOptions, " /SAFEBOOT:DSREPAIR /SOS");
+ break;
+
+ default:
+ break;
+ }
if (BootLogging)
strcat(BootOptions, " /BOOTLOG");
if (VgaMode)
strcat(BootOptions, " /BASEVIDEO");
- if (LastKnownGoodConfiguration)
- DbgPrint("Last known good configuration is not supported yet!\n");
-
- if (DirectoryServicesRepairMode)
- strcat(BootOptions, " /SAFEBOOT:DSREPAIR /SOS");
-
if (DebuggingMode)
strcat(BootOptions, " /DEBUG");
}
{
UiDrawMenuItem(MenuInfo, i);
}
+
+ /* Display the boot options if needed */
+ if (MenuInfo->ShowBootOptions)
+ {
+ DisplayBootTimeOptions();
+ }
}
ULONG
BOOLEAN
UiDisplayMenu(IN PCSTR MenuHeader,
IN PCSTR MenuFooter,
+ IN BOOLEAN ShowBootOptions,
IN PCSTR MenuItemList[],
IN ULONG MenuItemCount,
IN ULONG DefaultMenuItem,
/* Setup the MENU_INFO structure */
MenuInformation.MenuHeader = MenuHeader;
MenuInformation.MenuFooter = MenuFooter;
+ MenuInformation.ShowBootOptions = ShowBootOptions;
MenuInformation.MenuItemList = MenuItemList;
MenuInformation.MenuItemCount = MenuItemCount;
MenuInformation.MenuTimeRemaining = MenuTimeOut;
TuiDrawMenuItem(MenuInfo, i);
}
+ //
+ // Display the boot options if needed
+ //
+ if (MenuInfo->ShowBootOptions)
+ {
+ DisplayBootTimeOptions();
+ }
+
VideoCopyOffScreenBufferToVRAM();
}
//
///////////////////////////////////////////////////////////////////////////////////////
-BOOLEAN NoUiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
+BOOLEAN NoUiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
{
*SelectedMenuItem = DefaultMenuItem;
return TRUE;
//
// Draw title text
//
- TuiDrawText( (UiScreenWidth / 2) - ((ULONG)strlen(UiTitleBoxTitleText) / 2),
+ TuiDrawText( (UiScreenWidth - (ULONG)strlen(UiTitleBoxTitleText)) / 2,
2,
UiTitleBoxTitleText,
ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
BOOLEAN
TuiDisplayMenu(PCSTR MenuHeader,
PCSTR MenuFooter,
+ BOOLEAN ShowBootOptions,
PCSTR MenuItemList[],
ULONG MenuItemCount,
ULONG DefaultMenuItem,
//
MenuInformation.MenuHeader = MenuHeader;
MenuInformation.MenuFooter = MenuFooter;
+ MenuInformation.ShowBootOptions = ShowBootOptions;
MenuInformation.MenuItemList = MenuItemList;
MenuInformation.MenuItemCount = MenuItemCount;
MenuInformation.MenuTimeRemaining = MenuTimeOut;
TuiDrawMenuItem(MenuInfo, i);
}
+ /* Display the boot options if needed */
+ if (MenuInfo->ShowBootOptions)
+ {
+ DisplayBootTimeOptions();
+ }
+
VideoCopyOffScreenBufferToVRAM();
}
}
}
-BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
+BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
{
- return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter);
+ return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, ShowBootOptions, MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter);
}
VOID UiFadeInBackdrop(VOID)