ReactOS 0.4.17-dev-116-ga4b6fe9
options.c
Go to the documentation of this file.
1/*
2 * PROJECT: FreeLoader
3 * LICENSE: Dual-licensed:
4 * GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
5 * MIT (https://spdx.org/licenses/MIT)
6 * PURPOSE: FreeLoader Setup and Configuration F2 menu.
7 * COPYRIGHT: Copyright 1998-2003 Brian Palmer <brianp@sginet.com>
8 * Copyright 2012 Giannis Adamopoulos <gadamopoulos@reactos.org>
9 * Copyright 2022-2026 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
10 */
11
12/* INCLUDES *******************************************************************/
13
14#include <freeldr.h>
15#include <debug.h> // For DbgParseDebugChannels()
16
17/* GLOBALS ********************************************************************/
18
19/* Named menu IDs */
21{
24#ifdef HAS_OPTION_MENU_EDIT_CMDLINE
25 ActionEditBootCmdLine,
26#endif
27#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
28 ActionCustomBoot,
29#endif
33
34typedef struct _FRLDR_OPTIONS
35{
39
40static FRLDR_OPTIONS FrLdrOptions[] = // OptionsMenuList
41{
42 {ActionDebugging, "FreeLdr debugging"},
43
45
46#ifdef HAS_OPTION_MENU_EDIT_CMDLINE
47 {ActionEditBootCmdLine, "Edit Boot Command Line (F10)"},
48#endif
49#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
50 {ActionCustomBoot, "Custom Boot"},
51#endif
52 {ActionReboot, "Reboot"},
53 {ActionBackToPrevMenu, "Return to OS Choices menu"},
54};
55
57 "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"
66 "Examples:\n"
67 " trace+windows,trace+reactos\n"
68 " +hwdetect,err-disk\n"
69 " +peloader\n"
70 "NOTE: all letters must be lowercase, no spaces allowed.";
71
72/* FUNCTIONS ******************************************************************/
73
74VOID
76 _In_opt_ OperatingSystemItem* OperatingSystem)
77{
79 PCSTR OptionsMenuList[RTL_NUMBER_OF(FrLdrOptions)]; // FIXME!
80 ULONG i, MenuItemCount;
81 ULONG SelectedMenuItem = 0;
82
83 /* Build the menu, filtering out any item that may not be applicable */
84 for (i = 0, MenuItemCount = 0; i < RTL_NUMBER_OF(FrLdrOptions); ++i)
85 {
86 /* Hide the "Return to OS Choices" item if no OS entry is selected */
87 if ((FrLdrOptions[i].Id == ActionBackToPrevMenu) && !OperatingSystem)
88 continue;
89#ifdef HAS_OPTION_MENU_EDIT_CMDLINE
90 if ((FrLdrOptions[i].Id == ActionEditBootCmdLine) && !OperatingSystem)
91 continue;
92#endif
93 MenuActionsMap[MenuItemCount] = FrLdrOptions[i].Id;
94 OptionsMenuList[MenuItemCount++] = FrLdrOptions[i].Item;
95 }
96
97doMenu:
98 /* Clear the backdrop */
100
101 if (!UiDisplayMenu(VERSION " Setup and Configuration",
102 OperatingSystem ? NULL : "Press ESC to reboot.",
103 OptionsMenuList,
104 MenuItemCount,
105 SelectedMenuItem, -1,
106 &SelectedMenuItem,
107 TRUE,
108 NULL, NULL))
109 {
110 /* The user pressed ESC */
111 return;
112 }
113
114 switch (MenuActionsMap[SelectedMenuItem])
115 {
116 case ActionDebugging:
117 {
118 CHAR DebugChannelString[100] = "";
119 // DebugChannelString[0] = ANSI_NULL;
121 DebugChannelString,
122 RTL_NUMBER_OF(DebugChannelString)))
123 {
124 DbgParseDebugChannels(DebugChannelString);
125 }
126 break;
127 }
128#ifdef HAS_OPTION_MENU_EDIT_CMDLINE
129 case ActionEditBootCmdLine:
130 if (OperatingSystem)
131 EditOperatingSystemEntry(OperatingSystem);
132 break;
133#endif
134#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
135 case ActionCustomBoot:
136 OptionMenuCustomBoot();
137 break;
138#endif
139 case ActionReboot:
141 return;
143 // if (OperatingSystem)
144 return; /* Just return to the caller */
146 }
147 goto doMenu;
148}
149
150/*
151 * Display selected human-readable boot-option descriptions at the bottom of the screen.
152 */
153VOID
155 _In_ OperatingSystemItem* OperatingSystem)
156{
157 if (!OperatingSystem->AdvBootOptsDesc[0])
158 return;
159
160 /* Display the chosen boot options */
161 UiDrawText(0,
162 UiGetScreenHeight() - 2,
163 OperatingSystem->AdvBootOptsDesc,
165}
166
168{
169 UiMessageBox("The system will now reboot.");
170 Reboot();
171}
DWORD Id
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define VERSION
Definition: rdesktop.h:45
#define DbgParseDebugChannels(val)
Definition: debug.h:124
BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.c:633
#define COLOR_LIGHTBLUE
Definition: ui.h:338
VOID UiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: ui.c:254
VOID UiDrawBackdrop(ULONG DrawHeight)
Definition: ui.c:233
#define ATTR(cFore, cBack)
Definition: ui.h:323
UCHAR UiGetMenuBgColor(VOID)
Definition: ui.c:661
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 UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
VOID FreeLdrSetupMenu(_In_opt_ OperatingSystemItem *OperatingSystem)
Definition: options.c:75
enum _FRLDR_SETUP_ACTION FRLDR_SETUP_ACTION
static FRLDR_OPTIONS FrLdrOptions[]
Definition: options.c:40
struct _FRLDR_OPTIONS FRLDR_OPTIONS
static PCSTR FrldrDbgMsg
Definition: options.c:56
_FRLDR_SETUP_ACTION
Definition: options.c:21
@ ActionBackToPrevMenu
Definition: options.c:31
@ ActionSeparator
Definition: options.c:22
@ ActionReboot
Definition: options.c:30
@ ActionDebugging
Definition: options.c:23
VOID OptionMenuReboot(VOID)
Definition: options.c:167
VOID DisplayBootTimeOptions(_In_ OperatingSystemItem *OperatingSystem)
Definition: options.c:154
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define DEFAULT_UNREACHABLE
char CHAR
Definition: pedump.c:57
ULONG Id
Definition: options.c:36
PCSTR Item
Definition: options.c:37
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
DECLSPEC_NORETURN VOID __cdecl Reboot(VOID)
Definition: uefildr.c:99