diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-11-01 14:16:32 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-11-01 18:35:01 -0600 |
| commit | b5553689ed1b1bd32f854654f56935c039a9b13b (patch) | |
| tree | 6afcbd397eebab56c8235b30ee10d4d07d89de2b /src/engine/condition.cpp | |
| parent | 79d7d3aa1de224d90d5e3a1174b3158ffe49b6f3 (diff) | |
| download | wix-b5553689ed1b1bd32f854654f56935c039a9b13b.tar.gz wix-b5553689ed1b1bd32f854654f56935c039a9b13b.tar.bz2 wix-b5553689ed1b1bd32f854654f56935c039a9b13b.zip | |
WIXFEAT:6258 - Format variables when evaluating condition.
Diffstat (limited to 'src/engine/condition.cpp')
| -rw-r--r-- | src/engine/condition.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/engine/condition.cpp b/src/engine/condition.cpp index 224eb0da..d6038b34 100644 --- a/src/engine/condition.cpp +++ b/src/engine/condition.cpp | |||
| @@ -432,6 +432,7 @@ static HRESULT ParseOperand( | |||
| 432 | ) | 432 | ) |
| 433 | { | 433 | { |
| 434 | HRESULT hr = S_OK; | 434 | HRESULT hr = S_OK; |
| 435 | LPWSTR sczFormatted = NULL; | ||
| 435 | 436 | ||
| 436 | // Symbols don't encrypt their value, so can access the value directly. | 437 | // Symbols don't encrypt their value, so can access the value directly. |
| 437 | switch (pContext->NextSymbol.Type) | 438 | switch (pContext->NextSymbol.Type) |
| @@ -451,9 +452,11 @@ static HRESULT ParseOperand( | |||
| 451 | 452 | ||
| 452 | if (BURN_VARIANT_TYPE_FORMATTED == pOperand->Value.Type) | 453 | if (BURN_VARIANT_TYPE_FORMATTED == pOperand->Value.Type) |
| 453 | { | 454 | { |
| 454 | // TODO: actually format the value? | 455 | hr = VariableGetFormatted(pContext->pVariables, pContext->NextSymbol.Value.sczValue, &sczFormatted, &pOperand->fHidden); |
| 455 | hr = BVariantChangeType(&pOperand->Value, BURN_VARIANT_TYPE_STRING); | 456 | ExitOnRootFailure(hr, "Failed to format variable '%ls' for condition '%ls'", pContext->NextSymbol.Value.sczValue, pContext->wzCondition); |
| 456 | ExitOnRootFailure(hr, "Failed to change variable '%ls' type for condition '%ls'", pContext->NextSymbol.Value.sczValue, pContext->wzCondition); | 457 | |
| 458 | hr = BVariantSetString(&pOperand->Value, sczFormatted, 0, FALSE); | ||
| 459 | ExitOnRootFailure(hr, "Failed to store formatted value for variable '%ls' for condition '%ls'", pContext->NextSymbol.Value.sczValue, pContext->wzCondition); | ||
| 457 | } | 460 | } |
| 458 | break; | 461 | break; |
| 459 | 462 | ||
| @@ -477,6 +480,8 @@ static HRESULT ParseOperand( | |||
| 477 | ExitOnFailure(hr, "Failed to read next symbol."); | 480 | ExitOnFailure(hr, "Failed to read next symbol."); |
| 478 | 481 | ||
| 479 | LExit: | 482 | LExit: |
| 483 | StrSecureZeroFreeString(sczFormatted); | ||
| 484 | |||
| 480 | return hr; | 485 | return hr; |
| 481 | } | 486 | } |
| 482 | 487 | ||
