ReactOS 0.4.15-dev-7924-g5949c20
ui.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for ui.c:

Go to the source code of this file.

Macros

#define TAG_UI_TEXT   'xTiU'
 

Functions

 DBG_DEFAULT_CHANNEL (UI)
 
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 (_In_ PCSTR MessageText)
 
VOID UiMessageBox (_In_ PCSTR Format,...)
 
VOID UiMessageBoxCritical (_In_ PCSTR MessageText)
 
UCHAR UiTextToColor (PCSTR ColorText)
 
UCHAR UiTextToFillStyle (PCSTR FillStyleText)
 
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)
 
static VOID UiEscapeString (PCHAR String)
 
VOID UiShowMessageBoxesInSection (IN ULONG_PTR SectionId)
 
VOID UiShowMessageBoxesInArgv (IN ULONG Argc, IN PCHAR Argv[])
 
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 UiFadeInBackdrop (VOID)
 
VOID UiFadeOut (VOID)
 
BOOLEAN UiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 

Variables

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] = "Boot Menu"
 
CHAR UiTimeText [260] = "[Time Remaining: %d]"
 
const PCSTR UiMonthNames [12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }
 
ULONG UiScreenWidth
 
ULONG UiScreenHeight
 
UI_PROGRESS_BAR UiProgressBar = {{0}}
 
UIVTBL UiVtbl
 

Macro Definition Documentation

◆ TAG_UI_TEXT

#define TAG_UI_TEXT   'xTiU'

Definition at line 52 of file ui.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UI  )

◆ 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 605 of file ui.c.

617{
618 return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, ShowBootOptions,
619 MenuItemList, MenuItemCount, DefaultMenuItem,
620 MenuTimeOut, SelectedMenuItem, CanEscape,
621 KeyPressFilter, Context);
622}
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:287
UIVTBL UiVtbl
Definition: ui.c:64

Referenced by DoOptionsMenu(), and RunLoader().

◆ UiDrawBackdrop()

VOID UiDrawBackdrop ( VOID  )

Definition at line 233 of file ui.c.

234{
236}
VOID(* DrawBackdrop)(VOID)
Definition: ui.h:253

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 248 of file ui.c.

249{
250 UiVtbl.DrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr);
251}
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:107
VOID(* DrawBox)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.h:256

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 275 of file ui.c.

282{
283 UiVtbl.DrawCenteredText(Left, Top, Right, Bottom, TextString, Attr);
284}
VOID(* DrawCenteredText)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: ui.h:259

Referenced by UiInfoBox().

◆ UiDrawProgressBar()

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

Definition at line 494 of file ui.c.

