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 "Start ReactOS normally",
41 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
44 #ifdef HAS_OPTION_MENU_REBOOT
49 PCSTR FrldrDbgMsg
= "Enable FreeLdr debug channels\n"
50 "Acceptable syntax: [level1]#channel1[,[level2]#channel2]\n"
51 "level can be one of: trace,warn,fixme,err\n"
52 " if the level is ommited all levels\n"
53 " are enabled for the specified channel\n"
54 "# can be either + or -\n"
55 "channel can be one of the following:\n"
56 " all,warning,memory,filesystem,inifile,ui,disk,cache,registry,\n"
57 " reactos,linux,hwdetect,windows,peloader,scsiport,heap\n"
59 " trace+windows,trace+reactos\n"
60 " +hwdetect,err-disk\n"
62 "NOTE: all letters must be lowercase, no spaces allowed.";
65 // The boot options are mutually exclusive.
72 SAFE_MODE_WITH_NETWORKING
,
73 SAFE_MODE_WITH_COMMAND_PROMPT
,
75 LAST_KNOWN_GOOD_CONFIGURATION
,
76 DIRECTORY_SERVICES_RESTORE_MODE
,
79 ULONG OptionsMenuItemCount
= sizeof(OptionsMenuList
) / sizeof(OptionsMenuList
[0]);
81 static enum BootOption BootOptionChoice
= NO_OPTION
;
82 static BOOLEAN BootLogging
= FALSE
;
83 static BOOLEAN VgaMode
= FALSE
;
84 static BOOLEAN DebuggingMode
= FALSE
;
86 VOID
DoOptionsMenu(VOID
)
88 ULONG SelectedMenuItem
;
89 CHAR DebugChannelString
[100];
91 if (!UiDisplayMenu("Select an option:", "",
100 // The user pressed ESC
104 // Clear the backdrop
107 switch (SelectedMenuItem
)
110 BootOptionChoice
= SAFE_MODE
;
113 case 1: // Safe Mode with Networking
114 BootOptionChoice
= SAFE_MODE_WITH_NETWORKING
;
117 case 2: // Safe Mode with Command Prompt
118 BootOptionChoice
= SAFE_MODE_WITH_COMMAND_PROMPT
;
121 // case 3: // Separator
123 case 4: // Enable Boot Logging
126 case 5: // Enable VGA Mode
129 case 6: // Last Known Good Configuration
130 BootOptionChoice
= LAST_KNOWN_GOOD_CONFIGURATION
;
132 case 7: // Directory Services Restore Mode
133 BootOptionChoice
= DIRECTORY_SERVICES_RESTORE_MODE
;
135 case 8: // Debugging Mode
136 DebuggingMode
= TRUE
;
138 case 9: // FreeLdr debugging
139 DebugChannelString
[0] = 0;
140 if (UiEditBox(FrldrDbgMsg
,
142 sizeof(DebugChannelString
) / sizeof(DebugChannelString
[0])))
144 DbgParseDebugChannels(DebugChannelString
);
147 // case 10: // Separator
149 case 11: // Start ReactOS normally
150 // Reset all the parameters to their default values.
151 BootOptionChoice
= NO_OPTION
;
154 DebuggingMode
= FALSE
;
156 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
157 case 12: // Custom Boot
158 OptionMenuCustomBoot();
161 #ifdef HAS_OPTION_MENU_REBOOT
169 VOID
DisplayBootTimeOptions(VOID
)
171 CHAR BootOptions
[260] = "";
173 switch (BootOptionChoice
)
176 strcat(BootOptions
, OptionsMenuList
[0]);
179 case SAFE_MODE_WITH_NETWORKING
:
180 strcat(BootOptions
, OptionsMenuList
[1]);
183 case SAFE_MODE_WITH_COMMAND_PROMPT
:
184 strcat(BootOptions
, OptionsMenuList
[2]);
187 case LAST_KNOWN_GOOD_CONFIGURATION
:
188 strcat(BootOptions
, OptionsMenuList
[6]);
191 case DIRECTORY_SERVICES_RESTORE_MODE
:
192 strcat(BootOptions
, OptionsMenuList
[7]);
201 if ( (BootOptionChoice
!= SAFE_MODE
) &&
202 (BootOptionChoice
!= SAFE_MODE_WITH_NETWORKING
) &&
203 (BootOptionChoice
!= SAFE_MODE_WITH_COMMAND_PROMPT
) )
205 if (BootOptionChoice
!= NO_OPTION
)
207 strcat(BootOptions
, ", ");
209 strcat(BootOptions
, OptionsMenuList
[4]);
215 if ((BootOptionChoice
!= NO_OPTION
) ||
218 strcat(BootOptions
, ", ");
220 strcat(BootOptions
, OptionsMenuList
[5]);
225 if ((BootOptionChoice
!= NO_OPTION
) ||
226 BootLogging
|| VgaMode
)
228 strcat(BootOptions
, ", ");
230 strcat(BootOptions
, OptionsMenuList
[8]);
233 /* Display the chosen boot options */
237 ATTR(COLOR_LIGHTBLUE
, UiMenuBgColor
));
240 VOID
AppendBootTimeOptions(PCHAR BootOptions
)
242 switch (BootOptionChoice
)
245 strcat(BootOptions
, " /SAFEBOOT:MINIMAL /SOS"); //FIXME: NOGUIBOOT should also be specified
248 case SAFE_MODE_WITH_NETWORKING
:
249 strcat(BootOptions
, " /SAFEBOOT:NETWORK /SOS"); //FIXME: NOGUIBOOT should also be specified
252 case SAFE_MODE_WITH_COMMAND_PROMPT
:
253 strcat(BootOptions
, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); //FIXME: NOGUIBOOT should also be specified
256 case LAST_KNOWN_GOOD_CONFIGURATION
:
257 DbgPrint("Last known good configuration is not supported yet!\n");
260 case DIRECTORY_SERVICES_RESTORE_MODE
:
261 strcat(BootOptions
, " /SAFEBOOT:DSREPAIR /SOS");
269 strcat(BootOptions
, " /BOOTLOG");
272 strcat(BootOptions
, " /BASEVIDEO");
275 strcat(BootOptions
, " /DEBUG");