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.
20 /* INCLUDES *******************************************************************/
25 /* GLOBALS ********************************************************************/
27 PCSTR OptionsMenuList
[] =
30 "Safe Mode with Networking",
31 "Safe Mode with Command Prompt",
35 "Enable Boot Logging",
37 "Last Known Good Configuration",
38 "Directory Services Restore Mode",
44 "Start ReactOS normally",
45 #ifdef HAS_OPTION_MENU_EDIT_CMDLINE
46 "Edit Boot Command Line (F10)",
48 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
51 #ifdef HAS_OPTION_MENU_REBOOT
57 PCSTR FrldrDbgMsg
= "Enable FreeLdr debug channels\n"
58 "Acceptable syntax: [level1]#channel1[,[level2]#channel2]\n"
59 "level can be one of: trace,warn,fixme,err\n"
60 " if the level is omitted all levels\n"
61 " are enabled for the specified channel\n"
62 "# can be either + or -\n"
63 "channel can be one of the following:\n"
64 " all,warning,memory,filesystem,inifile,ui,disk,cache,registry,\n"
65 " reactos,linux,hwdetect,windows,peloader,scsiport,heap\n"
67 " trace+windows,trace+reactos\n"
68 " +hwdetect,err-disk\n"
70 "NOTE: all letters must be lowercase, no spaces allowed.";
72 /* The boot options are mutually exclusive */
78 SAFE_MODE_WITH_NETWORKING
,
79 SAFE_MODE_WITH_COMMAND_PROMPT
,
81 LAST_KNOWN_GOOD_CONFIGURATION
,
82 DIRECTORY_SERVICES_RESTORE_MODE
,
85 static enum BootOption BootOptionChoice
= NO_OPTION
;
86 static BOOLEAN BootLogging
= FALSE
;
87 static BOOLEAN VgaMode
= FALSE
;
88 static BOOLEAN DebuggingMode
= FALSE
;
90 /* FUNCTIONS ******************************************************************/
92 VOID
DoOptionsMenu(IN OperatingSystemItem
* OperatingSystem
)
94 ULONG SelectedMenuItem
;
95 CHAR DebugChannelString
[100];
97 if (!UiDisplayMenu("Select an option:", NULL
,
100 sizeof(OptionsMenuList
) / sizeof(OptionsMenuList
[0]),
101 11, // Use "Start ReactOS normally" as default; see the switch below.
107 /* The user pressed ESC */
111 /* Clear the backdrop */
114 switch (SelectedMenuItem
)
117 BootOptionChoice
= SAFE_MODE
;
120 case 1: // Safe Mode with Networking
121 BootOptionChoice
= SAFE_MODE_WITH_NETWORKING
;
124 case 2: // Safe Mode with Command Prompt
125 BootOptionChoice
= SAFE_MODE_WITH_COMMAND_PROMPT
;
128 // case 3: // Separator
130 case 4: // Enable Boot Logging
133 case 5: // Enable VGA Mode
136 case 6: // Last Known Good Configuration
137 BootOptionChoice
= LAST_KNOWN_GOOD_CONFIGURATION
;
139 case 7: // Directory Services Restore Mode
140 BootOptionChoice
= DIRECTORY_SERVICES_RESTORE_MODE
;
142 case 8: // Debugging Mode
143 DebuggingMode
= TRUE
;
145 case 9: // FreeLdr debugging
146 DebugChannelString
[0] = 0;
147 if (UiEditBox(FrldrDbgMsg
,
149 sizeof(DebugChannelString
) / sizeof(DebugChannelString
[0])))
151 DbgParseDebugChannels(DebugChannelString
);
154 // case 10: // Separator
156 case 11: // Start ReactOS normally
157 // Reset all the parameters to their default values.
158 BootOptionChoice
= NO_OPTION
;
161 DebuggingMode
= FALSE
;
163 #ifdef HAS_OPTION_MENU_EDIT_CMDLINE
164 case 12: // Edit command line
165 EditOperatingSystemEntry(OperatingSystem
);
168 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
169 case 13: // Custom Boot
170 OptionMenuCustomBoot();
173 #ifdef HAS_OPTION_MENU_REBOOT
181 VOID
DisplayBootTimeOptions(VOID
)
183 CHAR BootOptions
[260] = "";
185 switch (BootOptionChoice
)
188 strcat(BootOptions
, OptionsMenuList
[0]);
191 case SAFE_MODE_WITH_NETWORKING
:
192 strcat(BootOptions
, OptionsMenuList
[1]);
195 case SAFE_MODE_WITH_COMMAND_PROMPT
:
196 strcat(BootOptions
, OptionsMenuList
[2]);
199 case LAST_KNOWN_GOOD_CONFIGURATION
:
200 strcat(BootOptions
, OptionsMenuList
[6]);
203 case DIRECTORY_SERVICES_RESTORE_MODE
:
204 strcat(BootOptions
, OptionsMenuList
[7]);
213 if ( (BootOptionChoice
!= SAFE_MODE
) &&
214 (BootOptionChoice
!= SAFE_MODE_WITH_NETWORKING
) &&
215 (BootOptionChoice
!= SAFE_MODE_WITH_COMMAND_PROMPT
) )
217 if (BootOptionChoice
!= NO_OPTION
)
219 strcat(BootOptions
, ", ");
221 strcat(BootOptions
, OptionsMenuList
[4]);
227 if ((BootOptionChoice
!= NO_OPTION
) ||
230 strcat(BootOptions
, ", ");
232 strcat(BootOptions
, OptionsMenuList
[5]);
237 if ((BootOptionChoice
!= NO_OPTION
) ||
238 BootLogging
|| VgaMode
)
240 strcat(BootOptions
, ", ");
242 strcat(BootOptions
, OptionsMenuList
[8]);
245 /* Display the chosen boot options */
249 ATTR(COLOR_LIGHTBLUE
, UiMenuBgColor
));
252 VOID
AppendBootTimeOptions(PCHAR BootOptions
)
254 switch (BootOptionChoice
)
257 strcat(BootOptions
, " /SAFEBOOT:MINIMAL /SOS /NOGUIBOOT");
260 case SAFE_MODE_WITH_NETWORKING
:
261 strcat(BootOptions
, " /SAFEBOOT:NETWORK /SOS /NOGUIBOOT");
264 case SAFE_MODE_WITH_COMMAND_PROMPT
:
265 strcat(BootOptions
, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS /NOGUIBOOT");
268 case LAST_KNOWN_GOOD_CONFIGURATION
:
269 DbgPrint("Last known good configuration is not supported yet!\n");
272 case DIRECTORY_SERVICES_RESTORE_MODE
:
273 strcat(BootOptions
, " /SAFEBOOT:DSREPAIR /SOS");
281 strcat(BootOptions
, " /BOOTLOG");
284 strcat(BootOptions
, " /BASEVIDEO");
287 strcat(BootOptions
, " /DEBUG");