aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2026-01-30 15:18:43 -0800
committerRob Mensching <rob@firegiant.com>2026-01-30 18:38:41 -0800
commit7c3c2cad3c5e95fac151debc89c2f5629b4c6b21 (patch)
tree6d43cdcef8d50a2c524b26681418cee425a39651 /src
parenta16948df3c51f872e750798a967505a93b8439d5 (diff)
downloadwix-7c3c2cad3c5e95fac151debc89c2f5629b4c6b21.tar.gz
wix-7c3c2cad3c5e95fac151debc89c2f5629b4c6b21.tar.bz2
wix-7c3c2cad3c5e95fac151debc89c2f5629b4c6b21.zip
Many small code quality fixes
Diffstat (limited to 'src')
-rw-r--r--src/burn/engine/bootstrapperapplication.cpp2
-rw-r--r--src/burn/engine/burnpipe.cpp6
-rw-r--r--src/burn/engine/cabextract.cpp8
-rw-r--r--src/burn/engine/cache.cpp8
-rw-r--r--src/burn/engine/core.cpp7
-rw-r--r--src/burn/engine/dependency.cpp4
-rw-r--r--src/burn/engine/elevation.cpp2
-rw-r--r--src/burn/engine/exeengine.cpp2
-rw-r--r--src/burn/engine/logging.cpp7
-rw-r--r--src/burn/engine/msiengine.cpp12
-rw-r--r--src/burn/engine/msuengine.cpp2
-rw-r--r--src/burn/engine/plan.cpp3
-rw-r--r--src/burn/engine/pseudobundle.cpp11
-rw-r--r--src/burn/engine/search.cpp2
-rw-r--r--src/burn/engine/variant.cpp45
15 files changed, 73 insertions, 48 deletions
diff --git a/src/burn/engine/bootstrapperapplication.cpp b/src/burn/engine/bootstrapperapplication.cpp
index dc3bd5da..346c47a5 100644
--- a/src/burn/engine/bootstrapperapplication.cpp
+++ b/src/burn/engine/bootstrapperapplication.cpp
@@ -674,7 +674,7 @@ static HRESULT VerifyPipeSecret(
674 hr = StrAlloc(&sczVerificationSecret, cbVerificationSecret / sizeof(WCHAR) + 1); 674 hr = StrAlloc(&sczVerificationSecret, cbVerificationSecret / sizeof(WCHAR) + 1);
675 ExitOnFailure(hr, "Failed to allocate buffer for bootstrapper application verification secret."); 675 ExitOnFailure(hr, "Failed to allocate buffer for bootstrapper application verification secret.");
676 676
677 FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(sczVerificationSecret), cbVerificationSecret); 677 hr = FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(sczVerificationSecret), cbVerificationSecret);
678 ExitOnFailure(hr, "Failed to read verification secret from bootstrapper application pipe."); 678 ExitOnFailure(hr, "Failed to read verification secret from bootstrapper application pipe.");
679 679
680 // Verify the secrets match. 680 // Verify the secrets match.
diff --git a/src/burn/engine/burnpipe.cpp b/src/burn/engine/burnpipe.cpp
index ec85822e..102ccb4f 100644
--- a/src/burn/engine/burnpipe.cpp
+++ b/src/burn/engine/burnpipe.cpp
@@ -446,11 +446,11 @@ extern "C" HRESULT BurnPipeChildConnect(
446 446
447 // Try to connect to the parent. 447 // Try to connect to the parent.
448 hr = PipeClientConnect(pConnection->sczName, &pConnection->hPipe); 448 hr = PipeClientConnect(pConnection->sczName, &pConnection->hPipe);
449 ExitOnRootFailure(hr, "Failed to open parent pipe: %ls", sczPipeName) 449 ExitOnRootFailure(hr, "Failed to open parent pipe: %ls", pConnection->sczName)
450 450
451 // Verify the parent and notify it that the child connected. 451 // Verify the parent and notify it that the child connected.
452 hr = ChildPipeConnected(pConnection->hPipe, pConnection->sczSecret, &pConnection->dwProcessId); 452 hr = ChildPipeConnected(pConnection->hPipe, pConnection->sczSecret, &pConnection->dwProcessId);
453 ExitOnFailure(hr, "Failed to verify parent pipe: %ls", sczPipeName); 453 ExitOnFailure(hr, "Failed to verify parent pipe: %ls", pConnection->sczName);
454 454
455 if (fCompanion) 455 if (fCompanion)
456 { 456 {
@@ -511,7 +511,7 @@ static HRESULT ChildPipeConnected(
511 hr = StrAlloc(&sczVerificationSecret, cbVerificationSecret / sizeof(WCHAR) + 1); 511 hr = StrAlloc(&sczVerificationSecret, cbVerificationSecret / sizeof(WCHAR) + 1);
512 ExitOnFailure(hr, "Failed to allocate buffer for verification secret."); 512 ExitOnFailure(hr, "Failed to allocate buffer for verification secret.");
513 513
514 FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(sczVerificationSecret), cbVerificationSecret); 514 hr = FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(sczVerificationSecret), cbVerificationSecret);
515 ExitOnFailure(hr, "Failed to read verification secret from parent pipe."); 515 ExitOnFailure(hr, "Failed to read verification secret from parent pipe.");
516 516
517 // Verify the secrets match. 517 // Verify the secrets match.
diff --git a/src/burn/engine/cabextract.cpp b/src/burn/engine/cabextract.cpp
index 5663c3f7..2140130d 100644
--- a/src/burn/engine/cabextract.cpp
+++ b/src/burn/engine/cabextract.cpp
@@ -833,9 +833,13 @@ static UINT FAR DIAMONDAPI CabWrite(
833 833
834 case BURN_CAB_OPERATION_STREAM_TO_BUFFER: 834 case BURN_CAB_OPERATION_STREAM_TO_BUFFER:
835 // copy to target buffer 835 // copy to target buffer
836 memcpy_s(pContext->Cabinet.pbTargetBuffer + pContext->Cabinet.iTargetBuffer, pContext->Cabinet.cbTargetBuffer - pContext->Cabinet.iTargetBuffer, pv, cb); 836 if (memcpy_s(pContext->Cabinet.pbTargetBuffer + pContext->Cabinet.iTargetBuffer, pContext->Cabinet.cbTargetBuffer - pContext->Cabinet.iTargetBuffer, pv, cb))
837 pContext->Cabinet.iTargetBuffer += cb; 837 {
838 hr = E_INSUFFICIENT_BUFFER;
839 ExitOnRootFailure(hr, "Failed to copy data to target buffer during cabinet extraction.");
840 }
838 841
842 pContext->Cabinet.iTargetBuffer += cb;
839 cbWrite = cb; 843 cbWrite = cb;
840 break; 844 break;
841 845
diff --git a/src/burn/engine/cache.cpp b/src/burn/engine/cache.cpp
index f5df6500..c85a1be4 100644
--- a/src/burn/engine/cache.cpp
+++ b/src/burn/engine/cache.cpp
@@ -363,6 +363,8 @@ extern "C" HRESULT CacheEnsureBaseWorkingFolder(
363 } 363 }
364 364
365 pWorkingFolderAcl = reinterpret_cast<LPSECURITY_ATTRIBUTES>(MemAlloc(sizeof(SECURITY_ATTRIBUTES), TRUE)); 365 pWorkingFolderAcl = reinterpret_cast<LPSECURITY_ATTRIBUTES>(MemAlloc(sizeof(SECURITY_ATTRIBUTES), TRUE));
366 ExitOnNull(pWorkingFolderAcl, hr, E_OUTOFMEMORY, "Failed to allocate security attributes.");
367
366 pWorkingFolderAcl->nLength = sizeof(SECURITY_ATTRIBUTES); 368 pWorkingFolderAcl->nLength = sizeof(SECURITY_ATTRIBUTES);
367 pWorkingFolderAcl->lpSecurityDescriptor = psd; 369 pWorkingFolderAcl->lpSecurityDescriptor = psd;
368 pWorkingFolderAcl->bInheritHandle = FALSE; 370 pWorkingFolderAcl->bInheritHandle = FALSE;
@@ -857,6 +859,7 @@ extern "C" HRESULT CacheSendProgressCallback(
857 case PROGRESS_STOP: 859 case PROGRESS_STOP:
858 hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); 860 hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
859 ExitOnRootFailure(hr, "UX aborted on download progress."); 861 ExitOnRootFailure(hr, "UX aborted on download progress.");
862 break;
860 863
861 case PROGRESS_QUIET: // Not actually an error, just an indication to the caller to stop requesting progress. 864 case PROGRESS_QUIET: // Not actually an error, just an indication to the caller to stop requesting progress.
862 pCallback->pfnProgress = NULL; 865 pCallback->pfnProgress = NULL;
@@ -866,6 +869,7 @@ extern "C" HRESULT CacheSendProgressCallback(
866 default: 869 default:
867 hr = E_UNEXPECTED; 870 hr = E_UNEXPECTED;
868 ExitOnRootFailure(hr, "Invalid return code from progress routine."); 871 ExitOnRootFailure(hr, "Invalid return code from progress routine.");
872 break;
869 } 873 }
870 } 874 }
871 875
@@ -1435,8 +1439,8 @@ extern "C" void CacheUninitialize(
1435 ReleaseStr(pCache->sczBaseWorkingFolder); 1439 ReleaseStr(pCache->sczBaseWorkingFolder);
1436 ReleaseStr(pCache->sczAcquisitionFolder); 1440 ReleaseStr(pCache->sczAcquisitionFolder);
1437 ReleaseStr(pCache->sczSourceProcessFolder); 1441 ReleaseStr(pCache->sczSourceProcessFolder);
1438 ReleaseStr(pCache->sczBundleEngineWorkingPath) 1442 ReleaseStr(pCache->sczBundleEngineWorkingPath);
1439 ReleaseFileHandle(pCache->hBundleEngineWorkingFile) 1443 ReleaseFileHandle(pCache->hBundleEngineWorkingFile);
1440 1444
1441 memset(pCache, 0, sizeof(BURN_CACHE)); 1445 memset(pCache, 0, sizeof(BURN_CACHE));
1442} 1446}
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp
index de202321..2dfa4857 100644
--- a/src/burn/engine/core.cpp
+++ b/src/burn/engine/core.cpp
@@ -1232,8 +1232,11 @@ HRESULT CoreAppendLogToCommandLine(
1232 hr = StrAllocConcat(psczCommandLine, szLogArgFormatted, 0); 1232 hr = StrAllocConcat(psczCommandLine, szLogArgFormatted, 0);
1233 ExitOnFailure(hr, "Failed concatenating '-log' to command line"); 1233 ExitOnFailure(hr, "Failed concatenating '-log' to command line");
1234 1234
1235 hr = StrAllocConcat(psczObfuscatedCommandLine, szLogArgFormatted, 0); 1235 if (psczObfuscatedCommandLine)
1236 ExitOnFailure(hr, "Failed concatenating '-log' to obfuscated command line"); 1236 {
1237 hr = StrAllocConcat(psczObfuscatedCommandLine, szLogArgFormatted, 0);
1238 ExitOnFailure(hr, "Failed concatenating '-log' to obfuscated command line");
1239 }
1237 1240
1238LExit: 1241LExit:
1239 if (rgszArgs) 1242 if (rgszArgs)
diff --git a/src/burn/engine/dependency.cpp b/src/burn/engine/dependency.cpp
index 6f80c21b..94a8a1e4 100644
--- a/src/burn/engine/dependency.cpp
+++ b/src/burn/engine/dependency.cpp
@@ -601,8 +601,8 @@ extern "C" HRESULT DependencyPlanPackageBegin(
601 pProvider->dependentExecute = BURN_DEPENDENCY_ACTION_NONE; 601 pProvider->dependentExecute = BURN_DEPENDENCY_ACTION_NONE;
602 } 602 }
603 603
604 if (BURN_DEPENDENCY_ACTION_UNREGISTER == pProvider->dependentRollback && pProvider->fBundleRegisteredAsDependent || 604 if ((BURN_DEPENDENCY_ACTION_UNREGISTER == pProvider->dependentRollback && pProvider->fBundleRegisteredAsDependent) ||
605 BURN_DEPENDENCY_ACTION_REGISTER == pProvider->dependentRollback && !pProvider->fBundleRegisteredAsDependent) 605 (BURN_DEPENDENCY_ACTION_REGISTER == pProvider->dependentRollback && !pProvider->fBundleRegisteredAsDependent))
606 { 606 {
607 pProvider->dependentRollback = BURN_DEPENDENCY_ACTION_NONE; 607 pProvider->dependentRollback = BURN_DEPENDENCY_ACTION_NONE;
608 } 608 }
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp
index aff05ae3..acaa8276 100644
--- a/src/burn/engine/elevation.cpp
+++ b/src/burn/engine/elevation.cpp
@@ -2824,7 +2824,7 @@ LExit:
2824 // TODO: do the right thing here. 2824 // TODO: do the right thing here.
2825 //DependencyUninitializeRegistrationAction(&action); 2825 //DependencyUninitializeRegistrationAction(&action);
2826 ReleaseStr(action.sczDependentProviderKey); 2826 ReleaseStr(action.sczDependentProviderKey);
2827 ReleaseStr(action.sczBundleCode) 2827 ReleaseStr(action.sczBundleCode);
2828 2828
2829 return hr; 2829 return hr;
2830} 2830}
diff --git a/src/burn/engine/exeengine.cpp b/src/burn/engine/exeengine.cpp
index 4df762da..c001e563 100644
--- a/src/burn/engine/exeengine.cpp
+++ b/src/burn/engine/exeengine.cpp
@@ -449,7 +449,7 @@ extern "C" HRESULT ExeEngineExecutePackage(
449 449
450 if (BURN_EXE_DETECTION_TYPE_ARP == pPackage->Exe.detectionType && 450 if (BURN_EXE_DETECTION_TYPE_ARP == pPackage->Exe.detectionType &&
451 (BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pExecuteAction->exePackage.action || 451 (BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pExecuteAction->exePackage.action ||
452 BOOTSTRAPPER_ACTION_STATE_INSTALL == pExecuteAction->exePackage.action && fRollback)) 452 (BOOTSTRAPPER_ACTION_STATE_INSTALL == pExecuteAction->exePackage.action && fRollback)))
453 { 453 {
454 hr = DetectArpEntry(pPackage, &applyState, &sczArpUninstallString); 454 hr = DetectArpEntry(pPackage, &applyState, &sczArpUninstallString);
455 ExitOnFailure(hr, "Failed to query ArpEntry for %hs.", BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pExecuteAction->exePackage.action ? "uninstall" : "install"); 455 ExitOnFailure(hr, "Failed to query ArpEntry for %hs.", BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pExecuteAction->exePackage.action ? "uninstall" : "install");
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp
index 51b546ad..52123499 100644
--- a/src/burn/engine/logging.cpp
+++ b/src/burn/engine/logging.cpp
@@ -322,15 +322,17 @@ extern "C" HRESULT LoggingSetPackageVariable(
322 ExitFunction(); 322 ExitFunction();
323 } 323 }
324 324
325 // For burn packages we'll add logging even it it wasn't explictly specified 325 // For burn packages we'll add logging even it it wasn't explictly specified.
326 if (BURN_PACKAGE_TYPE_BUNDLE == pPackage->type || (BURN_PACKAGE_TYPE_EXE == pPackage->type && BURN_EXE_PROTOCOL_TYPE_BURN == pPackage->Exe.protocol)) 326 if (BURN_PACKAGE_TYPE_BUNDLE == pPackage->type || (BURN_PACKAGE_TYPE_EXE == pPackage->type && BURN_EXE_PROTOCOL_TYPE_BURN == pPackage->Exe.protocol))
327 { 327 {
328 if (!fRollback && (!pPackage->sczLogPathVariable || !*pPackage->sczLogPathVariable)) 328 if (!fRollback && (!pPackage->sczLogPathVariable || !*pPackage->sczLogPathVariable))
329 { 329 {
330 // Best effort, no need to fail if we can't set the logging path.
330 StrAllocFormatted(&pPackage->sczLogPathVariable, L"WixBundleLog_%ls", pPackage->sczId); 331 StrAllocFormatted(&pPackage->sczLogPathVariable, L"WixBundleLog_%ls", pPackage->sczId);
331 } 332 }
332 else if (fRollback && (!pPackage->sczRollbackLogPathVariable || !*pPackage->sczRollbackLogPathVariable)) 333 else if (fRollback && (!pPackage->sczRollbackLogPathVariable || !*pPackage->sczRollbackLogPathVariable))
333 { 334 {
335 // Best effort, no need to fail if we can't set the logging path.
334 StrAllocFormatted(&pPackage->sczRollbackLogPathVariable, L"WixBundleRollbackLog_%ls", pPackage->sczId); 336 StrAllocFormatted(&pPackage->sczRollbackLogPathVariable, L"WixBundleRollbackLog_%ls", pPackage->sczId);
335 } 337 }
336 } 338 }
@@ -1052,7 +1054,8 @@ static HRESULT GetNonSessionSpecificTempFolder(
1052 hr = ::StringCchLengthW(sczSessionId, STRSAFE_MAX_CCH, reinterpret_cast<size_t*>(&cchSessionId)); 1054 hr = ::StringCchLengthW(sczSessionId, STRSAFE_MAX_CCH, reinterpret_cast<size_t*>(&cchSessionId));
1053 ExitOnFailure(hr, "Failed to get length of session id string."); 1055 ExitOnFailure(hr, "Failed to get length of session id string.");
1054 1056
1055 if (CSTR_EQUAL == ::CompareStringOrdinal(sczTempFolder + cchTempFolder - cchSessionId, static_cast<DWORD>(cchSessionId), sczSessionId, static_cast<DWORD>(cchSessionId), FALSE)) 1057 if (cchTempFolder >= cchSessionId &&
1058 CSTR_EQUAL == ::CompareStringOrdinal(sczTempFolder + cchTempFolder - cchSessionId, static_cast<DWORD>(cchSessionId), sczSessionId, static_cast<DWORD>(cchSessionId), FALSE))
1056 { 1059 {
1057 cchTempFolder -= cchSessionId; 1060 cchTempFolder -= cchSessionId;
1058 } 1061 }
diff --git a/src/burn/engine/msiengine.cpp b/src/burn/engine/msiengine.cpp
index 48ec0c81..a1379054 100644
--- a/src/burn/engine/msiengine.cpp
+++ b/src/burn/engine/msiengine.cpp
@@ -2158,7 +2158,7 @@ static HRESULT ConcatFeatureActionProperties(
2158 2158
2159 if (sczAddLocal) 2159 if (sczAddLocal)
2160 { 2160 {
2161 hr = StrAllocFormatted(&scz, L" ADDLOCAL=\"%s\"", sczAddLocal, 0); 2161 hr = StrAllocFormatted(&scz, L" ADDLOCAL=\"%s\"", sczAddLocal);
2162 ExitOnFailure(hr, "Failed to format ADDLOCAL string."); 2162 ExitOnFailure(hr, "Failed to format ADDLOCAL string.");
2163 2163
2164 hr = StrAllocConcatSecure(psczArguments, scz, 0); 2164 hr = StrAllocConcatSecure(psczArguments, scz, 0);
@@ -2167,7 +2167,7 @@ static HRESULT ConcatFeatureActionProperties(
2167 2167
2168 if (sczAddSource) 2168 if (sczAddSource)
2169 { 2169 {
2170 hr = StrAllocFormatted(&scz, L" ADDSOURCE=\"%s\"", sczAddSource, 0); 2170 hr = StrAllocFormatted(&scz, L" ADDSOURCE=\"%s\"", sczAddSource);
2171 ExitOnFailure(hr, "Failed to format ADDSOURCE string."); 2171 ExitOnFailure(hr, "Failed to format ADDSOURCE string.");
2172 2172
2173 hr = StrAllocConcatSecure(psczArguments, scz, 0); 2173 hr = StrAllocConcatSecure(psczArguments, scz, 0);
@@ -2176,7 +2176,7 @@ static HRESULT ConcatFeatureActionProperties(
2176 2176
2177 if (sczAddDefault) 2177 if (sczAddDefault)
2178 { 2178 {
2179 hr = StrAllocFormatted(&scz, L" ADDDEFAULT=\"%s\"", sczAddDefault, 0); 2179 hr = StrAllocFormatted(&scz, L" ADDDEFAULT=\"%s\"", sczAddDefault);
2180 ExitOnFailure(hr, "Failed to format ADDDEFAULT string."); 2180 ExitOnFailure(hr, "Failed to format ADDDEFAULT string.");
2181 2181
2182 hr = StrAllocConcatSecure(psczArguments, scz, 0); 2182 hr = StrAllocConcatSecure(psczArguments, scz, 0);
@@ -2185,7 +2185,7 @@ static HRESULT ConcatFeatureActionProperties(
2185 2185
2186 if (sczReinstall) 2186 if (sczReinstall)
2187 { 2187 {
2188 hr = StrAllocFormatted(&scz, L" REINSTALL=\"%s\"", sczReinstall, 0); 2188 hr = StrAllocFormatted(&scz, L" REINSTALL=\"%s\"", sczReinstall);
2189 ExitOnFailure(hr, "Failed to format REINSTALL string."); 2189 ExitOnFailure(hr, "Failed to format REINSTALL string.");
2190 2190
2191 hr = StrAllocConcatSecure(psczArguments, scz, 0); 2191 hr = StrAllocConcatSecure(psczArguments, scz, 0);
@@ -2194,7 +2194,7 @@ static HRESULT ConcatFeatureActionProperties(
2194 2194
2195 if (sczAdvertise) 2195 if (sczAdvertise)
2196 { 2196 {
2197 hr = StrAllocFormatted(&scz, L" ADVERTISE=\"%s\"", sczAdvertise, 0); 2197 hr = StrAllocFormatted(&scz, L" ADVERTISE=\"%s\"", sczAdvertise);
2198 ExitOnFailure(hr, "Failed to format ADVERTISE string."); 2198 ExitOnFailure(hr, "Failed to format ADVERTISE string.");
2199 2199
2200 hr = StrAllocConcatSecure(psczArguments, scz, 0); 2200 hr = StrAllocConcatSecure(psczArguments, scz, 0);
@@ -2203,7 +2203,7 @@ static HRESULT ConcatFeatureActionProperties(
2203 2203
2204 if (sczRemove) 2204 if (sczRemove)
2205 { 2205 {
2206 hr = StrAllocFormatted(&scz, L" REMOVE=\"%s\"", sczRemove, 0); 2206 hr = StrAllocFormatted(&scz, L" REMOVE=\"%s\"", sczRemove);
2207 ExitOnFailure(hr, "Failed to format REMOVE string."); 2207 ExitOnFailure(hr, "Failed to format REMOVE string.");
2208 2208
2209 hr = StrAllocConcatSecure(psczArguments, scz, 0); 2209 hr = StrAllocConcatSecure(psczArguments, scz, 0);
diff --git a/src/burn/engine/msuengine.cpp b/src/burn/engine/msuengine.cpp
index 43f5f76c..d31691a5 100644
--- a/src/burn/engine/msuengine.cpp
+++ b/src/burn/engine/msuengine.cpp
@@ -313,6 +313,8 @@ LExit:
313 SetServiceStartType(schWu, SERVICE_DISABLED); 313 SetServiceStartType(schWu, SERVICE_DISABLED);
314 } 314 }
315 315
316 ReleaseServiceHandle(schWu);
317
316 // Best effort to clear the execute package cache folder variable. 318 // Best effort to clear the execute package cache folder variable.
317 VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, NULL, TRUE, FALSE); 319 VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, NULL, TRUE, FALSE);
318 320
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp
index a6196e3c..9feb56ff 100644
--- a/src/burn/engine/plan.cpp
+++ b/src/burn/engine/plan.cpp
@@ -1542,7 +1542,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete(
1542 1542
1543 if (fBundle && BOOTSTRAPPER_ACTION_STATE_NONE != packageAction) 1543 if (fBundle && BOOTSTRAPPER_ACTION_STATE_NONE != packageAction)
1544 { 1544 {
1545 if (pPackage->cDependencyProviders) 1545 if (pPackage && pPackage->cDependencyProviders)
1546 { 1546 {
1547 // Bundles only support a single provider key. 1547 // Bundles only support a single provider key.
1548 const BURN_DEPENDENCY_PROVIDER* pProvider = pPackage->rgDependencyProviders; 1548 const BURN_DEPENDENCY_PROVIDER* pProvider = pPackage->rgDependencyProviders;
@@ -2015,6 +2015,7 @@ extern "C" HRESULT PlanRollbackBoundaryComplete(
2015 2015
2016 // Add checkpoints. 2016 // Add checkpoints.
2017 hr = PlanExecuteCheckpoint(pPlan); 2017 hr = PlanExecuteCheckpoint(pPlan);
2018 ExitOnFailure(hr, "Failed to append execute checkpoint for rollback boundary complete.");
2018 2019
2019 // Add complete rollback boundary to execute plan. 2020 // Add complete rollback boundary to execute plan.
2020 hr = PlanAppendExecuteAction(pPlan, &pExecuteAction); 2021 hr = PlanAppendExecuteAction(pPlan, &pExecuteAction);
diff --git a/src/burn/engine/pseudobundle.cpp b/src/burn/engine/pseudobundle.cpp
index f0d67068..ff7f185c 100644
--- a/src/burn/engine/pseudobundle.cpp
+++ b/src/burn/engine/pseudobundle.cpp
@@ -127,8 +127,8 @@ extern "C" HRESULT PseudoBundleInitializePassthrough(
127 ExitOnFailure(hr, "Failed to copy cache id for passthrough pseudo bundle."); 127 ExitOnFailure(hr, "Failed to copy cache id for passthrough pseudo bundle.");
128 128
129 // Log variables - best effort 129 // Log variables - best effort
130 StrAllocFormatted(&pPackage->sczLogPathVariable, L"WixBundleLog_%ls", pPackage->sczId); 130 StrAllocFormatted(&pPassthroughPackage->sczLogPathVariable, L"WixBundleLog_%ls", pPackage->sczId);
131 StrAllocFormatted(&pPackage->sczRollbackLogPathVariable, L"WixBundleRollbackLog_%ls", pPackage->sczId); 131 StrAllocFormatted(&pPassthroughPackage->sczRollbackLogPathVariable, L"WixBundleRollbackLog_%ls", pPackage->sczId);
132 132
133 hr = CoreCreatePassthroughBundleCommandLine(&sczArguments, pInternalCommand, pCommand); 133 hr = CoreCreatePassthroughBundleCommandLine(&sczArguments, pInternalCommand, pCommand);
134 ExitOnFailure(hr, "Failed to create command-line arguments."); 134 ExitOnFailure(hr, "Failed to create command-line arguments.");
@@ -155,6 +155,8 @@ extern "C" HRESULT PseudoBundleInitializeUpdateBundle(
155{ 155{
156 HRESULT hr = S_OK; 156 HRESULT hr = S_OK;
157 BURN_PAYLOAD* pPayload = NULL; 157 BURN_PAYLOAD* pPayload = NULL;
158 BYTE* rgbHash = NULL;
159 DWORD cbHash = 0;
158 160
159 // Initialize the single payload, and fill out all the necessary fields 161 // Initialize the single payload, and fill out all the necessary fields
160 pPackage->payloads.rgItems = (BURN_PAYLOAD_GROUP_ITEM*)MemAlloc(sizeof(BURN_PAYLOAD_GROUP_ITEM), TRUE); 162 pPackage->payloads.rgItems = (BURN_PAYLOAD_GROUP_ITEM*)MemAlloc(sizeof(BURN_PAYLOAD_GROUP_ITEM), TRUE);
@@ -185,9 +187,6 @@ extern "C" HRESULT PseudoBundleInitializeUpdateBundle(
185 187
186 if (wzHash && *wzHash) 188 if (wzHash && *wzHash)
187 { 189 {
188 BYTE* rgbHash = NULL;
189 DWORD cbHash = 0;
190
191 hr = StrAllocHexDecode(wzHash, &rgbHash, &cbHash); 190 hr = StrAllocHexDecode(wzHash, &rgbHash, &cbHash);
192 ExitOnFailure(hr, "Failed to decode hash string: %ls.", wzHash); 191 ExitOnFailure(hr, "Failed to decode hash string: %ls.", wzHash);
193 192
@@ -223,5 +222,7 @@ extern "C" HRESULT PseudoBundleInitializeUpdateBundle(
223 ExitOnFailure(hr, "Failed to copy install arguments for update bundle package"); 222 ExitOnFailure(hr, "Failed to copy install arguments for update bundle package");
224 223
225LExit: 224LExit:
225 ReleaseStr(rgbHash);
226
226 return hr; 227 return hr;
227} 228}
diff --git a/src/burn/engine/search.cpp b/src/burn/engine/search.cpp
index 1f128e95..a60215fe 100644
--- a/src/burn/engine/search.cpp
+++ b/src/burn/engine/search.cpp
@@ -334,7 +334,7 @@ extern "C" HRESULT SearchesParseFromXml(
334 { 334 {
335 pSearch->MsiProductSearch.Type = BURN_MSI_PRODUCT_SEARCH_TYPE_ASSIGNMENT; 335 pSearch->MsiProductSearch.Type = BURN_MSI_PRODUCT_SEARCH_TYPE_ASSIGNMENT;
336 } 336 }
337 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"exists", -1)) 337 else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"exists", -1, FALSE))
338 { 338 {
339 pSearch->MsiProductSearch.Type = BURN_MSI_PRODUCT_SEARCH_TYPE_EXISTS; 339 pSearch->MsiProductSearch.Type = BURN_MSI_PRODUCT_SEARCH_TYPE_EXISTS;
340 } 340 }
diff --git a/src/burn/engine/variant.cpp b/src/burn/engine/variant.cpp
index 2267ee7b..3fc02aa8 100644
--- a/src/burn/engine/variant.cpp
+++ b/src/burn/engine/variant.cpp
@@ -10,6 +10,9 @@ static HRESULT GetVersionInternal(
10 __in BOOL fSilent, 10 __in BOOL fSilent,
11 __out VERUTIL_VERSION** ppValue 11 __out VERUTIL_VERSION** ppValue
12 ); 12 );
13static void FreeVariantValue(
14 __in BURN_VARIANT* pVariant
15 );
13 16
14// function definitions 17// function definitions
15 18
@@ -17,12 +20,7 @@ extern "C" void BVariantUninitialize(
17 __in BURN_VARIANT* pVariant 20 __in BURN_VARIANT* pVariant
18 ) 21 )
19{ 22{
20 if (BURN_VARIANT_TYPE_FORMATTED == pVariant->Type || 23 FreeVariantValue(pVariant);
21 BURN_VARIANT_TYPE_STRING == pVariant->Type)
22 {
23 StrSecureZeroFreeString(pVariant->sczValue);
24 }
25 SecureZeroMemory(pVariant, sizeof(BURN_VARIANT));
26} 24}
27 25
28extern "C" HRESULT BVariantGetNumeric( 26extern "C" HRESULT BVariantGetNumeric(
@@ -164,12 +162,8 @@ extern "C" HRESULT BVariantSetNumeric(
164{ 162{
165 HRESULT hr = S_OK; 163 HRESULT hr = S_OK;
166 164
167 if (BURN_VARIANT_TYPE_FORMATTED == pVariant->Type || 165 FreeVariantValue(pVariant);
168 BURN_VARIANT_TYPE_STRING == pVariant->Type) 166
169 {
170 StrSecureZeroFreeString(pVariant->sczValue);
171 }
172 memset(pVariant, 0, sizeof(BURN_VARIANT));
173 pVariant->llValue = llValue; 167 pVariant->llValue = llValue;
174 pVariant->Type = BURN_VARIANT_TYPE_NUMERIC; 168 pVariant->Type = BURN_VARIANT_TYPE_NUMERIC;
175 169
@@ -194,7 +188,7 @@ extern "C" HRESULT BVariantSetString(
194 if (BURN_VARIANT_TYPE_FORMATTED != pVariant->Type && 188 if (BURN_VARIANT_TYPE_FORMATTED != pVariant->Type &&
195 BURN_VARIANT_TYPE_STRING != pVariant->Type) 189 BURN_VARIANT_TYPE_STRING != pVariant->Type)
196 { 190 {
197 memset(pVariant, 0, sizeof(BURN_VARIANT)); 191 FreeVariantValue(pVariant);
198 } 192 }
199 193
200 hr = StrAllocStringSecure(&pVariant->sczValue, wzValue, cchValue); 194 hr = StrAllocStringSecure(&pVariant->sczValue, wzValue, cchValue);
@@ -220,12 +214,8 @@ extern "C" HRESULT BVariantSetVersion(
220 } 214 }
221 else // assign the value. 215 else // assign the value.
222 { 216 {
223 if (BURN_VARIANT_TYPE_FORMATTED == pVariant->Type || 217 FreeVariantValue(pVariant);
224 BURN_VARIANT_TYPE_STRING == pVariant->Type) 218
225 {
226 StrSecureZeroFreeString(pVariant->sczValue);
227 }
228 memset(pVariant, 0, sizeof(BURN_VARIANT));
229 hr = VerCopyVersion(pValue, &pVariant->pValue); 219 hr = VerCopyVersion(pValue, &pVariant->pValue);
230 pVariant->Type = BURN_VARIANT_TYPE_VERSION; 220 pVariant->Type = BURN_VARIANT_TYPE_VERSION;
231 } 221 }
@@ -319,3 +309,20 @@ extern "C" HRESULT BVariantChangeType(
319LExit: 309LExit:
320 return hr; 310 return hr;
321} 311}
312
313static void FreeVariantValue(
314 __in BURN_VARIANT* pVariant
315 )
316{
317 if ((BURN_VARIANT_TYPE_FORMATTED == pVariant->Type || BURN_VARIANT_TYPE_STRING == pVariant->Type) &&
318 pVariant->sczValue)
319 {
320 StrSecureZeroFreeString(pVariant->sczValue);
321 }
322 else if (BURN_VARIANT_TYPE_VERSION == pVariant->Type && pVariant->pValue)
323 {
324 VerFreeVersion(pVariant->pValue);
325 }
326
327 SecureZeroMemory(pVariant, sizeof(BURN_VARIANT));
328}