[SETUPLIB][USETUP] Use NT RTL String Safe functions instead of Win32-oriented ones (and remove usage of HRESULT too).

Based on:
svn path=/branches/setup_improvements/; revision=75755
svn path=/branches/setup_improvements/; revision=75757
This commit is contained in:
Hermès Bélusca-Maïto 2017-09-03 20:05:11 +00:00
parent 254aa472e8
commit 48aab0fb20
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
10 changed files with 69 additions and 70 deletions

View file

@ -16,9 +16,6 @@
#include "setuplib.h"
// HACK!
#include <strsafe.h>
#define NDEBUG
#include <debug.h>
@ -147,7 +144,11 @@ CheckUnattendedSetup(
DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
goto Quit;
}
wcscpy(pSetupData->InstallationDirectory, Value);
RtlStringCchCopyW(pSetupData->InstallationDirectory,
ARRAYSIZE(pSetupData->InstallationDirectory),
Value);
INF_FreeData(Value);
}
@ -189,7 +190,9 @@ CheckUnattendedSetup(
if (INF_GetData(&Context, NULL, &Value))
{
LONG Id = wcstol(Value, NULL, 16);
swprintf(pSetupData->LocaleID, L"%08lx", Id);
RtlStringCchPrintfW(pSetupData->LocaleID,
ARRAYSIZE(pSetupData->LocaleID),
L"%08lx", Id);
INF_FreeData(Value);
}
}
@ -233,8 +236,8 @@ InstallSetupInfFile(
if (IniSection)
{
/* Key "skipmissingfiles" */
// StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
// L"\"%s\"", L"WinNt5.2");
// RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
// L"\"%s\"", L"WinNt5.2");
// IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
// L"Version", PathBuffer);
}
@ -242,20 +245,20 @@ InstallSetupInfFile(
IniSection = IniCacheAppendSection(IniCache, L"Data");
if (IniSection)
{
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"UnattendedInstall", PathBuffer);
// "floppylessbootpath" (yes/no)
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", L"winnt");
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", L"winnt");
IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"ProductType", PathBuffer);
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"SourcePath", PathBuffer);
@ -561,7 +564,10 @@ LoadSetupInf(
if (!INF_GetData(&Context, NULL, &Value))
return ERROR_CORRUPT_TXTSETUPSIF;
wcscpy(pSetupData->InstallationDirectory, Value);
RtlStringCchCopyW(pSetupData->InstallationDirectory,
ARRAYSIZE(pSetupData->InstallationDirectory),
Value);
INF_FreeData(Value);
}