ReactOS 0.4.16-dev-2610-ge2c92c0
advopts.c File Reference
#include <freeldr.h>
#include "ntldropts.h"
Include dependency graph for advopts.c:

Go to the source code of this file.

Functions

static VOID GetBootOptionsDescription (_Inout_z_bytecount_(BootOptsDescSize) PSTR BootOptsDesc, _In_ SIZE_T BootOptsDescSize)
 
VOID MenuNTOptions (_Inout_ OperatingSystemItem *OperatingSystem)
 
VOID AppendBootTimeOptions (_Inout_z_bytecount_(BootOptionsSize) PSTR BootOptions, _In_ SIZE_T BootOptionsSize)
 

Variables

static PCSTR OptionsMenuList []
 
enum BootOption BootOptionChoice = NO_OPTION
 
LOGICAL BootFlags = 0
 

Function Documentation

◆ AppendBootTimeOptions()

VOID AppendBootTimeOptions ( _Inout_z_bytecount_(BootOptionsSize) PSTR  BootOptions,
_In_ SIZE_T  BootOptionsSize 
)

Definition at line 185 of file advopts.c.

189{
190 /* NOTE: Keep in sync with the 'enum BootOption' in winldr.h */
191 static const PCSTR OptionsStr[] =
192 {
193 /* NO_OPTION */ NULL,
194 /* SAFEBOOT */ "SAFEBOOT:MINIMAL SOS NOGUIBOOT",
195 /* SAFEBOOT_NETWORK */ "SAFEBOOT:NETWORK SOS NOGUIBOOT",
196 /* SAFEBOOT_ALTSHELL */ "SAFEBOOT:MINIMAL(ALTERNATESHELL) SOS NOGUIBOOT",
197 /* SAFEBOOT_DSREPAIR */ "SAFEBOOT:DSREPAIR SOS",
198 /* LKG_CONFIG */ NULL,
199 };
200
201 if (BootOptionsSize < sizeof(CHAR))
202 return;
203
204 switch (BootOptionChoice)
205 {
206 case SAFEBOOT:
207 case SAFEBOOT_NETWORK:
210 {
212 NtLdrAddOptions(BootOptions, BootOptionsSize, TRUE, OptionsStr[BootOptionChoice]);
213 break;
214 }
215
216 case LKG_CONFIG:
217 DbgPrint("Last known good configuration is not supported yet!\n");
218 break;
219
220 default:
221 break;
222 }
223
225 NtLdrAddOptions(BootOptions, BootOptionsSize, TRUE, "BOOTLOG");
226
228 NtLdrAddOptions(BootOptions, BootOptionsSize, TRUE, "BASEVIDEO");
229
231 NtLdrAddOptions(BootOptions, BootOptionsSize, TRUE, "DEBUG");
232}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
LOGICAL BootFlags
Definition: advopts.c:44
enum BootOption BootOptionChoice
Definition: advopts.c:43
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define DbgPrint
Definition: hal.h:12
#define BOOT_DEBUGGING
Definition: winldr.h:61
@ SAFEBOOT
Definition: winldr.h:51
@ LKG_CONFIG
Definition: winldr.h:56
@ SAFEBOOT_DSREPAIR
Definition: winldr.h:54
@ SAFEBOOT_NETWORK
Definition: winldr.h:52
@ SAFEBOOT_ALTSHELL
Definition: winldr.h:53
#define BOOT_LOGGING
Definition: winldr.h:59
#define BOOT_VGA_MODE
Definition: winldr.h:60
#define ASSERT(a)
Definition: mode.c:44
VOID NtLdrAddOptions(IN OUT PSTR LoadOptions, IN ULONG BufferSize, IN BOOLEAN Append, IN PCSTR NewOptions OPTIONAL)
Definition: ntldropts.c:140
char CHAR
Definition: pedump.c:57
const char * PCSTR
Definition: typedefs.h:52

Referenced by LoadAndBootWindows(), and LoadReactOSSetup().

◆ GetBootOptionsDescription()

static VOID GetBootOptionsDescription ( _Inout_z_bytecount_(BootOptsDescSize) PSTR  BootOptsDesc,
_In_ SIZE_T  BootOptsDescSize 
)
static

Definition at line 49 of file advopts.c.

