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 omitted 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:", "",
99 11, // Use "Start ReactOS normally" as default; see the switch below.
105 /* The user pressed ESC */
109 /* Clear the backdrop */
112 switch (SelectedMenuItem
)
115 BootOptionChoice
= SAFE_MODE
;
118 case 1: // Safe Mode with Networking
119 BootOptionChoice
= SAFE_MODE_WITH_NETWORKING
;
122 case 2: // Safe Mode with Command Prompt
123 BootOptionChoice
= SAFE_MODE_WITH_COMMAND_PROMPT
;
126 // case 3: // Separator
128 case 4: // Enable Boot Logging
131 case 5: // Enable VGA Mode
134 case 6: // Last Known Good Configuration
135 BootOptionChoice
= LAST_KNOWN_GOOD_CONFIGURATION
;
137 case 7: // Directory Services Restore Mode
138 BootOptionChoice
= DIRECTORY_SERVICES_RESTORE_MODE
;
140 case 8: // Debugging Mode
141 DebuggingMode
= TRUE
;
143 case 9: // FreeLdr debugging
144 DebugChannelString
[0] = 0;
145 if (UiEditBox(FrldrDbgMsg
,
147 sizeof(DebugChannelString
) / sizeof(DebugChannelString
[0])))
149 DbgParseDebugChannels(DebugChannelString
);
152 // case 10: // Separator
154 case 11: // Start ReactOS normally
155 // Reset all the parameters to their default values.
156 BootOptionChoice
= NO_OPTION
;
159 DebuggingMode
= FALSE
;
161 #ifdef HAS_OPTION_MENU_CUSTOM_BOOT
162 case 12: // Custom Boot
163 OptionMenuCustomBoot();
166 #ifdef HAS_OPTION_MENU_REBOOT
174 VOID
DisplayBootTimeOptions(VOID
)
176 CHAR BootOptions
[260] = "";
178 switch (BootOptionChoice
)
181 strcat(BootOptions
, OptionsMenuList
[0]);
184 case SAFE_MODE_WITH_NETWORKING
:
185 strcat(BootOptions
, OptionsMenuList
[1]);
188 case SAFE_MODE_WITH_COMMAND_PROMPT
:
189 strcat(BootOptions
, OptionsMenuList
[2]);
192 case LAST_KNOWN_GOOD_CONFIGURATION
:
193 strcat(BootOptions
, OptionsMenuList
[6]);
196 case DIRECTORY_SERVICES_RESTORE_MODE
:
197 strcat(BootOptions
, OptionsMenuList
[7]);
206 if ( (BootOptionChoice
!= SAFE_MODE
) &&
207 (BootOptionChoice
!= SAFE_MODE_WITH_NETWORKING
) &&
208 (BootOptionChoice
!= SAFE_MODE_WITH_COMMAND_PROMPT
) )
210 if (BootOptionChoice
!= NO_OPTION
)
212 strcat(BootOptions
, ", ");
214 strcat(BootOptions
, OptionsMenuList
[4]);
220 if ((BootOptionChoice
!= NO_OPTION
) ||
223 strcat(BootOptions
, ", ");
225 strcat(BootOptions
, OptionsMenuList
[5]);
230 if ((BootOptionChoice
!= NO_OPTION
) ||
231 BootLogging
|| VgaMode
)
233 strcat(BootOptions
, ", ");
235 strcat(BootOptions
, OptionsMenuList
[8]);
238 /* Display the chosen boot options */
242 ATTR(COLOR_LIGHTBLUE
, UiMenuBgColor
));
245 VOID
AppendBootTimeOptions(PCHAR BootOptions
)
247 switch (BootOptionChoice
)
250 strcat(BootOptions
, " /SAFEBOOT:MINIMAL /SOS"); // FIXME: NOGUIBOOT should also be specified
253 case SAFE_MODE_WITH_NETWORKING
:
254 strcat(BootOptions
, " /SAFEBOOT:NETWORK /SOS"); // FIXME: NOGUIBOOT should also be specified
257 case SAFE_MODE_WITH_COMMAND_PROMPT
:
258 strcat(BootOptions
, " /SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS"); // FIXME: NOGUIBOOT should also be specified
261 case LAST_KNOWN_GOOD_CONFIGURATION
:
262 DbgPrint("Last known good configuration is not supported yet!\n");
265 case DIRECTORY_SERVICES_RESTORE_MODE
:
266 strcat(BootOptions
, " /SAFEBOOT:DSREPAIR /SOS");
274 strcat(BootOptions
, " /BOOTLOG");
277 strcat(BootOptions
, " /BASEVIDEO");
280 strcat(BootOptions
, " /DEBUG");