aboutsummaryrefslogtreecommitdiff
path: root/src/engine/msiengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/msiengine.cpp')
-rw-r--r--src/engine/msiengine.cpp60
1 files changed, 52 insertions, 8 deletions
diff --git a/src/engine/msiengine.cpp b/src/engine/msiengine.cpp
index ae105155..f0aa784e 100644
--- a/src/engine/msiengine.cpp
+++ b/src/engine/msiengine.cpp
@@ -42,7 +42,7 @@ static HRESULT ConcatFeatureActionProperties(
42 ); 42 );
43static HRESULT ConcatPatchProperty( 43static HRESULT ConcatPatchProperty(
44 __in BURN_PACKAGE* pPackage, 44 __in BURN_PACKAGE* pPackage,
45 __in_opt BOOTSTRAPPER_ACTION_STATE* rgSlipstreamPatchActions, 45 __in BOOL fRollback,
46 __inout_z LPWSTR* psczArguments 46 __inout_z LPWSTR* psczArguments
47 ); 47 );
48static void RegisterSourceDirectory( 48static void RegisterSourceDirectory(
@@ -1180,10 +1180,10 @@ extern "C" HRESULT MsiEngineExecutePackage(
1180 ExitOnFailure(hr, "Failed to add feature action properties to obfuscated argument string."); 1180 ExitOnFailure(hr, "Failed to add feature action properties to obfuscated argument string.");
1181 1181
1182 // add slipstream patch properties 1182 // add slipstream patch properties
1183 hr = ConcatPatchProperty(pExecuteAction->msiPackage.pPackage, pExecuteAction->msiPackage.rgSlipstreamPatches, &sczProperties); 1183 hr = ConcatPatchProperty(pExecuteAction->msiPackage.pPackage, fRollback, &sczProperties);
1184 ExitOnFailure(hr, "Failed to add patch properties to argument string."); 1184 ExitOnFailure(hr, "Failed to add patch properties to argument string.");
1185 1185
1186 hr = ConcatPatchProperty(pExecuteAction->msiPackage.pPackage, pExecuteAction->msiPackage.rgSlipstreamPatches, &sczObfuscatedProperties); 1186 hr = ConcatPatchProperty(pExecuteAction->msiPackage.pPackage, fRollback, &sczObfuscatedProperties);
1187 ExitOnFailure(hr, "Failed to add patch properties to obfuscated argument string."); 1187 ExitOnFailure(hr, "Failed to add patch properties to obfuscated argument string.");
1188 1188
1189 hr = MsiEngineConcatActionProperty(pExecuteAction->msiPackage.actionMsiProperty, &sczProperties); 1189 hr = MsiEngineConcatActionProperty(pExecuteAction->msiPackage.actionMsiProperty, &sczProperties);
@@ -1432,6 +1432,7 @@ extern "C" HRESULT MsiEngineCalculateInstallUiLevel(
1432 1432
1433extern "C" void MsiEngineUpdateInstallRegistrationState( 1433extern "C" void MsiEngineUpdateInstallRegistrationState(
1434 __in BURN_EXECUTE_ACTION* pAction, 1434 __in BURN_EXECUTE_ACTION* pAction,
1435 __in BOOL fRollback,
1435 __in HRESULT hrExecute, 1436 __in HRESULT hrExecute,
1436 __in BOOL fInsideMsiTransaction 1437 __in BOOL fInsideMsiTransaction
1437 ) 1438 )
@@ -1462,6 +1463,49 @@ extern "C" void MsiEngineUpdateInstallRegistrationState(
1462 pPackage->installRegistrationState = newState; 1463 pPackage->installRegistrationState = newState;
1463 } 1464 }
1464 1465
1466 if (BURN_PACKAGE_REGISTRATION_STATE_ABSENT == newState)
1467 {
1468 for (DWORD i = 0; i < pPackage->Msi.cChainedPatches; ++i)
1469 {
1470 BURN_CHAINED_PATCH* pChainedPatch = pPackage->Msi.rgChainedPatches + i;
1471 BURN_MSPTARGETPRODUCT* pTargetProduct = pChainedPatch->pMspPackage->Msp.rgTargetProducts + pChainedPatch->dwMspTargetProductIndex;
1472
1473 if (fInsideMsiTransaction)
1474 {
1475 pTargetProduct->transactionRegistrationState = newState;
1476 }
1477 else
1478 {
1479 pTargetProduct->registrationState = newState;
1480 }
1481 }
1482 }
1483 else
1484 {
1485 for (DWORD i = 0; i < pPackage->Msi.cSlipstreamMspPackages; ++i)
1486 {
1487 BURN_SLIPSTREAM_MSP* pSlipstreamMsp = pPackage->Msi.rgSlipstreamMsps + i;
1488 BOOTSTRAPPER_ACTION_STATE patchExecuteAction = fRollback ? pSlipstreamMsp->rollback : pSlipstreamMsp->execute;
1489
1490 if (BOOTSTRAPPER_ACTION_STATE_INSTALL > patchExecuteAction)
1491 {
1492 continue;
1493 }
1494
1495 BURN_CHAINED_PATCH* pChainedPatch = pPackage->Msi.rgChainedPatches + pSlipstreamMsp->dwMsiChainedPatchIndex;
1496 BURN_MSPTARGETPRODUCT* pTargetProduct = pChainedPatch->pMspPackage->Msp.rgTargetProducts + pChainedPatch->dwMspTargetProductIndex;
1497
1498 if (fInsideMsiTransaction)
1499 {
1500 pTargetProduct->transactionRegistrationState = newState;
1501 }
1502 else
1503 {
1504 pTargetProduct->registrationState = newState;
1505 }
1506 }
1507 }
1508
1465LExit: 1509LExit:
1466 return; 1510 return;
1467} 1511}
@@ -1911,7 +1955,7 @@ LExit:
1911 1955
1912static HRESULT ConcatPatchProperty( 1956static HRESULT ConcatPatchProperty(
1913 __in BURN_PACKAGE* pPackage, 1957 __in BURN_PACKAGE* pPackage,
1914 __in_opt BOOTSTRAPPER_ACTION_STATE* rgSlipstreamPatchActions, 1958 __in BOOL fRollback,
1915 __inout_z LPWSTR* psczArguments 1959 __inout_z LPWSTR* psczArguments
1916 ) 1960 )
1917{ 1961{
@@ -1921,14 +1965,14 @@ static HRESULT ConcatPatchProperty(
1921 LPWSTR sczPatches = NULL; 1965 LPWSTR sczPatches = NULL;
1922 1966
1923 // If there are slipstream patch actions, build up their patch action. 1967 // If there are slipstream patch actions, build up their patch action.
1924 if (rgSlipstreamPatchActions) 1968 if (pPackage->Msi.cSlipstreamMspPackages)
1925 { 1969 {
1926 for (DWORD i = 0; i < pPackage->Msi.cSlipstreamMspPackages; ++i) 1970 for (DWORD i = 0; i < pPackage->Msi.cSlipstreamMspPackages; ++i)
1927 { 1971 {
1928 BURN_PACKAGE* pMspPackage = pPackage->Msi.rgSlipstreamMsps[i].pMspPackage; 1972 BURN_SLIPSTREAM_MSP* pSlipstreamMsp = pPackage->Msi.rgSlipstreamMsps + i;
1929 AssertSz(BURN_PACKAGE_TYPE_MSP == pMspPackage->type, "Only MSP packages can be slipstream patches."); 1973 BURN_PACKAGE* pMspPackage = pSlipstreamMsp->pMspPackage;
1974 BOOTSTRAPPER_ACTION_STATE patchExecuteAction = fRollback ? pSlipstreamMsp->rollback : pSlipstreamMsp->execute;
1930 1975
1931 BOOTSTRAPPER_ACTION_STATE patchExecuteAction = rgSlipstreamPatchActions[i];
1932 if (BOOTSTRAPPER_ACTION_STATE_UNINSTALL < patchExecuteAction) 1976 if (BOOTSTRAPPER_ACTION_STATE_UNINSTALL < patchExecuteAction)
1933 { 1977 {
1934 hr = CacheGetCompletedPath(pMspPackage->fPerMachine, pMspPackage->sczCacheId, &sczCachedDirectory); 1978 hr = CacheGetCompletedPath(pMspPackage->fPerMachine, pMspPackage->sczCacheId, &sczCachedDirectory);