53{
54 /* NOTE: Keep in sync with the 'enum BootOption'
55 * in winldr.h and the OptionsMenuList above. */
56 static const PCSTR* OptionNames[] =
57 {
58 /* NO_OPTION */ NULL,
59 /* SAFEBOOT */ &OptionsMenuList[0],
60 /* SAFEBOOT_NETWORK */ &OptionsMenuList[1],
61 /* SAFEBOOT_ALTSHELL */ &OptionsMenuList[2],
62 /* SAFEBOOT_DSREPAIR */ &OptionsMenuList[7],
63 /* LKG_CONFIG */ &OptionsMenuList[6],
64 };
65
66 if (BootOptsDescSize < sizeof(CHAR))
67 return;
68
69 *BootOptsDesc = ANSI_NULL;
70
72 if (BootOptionChoice != NO_OPTION) // && BootOptionChoice < RTL_NUMBER_OF(OptionNames)
73 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, *OptionNames[BootOptionChoice]);
74
76 {
77 /* Since these safe mode options come by default with boot logging,
78 * don't show "Boot Logging" when one of these is selected;
79 * instead just show the corresponding safe mode option name. */
80 if ( (BootOptionChoice != SAFEBOOT) &&
83 {
84 if (*BootOptsDesc)
85 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, ", ");
86 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, OptionsMenuList[4]);
87 }
88 }
89
91 {
92 if (*BootOptsDesc)
93 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, ", ");
94 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, OptionsMenuList[5]);
95 }
96
98 {
99 if (*BootOptsDesc)
100 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, ", ");
101 RtlStringCbCatA(BootOptsDesc, BootOptsDescSize, OptionsMenuList[8]);
102 }
103}
static PCSTR OptionsMenuList[]
Definition: advopts.c:17
@ NO_OPTION
Definition: winldr.h:49
#define ANSI_NULL
NTSTRSAFEAPI RtlStringCbCatA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:625

Referenced by MenuNTOptions().

◆ MenuNTOptions()

VOID MenuNTOptions ( _Inout_ OperatingSystemItem OperatingSystem)

Definition at line 106 of file advopts.c.

108{
109 ULONG SelectedMenuItem;
110
111 /* Redraw the backdrop, but don't overwrite boot options */
113 DisplayBootTimeOptions(OperatingSystem);
114
115 if (!UiDisplayMenu("Please select an option:",
116 NULL,
119 10, // Use "Start ReactOS normally" as default; see the switch below.
120 -1,
121 &SelectedMenuItem,
122 TRUE,
123 NULL, NULL))
124 {
125 /* The user pressed ESC */
126 return;
127 }
128
129 switch (SelectedMenuItem)
130 {
131 case 0: // Safe Mode
134 break;
135 case 1: // Safe Mode with Networking
138 break;
139 case 2: // Safe Mode with Command Prompt
142 break;
143 // case 3: // Separator
144 // break;
145 case 4: // Enable Boot Logging
147 break;
148 case 5: // Enable VGA Mode
150 break;
151 case 6: // Last Known Good Configuration
153 break;
154 case 7: // Directory Services Restore Mode
156 break;
157 case 8: // Debugging Mode
159 break;
160 // case 9: // Separator
161 // break;
162 case 10: // Start ReactOS normally
163 // Reset all the parameters to their default values.
165 BootFlags = 0;
166 break;
167#ifdef HAS_OPTION_MENU_EDIT_CMDLINE
168 case 11: // Edit command line
169 EditOperatingSystemEntry(OperatingSystem);
170 break;
171#endif
172#ifdef HAS_OPTION_MENU_REBOOT
173 case 12: // Reboot
175 break;
176#endif
177 }
178
179 /* Update the human-readable boot-option description string */
180 GetBootOptionsDescription(OperatingSystem->AdvBootOptsDesc,
181 sizeof(OperatingSystem->AdvBootOptsDesc));
182}
static VOID GetBootOptionsDescription(_Inout_z_bytecount_(BootOptsDescSize) PSTR BootOptsDesc, _In_ SIZE_T BootOptsDescSize)
Definition: advopts.c:49
VOID DisplayBootTimeOptions(_In_ OperatingSystemItem *OperatingSystem)
Definition: options.c:115
VOID UiDrawBackdrop(ULONG DrawHeight)
Definition: ui.c:233
ULONG UiGetScreenHeight(VOID)
Definition: ui.c:655
BOOLEAN UiDisplayMenu(IN PCSTR MenuHeader, IN PCSTR MenuFooter OPTIONAL, IN PCSTR MenuItemList[], IN ULONG MenuItemCount, IN ULONG DefaultMenuItem, IN LONG MenuTimeOut, OUT PULONG SelectedMenuItem, IN BOOLEAN CanEscape, IN UiMenuKeyPressFilterCallback KeyPressFilter OPTIONAL, IN PVOID Context OPTIONAL)
Definition: ui.c:605
VOID OptionMenuReboot(VOID)
uint32_t ULONG
Definition: typedefs.h:59

Variable Documentation

◆ BootFlags

LOGICAL BootFlags = 0

Definition at line 44 of file advopts.c.

Referenced by AppendBootTimeOptions(), GetBootOptionsDescription(), and MenuNTOptions().

◆ BootOptionChoice

enum BootOption BootOptionChoice = NO_OPTION

Definition at line 43 of file advopts.c.

Referenced by AppendBootTimeOptions(), GetBootOptionsDescription(), and MenuNTOptions().

◆ OptionsMenuList

PCSTR OptionsMenuList[]
static
Initial value:
=
{
"Safe Mode",
"Safe Mode with Networking",
"Safe Mode with Command Prompt",
"Enable Boot Logging",
"Enable VGA Mode",
"Last Known Good Configuration",
"Directory Services Restore Mode",
"Debugging Mode",
"Start ReactOS normally",
}

Definition at line 17 of file advopts.c.

Referenced by GetBootOptionsDescription(), and MenuNTOptions().