500{
501 UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, ProgressText);
502}
VOID(* DrawProgressBar)(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: ui.h:268

◆ UiDrawProgressBarCenter()

VOID UiDrawProgressBarCenter ( _In_ PCSTR  ProgressText)

Definition at line 487 of file ui.c.

489{
490 UiVtbl.DrawProgressBarCenter(ProgressText);
491}
VOID(* DrawProgressBarCenter)(_In_ PCSTR ProgressText)
Definition: ui.h:265

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

◆ UiDrawShadow()

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

Definition at line 243 of file ui.c.

244{
245 UiVtbl.DrawShadow(Left, Top, Right, Bottom);
246}
VOID(* DrawShadow)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: ui.h:255

◆ UiDrawStatusText()

VOID UiDrawStatusText ( PCSTR  StatusText)

Definition at line 286 of file ui.c.

287{
288 UiVtbl.DrawStatusText(StatusText);
289}
VOID(* DrawStatusText)(PCSTR StatusText)
Definition: ui.h:260

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 254 of file ui.c.

259{
260 UiVtbl.DrawText(X, Y, Text, Attr);
261}
char * Text
Definition: combotst.c:136
#define Y(I)
VOID(* DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.h:257

Referenced by DisplayBootTimeOptions(), TuiDrawMenuItem(), TuiDrawMenuTimeout(), TuiDrawMsgBoxCommon(), 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 264 of file ui.c.

270{
271 UiVtbl.DrawText2(X, Y, MaxNumChars, Text, Attr);
272}
VOID(* DrawText2)(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: ui.h:258

Referenced by TuiEditBox().

◆ UiEditBox()

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

Definition at line 634 of file ui.c.

635{
636 return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
637}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
BOOLEAN(* EditBox)(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.h:281

Referenced by DoOptionsMenu(), and EditCustomBootReactOS().

◆ UiEscapeString()

static VOID UiEscapeString ( PCHAR  String)
static

Definition at line 505 of file ui.c.

506{
507 ULONG Idx;
508
509 for (Idx=0; Idx<strlen(String); Idx++)
510 {
511 // Escape the new line characters
512 if (String[Idx] == '\\' && String[Idx+1] == 'n')
513 {
514 // Escape the character
515 String[Idx] = '\n';
516
517 // Move the rest of the string up
518 strcpy(&String[Idx+1], &String[Idx+2]);
519 }
520 }
521}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

Referenced by UiShowMessageBoxesInArgv(), and UiShowMessageBoxesInSection().

◆ UiFadeInBackdrop()

VOID UiFadeInBackdrop ( VOID  )

Definition at line 624 of file ui.c.

625{
627}
VOID(* FadeInBackdrop)(VOID)
Definition: ui.h:284

Referenced by UiInitialize().

◆ UiFadeOut()

VOID UiFadeOut ( VOID  )

Definition at line 629 of file ui.c.

630{
631 UiVtbl.FadeOut();
632}
VOID(* FadeOut)(VOID)
Definition: ui.h:285

◆ UiFillArea()

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

Definition at line 238 of file ui.c.

239{
240 UiVtbl.FillArea(Left, Top, Right, Bottom, FillChar, Attr);
241}
VOID(* FillArea)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: ui.h:254

Referenced by TuiEditBox().

◆ UiIndicateProgress()

VOID UiIndicateProgress ( VOID  )

Definition at line 418 of file ui.c.

419{
420 ULONG Percentage;
421
422 /* Increase progress */
423 UiProgressBar.Indicator.Count++;
424
425 /* Compute the new percentage - Don't go over 100% */
426 Percentage = 100 * UiProgressBar.Indicator.Count /
427 UiProgressBar.Indicator.Expected;
428 Percentage = min(Percentage, 99);
429
430 if (Percentage != UiProgressBar.Indicator.Percentage)
431 {
432 /* Percentage has changed, update the progress bar */
433 UiProgressBar.Indicator.Percentage = Percentage;
434 UiUpdateProgressBar(Percentage, NULL);
435 }
436}
#define NULL
Definition: types.h:112
#define min(a, b)
Definition: monoChain.cc:55
struct _UI_PROGRESS_BAR::@185 Indicator
UI_PROGRESS_BAR UiProgressBar
Definition: ui.c:62
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:454

Referenced by WinLdrLoadBootDrivers().

◆ UiInfoBox()

VOID UiInfoBox ( _In_ PCSTR  MessageText)

Definition at line 297 of file ui.c.

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

Referenced by UiUnInitialize().

◆ UiInitialize()

BOOLEAN UiInitialize ( BOOLEAN  ShowUi)

Definition at line 92 of file ui.c.

93{
94 VIDEODISPLAYMODE UiDisplayMode; // Tells us if we are in text or graphics mode
95 BOOLEAN UiMinimal = FALSE; // Tells us if we are using a minimal console-like UI
96 ULONG_PTR SectionId;
98 CHAR SettingText[260];
99
100 if (!ShowUi)
101 {
102 if (!UiVtbl.Initialize())
103 {
105 return FALSE;
106 }
107 return TRUE;
108 }
109
110 TRACE("Initializing User Interface.\n");
111 TRACE("Reading UI settings from [Display] section.\n");
112
113 /* Open the [Display] section */
114 if (!IniOpenSection("Display", &SectionId))
115 SectionId = 0;
116
117 /* Select the video mode */
118 SettingText[0] = '\0';
119 if ((SectionId != 0) && !IniReadSettingByName(SectionId, "DisplayMode", SettingText, sizeof(SettingText)))
120 {
121 SettingText[0] = '\0';
122 }
123 UiDisplayMode = MachVideoSetDisplayMode(SettingText, TRUE);
125
126 /* Select the UI */
127 if ((SectionId != 0) && IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText)))
128 {
129 UiMinimal = (_stricmp(SettingText, "Yes") == 0);
130 }
131
132 if (UiDisplayMode == VideoGraphicsMode)
133#if 0 // We don't support a GUI mode yet.
134 UiVtbl = GuiVtbl;
135#else
136 {
137 // Switch back to text mode.
139 UiDisplayMode = VideoTextMode;
140 }
141#endif
142 else // if (UiDisplayMode == VideoTextMode)
143 UiVtbl = (UiMinimal ? MiniTuiVtbl : TuiVtbl);
144
145 /* Load the UI and initialize its default settings */
146 if (!UiVtbl.Initialize())
147 {
149 return FALSE;
150 }
151
152 /* Load the user UI settings */
153 if (SectionId != 0)
154 {
155 static const struct
156 {
157 PCSTR SettingName;
158 PVOID SettingVar;
159 SIZE_T SettingSize OPTIONAL; // Must be non-zero only for text buffers.
160 UCHAR SettingType; // 0: Text, 1: Yes/No, 2: Color, 3: Fill style
161 } Settings[] =
162 {
163 {"TitleText", &UiTitleBoxTitleText, sizeof(UiTitleBoxTitleText), 0},
164 {"TimeText" , &UiTimeText, sizeof(UiTimeText), 0},
165
166 {"ShowTime" , &UiShowTime , 0, 1},
167 {"MenuBox" , &UiMenuBox , 0, 1},
168 {"CenterMenu" , &UiCenterMenu , 0, 1},
169 {"SpecialEffects", &UiUseSpecialEffects, 0, 1},
170
171 {"BackdropColor" , &UiBackdropBgColor , 0, 2},
172 {"BackdropTextColor" , &UiBackdropFgColor , 0, 2},
173 {"StatusBarColor" , &UiStatusBarBgColor , 0, 2},
174 {"StatusBarTextColor" , &UiStatusBarFgColor , 0, 2},
175 {"TitleBoxColor" , &UiTitleBoxBgColor , 0, 2},
176 {"TitleBoxTextColor" , &UiTitleBoxFgColor , 0, 2},
177 {"MessageBoxColor" , &UiMessageBoxBgColor , 0, 2},
178 {"MessageBoxTextColor", &UiMessageBoxFgColor , 0, 2},
179 {"MenuColor" , &UiMenuBgColor , 0, 2},
180 {"MenuTextColor" , &UiMenuFgColor , 0, 2},
181 {"TextColor" , &UiTextColor , 0, 2},
182 {"SelectedColor" , &UiSelectedTextBgColor, 0, 2},
183 {"SelectedTextColor" , &UiSelectedTextColor , 0, 2},
184 {"EditBoxColor" , &UiEditBoxBgColor , 0, 2},
185 {"EditBoxTextColor" , &UiEditBoxTextColor , 0, 2},
186
187 {"BackdropFillStyle", &UiBackdropFillStyle, 0, 3},
188 };
189 ULONG i;
190
191 for (i = 0; i < RTL_NUMBER_OF(Settings); ++i)
192 {
193 if (!IniReadSettingByName(SectionId, Settings[i].SettingName, SettingText, sizeof(SettingText)))
194 continue;
195
196 switch (Settings[i].SettingType)
197 {
198 case 0: // Text
199 RtlStringCbCopyA((PCHAR)Settings[i].SettingVar,
200 Settings[i].SettingSize, SettingText);
201 break;
202 case 1: // Yes/No
203 *(PBOOLEAN)Settings[i].SettingVar = (_stricmp(SettingText, "Yes") == 0);
204 break;
205 case 2: // Color
206 *(PUCHAR)Settings[i].SettingVar = UiTextToColor(SettingText);
207 break;
208 case 3: // Fill style
209 *(PUCHAR)Settings[i].SettingVar = UiTextToFillStyle(SettingText);
210 break;
211 default:
212 break;
213 }
214 }
215 }
216
217 /* Draw the backdrop and fade it in if special effects are enabled */
219
220 TRACE("UiInitialize() returning TRUE.\n");
221 return TRUE;
222}
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:94
#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:149
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
const UIVTBL MiniTuiVtbl
Definition: minitui.c:237
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:250
const UIVTBL TuiVtbl
Definition: tui.c:1219
#define OPTIONAL
Definition: typedefs.h:41
unsigned char * PBOOLEAN
Definition: typedefs.h:53
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
char * PCHAR
Definition: typedefs.h:51
UCHAR UiMessageBoxFgColor
Definition: ui.c:32
UCHAR UiTextToFillStyle(PCSTR FillStyleText)
Definition: ui.c:383
UCHAR UiMessageBoxBgColor
Definition: ui.c:33
UCHAR UiTextToColor(PCSTR ColorText)
Definition: ui.c:378
UCHAR UiEditBoxTextColor
Definition: ui.c:39
UCHAR UiStatusBarBgColor
Definition: ui.c:26
BOOLEAN UiUseSpecialEffects
Definition: ui.c:45
BOOLEAN UiCenterMenu
Definition: ui.c:44
UCHAR UiTitleBoxBgColor
Definition: ui.c:31
CHAR UiTimeText[260]
Definition: ui.c:48
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:47
UCHAR UiTitleBoxFgColor
Definition: ui.c:30
UCHAR UiBackdropFgColor
Definition: ui.c:27
BOOLEAN UiShowTime
Definition: ui.c:42
UCHAR UiBackdropFillStyle
Definition: ui.c:29
UCHAR UiBackdropBgColor
Definition: ui.c:28
BOOLEAN UiMenuBox
Definition: ui.c:43
UCHAR UiStatusBarFgColor
Definition: ui.c:25
UCHAR UiSelectedTextColor
Definition: ui.c:37
UCHAR UiSelectedTextBgColor
Definition: ui.c:38
UCHAR UiEditBoxBgColor
Definition: ui.c:40
VOID UiFadeInBackdrop(VOID)
Definition: ui.c:624
_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(), EfiEntry(), RunLoader(), and UiResetForSOS().

◆ UiInitProgressBar()

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

Definition at line 389 of file ui.c.

395{
396 /* Progress bar area */
397 UiProgressBar.Left = Left;
399 UiProgressBar.Right = Right;
401 // UiProgressBar.Width = Right - Left + 1;
402
403 /* Set the progress bar ranges */
405 UiProgressBar.Indicator.Count = 0;
406 UiProgressBar.Indicator.Expected = 25;
407 UiProgressBar.Indicator.Percentage = 0;
408
409 /* Enable the progress bar */
411
412 /* Initial drawing: set the "Loading..." text and the original position */
413 UiVtbl.SetProgressBarText(ProgressText);
415}
ULONG Top
Definition: ui.h:132
ULONG Bottom
Definition: ui.h:134
BOOLEAN Show
Definition: ui.h:136
ULONG Left
Definition: ui.h:131
ULONG Right
Definition: ui.h:133
VOID(* TickProgressBar)(_In_ ULONG SubPercentTimes100)
Definition: ui.h:278
VOID(* SetProgressBarText)(_In_ PCSTR ProgressText)
Definition: ui.h:275
VOID UiSetProgressBarSubset(_In_ ULONG Floor, _In_ ULONG Ceiling)
Definition: ui.c:439

Referenced by MiniTuiDrawProgressBar(), and TuiDrawProgressBar().

◆ UiMessageBox()

VOID UiMessageBox ( _In_ PCSTR  Format,
  ... 
)

◆ UiMessageBoxCritical()

VOID UiMessageBoxCritical ( _In_ PCSTR  MessageText)

◆ UiSetProgressBarSubset()

VOID UiSetProgressBarSubset ( _In_ ULONG  Floor,
_In_ ULONG  Ceiling 
)

Definition at line 439 of file ui.c.

442{
443 /* Sanity checks */
444 ASSERT(Floor < Ceiling);
445 ASSERT(Ceiling <= 100);
446
447 /* Update the progress bar state */
448 UiProgressBar.State.Floor = Floor * 100;
449 // UiProgressBar.State.Ceiling = Ceiling * 100;
450 UiProgressBar.State.Bias = Ceiling - Floor;
451}
#define ASSERT(a)
Definition: mode.c:44
struct _UI_PROGRESS_BAR::@184 State

Referenced by LoadAndBootWindowsCommon(), and UiInitProgressBar().

◆ UiSetProgressBarText()

VOID UiSetProgressBarText ( _In_ PCSTR  ProgressText)

Definition at line 476 of file ui.c.

478{
479 /* Make sure the progress bar is enabled */
480 if (!UiProgressBar.Show)
481 return;
482
483 UiVtbl.SetProgressBarText(ProgressText);
484}

Referenced by LoadAndBootWindowsCommon(), and UiUpdateProgressBar().

◆ UiShowMessageBoxesInArgv()

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

Definition at line 568 of file ui.c.

571{
572 ULONG LastIndex;
573 PCSTR ArgValue;
574 PCHAR MessageBoxText;
575 SIZE_T MessageBoxTextSize;
576
577 /* Find all the message box settings and run them */
578 for (LastIndex = 0;
579 (ArgValue = GetNextArgumentValue(Argc, Argv, &LastIndex, "MessageBox")) != NULL;
580 ++LastIndex)
581 {
582 /* Get the real length of the MessageBox text */
583 MessageBoxTextSize = (strlen(ArgValue) + 1) * sizeof(CHAR);
584
585 /* Allocate enough memory to hold the text */
586 MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
587 if (!MessageBoxText)
588 continue;
589
590 /* Get the MessageBox text */
591 strcpy(MessageBoxText, ArgValue);
592
593 /* Fix it up */
594 UiEscapeString(MessageBoxText);
595
596 /* Display it */
597 UiMessageBox(MessageBoxText);
598
599 /* Free the memory */
600 FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
601 }
602}
PSTR GetNextArgumentValue(_In_ ULONG Argc, _In_ PCHAR Argv[], _Inout_opt_ PULONG LastIndex, _In_ PCSTR 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:505
VOID UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
#define TAG_UI_TEXT
Definition: ui.c:52

◆ UiShowMessageBoxesInSection()

VOID UiShowMessageBoxesInSection ( IN ULONG_PTR  SectionId)

Definition at line 524 of file ui.c.

526{
527 ULONG Idx;
528 CHAR SettingName[80];
529 CHAR SettingValue[80];
530 PCHAR MessageBoxText;
531 ULONG MessageBoxTextSize;
532
533 if (SectionId == 0)
534 return;
535
536 /* Find all the message box settings and run them */
537 for (Idx = 0; Idx < IniGetNumSectionItems(SectionId); Idx++)
538 {
539 IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue));
540 if (_stricmp(SettingName, "MessageBox") != 0)
541 continue;
542
543 /* Get the real length of the MessageBox text */
544 MessageBoxTextSize = IniGetSectionSettingValueSize(SectionId, Idx);
545 // if (MessageBoxTextSize <= 0)
546 // continue;
547
548 /* Allocate enough memory to hold the text */
549 MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
550 if (!MessageBoxText)
551 continue;
552
553 /* Get the MessageBox text */
554 IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), MessageBoxText, MessageBoxTextSize);
555
556 /* Fix it up */
557 UiEscapeString(MessageBoxText);
558
559 /* Display it */
560 UiMessageBox(MessageBoxText);
561
562 /* Free the memory */
563 FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
564 }
565}
ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:103
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
Definition: inifile.c:55
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
Definition: inifile.c:116

