mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[REACTOS] Use explicit StringCb*W() (#2069)
This commit is contained in:
parent
f3af9cfcf1
commit
0f92924a99
|
@ -43,8 +43,8 @@ OpenShellFolder(LPWSTR lpFolderCLSID)
|
||||||
* Open a shell folder using "explorer.exe". The passed CLSIDs
|
* Open a shell folder using "explorer.exe". The passed CLSIDs
|
||||||
* are all subfolders of the "Control Panel" shell folder.
|
* 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}");
|
StringCbCopyW(szParameters, sizeof(szParameters), L"/n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}");
|
||||||
StringCbCat(szParameters,sizeof(szParameters), lpFolderCLSID);
|
StringCbCatW(szParameters, sizeof(szParameters), lpFolderCLSID);
|
||||||
|
|
||||||
return (INT_PTR)ShellExecuteW(NULL,
|
return (INT_PTR)ShellExecuteW(NULL,
|
||||||
L"open",
|
L"open",
|
||||||
|
|
|
@ -49,7 +49,7 @@ write_status(LPCWSTR lpFmt, ...)
|
||||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
|
||||||
va_start(args, lpFmt);
|
va_start(args, lpFmt);
|
||||||
StringCbVPrintf(szTxt, sizeof(szTxt), lpFmt, args);
|
StringCbVPrintfW(szTxt, sizeof(szTxt), lpFmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
|
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
|
||||||
|
|
|
@ -665,7 +665,7 @@ CDevSettings_GetData(IDataObject* iface,
|
||||||
(wcslen(pszRet) + 1) * sizeof(WCHAR));
|
(wcslen(pszRet) + 1) * sizeof(WCHAR));
|
||||||
if (pszBuf != NULL)
|
if (pszBuf != NULL)
|
||||||
{
|
{
|
||||||
hr = StringCbCopy(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
|
hr = StringCbCopyW(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
GlobalFree(pszBuf);
|
GlobalFree(pszBuf);
|
||||||
|
|
|
@ -682,7 +682,8 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFil
|
||||||
// construct default 'FileExtensionFile' by formatting the uppercase extension
|
// construct default 'FileExtensionFile' by formatting the uppercase extension
|
||||||
// with IDS_FILE_EXT_TYPE, outputting something like a l18n 'INI File'
|
// 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));
|
ZeroMemory(&lvItem, sizeof(LVITEMW));
|
||||||
|
|
|
@ -891,7 +891,7 @@ TRASH_CanTrashFile(LPCWSTR wszPath)
|
||||||
|
|
||||||
// Copy and retrieve the root path from get given string
|
// Copy and retrieve the root path from get given string
|
||||||
WCHAR wszRootPathName[MAX_PATH];
|
WCHAR wszRootPathName[MAX_PATH];
|
||||||
StringCbCopy(wszRootPathName, sizeof(wszRootPathName), wszPath);
|
StringCbCopyW(wszRootPathName, sizeof(wszRootPathName), wszPath);
|
||||||
PathStripToRootW(wszRootPathName);
|
PathStripToRootW(wszRootPathName);
|
||||||
|
|
||||||
// Test to see if the drive is fixed (non removable)
|
// Test to see if the drive is fixed (non removable)
|
||||||
|
|
|
@ -67,11 +67,11 @@ KmtFltCreateService(
|
||||||
{
|
{
|
||||||
WCHAR ServicePath[MAX_PATH];
|
WCHAR ServicePath[MAX_PATH];
|
||||||
|
|
||||||
StringCbCopy(ServicePath, sizeof ServicePath, ServiceName);
|
StringCbCopyW(ServicePath, sizeof(ServicePath), ServiceName);
|
||||||
StringCbCat(ServicePath, sizeof ServicePath, L"_drv.sys");
|
StringCbCatW(ServicePath, sizeof(ServicePath), L"_drv.sys");
|
||||||
|
|
||||||
StringCbCopy(TestServiceName, sizeof TestServiceName, L"Kmtest-");
|
StringCbCopyW(TestServiceName, sizeof(TestServiceName), L"Kmtest-");
|
||||||
StringCbCat(TestServiceName, sizeof TestServiceName, ServiceName);
|
StringCbCatW(TestServiceName, sizeof(TestServiceName), ServiceName);
|
||||||
|
|
||||||
return KmtpCreateService(TestServiceName,
|
return KmtpCreateService(TestServiceName,
|
||||||
ServicePath,
|
ServicePath,
|
||||||
|
@ -455,9 +455,9 @@ KmtFltAddAltitude(
|
||||||
DWORD Zero = 0;
|
DWORD Zero = 0;
|
||||||
LONG Error;
|
LONG Error;
|
||||||
|
|
||||||
StringCbCopy(KeyPath, sizeof KeyPath, L"SYSTEM\\CurrentControlSet\\Services\\");
|
StringCbCopyW(KeyPath, sizeof(KeyPath), L"SYSTEM\\CurrentControlSet\\Services\\");
|
||||||
StringCbCat(KeyPath, sizeof KeyPath, TestServiceName);
|
StringCbCatW(KeyPath, sizeof(KeyPath), TestServiceName);
|
||||||
StringCbCat(KeyPath, sizeof KeyPath, L"\\Instances\\");
|
StringCbCatW(KeyPath, sizeof(KeyPath), L"\\Instances\\");
|
||||||
|
|
||||||
Error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
Error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
KeyPath,
|
KeyPath,
|
||||||
|
@ -473,8 +473,8 @@ KmtFltAddAltitude(
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringCbCopy(DefaultInstance, sizeof DefaultInstance, TestServiceName);
|
StringCbCopyW(DefaultInstance, sizeof(DefaultInstance), TestServiceName);
|
||||||
StringCbCat(DefaultInstance, sizeof DefaultInstance, L" Instance");
|
StringCbCatW(DefaultInstance, sizeof(DefaultInstance), L" Instance");
|
||||||
|
|
||||||
Error = RegSetValueExW(hKey,
|
Error = RegSetValueExW(hKey,
|
||||||
L"DefaultInstance",
|
L"DefaultInstance",
|
||||||
|
|
|
@ -431,7 +431,7 @@ KmtpCreateService(
|
||||||
assert(wcsrchr(DriverPath, L'\\') != NULL);
|
assert(wcsrchr(DriverPath, L'\\') != NULL);
|
||||||
wcsrchr(DriverPath, L'\\')[1] = L'\0';
|
wcsrchr(DriverPath, L'\\')[1] = L'\0';
|
||||||
|
|
||||||
result = StringCbCat(DriverPath, sizeof DriverPath, ServicePath);
|
result = StringCbCatW(DriverPath, sizeof(DriverPath), ServicePath);
|
||||||
if (FAILED(result))
|
if (FAILED(result))
|
||||||
error_value_goto(Error, result, cleanup);
|
error_value_goto(Error, result, cleanup);
|
||||||
|
|
||||||
|
|
|
@ -131,11 +131,11 @@ KmtLoadDriver(
|
||||||
DWORD Error = ERROR_SUCCESS;
|
DWORD Error = ERROR_SUCCESS;
|
||||||
WCHAR ServicePath[MAX_PATH];
|
WCHAR ServicePath[MAX_PATH];
|
||||||
|
|
||||||
StringCbCopy(ServicePath, sizeof ServicePath, ServiceName);
|
StringCbCopyW(ServicePath, sizeof(ServicePath), ServiceName);
|
||||||
StringCbCat(ServicePath, sizeof ServicePath, L"_drv.sys");
|
StringCbCatW(ServicePath, sizeof(ServicePath), L"_drv.sys");
|
||||||
|
|
||||||
StringCbCopy(TestServiceName, sizeof TestServiceName, L"Kmtest-");
|
StringCbCopyW(TestServiceName, sizeof(TestServiceName), L"Kmtest-");
|
||||||
StringCbCat(TestServiceName, sizeof TestServiceName, ServiceName);
|
StringCbCatW(TestServiceName, sizeof(TestServiceName), ServiceName);
|
||||||
|
|
||||||
Error = KmtCreateAndStartService(TestServiceName, ServicePath, NULL, &TestServiceHandle, RestartIfRunning);
|
Error = KmtCreateAndStartService(TestServiceName, ServicePath, NULL, &TestServiceHandle, RestartIfRunning);
|
||||||
|
|
||||||
|
@ -176,8 +176,8 @@ KmtOpenDriver(VOID)
|
||||||
DWORD Error = ERROR_SUCCESS;
|
DWORD Error = ERROR_SUCCESS;
|
||||||
WCHAR DevicePath[MAX_PATH];
|
WCHAR DevicePath[MAX_PATH];
|
||||||
|
|
||||||
StringCbCopy(DevicePath, sizeof DevicePath, L"\\\\.\\Global\\GLOBALROOT\\Device\\");
|
StringCbCopyW(DevicePath, sizeof(DevicePath), L"\\\\.\\Global\\GLOBALROOT\\Device\\");
|
||||||
StringCbCat(DevicePath, sizeof DevicePath, TestServiceName);
|
StringCbCatW(DevicePath, sizeof(DevicePath), TestServiceName);
|
||||||
|
|
||||||
TestDeviceHandle = CreateFile(DevicePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
TestDeviceHandle = CreateFile(DevicePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (TestDeviceHandle == INVALID_HANDLE_VALUE)
|
if (TestDeviceHandle == INVALID_HANDLE_VALUE)
|
||||||
|
|
Loading…
Reference in a new issue