https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f92924a994245f737a84…
commit 0f92924a994245f737a84a0f695d3e70e09a01d0
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Thu Nov 21 00:47:06 2019 +0100
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Nov 21 00:47:06 2019 +0100
[REACTOS] Use explicit StringCb*W() (#2069)
---
base/applications/control/control.c | 4 ++--
base/applications/network/dwnl/dwnl.c | 2 +-
dll/cpl/desk/devsett.c | 2 +-
dll/win32/shell32/dialogs/filetypes.cpp | 3 ++-
dll/win32/shell32/folders/CRecycleBin.cpp | 2 +-
modules/rostests/kmtests/kmtest/fltsupport.c | 18 +++++++++---------
modules/rostests/kmtests/kmtest/service.c | 2 +-
modules/rostests/kmtests/kmtest/support.c | 12 ++++++------
8 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/base/applications/control/control.c b/base/applications/control/control.c
index d008cae4abd..f0ca50b444c 100644
--- a/base/applications/control/control.c
+++ b/base/applications/control/control.c
@@ -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",
diff --git a/base/applications/network/dwnl/dwnl.c
b/base/applications/network/dwnl/dwnl.c
index 7660906a5f4..74826ef8052 100644
--- a/base/applications/network/dwnl/dwnl.c
+++ b/base/applications/network/dwnl/dwnl.c
@@ -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))
diff --git a/dll/cpl/desk/devsett.c b/dll/cpl/desk/devsett.c
index 446848fa0cc..73dbb78a62f 100644
--- a/dll/cpl/desk/devsett.c
+++ b/dll/cpl/desk/devsett.c
@@ -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);
diff --git a/dll/win32/shell32/dialogs/filetypes.cpp
b/dll/win32/shell32/dialogs/filetypes.cpp
index 56b32cb20aa..f54203d0511 100644
--- a/dll/win32/shell32/dialogs/filetypes.cpp
+++ b/dll/win32/shell32/dialogs/filetypes.cpp
@@ -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));
diff --git a/dll/win32/shell32/folders/CRecycleBin.cpp
b/dll/win32/shell32/folders/CRecycleBin.cpp
index d227720fe34..a62696a2628 100644
--- a/dll/win32/shell32/folders/CRecycleBin.cpp
+++ b/dll/win32/shell32/folders/CRecycleBin.cpp
@@ -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)
diff --git a/modules/rostests/kmtests/kmtest/fltsupport.c
b/modules/rostests/kmtests/kmtest/fltsupport.c
index 4127ccad24f..1488a44a183 100644
--- a/modules/rostests/kmtests/kmtest/fltsupport.c
+++ b/modules/rostests/kmtests/kmtest/fltsupport.c
@@ -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",
diff --git a/modules/rostests/kmtests/kmtest/service.c
b/modules/rostests/kmtests/kmtest/service.c
index 7427fbfdd39..249b3a8f47e 100644
--- a/modules/rostests/kmtests/kmtest/service.c
+++ b/modules/rostests/kmtests/kmtest/service.c
@@ -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);
diff --git a/modules/rostests/kmtests/kmtest/support.c
b/modules/rostests/kmtests/kmtest/support.c
index 2a2c99ed226..13bd66b323d 100644
--- a/modules/rostests/kmtests/kmtest/support.c
+++ b/modules/rostests/kmtests/kmtest/support.c
@@ -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)