aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h15
-rw-r--r--src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h16
-rw-r--r--src/api/burn/balutil/BalBootstrapperEngine.cpp28
-rw-r--r--src/api/burn/balutil/balutil.cpp51
-rw-r--r--src/api/burn/balutil/inc/IBootstrapperEngine.h8
-rw-r--r--src/api/burn/balutil/inc/balutil.h24
-rw-r--r--src/api/burn/bextutil/BextBundleExtensionEngine.cpp29
-rw-r--r--src/api/burn/bextutil/inc/IBundleExtensionEngine.h7
8 files changed, 178 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
index 941e4241..96302bd1 100644
--- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
+++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
@@ -111,6 +111,7 @@ enum BOOTSTRAPPER_ENGINE_MESSAGE
111 BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, 111 BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE,
112 BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE, 112 BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE,
113 BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, 113 BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS,
114 BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE,
114}; 115};
115 116
116typedef struct _BAENGINE_APPLY_ARGS 117typedef struct _BAENGINE_APPLY_ARGS
@@ -426,6 +427,20 @@ typedef struct _BAENGINE_SETVARIABLEVERSION_RESULTS
426 DWORD cbSize; 427 DWORD cbSize;
427} BAENGINE_SETVARIABLEVERSION_RESULTS; 428} BAENGINE_SETVARIABLEVERSION_RESULTS;
428 429
430typedef struct _BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS
431{
432 DWORD cbSize;
433 LPCWSTR wzBundleId;
434 LPCWSTR wzVariable;
435} BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS;
436
437typedef struct _BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS
438{
439 DWORD cbSize;
440 LPWSTR wzValue;
441 // Should be initialized to the size of wzValue.
442 SIZE_T cchValue;
443} BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS;
429 444
430extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_ENGINE_PROC)( 445extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_ENGINE_PROC)(
431 __in BOOTSTRAPPER_ENGINE_MESSAGE message, 446 __in BOOTSTRAPPER_ENGINE_MESSAGE message,
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h
index b397ec16..b585d1a2 100644
--- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h
+++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h
@@ -28,6 +28,7 @@ enum BUNDLE_EXTENSION_ENGINE_MESSAGE
28 BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, 28 BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING,
29 BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, 29 BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION,
30 BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, 30 BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS,
31 BUNDLE_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE,
31}; 32};
32 33
33typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS 34typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS
@@ -172,6 +173,21 @@ typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS
172 DWORD cbSize; 173 DWORD cbSize;
173} BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS; 174} BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS;
174 175
176typedef struct _BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS
177{
178 DWORD cbSize;
179 LPCWSTR wzBundleId;
180 LPCWSTR wzVariable;
181} BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS;
182
183typedef struct _BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS
184{
185 DWORD cbSize;
186 LPWSTR wzValue;
187 // Should be initialized to the size of wzValue.
188 SIZE_T cchValue;
189} BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS;
190
175extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_ENGINE_PROC)( 191extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_ENGINE_PROC)(
176 __in BUNDLE_EXTENSION_ENGINE_MESSAGE message, 192 __in BUNDLE_EXTENSION_ENGINE_MESSAGE message,
177 __in const LPVOID pvArgs, 193 __in const LPVOID pvArgs,
diff --git a/src/api/burn/balutil/BalBootstrapperEngine.cpp b/src/api/burn/balutil/BalBootstrapperEngine.cpp
index 898a8a15..be53c6b9 100644
--- a/src/api/burn/balutil/BalBootstrapperEngine.cpp
+++ b/src/api/burn/balutil/BalBootstrapperEngine.cpp
@@ -158,6 +158,34 @@ public: // IBootstrapperEngine
158 return hr; 158 return hr;
159 } 159 }
160 160
161 virtual STDMETHODIMP GetRelatedBundleVariable(
162 __in_z LPCWSTR wzBundleId,
163 __in_z LPCWSTR wzVariable,
164 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
165 __inout SIZE_T* pcchValue
166 )
167 {
168 HRESULT hr = S_OK;
169 BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { };
170 BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { };
171
172 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required");
173
174 args.cbSize = sizeof(args);
175 args.wzBundleId = wzBundleId;
176 args.wzVariable = wzVariable;
177
178 results.cbSize = sizeof(results);
179 results.wzValue = wzValue;
180 results.cchValue = *pcchValue;
181
182 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, &args, &results, m_pvBAEngineProcContext);
183
184 *pcchValue = results.cchValue;
185 LExit:
186 return hr;
187 }
188
161 virtual STDMETHODIMP FormatString( 189 virtual STDMETHODIMP FormatString(
162 __in_z LPCWSTR wzIn, 190 __in_z LPCWSTR wzIn,
163 __out_ecount_opt(*pcchOut) LPWSTR wzOut, 191 __out_ecount_opt(*pcchOut) LPWSTR wzOut,
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
diff --git a/src/api/burn/balutil/inc/IBootstrapperEngine.h b/src/api/burn/balutil/inc/IBootstrapperEngine.h
index 2a108223..bfa13997 100644
--- a/src/api/burn/balutil/inc/IBootstrapperEngine.h
+++ b/src/api/burn/balutil/inc/IBootstrapperEngine.h
@@ -136,4 +136,12 @@ DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-8
136 __in_z LPCWSTR wzVersion2, 136 __in_z LPCWSTR wzVersion2,
137 __out int* pnResult 137 __out int* pnResult
138 ) = 0; 138 ) = 0;
139
140 STDMETHOD(GetRelatedBundleVariable)(
141 __in_z LPCWSTR wzBundleId,
142 __in_z LPCWSTR wzVariable,
143 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
144 __inout SIZE_T* pcchValue
145 ) = 0;
146
139}; 147};
diff --git a/src/api/burn/balutil/inc/balutil.h b/src/api/burn/balutil/inc/balutil.h
index 3040cfe8..36c165a3 100644
--- a/src/api/burn/balutil/inc/balutil.h
+++ b/src/api/burn/balutil/inc/balutil.h
@@ -140,6 +140,30 @@ DAPI_(HRESULT) BalGetNumericVariable(
140 ); 140 );
141 141
142/******************************************************************* 142/*******************************************************************
143BalGetRelatedBundleVariable - gets a string from a shared variable in the engine.
144
145Note: Use StrFree() to release psczValue.
146********************************************************************/
147DAPI_(HRESULT) BalGetRelatedBundleVariable(
148 __in_z LPCWSTR wzBundleId,
149 __in_z LPCWSTR wzVariable,
150 __inout LPWSTR* psczValue
151);
152
153/*******************************************************************
154BalGetRelatedBundleVariableFromEngine - gets a string from a shared variable in the engine.
155
156 Note: Use StrFree() to release psczValue.
157********************************************************************/
158DAPI_(HRESULT) BalGetRelatedBundleVariableFromEngine(
159 __in IBootstrapperEngine* pEngine,
160 __in_z LPCWSTR wzBundleId,
161 __in_z LPCWSTR wzVariable,
162 __inout LPWSTR* psczValue
163);
164
165
166/*******************************************************************
143BalSetNumericVariable - sets a numeric variable in the engine. 167BalSetNumericVariable - sets a numeric variable in the engine.
144 168
145********************************************************************/ 169********************************************************************/
diff --git a/src/api/burn/bextutil/BextBundleExtensionEngine.cpp b/src/api/burn/bextutil/BextBundleExtensionEngine.cpp
index 6043e2db..2c854817 100644
--- a/src/api/burn/bextutil/BextBundleExtensionEngine.cpp
+++ b/src/api/burn/bextutil/BextBundleExtensionEngine.cpp
@@ -306,6 +306,35 @@ public: // IBundleExtensionEngine
306 return hr; 306 return hr;
307 } 307 }
308 308
309 virtual STDMETHODIMP GetRelatedBundleVariable(
310 __in_z LPCWSTR wzBundleId,
311 __in_z LPCWSTR wzVariable,
312 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
313 __inout SIZE_T* pcchValue
314 )
315 {
316 HRESULT hr = S_OK;
317 BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { };
318 BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { };
319
320 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required");
321
322 args.cbSize = sizeof(args);
323 args.wzBundleId = wzBundleId;
324 args.wzVariable = wzVariable;
325
326 results.cbSize = sizeof(results);
327 results.wzValue = wzValue;
328 results.cchValue = *pcchValue;
329
330 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, &args, &results, m_pvBundleExtensionEngineProcContext);
331
332 *pcchValue = results.cchValue;
333
334 LExit:
335 return hr;
336 }
337
309public: 338public:
310 CBextBundleExtensionEngine( 339 CBextBundleExtensionEngine(
311 __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, 340 __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc,
diff --git a/src/api/burn/bextutil/inc/IBundleExtensionEngine.h b/src/api/burn/bextutil/inc/IBundleExtensionEngine.h
index 63dadb06..0053a71e 100644
--- a/src/api/burn/bextutil/inc/IBundleExtensionEngine.h
+++ b/src/api/burn/bextutil/inc/IBundleExtensionEngine.h
@@ -64,4 +64,11 @@ DECLARE_INTERFACE_IID_(IBundleExtensionEngine, IUnknown, "9D027A39-F6B6-42CC-973
64 __in_z LPCWSTR wzVersion2, 64 __in_z LPCWSTR wzVersion2,
65 __out int* pnResult 65 __out int* pnResult
66 ) = 0; 66 ) = 0;
67
68 STDMETHOD(GetRelatedBundleVariable)(
69 __in_z LPCWSTR wzBundleId,
70 __in_z LPCWSTR wzVariable,
71 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
72 __inout SIZE_T * pcchValue
73 ) = 0;
67}; 74};