diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-07-18 19:52:05 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-07-18 19:52:05 -0500 |
commit | 1bdf42c558d6923380b9f3ea409027816f972f98 (patch) | |
tree | 0c3c879e6ddf51e6771f88d0bd85d8d45cf66104 /src/burn | |
parent | f3c96bcab560cb09355e9366eac3f4195479d95d (diff) | |
download | wix-1bdf42c558d6923380b9f3ea409027816f972f98.tar.gz wix-1bdf42c558d6923380b9f3ea409027816f972f98.tar.bz2 wix-1bdf42c558d6923380b9f3ea409027816f972f98.zip |
Refactor butil while cleaning up other things.
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/CustomizedNativeRecommendedRules.ruleset | 8 | ||||
-rw-r--r-- | src/burn/engine/registration.cpp | 15 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/RegistrationTest.cpp | 80 |
3 files changed, 42 insertions, 61 deletions
diff --git a/src/burn/CustomizedNativeRecommendedRules.ruleset b/src/burn/CustomizedNativeRecommendedRules.ruleset deleted file mode 100644 index 142b141c..00000000 --- a/src/burn/CustomizedNativeRecommendedRules.ruleset +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <RuleSet Name="Customized Microsoft Native Recommended Rules" Description="Microsoft Native Recommended Rules, -C26812" ToolsVersion="16.0"> | ||
3 | <Include Path="nativerecommendedrules.ruleset" Action="Default" /> | ||
4 | <Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native"> | ||
5 | <!-- We need C style enums since we support BAs written in C --> | ||
6 | <Rule Id="C26812" Action="None" /> | ||
7 | </Rules> | ||
8 | </RuleSet> \ No newline at end of file | ||
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index 4088004d..147865fa 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
@@ -910,7 +910,6 @@ extern "C" HRESULT RegistrationSessionEnd( | |||
910 | { | 910 | { |
911 | HRESULT hr = S_OK; | 911 | HRESULT hr = S_OK; |
912 | LPWSTR sczRebootRequiredKey = NULL; | 912 | LPWSTR sczRebootRequiredKey = NULL; |
913 | LPWSTR sczVariableKey = NULL; | ||
914 | HKEY hkRebootRequired = NULL; | 913 | HKEY hkRebootRequired = NULL; |
915 | HKEY hkRegistration = NULL; | 914 | HKEY hkRegistration = NULL; |
916 | 915 | ||
@@ -958,19 +957,8 @@ extern "C" HRESULT RegistrationSessionEnd( | |||
958 | 957 | ||
959 | RemoveSoftwareTags(pVariables, &pRegistration->softwareTags); | 958 | RemoveSoftwareTags(pVariables, &pRegistration->softwareTags); |
960 | 959 | ||
961 | // build variable registry key path | ||
962 | hr = StrAllocFormatted(&sczVariableKey, L"%s\\%s", pRegistration->sczRegistrationKey, REGISTRY_BUNDLE_VARIABLE_KEY); | ||
963 | ExitOnFailure(hr, "Failed to build variable registry key path."); | ||
964 | |||
965 | // Delete registration variable key. | ||
966 | hr = RegDelete(pRegistration->hkRoot, sczVariableKey, REG_KEY_DEFAULT, FALSE); | ||
967 | if (E_FILENOTFOUND != hr) | ||
968 | { | ||
969 | ExitOnFailure(hr, "Failed to delete registration variable key: %ls", sczVariableKey); | ||
970 | } | ||
971 | |||
972 | // Delete registration key. | 960 | // Delete registration key. |
973 | hr = RegDelete(pRegistration->hkRoot, pRegistration->sczRegistrationKey, REG_KEY_DEFAULT, FALSE); | 961 | hr = RegDelete(pRegistration->hkRoot, pRegistration->sczRegistrationKey, REG_KEY_DEFAULT, TRUE); |
974 | if (E_FILENOTFOUND != hr) | 962 | if (E_FILENOTFOUND != hr) |
975 | { | 963 | { |
976 | ExitOnFailure(hr, "Failed to delete registration key: %ls", pRegistration->sczRegistrationKey); | 964 | ExitOnFailure(hr, "Failed to delete registration key: %ls", pRegistration->sczRegistrationKey); |
@@ -998,7 +986,6 @@ extern "C" HRESULT RegistrationSessionEnd( | |||
998 | LExit: | 986 | LExit: |
999 | ReleaseRegKey(hkRegistration); | 987 | ReleaseRegKey(hkRegistration); |
1000 | ReleaseRegKey(hkRebootRequired); | 988 | ReleaseRegKey(hkRebootRequired); |
1001 | ReleaseStr(sczVariableKey); | ||
1002 | ReleaseStr(sczRebootRequiredKey); | 989 | ReleaseStr(sczRebootRequiredKey); |
1003 | 990 | ||
1004 | return hr; | 991 | return hr; |
diff --git a/src/burn/test/BurnUnitTest/RegistrationTest.cpp b/src/burn/test/BurnUnitTest/RegistrationTest.cpp index 298d4631..a8319bb2 100644 --- a/src/burn/test/BurnUnitTest/RegistrationTest.cpp +++ b/src/burn/test/BurnUnitTest/RegistrationTest.cpp | |||
@@ -4,16 +4,16 @@ | |||
4 | 4 | ||
5 | 5 | ||
6 | #define ROOT_PATH L"SOFTWARE\\WiX_Burn_UnitTest" | 6 | #define ROOT_PATH L"SOFTWARE\\WiX_Burn_UnitTest" |
7 | #define HKLM_PATH L"SOFTWARE\\WiX_Burn_UnitTest\\HKLM" | 7 | #define HKLM_PATH ROOT_PATH L"\\HKLM" |
8 | #define HKCU_PATH L"SOFTWARE\\WiX_Burn_UnitTest\\HKCU" | 8 | #define HKCU_PATH ROOT_PATH L"\\HKCU" |
9 | #define REGISTRY_UNINSTALL_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" | 9 | #define REGISTRY_UNINSTALL_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" |
10 | #define REGISTRY_RUN_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce" | 10 | #define REGISTRY_RUN_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce" |
11 | #define TEST_BUNDLE_ID L"{D54F896D-1952-43e6-9C67-B5652240618C}" | 11 | #define TEST_BUNDLE_ID L"{D54F896D-1952-43E6-9C67-B5652240618C}" |
12 | #define TEST_BUNDLE_UPGRADE_CODE L"{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}" | 12 | #define TEST_BUNDLE_UPGRADE_CODE L"{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}" |
13 | 13 | ||
14 | #define TEST_UNINSTALL_KEY L"HKEY_CURRENT_USER\\" HKCU_PATH L"\\" REGISTRY_UNINSTALL_KEY L"\\{D54F896D-1952-43e6-9C67-B5652240618C}" | 14 | #define TEST_UNINSTALL_KEY L"HKEY_CURRENT_USER\\" HKCU_PATH L"\\" REGISTRY_UNINSTALL_KEY L"\\" TEST_BUNDLE_ID |
15 | #define TEST_RUN_KEY L"HKEY_CURRENT_USER\\" HKCU_PATH L"\\" REGISTRY_RUN_KEY | 15 | #define TEST_RUN_KEY L"HKEY_CURRENT_USER\\" HKCU_PATH L"\\" REGISTRY_RUN_KEY |
16 | #define TEST_VARIABLE_KEY L"HKEY_CURRENT_USER\\" HKCU_PATH L"\\" REGISTRY_UNINSTALL_KEY L"\\{D54F896D-1952-43e6-9C67-B5652240618C}\\variables" | 16 | #define TEST_VARIABLE_KEY L"HKEY_CURRENT_USER\\" HKCU_PATH L"\\" REGISTRY_UNINSTALL_KEY L"\\" TEST_BUNDLE_ID L"\\variables" |
17 | 17 | ||
18 | 18 | ||
19 | static LSTATUS APIENTRY RegistrationTest_RegCreateKeyExW( | 19 | static LSTATUS APIENTRY RegistrationTest_RegCreateKeyExW( |
@@ -75,7 +75,7 @@ namespace Bootstrapper | |||
75 | BURN_REGISTRATION registration = { }; | 75 | BURN_REGISTRATION registration = { }; |
76 | BURN_LOGGING logging = { }; | 76 | BURN_LOGGING logging = { }; |
77 | BURN_PACKAGES packages = { }; | 77 | BURN_PACKAGES packages = { }; |
78 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 78 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); |
79 | 79 | ||
80 | try | 80 | try |
81 | { | 81 | { |
@@ -91,7 +91,7 @@ namespace Bootstrapper | |||
91 | L" <UX>" | 91 | L" <UX>" |
92 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 92 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
93 | L" </UX>" | 93 | L" </UX>" |
94 | L" <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' UpgradeCode='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" | 94 | L" <Registration Id='{D54F896D-1952-43E6-9C67-B5652240618C}' UpgradeCode='{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" |
95 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='RegisterBasicTest' DisplayVersion='1.0.0.0' />" | 95 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='RegisterBasicTest' DisplayVersion='1.0.0.0' />" |
96 | L" </Registration>" | 96 | L" </Registration>" |
97 | L"</Bundle>"; | 97 | L"</Bundle>"; |
@@ -123,7 +123,7 @@ namespace Bootstrapper | |||
123 | Assert::True(File::Exists(Path::Combine(cacheDirectory, gcnew String(L"setup.exe")))); | 123 | Assert::True(File::Exists(Path::Combine(cacheDirectory, gcnew String(L"setup.exe")))); |
124 | 124 | ||
125 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 125 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
126 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr))); | 126 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr))); |
127 | 127 | ||
128 | // end session | 128 | // end session |
129 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); | 129 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); |
@@ -133,7 +133,7 @@ namespace Bootstrapper | |||
133 | Assert::False(Directory::Exists(cacheDirectory)); | 133 | Assert::False(Directory::Exists(cacheDirectory)); |
134 | 134 | ||
135 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 135 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
136 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 136 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
137 | } | 137 | } |
138 | finally | 138 | finally |
139 | { | 139 | { |
@@ -165,7 +165,7 @@ namespace Bootstrapper | |||
165 | BURN_REGISTRATION registration = { }; | 165 | BURN_REGISTRATION registration = { }; |
166 | BURN_LOGGING logging = { }; | 166 | BURN_LOGGING logging = { }; |
167 | BURN_PACKAGES packages = { }; | 167 | BURN_PACKAGES packages = { }; |
168 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 168 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); |
169 | try | 169 | try |
170 | { | 170 | { |
171 | // set mock API's | 171 | // set mock API's |
@@ -180,7 +180,7 @@ namespace Bootstrapper | |||
180 | L" <UX>" | 180 | L" <UX>" |
181 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 181 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
182 | L" </UX>" | 182 | L" </UX>" |
183 | L" <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' UpgradeCode='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" | 183 | L" <Registration Id='{D54F896D-1952-43E6-9C67-B5652240618C}' UpgradeCode='{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" |
184 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='Product1' InProgressDisplayName='Product1 Installation' DisplayVersion='1.0.0.0' />" | 184 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='Product1' InProgressDisplayName='Product1 Installation' DisplayVersion='1.0.0.0' />" |
185 | L" </Registration>" | 185 | L" </Registration>" |
186 | L"</Bundle>"; | 186 | L"</Bundle>"; |
@@ -214,7 +214,7 @@ namespace Bootstrapper | |||
214 | // verify that registration was created | 214 | // verify that registration was created |
215 | Assert::Equal<String^>(gcnew String(L"Product1 Installation"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayName"), nullptr)); | 215 | Assert::Equal<String^>(gcnew String(L"Product1 Installation"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayName"), nullptr)); |
216 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 216 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
217 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 217 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
218 | 218 | ||
219 | // complete registration | 219 | // complete registration |
220 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); | 220 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); |
@@ -223,7 +223,7 @@ namespace Bootstrapper | |||
223 | // verify that registration was updated | 223 | // verify that registration was updated |
224 | Assert::Equal(Int32(BURN_RESUME_MODE_ARP), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 224 | Assert::Equal(Int32(BURN_RESUME_MODE_ARP), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
225 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 225 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
226 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 226 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
227 | 227 | ||
228 | // | 228 | // |
229 | // uninstall | 229 | // uninstall |
@@ -236,7 +236,7 @@ namespace Bootstrapper | |||
236 | // verify that registration was updated | 236 | // verify that registration was updated |
237 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 237 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
238 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 238 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
239 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 239 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
240 | 240 | ||
241 | // delete registration | 241 | // delete registration |
242 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); | 242 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); |
@@ -245,7 +245,7 @@ namespace Bootstrapper | |||
245 | // verify that registration was removed | 245 | // verify that registration was removed |
246 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 246 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
247 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 247 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
248 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 248 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
249 | } | 249 | } |
250 | finally | 250 | finally |
251 | { | 251 | { |
@@ -277,7 +277,7 @@ namespace Bootstrapper | |||
277 | BURN_REGISTRATION registration = { }; | 277 | BURN_REGISTRATION registration = { }; |
278 | BURN_LOGGING logging = { }; | 278 | BURN_LOGGING logging = { }; |
279 | BURN_PACKAGES packages = { }; | 279 | BURN_PACKAGES packages = { }; |
280 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 280 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); |
281 | try | 281 | try |
282 | { | 282 | { |
283 | // set mock API's | 283 | // set mock API's |
@@ -292,7 +292,7 @@ namespace Bootstrapper | |||
292 | L" <UX>" | 292 | L" <UX>" |
293 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 293 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
294 | L" </UX>" | 294 | L" </UX>" |
295 | L" <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' UpgradeCode='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='bar' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" | 295 | L" <Registration Id='{D54F896D-1952-43E6-9C67-B5652240618C}' UpgradeCode='{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}' Tag='foo' ProviderKey='bar' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" |
296 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='Product1' DisplayVersion='1.0.0.0' />" | 296 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='Product1' DisplayVersion='1.0.0.0' />" |
297 | L" </Registration>" | 297 | L" </Registration>" |
298 | L"</Bundle>"; | 298 | L"</Bundle>"; |
@@ -325,7 +325,7 @@ namespace Bootstrapper | |||
325 | 325 | ||
326 | // verify that registration was created | 326 | // verify that registration was created |
327 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 327 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
328 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 328 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
329 | 329 | ||
330 | // complete registration | 330 | // complete registration |
331 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_FULL); | 331 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_FULL); |
@@ -355,7 +355,7 @@ namespace Bootstrapper | |||
355 | // verify that registration was removed | 355 | // verify that registration was removed |
356 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 356 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
357 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 357 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
358 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 358 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
359 | } | 359 | } |
360 | finally | 360 | finally |
361 | { | 361 | { |
@@ -387,7 +387,7 @@ namespace Bootstrapper | |||
387 | BURN_REGISTRATION registration = { }; | 387 | BURN_REGISTRATION registration = { }; |
388 | BURN_LOGGING logging = { }; | 388 | BURN_LOGGING logging = { }; |
389 | BURN_PACKAGES packages = { }; | 389 | BURN_PACKAGES packages = { }; |
390 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 390 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); |
391 | try | 391 | try |
392 | { | 392 | { |
393 | // set mock API's | 393 | // set mock API's |
@@ -402,7 +402,7 @@ namespace Bootstrapper | |||
402 | L" <UX UxDllPayloadId='ux.dll'>" | 402 | L" <UX UxDllPayloadId='ux.dll'>" |
403 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 403 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
404 | L" </UX>" | 404 | L" </UX>" |
405 | L" <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' UpgradeCode='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" | 405 | L" <Registration Id='{D54F896D-1952-43E6-9C67-B5652240618C}' UpgradeCode='{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" |
406 | L" <Arp Register='yes' DisplayName='DisplayName1' DisplayVersion='1.2.3.4' Publisher='Publisher1' HelpLink='http://www.microsoft.com/help'" | 406 | L" <Arp Register='yes' DisplayName='DisplayName1' DisplayVersion='1.2.3.4' Publisher='Publisher1' HelpLink='http://www.microsoft.com/help'" |
407 | L" HelpTelephone='555-555-5555' AboutUrl='http://www.microsoft.com/about' UpdateUrl='http://www.microsoft.com/update'" | 407 | L" HelpTelephone='555-555-5555' AboutUrl='http://www.microsoft.com/about' UpdateUrl='http://www.microsoft.com/update'" |
408 | L" Comments='Comments1' Contact='Contact1' DisableModify='yes' DisableRemove='yes' />" | 408 | L" Comments='Comments1' Contact='Contact1' DisableModify='yes' DisableRemove='yes' />" |
@@ -437,7 +437,7 @@ namespace Bootstrapper | |||
437 | 437 | ||
438 | // verify that registration was created | 438 | // verify that registration was created |
439 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 439 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
440 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 440 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
441 | 441 | ||
442 | // finish registration | 442 | // finish registration |
443 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_FULL); | 443 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_FULL); |
@@ -446,7 +446,7 @@ namespace Bootstrapper | |||
446 | // verify that registration was updated | 446 | // verify that registration was updated |
447 | Assert::Equal(Int32(BURN_RESUME_MODE_ARP), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 447 | Assert::Equal(Int32(BURN_RESUME_MODE_ARP), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
448 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 448 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
449 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 449 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
450 | 450 | ||
451 | Assert::Equal<String^>(gcnew String(L"DisplayName1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayName"), nullptr)); | 451 | Assert::Equal<String^>(gcnew String(L"DisplayName1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayName"), nullptr)); |
452 | Assert::Equal<String^>(gcnew String(L"1.2.3.4"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayVersion"), nullptr)); | 452 | Assert::Equal<String^>(gcnew String(L"1.2.3.4"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayVersion"), nullptr)); |
@@ -470,7 +470,7 @@ namespace Bootstrapper | |||
470 | 470 | ||
471 | // verify that registration was updated | 471 | // verify that registration was updated |
472 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 472 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
473 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 473 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
474 | 474 | ||
475 | // delete registration | 475 | // delete registration |
476 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); | 476 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); |
@@ -479,7 +479,7 @@ namespace Bootstrapper | |||
479 | // verify that registration was removed | 479 | // verify that registration was removed |
480 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 480 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
481 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 481 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
482 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 482 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
483 | } | 483 | } |
484 | finally | 484 | finally |
485 | { | 485 | { |
@@ -517,7 +517,7 @@ namespace Bootstrapper | |||
517 | BYTE* pbBuffer = NULL; | 517 | BYTE* pbBuffer = NULL; |
518 | SIZE_T cbBuffer = 0; | 518 | SIZE_T cbBuffer = 0; |
519 | 519 | ||
520 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 520 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); |
521 | try | 521 | try |
522 | { | 522 | { |
523 | // set mock API's | 523 | // set mock API's |
@@ -532,8 +532,8 @@ namespace Bootstrapper | |||
532 | L" <UX>" | 532 | L" <UX>" |
533 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 533 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
534 | L" </UX>" | 534 | L" </UX>" |
535 | L" <RelatedBundle Id='" TEST_BUNDLE_UPGRADE_CODE "' Action='Upgrade' />" | 535 | L" <RelatedBundle Id='" TEST_BUNDLE_UPGRADE_CODE L"' Action='Upgrade' />" |
536 | L" <Registration Id='" TEST_BUNDLE_ID "' Tag='foo' ProviderKey='" TEST_BUNDLE_ID "' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" | 536 | L" <Registration Id='" TEST_BUNDLE_ID L"' Tag='foo' ProviderKey='" TEST_BUNDLE_ID L"' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" |
537 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='RegisterBasicTest' DisplayVersion='1.0.0.0' />" | 537 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='RegisterBasicTest' DisplayVersion='1.0.0.0' />" |
538 | L" </Registration>" | 538 | L" </Registration>" |
539 | L" <Variable Id='MyBurnVariable1' Type='numeric' Value='0' Hidden='no' Persisted='yes' />" | 539 | L" <Variable Id='MyBurnVariable1' Type='numeric' Value='0' Hidden='no' Persisted='yes' />" |
@@ -585,6 +585,7 @@ namespace Bootstrapper | |||
585 | 585 | ||
586 | ReleaseNullBuffer(pbBuffer); | 586 | ReleaseNullBuffer(pbBuffer); |
587 | cbBuffer = 0; | 587 | cbBuffer = 0; |
588 | |||
588 | // Verify the variables exist | 589 | // Verify the variables exist |
589 | Assert::Equal<String^>(gcnew String(L"42"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable1"), nullptr)); | 590 | Assert::Equal<String^>(gcnew String(L"42"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable1"), nullptr)); |
590 | Assert::Equal<String^>(gcnew String(L"bar"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable2"), nullptr)); | 591 | Assert::Equal<String^>(gcnew String(L"bar"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable2"), nullptr)); |
@@ -596,12 +597,14 @@ namespace Bootstrapper | |||
596 | // Verify we can find ourself via the UpgradeCode | 597 | // Verify we can find ourself via the UpgradeCode |
597 | hr = BundleEnumRelatedBundle(TEST_BUNDLE_UPGRADE_CODE, BUNDLE_INSTALL_CONTEXT_USER, &dwRelatedBundleIndex, sczRelatedBundleId); | 598 | hr = BundleEnumRelatedBundle(TEST_BUNDLE_UPGRADE_CODE, BUNDLE_INSTALL_CONTEXT_USER, &dwRelatedBundleIndex, sczRelatedBundleId); |
598 | TestThrowOnFailure(hr, L"Failed to enumerate related bundle."); | 599 | TestThrowOnFailure(hr, L"Failed to enumerate related bundle."); |
599 | Assert::Equal<String^>(gcnew String(TEST_BUNDLE_ID), gcnew String(sczRelatedBundleId)); | 600 | |
601 | NativeAssert::StringEqual(TEST_BUNDLE_ID, sczRelatedBundleId); | ||
600 | 602 | ||
601 | // Verify we can read the bundle variables via the API | 603 | // Verify we can read the bundle variables via the API |
602 | hr = BundleGetBundleVariable(TEST_BUNDLE_ID, L"MyBurnVariable1", &sczValue); | 604 | hr = BundleGetBundleVariable(TEST_BUNDLE_ID, L"MyBurnVariable1", &sczValue); |
603 | TestThrowOnFailure(hr, L"Failed to read MyBurnVariable1."); | 605 | TestThrowOnFailure(hr, L"Failed to read MyBurnVariable1."); |
604 | Assert::Equal<String^>(gcnew String(L"42"), gcnew String(sczValue)); | 606 | |
607 | NativeAssert::StringEqual(L"42", sczValue); | ||
605 | 608 | ||
606 | // end session | 609 | // end session |
607 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); | 610 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); |
@@ -626,7 +629,7 @@ namespace Bootstrapper | |||
626 | } | 629 | } |
627 | } | 630 | } |
628 | 631 | ||
629 | [Fact]//(Skip = "Currently fails")] | 632 | [Fact] |
630 | void ResumeTest() | 633 | void ResumeTest() |
631 | { | 634 | { |
632 | HRESULT hr = S_OK; | 635 | HRESULT hr = S_OK; |
@@ -643,7 +646,7 @@ namespace Bootstrapper | |||
643 | BYTE* pbBuffer = NULL; | 646 | BYTE* pbBuffer = NULL; |
644 | SIZE_T cbBuffer = 0; | 647 | SIZE_T cbBuffer = 0; |
645 | SIZE_T piBuffer = 0; | 648 | SIZE_T piBuffer = 0; |
646 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 649 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); |
647 | try | 650 | try |
648 | { | 651 | { |
649 | // set mock API's | 652 | // set mock API's |
@@ -658,7 +661,7 @@ namespace Bootstrapper | |||
658 | L" <UX>" | 661 | L" <UX>" |
659 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 662 | L" <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
660 | L" </UX>" | 663 | L" </UX>" |
661 | L" <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' UpgradeCode='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" | 664 | L" <Registration Id='{D54F896D-1952-43E6-9C67-B5652240618C}' UpgradeCode='{89FDAE1F-8CC1-48B9-B930-3945E0D3E7F0}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no'>" |
662 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='RegisterBasicTest' DisplayVersion='1.0.0.0' />" | 665 | L" <Arp Register='yes' Publisher='WiX Toolset' DisplayName='RegisterBasicTest' DisplayVersion='1.0.0.0' />" |
663 | L" </Registration>" | 666 | L" </Registration>" |
664 | L" <Variable Id='MyBurnVariable1' Type='numeric' Value='0' Hidden='no' Persisted='yes' />" | 667 | L" <Variable Id='MyBurnVariable1' Type='numeric' Value='0' Hidden='no' Persisted='yes' />" |
@@ -715,6 +718,7 @@ namespace Bootstrapper | |||
715 | 718 | ||
716 | ReleaseNullBuffer(pbBuffer); | 719 | ReleaseNullBuffer(pbBuffer); |
717 | cbBuffer = 0; | 720 | cbBuffer = 0; |
721 | |||
718 | // Verify the variables exist | 722 | // Verify the variables exist |
719 | Assert::Equal<String^>(gcnew String(L"42"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable1"), nullptr)); | 723 | Assert::Equal<String^>(gcnew String(L"42"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable1"), nullptr)); |
720 | Assert::Equal<String^>(gcnew String(L"bar"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable2"), nullptr)); | 724 | Assert::Equal<String^>(gcnew String(L"bar"), (String^)Registry::GetValue(gcnew String(TEST_VARIABLE_KEY), gcnew String(L"MyBurnVariable2"), nullptr)); |
@@ -723,7 +727,8 @@ namespace Bootstrapper | |||
723 | 727 | ||
724 | hr = BundleGetBundleVariable(TEST_BUNDLE_ID, L"MyBurnVariable1", &sczValue); | 728 | hr = BundleGetBundleVariable(TEST_BUNDLE_ID, L"MyBurnVariable1", &sczValue); |
725 | TestThrowOnFailure(hr, L"Failed to read MyBurnVariable1."); | 729 | TestThrowOnFailure(hr, L"Failed to read MyBurnVariable1."); |
726 | Assert::Equal<String^>(gcnew String(L"42"), gcnew String(sczValue)); | 730 | |
731 | NativeAssert::StringEqual(L"42", sczValue); | ||
727 | 732 | ||
728 | // read interrupted resume type | 733 | // read interrupted resume type |
729 | hr = RegistrationDetectResumeType(®istration, &resumeType); | 734 | hr = RegistrationDetectResumeType(®istration, &resumeType); |
@@ -736,7 +741,7 @@ namespace Bootstrapper | |||
736 | TestThrowOnFailure(hr, L"Failed to suspend session."); | 741 | TestThrowOnFailure(hr, L"Failed to suspend session."); |
737 | 742 | ||
738 | // verify that run key was removed | 743 | // verify that run key was removed |
739 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 744 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
740 | 745 | ||
741 | // read suspend resume type | 746 | // read suspend resume type |
742 | hr = RegistrationDetectResumeType(®istration, &resumeType); | 747 | hr = RegistrationDetectResumeType(®istration, &resumeType); |
@@ -751,15 +756,12 @@ namespace Bootstrapper | |||
751 | hr = VariableDeserialize(&variables, TRUE, pbBuffer, cbBuffer, &piBuffer); | 756 | hr = VariableDeserialize(&variables, TRUE, pbBuffer, cbBuffer, &piBuffer); |
752 | TestThrowOnFailure(hr, L"Failed to deserialize variables."); | 757 | TestThrowOnFailure(hr, L"Failed to deserialize variables."); |
753 | 758 | ||
754 | //Assert::Equal((SIZE_T)sizeof(rgbData), cbBuffer); | ||
755 | //Assert::True(0 == memcmp(pbBuffer, rgbData, sizeof(rgbData))); | ||
756 | |||
757 | // write active resume mode | 759 | // write active resume mode |
758 | hr = RegistrationSessionResume(®istration, &variables, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); | 760 | hr = RegistrationSessionResume(®istration, &variables, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); |
759 | TestThrowOnFailure(hr, L"Failed to write active resume mode."); | 761 | TestThrowOnFailure(hr, L"Failed to write active resume mode."); |
760 | 762 | ||
761 | // verify that run key was put back | 763 | // verify that run key was put back |
762 | Assert::NotEqual((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 764 | Assert::NotEqual((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)); |
763 | 765 | ||
764 | // end session | 766 | // end session |
765 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); | 767 | hr = RegistrationSessionEnd(®istration, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); |