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_CUSTOM_BOOT
48 #ifdef HAS_OPTION_MENU_REBOOT
53 PCSTR FrldrDbgMsg
= "Enable FreeLdr debug channels\n"
54 "Acceptable syntax: [level1]#channel1[,[level2]#channel2]\n"
55 "level can be one of: trace,warn,fixme,err\n"
56 " if the level is ommited all levels\n"
57 " are enabled for the specified channel\n"
58 "# can be either + or -\n"
59 "channel can be one of the following:\n"
60 " all,warning,memory,filesystem,inifile,ui,disk,cache,registry,\n"
61 " reactos,linux,hwdetect,windows,peloader,scsiport,heap\n"
63 " trace+windows,trace+reactos\n"
64 " +hwdetect,err-disk\n"
66 "NOTE: all letters must be lowercase, no spaces allowed.";
68 /* The boot options are mutually exclusive */
74 SAFE_MODE_WITH_NETWORKING
,
75 SAFE_MODE_WITH_COMMAND_PROMPT
,
77 LAST_KNOWN_GOOD_CONFIGURATION
,
78 DIRECTORY_SERVICES_RESTORE_MODE
,
81 ULONG OptionsMenuItemCount
= sizeof(OptionsMenuList
) / sizeof(OptionsMenuList
[0]);
83 static enum BootOption BootOptionChoice
= NO_OPTION
;
84 static BOOLEAN BootLogging
= FALSE
;
85 static BOOLEAN VgaMode
= FALSE
;
86 static BOOLEAN DebuggingMode
= FALSE
;
88 /* FUNCTIONS ******************************************************************/
90 VOID
DoOptionsMenu(VOID
)
92 ULONG SelectedMenuItem
;
93 CHAR DebugChannelString
[100];
95 if (!UiDisplayMenu("Select an option:", "",
104 /* The user pressed ESC */
108 /* Clear the backdrop */
111 switch (SelectedMenuItem
)
114 BootOptionChoice
= SAFE_MODE
;
117 case 1: // Safe Mode with Networking
118 BootOptionChoice
= SAFE_MODE_WITH_NETWORKING
;
121 case 2: // Safe Mode with Command Prompt
122 BootOptionChoice
= SAFE_MODE_WITH_COMMAND_PROMPT
;
125 // case 3: // Separator
127 case 4: // Enable Boot Logging
130 case 5: // Enable VGA Mode
133 case 6: // Last Known Good Configuration
134 BootOptionChoice
= LAST_KNOWN_GOOD_CONFIGURATION
;
136 case 7: // Directory Services Restore Mode
137 BootOptionChoice
= DIRECTORY_SERVICES_RESTORE_MODE
;
139 case 8: // Debugging Mode
140 DebuggingMode
= TRUE
;
142 case 9: // FreeLdr debugging
143 DebugChannelString
[0] = 0;
144 if (UiEditBox(FrldrDbgMsg
,
146 sizeof(DebugChannelString
) / sizeof(DebugChannelString
[0])))
148 DbgParseDebugChannels(DebugChannelString
);
151 // case 10: // Separator
153 case 11: // Start ReactOS normally
154 // Reset all the parameters to their default values.
155 BootOptionChoice
= NO_OPTION
;
158 DebuggingMode
= FALSE
;
160 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
161 case 12: // Custom Boot
162 OptionMenuCustomBoot();
165 #ifdef HAS_OPTION_MENU_REBOOT
173 VOID
DisplayBootTimeOptions(VOID
)
175 CHAR BootOptions
[260] = "";
177 switch (BootOptionChoice
)
180 strcat(BootOptions
, OptionsMenuList
[0]);
183 case SAFE_MODE_WITH_NETWORKING
:
184 strcat(BootOptions
, OptionsMenuList
[1]);
187 case SAFE_MODE_WITH_COMMAND_PROMPT
:
188 strcat(BootOptions
, OptionsMenuList
[2]);
191 case LAST_KNOWN_GOOD_CONFIGURATION
:
192 strcat(BootOptions
, OptionsMenuList
[6]);
195 case DIRECTORY_SERVICES_RESTORE_MODE
:
196 strcat(BootOptions
, OptionsMenuList
[7]);
205 if ( (BootOptionChoice
!= SAFE_MODE
) &&
206 (BootOptionChoice
!= SAFE_MODE_WITH_NETWORKING
) &&
207 (BootOptionChoice
!= SAFE_MODE_WITH_COMMAND_PROMPT
) )
209 if (BootOptionChoice
!= NO_OPTION
)
211 strcat(BootOptions
, ", ");
213 strcat(BootOptions
, OptionsMenuList
[4]);
219 if ((BootOptionChoice
!= NO_OPTION
) ||
222 strcat(BootOptions
, ", ");
224 strcat(BootOptions
, OptionsMenuList
[5]);
229 if ((BootOptionChoice
!= NO_OPTION
) ||
230 BootLogging
|| VgaMode
)
232 strcat(BootOptions
, ", ");
234 strcat(BootOptions
, OptionsMenuList
[8]);
237 /* Display the chosen boot options */
241 ATTR(COLOR_LIGHTBLUE
, UiMenuBgColor
));
244 VOID
AppendBootTimeOptions(PCHAR BootOptions
)
246 switch (BootOptionChoice
)
249 strcat(BootOptions
, " /SAFEBOOT:MINIMAL /SOS"); // FIXME: NOGUIBOOT should also be specified
252 case SAFE_MODE_WITH_NETWORKING
:
253 strcat(BootOptions
, " /SAFEBOOT:NETWORK /SOS"); // FIXME: NOGUIBOOT should also be specified
256 case SAFE_MODE_WITH_COMMAND_PROMPT
:
257 strcat(BootOptions
, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); // FIXME: NOGUIBOOT should also be specified
260 case LAST_KNOWN_GOOD_CONFIGURATION
:
261 DbgPrint("Last known good configuration is not supported yet!\n");
264 case DIRECTORY_SERVICES_RESTORE_MODE
:
265 strcat(BootOptions
, " /SAFEBOOT:DSREPAIR /SOS");
273 strcat(BootOptions
, " /BOOTLOG");
276 strcat(BootOptions
, " /BASEVIDEO");
279 strcat(BootOptions
, " /DEBUG");