ReactOS 0.4.15-dev-5664-g3bf4ef6
ui.h File Reference
#include <ui/minitui.h>
#include <ui/noui.h>
#include <ui/tui.h>
Include dependency graph for ui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _UI_PROGRESS_BAR
 
struct  tagUI_MENU_INFO
 
struct  tagUIVTBL
 

Macros

#define LIGHT_FILL   0xB0
 
#define MEDIUM_FILL   0xB1
 
#define DARK_FILL   0xB2
 
#define ATTR(cFore, cBack)   ((cBack << 4) | cFore)
 
#define COLOR_BLACK   0
 
#define COLOR_BLUE   1
 
#define COLOR_GREEN   2
 
#define COLOR_CYAN   3
 
#define COLOR_RED   4
 
#define COLOR_MAGENTA   5
 
#define COLOR_BROWN   6
 
#define COLOR_GRAY   7
 
#define COLOR_DARKGRAY   8
 
#define COLOR_LIGHTBLUE   9
 
#define COLOR_LIGHTGREEN   10
 
#define COLOR_LIGHTCYAN   11
 
#define COLOR_LIGHTRED   12
 
#define COLOR_LIGHTMAGENTA   13
 
#define COLOR_YELLOW   14
 
#define COLOR_WHITE   15
 
#define HORZ   0xC4
 
#define D_HORZ   0xCD
 
#define VERT   0xB3
 
#define D_VERT   0xBA
 

Typedefs

typedef struct _UI_PROGRESS_BAR UI_PROGRESS_BAR
 
typedef struct _UI_PROGRESS_BARPUI_PROGRESS_BAR
 
typedef struct tagUI_MENU_INFO UI_MENU_INFO
 
typedef struct tagUI_MENU_INFOPUI_MENU_INFO
 
typedef BOOLEAN(* UiMenuKeyPressFilterCallback) (IN ULONG KeyPress, IN ULONG SelectedMenuItem, IN PVOID Context OPTIONAL)
 
typedef struct tagUIVTBL UIVTBL
 
typedef struct tagUIVTBLPUIVTBL
 

Functions

BOOLEAN UiInitialize (BOOLEAN ShowUi)
 
VOID UiUnInitialize (PCSTR BootText)
 
VOID UiDrawBackdrop (VOID)
 
