3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 PCSTR OptionsMenuList
[] =
26 "Safe Mode with Networking",
27 "Safe Mode with Command Prompt",
31 "Enable Boot Logging",
33 "Last Known Good Configuration",
34 "Directory Services Restore Mode",
40 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
43 #ifdef HAS_OPTION_MENU_REBOOT
48 PCSTR FrldrDbgMsg
= "Enable freeldr debug channels\n"
49 "Acceptable syntax: [level1]#channel1[,[level2]#channel2]\n"
50 "level can be one of: trace,warn,fixme,err\n"
51 " if the level is ommited all levels\n"
52 " are enabled for the specified channel\n"
53 "# can be either + or -\n"
54 "channel can be one of the following:\n"
55 " all,warning,memory,filesystem,inifile,ui,disk,cache,registry,\n"
56 " reactos,linux,hwdetect,windows,peloader,scsiport,heap\n"
58 " trace+windows,trace+reactos\n"
59 " +hwdetect,err-disk\n"
61 "NOTE: all letters must be lowercase, no spaces allowed\n";
66 SAFE_MODE_WITH_NETWORKING
= 1,
67 SAFE_MODE_WITH_COMMAND_PROMPT
= 2,
71 ENABLE_BOOT_LOGGING
= 4,
73 LAST_KNOWN_GOOD_CONFIGURATION
= 6,
74 DIRECTORY_SERVICES_RESTORE_MODE
= 7,
76 FREELDR_DEBUGGING
= 9,
80 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
83 #ifdef HAS_OPTION_MENU_REBOOT
88 ULONG OptionsMenuItemCount
= sizeof(OptionsMenuList
) / sizeof(OptionsMenuList
[0]);
90 BOOLEAN SafeMode
= FALSE
;
91 BOOLEAN SafeModeWithNetworking
= FALSE
;
92 BOOLEAN SafeModeWithCommandPrompt
= FALSE
;
93 BOOLEAN BootLogging
= FALSE
;
94 BOOLEAN VgaMode
= FALSE
;
95 BOOLEAN LastKnownGoodConfiguration
= FALSE
;
96 BOOLEAN DirectoryServicesRepairMode
= FALSE
;
97 BOOLEAN DebuggingMode
= FALSE
;
99 VOID
DoOptionsMenu(VOID
)
101 ULONG SelectedMenuItem
;
102 CHAR DebugChannelString
[100];
104 if (!UiDisplayMenu(OptionsMenuList
, OptionsMenuItemCount
, 0, -1, &SelectedMenuItem
, TRUE
, NULL
))
106 // The user pressed ESC
110 // Clear the backdrop
113 switch (SelectedMenuItem
)
119 case SAFE_MODE_WITH_NETWORKING
:
120 SafeModeWithNetworking
= TRUE
;
123 case SAFE_MODE_WITH_COMMAND_PROMPT
:
124 SafeModeWithCommandPrompt
= TRUE
;
129 case ENABLE_BOOT_LOGGING
:
132 case ENABLE_VGA_MODE
:
135 case LAST_KNOWN_GOOD_CONFIGURATION
:
136 LastKnownGoodConfiguration
= TRUE
;
138 case DIRECTORY_SERVICES_RESTORE_MODE
:
139 DirectoryServicesRepairMode
= TRUE
;
142 DebuggingMode
= TRUE
;
144 case FREELDR_DEBUGGING
:
145 DebugChannelString
[0]=0;
146 if(UiEditBox(FrldrDbgMsg
, DebugChannelString
, 100))
147 DbgParseDebugChannels(DebugChannelString
);
151 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
153 OptionMenuCustomBoot();
156 #ifdef HAS_OPTION_MENU_REBOOT
164 VOID
AppendBootTimeOptions(PCHAR BootOptions
)
167 strcat(BootOptions
, " /SAFEBOOT:MINIMAL /SOS"); //FIXME: NOGUIBOOT should also be specified
169 if (SafeModeWithNetworking
)
170 strcat(BootOptions
, " /SAFEBOOT:NETWORK /SOS"); //FIXME: NOGUIBOOT should also be specified
172 if (SafeModeWithCommandPrompt
)
173 strcat(BootOptions
, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); //FIXME: NOGUIBOOT should also be specified
176 strcat(BootOptions
, " /BOOTLOG");
179 strcat(BootOptions
, " /BASEVIDEO");
181 if (LastKnownGoodConfiguration
)
182 DbgPrint("Last known good configuration is not supported yet!\n");
184 if (DirectoryServicesRepairMode
)
185 strcat(BootOptions
, " /SAFEBOOT:DSREPAIR /SOS");
188 strcat(BootOptions
, " /DEBUG");