[REACTOS] Use explicit StringCb*W() (#2069)

This commit is contained in:
Serge Gautherie 2019-11-21 00:47:06 +01:00 committed by Hermès BÉLUSCA - MAÏTO
parent f3af9cfcf1
commit 0f92924a99
8 changed files with 23 additions and 22 deletions

View file

@ -67,11 +67,11 @@ KmtFltCreateService(
{
WCHAR ServicePath[MAX_PATH];
StringCbCopy(ServicePath, sizeof ServicePath, ServiceName);
StringCbCat(ServicePath, sizeof ServicePath, L"_drv.sys");
StringCbCopyW(ServicePath, sizeof(ServicePath), ServiceName);
StringCbCatW(ServicePath, sizeof(ServicePath), L"_drv.sys");
StringCbCopy(TestServiceName, sizeof TestServiceName, L"Kmtest-");
StringCbCat(TestServiceName, sizeof TestServiceName, ServiceName);
StringCbCopyW(TestServiceName, sizeof(TestServiceName), L"Kmtest-");
StringCbCatW(TestServiceName, sizeof(TestServiceName), ServiceName);
return KmtpCreateService(TestServiceName,
ServicePath,
@ -455,9 +455,9 @@ KmtFltAddAltitude(
DWORD Zero = 0;
LONG Error;
StringCbCopy(KeyPath, sizeof KeyPath, L"SYSTEM\\CurrentControlSet\\Services\\");
StringCbCat(KeyPath, sizeof KeyPath, TestServiceName);
StringCbCat(KeyPath, sizeof KeyPath, L"\\Instances\\");
StringCbCopyW(KeyPath, sizeof(KeyPath), L"SYSTEM\\CurrentControlSet\\Services\\");
StringCbCatW(KeyPath, sizeof(KeyPath), TestServiceName);
StringCbCatW(KeyPath, sizeof(KeyPath), L"\\Instances\\");
Error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
KeyPath,
@ -473,8 +473,8 @@ KmtFltAddAltitude(
return Error;
}
StringCbCopy(DefaultInstance, sizeof DefaultInstance, TestServiceName);
StringCbCat(DefaultInstance, sizeof DefaultInstance, L" Instance");
StringCbCopyW(DefaultInstance, sizeof(DefaultInstance), TestServiceName);
StringCbCatW(DefaultInstance, sizeof(DefaultInstance), L" Instance");
Error = RegSetValueExW(hKey,
L"DefaultInstance",

View file

@ -431,7 +431,7 @@ KmtpCreateService(
assert(wcsrchr(DriverPath, L'\\') != NULL);
wcsrchr(DriverPath, L'\\')[1] = L'\0';
result = StringCbCat(DriverPath, sizeof DriverPath, ServicePath);
result = StringCbCatW(DriverPath, sizeof(DriverPath), ServicePath);
if (FAILED(result))
error_value_goto(Error, result, cleanup);

View file

@ -131,11 +131,11 @@ KmtLoadDriver(
DWORD Error = ERROR_SUCCESS;
WCHAR ServicePath[MAX_PATH];
StringCbCopy(ServicePath, sizeof ServicePath, ServiceName);
StringCbCat(ServicePath, sizeof ServicePath, L"_drv.sys");
StringCbCopyW(ServicePath, sizeof(ServicePath), ServiceName);
StringCbCatW(ServicePath, sizeof(ServicePath), L"_drv.sys");
StringCbCopy(TestServiceName, sizeof TestServiceName, L"Kmtest-");
StringCbCat(TestServiceName, sizeof TestServiceName, ServiceName);
StringCbCopyW(TestServiceName, sizeof(TestServiceName), L"Kmtest-");
StringCbCatW(TestServiceName, sizeof(TestServiceName), ServiceName);
Error = KmtCreateAndStartService(TestServiceName, ServicePath, NULL, &TestServiceHandle, RestartIfRunning);
@ -176,8 +176,8 @@ KmtOpenDriver(VOID)
DWORD Error = ERROR_SUCCESS;
WCHAR DevicePath[MAX_PATH];
StringCbCopy(DevicePath, sizeof DevicePath, L"\\\\.\\Global\\GLOBALROOT\\Device\\");
StringCbCat(DevicePath, sizeof DevicePath, TestServiceName);
StringCbCopyW(DevicePath, sizeof(DevicePath), L"\\\\.\\Global\\GLOBALROOT\\Device\\");
StringCbCatW(DevicePath, sizeof(DevicePath), TestServiceName);
TestDeviceHandle = CreateFile(DevicePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (TestDeviceHandle == INVALID_HANDLE_VALUE)