Author: hbelusca
Date: Sun Sep 3 19:46:26 2017
New Revision: 75753
URL:
http://svn.reactos.org/svn/reactos?rev=75753&view=rev
Log:
[SETUPLIB][USETUP]: Make the GENERIC_LIST store the items display text in UNICODE (and not
in ANSI). Only convert to ANSI when needed (e.g. in the display code for usetup).
The 1st-stage GUI setup will however use the UNICODE strings directly.
Modified:
branches/setup_improvements/base/setup/lib/settings.c
branches/setup_improvements/base/setup/lib/utils/genlist.c
branches/setup_improvements/base/setup/lib/utils/genlist.h
branches/setup_improvements/base/setup/lib/utils/osdetect.c
branches/setup_improvements/base/setup/usetup/genlist.c
branches/setup_improvements/base/setup/usetup/genlist.h
branches/setup_improvements/base/setup/usetup/usetup.c
Modified: branches/setup_improvements/base/setup/lib/settings.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/settings.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/settings.c [iso-8859-1] Sun Sep 3 19:46:26
2017
@@ -324,7 +324,7 @@
(NTAPI *PPROCESS_ENTRY_ROUTINE)(
IN PWCHAR KeyName,
IN PWCHAR KeyValue,
- IN PCHAR DisplayText,
+ OUT PWCHAR DisplayText,
IN SIZE_T DisplayTextSize,
OUT PVOID* UserData,
OUT PBOOLEAN Current,
@@ -345,7 +345,7 @@
PVOID UserData;
BOOLEAN Current;
UCHAR RetVal;
- CHAR DisplayText[128];
+ WCHAR DisplayText[128];
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, pContext))
return -1;
@@ -405,7 +405,7 @@
DefaultProcessEntry(
IN PWCHAR KeyName,
IN PWCHAR KeyValue,
- IN PCHAR DisplayText,
+ OUT PWCHAR DisplayText,
IN SIZE_T DisplayTextSize,
OUT PVOID* UserData,
OUT PBOOLEAN Current,
@@ -423,7 +423,7 @@
}
wcscpy((PWCHAR)*UserData, KeyName);
- sprintf(DisplayText, "%S", KeyValue);
+ wcscpy(DisplayText, KeyValue);
*Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE);
@@ -740,7 +740,7 @@
}
#if 0
- AppendGenericListEntry(List, "Other display driver", NULL, TRUE);
+ AppendGenericListEntry(List, L"Other display driver", NULL, TRUE);
#endif
return List;
@@ -1087,7 +1087,7 @@
ProcessLangEntry(
IN PWCHAR KeyName,
IN PWCHAR KeyValue,
- IN PCHAR DisplayText,
+ OUT PWCHAR DisplayText,
IN SIZE_T DisplayTextSize,
OUT PVOID* UserData,
OUT PBOOLEAN Current,
@@ -1111,7 +1111,7 @@
}
wcscpy((PWCHAR)*UserData, KeyName);
- sprintf(DisplayText, "%S", KeyValue);
+ wcscpy(DisplayText, KeyValue);
*Current = FALSE;
Modified: branches/setup_improvements/base/setup/lib/utils/genlist.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/utils/genlist.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/utils/genlist.c [iso-8859-1] Sun Sep 3
19:46:26 2017
@@ -67,7 +67,7 @@
BOOLEAN
AppendGenericListEntry(
IN OUT PGENERIC_LIST List,
- IN PCHAR Text,
+ IN PCWSTR Text,
IN PVOID UserData,
IN BOOLEAN Current)
{
@@ -75,11 +75,12 @@
Entry = (PGENERIC_LIST_ENTRY)RtlAllocateHeap(ProcessHeap,
0,
- sizeof(GENERIC_LIST_ENTRY) +
strlen(Text));
+ sizeof(GENERIC_LIST_ENTRY) +
+ (wcslen(Text) + 1) * sizeof(WCHAR));
if (Entry == NULL)
return FALSE;
- strcpy (Entry->Text, Text);
+ wcscpy(Entry->Text, Text);
Entry->List = List;
Entry->UserData = UserData;
@@ -140,7 +141,7 @@
return Entry->UserData;
}
-LPCSTR
+PCWSTR
GetListEntryText(
IN PGENERIC_LIST_ENTRY Entry)
{
Modified: branches/setup_improvements/base/setup/lib/utils/genlist.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/utils/genlist.h [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/utils/genlist.h [iso-8859-1] Sun Sep 3
19:46:26 2017
@@ -13,7 +13,7 @@
LIST_ENTRY Entry;
struct _GENERIC_LIST* List;
PVOID UserData;
- CHAR Text[1]; // FIXME: UI stuff
+ WCHAR Text[1]; // FIXME: UI stuff
} GENERIC_LIST_ENTRY, *PGENERIC_LIST_ENTRY;
@@ -39,7 +39,7 @@
BOOLEAN
AppendGenericListEntry(
IN OUT PGENERIC_LIST List,
- IN PCHAR Text,
+ IN PCWSTR Text,
IN PVOID UserData,
IN BOOLEAN Current);
@@ -64,7 +64,7 @@
GetListEntryUserData(
IN PGENERIC_LIST_ENTRY Entry);
-LPCSTR
+PCWSTR
GetListEntryText(
IN PGENERIC_LIST_ENTRY Entry);
Modified: branches/setup_improvements/base/setup/lib/utils/osdetect.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/utils/osdetect.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/utils/osdetect.c [iso-8859-1] Sun Sep 3
19:46:26 2017
@@ -571,7 +571,6 @@
{
PNTOS_INSTALLATION NtOsInstall;
SIZE_T ArcPathLength, NtPathLength;
- CHAR InstallNameA[MAX_PATH];
/* Is there already any installation with these settings? */
NtOsInstall = FindExistingNTOSInstall(List, SystemRootArcPath, SystemRootNtPath);
@@ -617,8 +616,7 @@
StringCchCopyW(NtOsInstall->InstallationName,
ARRAYSIZE(NtOsInstall->InstallationName), InstallationName);
// Having the GENERIC_LIST storing the display item string plainly sucks...
- StringCchPrintfA(InstallNameA, ARRAYSIZE(InstallNameA), "%S",
InstallationName);
- AppendGenericListEntry(List, InstallNameA, NtOsInstall, FALSE);
+ AppendGenericListEntry(List, InstallationName, NtOsInstall, FALSE);
return NtOsInstall;
}
Modified: branches/setup_improvements/base/setup/usetup/genlist.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/genlist.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/genlist.c [iso-8859-1] Sun Sep 3
19:46:26 2017
@@ -48,6 +48,8 @@
ListUi->Right = 0;
ListUi->Bottom = 0;
ListUi->Redraw = TRUE;
+
+ ListUi->CurrentItemText[0] = ANSI_NULL;
}
static
@@ -158,6 +160,8 @@
break;
ListUi->LastShown = Entry;
+ sprintf(ListUi->CurrentItemText, "%S", ListEntry->Text);
+
FillConsoleOutputAttribute(StdOutput,
(List->CurrentEntry == ListEntry) ?
FOREGROUND_BLUE | BACKGROUND_WHITE :
@@ -174,8 +178,8 @@
coPos.X++;
WriteConsoleOutputCharacterA(StdOutput,
- ListEntry->Text,
- min(strlen(ListEntry->Text), (SIZE_T)Width - 2),
+ ListUi->CurrentItemText,
+ min(strlen(ListUi->CurrentItemText),
(SIZE_T)Width - 2),
coPos,
&Written);
coPos.X--;
@@ -415,7 +419,7 @@
for (i = ListUi->Bottom - 1; i > ListUi->Top + 1; i--)
{
- ScrollUpGenericList(ListUi);
+ ScrollUpGenericList(ListUi);
}
/* Update user interface */
@@ -490,13 +494,17 @@
ListUi->Redraw = FALSE;
- if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) ==
AsciiChar) &&
+ sprintf(ListUi->CurrentItemText, "%S", ListEntry->Text);
+
+ if ((strlen(ListUi->CurrentItemText) > 0) &&
(tolower(ListUi->CurrentItemText[0]) == AsciiChar) &&
(List->CurrentEntry->Entry.Flink != &List->ListHead))
{
ScrollDownGenericList(ListUi);
ListEntry = List->CurrentEntry;
- if ((strlen(ListEntry->Text) > 0) &&
(tolower(ListEntry->Text[0]) == AsciiChar))
+ sprintf(ListUi->CurrentItemText, "%S", ListEntry->Text);
+
+ if ((strlen(ListUi->CurrentItemText) > 0) &&
(tolower(ListUi->CurrentItemText[0]) == AsciiChar))
goto End;
}
@@ -507,7 +515,9 @@
for (;;)
{
- if ((strlen(ListEntry->Text) > 0) &&
(tolower(ListEntry->Text[0]) == AsciiChar))
+ sprintf(ListUi->CurrentItemText, "%S", ListEntry->Text);
+
+ if ((strlen(ListUi->CurrentItemText) > 0) &&
(tolower(ListUi->CurrentItemText[0]) == AsciiChar))
{
Flag = TRUE;
break;
Modified: branches/setup_improvements/base/setup/usetup/genlist.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/genlist.h [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/genlist.h [iso-8859-1] Sun Sep 3
19:46:26 2017
@@ -40,6 +40,9 @@
SHORT Right;
SHORT Bottom;
BOOL Redraw;
+
+ CHAR CurrentItemText[256];
+
} GENERIC_LIST_UI, *PGENERIC_LIST_UI;
VOID
Modified: branches/setup_improvements/base/setup/usetup/usetup.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/usetup.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/usetup.c [iso-8859-1] Sun Sep 3
19:46:26 2017
@@ -1045,6 +1045,7 @@
DeviceSettingsPage(PINPUT_RECORD Ir)
{
static ULONG Line = 16;
+ CHAR CurrentItemText[256];
/* Initialize the computer settings list */
if (ComputerList == NULL)
@@ -1099,10 +1100,14 @@
MUIDisplayPage(DEVICE_SETTINGS_PAGE);
- CONSOLE_SetTextXY(25, 11, GetListEntryText(GetCurrentListEntry(ComputerList)));
- CONSOLE_SetTextXY(25, 12, GetListEntryText(GetCurrentListEntry(DisplayList)));
- CONSOLE_SetTextXY(25, 13, GetListEntryText(GetCurrentListEntry(KeyboardList)));
- CONSOLE_SetTextXY(25, 14, GetListEntryText(GetCurrentListEntry(LayoutList)));
+ sprintf(CurrentItemText, "%S",
GetListEntryText(GetCurrentListEntry(ComputerList)));
+ CONSOLE_SetTextXY(25, 11, CurrentItemText);
+ sprintf(CurrentItemText, "%S",
GetListEntryText(GetCurrentListEntry(DisplayList)));
+ CONSOLE_SetTextXY(25, 12, CurrentItemText);
+ sprintf(CurrentItemText, "%S",
GetListEntryText(GetCurrentListEntry(KeyboardList)));
+ CONSOLE_SetTextXY(25, 13, CurrentItemText);
+ sprintf(CurrentItemText, "%S",
GetListEntryText(GetCurrentListEntry(LayoutList)));
+ CONSOLE_SetTextXY(25, 14, CurrentItemText);
CONSOLE_InvertTextXY(24, Line, 48, 1);