[SETUPLIB] Some INI support refactoring: function/struct names, duplicated code (#6815)

And convert ANSI strings to UNICODE in a better way instead of
zero-extending them.
This commit is contained in:
Hermès Bélusca-Maïto 2024-04-23 21:09:36 +02:00
parent cb6fc76b8b
commit 817c27a54e
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 291 additions and 444 deletions

View file

@ -232,7 +232,7 @@ InstallSetupInfFile(
IO_STATUS_BLOCK IoStatusBlock;
#endif
PINICACHESECTION IniSection;
PINI_SECTION IniSection;
WCHAR PathBuffer[MAX_PATH];
WCHAR UnattendInfPath[MAX_PATH];
@ -241,35 +241,31 @@ InstallSetupInfFile(
if (!IniCache)
return;
IniSection = IniCacheAppendSection(IniCache, L"SetupParams");
IniSection = IniAddSection(IniCache, L"SetupParams");
if (IniSection)
{
/* Key "skipmissingfiles" */
// RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
// L"\"%s\"", L"WinNt5.2");
// IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
// L"Version", PathBuffer);
// IniAddKey(IniSection, L"Version", PathBuffer);
}
IniSection = IniCacheAppendSection(IniCache, L"Data");
IniSection = IniAddSection(IniCache, L"Data");
if (IniSection)
{
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"UnattendedInstall", PathBuffer);
IniAddKey(IniSection, L"UnattendedInstall", PathBuffer);
// "floppylessbootpath" (yes/no)
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", L"winnt");
IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"ProductType", PathBuffer);
IniAddKey(IniSection, L"ProductType", PathBuffer);
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"SourcePath", PathBuffer);
IniAddKey(IniSection, L"SourcePath", PathBuffer);
// "floppyless" ("0")
}