aboutsummaryrefslogtreecommitdiff
path: root/src/burn
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/burn
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/burn')
-rw-r--r--src/burn/engine/EngineForApplication.cpp19
-rw-r--r--src/burn/engine/EngineForExtension.cpp19
-rw-r--r--src/burn/engine/externalengine.cpp20
-rw-r--r--src/burn/engine/externalengine.h8
-rw-r--r--src/burn/test/BurnUnitTest/VariantTest.cpp8
5 files changed, 69 insertions, 5 deletions
diff --git a/src/burn/engine/EngineForApplication.cpp b/src/burn/engine/EngineForApplication.cpp
index 45bfaf83..eb77cc50 100644
--- a/src/burn/engine/EngineForApplication.cpp
+++ b/src/burn/engine/EngineForApplication.cpp
@@ -427,6 +427,22 @@ LExit:
427 return hr; 427 return hr;
428} 428}
429 429
430static HRESULT BAEngineGetRelatedBundleVariable(
431 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
432 __in const LPVOID pvArgs,
433 __inout LPVOID pvResults
434 )
435{
436 HRESULT hr = S_OK;
437 ValidateMessageArgs(hr, pvArgs, BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS, pArgs);
438 ValidateMessageResults(hr, pvResults, BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS, pResults);
439
440 hr = ExternalEngineGetRelatedBundleVariable(pContext->pEngineState, pArgs->wzBundleId, pArgs->wzVariable, pResults->wzValue, &pResults->cchValue);
441
442LExit:
443 return hr;
444}
445
430HRESULT WINAPI EngineForApplicationProc( 446HRESULT WINAPI EngineForApplicationProc(
431 __in BOOTSTRAPPER_ENGINE_MESSAGE message, 447 __in BOOTSTRAPPER_ENGINE_MESSAGE message,
432 __in const LPVOID pvArgs, 448 __in const LPVOID pvArgs,
@@ -519,6 +535,9 @@ HRESULT WINAPI EngineForApplicationProc(
519 case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS: 535 case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS:
520 hr = BAEngineCompareVersions(pContext, pvArgs, pvResults); 536 hr = BAEngineCompareVersions(pContext, pvArgs, pvResults);
521 break; 537 break;
538 case BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE:
539 hr = BAEngineGetRelatedBundleVariable(pContext, pvArgs, pvResults);
540 break;
522 default: 541 default:
523 hr = E_NOTIMPL; 542 hr = E_NOTIMPL;
524 break; 543 break;
diff --git a/src/burn/engine/EngineForExtension.cpp b/src/burn/engine/EngineForExtension.cpp
index 2e1c98fd..bb134a61 100644
--- a/src/burn/engine/EngineForExtension.cpp
+++ b/src/burn/engine/EngineForExtension.cpp
@@ -203,6 +203,22 @@ LExit:
203 return hr; 203 return hr;
204} 204}
205 205
206static HRESULT BEEngineGetRelatedBundleVariable(
207 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
208 __in const LPVOID pvArgs,
209 __inout LPVOID pvResults
210)
211{
212 HRESULT hr = S_OK;
213 ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS, pArgs);
214 ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS, pResults);
215
216 hr = ExternalEngineGetRelatedBundleVariable(pContext->pEngineState, pArgs->wzBundleId, pArgs->wzVariable, pResults->wzValue, &pResults->cchValue);
217
218LExit:
219 return hr;
220}
221
206HRESULT WINAPI EngineForExtensionProc( 222HRESULT WINAPI EngineForExtensionProc(
207 __in BUNDLE_EXTENSION_ENGINE_MESSAGE message, 223 __in BUNDLE_EXTENSION_ENGINE_MESSAGE message,
208 __in const LPVOID pvArgs, 224 __in const LPVOID pvArgs,
@@ -253,6 +269,9 @@ HRESULT WINAPI EngineForExtensionProc(
253 case BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS: 269 case BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS:
254 hr = BEEngineCompareVersions(pContext, pvArgs, pvResults); 270 hr = BEEngineCompareVersions(pContext, pvArgs, pvResults);
255 break; 271 break;
272 case BUNDLE_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE:
273 hr = BEEngineGetRelatedBundleVariable(pContext, pvArgs, pvResults);
274 break;
256 default: 275 default:
257 hr = E_NOTIMPL; 276 hr = E_NOTIMPL;
258 break; 277 break;
diff --git a/src/burn/engine/externalengine.cpp b/src/burn/engine/externalengine.cpp
index 262bb1a9..c38d8fc3 100644
--- a/src/burn/engine/externalengine.cpp
+++ b/src/burn/engine/externalengine.cpp
@@ -801,6 +801,26 @@ LExit:
801 return hr; 801 return hr;
802} 802}
803 803
804HRESULT ExternalEngineGetRelatedBundleVariable(
805 __in BURN_ENGINE_STATE* /*pEngineState*/,
806 __in_z LPCWSTR wzBundleId,
807 __in_z LPCWSTR wzVariable,
808 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
809 __inout SIZE_T* pcchValue
810 )
811{
812 HRESULT hr = S_OK;
813 if (wzVariable && *wzVariable && pcchValue)
814 {
815 hr = BundleGetBundleVariableFixed(wzBundleId, wzVariable, wzValue, pcchValue);
816 }
817 else
818 {
819 hr = E_INVALIDARG;
820 }
821 return hr;
822}
823
804// TODO: callers need to provide the original size (at the time of first public release) of the struct instead of the current size. 824// TODO: callers need to provide the original size (at the time of first public release) of the struct instead of the current size.
805HRESULT WINAPI ExternalEngineValidateMessageParameter( 825HRESULT WINAPI ExternalEngineValidateMessageParameter(
806 __in_opt const LPVOID pv, 826 __in_opt const LPVOID pv,
diff --git a/src/burn/engine/externalengine.h b/src/burn/engine/externalengine.h
index 9322234a..0c8a8cbb 100644
--- a/src/burn/engine/externalengine.h
+++ b/src/burn/engine/externalengine.h
@@ -129,6 +129,14 @@ HRESULT ExternalEngineCompareVersions(
129 __out int* pnResult 129 __out int* pnResult
130 ); 130 );
131 131
132HRESULT ExternalEngineGetRelatedBundleVariable(
133 __in BURN_ENGINE_STATE* pEngineState,
134 __in_z LPCWSTR wzBundleId,
135 __in_z LPCWSTR wzVariable,
136 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
137 __inout SIZE_T* pcchValue
138);
139
132HRESULT ExternalEngineDetect( 140HRESULT ExternalEngineDetect(
133 __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, 141 __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext,
134 __in_opt const HWND hwndParent 142 __in_opt const HWND hwndParent
diff --git a/src/burn/test/BurnUnitTest/VariantTest.cpp b/src/burn/test/BurnUnitTest/VariantTest.cpp
index 43899a2b..035864cf 100644
--- a/src/burn/test/BurnUnitTest/VariantTest.cpp
+++ b/src/burn/test/BurnUnitTest/VariantTest.cpp
@@ -27,11 +27,9 @@ namespace Bootstrapper
27 { 27 {
28 BURN_VARIANT expectedVariants[10]; 28 BURN_VARIANT expectedVariants[10];
29 BURN_VARIANT actualVariants[10]; 29 BURN_VARIANT actualVariants[10];
30 for (DWORD i = 0; i < 10; i++) 30
31 { 31 memset(expectedVariants, 0, sizeof(expectedVariants));
32 BVariantUninitialize(expectedVariants + i); 32 memset(actualVariants, 0, sizeof(actualVariants));
33 BVariantUninitialize(actualVariants + i);
34 }
35 33
36 try 34 try
37 { 35 {