aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-11-01 17:08:51 -0600
committerSean Hall <r.sean.hall@gmail.com>2020-11-01 18:35:01 -0600
commitd70b0710ba8ae05a5018ce96967f1cf7a7f717f5 (patch)
tree95f6d0fadaa7ab93e0c3265fd4c766d89f0dc080
parent352aefb0ac67ffbf74cd126db710031d4944fe89 (diff)
downloadwix-d70b0710ba8ae05a5018ce96967f1cf7a7f717f5.tar.gz
wix-d70b0710ba8ae05a5018ce96967f1cf7a7f717f5.tar.bz2
wix-d70b0710ba8ae05a5018ce96967f1cf7a7f717f5.zip
WIXFEAT:5355 - Don't clear variable for missing key or value.
-rw-r--r--src/engine/search.cpp6
-rw-r--r--src/test/BurnUnitTest/SearchTest.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/engine/search.cpp b/src/engine/search.cpp
index 065003c7..6d5f8d49 100644
--- a/src/engine/search.cpp
+++ b/src/engine/search.cpp
@@ -946,8 +946,7 @@ static HRESULT RegistrySearchValue(
946 { 946 {
947 // What if there is a hidden variable in sczKey? 947 // What if there is a hidden variable in sczKey?
948 LogStringLine(REPORT_STANDARD, "Registry key not found. Key = '%ls'", sczKey); 948 LogStringLine(REPORT_STANDARD, "Registry key not found. Key = '%ls'", sczKey);
949 hr = VariableSetVariant(pVariables, pSearch->sczVariable, &value); 949
950 ExitOnFailure(hr, "Failed to clear variable.");
951 ExitFunction1(hr = S_OK); 950 ExitFunction1(hr = S_OK);
952 } 951 }
953 ExitOnFailure(hr, "Failed to open registry key."); 952 ExitOnFailure(hr, "Failed to open registry key.");
@@ -958,8 +957,7 @@ static HRESULT RegistrySearchValue(
958 { 957 {
959 // What if there is a hidden variable in sczKey or sczValue? 958 // What if there is a hidden variable in sczKey or sczValue?
960 LogStringLine(REPORT_STANDARD, "Registry value not found. Key = '%ls', Value = '%ls'", sczKey, sczValue); 959 LogStringLine(REPORT_STANDARD, "Registry value not found. Key = '%ls', Value = '%ls'", sczKey, sczValue);
961 hr = VariableSetVariant(pVariables, pSearch->sczVariable, &value); 960
962 ExitOnFailure(hr, "Failed to clear variable.");
963 ExitFunction1(hr = S_OK); 961 ExitFunction1(hr = S_OK);
964 } 962 }
965 ExitOnWin32Error(er, hr, "Failed to query registry key value size."); 963 ExitOnWin32Error(er, hr, "Failed to query registry key value size.");
diff --git a/src/test/BurnUnitTest/SearchTest.cpp b/src/test/BurnUnitTest/SearchTest.cpp
index d868190d..eca01f5f 100644
--- a/src/test/BurnUnitTest/SearchTest.cpp
+++ b/src/test/BurnUnitTest/SearchTest.cpp
@@ -198,6 +198,8 @@ namespace Bootstrapper
198 198
199 VariableSetStringHelper(&variables, L"MyKey", L"SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\Value", FALSE); 199 VariableSetStringHelper(&variables, L"MyKey", L"SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\Value", FALSE);
200 VariableSetStringHelper(&variables, L"MyValue", L"String", FALSE); 200 VariableSetStringHelper(&variables, L"MyValue", L"String", FALSE);
201 VariableSetStringHelper(&variables, L"Variable27", L"Default27", FALSE);
202 VariableSetStringHelper(&variables, L"Variable28", L"Default28", FALSE);
201 203
202 LPCWSTR wzDocument = 204 LPCWSTR wzDocument =
203 L"<Bundle>" 205 L"<Bundle>"
@@ -227,6 +229,8 @@ namespace Bootstrapper
227 L" <RegistrySearch Id='Search24' Type='exists' Root='HKU' Key='.DEFAULT\\System\\NetworkServiceSidSubkeyDoesNotExist' Variable='Variable24' />" 229 L" <RegistrySearch Id='Search24' Type='exists' Root='HKU' Key='.DEFAULT\\System\\NetworkServiceSidSubkeyDoesNotExist' Variable='Variable24' />"
228 L" <RegistrySearch Id='Search25' Type='value' Root='HKCR' Key='.msi' Variable='Variable25' VariableType='string' />" 230 L" <RegistrySearch Id='Search25' Type='value' Root='HKCR' Key='.msi' Variable='Variable25' VariableType='string' />"
229 L" <RegistrySearch Id='Search26' Type='value' Root='HKCR' Key='.msi' Variable='Variable26' VariableType='formatted' />" 231 L" <RegistrySearch Id='Search26' Type='value' Root='HKCR' Key='.msi' Variable='Variable26' VariableType='formatted' />"
232 L" <RegistrySearch Id='Search27' Type='value' Root='HKCU' Key='SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\StringDoesNotExist' Value='String' Variable='Variable27' VariableType='string' />"
233 L" <RegistrySearch Id='Search28' Type='value' Root='HKCU' Key='SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\String' Value='DoesNotExist' Variable='Variable28' VariableType='string' />"
230 L"</Bundle>"; 234 L"</Bundle>";
231 235
232 // load XML document 236 // load XML document
@@ -270,6 +274,8 @@ namespace Bootstrapper
270 Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable24")); 274 Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable24"));
271 Assert::Equal<String^>(gcnew String(L"Msi.Package"), VariableGetStringHelper(&variables, L"Variable25")); 275 Assert::Equal<String^>(gcnew String(L"Msi.Package"), VariableGetStringHelper(&variables, L"Variable25"));
272 Assert::Equal<String^>(gcnew String(L"Msi.Package"), VariableGetStringHelper(&variables, L"Variable26")); 276 Assert::Equal<String^>(gcnew String(L"Msi.Package"), VariableGetStringHelper(&variables, L"Variable26"));
277 Assert::Equal<String^>(gcnew String(L"Default27"), VariableGetStringHelper(&variables, L"Variable27"));
278 Assert::Equal<String^>(gcnew String(L"Default28"), VariableGetStringHelper(&variables, L"Variable28"));
273 } 279 }
274 finally 280 finally
275 { 281 {