[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

@ -43,8 +43,8 @@ OpenShellFolder(LPWSTR lpFolderCLSID)
* Open a shell folder using "explorer.exe". The passed CLSIDs
* are all subfolders of the "Control Panel" shell folder.
*/
StringCbCopy(szParameters, sizeof(szParameters), L"/n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}");
StringCbCat(szParameters,sizeof(szParameters), lpFolderCLSID);
StringCbCopyW(szParameters, sizeof(szParameters), L"/n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}");
StringCbCatW(szParameters, sizeof(szParameters), lpFolderCLSID);
return (INT_PTR)ShellExecuteW(NULL,
L"open",

View file

@ -49,7 +49,7 @@ write_status(LPCWSTR lpFmt, ...)
CONSOLE_SCREEN_BUFFER_INFO csbi;
va_start(args, lpFmt);
StringCbVPrintf(szTxt, sizeof(szTxt), lpFmt, args);
StringCbVPrintfW(szTxt, sizeof(szTxt), lpFmt, args);
va_end(args);
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))

View file

@ -665,7 +665,7 @@ CDevSettings_GetData(IDataObject* iface,
(wcslen(pszRet) + 1) * sizeof(WCHAR));
if (pszBuf != NULL)
{
hr = StringCbCopy(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
hr = StringCbCopyW(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
if (FAILED(hr))
{
GlobalFree(pszBuf);

View file

@ -682,7 +682,8 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFil
// construct default 'FileExtensionFile' by formatting the uppercase extension
// with IDS_FILE_EXT_TYPE, outputting something like a l18n 'INI File'
StringCbPrintf(Entry->FileDescription, sizeof(Entry->FileDescription), szFile, &Entry->FileExtension[1]);
StringCbPrintfW(Entry->FileDescription, sizeof(Entry->FileDescription),
szFile, &Entry->FileExtension[1]);
}
ZeroMemory(&lvItem, sizeof(LVITEMW));

View file

@ -891,7 +891,7 @@ TRASH_CanTrashFile(LPCWSTR wszPath)
// Copy and retrieve the root path from get given string
WCHAR wszRootPathName[MAX_PATH];
StringCbCopy(wszRootPathName, sizeof(wszRootPathName), wszPath);
StringCbCopyW(wszRootPathName, sizeof(wszRootPathName), wszPath);
PathStripToRootW(wszRootPathName);
// Test to see if the drive is fixed (non removable)

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)