VOID UiFillArea (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
 
VOID UiDrawShadow (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
 
VOID UiDrawBox (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
 
VOID UiDrawText (_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
 
VOID UiDrawText2 (_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
 
VOID UiDrawCenteredText (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
 
VOID UiDrawStatusText (PCSTR StatusText)
 
VOID UiUpdateDateTime (VOID)
 
VOID UiInfoBox (PCSTR MessageText)
 
VOID UiMessageBox (PCSTR Format,...)
 
VOID UiMessageBoxCritical (PCSTR MessageText)
 
VOID UiInitProgressBar (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
 
VOID UiIndicateProgress (VOID)
 
VOID UiSetProgressBarSubset (_In_ ULONG Floor, _In_ ULONG Ceiling)
 
VOID UiUpdateProgressBar (_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
 
VOID UiSetProgressBarText (_In_ PCSTR ProgressText)
 
VOID UiDrawProgressBarCenter (_In_ PCSTR ProgressText)
 
VOID UiDrawProgressBar (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
 
VOID UiShowMessageBoxesInSection (IN ULONG_PTR SectionId)
 
VOID UiShowMessageBoxesInArgv (IN ULONG Argc, IN PCHAR Argv[])
 
BOOLEAN UiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 
UCHAR UiTextToColor (PCSTR ColorText)
 
UCHAR UiTextToFillStyle (PCSTR FillStyleText)
 
VOID UiFadeInBackdrop (VOID)
 
VOID UiFadeOut (VOID)
 
BOOLEAN UiDisplayMenu (IN PCSTR MenuHeader, IN PCSTR MenuFooter OPTIONAL, IN BOOLEAN ShowBootOptions, 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)
 
VOID UiInit (const char *CmdLine)
 

Variables

ULONG UiScreenWidth
 
ULONG UiScreenHeight
 
UCHAR UiStatusBarFgColor
 
UCHAR UiStatusBarBgColor
 
UCHAR UiBackdropFgColor
 
UCHAR UiBackdropBgColor
 
UCHAR UiBackdropFillStyle
 
UCHAR UiTitleBoxFgColor
 
UCHAR UiTitleBoxBgColor
 
UCHAR UiMessageBoxFgColor
 
UCHAR UiMessageBoxBgColor
 
UCHAR UiMenuFgColor
 
UCHAR UiMenuBgColor
 
UCHAR UiTextColor
 
UCHAR UiSelectedTextColor
 
UCHAR UiSelectedTextBgColor
 
UCHAR UiEditBoxTextColor
 
UCHAR UiEditBoxBgColor
 
BOOLEAN UiShowTime
 
BOOLEAN UiMenuBox
 
BOOLEAN UiCenterMenu
 
BOOLEAN UiUseSpecialEffects
 
CHAR UiTitleBoxTitleText [260]
 
CHAR UiTimeText [260]
 
const PCSTR UiMonthNames [12]
 
UI_PROGRESS_BAR UiProgressBar
 
UIVTBL UiVtbl
 

Macro Definition Documentation

◆ ATTR

#define ATTR (   cFore,
  cBack 
)    ((cBack << 4) | cFore)

Definition at line 314 of file ui.h.

◆ COLOR_BLACK

#define COLOR_BLACK   0

Definition at line 319 of file ui.h.

◆ COLOR_BLUE

#define COLOR_BLUE   1

Definition at line 320 of file ui.h.

◆ COLOR_BROWN

#define COLOR_BROWN   6

Definition at line 325 of file ui.h.

◆ COLOR_CYAN

#define COLOR_CYAN   3

Definition at line 322 of file ui.h.

◆ COLOR_DARKGRAY

#define COLOR_DARKGRAY   8

Definition at line 328 of file ui.h.

◆ COLOR_GRAY

#define COLOR_GRAY   7

Definition at line 326 of file ui.h.

◆ COLOR_GREEN

#define COLOR_GREEN   2

Definition at line 321 of file ui.h.

◆ COLOR_LIGHTBLUE

#define COLOR_LIGHTBLUE   9

Definition at line 329 of file ui.h.

◆ COLOR_LIGHTCYAN

#define COLOR_LIGHTCYAN   11

Definition at line 331 of file ui.h.

◆ COLOR_LIGHTGREEN

#define COLOR_LIGHTGREEN   10

Definition at line 330 of file ui.h.

◆ COLOR_LIGHTMAGENTA

#define COLOR_LIGHTMAGENTA   13

Definition at line 333 of file ui.h.

◆ COLOR_LIGHTRED

#define COLOR_LIGHTRED   12

Definition at line 332 of file ui.h.

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   5

Definition at line 324 of file ui.h.

◆ COLOR_RED

#define COLOR_RED   4

Definition at line 323 of file ui.h.

◆ COLOR_WHITE

#define COLOR_WHITE   15

Definition at line 335 of file ui.h.

◆ COLOR_YELLOW

#define COLOR_YELLOW   14

Definition at line 334 of file ui.h.

◆ D_HORZ

#define D_HORZ   0xCD

Definition at line 344 of file ui.h.

◆ D_VERT

#define D_VERT   0xBA

Definition at line 346 of file ui.h.

◆ DARK_FILL

#define DARK_FILL   0xB2

Definition at line 309 of file ui.h.

◆ HORZ

#define HORZ   0xC4

Definition at line 343 of file ui.h.

◆ LIGHT_FILL

#define LIGHT_FILL   0xB0

Definition at line 307 of file ui.h.

◆ MEDIUM_FILL

#define MEDIUM_FILL   0xB1

Definition at line 308 of file ui.h.

◆ VERT

#define VERT   0xB3

Definition at line 345 of file ui.h.

Typedef Documentation

◆ PUI_MENU_INFO

◆ PUI_PROGRESS_BAR

◆ PUIVTBL

◆ UI_MENU_INFO

◆ UI_PROGRESS_BAR

◆ UiMenuKeyPressFilterCallback

typedef BOOLEAN(* UiMenuKeyPressFilterCallback) (IN ULONG KeyPress, IN ULONG SelectedMenuItem, IN PVOID Context OPTIONAL)

Definition at line 220 of file ui.h.

◆ UIVTBL

Function Documentation

◆ UiDisplayMenu()

BOOLEAN UiDisplayMenu ( IN PCSTR  MenuHeader,
IN PCSTR MenuFooter  OPTIONAL,
IN BOOLEAN  ShowBootOptions,
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 at line 631 of file ui.c.

643{
644 return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, ShowBootOptions,
645 MenuItemList, MenuItemCount, DefaultMenuItem,
646 MenuTimeOut, SelectedMenuItem, CanEscape,
647 KeyPressFilter, Context);
648}
BOOLEAN(* DisplayMenu)(IN PCSTR MenuHeader, IN PCSTR MenuFooter OPTIONAL, IN BOOLEAN ShowBootOptions, 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.h:284
UIVTBL UiVtbl
Definition: ui.c:70

Referenced by DoOptionsMenu(), and RunLoader().

◆ UiDrawBackdrop()

VOID UiDrawBackdrop ( VOID  )

Definition at line 239 of file ui.c.

240{
242}
VOID(* DrawBackdrop)(VOID)
Definition: ui.h:250

Referenced by DoOptionsMenu(), LoadAndBootWindows(), LoadReactOSSetup(), MiniTuiDrawMenu(), RunLoader(), TuiDrawMenu(), and UiUnInitialize().

◆ UiDrawBox()

VOID UiDrawBox ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
UCHAR  VertStyle,
UCHAR  HorzStyle,
BOOLEAN  Fill,
BOOLEAN  Shadow,
UCHAR  Attr 
)

Definition at line 254 of file ui.c.

255{
256 UiVtbl.DrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr);
257}
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
VOID(* DrawBox)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.h:253

Referenced by TuiDrawMenuBox(), and UiInfoBox().

◆ UiDrawCenteredText()

VOID UiDrawCenteredText ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ PCSTR  TextString,
_In_ UCHAR  Attr 
)

Definition at line 281 of file ui.c.

288{
289 UiVtbl.DrawCenteredText(Left, Top, Right, Bottom, TextString, Attr);
290}
VOID(* DrawCenteredText)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: ui.h:256

Referenced by UiInfoBox().

◆ UiDrawProgressBar()

VOID UiDrawProgressBar ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ PCSTR  ProgressText 
)

Definition at line 514 of file ui.c.

520{
521#ifndef _M_ARM
522 UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, ProgressText);
523#else
524 MiniTuiDrawProgressBar(Left, Top, Right, Bottom, ProgressText);
525#endif
526}
VOID MiniTuiDrawProgressBar(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: minitui.c:178
VOID(* DrawProgressBar)(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: ui.h:265

◆ UiDrawProgressBarCenter()

VOID UiDrawProgressBarCenter ( _In_ PCSTR  ProgressText)

Definition at line 503 of file ui.c.

505{
506#ifndef _M_ARM
507 UiVtbl.DrawProgressBarCenter(ProgressText);
508#else
509 MiniTuiDrawProgressBarCenter(ProgressText);
510#endif
511}
VOID MiniTuiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: minitui.c:153
VOID(* DrawProgressBarCenter)(_In_ PCSTR ProgressText)
Definition: ui.h:262

Referenced by LoadAndBootWindows(), LoadReactOSSetup(), and RamDiskLoadVirtualFile().

◆ UiDrawShadow()

VOID UiDrawShadow ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom 
)

Definition at line 249 of file ui.c.

250{
251 UiVtbl.DrawShadow(Left, Top, Right, Bottom);
252}
VOID(* DrawShadow)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: ui.h:252

◆ UiDrawStatusText()

VOID UiDrawStatusText ( PCSTR  StatusText)

Definition at line 292 of file ui.c.

293{
294 UiVtbl.DrawStatusText(StatusText);
295}
VOID(* DrawStatusText)(PCSTR StatusText)
Definition: ui.h:257

Referenced by LoadAndBootWindows(), LoadReactOSSetup(), NtLdrOutputLoadMsg(), TuiEditBox(), TuiMessageBoxCritical(), UiUnInitialize(), and WinLdrSetupEms().

◆ UiDrawText()

VOID UiDrawText ( _In_ ULONG  X,
_In_ ULONG  Y,
_In_ PCSTR  Text,
_In_ UCHAR  Attr 
)

Definition at line 260 of file ui.c.

265{
266 UiVtbl.DrawText(X, Y, Text, Attr);
267}
char * Text
Definition: combotst.c:136
#define Y(I)
VOID(* DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.h:254

Referenced by DisplayBootTimeOptions(), TuiDrawMenu(), TuiDrawMenuItem(), TuiDrawMenuTimeout(), TuiEditBox(), and TuiMessageBoxCritical().

◆ UiDrawText2()

VOID UiDrawText2 ( _In_ ULONG  X,
_In_ ULONG  Y,
_In_opt_ ULONG  MaxNumChars,
_In_reads_or_z_(MaxNumChars) PCSTR  Text,
_In_ UCHAR  Attr 
)

Definition at line 270 of file ui.c.

276{
277 UiVtbl.DrawText2(X, Y, MaxNumChars, Text, Attr);
278}
VOID(* DrawText2)(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: ui.h:255

Referenced by TuiEditBox().

◆ UiEditBox()

BOOLEAN UiEditBox ( PCSTR  MessageText,
PCHAR  EditTextBuffer,
ULONG  Length 
)

Definition at line 660 of file ui.c.

661{
662 return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
663}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
BOOLEAN(* EditBox)(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.h:278

Referenced by DoOptionsMenu(), and EditCustomBootReactOS().

◆ UiFadeInBackdrop()

VOID UiFadeInBackdrop ( VOID  )

Definition at line 650 of file ui.c.

651{
653}
VOID(* FadeInBackdrop)(VOID)
Definition: ui.h:281

Referenced by UiInitialize().

◆ UiFadeOut()

VOID UiFadeOut ( VOID  )

Definition at line 655 of file ui.c.

656{
657 UiVtbl.FadeOut();
658}
VOID(* FadeOut)(VOID)
Definition: ui.h:282

◆ UiFillArea()

VOID UiFillArea ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
CHAR  FillChar,
UCHAR  Attr 
)

Definition at line 244 of file ui.c.

245{
246 UiVtbl.FillArea(Left, Top, Right, Bottom, FillChar, Attr);
247}
VOID(* FillArea)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: ui.h:251

Referenced by TuiEditBox().

◆ UiIndicateProgress()

VOID UiIndicateProgress ( VOID  )

Definition at line 426 of file ui.c.

427{
428 ULONG Percentage;
429
430 /* Increase progress */
431 UiProgressBar.Indicator.Count++;
432
433 /* Compute the new percentage - Don't go over 100% */
434 Percentage = 100 * UiProgressBar.Indicator.Count /
435 UiProgressBar.Indicator.Expected;
436 Percentage = min(Percentage, 99);
437
438 if (Percentage != UiProgressBar.Indicator.Percentage)
439 {
440 /* Percentage has changed, update the progress bar */
441 UiProgressBar.Indicator.Percentage = Percentage;
442 UiUpdateProgressBar(Percentage, NULL);
443 }
444}
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
struct _UI_PROGRESS_BAR::@175 Indicator
UI_PROGRESS_BAR UiProgressBar
Definition: ui.c:66
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:462

Referenced by WinLdrLoadBootDrivers().

◆ UiInfoBox()

VOID UiInfoBox ( PCSTR  MessageText)

Definition at line 302 of file ui.c.

303{
304 SIZE_T TextLength;
305 ULONG BoxWidth;
306 ULONG BoxHeight;
307 ULONG LineBreakCount;
309 SIZE_T LastIndex;
310 ULONG Left;
311 ULONG Top;
312 ULONG Right;
314
315 TextLength = strlen(MessageText);
316
317 // Count the new lines and the box width
318 LineBreakCount = 0;
319 BoxWidth = 0;
320 LastIndex = 0;
321 for (Index=0; Index<TextLength; Index++)
322 {
323 if (MessageText[Index] == '\n')
324 {
325 LastIndex = Index;
326 LineBreakCount++;
327 }
328 else
329 {
330 if ((Index - LastIndex) > BoxWidth)
331 {
332 BoxWidth = (ULONG)(Index - LastIndex);
333 }
334 }
335 }
336
337 // Calc the box width & height
338 BoxWidth += 6;
339 BoxHeight = LineBreakCount + 4;
340
341 // Calc the box coordinates
342 Left = (UiScreenWidth / 2) - (BoxWidth / 2);
343 Top =(UiScreenHeight / 2) - (BoxHeight / 2);
344 Right = (UiScreenWidth / 2) + (BoxWidth / 2);
345 Bottom = (UiScreenHeight / 2) + (BoxHeight / 2);
346
347 // Draw the box
348 UiDrawBox(Left,
349 Top,
350 Right,
351 Bottom,
352 VERT,
353 HORZ,
354 TRUE,
355 TRUE,
357 );
358
359 // Draw the text
360 UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
361}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
ULONG_PTR SIZE_T
Definition: typedefs.h:80
ULONG UiScreenWidth
Definition: ui.c:56
UCHAR UiTextColor
Definition: ui.c:38
UCHAR UiMenuBgColor
Definition: ui.c:37
ULONG UiScreenHeight
Definition: ui.c:57
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.c:254
UCHAR UiMenuFgColor
Definition: ui.c:36
VOID UiDrawCenteredText(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
Definition: ui.c:281
#define VERT
Definition: ui.h:345
#define ATTR(cFore, cBack)
Definition: ui.h:314
#define HORZ
Definition: ui.h:343
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by UiUnInitialize().

◆ UiInit()

VOID UiInit ( const char CmdLine)

◆ UiInitialize()

BOOLEAN UiInitialize ( BOOLEAN  ShowUi)

Definition at line 98 of file ui.c.

99{
100 VIDEODISPLAYMODE UiDisplayMode; // Tells us if we are in text or graphics mode
101 BOOLEAN UiMinimal = FALSE; // Tells us if we are using a minimal console-like UI
102 ULONG_PTR SectionId;
103 ULONG Depth;
104 CHAR SettingText[260];
105
106 if (!ShowUi)
107 {
108 if (!UiVtbl.Initialize())
109 {
111 return FALSE;
112 }
113 return TRUE;
114 }
115
116 TRACE("Initializing User Interface.\n");
117 TRACE("Reading UI settings from [Display] section.\n");
118
119 /* Open the [Display] section */
120 if (!IniOpenSection("Display", &SectionId))
121 SectionId = 0;
122
123 /* Select the video mode */
124 SettingText[0] = '\0';
125 if ((SectionId != 0) && !IniReadSettingByName(SectionId, "DisplayMode", SettingText, sizeof(SettingText)))
126 {
127 SettingText[0] = '\0';
128 }
129 UiDisplayMode = MachVideoSetDisplayMode(SettingText, TRUE);
131
132 /* Select the UI */
133 if ((SectionId != 0) && IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText)))
134 {
135 UiMinimal = (_stricmp(SettingText, "Yes") == 0);
136 }
137
138 if (UiDisplayMode == VideoGraphicsMode)
139#if 0 // We don't support a GUI mode yet.
140 UiVtbl = GuiVtbl;
141#else
142 {
143 // Switch back to text mode.
145 UiDisplayMode = VideoTextMode;
146 }
147#endif
148 else // if (UiDisplayMode == VideoTextMode)
149 UiVtbl = (UiMinimal ? MiniTuiVtbl : TuiVtbl);
150
151 /* Load the UI and initialize its default settings */
152 if (!UiVtbl.Initialize())
153 {
155 return FALSE;
156 }
157
158 /* Load the user UI settings */
159 if (SectionId != 0)
160 {
161 static const struct
162 {
163 PCSTR SettingName;
164 PVOID SettingVar;
165 SIZE_T SettingSize OPTIONAL; // Must be non-zero only for text buffers.
166 UCHAR SettingType; // 0: Text, 1: Yes/No, 2: Color, 3: Fill style
167 } Settings[] =
168 {
169 {"TitleText", &UiTitleBoxTitleText, sizeof(UiTitleBoxTitleText), 0},
170 {"TimeText" , &UiTimeText, sizeof(UiTimeText), 0},
171
172 {"ShowTime" , &UiShowTime , 0, 1},
173 {"MenuBox" , &UiMenuBox , 0, 1},
174 {"CenterMenu" , &UiCenterMenu , 0, 1},
175 {"SpecialEffects", &UiUseSpecialEffects, 0, 1},
176
177 {"BackdropColor" , &UiBackdropBgColor , 0, 2},
178 {"BackdropTextColor" , &UiBackdropFgColor , 0, 2},
179 {"StatusBarColor" , &UiStatusBarBgColor , 0, 2},
180 {"StatusBarTextColor" , &UiStatusBarFgColor , 0, 2},
181 {"TitleBoxColor" , &UiTitleBoxBgColor , 0, 2},
182 {"TitleBoxTextColor" , &UiTitleBoxFgColor , 0, 2},
183 {"MessageBoxColor" , &UiMessageBoxBgColor , 0, 2},
184 {"MessageBoxTextColor", &UiMessageBoxFgColor , 0, 2},
185 {"MenuColor" , &UiMenuBgColor , 0, 2},
186 {"MenuTextColor" , &UiMenuFgColor , 0, 2},
187 {"TextColor" , &UiTextColor , 0, 2},
188 {"SelectedColor" , &UiSelectedTextBgColor, 0, 2},
189 {"SelectedTextColor" , &UiSelectedTextColor , 0, 2},
190 {"EditBoxColor" , &UiEditBoxBgColor , 0, 2},
191 {"EditBoxTextColor" , &UiEditBoxTextColor , 0, 2},
192
193 {"BackdropFillStyle", &UiBackdropFillStyle, 0, 3},
194 };
195 ULONG i;
196
197 for (i = 0; i < RTL_NUMBER_OF(Settings); ++i)
198 {
199 if (!IniReadSettingByName(SectionId, Settings[i].SettingName, SettingText, sizeof(SettingText)))
200 continue;
201
202 switch (Settings[i].SettingType)
203 {
204 case 0: // Text
205 RtlStringCbCopyA((PCHAR)Settings[i].SettingVar,
206 Settings[i].SettingSize, SettingText);
207 break;
208 case 1: // Yes/No
209 *(PBOOLEAN)Settings[i].SettingVar = (_stricmp(SettingText, "Yes") == 0);
210 break;
211 case 2: // Color
212 *(PUCHAR)Settings[i].SettingVar = UiTextToColor(SettingText);
213 break;
214 case 3: // Fill style
215 *(PUCHAR)Settings[i].SettingVar = UiTextToFillStyle(SettingText);
216 break;
217 default:
218 break;
219 }
220 }
221 }
222
223 /* Draw the backdrop and fade it in if special effects are enabled */
225
226 TRACE("UiInitialize() returning TRUE.\n");
227 return TRUE;
228}
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
@ VideoTextMode
Definition: machine.h:35
@ VideoGraphicsMode
Definition: machine.h:36
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:94
#define MachVideoGetDisplaySize(W, H, D)
Definition: machine.h:96
enum tagVIDEODISPLAYMODE VIDEODISPLAYMODE
const UIVTBL GuiVtbl
Definition: gui.c:85
#define _stricmp
Definition: cat.c:22
#define FALSE
Definition: types.h:117
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
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
Definition: inifile.c:147
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
signed char * PCHAR
Definition: retypes.h:7
char * PBOOLEAN
Definition: retypes.h:11
unsigned char * PUCHAR
Definition: retypes.h:3
const UIVTBL MiniTuiVtbl
Definition: minitui.c:249
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
#define TRACE(s)
Definition: solgame.cpp:4
BOOLEAN(* Initialize)(VOID)
Definition: ui.h:247
const UIVTBL TuiVtbl
Definition: tui.c:1217
#define OPTIONAL
Definition: typedefs.h:41
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
UCHAR UiMessageBoxFgColor
Definition: ui.c:34
UCHAR UiTextToFillStyle(PCSTR FillStyleText)
Definition: ui.c:384
UCHAR UiMessageBoxBgColor
Definition: ui.c:35
UCHAR UiTextToColor(PCSTR ColorText)
Definition: ui.c:379
UCHAR UiEditBoxTextColor
Definition: ui.c:41
UCHAR UiStatusBarBgColor
Definition: ui.c:28
BOOLEAN UiUseSpecialEffects
Definition: ui.c:47
BOOLEAN UiCenterMenu
Definition: ui.c:46
UCHAR UiTitleBoxBgColor
Definition: ui.c:33
CHAR UiTimeText[260]
Definition: ui.c:50
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:49
UCHAR UiTitleBoxFgColor
Definition: ui.c:32
UCHAR UiBackdropFgColor
Definition: ui.c:29
BOOLEAN UiShowTime
Definition: ui.c:44
UCHAR UiBackdropFillStyle
Definition: ui.c:31
UCHAR UiBackdropBgColor
Definition: ui.c:30
BOOLEAN UiMenuBox
Definition: ui.c:45
UCHAR UiStatusBarFgColor
Definition: ui.c:27
UCHAR UiSelectedTextColor
Definition: ui.c:39
UCHAR UiSelectedTextBgColor
Definition: ui.c:40
UCHAR UiEditBoxBgColor
Definition: ui.c:42
VOID UiFadeInBackdrop(VOID)
Definition: ui.c:650
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175

Referenced by BootMain(), RunLoader(), and UiResetForSOS().

◆ UiInitProgressBar()

VOID UiInitProgressBar ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ PCSTR  ProgressText 
)

Definition at line 392 of file ui.c.

398{
399 /* Progress bar area */
400 UiProgressBar.Left = Left;
402 UiProgressBar.Right = Right;
404 // UiProgressBar.Width = Right - Left + 1;
405
406 /* Set the progress bar ranges */
408 UiProgressBar.Indicator.Count = 0;
409 UiProgressBar.Indicator.Expected = 25;
410 UiProgressBar.Indicator.Percentage = 0;
411
412 /* Enable the progress bar */
414
415 /* Initial drawing: set the "Loading..." text and the original position */
416#ifndef _M_ARM
417 UiVtbl.SetProgressBarText(ProgressText);
419#else
420 MiniTuiSetProgressBarText(ProgressText);
422#endif
423}
VOID MiniTuiTickProgressBar(_In_ ULONG SubPercentTimes100)
Definition: minitui.c:115
VOID MiniTuiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: minitui.c:77
ULONG Top
Definition: ui.h:125
ULONG Bottom
Definition: ui.h:127
BOOLEAN Show
Definition: ui.h:129
ULONG Left
Definition: ui.h:124
ULONG Right
Definition: ui.h:126
VOID(* TickProgressBar)(_In_ ULONG SubPercentTimes100)
Definition: ui.h:275
VOID(* SetProgressBarText)(_In_ PCSTR ProgressText)
Definition: ui.h:272
VOID UiSetProgressBarSubset(_In_ ULONG Floor, _In_ ULONG Ceiling)
Definition: ui.c:447

Referenced by MiniTuiDrawProgressBar(), and TuiDrawProgressBar().

◆ UiMessageBox()

VOID UiMessageBox ( PCSTR  Format,
  ... 
)

◆ UiMessageBoxCritical()

VOID UiMessageBoxCritical ( PCSTR  MessageText)

Definition at line 374 of file ui.c.

375{
376 UiVtbl.MessageBoxCritical(MessageText);
377}
VOID(* MessageBoxCritical)(PCSTR MessageText)
Definition: ui.h:260

Referenced by BootMain(), IniFileInitialize(), KeBugCheckEx(), MmAllocateHighestMemoryBelowAddress(), MmAllocateMemoryAtAddress(), MmAllocateMemoryWithType(), and RunLoader().

◆ UiSetProgressBarSubset()

VOID UiSetProgressBarSubset ( _In_ ULONG  Floor,
_In_ ULONG  Ceiling 
)

Definition at line 447 of file ui.c.

450{
451 /* Sanity checks */
452 ASSERT(Floor < Ceiling);
453 ASSERT(Ceiling <= 100);
454
455 /* Update the progress bar state */
456 UiProgressBar.State.Floor = Floor * 100;
457 // UiProgressBar.State.Ceiling = Ceiling * 100;
458 UiProgressBar.State.Bias = Ceiling - Floor;
459}
#define ASSERT(a)
Definition: mode.c:44
struct _UI_PROGRESS_BAR::@174 State

Referenced by LoadAndBootWindowsCommon(), and UiInitProgressBar().

◆ UiSetProgressBarText()

VOID UiSetProgressBarText ( _In_ PCSTR  ProgressText)

Definition at line 488 of file ui.c.

490{
491 /* Make sure the progress bar is enabled */
492 if (!UiProgressBar.Show)
493 return;
494
495#ifndef _M_ARM
496 UiVtbl.SetProgressBarText(ProgressText);
497#else
498 MiniTuiSetProgressBarText(ProgressText);
499#endif
500}

Referenced by LoadAndBootWindowsCommon(), and UiUpdateProgressBar().

◆ UiShowMessageBoxesInArgv()

VOID UiShowMessageBoxesInArgv ( IN ULONG  Argc,
IN PCHAR  Argv[] 
)

Definition at line 594 of file ui.c.

597{
598 ULONG LastIndex;
599 PCSTR ArgValue;
600 PCHAR MessageBoxText;
601 SIZE_T MessageBoxTextSize;
602
603 /* Find all the message box settings and run them */
604 for (LastIndex = 0;
605 (ArgValue = GetNextArgumentValue(Argc, Argv, &LastIndex, "MessageBox")) != NULL;
606 ++LastIndex)
607 {
608 /* Get the real length of the MessageBox text */
609 MessageBoxTextSize = (strlen(ArgValue) + 1) * sizeof(CHAR);
610
611 /* Allocate enough memory to hold the text */
612 MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
613 if (!MessageBoxText)
614 continue;
615
616 /* Get the MessageBox text */
617 strcpy(MessageBoxText, ArgValue);
618
619 /* Fix it up */
620 UiEscapeString(MessageBoxText);
621
622 /* Display it */
623 UiMessageBox(MessageBoxText);
624
625 /* Free the memory */
626 FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
627 }
628}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
PCHAR GetNextArgumentValue(IN ULONG Argc, IN PCHAR Argv[], IN OUT PULONG LastIndex OPTIONAL, IN PCHAR ArgumentName)
Definition: arcsupp.c:15
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197
static VOID UiEscapeString(PCHAR String)
Definition: ui.c:531
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:363
#define TAG_UI_TEXT
Definition: ui.c:54

◆ UiShowMessageBoxesInSection()

VOID UiShowMessageBoxesInSection ( IN ULONG_PTR  SectionId)

Definition at line 550 of file ui.c.

552{
553 ULONG Idx;
554 CHAR SettingName[80];
555 CHAR SettingValue[80];
556 PCHAR MessageBoxText;
557 ULONG MessageBoxTextSize;
558
559 if (SectionId == 0)
560 return;
561
562 /* Find all the message box settings and run them */
563 for (Idx = 0; Idx < IniGetNumSectionItems(SectionId); Idx++)
564 {
565 IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue));
566 if (_stricmp(SettingName, "MessageBox") != 0)
567 continue;
568
569 /* Get the real length of the MessageBox text */
570 MessageBoxTextSize = IniGetSectionSettingValueSize(SectionId, Idx);
571 // if (MessageBoxTextSize <= 0)
572 // continue;
573
574 /* Allocate enough memory to hold the text */
575 MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
576 if (!MessageBoxText)
577 continue;
578
579 /* Get the MessageBox text */
580 IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), MessageBoxText, MessageBoxTextSize);
581
582 /* Fix it up */
583 UiEscapeString(MessageBoxText);
584
585 /* Display it */
586 UiMessageBox(MessageBoxText);
587
588 /* Free the memory */
589 FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
590 }
591}
ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:101
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
Definition: inifile.c:54
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
Definition: inifile.c:114

Referenced by RunLoader().

◆ UiTextToColor()

UCHAR UiTextToColor ( PCSTR  ColorText)

Definition at line 379 of file ui.c.

380{
381 return UiVtbl.TextToColor(ColorText);
382}
UCHAR(* TextToColor)(PCSTR ColorText)
Definition: ui.h:279

Referenced by UiInitialize().

◆ UiTextToFillStyle()

UCHAR UiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 384 of file ui.c.

385{
386 return UiVtbl.TextToFillStyle(FillStyleText);
387}
UCHAR(* TextToFillStyle)(PCSTR FillStyleText)
Definition: ui.h:280

Referenced by UiInitialize().

◆ UiUnInitialize()

VOID UiUnInitialize ( PCSTR  BootText)

Definition at line 230 of file ui.c.

231{
233 UiDrawStatusText(BootText);
234 UiInfoBox(BootText);
235
237}
VOID(* UnInitialize)(VOID)
Definition: ui.h:248
VOID UiInfoBox(PCSTR MessageText)
Definition: ui.c:302
VOID UiDrawBackdrop(VOID)
Definition: ui.c:239
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:292

Referenced by RunLoader().

◆ UiUpdateDateTime()

VOID UiUpdateDateTime ( VOID  )

Definition at line 297 of file ui.c.

298{
300}
VOID(* UpdateDateTime)(VOID)
Definition: ui.h:258

◆ UiUpdateProgressBar()

VOID UiUpdateProgressBar ( _In_ ULONG  Percentage,
_In_opt_ PCSTR  ProgressText 
)

Definition at line 462 of file ui.c.

465{
466 ULONG TotalProgress;
467
468 /* Make sure the progress bar is enabled */
469 if (!UiProgressBar.Show)
470 return;
471
472 /* Set the progress text if specified */
473 if (ProgressText)
474 UiSetProgressBarText(ProgressText);
475
476 /* Compute the total progress and tick the progress bar */
477 TotalProgress = UiProgressBar.State.Floor + (Percentage * UiProgressBar.State.Bias);
478 // TotalProgress /= (100 * 100);
479
480#ifndef _M_ARM
481 UiVtbl.TickProgressBar(TotalProgress);
482#else
483 MiniTuiTickProgressBar(TotalProgress);
484#endif
485}
VOID UiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: ui.c:488

Referenced by LoadAndBootWindows(), LoadAndBootWindowsCommon(), LoadModule(), LoadReactOSSetup(), RamDiskLoadVirtualFile(), and UiIndicateProgress().

Variable Documentation

◆ UiBackdropBgColor

UCHAR UiBackdropBgColor
extern

◆ UiBackdropFgColor

UCHAR UiBackdropFgColor
extern

◆ UiBackdropFillStyle

UCHAR UiBackdropFillStyle
extern

◆ UiCenterMenu

BOOLEAN UiCenterMenu
extern

◆ UiEditBoxBgColor

UCHAR UiEditBoxBgColor
extern

Definition at line 42 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), and UiInitialize().

