[FREELDR]

- 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
This commit is contained in:
Hermès Bélusca-Maïto 2012-12-26 01:40:18 +00:00
parent da0a3154ac
commit 4434b64659
14 changed files with 202 additions and 93 deletions

View file

@ -44,6 +44,7 @@ VOID OptionMenuCustomBoot(VOID)
ULONG SelectedMenuItem;
if (!UiDisplayMenu("Please choose a boot method:", "",
FALSE,
CustomBootMenuList,
CustomBootMenuCount,
0, -1,

View file

@ -273,6 +273,7 @@ VOID RunLoader(VOID)
if (!UiDisplayMenu("Please select the operating system to start:",
"For troubleshooting and advanced startup options for "
"ReactOS, press F8.",
TRUE,
OperatingSystemDisplayNames,
OperatingSystemCount,
DefaultOperatingSystem,

View file

@ -20,4 +20,5 @@
#pragma once
VOID DoOptionsMenu(VOID);
VOID DisplayBootTimeOptions(VOID);
VOID AppendBootTimeOptions(PCHAR BootOptions);

View file

@ -70,7 +70,7 @@ VOID UiMessageBoxCritical(PCSTR MessageText); // Displays a message box on th
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
@ -91,8 +91,9 @@ typedef struct tagUI_MENU_INFO
{
PCSTR MenuHeader;
PCSTR MenuFooter;
BOOLEAN ShowBootOptions;
PCSTR *MenuItemList;
PCSTR* MenuItemList;
ULONG MenuItemCount;
LONG MenuTimeRemaining;
ULONG SelectedMenuItem;
@ -105,7 +106,7 @@ typedef struct tagUI_MENU_INFO
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);
///////////////////////////////////////////////////////////////////////////////////////
//
@ -135,7 +136,7 @@ typedef struct tagUIVTBL
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;

View file

@ -48,6 +48,6 @@ UCHAR GuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into
// 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;

View file

@ -41,5 +41,5 @@ VOID NoUiFadeOut(VOID);
//
///////////////////////////////////////////////////////////////////////////////////////
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);

View file

@ -63,7 +63,7 @@ VOID TuiDrawMenu(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)

View file

@ -37,6 +37,7 @@ PCSTR OptionsMenuList[] =
NULL,
"Start ReactOS normally",
#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
"Custom Boot",
#endif
@ -60,41 +61,27 @@ PCSTR FrldrDbgMsg = "Enable FreeLdr debug channels\n"
" +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)
{
@ -102,6 +89,7 @@ VOID DoOptionsMenu(VOID)
CHAR DebugChannelString[100];
if (!UiDisplayMenu("Select an option:", "",
TRUE,
OptionsMenuList,
OptionsMenuItemCount,
0, -1,
@ -118,65 +106,164 @@ VOID DoOptionsMenu(VOID)
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;
if (SafeModeWithNetworking)
strcat(BootOptions, " /SAFEBOOT:NETWORK /SOS"); //FIXME: NOGUIBOOT should also be specified
case SAFE_MODE_WITH_NETWORKING:
strcat(BootOptions, " /SAFEBOOT:NETWORK /SOS"); //FIXME: NOGUIBOOT should also be specified
break;
if (SafeModeWithCommandPrompt)
strcat(BootOptions, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); //FIXME: NOGUIBOOT should also be specified
case SAFE_MODE_WITH_COMMAND_PROMPT:
strcat(BootOptions, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); //FIXME: NOGUIBOOT should also be specified
break;
case LAST_KNOWN_GOOD_CONFIGURATION:
DbgPrint("Last known good configuration is not supported yet!\n");
break;
case DIRECTORY_SERVICES_RESTORE_MODE:
strcat(BootOptions, " /SAFEBOOT:DSREPAIR /SOS");
break;
default:
break;
}
if (BootLogging)
strcat(BootOptions, " /BOOTLOG");
@ -184,12 +271,6 @@ VOID AppendBootTimeOptions(PCHAR BootOptions)
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");
}

View file

@ -384,6 +384,12 @@ UiDrawMenu(IN PUI_MENU_INFO MenuInfo)
{
UiDrawMenuItem(MenuInfo, i);
}
/* Display the boot options if needed */
if (MenuInfo->ShowBootOptions)
{
DisplayBootTimeOptions();
}
}
ULONG
@ -502,6 +508,7 @@ UiCalcMenuBoxSize(IN PUI_MENU_INFO MenuInfo)
BOOLEAN
UiDisplayMenu(IN PCSTR MenuHeader,
IN PCSTR MenuFooter,
IN BOOLEAN ShowBootOptions,
IN PCSTR MenuItemList[],
IN ULONG MenuItemCount,
IN ULONG DefaultMenuItem,
@ -526,6 +533,7 @@ UiDisplayMenu(IN PCSTR MenuHeader,
/* Setup the MENU_INFO structure */
MenuInformation.MenuHeader = MenuHeader;
MenuInformation.MenuFooter = MenuFooter;
MenuInformation.ShowBootOptions = ShowBootOptions;
MenuInformation.MenuItemList = MenuItemList;
MenuInformation.MenuItemCount = MenuItemCount;
MenuInformation.MenuTimeRemaining = MenuTimeOut;

View file

@ -123,6 +123,14 @@ MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo)
TuiDrawMenuItem(MenuInfo, i);
}
//
// Display the boot options if needed
//
if (MenuInfo->ShowBootOptions)
{
DisplayBootTimeOptions();
}
VideoCopyOffScreenBufferToVRAM();
}

View file

@ -109,7 +109,7 @@ VOID NoUiFadeOut(VOID)
//
///////////////////////////////////////////////////////////////////////////////////////
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;

View file

@ -128,7 +128,7 @@ VOID TuiDrawBackdrop(VOID)
//
// Draw title text
//
TuiDrawText( (UiScreenWidth / 2) - ((ULONG)strlen(UiTitleBoxTitleText) / 2),
TuiDrawText( (UiScreenWidth - (ULONG)strlen(UiTitleBoxTitleText)) / 2,
2,
UiTitleBoxTitleText,
ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));

View file

@ -16,6 +16,7 @@
BOOLEAN
TuiDisplayMenu(PCSTR MenuHeader,
PCSTR MenuFooter,
BOOLEAN ShowBootOptions,
PCSTR MenuItemList[],
ULONG MenuItemCount,
ULONG DefaultMenuItem,
@ -45,6 +46,7 @@ TuiDisplayMenu(PCSTR MenuHeader,
//
MenuInformation.MenuHeader = MenuHeader;
MenuInformation.MenuFooter = MenuFooter;
MenuInformation.ShowBootOptions = ShowBootOptions;
MenuInformation.MenuItemList = MenuItemList;
MenuInformation.MenuItemCount = MenuItemCount;
MenuInformation.MenuTimeRemaining = MenuTimeOut;
@ -225,6 +227,12 @@ TuiDrawMenu(PUI_MENU_INFO MenuInfo)
TuiDrawMenuItem(MenuInfo, i);
}
/* Display the boot options if needed */
if (MenuInfo->ShowBootOptions)
{
DisplayBootTimeOptions();
}
VideoCopyOffScreenBufferToVRAM();
}

View file

@ -442,9 +442,9 @@ VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars)
}
}
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)