diff options
-rw-r--r-- | src/burn/engine/core.cpp | 12 | ||||
-rw-r--r-- | src/burn/engine/elevation.cpp | 7 | ||||
-rw-r--r-- | src/burn/engine/registration.cpp | 8 | ||||
-rw-r--r-- | src/burn/engine/variable.cpp | 2 |
4 files changed, 14 insertions, 15 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index ca4d607b..43f79133 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -264,10 +264,6 @@ extern "C" HRESULT CoreQueryRegistration( | |||
264 | SIZE_T cbBuffer = 0; | 264 | SIZE_T cbBuffer = 0; |
265 | SIZE_T iBuffer = 0; | 265 | SIZE_T iBuffer = 0; |
266 | 266 | ||
267 | // Detect if bundle is already installed. | ||
268 | hr = RegistrationDetectInstalled(&pEngineState->registration); | ||
269 | ExitOnFailure(hr, "Failed to detect bundle install state."); | ||
270 | |||
271 | // detect resume type | 267 | // detect resume type |
272 | hr = RegistrationDetectResumeType(&pEngineState->registration, &pEngineState->command.resumeType); | 268 | hr = RegistrationDetectResumeType(&pEngineState->registration, &pEngineState->command.resumeType); |
273 | ExitOnFailure(hr, "Failed to detect resume type."); | 269 | ExitOnFailure(hr, "Failed to detect resume type."); |
@@ -315,14 +311,6 @@ extern "C" HRESULT CoreDetect( | |||
315 | DetectReset(&pEngineState->registration, &pEngineState->packages); | 311 | DetectReset(&pEngineState->registration, &pEngineState->packages); |
316 | PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); | 312 | PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); |
317 | 313 | ||
318 | // Detect if bundle installed state has changed since start up. | ||
319 | // This only happens if Apply() changed the state of bundle (installed, in progress, or uninstalled). | ||
320 | // In that case, Detect() can be used here to reset the installed state. | ||
321 | // Of course, there's also cases outside of this bundle's control, | ||
322 | // like other processes messing with its registration. | ||
323 | hr = RegistrationDetectInstalled(&pEngineState->registration); | ||
324 | ExitOnFailure(hr, "Failed to detect bundle install state."); | ||
325 | |||
326 | hr = RegistrationSetDynamicVariables(&pEngineState->registration, &pEngineState->variables); | 314 | hr = RegistrationSetDynamicVariables(&pEngineState->registration, &pEngineState->variables); |
327 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); | 315 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); |
328 | 316 | ||
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp index d12a151a..e479b6c0 100644 --- a/src/burn/engine/elevation.cpp +++ b/src/burn/engine/elevation.cpp | |||
@@ -178,6 +178,7 @@ static HRESULT OnApplyInitialize( | |||
178 | ); | 178 | ); |
179 | static HRESULT ElevatedProcessDetect( | 179 | static HRESULT ElevatedProcessDetect( |
180 | __in BURN_REGISTRATION* pRegistration, | 180 | __in BURN_REGISTRATION* pRegistration, |
181 | __in BURN_VARIABLES* pVariables, | ||
181 | __in BURN_PACKAGES* pPackages | 182 | __in BURN_PACKAGES* pPackages |
182 | ); | 183 | ); |
183 | static HRESULT OnApplyUninitialize( | 184 | static HRESULT OnApplyUninitialize( |
@@ -2245,7 +2246,7 @@ static HRESULT OnApplyInitialize( | |||
2245 | ExitOnFailure(hr, "Failed to acquire lock due to setup in other session."); | 2246 | ExitOnFailure(hr, "Failed to acquire lock due to setup in other session."); |
2246 | 2247 | ||
2247 | // Detect. | 2248 | // Detect. |
2248 | hr = ElevatedProcessDetect(pRegistration, pPackages); | 2249 | hr = ElevatedProcessDetect(pRegistration, pVariables, pPackages); |
2249 | ExitOnFailure(hr, "Failed to run detection in elevated process."); | 2250 | ExitOnFailure(hr, "Failed to run detection in elevated process."); |
2250 | 2251 | ||
2251 | // Attempt to pause AU with best effort. | 2252 | // Attempt to pause AU with best effort. |
@@ -2331,6 +2332,7 @@ LExit: | |||
2331 | 2332 | ||
2332 | static HRESULT ElevatedProcessDetect( | 2333 | static HRESULT ElevatedProcessDetect( |
2333 | __in BURN_REGISTRATION* pRegistration, | 2334 | __in BURN_REGISTRATION* pRegistration, |
2335 | __in BURN_VARIABLES* pVariables, | ||
2334 | __in BURN_PACKAGES* pPackages | 2336 | __in BURN_PACKAGES* pPackages |
2335 | ) | 2337 | ) |
2336 | { | 2338 | { |
@@ -2338,6 +2340,9 @@ static HRESULT ElevatedProcessDetect( | |||
2338 | 2340 | ||
2339 | DetectReset(pRegistration, pPackages); | 2341 | DetectReset(pRegistration, pPackages); |
2340 | 2342 | ||
2343 | hr = RegistrationSetDynamicVariables(pRegistration, pVariables); | ||
2344 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during elevated detect."); | ||
2345 | |||
2341 | hr = RelatedBundlesInitializeForScope(TRUE, pRegistration, &pRegistration->relatedBundles); | 2346 | hr = RelatedBundlesInitializeForScope(TRUE, pRegistration, &pRegistration->relatedBundles); |
2342 | ExitOnFailure(hr, "Failed to initialize per-machine related bundles."); | 2347 | ExitOnFailure(hr, "Failed to initialize per-machine related bundles."); |
2343 | 2348 | ||
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index fcefe5e0..545c390b 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
@@ -484,7 +484,13 @@ extern "C" HRESULT RegistrationSetDynamicVariables( | |||
484 | ) | 484 | ) |
485 | { | 485 | { |
486 | HRESULT hr = S_OK; | 486 | HRESULT hr = S_OK; |
487 | LONGLONG llInstalled = BOOTSTRAPPER_REGISTRATION_TYPE_FULL == pRegistration->detectedRegistrationType ? 1 : 0; | 487 | LONGLONG llInstalled = 0; |
488 | |||
489 | // Detect if bundle is already installed. | ||
490 | hr = RegistrationDetectInstalled(pRegistration); | ||
491 | ExitOnFailure(hr, "Failed to detect bundle install state."); | ||
492 | |||
493 | llInstalled = BOOTSTRAPPER_REGISTRATION_TYPE_FULL == pRegistration->detectedRegistrationType ? 1 : 0; | ||
488 | 494 | ||
489 | hr = VariableSetNumeric(pVariables, BURN_BUNDLE_INSTALLED, llInstalled, TRUE); | 495 | hr = VariableSetNumeric(pVariables, BURN_BUNDLE_INSTALLED, llInstalled, TRUE); |
490 | ExitOnFailure(hr, "Failed to set the bundle installed built-in variable."); | 496 | ExitOnFailure(hr, "Failed to set the bundle installed built-in variable."); |
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index 5d92590c..ae06c1d5 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
@@ -271,7 +271,7 @@ extern "C" HRESULT VariableInitialize( | |||
271 | {BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, InitializeVariableString, NULL, FALSE, TRUE}, | 271 | {BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, InitializeVariableString, NULL, FALSE, TRUE}, |
272 | {BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, InitializeVariableString, NULL, FALSE, TRUE}, | 272 | {BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, InitializeVariableString, NULL, FALSE, TRUE}, |
273 | {BURN_BUNDLE_FORCED_RESTART_PACKAGE, InitializeVariableString, NULL, TRUE, TRUE}, | 273 | {BURN_BUNDLE_FORCED_RESTART_PACKAGE, InitializeVariableString, NULL, TRUE, TRUE}, |
274 | {BURN_BUNDLE_INSTALLED, InitializeVariableNumeric, 0, FALSE, TRUE}, | 274 | {BURN_BUNDLE_INSTALLED, InitializeVariableNumeric, 0}, |
275 | {BURN_BUNDLE_ELEVATED, InitializeVariableNumeric, 0, FALSE, TRUE}, | 275 | {BURN_BUNDLE_ELEVATED, InitializeVariableNumeric, 0, FALSE, TRUE}, |
276 | {BURN_BUNDLE_ACTIVE_PARENT, InitializeVariableString, NULL, FALSE, TRUE}, | 276 | {BURN_BUNDLE_ACTIVE_PARENT, InitializeVariableString, NULL, FALSE, TRUE}, |
277 | {BURN_BUNDLE_PROVIDER_KEY, InitializeVariableString, (DWORD_PTR)L"", FALSE, TRUE}, | 277 | {BURN_BUNDLE_PROVIDER_KEY, InitializeVariableString, (DWORD_PTR)L"", FALSE, TRUE}, |