Referenced by RunLoader().

◆ UiTextToColor()

UCHAR UiTextToColor ( PCSTR  ColorText)

Definition at line 378 of file ui.c.

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

Referenced by UiInitialize().

◆ UiTextToFillStyle()

UCHAR UiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 383 of file ui.c.

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

Referenced by UiInitialize().

◆ UiUnInitialize()

VOID UiUnInitialize ( PCSTR  BootText)

Definition at line 224 of file ui.c.

225{
227 UiDrawStatusText(BootText);
228 UiInfoBox(BootText);
229
231}
VOID(* UnInitialize)(VOID)
Definition: ui.h:251
VOID UiInfoBox(_In_ PCSTR MessageText)
Definition: ui.c:297
VOID UiDrawBackdrop(VOID)
Definition: ui.c:233
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:286

Referenced by RunLoader().

◆ UiUpdateDateTime()

VOID UiUpdateDateTime ( VOID  )

Definition at line 291 of file ui.c.

292{
294}
VOID(* UpdateDateTime)(VOID)
Definition: ui.h:261

◆ UiUpdateProgressBar()

VOID UiUpdateProgressBar ( _In_ ULONG  Percentage,
_In_opt_ PCSTR  ProgressText 
)

Definition at line 454 of file ui.c.

457{
458 ULONG TotalProgress;
459
460 /* Make sure the progress bar is enabled */
461 if (!UiProgressBar.Show)
462 return;
463
464 /* Set the progress text if specified */
465 if (ProgressText)
466 UiSetProgressBarText(ProgressText);
467
468 /* Compute the total progress and tick the progress bar */
469 TotalProgress = UiProgressBar.State.Floor + (Percentage * UiProgressBar.State.Bias);
470 // TotalProgress /= (100 * 100);
471
472 UiVtbl.TickProgressBar(TotalProgress);
473}
VOID UiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: ui.c:476

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

