@joebigelow / wix / commits / 56c98031

The bundle provider's presence needs to follow ARP registration.

Sean Hall committed Jan 31, 2022 at 15:44 UTC 56c980318e7167be591f7807c2fc34cea7d5cb42
12 files changed +233 -253
src/burn/engine/apply.cpp
+21 -20
@@ -432,12 +432,12 @@ extern "C" HRESULT ApplyRegister(
432 // begin new session
433 if (pEngineState->registration.fPerMachine)
434 {
435 - hr = ElevationSessionBegin(pEngineState->companionConnection.hPipe, sczEngineWorkingPath, pEngineState->registration.sczResumeCommandLine, pEngineState->registration.fDisableResume, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->plan.dependencyRegistrationAction, pEngineState->plan.qwEstimatedSize, registrationType);
435 + hr = ElevationSessionBegin(pEngineState->companionConnection.hPipe, sczEngineWorkingPath, pEngineState->registration.sczResumeCommandLine, pEngineState->registration.fDisableResume, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->registration.fDetectedForeignProviderKeyBundleId, pEngineState->plan.qwEstimatedSize, registrationType);
436 ExitOnFailure(hr, "Failed to begin registration session in per-machine process.");
437 }
438 else
439 {
440 - hr = RegistrationSessionBegin(sczEngineWorkingPath, &pEngineState->registration, &pEngineState->cache, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->plan.dependencyRegistrationAction, pEngineState->plan.qwEstimatedSize, registrationType);
440 + hr = RegistrationSessionBegin(sczEngineWorkingPath, &pEngineState->registration, &pEngineState->cache, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->plan.qwEstimatedSize, registrationType);
441 ExitOnFailure(hr, "Failed to begin registration session.");
442 }
443 }
@@ -521,12 +521,12 @@ extern "C" HRESULT ApplyUnregister(
521
522 if (pEngineState->registration.fPerMachine)
523 {
524 - hr = ElevationSessionEnd(pEngineState->companionConnection.hPipe, resumeMode, restart, pEngineState->plan.dependencyRegistrationAction, registrationType);
524 + hr = ElevationSessionEnd(pEngineState->companionConnection.hPipe, resumeMode, restart, pEngineState->registration.fDetectedForeignProviderKeyBundleId, registrationType);
525 ExitOnFailure(hr, "Failed to end session in per-machine process.");
526 }
527 else
528 {
529 - hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->cache, &pEngineState->variables, &pEngineState->packages, resumeMode, restart, pEngineState->plan.dependencyRegistrationAction, registrationType);
529 + hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->cache, &pEngineState->variables, &pEngineState->packages, resumeMode, restart, registrationType);
530 ExitOnFailure(hr, "Failed to end session in per-user process.");
531 }
532
@@ -2914,8 +2914,9 @@ static HRESULT ExecuteDependencyAction(
2914 )
2915 {
2916 HRESULT hr = S_OK;
2917 + BURN_PACKAGE* pPackage = pAction->packageDependency.pPackage;
2918
2918 - if (pAction->packageDependency.pPackage->fPerMachine)
2919 + if (pPackage->fPerMachine)
2920 {
2921 hr = ElevationExecutePackageDependencyAction(pEngineState->companionConnection.hPipe, pAction);
2922 ExitOnFailure(hr, "Failed to register the dependency on per-machine package.");
@@ -2926,20 +2927,20 @@ static HRESULT ExecuteDependencyAction(
2927 ExitOnFailure(hr, "Failed to register the dependency on per-user package.");
2928 }
2929
2929 - if (pAction->packageDependency.pPackage->fCanAffectRegistration)
2930 + if (pPackage->fCanAffectRegistration)
2931 {
2932 if (BURN_DEPENDENCY_ACTION_REGISTER == pAction->packageDependency.action)
2933 {
2933 - if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pAction->packageDependency.pPackage->cacheRegistrationState)
2934 + if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pPackage->cacheRegistrationState)
2935 {
2935 - pAction->packageDependency.pPackage->cacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT;
2936 + pPackage->cacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT;
2937 }
2938
2938 - if (BURN_PACKAGE_TYPE_MSP == pAction->packageDependency.pPackage->type)
2939 + if (BURN_PACKAGE_TYPE_MSP == pPackage->type)
2940 {
2940 - for (DWORD i = 0; i < pAction->packageDependency.pPackage->Msp.cTargetProductCodes; ++i)
2941 + for (DWORD i = 0; i < pPackage->Msp.cTargetProductCodes; ++i)
2942 {
2942 - BURN_MSPTARGETPRODUCT* pTargetProduct = pAction->packageDependency.pPackage->Msp.rgTargetProducts + i;
2943 + BURN_MSPTARGETPRODUCT* pTargetProduct = pPackage->Msp.rgTargetProducts + i;
2944
2945 if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pTargetProduct->registrationState)
2946 {
@@ -2947,23 +2948,23 @@ static HRESULT ExecuteDependencyAction(
2948 }
2949 }
2950 }
2950 - else if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pAction->packageDependency.pPackage->installRegistrationState)
2951 + else if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pPackage->installRegistrationState)
2952 {
2952 - pAction->packageDependency.pPackage->installRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT;
2953 + pPackage->installRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT;
2954 }
2955 }
2956 else if (BURN_DEPENDENCY_ACTION_UNREGISTER == pAction->packageDependency.action)
2957 {
2957 - if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pAction->packageDependency.pPackage->cacheRegistrationState)
2958 + if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->cacheRegistrationState)
2959 {
2959 - pAction->packageDependency.pPackage->cacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED;
2960 + pPackage->cacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED;
2961 }
2962
2962 - if (BURN_PACKAGE_TYPE_MSP == pAction->packageDependency.pPackage->type)
2963 + if (BURN_PACKAGE_TYPE_MSP == pPackage->type)
2964 {
2964 - for (DWORD i = 0; i < pAction->packageDependency.pPackage->Msp.cTargetProductCodes; ++i)
2965 + for (DWORD i = 0; i < pPackage->Msp.cTargetProductCodes; ++i)
2966 {
2966 - BURN_MSPTARGETPRODUCT* pTargetProduct = pAction->packageDependency.pPackage->Msp.rgTargetProducts + i;
2967 + BURN_MSPTARGETPRODUCT* pTargetProduct = pPackage->Msp.rgTargetProducts + i;
2968
2969 if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pTargetProduct->registrationState)
2970 {
@@ -2971,9 +2972,9 @@ static HRESULT ExecuteDependencyAction(
2972 }
2973 }
2974 }
2974 - else if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pAction->packageDependency.pPackage->installRegistrationState)
2975 + else if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->installRegistrationState)
2976 {
2976 - pAction->packageDependency.pPackage->installRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED;
2977 + pPackage->installRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED;
2978 }
2979 }
2980 }
src/burn/engine/approvedexe.h
+2
@@ -8,10 +8,12 @@ extern "C" {
8
9 // forward declare
10
11 +enum BURN_MODE;
12 typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT BOOTSTRAPPER_ENGINE_CONTEXT;
13 typedef struct _BURN_CACHE BURN_CACHE;
14 typedef struct _BURN_DEPENDENCIES BURN_DEPENDENCIES;
15 typedef struct _BURN_ENGINE_COMMAND BURN_ENGINE_COMMAND;
16 +typedef struct _BURN_LOGGING BURN_LOGGING;
17
18 // structs
19
src/burn/engine/dependency.cpp
+5
@@ -246,6 +246,11 @@ extern "C" HRESULT DependencyDetectProviderKeyBundleId(
246 hr = StrAllocString(&pRegistration->sczDetectedProviderKeyBundleId, pRegistration->sczProviderKey, 0);
247 ExitOnFailure(hr, "Failed to initialize provider key bundle id.");
248 }
249 + else if (CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczId, -1, pRegistration->sczDetectedProviderKeyBundleId, -1))
250 + {
251 + pRegistration->fDetectedForeignProviderKeyBundleId = TRUE;
252 + LogId(REPORT_STANDARD, MSG_DETECTED_FOREIGN_BUNDLE_PROVIDER_REGISTRATION, pRegistration->sczProviderKey, pRegistration->sczDetectedProviderKeyBundleId);
253 + }
254
255 LExit:
256 return hr;
src/burn/engine/detect.cpp
+2 -2
@@ -39,6 +39,7 @@ extern "C" void DetectReset(
39 {
40 RelatedBundlesUninitialize(&pRegistration->relatedBundles);
41 ReleaseNullStr(pRegistration->sczDetectedProviderKeyBundleId);
42 + pRegistration->fDetectedForeignProviderKeyBundleId = FALSE;
43 pRegistration->fSelfRegisteredAsDependent = FALSE;
44 pRegistration->fParentRegisteredAsDependent = FALSE;
45 pRegistration->fForwardCompatibleBundleExists = FALSE;
@@ -118,8 +119,7 @@ extern "C" HRESULT DetectForwardCompatibleBundles(
119 HRESULT hr = S_OK;
120 int nCompareResult = 0;
121
121 - if (pRegistration->sczDetectedProviderKeyBundleId &&
122 - CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRegistration->sczId, -1))
122 + if (pRegistration->fDetectedForeignProviderKeyBundleId)
123 {
124 for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle)
125 {
src/burn/engine/elevation.cpp
+8 -10
@@ -525,7 +525,7 @@ extern "C" HRESULT ElevationSessionBegin(
525 __in BOOL fDisableResume,
526 __in BURN_VARIABLES* pVariables,
527 __in DWORD dwRegistrationOperations,
528 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
528 + __in BOOL fDetectedForeignProviderKeyBundleId,
529 __in DWORD64 qwEstimatedSize,
530 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
531 )
@@ -548,7 +548,7 @@ extern "C" HRESULT ElevationSessionBegin(
548 hr = BuffWriteNumber(&pbData, &cbData, dwRegistrationOperations);
549 ExitOnFailure(hr, "Failed to write registration operations to message buffer.");
550
551 - hr = BuffWriteNumber(&pbData, &cbData, (DWORD)dependencyRegistrationAction);
551 + hr = BuffWriteNumber(&pbData, &cbData, (DWORD)fDetectedForeignProviderKeyBundleId);
552 ExitOnFailure(hr, "Failed to write dependency registration action to message buffer.");
553
554 hr = BuffWriteNumber64(&pbData, &cbData, qwEstimatedSize);
@@ -622,7 +622,7 @@ extern "C" HRESULT ElevationSessionEnd(
622 __in HANDLE hPipe,
623 __in BURN_RESUME_MODE resumeMode,
624 __in BOOTSTRAPPER_APPLY_RESTART restart,
625 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
625 + __in BOOL fDetectedForeignProviderKeyBundleId,
626 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
627 )
628 {
@@ -638,7 +638,7 @@ extern "C" HRESULT ElevationSessionEnd(
638 hr = BuffWriteNumber(&pbData, &cbData, (DWORD)restart);
639 ExitOnFailure(hr, "Failed to write restart enum to message buffer.");
640
641 - hr = BuffWriteNumber(&pbData, &cbData, (DWORD)dependencyRegistrationAction);
641 + hr = BuffWriteNumber(&pbData, &cbData, (DWORD)fDetectedForeignProviderKeyBundleId);
642 ExitOnFailure(hr, "Failed to write dependency registration action to message buffer.");
643
644 hr = BuffWriteNumber(&pbData, &cbData, (DWORD)registrationType);
@@ -2359,7 +2359,6 @@ static HRESULT OnSessionBegin(
2359 SIZE_T iData = 0;
2360 LPWSTR sczEngineWorkingPath = NULL;
2361 DWORD dwRegistrationOperations = 0;
2362 - DWORD dwDependencyRegistrationAction = 0;
2362 DWORD64 qwEstimatedSize = 0;
2363 DWORD dwRegistrationType = 0;
2364
@@ -2376,7 +2375,7 @@ static HRESULT OnSessionBegin(
2375 hr = BuffReadNumber(pbData, cbData, &iData, &dwRegistrationOperations);
2376 ExitOnFailure(hr, "Failed to read registration operations.");
2377
2379 - hr = BuffReadNumber(pbData, cbData, &iData, &dwDependencyRegistrationAction);
2378 + hr = BuffReadNumber(pbData, cbData, &iData, (DWORD*)&pRegistration->fDetectedForeignProviderKeyBundleId);
2379 ExitOnFailure(hr, "Failed to read dependency registration action.");
2380
2381 hr = BuffReadNumber64(pbData, cbData, &iData, &qwEstimatedSize);
@@ -2389,7 +2388,7 @@ static HRESULT OnSessionBegin(
2388 ExitOnFailure(hr, "Failed to read variables.");
2389
2390 // Begin session in per-machine process.
2392 - hr = RegistrationSessionBegin(sczEngineWorkingPath, pRegistration, pCache, pVariables, dwRegistrationOperations, (BURN_DEPENDENCY_REGISTRATION_ACTION)dwDependencyRegistrationAction, qwEstimatedSize, (BOOTSTRAPPER_REGISTRATION_TYPE)dwRegistrationType);
2391 + hr = RegistrationSessionBegin(sczEngineWorkingPath, pRegistration, pCache, pVariables, dwRegistrationOperations, qwEstimatedSize, (BOOTSTRAPPER_REGISTRATION_TYPE)dwRegistrationType);
2392 ExitOnFailure(hr, "Failed to begin registration session.");
2393
2394 LExit:
@@ -2443,7 +2442,6 @@ static HRESULT OnSessionEnd(
2442 SIZE_T iData = 0;
2443 DWORD dwResumeMode = 0;
2444 DWORD dwRestart = 0;
2446 - DWORD dwDependencyRegistrationAction = 0;
2445 DWORD dwRegistrationType = 0;
2446
2447 // Deserialize message data.
@@ -2453,14 +2451,14 @@ static HRESULT OnSessionEnd(
2451 hr = BuffReadNumber(pbData, cbData, &iData, &dwRestart);
2452 ExitOnFailure(hr, "Failed to read restart enum.");
2453
2456 - hr = BuffReadNumber(pbData, cbData, &iData, &dwDependencyRegistrationAction);
2454 + hr = BuffReadNumber(pbData, cbData, &iData, (DWORD*)&pRegistration->fDetectedForeignProviderKeyBundleId);
2455 ExitOnFailure(hr, "Failed to read dependency registration action.");
2456
2457 hr = BuffReadNumber(pbData, cbData, &iData, &dwRegistrationType);
2458 ExitOnFailure(hr, "Failed to read dependency registration action.");
2459
2460 // suspend session in per-machine process
2463 - hr = RegistrationSessionEnd(pRegistration, pCache, pVariables, pPackages, (BURN_RESUME_MODE)dwResumeMode, (BOOTSTRAPPER_APPLY_RESTART)dwRestart, (BURN_DEPENDENCY_REGISTRATION_ACTION)dwDependencyRegistrationAction, (BOOTSTRAPPER_REGISTRATION_TYPE)dwRegistrationType);
2461 + hr = RegistrationSessionEnd(pRegistration, pCache, pVariables, pPackages, (BURN_RESUME_MODE)dwResumeMode, (BOOTSTRAPPER_APPLY_RESTART)dwRestart, (BOOTSTRAPPER_REGISTRATION_TYPE)dwRegistrationType);
2462 ExitOnFailure(hr, "Failed to suspend registration session.");
2463
2464 LExit:
src/burn/engine/elevation.h
+2 -2
@@ -28,7 +28,7 @@ HRESULT ElevationSessionBegin(
28 __in BOOL fDisableResume,
29 __in BURN_VARIABLES* pVariables,
30 __in DWORD dwRegistrationOperations,
31 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
31 + __in BOOL fDetectedForeignProviderKeyBundleId,
32 __in DWORD64 qwEstimatedSize,
33 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
34 );
@@ -43,7 +43,7 @@ HRESULT ElevationSessionEnd(
43 __in HANDLE hPipe,
44 __in BURN_RESUME_MODE resumeMode,
45 __in BOOTSTRAPPER_APPLY_RESTART restart,
46 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
46 + __in BOOL fDetectedForeignProviderKeyBundleId,
47 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
48 );
49 HRESULT ElevationSaveState(
src/burn/engine/engine.mc
+7
@@ -275,6 +275,13 @@ Language=English
275 Detected related bundle missing from cache: %1!ls!, cache path: %2!ls!
276 .
277
278 +MessageId=110
279 +Severity=Success
280 +SymbolicName=MSG_DETECTED_FOREIGN_BUNDLE_PROVIDER_REGISTRATION
281 +Language=English
282 +Detected bundle provider key: %1!ls! that is registered to a different bundle: %2!ls!
283 +.
284 +
285 MessageId=120
286 Severity=Warning
287 SymbolicName=MSG_DETECT_PACKAGE_NOT_FULLY_CACHED
src/burn/engine/plan.cpp
+6 -17
@@ -541,25 +541,14 @@ extern "C" HRESULT PlanRegistration(
541 pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
542 }
543
544 - // Always write registration since things may have changed or it just needs to be "fixed up".
545 - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
546 -
547 - // Always update our estimated size registration when installing/modify/repair since things
548 - // may have been added or removed or it just needs to be "fixed up".
549 - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE;
550 -
544 if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action)
545 {
553 - // If our provider key was detected and it points to our current bundle then we can
554 - // unregister the bundle dependency.
555 - if (pRegistration->sczDetectedProviderKeyBundleId &&
556 - CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczId, -1, pRegistration->sczDetectedProviderKeyBundleId, -1))
546 + // If our provider key was not owned by a different bundle,
547 + // then plan to write our provider key registration to "fix it" if broken
548 + // in case the bundle isn't successfully uninstalled.
549 + if (!pRegistration->fDetectedForeignProviderKeyBundleId)
550 {
558 - pPlan->dependencyRegistrationAction = BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER;
559 - }
560 - else // log that another bundle already owned our registration, hopefully this only happens when a newer version
561 - { // of a bundle installed and is in the process of upgrading us.
562 - LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_PROVIDER_KEY_REMOVAL, pRegistration->sczProviderKey, pRegistration->sczDetectedProviderKeyBundleId);
551 + pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY;
552 }
553
554 // Create the dictionary of dependents that should be ignored.
@@ -651,7 +640,7 @@ extern "C" HRESULT PlanRegistration(
640
641 // Always plan to write our provider key registration when installing/modify/repair to "fix it"
642 // if broken.
654 - pPlan->dependencyRegistrationAction = BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER;
643 + pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY;
644
645 // Create the dictionary of bundle dependents.
646 hr = DictCreateStringList(&sdBundleDependents, 5, DICT_FLAG_CASEINSENSITIVE);
src/burn/engine/plan.h
+1 -11
@@ -15,15 +15,7 @@ enum BURN_REGISTRATION_ACTION_OPERATIONS
15 {
16 BURN_REGISTRATION_ACTION_OPERATIONS_NONE = 0x0,
17 BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE = 0x1,
18 - BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION = 0x2,
19 - BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE = 0x4,
20 -};
21 -
22 -enum BURN_DEPENDENCY_REGISTRATION_ACTION
23 -{
24 - BURN_DEPENDENCY_REGISTRATION_ACTION_NONE,
25 - BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER,
26 - BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER,
18 + BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY = 0x2,
19 };
20
21 enum BURN_DEPENDENT_REGISTRATION_ACTION_TYPE
@@ -272,8 +264,6 @@ typedef struct _BURN_PLAN
264 BOOL fEnabledForwardCompatibleBundle;
265 BURN_PACKAGE forwardCompatibleBundle;
266
275 - BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction;
276 -
267 BURN_DEPENDENT_REGISTRATION_ACTION* rgRegistrationActions;
268 DWORD cRegistrationActions;
269
src/burn/engine/registration.cpp
+154 -166
@@ -605,7 +605,6 @@ extern "C" HRESULT RegistrationSessionBegin(
605 __in BURN_CACHE* pCache,
606 __in BURN_VARIABLES* pVariables,
607 __in DWORD dwRegistrationOptions,
608 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
608 __in DWORD64 qwEstimatedSize,
609 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
610 )
@@ -635,206 +634,199 @@ extern "C" HRESULT RegistrationSessionBegin(
634 ExitOnFailure(hr, "Failed to create registration key.");
635
636 // Write any ARP values and software tags.
638 - if (dwRegistrationOptions & BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION)
639 - {
640 - // Upgrade information
641 - hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, pRegistration->sczCacheExecutablePath);
642 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH);
637 + hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, pRegistration->sczCacheExecutablePath);
638 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH);
639
644 - hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, pRegistration->rgsczUpgradeCodes, pRegistration->cUpgradeCodes);
645 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE);
640 + hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, pRegistration->rgsczUpgradeCodes, pRegistration->cUpgradeCodes);
641 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE);
642
647 - hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE, pRegistration->rgsczAddonCodes, pRegistration->cAddonCodes);
648 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE);
643 + hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE, pRegistration->rgsczAddonCodes, pRegistration->cAddonCodes);
644 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE);
645
650 - hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE, pRegistration->rgsczDetectCodes, pRegistration->cDetectCodes);
651 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE);
646 + hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE, pRegistration->rgsczDetectCodes, pRegistration->cDetectCodes);
647 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE);
648
653 - hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE, pRegistration->rgsczPatchCodes, pRegistration->cPatchCodes);
654 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE);
649 + hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE, pRegistration->rgsczPatchCodes, pRegistration->cPatchCodes);
650 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE);
651
656 - hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION, pRegistration->pVersion->sczVersion);
657 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION);
652 + hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION, pRegistration->pVersion->sczVersion);
653 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION);
654
659 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MAJOR, pRegistration->pVersion->dwMajor);
660 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MAJOR);
655 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MAJOR, pRegistration->pVersion->dwMajor);
656 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MAJOR);
657
662 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MINOR, pRegistration->pVersion->dwMinor);
663 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MINOR);
658 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MINOR, pRegistration->pVersion->dwMinor);
659 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MINOR);
660
665 - if (pRegistration->sczProviderKey)
666 - {
667 - hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY, pRegistration->sczProviderKey);
668 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY);
669 - }
661 + if (pRegistration->sczProviderKey)
662 + {
663 + hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY, pRegistration->sczProviderKey);
664 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY);
665 + }
666
671 - if (pRegistration->sczTag)
672 - {
673 - hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_TAG, pRegistration->sczTag);
674 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_TAG);
675 - }
667 + if (pRegistration->sczTag)
668 + {
669 + hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_TAG, pRegistration->sczTag);
670 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_TAG);
671 + }
672
677 - hr = RegWriteStringFormatted(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_VERSION, L"%hs", szVerMajorMinorBuild);
678 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_VERSION);
673 + hr = RegWriteStringFormatted(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_VERSION, L"%hs", szVerMajorMinorBuild);
674 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_VERSION);
675
680 - hr = RegWriteNumber(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION, BURN_PROTOCOL_VERSION);
681 - ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION);
676 + hr = RegWriteNumber(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION, BURN_PROTOCOL_VERSION);
677 + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION);
678
683 - // DisplayIcon: [path to exe] and ",0" to refer to the first icon in the executable.
684 - hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_DISPLAY_ICON, L"%s,0", pRegistration->sczCacheExecutablePath);
685 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_ICON);
679 + // DisplayIcon: [path to exe] and ",0" to refer to the first icon in the executable.
680 + hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_DISPLAY_ICON, L"%s,0", pRegistration->sczCacheExecutablePath);
681 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_ICON);
682
687 - // update display name
688 - hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType);
689 - ExitOnFailure(hr, "Failed to update name and publisher.");
683 + // update display name
684 + hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType);
685 + ExitOnFailure(hr, "Failed to update name and publisher.");
686
691 - // DisplayVersion: provided by UI
692 - if (pRegistration->sczDisplayVersion)
693 - {
694 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_DISPLAY_VERSION, pRegistration->sczDisplayVersion);
695 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_VERSION);
696 - }
687 + // DisplayVersion: provided by UI
688 + if (pRegistration->sczDisplayVersion)
689 + {
690 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_DISPLAY_VERSION, pRegistration->sczDisplayVersion);
691 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_VERSION);
692 + }
693
698 - // Publisher: provided by UI
699 - hr = GetBundleManufacturer(pRegistration, pVariables, &sczPublisher);
700 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PUBLISHER, SUCCEEDED(hr) ? sczPublisher : pRegistration->sczPublisher);
701 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PUBLISHER);
694 + // Publisher: provided by UI
695 + hr = GetBundleManufacturer(pRegistration, pVariables, &sczPublisher);
696 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PUBLISHER, SUCCEEDED(hr) ? sczPublisher : pRegistration->sczPublisher);
697 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PUBLISHER);
698
703 - // HelpLink: provided by UI
704 - if (pRegistration->sczHelpLink)
705 - {
706 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_LINK, pRegistration->sczHelpLink);
707 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_LINK);
708 - }
699 + // HelpLink: provided by UI
700 + if (pRegistration->sczHelpLink)
701 + {
702 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_LINK, pRegistration->sczHelpLink);
703 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_LINK);
704 + }
705
710 - // HelpTelephone: provided by UI
711 - if (pRegistration->sczHelpTelephone)
712 - {
713 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_TELEPHONE, pRegistration->sczHelpTelephone);
714 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_TELEPHONE);
715 - }
706 + // HelpTelephone: provided by UI
707 + if (pRegistration->sczHelpTelephone)
708 + {
709 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_TELEPHONE, pRegistration->sczHelpTelephone);
710 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_TELEPHONE);
711 + }
712
717 - // URLInfoAbout, provided by UI
718 - if (pRegistration->sczAboutUrl)
719 - {
720 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_INFO_ABOUT, pRegistration->sczAboutUrl);
721 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_INFO_ABOUT);
722 - }
713 + // URLInfoAbout, provided by UI
714 + if (pRegistration->sczAboutUrl)
715 + {
716 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_INFO_ABOUT, pRegistration->sczAboutUrl);
717 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_INFO_ABOUT);
718 + }
719
724 - // URLUpdateInfo, provided by UI
725 - if (pRegistration->sczUpdateUrl)
726 - {
727 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_UPDATE_INFO, pRegistration->sczUpdateUrl);
728 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_UPDATE_INFO);
729 - }
720 + // URLUpdateInfo, provided by UI
721 + if (pRegistration->sczUpdateUrl)
722 + {
723 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_UPDATE_INFO, pRegistration->sczUpdateUrl);
724 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_UPDATE_INFO);
725 + }
726
731 - // ParentDisplayName
732 - if (pRegistration->sczParentDisplayName)
733 - {
734 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_DISPLAY_NAME, pRegistration->sczParentDisplayName);
735 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_DISPLAY_NAME);
727 + // ParentDisplayName
728 + if (pRegistration->sczParentDisplayName)
729 + {
730 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_DISPLAY_NAME, pRegistration->sczParentDisplayName);
731 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_DISPLAY_NAME);
732
737 - // Need to write the ParentKeyName but can be set to anything.
738 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_KEY_NAME, pRegistration->sczParentDisplayName);
739 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_KEY_NAME);
740 - }
733 + // Need to write the ParentKeyName but can be set to anything.
734 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_KEY_NAME, pRegistration->sczParentDisplayName);
735 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_KEY_NAME);
736 + }
737
742 - // Comments, provided by UI
743 - if (pRegistration->sczComments)
744 - {
745 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_COMMENTS, pRegistration->sczComments);
746 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_COMMENTS);
747 - }
738 + // Comments, provided by UI
739 + if (pRegistration->sczComments)
740 + {
741 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_COMMENTS, pRegistration->sczComments);
742 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_COMMENTS);
743 + }
744
749 - // Contact, provided by UI
750 - if (pRegistration->sczContact)
751 - {
752 - hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_CONTACT, pRegistration->sczContact);
753 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_CONTACT);
754 - }
745 + // Contact, provided by UI
746 + if (pRegistration->sczContact)
747 + {
748 + hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_CONTACT, pRegistration->sczContact);
749 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_CONTACT);
750 + }
751
756 - // InstallLocation: provided by UI
757 - // TODO: need to figure out what "InstallLocation" means in a chainer. <smile/>
752 + // InstallLocation: provided by UI
753 + // TODO: need to figure out what "InstallLocation" means in a chainer. <smile/>
754
759 - // NoModify
760 - if (BURN_REGISTRATION_MODIFY_DISABLE == pRegistration->modify)
761 - {
762 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_MODIFY, 1);
763 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_MODIFY);
764 - }
765 - else if (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON != pRegistration->modify) // if support modify (aka: did not disable anything)
766 - {
767 - // ModifyPath: [path to exe] /modify
768 - hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_MODIFY_PATH, L"\"%ls\" /%ls /modify", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM);
769 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_MODIFY_PATH);
755 + // NoModify
756 + if (BURN_REGISTRATION_MODIFY_DISABLE == pRegistration->modify)
757 + {
758 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_MODIFY, 1);
759 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_MODIFY);
760 + }
761 + else if (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON != pRegistration->modify) // if support modify (aka: did not disable anything)
762 + {
763 + // ModifyPath: [path to exe] /modify
764 + hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_MODIFY_PATH, L"\"%ls\" /%ls /modify", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM);
765 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_MODIFY_PATH);
766
771 - // NoElevateOnModify: 1
772 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY, 1);
773 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY);
774 - }
767 + // NoElevateOnModify: 1
768 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY, 1);
769 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY);
770 + }
771
776 - // NoRemove: should this be allowed?
777 - if (pRegistration->fNoRemoveDefined)
778 - {
779 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_REMOVE, (DWORD)pRegistration->fNoRemove);
780 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_REMOVE);
781 - }
772 + // NoRemove: should this be allowed?
773 + if (pRegistration->fNoRemoveDefined)
774 + {
775 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_REMOVE, (DWORD)pRegistration->fNoRemove);
776 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_REMOVE);
777 + }
778
783 - // Conditionally hide the ARP entry.
784 - if (!pRegistration->fRegisterArp)
785 - {
786 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1);
787 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT);
788 - }
779 + // Conditionally hide the ARP entry.
780 + if (!pRegistration->fRegisterArp)
781 + {
782 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1);
783 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT);
784 + }
785
790 - // QuietUninstallString: [path to exe] /uninstall /quiet
791 - hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING, L"\"%ls\" /%ls /uninstall /quiet", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM);
792 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING);
786 + // QuietUninstallString: [path to exe] /uninstall /quiet
787 + hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING, L"\"%ls\" /%ls /uninstall /quiet", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM);
788 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING);
789
794 - // UninstallString, [path to exe]
795 - // If the modify button is to be disabled, we'll add "/modify" to the uninstall string because the button is "Uninstall/Change". Otherwise,
796 - // it's just the "Uninstall" button so we add "/uninstall" to make the program just go away.
797 - LPCWSTR wzUninstallParameters = (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON == pRegistration->modify) ? L"/modify" : L" /uninstall";
798 - hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_UNINSTALL_STRING, L"\"%ls\" /%ls %ls", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, wzUninstallParameters);
799 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_UNINSTALL_STRING);
790 + // UninstallString, [path to exe]
791 + // If the modify button is to be disabled, we'll add "/modify" to the uninstall string because the button is "Uninstall/Change". Otherwise,
792 + // it's just the "Uninstall" button so we add "/uninstall" to make the program just go away.
793 + LPCWSTR wzUninstallParameters = (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON == pRegistration->modify) ? L"/modify" : L" /uninstall";
794 + hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_UNINSTALL_STRING, L"\"%ls\" /%ls %ls", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, wzUninstallParameters);
795 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_UNINSTALL_STRING);
796
801 - if (pRegistration->softwareTags.cSoftwareTags)
802 - {
803 - hr = WriteSoftwareTags(pVariables, &pRegistration->softwareTags);
804 - ExitOnFailure(hr, "Failed to write software tags.");
805 - }
797 + if (pRegistration->softwareTags.cSoftwareTags)
798 + {
799 + hr = WriteSoftwareTags(pVariables, &pRegistration->softwareTags);
800 + ExitOnFailure(hr, "Failed to write software tags.");
801 + }
802
807 - // Update registration.
808 - if (pRegistration->update.fRegisterUpdate)
809 - {
810 - hr = WriteUpdateRegistration(pRegistration, pVariables);
811 - ExitOnFailure(hr, "Failed to write update registration.");
812 - }
803 + // Update registration.
804 + if (pRegistration->update.fRegisterUpdate)
805 + {
806 + hr = WriteUpdateRegistration(pRegistration, pVariables);
807 + ExitOnFailure(hr, "Failed to write update registration.");
808 }
809
810 // Update estimated size.
816 - if (dwRegistrationOptions & BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE)
811 + qwEstimatedSize /= 1024; // Convert bytes to KB
812 + if (0 < qwEstimatedSize)
813 {
818 - qwEstimatedSize /= 1024; // Convert bytes to KB
819 - if (0 < qwEstimatedSize)
814 + if (DWORD_MAX < qwEstimatedSize)
815 {
821 - if (DWORD_MAX < qwEstimatedSize)
822 - {
823 - // ARP doesn't support QWORDs here
824 - dwSize = DWORD_MAX;
825 - }
826 - else
827 - {
828 - dwSize = static_cast<DWORD>(qwEstimatedSize);
829 - }
830 -
831 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_ESTIMATED_SIZE, dwSize);
832 - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_ESTIMATED_SIZE);
816 + // ARP doesn't support QWORDs here
817 + dwSize = DWORD_MAX;
818 }
819 + else
820 + {
821 + dwSize = static_cast<DWORD>(qwEstimatedSize);
822 + }
823 +
824 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_ESTIMATED_SIZE, dwSize);
825 + ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_ESTIMATED_SIZE);
826 }
827
828 // Register the bundle dependency key.
837 - if (BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER == dependencyRegistrationAction)
829 + if (dwRegistrationOptions & BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY)
830 {
831 hr = DependencyRegisterBundle(pRegistration);
832 ExitOnFailure(hr, "Failed to register the bundle dependency key.");
@@ -897,7 +889,6 @@ extern "C" HRESULT RegistrationSessionEnd(
889 __in BURN_PACKAGES* pPackages,
890 __in BURN_RESUME_MODE resumeMode,
891 __in BOOTSTRAPPER_APPLY_RESTART restart,
900 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
892 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
893 )
894 {
@@ -909,11 +900,8 @@ extern "C" HRESULT RegistrationSessionEnd(
900 {
901 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE == registrationType, "Registration type must be NONE if resume mode is NONE");
902
912 - // If we just registered the bundle dependency but something went wrong and caused us to not
913 - // keep the bundle registration (like rollback) or we are supposed to unregister the bundle
914 - // dependency when unregistering the bundle, do so.
915 - if (BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER == dependencyRegistrationAction ||
916 - BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER == dependencyRegistrationAction)
903 + // If we own the bundle dependency then remove it.
904 + if (!pRegistration->fDetectedForeignProviderKeyBundleId)
905 {
906 // Remove the bundle dependency key.
907 DependencyUnregisterBundle(pRegistration, pPackages);
src/burn/engine/registration.h
+1 -7
@@ -7,11 +7,6 @@ extern "C" {
7 #endif
8
9
10 -enum BURN_MODE;
11 -enum BURN_DEPENDENCY_REGISTRATION_ACTION;
12 -struct _BURN_LOGGING;
13 -typedef _BURN_LOGGING BURN_LOGGING;
14 -
10 // constants
11
12 const LPCWSTR BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
@@ -152,6 +147,7 @@ typedef struct _BURN_REGISTRATION
147 BOOL fForwardCompatibleBundleExists; // Only valid after detect.
148 BOOL fEligibleForCleanup; // Only valid after detect.
149
150 + BOOL fDetectedForeignProviderKeyBundleId;
151 LPWSTR sczDetectedProviderKeyBundleId;
152 LPWSTR sczBundlePackageAncestors;
153 } BURN_REGISTRATION;
@@ -187,7 +183,6 @@ HRESULT RegistrationSessionBegin(
183 __in BURN_CACHE* pCache,
184 __in BURN_VARIABLES* pVariables,
185 __in DWORD dwRegistrationOptions,
190 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
186 __in DWORD64 qwEstimatedSize,
187 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
188 );
@@ -203,7 +198,6 @@ HRESULT RegistrationSessionEnd(
198 __in BURN_PACKAGES* pPackages,
199 __in BURN_RESUME_MODE resumeMode,
200 __in BOOTSTRAPPER_APPLY_RESTART restart,
206 - __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
201 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
202 );
203 HRESULT RegistrationSaveState(
src/burn/test/BurnUnitTest/RegistrationTest.cpp
+24 -18
@@ -79,6 +79,7 @@ namespace Bootstrapper
79 BURN_CACHE cache = { };
80 BURN_ENGINE_COMMAND internalCommand = { };
81 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
82 + DWORD dwRegistrationOptions = BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
83
84 try
85 {
@@ -125,7 +126,7 @@ namespace Bootstrapper
126 TestThrowOnFailure(hr, L"Failed to get current process path.");
127
128 // write registration
128 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
129 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
130 TestThrowOnFailure(hr, L"Failed to register bundle.");
131
132 // verify that registration was created
@@ -136,7 +137,7 @@ namespace Bootstrapper
137 Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.clean.room /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr)));
138
139 // end session
139 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
140 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
141 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
142
143 // verify that registration was removed
@@ -179,6 +180,7 @@ namespace Bootstrapper
180 BURN_CACHE cache = { };
181 BURN_ENGINE_COMMAND internalCommand = { };
182 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
183 + DWORD dwRegistrationOptions = 0;
184 try
185 {
186 // set mock API's
@@ -228,7 +230,7 @@ namespace Bootstrapper
230 //
231
232 // write registration
231 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
233 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
234 TestThrowOnFailure(hr, L"Failed to register bundle.");
235
236 // verify that registration was created
@@ -237,7 +239,7 @@ namespace Bootstrapper
239 Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.clean.room /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr));
240
241 // complete registration
240 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
242 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
243 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
244
245 // verify that registration was updated
@@ -250,7 +252,7 @@ namespace Bootstrapper
252 //
253
254 // write registration
253 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
255 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
256 TestThrowOnFailure(hr, L"Failed to register bundle.");
257
258 // verify that registration was updated
@@ -259,7 +261,7 @@ namespace Bootstrapper
261 Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.clean.room /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr));
262
263 // delete registration
262 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
264 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
265 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
266
267 // verify that registration was removed
@@ -301,6 +303,7 @@ namespace Bootstrapper
303 BURN_CACHE cache = { };
304 BURN_ENGINE_COMMAND internalCommand = { };
305 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
306 + DWORD dwRegistrationOptions = 0;
307 try
308 {
309 // set mock API's
@@ -350,7 +353,7 @@ namespace Bootstrapper
353 //
354
355 // write registration
353 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
356 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
357 TestThrowOnFailure(hr, L"Failed to register bundle.");
358
359 // verify that registration was created
@@ -358,7 +361,7 @@ namespace Bootstrapper
361 Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.clean.room /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr));
362
363 // complete registration
361 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_FULL);
364 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, BOOTSTRAPPER_REGISTRATION_TYPE_FULL);
365 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
366
367 // verify that registration variables were updated
@@ -378,7 +381,7 @@ namespace Bootstrapper
381 //
382
383 // delete registration
381 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
384 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
385 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
386
387 // verify that registration was removed
@@ -420,6 +423,7 @@ namespace Bootstrapper
423 BURN_CACHE cache = { };
424 BURN_ENGINE_COMMAND internalCommand = { };
425 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
426 + DWORD dwRegistrationOptions = 0;
427 try
428 {
429 // set mock API's
@@ -471,7 +475,7 @@ namespace Bootstrapper
475 //
476
477 // write registration
474 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
478 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
479 TestThrowOnFailure(hr, L"Failed to register bundle.");
480
481 // verify that registration was created
@@ -479,7 +483,7 @@ namespace Bootstrapper
483 Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.clean.room /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr));
484
485 // finish registration
482 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_FULL);
486 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_FULL);
487 TestThrowOnFailure(hr, L"Failed to register bundle.");
488
489 // verify that registration was updated
@@ -504,7 +508,7 @@ namespace Bootstrapper
508 //
509
510 // write registration
507 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
511 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
512 TestThrowOnFailure(hr, L"Failed to register bundle.");
513
514 // verify that registration was updated
@@ -512,7 +516,7 @@ namespace Bootstrapper
516 Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.clean.room /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr));
517
518 // delete registration
515 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
519 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
520 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
521
522 // verify that registration was removed
@@ -558,6 +562,7 @@ namespace Bootstrapper
562 BURN_ENGINE_COMMAND internalCommand = { };
563 BYTE* pbBuffer = NULL;
564 SIZE_T cbBuffer = 0;
565 + DWORD dwRegistrationOptions = 0;
566
567 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
568 try
@@ -614,7 +619,7 @@ namespace Bootstrapper
619 TestThrowOnFailure(hr, L"Failed to get current process path.");
620
621 // begin session
617 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
622 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
623 TestThrowOnFailure(hr, L"Failed to register bundle.");
624
625 VariableSetNumericHelper(&variables, L"MyBurnVariable1", 42);
@@ -657,7 +662,7 @@ namespace Bootstrapper
662 NativeAssert::StringEqual(L"42", sczValue);
663
664 // end session
660 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
665 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
666 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
667 }
668 finally
@@ -700,6 +705,7 @@ namespace Bootstrapper
705 SIZE_T cbBuffer = 0;
706 SIZE_T piBuffer = 0;
707 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
708 + DWORD dwRegistrationOptions = 0;
709 try
710 {
711 // set mock API's
@@ -758,7 +764,7 @@ namespace Bootstrapper
764 Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_NONE, (int)resumeType);
765
766 // begin session
761 - hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
767 + hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
768 TestThrowOnFailure(hr, L"Failed to register bundle.");
769
770 VariableSetNumericHelper(&variables, L"MyBurnVariable1", 42);
@@ -797,7 +803,7 @@ namespace Bootstrapper
803 Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, (int)resumeType);
804
805 // suspend session
800 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_SUSPEND, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
806 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_SUSPEND, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
807 TestThrowOnFailure(hr, L"Failed to suspend session.");
808
809 // verify that run key was removed
@@ -824,7 +830,7 @@ namespace Bootstrapper
830 Assert::NotEqual((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(TEST_BUNDLE_ID), nullptr));
831
832 // end session
827 - hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
833 + hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
834 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
835
836 // read resume type after session