mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[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. svn path=/branches/setup_improvements/; revision=75753
This commit is contained in:
parent
b86d19e936
commit
254aa472e8
7 changed files with 44 additions and 27 deletions
|
@ -323,7 +323,7 @@ typedef UCHAR
|
|||
(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,
|
||||
|
@ -344,7 +344,7 @@ AddEntriesFromInfSection(
|
|||
PVOID UserData;
|
||||
BOOLEAN Current;
|
||||
UCHAR RetVal;
|
||||
CHAR DisplayText[128];
|
||||
WCHAR DisplayText[128];
|
||||
|
||||
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, pContext))
|
||||
return -1;
|
||||
|
@ -404,7 +404,7 @@ NTAPI
|
|||
DefaultProcessEntry(
|
||||
IN PWCHAR KeyName,
|
||||
IN PWCHAR KeyValue,
|
||||
IN PCHAR DisplayText,
|
||||
OUT PWCHAR DisplayText,
|
||||
IN SIZE_T DisplayTextSize,
|
||||
OUT PVOID* UserData,
|
||||
OUT PBOOLEAN Current,
|
||||
|
@ -422,7 +422,7 @@ DefaultProcessEntry(
|
|||
}
|
||||
|
||||
wcscpy((PWCHAR)*UserData, KeyName);
|
||||
sprintf(DisplayText, "%S", KeyValue);
|
||||
wcscpy(DisplayText, KeyValue);
|
||||
|
||||
*Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE);
|
||||
|
||||
|
@ -739,7 +739,7 @@ CreateDisplayDriverList(
|
|||
}
|
||||
|
||||
#if 0
|
||||
AppendGenericListEntry(List, "Other display driver", NULL, TRUE);
|
||||
AppendGenericListEntry(List, L"Other display driver", NULL, TRUE);
|
||||
#endif
|
||||
|
||||
return List;
|
||||
|
@ -1086,7 +1086,7 @@ NTAPI
|
|||
ProcessLangEntry(
|
||||
IN PWCHAR KeyName,
|
||||
IN PWCHAR KeyValue,
|
||||
IN PCHAR DisplayText,
|
||||
OUT PWCHAR DisplayText,
|
||||
IN SIZE_T DisplayTextSize,
|
||||
OUT PVOID* UserData,
|
||||
OUT PBOOLEAN Current,
|
||||
|
@ -1110,7 +1110,7 @@ ProcessLangEntry(
|
|||
}
|
||||
|
||||
wcscpy((PWCHAR)*UserData, KeyName);
|
||||
sprintf(DisplayText, "%S", KeyValue);
|
||||
wcscpy(DisplayText, KeyValue);
|
||||
|
||||
*Current = FALSE;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ DestroyGenericList(
|
|||
BOOLEAN
|
||||
AppendGenericListEntry(
|
||||
IN OUT PGENERIC_LIST List,
|
||||
IN PCHAR Text,
|
||||
IN PCWSTR Text,
|
||||
IN PVOID UserData,
|
||||
IN BOOLEAN Current)
|
||||
{
|
||||
|
@ -73,11 +73,12 @@ AppendGenericListEntry(
|
|||
|
||||
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;
|
||||
|
||||
|
@ -138,7 +139,7 @@ GetListEntryUserData(
|
|||
return Entry->UserData;
|
||||
}
|
||||
|
||||
LPCSTR
|
||||
PCWSTR
|
||||
GetListEntryText(
|
||||
IN PGENERIC_LIST_ENTRY Entry)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct _GENERIC_LIST_ENTRY
|
|||
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;
|
||||
|
||||
|
@ -38,7 +38,7 @@ DestroyGenericList(
|
|||
BOOLEAN
|
||||
AppendGenericListEntry(
|
||||
IN OUT PGENERIC_LIST List,
|
||||
IN PCHAR Text,
|
||||
IN PCWSTR Text,
|
||||
IN PVOID UserData,
|
||||
IN BOOLEAN Current);
|
||||
|
||||
|
@ -63,7 +63,7 @@ PVOID
|
|||
GetListEntryUserData(
|
||||
IN PGENERIC_LIST_ENTRY Entry);
|
||||
|
||||
LPCSTR
|
||||
PCWSTR
|
||||
GetListEntryText(
|
||||
IN PGENERIC_LIST_ENTRY Entry);
|
||||
|
||||
|
|
|
@ -575,7 +575,6 @@ AddNTOSInstallation(
|
|||
{
|
||||
PNTOS_INSTALLATION NtOsInstall;
|
||||
SIZE_T ArcPathLength, NtPathLength;
|
||||
CHAR InstallNameA[MAX_PATH];
|
||||
|
||||
/* Is there already any installation with these settings? */
|
||||
NtOsInstall = FindExistingNTOSInstall(List, SystemRootArcPath, SystemRootNtPath);
|
||||
|
@ -623,8 +622,7 @@ AddNTOSInstallation(
|
|||
InstallationName);
|
||||
|
||||
// Having the GENERIC_LIST storing the display item string plainly sucks...
|
||||
RtlStringCchPrintfA(InstallNameA, ARRAYSIZE(InstallNameA), "%S", InstallationName);
|
||||
AppendGenericListEntry(List, InstallNameA, NtOsInstall, FALSE);
|
||||
AppendGenericListEntry(List, InstallationName, NtOsInstall, FALSE);
|
||||
|
||||
return NtOsInstall;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ InitGenericListUi(
|
|||
ListUi->Right = 0;
|
||||
ListUi->Bottom = 0;
|
||||
ListUi->Redraw = TRUE;
|
||||
|
||||
ListUi->CurrentItemText[0] = ANSI_NULL;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -157,6 +159,8 @@ DrawListEntries(
|
|||
break;
|
||||
ListUi->LastShown = Entry;
|
||||
|
||||
sprintf(ListUi->CurrentItemText, "%S", ListEntry->Text);
|
||||
|
||||
FillConsoleOutputAttribute(StdOutput,
|
||||
(List->CurrentEntry == ListEntry) ?
|
||||
FOREGROUND_BLUE | BACKGROUND_WHITE :
|
||||
|
@ -173,8 +177,8 @@ DrawListEntries(
|
|||
|
||||
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--;
|
||||
|
@ -414,7 +418,7 @@ ScrollPageUpGenericList(
|
|||
|
||||
for (i = ListUi->Bottom - 1; i > ListUi->Top + 1; i--)
|
||||
{
|
||||
ScrollUpGenericList(ListUi);
|
||||
ScrollUpGenericList(ListUi);
|
||||
}
|
||||
|
||||
/* Update user interface */
|
||||
|
@ -489,13 +493,17 @@ GenericListKeyPress(
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -506,7 +514,9 @@ GenericListKeyPress(
|
|||
|
||||
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;
|
||||
|
|
|
@ -40,6 +40,9 @@ typedef struct _GENERIC_LIST_UI
|
|||
SHORT Right;
|
||||
SHORT Bottom;
|
||||
BOOL Redraw;
|
||||
|
||||
CHAR CurrentItemText[256];
|
||||
|
||||
} GENERIC_LIST_UI, *PGENERIC_LIST_UI;
|
||||
|
||||
VOID
|
||||
|
|
|
@ -1093,6 +1093,7 @@ static PAGE_NUMBER
|
|||
DeviceSettingsPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
static ULONG Line = 16;
|
||||
CHAR CurrentItemText[256];
|
||||
|
||||
/* Initialize the computer settings list */
|
||||
if (ComputerList == NULL)
|
||||
|
@ -1147,10 +1148,14 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
|
|||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue