aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/registration.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-01-31 15:44:00 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-02-01 23:36:23 -0600
commit56c980318e7167be591f7807c2fc34cea7d5cb42 (patch)
treee074b3548d8dfe51f420b6d0278a6fe17191b6ec /src/burn/engine/registration.cpp
parentbfe5ab76b5ecc1a21078534e6fba90d12cfd3c00 (diff)
downloadwix-56c980318e7167be591f7807c2fc34cea7d5cb42.tar.gz
wix-56c980318e7167be591f7807c2fc34cea7d5cb42.tar.bz2
wix-56c980318e7167be591f7807c2fc34cea7d5cb42.zip
The bundle provider's presence needs to follow ARP registration.
Diffstat (limited to 'src/burn/engine/registration.cpp')
-rw-r--r--src/burn/engine/registration.cpp320
1 files changed, 154 insertions, 166 deletions
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index c76dde53..59947867 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -605,7 +605,6 @@ extern "C" HRESULT RegistrationSessionBegin(
605 __in BURN_CACHE* pCache, 605 __in BURN_CACHE* pCache,
606 __in BURN_VARIABLES* pVariables, 606 __in BURN_VARIABLES* pVariables,
607 __in DWORD dwRegistrationOptions, 607 __in DWORD dwRegistrationOptions,
608 __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
609 __in DWORD64 qwEstimatedSize, 608 __in DWORD64 qwEstimatedSize,
610 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType 609 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
611 ) 610 )
@@ -635,206 +634,199 @@ extern "C" HRESULT RegistrationSessionBegin(
635 ExitOnFailure(hr, "Failed to create registration key."); 634 ExitOnFailure(hr, "Failed to create registration key.");
636 635
637 // Write any ARP values and software tags. 636 // Write any ARP values and software tags.
638 if (dwRegistrationOptions & BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION) 637 hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, pRegistration->sczCacheExecutablePath);
639 { 638 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH);
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);
643 639
644 hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, pRegistration->rgsczUpgradeCodes, pRegistration->cUpgradeCodes); 640 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); 641 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE);
646 642
647 hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE, pRegistration->rgsczAddonCodes, pRegistration->cAddonCodes); 643 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); 644 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE);
649 645
650 hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE, pRegistration->rgsczDetectCodes, pRegistration->cDetectCodes); 646 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); 647 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE);
652 648
653 hr = RegWriteStringArray(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE, pRegistration->rgsczPatchCodes, pRegistration->cPatchCodes); 649 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); 650 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE);
655 651
656 hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION, pRegistration->pVersion->sczVersion); 652 hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION, pRegistration->pVersion->sczVersion);
657 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION); 653 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION);
658 654
659 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MAJOR, pRegistration->pVersion->dwMajor); 655 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MAJOR, pRegistration->pVersion->dwMajor);
660 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MAJOR); 656 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MAJOR);
661 657
662 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MINOR, pRegistration->pVersion->dwMinor); 658 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_VERSION_MINOR, pRegistration->pVersion->dwMinor);
663 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MINOR); 659 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_VERSION_MINOR);
664 660
665 if (pRegistration->sczProviderKey) 661 if (pRegistration->sczProviderKey)
666 { 662 {
667 hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY, pRegistration->sczProviderKey); 663 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); 664 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY);
669 } 665 }
670 666
671 if (pRegistration->sczTag) 667 if (pRegistration->sczTag)
672 { 668 {
673 hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_TAG, pRegistration->sczTag); 669 hr = RegWriteString(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_TAG, pRegistration->sczTag);
674 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_TAG); 670 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_TAG);
675 } 671 }
676 672
677 hr = RegWriteStringFormatted(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_VERSION, L"%hs", szVerMajorMinorBuild); 673 hr = RegWriteStringFormatted(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_VERSION, L"%hs", szVerMajorMinorBuild);
678 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_VERSION); 674 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_VERSION);
679 675
680 hr = RegWriteNumber(hkRegistration, BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION, BURN_PROTOCOL_VERSION); 676 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); 677 ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION);
682 678
683 // DisplayIcon: [path to exe] and ",0" to refer to the first icon in the executable. 679 // 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); 680 hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_DISPLAY_ICON, L"%s,0", pRegistration->sczCacheExecutablePath);
685 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_ICON); 681 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_ICON);
686 682
687 // update display name 683 // update display name
688 hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType); 684 hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType);
689 ExitOnFailure(hr, "Failed to update name and publisher."); 685 ExitOnFailure(hr, "Failed to update name and publisher.");
690 686
691 // DisplayVersion: provided by UI 687 // DisplayVersion: provided by UI
692 if (pRegistration->sczDisplayVersion) 688 if (pRegistration->sczDisplayVersion)
693 { 689 {
694 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_DISPLAY_VERSION, pRegistration->sczDisplayVersion); 690 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_DISPLAY_VERSION, pRegistration->sczDisplayVersion);
695 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_VERSION); 691 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_VERSION);
696 } 692 }
697 693
698 // Publisher: provided by UI 694 // Publisher: provided by UI
699 hr = GetBundleManufacturer(pRegistration, pVariables, &sczPublisher); 695 hr = GetBundleManufacturer(pRegistration, pVariables, &sczPublisher);
700 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PUBLISHER, SUCCEEDED(hr) ? sczPublisher : pRegistration->sczPublisher); 696 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PUBLISHER, SUCCEEDED(hr) ? sczPublisher : pRegistration->sczPublisher);
701 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PUBLISHER); 697 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PUBLISHER);
702 698
703 // HelpLink: provided by UI 699 // HelpLink: provided by UI
704 if (pRegistration->sczHelpLink) 700 if (pRegistration->sczHelpLink)
705 { 701 {
706 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_LINK, pRegistration->sczHelpLink); 702 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_LINK, pRegistration->sczHelpLink);
707 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_LINK); 703 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_LINK);
708 } 704 }
709 705
710 // HelpTelephone: provided by UI 706 // HelpTelephone: provided by UI
711 if (pRegistration->sczHelpTelephone) 707 if (pRegistration->sczHelpTelephone)
712 { 708 {
713 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_TELEPHONE, pRegistration->sczHelpTelephone); 709 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_HELP_TELEPHONE, pRegistration->sczHelpTelephone);
714 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_TELEPHONE); 710 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_HELP_TELEPHONE);
715 } 711 }
716 712
717 // URLInfoAbout, provided by UI 713 // URLInfoAbout, provided by UI
718 if (pRegistration->sczAboutUrl) 714 if (pRegistration->sczAboutUrl)
719 { 715 {
720 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_INFO_ABOUT, pRegistration->sczAboutUrl); 716 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_INFO_ABOUT, pRegistration->sczAboutUrl);
721 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_INFO_ABOUT); 717 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_INFO_ABOUT);
722 } 718 }
723 719
724 // URLUpdateInfo, provided by UI 720 // URLUpdateInfo, provided by UI
725 if (pRegistration->sczUpdateUrl) 721 if (pRegistration->sczUpdateUrl)
726 { 722 {
727 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_UPDATE_INFO, pRegistration->sczUpdateUrl); 723 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_URL_UPDATE_INFO, pRegistration->sczUpdateUrl);
728 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_UPDATE_INFO); 724 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_URL_UPDATE_INFO);
729 } 725 }
730 726
731 // ParentDisplayName 727 // ParentDisplayName
732 if (pRegistration->sczParentDisplayName) 728 if (pRegistration->sczParentDisplayName)
733 { 729 {
734 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_DISPLAY_NAME, pRegistration->sczParentDisplayName); 730 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_DISPLAY_NAME, pRegistration->sczParentDisplayName);
735 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_DISPLAY_NAME); 731 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_DISPLAY_NAME);
736 732
737 // Need to write the ParentKeyName but can be set to anything. 733 // Need to write the ParentKeyName but can be set to anything.
738 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_KEY_NAME, pRegistration->sczParentDisplayName); 734 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_PARENT_KEY_NAME, pRegistration->sczParentDisplayName);
739 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_KEY_NAME); 735 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_PARENT_KEY_NAME);
740 } 736 }
741 737
742 // Comments, provided by UI 738 // Comments, provided by UI
743 if (pRegistration->sczComments) 739 if (pRegistration->sczComments)
744 { 740 {
745 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_COMMENTS, pRegistration->sczComments); 741 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_COMMENTS, pRegistration->sczComments);
746 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_COMMENTS); 742 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_COMMENTS);
747 } 743 }
748 744
749 // Contact, provided by UI 745 // Contact, provided by UI
750 if (pRegistration->sczContact) 746 if (pRegistration->sczContact)
751 { 747 {
752 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_CONTACT, pRegistration->sczContact); 748 hr = RegWriteString(hkRegistration, REGISTRY_BUNDLE_CONTACT, pRegistration->sczContact);
753 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_CONTACT); 749 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_CONTACT);
754 } 750 }
755 751
756 // InstallLocation: provided by UI 752 // InstallLocation: provided by UI
757 // TODO: need to figure out what "InstallLocation" means in a chainer. <smile/> 753 // TODO: need to figure out what "InstallLocation" means in a chainer. <smile/>
758 754
759 // NoModify 755 // NoModify
760 if (BURN_REGISTRATION_MODIFY_DISABLE == pRegistration->modify) 756 if (BURN_REGISTRATION_MODIFY_DISABLE == pRegistration->modify)
761 { 757 {
762 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_MODIFY, 1); 758 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_MODIFY, 1);
763 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_MODIFY); 759 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_MODIFY);
764 } 760 }
765 else if (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON != pRegistration->modify) // if support modify (aka: did not disable anything) 761 else if (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON != pRegistration->modify) // if support modify (aka: did not disable anything)
766 { 762 {
767 // ModifyPath: [path to exe] /modify 763 // ModifyPath: [path to exe] /modify
768 hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_MODIFY_PATH, L"\"%ls\" /%ls /modify", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); 764 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); 765 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_MODIFY_PATH);
770 766
771 // NoElevateOnModify: 1 767 // NoElevateOnModify: 1
772 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY, 1); 768 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY, 1);
773 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY); 769 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY);
774 } 770 }
775 771
776 // NoRemove: should this be allowed? 772 // NoRemove: should this be allowed?
777 if (pRegistration->fNoRemoveDefined) 773 if (pRegistration->fNoRemoveDefined)
778 { 774 {
779 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_REMOVE, (DWORD)pRegistration->fNoRemove); 775 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_REMOVE, (DWORD)pRegistration->fNoRemove);
780 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_REMOVE); 776 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_REMOVE);
781 } 777 }
782 778
783 // Conditionally hide the ARP entry. 779 // Conditionally hide the ARP entry.
784 if (!pRegistration->fRegisterArp) 780 if (!pRegistration->fRegisterArp)
785 { 781 {
786 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1); 782 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1);
787 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT); 783 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT);
788 } 784 }
789 785
790 // QuietUninstallString: [path to exe] /uninstall /quiet 786 // 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); 787 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); 788 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING);
793 789
794 // UninstallString, [path to exe] 790 // 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, 791 // 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. 792 // 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"; 793 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); 794 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); 795 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_UNINSTALL_STRING);
800 796
801 if (pRegistration->softwareTags.cSoftwareTags) 797 if (pRegistration->softwareTags.cSoftwareTags)
802 { 798 {
803 hr = WriteSoftwareTags(pVariables, &pRegistration->softwareTags); 799 hr = WriteSoftwareTags(pVariables, &pRegistration->softwareTags);
804 ExitOnFailure(hr, "Failed to write software tags."); 800 ExitOnFailure(hr, "Failed to write software tags.");
805 } 801 }
806 802
807 // Update registration. 803 // Update registration.
808 if (pRegistration->update.fRegisterUpdate) 804 if (pRegistration->update.fRegisterUpdate)
809 { 805 {
810 hr = WriteUpdateRegistration(pRegistration, pVariables); 806 hr = WriteUpdateRegistration(pRegistration, pVariables);
811 ExitOnFailure(hr, "Failed to write update registration."); 807 ExitOnFailure(hr, "Failed to write update registration.");
812 }
813 } 808 }
814 809
815 // Update estimated size. 810 // Update estimated size.
816 if (dwRegistrationOptions & BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE) 811 qwEstimatedSize /= 1024; // Convert bytes to KB
812 if (0 < qwEstimatedSize)
817 { 813 {
818 qwEstimatedSize /= 1024; // Convert bytes to KB 814 if (DWORD_MAX < qwEstimatedSize)
819 if (0 < qwEstimatedSize)
820 { 815 {
821 if (DWORD_MAX < qwEstimatedSize) 816 // ARP doesn't support QWORDs here
822 { 817 dwSize = DWORD_MAX;
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);
833 } 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);
834 } 826 }
835 827
836 // Register the bundle dependency key. 828 // Register the bundle dependency key.
837 if (BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER == dependencyRegistrationAction) 829 if (dwRegistrationOptions & BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY)
838 { 830 {
839 hr = DependencyRegisterBundle(pRegistration); 831 hr = DependencyRegisterBundle(pRegistration);
840 ExitOnFailure(hr, "Failed to register the bundle dependency key."); 832 ExitOnFailure(hr, "Failed to register the bundle dependency key.");
@@ -897,7 +889,6 @@ extern "C" HRESULT RegistrationSessionEnd(
897 __in BURN_PACKAGES* pPackages, 889 __in BURN_PACKAGES* pPackages,
898 __in BURN_RESUME_MODE resumeMode, 890 __in BURN_RESUME_MODE resumeMode,
899 __in BOOTSTRAPPER_APPLY_RESTART restart, 891 __in BOOTSTRAPPER_APPLY_RESTART restart,
900 __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction,
901 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType 892 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
902 ) 893 )
903{ 894{
@@ -909,11 +900,8 @@ extern "C" HRESULT RegistrationSessionEnd(
909 { 900 {
910 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE == registrationType, "Registration type must be NONE if resume mode is NONE"); 901 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE == registrationType, "Registration type must be NONE if resume mode is NONE");
911 902
912 // If we just registered the bundle dependency but something went wrong and caused us to not 903 // If we own the bundle dependency then remove it.
913 // keep the bundle registration (like rollback) or we are supposed to unregister the bundle 904 if (!pRegistration->fDetectedForeignProviderKeyBundleId)
914 // dependency when unregistering the bundle, do so.
915 if (BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER == dependencyRegistrationAction ||
916 BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER == dependencyRegistrationAction)
917 { 905 {
918 // Remove the bundle dependency key. 906 // Remove the bundle dependency key.
919 DependencyUnregisterBundle(pRegistration, pPackages); 907 DependencyUnregisterBundle(pRegistration, pPackages);