From 70f15564021cbe9eda5b48bee9a07e13e3e3f2c2 Mon Sep 17 00:00:00 2001 From: Nir Bar Date: Thu, 18 Jul 2024 14:13:41 +0300 Subject: [PATCH] Fix multi-string initialization --- src/CaCommon/WixString.h | 2 +- src/PanelSwCustomActions/ExecOnComponent.cpp | 3 +-- src/TidyBuild.custom.props | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/CaCommon/WixString.h b/src/CaCommon/WixString.h index 9548e2e..e7d41a5 100644 --- a/src/CaCommon/WixString.h +++ b/src/CaCommon/WixString.h @@ -570,7 +570,7 @@ class CWixString if (!_pS) { - hr = Format(L"%ls\0", sz); + hr = Format(L"%ls%lc", sz, L'\0'); ExitOnFailure(hr, "Failed to allocate string"); ExitFunction(); } diff --git a/src/PanelSwCustomActions/ExecOnComponent.cpp b/src/PanelSwCustomActions/ExecOnComponent.cpp index 888cdc6..1071a51 100644 --- a/src/PanelSwCustomActions/ExecOnComponent.cpp +++ b/src/PanelSwCustomActions/ExecOnComponent.cpp @@ -997,7 +997,7 @@ HRESULT CExecOnComponent::SetEnvironment(CWixString* pszEnvironmentMultiSz, cons BOOL bFound = FALSE; for (LPCWSTR szCurr = nullptr; SUCCEEDED(pszEnvironmentMultiSz->MultiStringGet(i, &szCurr)); ++i) { - LPCWSTR szEqual = wcschr(szCurr, L'=');; + LPCWSTR szEqual = wcschr(szCurr, L'='); DWORD dwLen1 = szEqual - szCurr; if (!dwLen1 || !szEqual) { @@ -1149,7 +1149,6 @@ HRESULT CExecOnComponent::LaunchProcess(IMPERSONATION_CONTEXT* pctxImpersonation bRes = ::CreateProcess(nullptr, szCommand, nullptr, nullptr, TRUE, ::GetPriorityClass(::GetCurrentProcess()) | CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT, (LPVOID)rgszEnvironment, szWorkingDirectory, &si, &pi); ExitOnNullWithLastError(bRes, hr, "Failed to create process"); } - WcaLog(LOGLEVEL::LOGMSG_VERBOSE, "Launched process '%ls'", szCommand); if (phStdOut) { diff --git a/src/TidyBuild.custom.props b/src/TidyBuild.custom.props index 62f938c..6ef739a 100644 --- a/src/TidyBuild.custom.props +++ b/src/TidyBuild.custom.props @@ -2,7 +2,7 @@ - 5.1.1 + 5.1.2 $(FullVersion).$(GITHUB_RUN_NUMBER) PanelSwWixExtension Panel::Software