diff options
Diffstat (limited to 'src/api/burn/balutil/balutil.cpp')
-rw-r--r-- | src/api/burn/balutil/balutil.cpp | 51 |
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 | ||
424 | DAPI_(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 | |||
440 | LExit: | ||
441 | return hr; | ||
442 | } | ||
443 | |||
444 | DAPI_(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 | |||
471 | LExit: | ||
472 | return hr; | ||
473 | } | ||
474 | |||
424 | DAPI_(HRESULT) BalSetVersionVariable( | 475 | DAPI_(HRESULT) BalSetVersionVariable( |
425 | __in_z LPCWSTR wzVariable, | 476 | __in_z LPCWSTR wzVariable, |
426 | __in_z_opt LPCWSTR wzValue | 477 | __in_z_opt LPCWSTR wzValue |