summaryrefslogtreecommitdiff
path: root/src/api/burn/balutil/balutil.cpp
diff options
context:
space:
mode:
authorJacob Hoover <jacob.hoover@greenheck.com>2022-11-10 10:48:23 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-11-10 23:49:10 -0600
commitfa393914f12f6d6bc88a73e4d5b009da765f6dd5 (patch)
tree6dbf354d4542b3e085795b0a917eaafc1eead415 /src/api/burn/balutil/balutil.cpp
parentc843b47d6233153fa961c6d0e61edf7cedf255bb (diff)
downloadwix-fa393914f12f6d6bc88a73e4d5b009da765f6dd5.tar.gz
wix-fa393914f12f6d6bc88a73e4d5b009da765f6dd5.tar.bz2
wix-fa393914f12f6d6bc88a73e4d5b009da765f6dd5.zip
WIXFEAT-3704 - Allow access to persisted variables from related bundles
Diffstat (limited to 'src/api/burn/balutil/balutil.cpp')
-rw-r--r--src/api/burn/balutil/balutil.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/api/burn/balutil/balutil.cpp b/src/api/burn/balutil/balutil.cpp
index 5671da4e..2d80878c 100644
--- a/src/api/burn/balutil/balutil.cpp
+++ b/src/api/burn/balutil/balutil.cpp
@@ -421,6 +421,57 @@ LExit:
421 return hr; 421 return hr;
422} 422}
423 423
424DAPI_(HRESULT) BalGetRelatedBundleVariable(
425 __in_z LPCWSTR wzBundleId,
426 __in_z LPCWSTR wzVariable,
427 __inout LPWSTR* psczValue
428)
429{
430 HRESULT hr = S_OK;
431
432 if (!vpEngine)
433 {
434 hr = E_POINTER;
435 ExitOnRootFailure(hr, "BalInitialize() must be called first.");
436 }
437
438 hr = BalGetRelatedBundleVariableFromEngine(vpEngine, wzBundleId, wzVariable, psczValue);
439
440LExit:
441 return hr;
442}
443
444DAPI_(HRESULT) BalGetRelatedBundleVariableFromEngine(
445 __in IBootstrapperEngine* pEngine,
446 __in_z LPCWSTR wzBundleId,
447 __in_z LPCWSTR wzVariable,
448 __inout LPWSTR* psczValue
449)
450{
451 HRESULT hr = S_OK;
452 SIZE_T cch = 0;
453
454 if (*psczValue)
455 {
456 hr = StrMaxLength(*psczValue, reinterpret_cast<DWORD_PTR*>(&cch));
457 ExitOnFailure(hr, "Failed to determine length of value.");
458 }
459
460 hr = pEngine->GetRelatedBundleVariable(wzBundleId, wzVariable, *psczValue, &cch);
461 if (E_MOREDATA == hr)
462 {
463 ++cch;
464
465 hr = StrAllocSecure(psczValue, cch);
466 ExitOnFailure(hr, "Failed to allocate value.");
467
468 hr = pEngine->GetRelatedBundleVariable(wzBundleId, wzVariable, *psczValue, &cch);
469 }
470
471LExit:
472 return hr;
473}
474
424DAPI_(HRESULT) BalSetVersionVariable( 475DAPI_(HRESULT) BalSetVersionVariable(
425 __in_z LPCWSTR wzVariable, 476 __in_z LPCWSTR wzVariable,
426 __in_z_opt LPCWSTR wzValue 477 __in_z_opt LPCWSTR wzValue