◆ UiEditBoxTextColor

UCHAR UiEditBoxTextColor
extern

Definition at line 41 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), and UiInitialize().

◆ UiMenuBgColor

◆ UiMenuBox

BOOLEAN UiMenuBox
extern

◆ UiMenuFgColor

◆ UiMessageBoxBgColor

UCHAR UiMessageBoxBgColor
extern

Definition at line 35 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), TuiMessageBoxCritical(), and UiInitialize().

◆ UiMessageBoxFgColor

UCHAR UiMessageBoxFgColor
extern

Definition at line 34 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), TuiMessageBoxCritical(), and UiInitialize().

◆ UiMonthNames

const PCSTR UiMonthNames[12]
extern

Definition at line 52 of file ui.c.

Referenced by TuiUpdateDateTime().

◆ UiProgressBar

◆ UiScreenHeight

◆ UiScreenWidth

◆ UiSelectedTextBgColor

UCHAR UiSelectedTextBgColor
extern

Definition at line 40 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawMenuItem(), TuiInitialize(), and UiInitialize().

◆ UiSelectedTextColor

UCHAR UiSelectedTextColor
extern

Definition at line 39 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawMenuItem(), TuiInitialize(), and UiInitialize().

◆ UiShowTime

BOOLEAN UiShowTime
extern

Definition at line 44 of file ui.c.

Referenced by MiniTuiInitialize(), TuiInitialize(), TuiUpdateDateTime(), and UiInitialize().

◆ UiStatusBarBgColor

UCHAR UiStatusBarBgColor
extern

Definition at line 28 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawStatusText(), TuiInitialize(), and UiInitialize().

◆ UiStatusBarFgColor

UCHAR UiStatusBarFgColor
extern

Definition at line 27 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawStatusText(), TuiInitialize(), and UiInitialize().

◆ UiTextColor

◆ UiTimeText

CHAR UiTimeText[260]
extern

Definition at line 50 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawMenuTimeout(), TuiInitialize(), and UiInitialize().

◆ UiTitleBoxBgColor

UCHAR UiTitleBoxBgColor
extern

◆ UiTitleBoxFgColor

UCHAR UiTitleBoxFgColor
extern

◆ UiTitleBoxTitleText

CHAR UiTitleBoxTitleText[260]
extern

Definition at line 49 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawBackdrop(), TuiInitialize(), and UiInitialize().

◆ UiUseSpecialEffects

BOOLEAN UiUseSpecialEffects
extern

◆ UiVtbl