diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/burn/engine/apply.cpp | 4 | ||||
| -rw-r--r-- | src/burn/engine/core.cpp | 5 | ||||
| -rw-r--r-- | src/burn/engine/engine.mc | 2 | ||||
| -rw-r--r-- | src/burn/engine/registration.cpp | 38 | ||||
| -rw-r--r-- | src/burn/engine/registration.h | 3 | ||||
| -rw-r--r-- | src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs | 11 |
6 files changed, 45 insertions, 18 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index b7a54246..818427ac 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -536,8 +536,6 @@ extern "C" HRESULT ApplyUnregister( | |||
| 536 | IgnoreRollbackError(hrRegistrationRollback, "Dependent registration actions failed"); | 536 | IgnoreRollbackError(hrRegistrationRollback, "Dependent registration actions failed"); |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | LogId(REPORT_STANDARD, MSG_SESSION_END, pEngineState->registration.sczRegistrationKey, LoggingInstallScopeToString(pEngineState->registration.fPerMachine), LoggingResumeModeToString(resumeMode), LoggingRestartToString(restart), LoggingBoolToString(pEngineState->registration.fDisableResume), LoggingRegistrationTypeToString(defaultRegistrationType), LoggingRegistrationTypeToString(registrationType)); | ||
| 540 | |||
| 541 | if (BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action) | 539 | if (BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action) |
| 542 | { | 540 | { |
| 543 | registrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; | 541 | registrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; |
| @@ -546,6 +544,8 @@ extern "C" HRESULT ApplyUnregister( | |||
| 546 | LogId(REPORT_STANDARD, MSG_UNSAFE_SESSION_END); | 544 | LogId(REPORT_STANDARD, MSG_UNSAFE_SESSION_END); |
| 547 | } | 545 | } |
| 548 | 546 | ||
| 547 | LogId(REPORT_STANDARD, MSG_SESSION_END, pEngineState->registration.sczRegistrationKey, LoggingInstallScopeToString(pEngineState->registration.fPerMachine), LoggingResumeModeToString(resumeMode), LoggingRestartToString(restart), LoggingBoolToString(pEngineState->registration.fDisableResume), LoggingRegistrationTypeToString(defaultRegistrationType), LoggingRegistrationTypeToString(registrationType)); | ||
| 548 | |||
| 549 | if (pEngineState->registration.fPerMachine) | 549 | if (pEngineState->registration.fPerMachine) |
| 550 | { | 550 | { |
| 551 | hr = ElevationSessionEnd(pEngineState->companionConnection.hPipe, resumeMode, restart, pEngineState->registration.fDetectedForeignProviderKeyBundleCode, qwEstimatedSize, registrationType); | 551 | hr = ElevationSessionEnd(pEngineState->companionConnection.hPipe, resumeMode, restart, pEngineState->registration.fDetectedForeignProviderKeyBundleCode, qwEstimatedSize, registrationType); |
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index da4ea91b..926c327b 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
| @@ -256,6 +256,10 @@ extern "C" HRESULT CoreQueryRegistration( | |||
| 256 | SIZE_T cbBuffer = 0; | 256 | SIZE_T cbBuffer = 0; |
| 257 | SIZE_T iBuffer = 0; | 257 | SIZE_T iBuffer = 0; |
| 258 | 258 | ||
| 259 | // Detect if bundle is already installed. | ||
| 260 | hr = RegistrationDetectInstalled(&pEngineState->registration, &pEngineState->cache); | ||
| 261 | ExitOnFailure(hr, "Failed to detect bundle install state."); | ||
| 262 | |||
| 259 | // detect resume type | 263 | // detect resume type |
| 260 | hr = RegistrationDetectResumeType(&pEngineState->registration, &pEngineState->command.resumeType); | 264 | hr = RegistrationDetectResumeType(&pEngineState->registration, &pEngineState->command.resumeType); |
| 261 | ExitOnFailure(hr, "Failed to detect resume type."); | 265 | ExitOnFailure(hr, "Failed to detect resume type."); |
| @@ -2280,6 +2284,7 @@ static HRESULT DetectPackagePayloadsCached( | |||
| 2280 | LExit: | 2284 | LExit: |
| 2281 | ReleaseStr(sczPayloadCachePath); | 2285 | ReleaseStr(sczPayloadCachePath); |
| 2282 | ReleaseStr(sczCachePath); | 2286 | ReleaseStr(sczCachePath); |
| 2287 | |||
| 2283 | return hr; | 2288 | return hr; |
| 2284 | } | 2289 | } |
| 2285 | 2290 | ||
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index edafef97..72e62fe4 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc | |||
| @@ -1055,7 +1055,7 @@ MessageId=371 | |||
| 1055 | Severity=Success | 1055 | Severity=Success |
| 1056 | SymbolicName=MSG_SESSION_UPDATE | 1056 | SymbolicName=MSG_SESSION_UPDATE |
| 1057 | Language=English | 1057 | Language=English |
| 1058 | Updating session, registration key: %1!ls!, scope: %2!hs!, resume: %3!hs!, restart initiated: %4!hs!, disable resume: %5!hs! | 1058 | Updating session, registration key: %1!ls!, scope: %2!hs!, resume: %3!hs!, restart initiated: %4!hs!, disable resume: %5!hs!, registration: %6!hs! |
| 1059 | . | 1059 | . |
| 1060 | 1060 | ||
| 1061 | MessageId=372 | 1061 | MessageId=372 |
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index e7a9b95f..855ebf04 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
| @@ -64,7 +64,7 @@ static HRESULT EnsureRegistrationVariable( | |||
| 64 | ); | 64 | ); |
| 65 | static HRESULT UpdateResumeMode( | 65 | static HRESULT UpdateResumeMode( |
| 66 | __in BURN_REGISTRATION* pRegistration, | 66 | __in BURN_REGISTRATION* pRegistration, |
| 67 | __in HKEY hkRegistration, | 67 | __in_opt HKEY hkRegistration, |
| 68 | __in BURN_RESUME_MODE resumeMode, | 68 | __in BURN_RESUME_MODE resumeMode, |
| 69 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, | 69 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, |
| 70 | __in BOOL fRestartInitiated | 70 | __in BOOL fRestartInitiated |
| @@ -461,13 +461,7 @@ extern "C" HRESULT RegistrationSetDynamicVariables( | |||
| 461 | ) | 461 | ) |
| 462 | { | 462 | { |
| 463 | HRESULT hr = S_OK; | 463 | HRESULT hr = S_OK; |
| 464 | LONGLONG llInstalled = 0; | 464 | LONGLONG llInstalled = BOOTSTRAPPER_REGISTRATION_TYPE_FULL == pRegistration->detectedRegistrationType ? 1 : 0; |
| 465 | |||
| 466 | // Detect if bundle is already installed. | ||
| 467 | hr = RegistrationDetectInstalled(pRegistration); | ||
| 468 | ExitOnFailure(hr, "Failed to detect bundle install state."); | ||
| 469 | |||
| 470 | llInstalled = BOOTSTRAPPER_REGISTRATION_TYPE_FULL == pRegistration->detectedRegistrationType ? 1 : 0; | ||
| 471 | 465 | ||
| 472 | hr = VariableSetNumeric(pVariables, BURN_BUNDLE_INSTALLED, llInstalled, TRUE); | 466 | hr = VariableSetNumeric(pVariables, BURN_BUNDLE_INSTALLED, llInstalled, TRUE); |
| 473 | ExitOnFailure(hr, "Failed to set the bundle installed built-in variable."); | 467 | ExitOnFailure(hr, "Failed to set the bundle installed built-in variable."); |
| @@ -483,7 +477,8 @@ LExit: | |||
| 483 | } | 477 | } |
| 484 | 478 | ||
| 485 | extern "C" HRESULT RegistrationDetectInstalled( | 479 | extern "C" HRESULT RegistrationDetectInstalled( |
| 486 | __in BURN_REGISTRATION* pRegistration | 480 | __in BURN_REGISTRATION* pRegistration, |
| 481 | __in BURN_CACHE* pCache | ||
| 487 | ) | 482 | ) |
| 488 | { | 483 | { |
| 489 | HRESULT hr = S_OK; | 484 | HRESULT hr = S_OK; |
| @@ -496,14 +491,28 @@ extern "C" HRESULT RegistrationDetectInstalled( | |||
| 496 | { | 491 | { |
| 497 | // For PUOM/PMOU bundles, check per-machine then fall back to per-user. | 492 | // For PUOM/PMOU bundles, check per-machine then fall back to per-user. |
| 498 | hr = DetectInstalled(pRegistration, HKEY_LOCAL_MACHINE); | 493 | hr = DetectInstalled(pRegistration, HKEY_LOCAL_MACHINE); |
| 494 | if (SUCCEEDED(hr)) | ||
| 495 | { | ||
| 496 | pRegistration->fPerMachine = TRUE; | ||
| 499 | 497 | ||
| 500 | if (FAILED(hr)) | 498 | hr = RegistrationSetPaths(pRegistration, pCache); |
| 499 | ExitOnFailure(hr, "Failed to set registration paths for per-machine configurable scope."); | ||
| 500 | } | ||
| 501 | else | ||
| 501 | { | 502 | { |
| 502 | hr = DetectInstalled(pRegistration, HKEY_CURRENT_USER); | 503 | hr = DetectInstalled(pRegistration, HKEY_CURRENT_USER); |
| 504 | |||
| 505 | if (SUCCEEDED(hr)) | ||
| 506 | { | ||
| 507 | pRegistration->fPerMachine = FALSE; | ||
| 508 | |||
| 509 | hr = RegistrationSetPaths(pRegistration, pCache); | ||
| 510 | ExitOnFailure(hr, "Failed to set registration paths for per-user configurable scope."); | ||
| 511 | } | ||
| 503 | } | 512 | } |
| 504 | } | 513 | } |
| 505 | 514 | ||
| 506 | //LExit: | 515 | LExit: |
| 507 | // Not finding the key or value is okay. | 516 | // Not finding the key or value is okay. |
| 508 | if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr) | 517 | if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr) |
| 509 | { | 518 | { |
| @@ -1086,6 +1095,8 @@ extern "C" HRESULT RegistrationSetPaths( | |||
| 1086 | hr = PathConcatRelativeToFullyQualifiedBase(sczCacheDirectory, pRegistration->sczExecutableName, &pRegistration->sczCacheExecutablePath); | 1095 | hr = PathConcatRelativeToFullyQualifiedBase(sczCacheDirectory, pRegistration->sczExecutableName, &pRegistration->sczCacheExecutablePath); |
| 1087 | ExitOnFailure(hr, "Failed to build cached executable path."); | 1096 | ExitOnFailure(hr, "Failed to build cached executable path."); |
| 1088 | 1097 | ||
| 1098 | pRegistration->fCached = pRegistration->sczCacheExecutablePath && FileExistsEx(pRegistration->sczCacheExecutablePath, NULL); | ||
| 1099 | |||
| 1089 | // build state file path | 1100 | // build state file path |
| 1090 | hr = StrAllocFormatted(&pRegistration->sczStateFile, L"%ls\\state.rsm", sczCacheDirectory); | 1101 | hr = StrAllocFormatted(&pRegistration->sczStateFile, L"%ls\\state.rsm", sczCacheDirectory); |
| 1091 | ExitOnFailure(hr, "Failed to build state file path."); | 1102 | ExitOnFailure(hr, "Failed to build state file path."); |
| @@ -1242,7 +1253,7 @@ LExit: | |||
| 1242 | 1253 | ||
| 1243 | static HRESULT UpdateResumeMode( | 1254 | static HRESULT UpdateResumeMode( |
| 1244 | __in BURN_REGISTRATION* pRegistration, | 1255 | __in BURN_REGISTRATION* pRegistration, |
| 1245 | __in HKEY hkRegistration, | 1256 | __in_opt HKEY hkRegistration, |
| 1246 | __in BURN_RESUME_MODE resumeMode, | 1257 | __in BURN_RESUME_MODE resumeMode, |
| 1247 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, | 1258 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, |
| 1248 | __in BOOL fRestartInitiated | 1259 | __in BOOL fRestartInitiated |
| @@ -1254,7 +1265,7 @@ static HRESULT UpdateResumeMode( | |||
| 1254 | LPWSTR sczRunOnceCommandLine = NULL; | 1265 | LPWSTR sczRunOnceCommandLine = NULL; |
| 1255 | LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY; | 1266 | LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY; |
| 1256 | 1267 | ||
| 1257 | LogId(REPORT_STANDARD, MSG_SESSION_UPDATE, pRegistration->sczRegistrationKey, LoggingInstallScopeToString(pRegistration->fPerMachine), LoggingResumeModeToString(resumeMode), LoggingBoolToString(fRestartInitiated), LoggingBoolToString(pRegistration->fDisableResume)); | 1268 | LogId(REPORT_STANDARD, MSG_SESSION_UPDATE, pRegistration->sczRegistrationKey, LoggingInstallScopeToString(pRegistration->fPerMachine), LoggingResumeModeToString(resumeMode), LoggingBoolToString(fRestartInitiated), LoggingBoolToString(pRegistration->fDisableResume), LoggingRegistrationTypeToString(registrationType)); |
| 1258 | 1269 | ||
| 1259 | // write resume information | 1270 | // write resume information |
| 1260 | if (hkRegistration) | 1271 | if (hkRegistration) |
| @@ -1776,7 +1787,6 @@ static HRESULT DetectInstalled( | |||
| 1776 | DWORD dwInstalled = 0; | 1787 | DWORD dwInstalled = 0; |
| 1777 | DWORD dwScope = 0; | 1788 | DWORD dwScope = 0; |
| 1778 | 1789 | ||
| 1779 | pRegistration->fCached = pRegistration->sczCacheExecutablePath && FileExistsEx(pRegistration->sczCacheExecutablePath, NULL); | ||
| 1780 | pRegistration->detectedRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; | 1790 | pRegistration->detectedRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; |
| 1781 | pRegistration->detectedScope = BOOTSTRAPPER_SCOPE_DEFAULT; | 1791 | pRegistration->detectedScope = BOOTSTRAPPER_SCOPE_DEFAULT; |
| 1782 | 1792 | ||
diff --git a/src/burn/engine/registration.h b/src/burn/engine/registration.h index 97c6951b..050a1a4b 100644 --- a/src/burn/engine/registration.h +++ b/src/burn/engine/registration.h | |||
| @@ -186,7 +186,8 @@ HRESULT RegistrationSetDynamicVariables( | |||
| 186 | __in BURN_VARIABLES* pVariables | 186 | __in BURN_VARIABLES* pVariables |
| 187 | ); | 187 | ); |
| 188 | HRESULT RegistrationDetectInstalled( | 188 | HRESULT RegistrationDetectInstalled( |
| 189 | __in BURN_REGISTRATION* pRegistration | 189 | __in BURN_REGISTRATION* pRegistration, |
| 190 | __in BURN_CACHE* pCache | ||
| 190 | ); | 191 | ); |
| 191 | HRESULT RegistrationDetectResumeType( | 192 | HRESULT RegistrationDetectResumeType( |
| 192 | __in BURN_REGISTRATION* pRegistration, | 193 | __in BURN_REGISTRATION* pRegistration, |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs index 049cefc3..9e8870fc 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs | |||
| @@ -108,7 +108,12 @@ namespace WixToolsetTest.BurnE2E | |||
| 108 | 108 | ||
| 109 | Assert.True(LogVerifier.MessageInLogFile(log, "Plan begin, 3 packages, action: Install, planned scope: Default")); | 109 | Assert.True(LogVerifier.MessageInLogFile(log, "Plan begin, 3 packages, action: Install, planned scope: Default")); |
| 110 | 110 | ||
| 111 | log = bundle.Modify(); | ||
| 112 | Assert.True(LogVerifier.MessageInLogFile(log, "TESTBA: OnDetectBegin: Cached=True")); | ||
| 113 | Assert.False(LogVerifier.MessageInLogFile(log, "Could not load or read state file:")); | ||
| 114 | |||
| 111 | log = bundle.Repair(); | 115 | log = bundle.Repair(); |
| 116 | Assert.False(LogVerifier.MessageInLogFile(log, "Could not load or read state file:")); | ||
| 112 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerUser. Scope cannot change during maintenance.")); | 117 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerUser. Scope cannot change during maintenance.")); |
| 113 | 118 | ||
| 114 | var bundleV2 = this.CreateBundleInstaller("AllPuomBundleTestBAv2"); | 119 | var bundleV2 = this.CreateBundleInstaller("AllPuomBundleTestBAv2"); |
| @@ -132,6 +137,8 @@ namespace WixToolsetTest.BurnE2E | |||
| 132 | Assert.True(LogVerifier.MessageInLogFile(log, "Plan begin, 3 packages, action: Install, planned scope: Default")); | 137 | Assert.True(LogVerifier.MessageInLogFile(log, "Plan begin, 3 packages, action: Install, planned scope: Default")); |
| 133 | 138 | ||
| 134 | log = bundle.Repair(); | 139 | log = bundle.Repair(); |
| 140 | Assert.True(LogVerifier.MessageInLogFile(log, "TESTBA: OnDetectBegin: Cached=True")); | ||
| 141 | Assert.False(LogVerifier.MessageInLogFile(log, "Could not load or read state file:")); | ||
| 135 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerUser. Scope cannot change during maintenance.")); | 142 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerUser. Scope cannot change during maintenance.")); |
| 136 | 143 | ||
| 137 | var bundleV2 = this.CreateBundleInstaller("AllPuomBundleTestBAv2"); | 144 | var bundleV2 = this.CreateBundleInstaller("AllPuomBundleTestBAv2"); |
| @@ -164,6 +171,8 @@ namespace WixToolsetTest.BurnE2E | |||
| 164 | Assert.True(LogVerifier.MessageInLogFile(log, "Planned package: PmouPkg2.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, scope: PerMachine,")); | 171 | Assert.True(LogVerifier.MessageInLogFile(log, "Planned package: PmouPkg2.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, scope: PerMachine,")); |
| 165 | 172 | ||
| 166 | log = bundle.Repair(); | 173 | log = bundle.Repair(); |
| 174 | Assert.True(LogVerifier.MessageInLogFile(log, "TESTBA: OnDetectBegin: Cached=True")); | ||
| 175 | Assert.False(LogVerifier.MessageInLogFile(log, "Could not load or read state file:")); | ||
| 167 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerMachine")); | 176 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerMachine")); |
| 168 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg1.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); | 177 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg1.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); |
| 169 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg2.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); | 178 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg2.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); |
| @@ -508,6 +517,8 @@ namespace WixToolsetTest.BurnE2E | |||
| 508 | Assert.True(LogVerifier.MessageInLogFile(log, "Planned package: PerUserPkg.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, scope: PerUser")); | 517 | Assert.True(LogVerifier.MessageInLogFile(log, "Planned package: PerUserPkg.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, scope: PerUser")); |
| 509 | 518 | ||
| 510 | log = bundle.Repair(); | 519 | log = bundle.Repair(); |
| 520 | Assert.True(LogVerifier.MessageInLogFile(log, "TESTBA: OnDetectBegin: Cached=True")); | ||
| 521 | Assert.False(LogVerifier.MessageInLogFile(log, "Could not load or read state file:")); | ||
| 511 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PerMachinePkg.msi, state: Present, authored scope: PerMachine, detected scope: PerMachine,")); | 522 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PerMachinePkg.msi, state: Present, authored scope: PerMachine, detected scope: PerMachine,")); |
| 512 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg1.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); | 523 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg1.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); |
| 513 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg2.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); | 524 | Assert.True(LogVerifier.MessageInLogFile(log, "Detected package: PmouPkg2.msi, state: Present, authored scope: PerMachineOrUser, detected scope: PerMachine,")); |
