From 273c69f34311f4f4e5f6b5896e71d0788f12d96a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 17 Oct 2020 19:12:21 -0500 Subject: WIXFEAT:6210 Change data type of versions to strings. --- src/test/BurnUnitTest/VariableHelpers.cpp | 34 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/test/BurnUnitTest/VariableHelpers.cpp') diff --git a/src/test/BurnUnitTest/VariableHelpers.cpp b/src/test/BurnUnitTest/VariableHelpers.cpp index fdfb9191..99ba492a 100644 --- a/src/test/BurnUnitTest/VariableHelpers.cpp +++ b/src/test/BurnUnitTest/VariableHelpers.cpp @@ -33,12 +33,23 @@ namespace Bootstrapper TestThrowOnFailure2(hr, L"Failed to set %s to: %I64d", wzVariable, llValue); } - void VariableSetVersionHelper(BURN_VARIABLES* pVariables, LPCWSTR wzVariable, DWORD64 qwValue) + void VariableSetVersionHelper(BURN_VARIABLES* pVariables, LPCWSTR wzVariable, LPCWSTR wzValue) { HRESULT hr = S_OK; + VERUTIL_VERSION* pVersion = NULL; - hr = VariableSetVersion(pVariables, wzVariable, qwValue, FALSE); - TestThrowOnFailure2(hr, L"Failed to set %s to: 0x%016I64x", wzVariable, qwValue); + try + { + hr = VerParseVersion(wzValue, 0, FALSE, &pVersion); + TestThrowOnFailure1(hr, L"Failed to parse version '%ls'", wzValue); + + hr = VariableSetVersion(pVariables, wzVariable, pVersion, FALSE); + TestThrowOnFailure2(hr, L"Failed to set %s to: '%ls'", wzVariable, wzValue); + } + finally + { + ReleaseVerutilVersion(pVersion); + } } String^ VariableGetStringHelper(BURN_VARIABLES* pVariables, LPCWSTR wzVariable) @@ -69,15 +80,22 @@ namespace Bootstrapper return llValue; } - unsigned __int64 VariableGetVersionHelper(BURN_VARIABLES* pVariables, LPCWSTR wzVariable) + String^ VariableGetVersionHelper(BURN_VARIABLES* pVariables, LPCWSTR wzVariable) { HRESULT hr = S_OK; - DWORD64 qwValue = 0; + VERUTIL_VERSION* pValue = NULL; - hr = VariableGetVersion(pVariables, wzVariable, &qwValue); - TestThrowOnFailure1(hr, L"Failed to get: %s", wzVariable); + try + { + hr = VariableGetVersion(pVariables, wzVariable, &pValue); + TestThrowOnFailure1(hr, L"Failed to get: %s", wzVariable); - return qwValue; + return gcnew String(pValue->sczVersion); + } + finally + { + ReleaseVerutilVersion(pValue); + } } String^ VariableGetFormattedHelper(BURN_VARIABLES* pVariables, LPCWSTR wzVariable) -- cgit v1.2.3-55-g6feb