diff options
Diffstat (limited to 'src/engine/externalengine.cpp')
-rw-r--r-- | src/engine/externalengine.cpp | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/src/engine/externalengine.cpp b/src/engine/externalengine.cpp index 7e9bb25c..d6c44736 100644 --- a/src/engine/externalengine.cpp +++ b/src/engine/externalengine.cpp | |||
@@ -269,8 +269,7 @@ HRESULT ExternalEngineSetUpdate( | |||
269 | ) | 269 | ) |
270 | { | 270 | { |
271 | HRESULT hr = S_OK; | 271 | HRESULT hr = S_OK; |
272 | LPCWSTR sczId = NULL; | 272 | LPWSTR sczFilePath = NULL; |
273 | LPWSTR sczLocalSource = NULL; | ||
274 | LPWSTR sczCommandline = NULL; | 273 | LPWSTR sczCommandline = NULL; |
275 | UUID guid = { }; | 274 | UUID guid = { }; |
276 | WCHAR wzGuid[39]; | 275 | WCHAR wzGuid[39]; |
@@ -296,38 +295,30 @@ HRESULT ExternalEngineSetUpdate( | |||
296 | { | 295 | { |
297 | UpdateUninitialize(&pEngineState->update); | 296 | UpdateUninitialize(&pEngineState->update); |
298 | 297 | ||
299 | if (!wzLocalSource || !*wzLocalSource) | ||
300 | { | ||
301 | hr = StrAllocFormatted(&sczLocalSource, L"update\\%ls", pEngineState->registration.sczExecutableName); | ||
302 | ExitOnFailure(hr, "Failed to default local update source"); | ||
303 | } | ||
304 | |||
305 | hr = CoreRecreateCommandLine(&sczCommandline, BOOTSTRAPPER_ACTION_INSTALL, pEngineState->command.display, pEngineState->command.restart, BOOTSTRAPPER_RELATION_NONE, FALSE, pEngineState->registration.sczActiveParent, pEngineState->registration.sczAncestors, NULL, pEngineState->command.wzCommandLine); | 298 | hr = CoreRecreateCommandLine(&sczCommandline, BOOTSTRAPPER_ACTION_INSTALL, pEngineState->command.display, pEngineState->command.restart, BOOTSTRAPPER_RELATION_NONE, FALSE, pEngineState->registration.sczActiveParent, pEngineState->registration.sczAncestors, NULL, pEngineState->command.wzCommandLine); |
306 | ExitOnFailure(hr, "Failed to recreate command-line for update bundle."); | 299 | ExitOnFailure(hr, "Failed to recreate command-line for update bundle."); |
307 | 300 | ||
308 | // Per-user bundles would fail to use the downloaded update bundle, as the existing install would already be cached | 301 | // Bundles would fail to use the downloaded update bundle, as the running bundle would be one of the search paths. |
309 | // at the registration id's location. Here I am generating a random guid, but in the future it would be nice if the | 302 | // Here I am generating a random guid, but in the future it would be nice if the feed would provide the ID of the update. |
310 | // feed would provide the ID of the update. | 303 | rs = ::UuidCreate(&guid); |
311 | if (!pEngineState->registration.fPerMachine) | 304 | hr = HRESULT_FROM_RPC(rs); |
305 | ExitOnFailure(hr, "Failed to create bundle update guid."); | ||
306 | |||
307 | if (!::StringFromGUID2(guid, wzGuid, countof(wzGuid))) | ||
312 | { | 308 | { |
313 | rs = ::UuidCreate(&guid); | 309 | hr = E_OUTOFMEMORY; |
314 | hr = HRESULT_FROM_RPC(rs); | 310 | ExitOnRootFailure(hr, "Failed to convert bundle update guid into string."); |
315 | ExitOnFailure(hr, "Failed to create bundle update guid."); | 311 | } |
316 | 312 | ||
317 | if (!::StringFromGUID2(guid, wzGuid, countof(wzGuid))) | 313 | hr = StrAllocFormatted(&sczFilePath, L"%ls\\%ls", wzGuid, pEngineState->registration.sczExecutableName); |
318 | { | 314 | ExitOnFailure(hr, "Failed to build bundle update file path."); |
319 | hr = E_OUTOFMEMORY; | ||
320 | ExitOnRootFailure(hr, "Failed to convert bundle update guid into string."); | ||
321 | } | ||
322 | 315 | ||
323 | sczId = wzGuid; | 316 | if (!wzLocalSource || !*wzLocalSource) |
324 | } | ||
325 | else | ||
326 | { | 317 | { |
327 | sczId = pEngineState->registration.sczId; | 318 | wzLocalSource = sczFilePath; |
328 | } | 319 | } |
329 | 320 | ||
330 | hr = PseudoBundleInitialize(FILEMAKEVERSION(rmj, rmm, rup, rpr), &pEngineState->update.package, FALSE, sczId, BOOTSTRAPPER_RELATION_UPDATE, BOOTSTRAPPER_PACKAGE_STATE_ABSENT, FALSE, pEngineState->registration.sczExecutableName, sczLocalSource ? sczLocalSource : wzLocalSource, wzDownloadSource, qwSize, TRUE, sczCommandline, NULL, NULL, NULL, rgbHash, cbHash); | 321 | hr = PseudoBundleInitialize(FILEMAKEVERSION(rmj, rmm, rup, rpr), &pEngineState->update.package, FALSE, pEngineState->registration.sczId, BOOTSTRAPPER_RELATION_UPDATE, BOOTSTRAPPER_PACKAGE_STATE_ABSENT, FALSE, sczFilePath, wzLocalSource, wzDownloadSource, qwSize, TRUE, sczCommandline, NULL, NULL, NULL, rgbHash, cbHash); |
331 | ExitOnFailure(hr, "Failed to set update bundle."); | 322 | ExitOnFailure(hr, "Failed to set update bundle."); |
332 | 323 | ||
333 | pEngineState->update.fUpdateAvailable = TRUE; | 324 | pEngineState->update.fUpdateAvailable = TRUE; |
@@ -337,7 +328,7 @@ LExit: | |||
337 | ::LeaveCriticalSection(&pEngineState->userExperience.csEngineActive); | 328 | ::LeaveCriticalSection(&pEngineState->userExperience.csEngineActive); |
338 | 329 | ||
339 | ReleaseStr(sczCommandline); | 330 | ReleaseStr(sczCommandline); |
340 | ReleaseStr(sczLocalSource); | 331 | ReleaseStr(sczFilePath); |
341 | 332 | ||
342 | return hr; | 333 | return hr; |
343 | } | 334 | } |