[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

@ -422,7 +422,7 @@ DefaultProcessEntry(
}
wcscpy((PWCHAR)*UserData, KeyName);
wcscpy(DisplayText, KeyValue);
RtlStringCbCopyW(DisplayText, DisplayTextSize, KeyValue);
*Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE);
@ -483,7 +483,7 @@ CreateComputerTypeList(
}
DPRINT("Computer key: %S\n", KeyName);
wcscpy(ComputerKey, KeyName);
RtlStringCchCopyW(ComputerKey, ARRAYSIZE(ComputerKey), KeyName);
INF_FreeData(KeyName);
} while (SetupFindNextLine(&Context, &Context));
@ -548,7 +548,7 @@ GetDisplayIdentifier(
BusInstance = 0;
while (TRUE)
{
swprintf(Buffer, L"%lu", BusInstance);
RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", BusInstance);
RtlInitUnicodeString(&KeyName, Buffer);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
@ -584,7 +584,7 @@ GetDisplayIdentifier(
while (TRUE)
{
/* Open the pointer controller instance key */
swprintf(Buffer, L"%lu", ControllerInstance);
RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", ControllerInstance);
RtlInitUnicodeString(&KeyName, Buffer);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
@ -719,7 +719,7 @@ CreateDisplayDriverList(
}
DPRINT("Display key: %S\n", KeyName);
wcscpy(DisplayKey, KeyName);
RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
INF_FreeData(KeyName);
} while (SetupFindNextLine(&Context, &Context));
@ -764,8 +764,8 @@ ProcessComputerFiles(
return FALSE;
}
wcscpy(SectionName, L"Files.");
wcscat(SectionName, (const wchar_t*)GetListEntryUserData(Entry));
RtlStringCchPrintfW(SectionName, ARRAYSIZE(SectionName),
L"Files.%s", (PCWSTR)GetListEntryUserData(Entry));
*AdditionalSectionName = SectionName;
return TRUE;
@ -813,7 +813,9 @@ ProcessDisplayRegistry(
ASSERT(wcslen(ServiceName) < 10);
DPRINT1("Service name: '%S'\n", ServiceName);
swprintf(RegPath, L"System\\CurrentControlSet\\Services\\%s", ServiceName);
RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
L"System\\CurrentControlSet\\Services\\%s",
ServiceName);
RtlInitUnicodeString(&KeyName, RegPath);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
@ -850,9 +852,9 @@ ProcessDisplayRegistry(
return FALSE;
}
swprintf(RegPath,
L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
ServiceName);
RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
ServiceName);
DPRINT1("RegPath: '%S'\n", RegPath);
RtlInitUnicodeString(&KeyName, RegPath);
InitializeObjectAttributes(&ObjectAttributes,
@ -1110,7 +1112,7 @@ ProcessLangEntry(
}
wcscpy((PWCHAR)*UserData, KeyName);
wcscpy(DisplayText, KeyValue);
RtlStringCbCopyW(DisplayText, DisplayTextSize, KeyValue);
*Current = FALSE;