@@ -25,6 +25,7 @@ static HRESULT ExecuteBundle(
2525 __in BOOTSTRAPPER_RELATION_TYPE relationType,
2626 __in BURN_PACKAGE* pPackage,
2727 __in BOOL fPseudoPackage ,
28+ __in BOOL fPerMachine ,
2829 __in_z_opt LPCWSTR wzParent,
2930 __in_z_opt LPCWSTR wzIgnoreDependencies,
3031 __in_z_opt LPCWSTR wzAncestors,
@@ -51,7 +52,7 @@ extern "C" HRESULT BundlePackageEngineParsePackageFromXml(
5152 BOOL fFoundXml = FALSE ;
5253 LPWSTR scz = NULL ;
5354
54- // @DetectCondition
55+ // @BundleCode
5556 hr = XmlGetAttributeEx (pixnBundlePackage, L" BundleCode" , &pPackage->Bundle .sczBundleCode );
5657 ExitOnRequiredXmlQueryFailure (hr, " Failed to get @BundleCode." );
5758
@@ -91,6 +92,10 @@ extern "C" HRESULT BundlePackageEngineParsePackageFromXml(
9192 hr = XmlGetYesNoAttribute (pixnBundlePackage, L" Win64" , &pPackage->Bundle .fWin64 );
9293 ExitOnRequiredXmlQueryFailure (hr, " Failed to get @Win64." );
9394
95+ // @Scope
96+ hr = PackageParseScopeFromXml (pixnBundlePackage, &pPackage->scope );
97+ ExitOnRequiredXmlQueryFailure (hr, " Failed to get @Scope." );
98+
9499 hr = BundlePackageEngineParseRelatedCodes (pixnBundlePackage, &pPackage->Bundle .rgsczDetectCodes , &pPackage->Bundle .cDetectCodes , &pPackage->Bundle .rgsczUpgradeCodes , &pPackage->Bundle .cUpgradeCodes , &pPackage->Bundle .rgsczAddonCodes , &pPackage->Bundle .cAddonCodes , &pPackage->Bundle .rgsczPatchCodes , &pPackage->Bundle .cPatchCodes );
95100 ExitOnFailure (hr, " Failed to parse related codes." );
96101
@@ -608,6 +613,7 @@ extern "C" HRESULT BundlePackageEngineExecutePackage(
608613 __in BURN_VARIABLES* pVariables,
609614 __in BOOL fRollback ,
610615 __in BOOL fCacheAvailable ,
616+ __in BOOL fPerMachine ,
611617 __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler,
612618 __in LPVOID pvContext,
613619 __out BOOTSTRAPPER_APPLY_RESTART* pRestart
@@ -621,14 +627,15 @@ extern "C" HRESULT BundlePackageEngineExecutePackage(
621627 BOOTSTRAPPER_RELATION_TYPE relationType = BOOTSTRAPPER_RELATION_CHAIN_PACKAGE;
622628 BURN_PACKAGE* pPackage = pExecuteAction->bundlePackage .pPackage ;
623629
624- return ExecuteBundle (pCache, pVariables, fRollback , fCacheAvailable , pfnGenericMessageHandler, pvContext, action, relationType, pPackage, FALSE , wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart);
630+ return ExecuteBundle (pCache, pVariables, fRollback , fCacheAvailable , pfnGenericMessageHandler, pvContext, action, relationType, pPackage, FALSE , fPerMachine , wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart);
625631}
626632
627633extern " C" HRESULT BundlePackageEngineExecuteRelatedBundle (
628634 __in BURN_EXECUTE_ACTION* pExecuteAction,
629635 __in BURN_CACHE* pCache,
630636 __in BURN_VARIABLES* pVariables,
631637 __in BOOL fRollback ,
638+ __in BOOL fPerMachine ,
632639 __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler,
633640 __in LPVOID pvContext,
634641 __out BOOTSTRAPPER_APPLY_RESTART* pRestart
@@ -643,7 +650,7 @@ extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle(
643650 BOOTSTRAPPER_RELATION_TYPE relationType = ConvertRelationType (pRelatedBundle->planRelationType );
644651 BURN_PACKAGE* pPackage = &pRelatedBundle->package ;
645652
646- return ExecuteBundle (pCache, pVariables, fRollback , TRUE , pfnGenericMessageHandler, pvContext, action, relationType, pPackage, TRUE , wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart);
653+ return ExecuteBundle (pCache, pVariables, fRollback , TRUE , pfnGenericMessageHandler, pvContext, action, relationType, pPackage, TRUE , fPerMachine , wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart);
647654}
648655
649656extern " C" void BundlePackageEngineUpdateInstallRegistrationState (
@@ -742,6 +749,7 @@ static HRESULT ExecuteBundle(
742749 __in BOOTSTRAPPER_RELATION_TYPE relationType,
743750 __in BURN_PACKAGE* pPackage,
744751 __in BOOL fPseudoPackage ,
752+ __in BOOL fPerMachine ,
745753 __in_z_opt LPCWSTR wzParent,
746754 __in_z_opt LPCWSTR wzIgnoreDependencies,
747755 __in_z_opt LPCWSTR wzAncestors,
@@ -987,6 +995,16 @@ static HRESULT ExecuteBundle(
987995 hr = CoreAppendFileHandleSelfToCommandLine (sczExecutablePath, &hExecutableFile, &sczBaseCommand, NULL );
988996 ExitOnFailure (hr, " Failed to append %ls" , BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF);
989997
998+ // Configurable-scope bundle packages get the scope of the parent bundle.
999+ // Note that the command-line switch takes effect only if the BA does a
1000+ // default plan.
1001+ if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == pPackage->scope
1002+ || BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == pPackage->scope )
1003+ {
1004+ hr = StrAllocConcat (&sczBaseCommand, fPerMachine ? L" -permachine" : L" -peruser" , 0 );
1005+ ExitOnFailure (hr, " Failed to append scope switch to the command line." );
1006+ }
1007+
9901008 // build user args
9911009 if (sczUnformattedUserArgs && *sczUnformattedUserArgs)
9921010 {
0 commit comments