[REACTOS] Use explicit StringCb*W() (#2069)
authorSerge Gautherie <32623169+SergeGautherie@users.noreply.github.com>
Wed, 20 Nov 2019 23:47:06 +0000 (00:47 +0100)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Wed, 20 Nov 2019 23:47:06 +0000 (00:47 +0100)
base/applications/control/control.c
base/applications/network/dwnl/dwnl.c
dll/cpl/desk/devsett.c
dll/win32/shell32/dialogs/filetypes.cpp
dll/win32/shell32/folders/CRecycleBin.cpp
modules/rostests/kmtests/kmtest/fltsupport.c
modules/rostests/kmtests/kmtest/service.c
modules/rostests/kmtests/kmtest/support.c

index d008cae..f0ca50b 100644 (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",
index 7660906..74826ef 100644 (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))
index 446848f..73dbb78 100644 (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);
index 56b32cb..f54203d 100644 (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));
index d227720..a62696a 100644 (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)
index 4127cca..1488a44 100644 (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",
index 7427fbf..249b3a8 100644 (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);
 
index 2a2c99e..13bd66b 100644 (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)