Variable Documentation

◆ UiBackdropBgColor

UCHAR UiBackdropBgColor

◆ UiBackdropFgColor

UCHAR UiBackdropFgColor

◆ UiBackdropFillStyle

UCHAR UiBackdropFillStyle

◆ UiCenterMenu

◆ UiEditBoxBgColor

UCHAR UiEditBoxBgColor

Definition at line 40 of file ui.c.

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

◆ UiEditBoxTextColor

UCHAR UiEditBoxTextColor

Definition at line 39 of file ui.c.

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

◆ UiMenuBgColor

◆ UiMenuBox

◆ UiMenuFgColor

◆ UiMessageBoxBgColor

UCHAR UiMessageBoxBgColor

Definition at line 33 of file ui.c.

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

◆ UiMessageBoxFgColor

UCHAR UiMessageBoxFgColor

Definition at line 32 of file ui.c.

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

◆ UiMonthNames

const PCSTR UiMonthNames[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }

Definition at line 50 of file ui.c.

Referenced by TuiUpdateDateTime().

◆ UiProgressBar

◆ UiScreenHeight

◆ UiScreenWidth

◆ UiSelectedTextBgColor

UCHAR UiSelectedTextBgColor

Definition at line 38 of file ui.c.

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

◆ UiSelectedTextColor

UCHAR UiSelectedTextColor

Definition at line 37 of file ui.c.

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

◆ UiShowTime

BOOLEAN UiShowTime

Definition at line 42 of file ui.c.

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

◆ UiStatusBarBgColor

UCHAR UiStatusBarBgColor

Definition at line 26 of file ui.c.

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

◆ UiStatusBarFgColor

UCHAR UiStatusBarFgColor

Definition at line 25 of file ui.c.

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

◆ UiTextColor

◆ UiTimeText

CHAR UiTimeText[260] = "[Time Remaining: %d]"

Definition at line 48 of file ui.c.

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

◆ UiTitleBoxBgColor

UCHAR UiTitleBoxBgColor

◆ UiTitleBoxFgColor

UCHAR UiTitleBoxFgColor

◆ UiTitleBoxTitleText

CHAR UiTitleBoxTitleText[260] = "Boot Menu"

Definition at line 47 of file ui.c.

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

◆ UiUseSpecialEffects

BOOLEAN UiUseSpecialEffects

◆ UiVtbl

UIVTBL UiVtbl
Initial value:
=
{
}
VOID NoUiMessageBox(_In_ PCSTR MessageText)
Definition: noui.c:81
VOID NoUiUnInitialize(VOID)
Definition: noui.c:16
VOID NoUiDrawStatusText(PCSTR StatusText)
Definition: noui.c:71
VOID NoUiDrawProgressBar(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: noui.c:123
VOID NoUiTickProgressBar(_In_ ULONG SubPercentTimes100)
Definition: noui.c:111
VOID NoUiFadeInBackdrop(VOID)
Definition: noui.c:148
UCHAR NoUiTextToFillStyle(PCSTR FillStyleText)
Definition: noui.c:143
BOOLEAN NoUiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: noui.c:133
VOID NoUiDrawText2(_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
Definition: noui.c:47
VOID NoUiUpdateDateTime(VOID)
Definition: noui.c:76
VOID NoUiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: noui.c:28
VOID NoUiDrawCenteredText(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
Definition: noui.c:60
BOOLEAN NoUiInitialize(VOID)
Definition: noui.c:11
VOID NoUiMessageBoxCritical(_In_ PCSTR MessageText)
Definition: noui.c:88
VOID NoUiDrawMenu(_In_ PUI_MENU_INFO MenuInfo)
Definition: noui.c:181
VOID NoUiDrawBackdrop(VOID)
Definition: noui.c:20
VOID NoUiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: noui.c:105
VOID NoUiFadeOut(VOID)
Definition: noui.c:152
VOID NoUiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: noui.c:24
VOID NoUiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: noui.c:32
BOOLEAN NoUiDisplayMenu(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: noui.c:163
VOID NoUiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: noui.c:117
VOID NoUiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: noui.c:37
UCHAR NoUiTextToColor(PCSTR ColorText)
Definition: noui.c:138

Definition at line 64 of file ui.c.

Referenced by MiniTuiDrawMenu(), RunLoader(), TuiDisplayMenu(), TuiDrawMenu(), TuiProcessMenuKeyboardEvent(), UiDisplayMenu(), UiDrawBackdrop(), UiDrawBox(), UiDrawCenteredText(), UiDrawProgressBar(), UiDrawProgressBarCenter(), UiDrawShadow(), UiDrawStatusText(), UiDrawText(), UiDrawText2(), UiEditBox(), UiFadeInBackdrop(), UiFadeOut(), UiFillArea(), UiInitialize(), UiInitProgressBar(), UiMessageBox(), UiMessageBoxCritical(), UiResetForSOS(), UiSetProgressBarText(), UiTextToColor(), UiTextToFillStyle(), UiUnInitialize(), UiUpdateDateTime(), and UiUpdateProgressBar().