[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:
Hermès Bélusca-Maïto 2017-09-03 19:46:26 +00:00
parent b86d19e936
commit 254aa472e8
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
7 changed files with 44 additions and 27 deletions

View file

@ -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)
{

View file

@ -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);

View file

@ -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;
}