https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f3ed60ea4779a8848c3a…
commit 9f3ed60ea4779a8848c3a78d004f415520669832
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Tue Apr 28 13:08:55 2020 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Wed May 5 19:30:53 2021 +0200
[USETUP] Loop over MUI entries of the same ID
MUI entries can have the same ID pointed by TextID member of MUI_ENTRY structure. For this matter, altering a certain entry such as deleting a portion of text with MUIClearStyledText() only removes that portion of text when the given ID argument and the retrieved ID match.
However, MUIClearStyledText() only removes the first instance of text in the console leaving other entries with the same ID as is. Therefore we must ensure that we also iterate over other entries with the same ID as well. Besides the aforementioned function, do the same with MUIClearText(), MUISetText() and MUISetStyledText() too.
---
base/setup/usetup/mui.c | 90 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 75 insertions(+), 15 deletions(-)
diff --git a/base/setup/usetup/mui.c b/base/setup/usetup/mui.c
index d16caaa8800..d1e6599c461 100644
--- a/base/setup/usetup/mui.c
+++ b/base/setup/usetup/mui.c
@@ -325,6 +325,7 @@ MUIClearText(
IN INT TextID)
{
const MUI_ENTRY * entry;
+ ULONG Index = 0;
/* Get the MUI entry */
entry = MUIGetEntry(Page, TextID);
@@ -332,11 +333,25 @@ MUIClearText(
if (!entry)
return;
- /* Remove the text by using CONSOLE_ClearTextXY() */
- CONSOLE_ClearTextXY(
- entry->X,
- entry->Y,
- (ULONG)strlen(entry->Buffer));
+ /* Ensure that the text string given by the text ID and page is not NULL */
+ while (entry[Index].Buffer != NULL)
+ {
+ /* If text ID is not correct, skip the entry */
+ if (entry[Index].TextID != TextID)
+ {
+ Index++;
+ continue;
+ }
+
+ /* Remove the text by using CONSOLE_ClearTextXY() */
+ CONSOLE_ClearTextXY(
+ entry[Index].X,
+ entry[Index].Y,
+ (ULONG)strlen(entry[Index].Buffer));
+
+ /* Increment the index and loop over next entires with the same ID */
+ Index++;
+ }
}
/**
@@ -366,6 +381,7 @@ MUIClearStyledText(
IN INT Flags)
{
const MUI_ENTRY * entry;
+ ULONG Index = 0;
/* Get the MUI entry */
entry = MUIGetEntry(Page, TextID);
@@ -373,12 +389,26 @@ MUIClearStyledText(
if (!entry)
return;
- /* Now, begin removing the text by calling CONSOLE_ClearStyledText() */
- CONSOLE_ClearStyledText(
- entry->X,
- entry->Y,
- Flags,
- (ULONG)strlen(entry->Buffer));
+ /* Ensure that the text string given by the text ID and page is not NULL */
+ while (entry[Index].Buffer != NULL)
+ {
+ /* If text ID is not correct, skip the entry */
+ if (entry[Index].TextID != TextID)
+ {
+ Index++;
+ continue;
+ }
+
+ /* Now, begin removing the text by calling CONSOLE_ClearStyledText() */
+ CONSOLE_ClearStyledText(
+ entry[Index].X,
+ entry[Index].Y,
+ Flags,
+ (ULONG)strlen(entry[Index].Buffer));
+
+ /* Increment the index and loop over next entires with the same ID */
+ Index++;
+ }
}
/**
@@ -403,6 +433,7 @@ MUISetText(
IN INT TextID)
{
const MUI_ENTRY * entry;
+ ULONG Index = 0;
/* Get the MUI entry */
entry = MUIGetEntry(Page, TextID);
@@ -410,8 +441,22 @@ MUISetText(
if (!entry)
return;
- /* Print the text to the console output by calling CONSOLE_SetTextXY() */
- CONSOLE_SetTextXY(entry->X, entry->Y, entry->Buffer);
+ /* Ensure that the text string given by the text ID and page is not NULL */
+ while (entry[Index].Buffer != NULL)
+ {
+ /* If text ID is not correct, skip the entry */
+ if (entry[Index].TextID != TextID)
+ {
+ Index++;
+ continue;
+ }
+
+ /* Print the text to the console output by calling CONSOLE_SetTextXY() */
+ CONSOLE_SetTextXY(entry[Index].X, entry[Index].Y, entry[Index].Buffer);
+
+ /* Increment the index and loop over next entires with the same ID */
+ Index++;
+ }
}
/**
@@ -441,6 +486,7 @@ MUISetStyledText(
IN INT Flags)
{
const MUI_ENTRY * entry;
+ ULONG Index = 0;
/* Get the MUI entry */
entry = MUIGetEntry(Page, TextID);
@@ -448,8 +494,22 @@ MUISetStyledText(
if (!entry)
return;
- /* Print the text to the console output by calling CONSOLE_SetStyledText() */
- CONSOLE_SetStyledText(entry->X, entry->Y, Flags, entry->Buffer);
+ /* Ensure that the text string given by the text ID and page is not NULL */
+ while (entry[Index].Buffer != NULL)
+ {
+ /* If text ID is not correct, skip the entry */
+ if (entry[Index].TextID != TextID)
+ {
+ Index++;
+ continue;
+ }
+
+ /* Print the text to the console output by calling CONSOLE_SetStyledText() */
+ CONSOLE_SetStyledText(entry[Index].X, entry[Index].Y, Flags, entry[Index].Buffer);
+
+ /* Increment the index and loop over next entires with the same ID */
+ Index++;
+ }
}
VOID