diff options
| author | Rob Mensching <rob@firegiant.com> | 2024-01-11 18:26:20 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
| commit | 0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch) | |
| tree | 9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/burn/engine | |
| parent | 2824298d9dd817a47527c920363556b54ead5d5d (diff) | |
| download | wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2 wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip | |
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/burn/engine')
38 files changed, 12111 insertions, 4288 deletions
diff --git a/src/burn/engine/EngineForApplication.cpp b/src/burn/engine/EngineForApplication.cpp deleted file mode 100644 index eb77cc50..00000000 --- a/src/burn/engine/EngineForApplication.cpp +++ /dev/null | |||
| @@ -1,548 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | |||
| 6 | static HRESULT BAEngineGetPackageCount( | ||
| 7 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 8 | __in const LPVOID pvArgs, | ||
| 9 | __inout LPVOID pvResults | ||
| 10 | ) | ||
| 11 | { | ||
| 12 | HRESULT hr = S_OK; | ||
| 13 | ValidateMessageArgs(hr, pvArgs, BAENGINE_GETPACKAGECOUNT_ARGS, pArgs); | ||
| 14 | ValidateMessageResults(hr, pvResults, BAENGINE_GETPACKAGECOUNT_RESULTS, pResults); | ||
| 15 | |||
| 16 | ExternalEngineGetPackageCount(pContext->pEngineState, &pResults->cPackages); | ||
| 17 | |||
| 18 | LExit: | ||
| 19 | return hr; | ||
| 20 | } | ||
| 21 | |||
| 22 | static HRESULT BAEngineGetVariableNumeric( | ||
| 23 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 24 | __in const LPVOID pvArgs, | ||
| 25 | __inout LPVOID pvResults | ||
| 26 | ) | ||
| 27 | { | ||
| 28 | HRESULT hr = S_OK; | ||
| 29 | ValidateMessageArgs(hr, pvArgs, BAENGINE_GETVARIABLENUMERIC_ARGS, pArgs); | ||
| 30 | ValidateMessageResults(hr, pvResults, BAENGINE_GETVARIABLENUMERIC_RESULTS, pResults); | ||
| 31 | |||
| 32 | hr = ExternalEngineGetVariableNumeric(pContext->pEngineState, pArgs->wzVariable, &pResults->llValue); | ||
| 33 | |||
| 34 | LExit: | ||
| 35 | return hr; | ||
| 36 | } | ||
| 37 | |||
| 38 | static HRESULT BAEngineGetVariableString( | ||
| 39 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 40 | __in const LPVOID pvArgs, | ||
| 41 | __inout LPVOID pvResults | ||
| 42 | ) | ||
| 43 | { | ||
| 44 | HRESULT hr = S_OK; | ||
| 45 | ValidateMessageArgs(hr, pvArgs, BAENGINE_GETVARIABLESTRING_ARGS, pArgs); | ||
| 46 | ValidateMessageResults(hr, pvResults, BAENGINE_GETVARIABLESTRING_RESULTS, pResults); | ||
| 47 | |||
| 48 | hr = ExternalEngineGetVariableString(pContext->pEngineState, pArgs->wzVariable, pResults->wzValue, &pResults->cchValue); | ||
| 49 | |||
| 50 | LExit: | ||
| 51 | return hr; | ||
| 52 | } | ||
| 53 | |||
| 54 | static HRESULT BAEngineGetVariableVersion( | ||
| 55 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 56 | __in const LPVOID pvArgs, | ||
| 57 | __inout LPVOID pvResults | ||
| 58 | ) | ||
| 59 | { | ||
| 60 | HRESULT hr = S_OK; | ||
| 61 | ValidateMessageArgs(hr, pvArgs, BAENGINE_GETVARIABLEVERSION_ARGS, pArgs); | ||
| 62 | ValidateMessageResults(hr, pvResults, BAENGINE_GETVARIABLEVERSION_RESULTS, pResults); | ||
| 63 | |||
| 64 | hr = ExternalEngineGetVariableVersion(pContext->pEngineState, pArgs->wzVariable, pResults->wzValue, &pResults->cchValue); | ||
| 65 | |||
| 66 | LExit: | ||
| 67 | return hr; | ||
| 68 | } | ||
| 69 | |||
| 70 | static HRESULT BAEngineFormatString( | ||
| 71 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 72 | __in const LPVOID pvArgs, | ||
| 73 | __inout LPVOID pvResults | ||
| 74 | ) | ||
| 75 | { | ||
| 76 | HRESULT hr = S_OK; | ||
| 77 | ValidateMessageArgs(hr, pvArgs, BAENGINE_FORMATSTRING_ARGS, pArgs); | ||
| 78 | ValidateMessageResults(hr, pvResults, BAENGINE_FORMATSTRING_RESULTS, pResults); | ||
| 79 | |||
| 80 | hr = ExternalEngineFormatString(pContext->pEngineState, pArgs->wzIn, pResults->wzOut, &pResults->cchOut); | ||
| 81 | |||
| 82 | LExit: | ||
| 83 | return hr; | ||
| 84 | } | ||
| 85 | |||
| 86 | static HRESULT BAEngineEscapeString( | ||
| 87 | __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/, | ||
| 88 | __in const LPVOID pvArgs, | ||
| 89 | __inout LPVOID pvResults | ||
| 90 | ) | ||
| 91 | { | ||
| 92 | HRESULT hr = S_OK; | ||
| 93 | ValidateMessageArgs(hr, pvArgs, BAENGINE_ESCAPESTRING_ARGS, pArgs); | ||
| 94 | ValidateMessageResults(hr, pvResults, BAENGINE_ESCAPESTRING_RESULTS, pResults); | ||
| 95 | |||
| 96 | hr = ExternalEngineEscapeString(pArgs->wzIn, pResults->wzOut, &pResults->cchOut); | ||
| 97 | |||
| 98 | LExit: | ||
| 99 | return hr; | ||
| 100 | } | ||
| 101 | |||
| 102 | static HRESULT BAEngineEvaluateCondition( | ||
| 103 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 104 | __in const LPVOID pvArgs, | ||
| 105 | __inout LPVOID pvResults | ||
| 106 | ) | ||
| 107 | { | ||
| 108 | HRESULT hr = S_OK; | ||
| 109 | ValidateMessageArgs(hr, pvArgs, BAENGINE_EVALUATECONDITION_ARGS, pArgs); | ||
| 110 | ValidateMessageResults(hr, pvResults, BAENGINE_EVALUATECONDITION_RESULTS, pResults); | ||
| 111 | |||
| 112 | hr = ExternalEngineEvaluateCondition(pContext->pEngineState, pArgs->wzCondition, &pResults->f); | ||
| 113 | |||
| 114 | LExit: | ||
| 115 | return hr; | ||
| 116 | } | ||
| 117 | |||
| 118 | static HRESULT BAEngineLog( | ||
| 119 | __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/, | ||
| 120 | __in const LPVOID pvArgs, | ||
| 121 | __inout LPVOID pvResults | ||
| 122 | ) | ||
| 123 | { | ||
| 124 | HRESULT hr = S_OK; | ||
| 125 | REPORT_LEVEL rl = REPORT_NONE; | ||
| 126 | ValidateMessageArgs(hr, pvArgs, BAENGINE_LOG_ARGS, pArgs); | ||
| 127 | ValidateMessageResults(hr, pvResults, BAENGINE_LOG_RESULTS, pResults); | ||
| 128 | |||
| 129 | switch (pArgs->level) | ||
| 130 | { | ||
| 131 | case BOOTSTRAPPER_LOG_LEVEL_STANDARD: | ||
| 132 | rl = REPORT_STANDARD; | ||
| 133 | break; | ||
| 134 | |||
| 135 | case BOOTSTRAPPER_LOG_LEVEL_VERBOSE: | ||
| 136 | rl = REPORT_VERBOSE; | ||
| 137 | break; | ||
| 138 | |||
| 139 | case BOOTSTRAPPER_LOG_LEVEL_DEBUG: | ||
| 140 | rl = REPORT_DEBUG; | ||
| 141 | break; | ||
| 142 | |||
| 143 | case BOOTSTRAPPER_LOG_LEVEL_ERROR: | ||
| 144 | rl = REPORT_ERROR; | ||
| 145 | break; | ||
| 146 | |||
| 147 | default: | ||
| 148 | ExitFunction1(hr = E_INVALIDARG); | ||
| 149 | } | ||
| 150 | |||
| 151 | hr = ExternalEngineLog(rl, pArgs->wzMessage); | ||
| 152 | ExitOnFailure(hr, "Failed to log BA message."); | ||
| 153 | |||
| 154 | LExit: | ||
| 155 | return hr; | ||
| 156 | } | ||
| 157 | |||
| 158 | static HRESULT BAEngineSendEmbeddedError( | ||
| 159 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 160 | __in const LPVOID pvArgs, | ||
| 161 | __inout LPVOID pvResults | ||
| 162 | ) | ||
| 163 | { | ||
| 164 | HRESULT hr = S_OK; | ||
| 165 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SENDEMBEDDEDERROR_ARGS, pArgs); | ||
| 166 | ValidateMessageResults(hr, pvResults, BAENGINE_SENDEMBEDDEDERROR_RESULTS, pResults); | ||
| 167 | |||
| 168 | hr = ExternalEngineSendEmbeddedError(pContext->pEngineState, pArgs->dwErrorCode, pArgs->wzMessage, pArgs->dwUIHint, &pResults->nResult); | ||
| 169 | |||
| 170 | LExit: | ||
| 171 | return hr; | ||
| 172 | } | ||
| 173 | |||
| 174 | static HRESULT BAEngineSendEmbeddedProgress( | ||
| 175 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 176 | __in const LPVOID pvArgs, | ||
| 177 | __inout LPVOID pvResults | ||
| 178 | ) | ||
| 179 | { | ||
| 180 | HRESULT hr = S_OK; | ||
| 181 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SENDEMBEDDEDPROGRESS_ARGS, pArgs); | ||
| 182 | ValidateMessageResults(hr, pvResults, BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS, pResults); | ||
| 183 | |||
| 184 | hr = ExternalEngineSendEmbeddedProgress(pContext->pEngineState, pArgs->dwProgressPercentage, pArgs->dwOverallProgressPercentage, &pResults->nResult); | ||
| 185 | |||
| 186 | LExit: | ||
| 187 | return hr; | ||
| 188 | } | ||
| 189 | |||
| 190 | static HRESULT BAEngineSetUpdate( | ||
| 191 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 192 | __in const LPVOID pvArgs, | ||
| 193 | __inout LPVOID pvResults | ||
| 194 | ) | ||
| 195 | { | ||
| 196 | HRESULT hr = S_OK; | ||
| 197 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETUPDATE_ARGS, pArgs); | ||
| 198 | ValidateMessageResults(hr, pvResults, BAENGINE_SETUPDATE_RESULTS, pResults); | ||
| 199 | |||
| 200 | hr = ExternalEngineSetUpdate(pContext->pEngineState, pArgs->wzLocalSource, pArgs->wzDownloadSource, pArgs->qwSize, pArgs->hashType, pArgs->wzHash); | ||
| 201 | |||
| 202 | LExit: | ||
| 203 | return hr; | ||
| 204 | } | ||
| 205 | |||
| 206 | static HRESULT BAEngineSetLocalSource( | ||
| 207 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 208 | __in const LPVOID pvArgs, | ||
| 209 | __inout LPVOID pvResults | ||
| 210 | ) | ||
| 211 | { | ||
| 212 | HRESULT hr = S_OK; | ||
| 213 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETLOCALSOURCE_ARGS, pArgs); | ||
| 214 | ValidateMessageResults(hr, pvResults, BAENGINE_SETLOCALSOURCE_RESULTS, pResults); | ||
| 215 | |||
| 216 | hr = ExternalEngineSetLocalSource(pContext->pEngineState, pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->wzPath); | ||
| 217 | |||
| 218 | LExit: | ||
| 219 | return hr; | ||
| 220 | } | ||
| 221 | |||
| 222 | static HRESULT BAEngineSetDownloadSource( | ||
| 223 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 224 | __in const LPVOID pvArgs, | ||
| 225 | __inout LPVOID pvResults | ||
| 226 | ) | ||
| 227 | { | ||
| 228 | HRESULT hr = S_OK; | ||
| 229 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETDOWNLOADSOURCE_ARGS, pArgs); | ||
| 230 | ValidateMessageResults(hr, pvResults, BAENGINE_SETDOWNLOADSOURCE_RESULTS, pResults); | ||
| 231 | |||
| 232 | hr = ExternalEngineSetDownloadSource(pContext->pEngineState, pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->wzUrl, pArgs->wzUser, pArgs->wzPassword); | ||
| 233 | |||
| 234 | LExit: | ||
| 235 | return hr; | ||
| 236 | } | ||
| 237 | |||
| 238 | static HRESULT BAEngineSetVariableNumeric( | ||
| 239 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 240 | __in const LPVOID pvArgs, | ||
| 241 | __inout LPVOID pvResults | ||
| 242 | ) | ||
| 243 | { | ||
| 244 | HRESULT hr = S_OK; | ||
| 245 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETVARIABLENUMERIC_ARGS, pArgs); | ||
| 246 | ValidateMessageResults(hr, pvResults, BAENGINE_SETVARIABLENUMERIC_RESULTS, pResults); | ||
| 247 | |||
| 248 | hr = ExternalEngineSetVariableNumeric(pContext->pEngineState, pArgs->wzVariable, pArgs->llValue); | ||
| 249 | |||
| 250 | LExit: | ||
| 251 | return hr; | ||
| 252 | } | ||
| 253 | |||
| 254 | static HRESULT BAEngineSetVariableString( | ||
| 255 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 256 | __in const LPVOID pvArgs, | ||
| 257 | __inout LPVOID pvResults | ||
| 258 | ) | ||
| 259 | { | ||
| 260 | HRESULT hr = S_OK; | ||
| 261 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETVARIABLESTRING_ARGS, pArgs); | ||
| 262 | ValidateMessageResults(hr, pvResults, BAENGINE_SETVARIABLESTRING_RESULTS, pResults); | ||
| 263 | |||
| 264 | hr = ExternalEngineSetVariableString(pContext->pEngineState, pArgs->wzVariable, pArgs->wzValue, pArgs->fFormatted); | ||
| 265 | |||
| 266 | LExit: | ||
| 267 | return hr; | ||
| 268 | } | ||
| 269 | |||
| 270 | static HRESULT BAEngineSetVariableVersion( | ||
| 271 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 272 | __in const LPVOID pvArgs, | ||
| 273 | __inout LPVOID pvResults | ||
| 274 | ) | ||
| 275 | { | ||
| 276 | HRESULT hr = S_OK; | ||
| 277 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETVARIABLEVERSION_ARGS, pArgs); | ||
| 278 | ValidateMessageResults(hr, pvResults, BAENGINE_SETVARIABLEVERSION_RESULTS, pResults); | ||
| 279 | |||
| 280 | hr = ExternalEngineSetVariableVersion(pContext->pEngineState, pArgs->wzVariable, pArgs->wzValue); | ||
| 281 | |||
| 282 | LExit: | ||
| 283 | return hr; | ||
| 284 | } | ||
| 285 | |||
| 286 | static HRESULT BAEngineCloseSplashScreen( | ||
| 287 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 288 | __in const LPVOID pvArgs, | ||
| 289 | __inout LPVOID pvResults | ||
| 290 | ) | ||
| 291 | { | ||
| 292 | HRESULT hr = S_OK; | ||
| 293 | ValidateMessageArgs(hr, pvArgs, BAENGINE_CLOSESPLASHSCREEN_ARGS, pArgs); | ||
| 294 | ValidateMessageResults(hr, pvResults, BAENGINE_CLOSESPLASHSCREEN_RESULTS, pResults); | ||
| 295 | |||
| 296 | ExternalEngineCloseSplashScreen(pContext->pEngineState); | ||
| 297 | |||
| 298 | LExit: | ||
| 299 | return hr; | ||
| 300 | } | ||
| 301 | |||
| 302 | static HRESULT BAEngineCompareVersions( | ||
| 303 | __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/, | ||
| 304 | __in const LPVOID pvArgs, | ||
| 305 | __inout LPVOID pvResults | ||
| 306 | ) | ||
| 307 | { | ||
| 308 | HRESULT hr = S_OK; | ||
| 309 | ValidateMessageArgs(hr, pvArgs, BAENGINE_COMPAREVERSIONS_ARGS, pArgs); | ||
| 310 | ValidateMessageResults(hr, pvResults, BAENGINE_COMPAREVERSIONS_RESULTS, pResults); | ||
| 311 | |||
| 312 | hr = ExternalEngineCompareVersions(pArgs->wzVersion1, pArgs->wzVersion2, &pResults->nResult); | ||
| 313 | |||
| 314 | LExit: | ||
| 315 | return hr; | ||
| 316 | } | ||
| 317 | |||
| 318 | static HRESULT BAEngineDetect( | ||
| 319 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 320 | __in const LPVOID pvArgs, | ||
| 321 | __inout LPVOID pvResults | ||
| 322 | ) | ||
| 323 | { | ||
| 324 | HRESULT hr = S_OK; | ||
| 325 | ValidateMessageArgs(hr, pvArgs, BAENGINE_DETECT_ARGS, pArgs); | ||
| 326 | ValidateMessageResults(hr, pvResults, BAENGINE_DETECT_RESULTS, pResults); | ||
| 327 | |||
| 328 | hr = ExternalEngineDetect(pContext, pArgs->hwndParent); | ||
| 329 | |||
| 330 | LExit: | ||
| 331 | return hr; | ||
| 332 | } | ||
| 333 | |||
| 334 | static HRESULT BAEnginePlan( | ||
| 335 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 336 | __in const LPVOID pvArgs, | ||
| 337 | __inout LPVOID pvResults | ||
| 338 | ) | ||
| 339 | { | ||
| 340 | HRESULT hr = S_OK; | ||
| 341 | ValidateMessageArgs(hr, pvArgs, BAENGINE_PLAN_ARGS, pArgs); | ||
| 342 | ValidateMessageResults(hr, pvResults, BAENGINE_PLAN_RESULTS, pResults); | ||
| 343 | |||
| 344 | hr = ExternalEnginePlan(pContext, pArgs->action); | ||
| 345 | |||
| 346 | LExit: | ||
| 347 | return hr; | ||
| 348 | } | ||
| 349 | |||
| 350 | static HRESULT BAEngineElevate( | ||
| 351 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 352 | __in const LPVOID pvArgs, | ||
| 353 | __inout LPVOID pvResults | ||
| 354 | ) | ||
| 355 | { | ||
| 356 | HRESULT hr = S_OK; | ||
| 357 | ValidateMessageArgs(hr, pvArgs, BAENGINE_ELEVATE_ARGS, pArgs); | ||
| 358 | ValidateMessageResults(hr, pvResults, BAENGINE_ELEVATE_RESULTS, pResults); | ||
| 359 | |||
| 360 | hr = ExternalEngineElevate(pContext, pArgs->hwndParent); | ||
| 361 | |||
| 362 | LExit: | ||
| 363 | return hr; | ||
| 364 | } | ||
| 365 | |||
| 366 | static HRESULT BAEngineApply( | ||
| 367 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 368 | __in const LPVOID pvArgs, | ||
| 369 | __inout LPVOID pvResults | ||
| 370 | ) | ||
| 371 | { | ||
| 372 | HRESULT hr = S_OK; | ||
| 373 | ValidateMessageArgs(hr, pvArgs, BAENGINE_APPLY_ARGS, pArgs); | ||
| 374 | ValidateMessageResults(hr, pvResults, BAENGINE_APPLY_RESULTS, pResults); | ||
| 375 | |||
| 376 | hr = ExternalEngineApply(pContext, pArgs->hwndParent); | ||
| 377 | |||
| 378 | LExit: | ||
| 379 | return hr; | ||
| 380 | } | ||
| 381 | |||
| 382 | static HRESULT BAEngineQuit( | ||
| 383 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 384 | __in const LPVOID pvArgs, | ||
| 385 | __inout LPVOID pvResults | ||
| 386 | ) | ||
| 387 | { | ||
| 388 | HRESULT hr = S_OK; | ||
| 389 | ValidateMessageArgs(hr, pvArgs, BAENGINE_QUIT_ARGS, pArgs); | ||
| 390 | ValidateMessageResults(hr, pvResults, BAENGINE_QUIT_RESULTS, pResults); | ||
| 391 | |||
| 392 | hr = ExternalEngineQuit(pContext, pArgs->dwExitCode); | ||
| 393 | |||
| 394 | LExit: | ||
| 395 | return hr; | ||
| 396 | } | ||
| 397 | |||
| 398 | static HRESULT BAEngineLaunchApprovedExe( | ||
| 399 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 400 | __in const LPVOID pvArgs, | ||
| 401 | __inout LPVOID pvResults | ||
| 402 | ) | ||
| 403 | { | ||
| 404 | HRESULT hr = S_OK; | ||
| 405 | ValidateMessageArgs(hr, pvArgs, BAENGINE_LAUNCHAPPROVEDEXE_ARGS, pArgs); | ||
| 406 | ValidateMessageResults(hr, pvResults, BAENGINE_LAUNCHAPPROVEDEXE_RESULTS, pResults); | ||
| 407 | |||
| 408 | hr = ExternalEngineLaunchApprovedExe(pContext, pArgs->hwndParent, pArgs->wzApprovedExeForElevationId, pArgs->wzArguments, pArgs->dwWaitForInputIdleTimeout); | ||
| 409 | |||
| 410 | LExit: | ||
| 411 | return hr; | ||
| 412 | } | ||
| 413 | |||
| 414 | static HRESULT BAEngineSetUpdateSource( | ||
| 415 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 416 | __in const LPVOID pvArgs, | ||
| 417 | __inout LPVOID pvResults | ||
| 418 | ) | ||
| 419 | { | ||
| 420 | HRESULT hr = S_OK; | ||
| 421 | ValidateMessageArgs(hr, pvArgs, BAENGINE_SETUPDATESOURCE_ARGS, pArgs); | ||
| 422 | ValidateMessageResults(hr, pvResults, BAENGINE_SETUPDATESOURCE_RESULTS, pResults); | ||
| 423 | |||
| 424 | hr = ExternalEngineSetUpdateSource(pContext->pEngineState, pArgs->wzUrl); | ||
| 425 | |||
| 426 | LExit: | ||
| 427 | return hr; | ||
| 428 | } | ||
| 429 | |||
| 430 | static HRESULT BAEngineGetRelatedBundleVariable( | ||
| 431 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext, | ||
| 432 | __in const LPVOID pvArgs, | ||
| 433 | __inout LPVOID pvResults | ||
| 434 | ) | ||
| 435 | { | ||
| 436 | HRESULT hr = S_OK; | ||
| 437 | ValidateMessageArgs(hr, pvArgs, BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS, pArgs); | ||
| 438 | ValidateMessageResults(hr, pvResults, BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS, pResults); | ||
| 439 | |||
| 440 | hr = ExternalEngineGetRelatedBundleVariable(pContext->pEngineState, pArgs->wzBundleId, pArgs->wzVariable, pResults->wzValue, &pResults->cchValue); | ||
| 441 | |||
| 442 | LExit: | ||
| 443 | return hr; | ||
| 444 | } | ||
| 445 | |||
| 446 | HRESULT WINAPI EngineForApplicationProc( | ||
| 447 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
| 448 | __in const LPVOID pvArgs, | ||
| 449 | __inout LPVOID pvResults, | ||
| 450 | __in_opt LPVOID pvContext | ||
| 451 | ) | ||
| 452 | { | ||
| 453 | HRESULT hr = S_OK; | ||
| 454 | BOOTSTRAPPER_ENGINE_CONTEXT* pContext = reinterpret_cast<BOOTSTRAPPER_ENGINE_CONTEXT*>(pvContext); | ||
| 455 | |||
| 456 | if (!pContext || !pvArgs || !pvResults) | ||
| 457 | { | ||
| 458 | ExitFunction1(hr = E_INVALIDARG); | ||
| 459 | } | ||
| 460 | |||
| 461 | switch (message) | ||
| 462 | { | ||
| 463 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT: | ||
| 464 | hr = BAEngineGetPackageCount(pContext, pvArgs, pvResults); | ||
| 465 | break; | ||
| 466 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC: | ||
| 467 | hr = BAEngineGetVariableNumeric(pContext, pvArgs, pvResults); | ||
| 468 | break; | ||
| 469 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING: | ||
| 470 | hr = BAEngineGetVariableString(pContext, pvArgs, pvResults); | ||
| 471 | break; | ||
| 472 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION: | ||
| 473 | hr = BAEngineGetVariableVersion(pContext, pvArgs, pvResults); | ||
| 474 | break; | ||
| 475 | case BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING: | ||
| 476 | hr = BAEngineFormatString(pContext, pvArgs, pvResults); | ||
| 477 | break; | ||
| 478 | case BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING: | ||
| 479 | hr = BAEngineEscapeString(pContext, pvArgs, pvResults); | ||
| 480 | break; | ||
| 481 | case BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION: | ||
| 482 | hr = BAEngineEvaluateCondition(pContext, pvArgs, pvResults); | ||
| 483 | break; | ||
| 484 | case BOOTSTRAPPER_ENGINE_MESSAGE_LOG: | ||
| 485 | hr = BAEngineLog(pContext, pvArgs, pvResults); | ||
| 486 | break; | ||
| 487 | case BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR: | ||
| 488 | hr = BAEngineSendEmbeddedError(pContext, pvArgs, pvResults); | ||
| 489 | break; | ||
| 490 | case BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS: | ||
| 491 | hr = BAEngineSendEmbeddedProgress(pContext, pvArgs, pvResults); | ||
| 492 | break; | ||
| 493 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE: | ||
| 494 | hr = BAEngineSetUpdate(pContext, pvArgs, pvResults); | ||
| 495 | break; | ||
| 496 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE: | ||
| 497 | hr = BAEngineSetLocalSource(pContext, pvArgs, pvResults); | ||
| 498 | break; | ||
| 499 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE: | ||
| 500 | hr = BAEngineSetDownloadSource(pContext, pvArgs, pvResults); | ||
| 501 | break; | ||
| 502 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC: | ||
| 503 | hr = BAEngineSetVariableNumeric(pContext, pvArgs, pvResults); | ||
| 504 | break; | ||
| 505 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING: | ||
| 506 | hr = BAEngineSetVariableString(pContext, pvArgs, pvResults); | ||
| 507 | break; | ||
| 508 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION: | ||
| 509 | hr = BAEngineSetVariableVersion(pContext, pvArgs, pvResults); | ||
| 510 | break; | ||
| 511 | case BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN: | ||
| 512 | hr = BAEngineCloseSplashScreen(pContext, pvArgs, pvResults); | ||
| 513 | break; | ||
| 514 | case BOOTSTRAPPER_ENGINE_MESSAGE_DETECT: | ||
| 515 | hr = BAEngineDetect(pContext, pvArgs, pvResults); | ||
| 516 | break; | ||
| 517 | case BOOTSTRAPPER_ENGINE_MESSAGE_PLAN: | ||
| 518 | hr = BAEnginePlan(pContext, pvArgs, pvResults); | ||
| 519 | break; | ||
| 520 | case BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE: | ||
| 521 | hr = BAEngineElevate(pContext, pvArgs, pvResults); | ||
| 522 | break; | ||
| 523 | case BOOTSTRAPPER_ENGINE_MESSAGE_APPLY: | ||
| 524 | hr = BAEngineApply(pContext, pvArgs, pvResults); | ||
| 525 | break; | ||
| 526 | case BOOTSTRAPPER_ENGINE_MESSAGE_QUIT: | ||
| 527 | hr = BAEngineQuit(pContext, pvArgs, pvResults); | ||
| 528 | break; | ||
| 529 | case BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE: | ||
| 530 | hr = BAEngineLaunchApprovedExe(pContext, pvArgs, pvResults); | ||
| 531 | break; | ||
| 532 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE: | ||
| 533 | hr = BAEngineSetUpdateSource(pContext, pvArgs, pvResults); | ||
| 534 | break; | ||
| 535 | case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS: | ||
| 536 | hr = BAEngineCompareVersions(pContext, pvArgs, pvResults); | ||
| 537 | break; | ||
| 538 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE: | ||
| 539 | hr = BAEngineGetRelatedBundleVariable(pContext, pvArgs, pvResults); | ||
| 540 | break; | ||
| 541 | default: | ||
| 542 | hr = E_NOTIMPL; | ||
| 543 | break; | ||
| 544 | } | ||
| 545 | |||
| 546 | LExit: | ||
| 547 | return hr; | ||
| 548 | } | ||
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index f3b05cf8..6908e955 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -390,7 +390,7 @@ extern "C" void ApplyReset( | |||
| 390 | __in BURN_PACKAGES* pPackages | 390 | __in BURN_PACKAGES* pPackages |
| 391 | ) | 391 | ) |
| 392 | { | 392 | { |
| 393 | UserExperienceExecuteReset(pUX); | 393 | BootstrapperApplicationExecuteReset(pUX); |
| 394 | 394 | ||
| 395 | for (DWORD i = 0; i < pPackages->cPackages; ++i) | 395 | for (DWORD i = 0; i < pPackages->cPackages; ++i) |
| 396 | { | 396 | { |
| @@ -444,7 +444,7 @@ extern "C" HRESULT ApplyRegister( | |||
| 444 | 444 | ||
| 445 | CalculateKeepRegistration(pEngineState, FALSE, ®istrationType, &qwEstimatedSize); | 445 | CalculateKeepRegistration(pEngineState, FALSE, ®istrationType, &qwEstimatedSize); |
| 446 | 446 | ||
| 447 | hr = UserExperienceOnRegisterBegin(&pEngineState->userExperience, ®istrationType); | 447 | hr = BACallbackOnRegisterBegin(&pEngineState->userExperience, ®istrationType); |
| 448 | ExitOnRootFailure(hr, "BA aborted register begin."); | 448 | ExitOnRootFailure(hr, "BA aborted register begin."); |
| 449 | 449 | ||
| 450 | hr = CacheCalculateBundleWorkingPath(pEngineState->plan.pCache, pEngineState->registration.sczExecutableName, &sczEngineWorkingPath); | 450 | hr = CacheCalculateBundleWorkingPath(pEngineState->plan.pCache, pEngineState->registration.sczExecutableName, &sczEngineWorkingPath); |
| @@ -474,7 +474,7 @@ extern "C" HRESULT ApplyRegister( | |||
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | LExit: | 476 | LExit: |
| 477 | UserExperienceOnRegisterComplete(&pEngineState->userExperience, hr); | 477 | BACallbackOnRegisterComplete(&pEngineState->userExperience, hr); |
| 478 | ReleaseStr(sczEngineWorkingPath); | 478 | ReleaseStr(sczEngineWorkingPath); |
| 479 | 479 | ||
| 480 | return hr; | 480 | return hr; |
| @@ -518,7 +518,7 @@ extern "C" HRESULT ApplyUnregister( | |||
| 518 | 518 | ||
| 519 | registrationType = defaultRegistrationType; | 519 | registrationType = defaultRegistrationType; |
| 520 | 520 | ||
| 521 | UserExperienceOnUnregisterBegin(&pEngineState->userExperience, ®istrationType); | 521 | BACallbackOnUnregisterBegin(&pEngineState->userExperience, ®istrationType); |
| 522 | 522 | ||
| 523 | // Barring the special cases, if it was determined that we should keep the registration then | 523 | // Barring the special cases, if it was determined that we should keep the registration then |
| 524 | // do that, otherwise the resume mode is NONE and registration will be removed. | 524 | // do that, otherwise the resume mode is NONE and registration will be removed. |
| @@ -560,7 +560,7 @@ extern "C" HRESULT ApplyUnregister( | |||
| 560 | pEngineState->resumeMode = resumeMode; | 560 | pEngineState->resumeMode = resumeMode; |
| 561 | 561 | ||
| 562 | LExit: | 562 | LExit: |
| 563 | UserExperienceOnUnregisterComplete(&pEngineState->userExperience, hr); | 563 | BACallbackOnUnregisterComplete(&pEngineState->userExperience, hr); |
| 564 | 564 | ||
| 565 | return hr; | 565 | return hr; |
| 566 | } | 566 | } |
| @@ -579,7 +579,7 @@ extern "C" HRESULT ApplyCache( | |||
| 579 | BURN_CACHE_CONTEXT cacheContext = { }; | 579 | BURN_CACHE_CONTEXT cacheContext = { }; |
| 580 | BURN_PACKAGE* pPackage = NULL; | 580 | BURN_PACKAGE* pPackage = NULL; |
| 581 | 581 | ||
| 582 | hr = UserExperienceOnCacheBegin(pUX); | 582 | hr = BACallbackOnCacheBegin(pUX); |
| 583 | ExitOnRootFailure(hr, "BA aborted cache."); | 583 | ExitOnRootFailure(hr, "BA aborted cache."); |
| 584 | 584 | ||
| 585 | hr = CacheEnsureAcquisitionFolder(pPlan->pCache); | 585 | hr = CacheEnsureAcquisitionFolder(pPlan->pCache); |
| @@ -681,7 +681,7 @@ LExit: | |||
| 681 | ReleaseMem(cacheContext.rgSearchPaths); | 681 | ReleaseMem(cacheContext.rgSearchPaths); |
| 682 | ReleaseStr(cacheContext.sczLocalAcquisitionSourcePath); | 682 | ReleaseStr(cacheContext.sczLocalAcquisitionSourcePath); |
| 683 | 683 | ||
| 684 | UserExperienceOnCacheComplete(pUX, hr); | 684 | BACallbackOnCacheComplete(pUX, hr); |
| 685 | return hr; | 685 | return hr; |
| 686 | } | 686 | } |
| 687 | 687 | ||
| @@ -716,7 +716,7 @@ extern "C" HRESULT ApplyExecute( | |||
| 716 | *pfSuspend = FALSE; | 716 | *pfSuspend = FALSE; |
| 717 | 717 | ||
| 718 | // Send execute begin to BA. | 718 | // Send execute begin to BA. |
| 719 | hr = UserExperienceOnExecuteBegin(&pEngineState->userExperience, pEngineState->plan.cExecutePackagesTotal); | 719 | hr = BACallbackOnExecuteBegin(&pEngineState->userExperience, pEngineState->plan.cExecutePackagesTotal); |
| 720 | ExitOnRootFailure(hr, "BA aborted execute begin."); | 720 | ExitOnRootFailure(hr, "BA aborted execute begin."); |
| 721 | 721 | ||
| 722 | // Do execute actions. | 722 | // Do execute actions. |
| @@ -840,7 +840,7 @@ extern "C" HRESULT ApplyExecute( | |||
| 840 | 840 | ||
| 841 | LExit: | 841 | LExit: |
| 842 | // Send execute complete to BA. | 842 | // Send execute complete to BA. |
| 843 | UserExperienceOnExecuteComplete(&pEngineState->userExperience, hr); | 843 | BACallbackOnExecuteComplete(&pEngineState->userExperience, hr); |
| 844 | 844 | ||
| 845 | return hr; | 845 | return hr; |
| 846 | } | 846 | } |
| @@ -983,7 +983,7 @@ static HRESULT ApplyCachePackage( | |||
| 983 | { | 983 | { |
| 984 | fCanceledBegin = FALSE; | 984 | fCanceledBegin = FALSE; |
| 985 | 985 | ||
| 986 | hr = UserExperienceOnCachePackageBegin(pContext->pUX, pPackage->sczId, pPackage->payloads.cItems, pPackage->payloads.qwTotalSize, fVital); | 986 | hr = BACallbackOnCachePackageBegin(pContext->pUX, pPackage->sczId, pPackage->payloads.cItems, pPackage->payloads.qwTotalSize, fVital); |
| 987 | if (FAILED(hr)) | 987 | if (FAILED(hr)) |
| 988 | { | 988 | { |
| 989 | fCanceledBegin = TRUE; | 989 | fCanceledBegin = TRUE; |
| @@ -1004,7 +1004,7 @@ static HRESULT ApplyCachePackage( | |||
| 1004 | 1004 | ||
| 1005 | pPackage->hrCacheResult = hr; | 1005 | pPackage->hrCacheResult = hr; |
| 1006 | cachePackageCompleteAction = SUCCEEDED(hr) || (pPackage->fVital && fVital) || fCanceledBegin ? BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE : BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_IGNORE; | 1006 | cachePackageCompleteAction = SUCCEEDED(hr) || (pPackage->fVital && fVital) || fCanceledBegin ? BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE : BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_IGNORE; |
| 1007 | UserExperienceOnCachePackageComplete(pContext->pUX, pPackage->sczId, hr, &cachePackageCompleteAction); | 1007 | BACallbackOnCachePackageComplete(pContext->pUX, pPackage->sczId, hr, &cachePackageCompleteAction); |
| 1008 | 1008 | ||
| 1009 | if (SUCCEEDED(hr)) | 1009 | if (SUCCEEDED(hr)) |
| 1010 | { | 1010 | { |
| @@ -1248,7 +1248,7 @@ static HRESULT ApplyProcessPayload( | |||
| 1248 | } | 1248 | } |
| 1249 | else if (pPackage && !pPackage->fAcquireOptionalSource && !fVital) | 1249 | else if (pPackage && !pPackage->fAcquireOptionalSource && !fVital) |
| 1250 | { | 1250 | { |
| 1251 | HRESULT hrResponse = UserExperienceOnCachePackageNonVitalValidationFailure(pContext->pUX, pPackage->sczId, hr, &action); | 1251 | HRESULT hrResponse = BACallbackOnCachePackageNonVitalValidationFailure(pContext->pUX, pPackage->sczId, hr, &action); |
| 1252 | ExitOnRootFailure(hrResponse, "BA aborted cache package non-vital failure."); | 1252 | ExitOnRootFailure(hrResponse, "BA aborted cache package non-vital failure."); |
| 1253 | 1253 | ||
| 1254 | if (BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_ACQUIRE != action) | 1254 | if (BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_ACQUIRE != action) |
| @@ -1369,10 +1369,10 @@ static HRESULT ExtractContainer( | |||
| 1369 | hr = PreparePayloadDestinationPath(pExtract->sczUnverifiedPath); | 1369 | hr = PreparePayloadDestinationPath(pExtract->sczUnverifiedPath); |
| 1370 | ExitOnFailure(hr, "Failed to prepare payload destination path: %ls", pExtract->sczUnverifiedPath); | 1370 | ExitOnFailure(hr, "Failed to prepare payload destination path: %ls", pExtract->sczUnverifiedPath); |
| 1371 | 1371 | ||
| 1372 | hr = UserExperienceOnCachePayloadExtractBegin(pContext->pUX, pContainer->sczId, pExtract->sczKey); | 1372 | hr = BACallbackOnCachePayloadExtractBegin(pContext->pUX, pContainer->sczId, pExtract->sczKey); |
| 1373 | if (FAILED(hr)) | 1373 | if (FAILED(hr)) |
| 1374 | { | 1374 | { |
| 1375 | UserExperienceOnCachePayloadExtractComplete(pContext->pUX, pContainer->sczId, pExtract->sczKey, hr); | 1375 | BACallbackOnCachePayloadExtractComplete(pContext->pUX, pContainer->sczId, pExtract->sczKey, hr); |
| 1376 | ExitOnRootFailure(hr, "BA aborted cache payload extract begin."); | 1376 | ExitOnRootFailure(hr, "BA aborted cache payload extract begin."); |
| 1377 | } | 1377 | } |
| 1378 | 1378 | ||
| @@ -1386,7 +1386,7 @@ static HRESULT ExtractContainer( | |||
| 1386 | hr = CompleteCacheProgress(&progress, pExtract->qwFileSize); | 1386 | hr = CompleteCacheProgress(&progress, pExtract->qwFileSize); |
| 1387 | } | 1387 | } |
| 1388 | 1388 | ||
| 1389 | UserExperienceOnCachePayloadExtractComplete(pContext->pUX, pContainer->sczId, pExtract->sczKey, hr); | 1389 | BACallbackOnCachePayloadExtractComplete(pContext->pUX, pContainer->sczId, pExtract->sczKey, hr); |
| 1390 | ExitOnFailure(hr, "Failed to extract payload: %ls from container: %ls", sczStreamName, pContainer->sczId); | 1390 | ExitOnFailure(hr, "Failed to extract payload: %ls from container: %ls", sczStreamName, pContainer->sczId); |
| 1391 | 1391 | ||
| 1392 | fExtracted = TRUE; | 1392 | fExtracted = TRUE; |
| @@ -1433,17 +1433,8 @@ static HRESULT LayoutBundle( | |||
| 1433 | 1433 | ||
| 1434 | progress.pCacheContext = pContext; | 1434 | progress.pCacheContext = pContext; |
| 1435 | 1435 | ||
| 1436 | hr = VariableGetString(pContext->pVariables, BURN_BUNDLE_SOURCE_PROCESS_PATH, &sczBundlePath); | 1436 | hr = PathForCurrentProcess(&sczBundlePath, NULL); |
| 1437 | if (FAILED(hr)) | 1437 | ExitOnFailure(hr, "Failed to get path to bundle to layout."); |
| 1438 | { | ||
| 1439 | if (E_NOTFOUND != hr) | ||
| 1440 | { | ||
| 1441 | ExitOnFailure(hr, "Failed to get path to bundle source process path to layout."); | ||
| 1442 | } | ||
| 1443 | |||
| 1444 | hr = PathForCurrentProcess(&sczBundlePath, NULL); | ||
| 1445 | ExitOnFailure(hr, "Failed to get path to bundle to layout."); | ||
| 1446 | } | ||
| 1447 | 1438 | ||
| 1448 | hr = PathConcatRelativeToFullyQualifiedBase(pContext->wzLayoutDirectory, wzExecutableName, &sczDestinationPath); | 1439 | hr = PathConcatRelativeToFullyQualifiedBase(pContext->wzLayoutDirectory, wzExecutableName, &sczDestinationPath); |
| 1449 | ExitOnFailure(hr, "Failed to concat layout path for bundle."); | 1440 | ExitOnFailure(hr, "Failed to concat layout path for bundle."); |
| @@ -1454,17 +1445,17 @@ static HRESULT LayoutBundle( | |||
| 1454 | 1445 | ||
| 1455 | if (fPathEqual && FileExistsEx(sczDestinationPath, NULL)) | 1446 | if (fPathEqual && FileExistsEx(sczDestinationPath, NULL)) |
| 1456 | { | 1447 | { |
| 1457 | hr = UserExperienceOnCacheContainerOrPayloadVerifyBegin(pContext->pUX, NULL, NULL); | 1448 | hr = BACallbackOnCacheContainerOrPayloadVerifyBegin(pContext->pUX, NULL, NULL); |
| 1458 | if (FAILED(hr)) | 1449 | if (FAILED(hr)) |
| 1459 | { | 1450 | { |
| 1460 | UserExperienceOnCacheContainerOrPayloadVerifyComplete(pContext->pUX, NULL, NULL, hr); | 1451 | BACallbackOnCacheContainerOrPayloadVerifyComplete(pContext->pUX, NULL, NULL, hr); |
| 1461 | ExitOnRootFailure(hr, "BA aborted cache payload verify begin."); | 1452 | ExitOnRootFailure(hr, "BA aborted cache payload verify begin."); |
| 1462 | } | 1453 | } |
| 1463 | 1454 | ||
| 1464 | progress.type = BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY; | 1455 | progress.type = BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY; |
| 1465 | hr = CompleteCacheProgress(&progress, qwBundleSize); | 1456 | hr = CompleteCacheProgress(&progress, qwBundleSize); |
| 1466 | 1457 | ||
| 1467 | UserExperienceOnCacheContainerOrPayloadVerifyComplete(pContext->pUX, NULL, NULL, hr); | 1458 | BACallbackOnCacheContainerOrPayloadVerifyComplete(pContext->pUX, NULL, NULL, hr); |
| 1468 | 1459 | ||
| 1469 | ExitFunction(); | 1460 | ExitFunction(); |
| 1470 | } | 1461 | } |
| @@ -1481,7 +1472,7 @@ static HRESULT LayoutBundle( | |||
| 1481 | progress.fCancel = FALSE; | 1472 | progress.fCancel = FALSE; |
| 1482 | fCanceledBegin = FALSE; | 1473 | fCanceledBegin = FALSE; |
| 1483 | 1474 | ||
| 1484 | hr = UserExperienceOnCacheAcquireBegin(pContext->pUX, NULL, NULL, &sczBundlePath, &sczBundleDownloadUrl, NULL, &cacheOperation); | 1475 | hr = BACallbackOnCacheAcquireBegin(pContext->pUX, NULL, NULL, &sczBundlePath, &sczBundleDownloadUrl, NULL, &cacheOperation); |
| 1485 | 1476 | ||
| 1486 | if (FAILED(hr)) | 1477 | if (FAILED(hr)) |
| 1487 | { | 1478 | { |
| @@ -1499,7 +1490,7 @@ static HRESULT LayoutBundle( | |||
| 1499 | } | 1490 | } |
| 1500 | } | 1491 | } |
| 1501 | 1492 | ||
| 1502 | UserExperienceOnCacheAcquireComplete(pContext->pUX, NULL, NULL, hr, &fRetryAcquire); | 1493 | BACallbackOnCacheAcquireComplete(pContext->pUX, NULL, NULL, hr, &fRetryAcquire); |
| 1503 | if (fRetryAcquire) | 1494 | if (fRetryAcquire) |
| 1504 | { | 1495 | { |
| 1505 | continue; | 1496 | continue; |
| @@ -1517,7 +1508,7 @@ static HRESULT LayoutBundle( | |||
| 1517 | { | 1508 | { |
| 1518 | fCanceledBegin = FALSE; | 1509 | fCanceledBegin = FALSE; |
| 1519 | 1510 | ||
| 1520 | hr = UserExperienceOnCacheVerifyBegin(pContext->pUX, NULL, NULL); | 1511 | hr = BACallbackOnCacheVerifyBegin(pContext->pUX, NULL, NULL); |
| 1521 | 1512 | ||
| 1522 | if (FAILED(hr)) | 1513 | if (FAILED(hr)) |
| 1523 | { | 1514 | { |
| @@ -1529,7 +1520,7 @@ static HRESULT LayoutBundle( | |||
| 1529 | } | 1520 | } |
| 1530 | 1521 | ||
| 1531 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action = BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE; | 1522 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action = BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE; |
| 1532 | UserExperienceOnCacheVerifyComplete(pContext->pUX, NULL, NULL, hr, &action); | 1523 | BACallbackOnCacheVerifyComplete(pContext->pUX, NULL, NULL, hr, &action); |
| 1533 | if (BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYVERIFICATION == action) | 1524 | if (BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYVERIFICATION == action) |
| 1534 | { | 1525 | { |
| 1535 | hr = S_FALSE; // retry verify. | 1526 | hr = S_FALSE; // retry verify. |
| @@ -1646,7 +1637,7 @@ static HRESULT AcquireContainerOrPayload( | |||
| 1646 | *pfRetry = FALSE; | 1637 | *pfRetry = FALSE; |
| 1647 | pProgress->fCancel = FALSE; | 1638 | pProgress->fCancel = FALSE; |
| 1648 | 1639 | ||
| 1649 | hr = UserExperienceOnCacheAcquireBegin(pContext->pUX, wzPackageOrContainerId, wzPayloadId, pwzSourcePath, pwzDownloadUrl, wzPayloadContainerId, &cacheOperation); | 1640 | hr = BACallbackOnCacheAcquireBegin(pContext->pUX, wzPackageOrContainerId, wzPayloadId, pwzSourcePath, pwzDownloadUrl, wzPayloadContainerId, &cacheOperation); |
| 1650 | ExitOnRootFailure(hr, "BA aborted cache acquire begin."); | 1641 | ExitOnRootFailure(hr, "BA aborted cache acquire begin."); |
| 1651 | 1642 | ||
| 1652 | // Skip the Resolving event and probing local paths if the BA already knew it wanted to download or extract. | 1643 | // Skip the Resolving event and probing local paths if the BA already knew it wanted to download or extract. |
| @@ -1746,7 +1737,7 @@ static HRESULT AcquireContainerOrPayload( | |||
| 1746 | } | 1737 | } |
| 1747 | 1738 | ||
| 1748 | // Let the BA have a chance to override the source. | 1739 | // Let the BA have a chance to override the source. |
| 1749 | hr = UserExperienceOnCacheAcquireResolving(pContext->pUX, wzPackageOrContainerId, wzPayloadId, pContext->rgSearchPaths, pContext->cSearchPaths, fFoundLocal, &dwChosenSearchPath, pwzDownloadUrl, wzPayloadContainerId, &resolveOperation); | 1740 | hr = BACallbackOnCacheAcquireResolving(pContext->pUX, wzPackageOrContainerId, wzPayloadId, pContext->rgSearchPaths, pContext->cSearchPaths, fFoundLocal, &dwChosenSearchPath, pwzDownloadUrl, wzPayloadContainerId, &resolveOperation); |
| 1750 | ExitOnRootFailure(hr, "BA aborted cache acquire resolving."); | 1741 | ExitOnRootFailure(hr, "BA aborted cache acquire resolving."); |
| 1751 | 1742 | ||
| 1752 | switch (resolveOperation) | 1743 | switch (resolveOperation) |
| @@ -1816,7 +1807,7 @@ LExit: | |||
| 1816 | } | 1807 | } |
| 1817 | pPayload->pContainer->fExtracted = TRUE; | 1808 | pPayload->pContainer->fExtracted = TRUE; |
| 1818 | } | 1809 | } |
| 1819 | UserExperienceOnCacheAcquireComplete(pContext->pUX, wzPackageOrContainerId, wzPayloadId, hr, pfRetry); | 1810 | BACallbackOnCacheAcquireComplete(pContext->pUX, wzPackageOrContainerId, wzPayloadId, hr, pfRetry); |
| 1820 | 1811 | ||
| 1821 | pContext->cSearchPathsMax = max(pContext->cSearchPaths, pContext->cSearchPathsMax); | 1812 | pContext->cSearchPathsMax = max(pContext->cSearchPaths, pContext->cSearchPathsMax); |
| 1822 | 1813 | ||
| @@ -1891,7 +1882,7 @@ static HRESULT LayoutOrCacheContainerOrPayload( | |||
| 1891 | { | 1882 | { |
| 1892 | fCanceledBegin = FALSE; | 1883 | fCanceledBegin = FALSE; |
| 1893 | 1884 | ||
| 1894 | hr = UserExperienceOnCacheVerifyBegin(pContext->pUX, wzPackageOrContainerId, wzPayloadId); | 1885 | hr = BACallbackOnCacheVerifyBegin(pContext->pUX, wzPackageOrContainerId, wzPayloadId); |
| 1895 | 1886 | ||
| 1896 | if (FAILED(hr)) | 1887 | if (FAILED(hr)) |
| 1897 | { | 1888 | { |
| @@ -1926,7 +1917,7 @@ static HRESULT LayoutOrCacheContainerOrPayload( | |||
| 1926 | } | 1917 | } |
| 1927 | 1918 | ||
| 1928 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action = FAILED(hr) && !fCanceledBegin && cTryAgainAttempts < BURN_CACHE_MAX_RECOMMENDED_VERIFY_TRYAGAIN_ATTEMPTS ? BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYACQUISITION : BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE; | 1919 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action = FAILED(hr) && !fCanceledBegin && cTryAgainAttempts < BURN_CACHE_MAX_RECOMMENDED_VERIFY_TRYAGAIN_ATTEMPTS ? BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYACQUISITION : BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE; |
| 1929 | UserExperienceOnCacheVerifyComplete(pContext->pUX, wzPackageOrContainerId, wzPayloadId, hr, &action); | 1920 | BACallbackOnCacheVerifyComplete(pContext->pUX, wzPackageOrContainerId, wzPayloadId, hr, &action); |
| 1930 | if (BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYVERIFICATION == action) | 1921 | if (BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYVERIFICATION == action) |
| 1931 | { | 1922 | { |
| 1932 | hr = S_FALSE; // retry verify. | 1923 | hr = S_FALSE; // retry verify. |
| @@ -2098,8 +2089,8 @@ static HRESULT WINAPI AuthenticationRequired( | |||
| 2098 | 2089 | ||
| 2099 | APPLY_AUTHENTICATION_REQUIRED_DATA* authenticationData = reinterpret_cast<APPLY_AUTHENTICATION_REQUIRED_DATA*>(pData); | 2090 | APPLY_AUTHENTICATION_REQUIRED_DATA* authenticationData = reinterpret_cast<APPLY_AUTHENTICATION_REQUIRED_DATA*>(pData); |
| 2100 | 2091 | ||
| 2101 | UserExperienceOnError(authenticationData->pUX, errorType, authenticationData->wzPackageOrContainerId, ERROR_ACCESS_DENIED, sczError, MB_RETRYCANCEL, 0, NULL, &nResult); // ignore return value; | 2092 | BACallbackOnError(authenticationData->pUX, errorType, authenticationData->wzPackageOrContainerId, ERROR_ACCESS_DENIED, sczError, MB_RETRYCANCEL, 0, NULL, &nResult); // ignore return value; |
| 2102 | nResult = UserExperienceCheckExecuteResult(authenticationData->pUX, FALSE, BURN_MB_RETRYTRYAGAIN, nResult); | 2093 | nResult = BootstrapperApplicationCheckExecuteResult(authenticationData->pUX, FALSE, BURN_MB_RETRYTRYAGAIN, nResult); |
| 2103 | if (IDTRYAGAIN == nResult && authenticationData->pUX->hwndApply) | 2094 | if (IDTRYAGAIN == nResult && authenticationData->pUX->hwndApply) |
| 2104 | { | 2095 | { |
| 2105 | er = ::InternetErrorDlg(authenticationData->pUX->hwndApply, hUrl, ERROR_INTERNET_INCORRECT_PASSWORD, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, NULL); | 2096 | er = ::InternetErrorDlg(authenticationData->pUX->hwndApply, hUrl, ERROR_INTERNET_INCORRECT_PASSWORD, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, NULL); |
| @@ -2150,7 +2141,7 @@ static HRESULT CALLBACK CacheMessageHandler( | |||
| 2150 | { | 2141 | { |
| 2151 | case BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE: | 2142 | case BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE: |
| 2152 | pProgress->type = BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY; | 2143 | pProgress->type = BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY; |
| 2153 | hr = UserExperienceOnCacheContainerOrPayloadVerifyBegin(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId); | 2144 | hr = BACallbackOnCacheContainerOrPayloadVerifyBegin(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId); |
| 2154 | break; | 2145 | break; |
| 2155 | case BURN_CACHE_STEP_HASH_TO_SKIP_VERIFY: | 2146 | case BURN_CACHE_STEP_HASH_TO_SKIP_VERIFY: |
| 2156 | pProgress->type = BURN_CACHE_PROGRESS_TYPE_PAYLOAD_VERIFY; | 2147 | pProgress->type = BURN_CACHE_PROGRESS_TYPE_PAYLOAD_VERIFY; |
| @@ -2173,7 +2164,7 @@ static HRESULT CALLBACK CacheMessageHandler( | |||
| 2173 | switch (pProgress->type) | 2164 | switch (pProgress->type) |
| 2174 | { | 2165 | { |
| 2175 | case BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY: | 2166 | case BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY: |
| 2176 | hr = UserExperienceOnCacheContainerOrPayloadVerifyComplete(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, hr); | 2167 | hr = BACallbackOnCacheContainerOrPayloadVerifyComplete(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, hr); |
| 2177 | break; | 2168 | break; |
| 2178 | } | 2169 | } |
| 2179 | case BURN_CACHE_MESSAGE_FAILURE: | 2170 | case BURN_CACHE_MESSAGE_FAILURE: |
| @@ -2321,31 +2312,31 @@ static DWORD CALLBACK CacheProgressRoutine( | |||
| 2321 | switch (pProgress->type) | 2312 | switch (pProgress->type) |
| 2322 | { | 2313 | { |
| 2323 | case BURN_CACHE_PROGRESS_TYPE_ACQUIRE: | 2314 | case BURN_CACHE_PROGRESS_TYPE_ACQUIRE: |
| 2324 | hr = UserExperienceOnCacheAcquireProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage); | 2315 | hr = BACallbackOnCacheAcquireProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage); |
| 2325 | ExitOnRootFailure(hr, "BA aborted acquire of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); | 2316 | ExitOnRootFailure(hr, "BA aborted acquire of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); |
| 2326 | break; | 2317 | break; |
| 2327 | case BURN_CACHE_PROGRESS_TYPE_PAYLOAD_VERIFY: | 2318 | case BURN_CACHE_PROGRESS_TYPE_PAYLOAD_VERIFY: |
| 2328 | hr = UserExperienceOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_HASH); | 2319 | hr = BACallbackOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_HASH); |
| 2329 | ExitOnRootFailure(hr, "BA aborted payload verify step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); | 2320 | ExitOnRootFailure(hr, "BA aborted payload verify step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); |
| 2330 | break; | 2321 | break; |
| 2331 | case BURN_CACHE_PROGRESS_TYPE_STAGE: | 2322 | case BURN_CACHE_PROGRESS_TYPE_STAGE: |
| 2332 | hr = UserExperienceOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_STAGE); | 2323 | hr = BACallbackOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_STAGE); |
| 2333 | ExitOnRootFailure(hr, "BA aborted stage step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); | 2324 | ExitOnRootFailure(hr, "BA aborted stage step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); |
| 2334 | break; | 2325 | break; |
| 2335 | case BURN_CACHE_PROGRESS_TYPE_HASH: | 2326 | case BURN_CACHE_PROGRESS_TYPE_HASH: |
| 2336 | hr = UserExperienceOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_HASH); | 2327 | hr = BACallbackOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_HASH); |
| 2337 | ExitOnRootFailure(hr, "BA aborted hash step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); | 2328 | ExitOnRootFailure(hr, "BA aborted hash step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); |
| 2338 | break; | 2329 | break; |
| 2339 | case BURN_CACHE_PROGRESS_TYPE_FINALIZE: | 2330 | case BURN_CACHE_PROGRESS_TYPE_FINALIZE: |
| 2340 | hr = UserExperienceOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_FINALIZE); | 2331 | hr = BACallbackOnCacheVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage, BOOTSTRAPPER_CACHE_VERIFY_STEP_FINALIZE); |
| 2341 | ExitOnRootFailure(hr, "BA aborted finalize step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); | 2332 | ExitOnRootFailure(hr, "BA aborted finalize step during verify of %hs: %ls", pProgress->pContainer ? "container" : "payload", pProgress->pContainer ? wzPackageOrContainerId : wzPayloadId); |
| 2342 | break; | 2333 | break; |
| 2343 | case BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY: | 2334 | case BURN_CACHE_PROGRESS_TYPE_CONTAINER_OR_PAYLOAD_VERIFY: |
| 2344 | hr = UserExperienceOnCacheContainerOrPayloadVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage); | 2335 | hr = BACallbackOnCacheContainerOrPayloadVerifyProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage); |
| 2345 | ExitOnRootFailure(hr, "BA aborted container or payload verify: %ls", wzPayloadId); | 2336 | ExitOnRootFailure(hr, "BA aborted container or payload verify: %ls", wzPayloadId); |
| 2346 | break; | 2337 | break; |
| 2347 | case BURN_CACHE_PROGRESS_TYPE_EXTRACT: | 2338 | case BURN_CACHE_PROGRESS_TYPE_EXTRACT: |
| 2348 | hr = UserExperienceOnCachePayloadExtractProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage); | 2339 | hr = BACallbackOnCachePayloadExtractProgress(pProgress->pCacheContext->pUX, wzPackageOrContainerId, wzPayloadId, TotalBytesTransferred.QuadPart, TotalFileSize.QuadPart, dwOverallPercentage); |
| 2349 | ExitOnRootFailure(hr, "BA aborted extract container: %ls, payload: %ls", wzPackageOrContainerId, wzPayloadId); | 2340 | ExitOnRootFailure(hr, "BA aborted extract container: %ls, payload: %ls", wzPackageOrContainerId, wzPayloadId); |
| 2350 | break; | 2341 | break; |
| 2351 | } | 2342 | } |
| @@ -2752,14 +2743,14 @@ static HRESULT ExecuteRelatedBundle( | |||
| 2752 | fBeginCalled = TRUE; | 2743 | fBeginCalled = TRUE; |
| 2753 | 2744 | ||
| 2754 | // Send package execute begin to BA. | 2745 | // Send package execute begin to BA. |
| 2755 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->relatedBundle.action, INSTALLUILEVEL_NOCHANGE, FALSE); | 2746 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->relatedBundle.action, INSTALLUILEVEL_NOCHANGE, FALSE); |
| 2756 | ExitOnRootFailure(hr, "BA aborted execute related bundle begin."); | 2747 | ExitOnRootFailure(hr, "BA aborted execute related bundle begin."); |
| 2757 | 2748 | ||
| 2758 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | 2749 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; |
| 2759 | message.dwUIHint = MB_OKCANCEL; | 2750 | message.dwUIHint = MB_OKCANCEL; |
| 2760 | message.progress.dwPercentage = fRollback ? 100 : 0; | 2751 | message.progress.dwPercentage = fRollback ? 100 : 0; |
| 2761 | nResult = GenericExecuteMessageHandler(&message, pContext); | 2752 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 2762 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 2753 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 2763 | ExitOnRootFailure(hr, "BA aborted related bundle progress."); | 2754 | ExitOnRootFailure(hr, "BA aborted related bundle progress."); |
| 2764 | 2755 | ||
| 2765 | // Execute package. | 2756 | // Execute package. |
| @@ -2778,7 +2769,7 @@ static HRESULT ExecuteRelatedBundle( | |||
| 2778 | message.dwUIHint = MB_OKCANCEL; | 2769 | message.dwUIHint = MB_OKCANCEL; |
| 2779 | message.progress.dwPercentage = fRollback ? 0 : 100; | 2770 | message.progress.dwPercentage = fRollback ? 0 : 100; |
| 2780 | nResult = GenericExecuteMessageHandler(&message, pContext); | 2771 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 2781 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 2772 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 2782 | ExitOnRootFailure(hr, "BA aborted related bundle progress."); | 2773 | ExitOnRootFailure(hr, "BA aborted related bundle progress."); |
| 2783 | 2774 | ||
| 2784 | pContext->cExecutedPackages += fRollback ? -1 : 1; | 2775 | pContext->cExecutedPackages += fRollback ? -1 : 1; |
| @@ -2877,14 +2868,14 @@ static HRESULT ExecuteBundlePackage( | |||
| 2877 | fBeginCalled = TRUE; | 2868 | fBeginCalled = TRUE; |
| 2878 | 2869 | ||
| 2879 | // Send package execute begin to BA. | 2870 | // Send package execute begin to BA. |
| 2880 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->bundlePackage.action, INSTALLUILEVEL_NOCHANGE, FALSE); | 2871 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->bundlePackage.action, INSTALLUILEVEL_NOCHANGE, FALSE); |
| 2881 | ExitOnRootFailure(hr, "BA aborted execute BUNDLE package begin."); | 2872 | ExitOnRootFailure(hr, "BA aborted execute BUNDLE package begin."); |
| 2882 | 2873 | ||
| 2883 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | 2874 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; |
| 2884 | message.dwUIHint = MB_OKCANCEL; | 2875 | message.dwUIHint = MB_OKCANCEL; |
| 2885 | message.progress.dwPercentage = fRollback ? 100 : 0; | 2876 | message.progress.dwPercentage = fRollback ? 100 : 0; |
| 2886 | nResult = GenericExecuteMessageHandler(&message, pContext); | 2877 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 2887 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 2878 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 2888 | ExitOnRootFailure(hr, "BA aborted BUNDLE progress."); | 2879 | ExitOnRootFailure(hr, "BA aborted BUNDLE progress."); |
| 2889 | 2880 | ||
| 2890 | fExecuted = TRUE; | 2881 | fExecuted = TRUE; |
| @@ -2905,7 +2896,7 @@ static HRESULT ExecuteBundlePackage( | |||
| 2905 | message.dwUIHint = MB_OKCANCEL; | 2896 | message.dwUIHint = MB_OKCANCEL; |
| 2906 | message.progress.dwPercentage = fRollback ? 0 : 100; | 2897 | message.progress.dwPercentage = fRollback ? 0 : 100; |
| 2907 | nResult = GenericExecuteMessageHandler(&message, pContext); | 2898 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 2908 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 2899 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 2909 | ExitOnRootFailure(hr, "BA aborted BUNDLE progress."); | 2900 | ExitOnRootFailure(hr, "BA aborted BUNDLE progress."); |
| 2910 | 2901 | ||
| 2911 | pContext->cExecutedPackages += fRollback ? -1 : 1; | 2902 | pContext->cExecutedPackages += fRollback ? -1 : 1; |
| @@ -2957,14 +2948,14 @@ static HRESULT ExecuteExePackage( | |||
| 2957 | fBeginCalled = TRUE; | 2948 | fBeginCalled = TRUE; |
| 2958 | 2949 | ||
| 2959 | // Send package execute begin to BA. | 2950 | // Send package execute begin to BA. |
| 2960 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->exePackage.action, INSTALLUILEVEL_NOCHANGE, FALSE); | 2951 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->exePackage.action, INSTALLUILEVEL_NOCHANGE, FALSE); |
| 2961 | ExitOnRootFailure(hr, "BA aborted execute EXE package begin."); | 2952 | ExitOnRootFailure(hr, "BA aborted execute EXE package begin."); |
| 2962 | 2953 | ||
| 2963 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | 2954 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; |
| 2964 | message.dwUIHint = MB_OKCANCEL; | 2955 | message.dwUIHint = MB_OKCANCEL; |
| 2965 | message.progress.dwPercentage = fRollback ? 100 : 0; | 2956 | message.progress.dwPercentage = fRollback ? 100 : 0; |
| 2966 | nResult = GenericExecuteMessageHandler(&message, pContext); | 2957 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 2967 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 2958 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 2968 | ExitOnRootFailure(hr, "BA aborted EXE progress."); | 2959 | ExitOnRootFailure(hr, "BA aborted EXE progress."); |
| 2969 | 2960 | ||
| 2970 | fExecuted = TRUE; | 2961 | fExecuted = TRUE; |
| @@ -2985,7 +2976,7 @@ static HRESULT ExecuteExePackage( | |||
| 2985 | message.dwUIHint = MB_OKCANCEL; | 2976 | message.dwUIHint = MB_OKCANCEL; |
| 2986 | message.progress.dwPercentage = fRollback ? 0 : 100; | 2977 | message.progress.dwPercentage = fRollback ? 0 : 100; |
| 2987 | nResult = GenericExecuteMessageHandler(&message, pContext); | 2978 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 2988 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 2979 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 2989 | ExitOnRootFailure(hr, "BA aborted EXE progress."); | 2980 | ExitOnRootFailure(hr, "BA aborted EXE progress."); |
| 2990 | 2981 | ||
| 2991 | pContext->cExecutedPackages += fRollback ? -1 : 1; | 2982 | pContext->cExecutedPackages += fRollback ? -1 : 1; |
| @@ -3036,7 +3027,7 @@ static HRESULT ExecuteMsiPackage( | |||
| 3036 | fBeginCalled = TRUE; | 3027 | fBeginCalled = TRUE; |
| 3037 | 3028 | ||
| 3038 | // Send package execute begin to BA. | 3029 | // Send package execute begin to BA. |
| 3039 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->msiPackage.action, pExecuteAction->msiPackage.uiLevel, pExecuteAction->msiPackage.fDisableExternalUiHandler); | 3030 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->msiPackage.action, pExecuteAction->msiPackage.uiLevel, pExecuteAction->msiPackage.fDisableExternalUiHandler); |
| 3040 | ExitOnRootFailure(hr, "BA aborted execute MSI package begin."); | 3031 | ExitOnRootFailure(hr, "BA aborted execute MSI package begin."); |
| 3041 | 3032 | ||
| 3042 | fExecuted = TRUE; | 3033 | fExecuted = TRUE; |
| @@ -3101,7 +3092,7 @@ static HRESULT ExecuteMspPackage( | |||
| 3101 | fBeginCalled = TRUE; | 3092 | fBeginCalled = TRUE; |
| 3102 | 3093 | ||
| 3103 | // Send package execute begin to BA. | 3094 | // Send package execute begin to BA. |
| 3104 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->mspTarget.action, pExecuteAction->mspTarget.uiLevel, pExecuteAction->mspTarget.fDisableExternalUiHandler); | 3095 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->mspTarget.action, pExecuteAction->mspTarget.uiLevel, pExecuteAction->mspTarget.fDisableExternalUiHandler); |
| 3105 | ExitOnRootFailure(hr, "BA aborted execute MSP package begin."); | 3096 | ExitOnRootFailure(hr, "BA aborted execute MSP package begin."); |
| 3106 | 3097 | ||
| 3107 | // Now send all the patches that target this product code. | 3098 | // Now send all the patches that target this product code. |
| @@ -3109,7 +3100,7 @@ static HRESULT ExecuteMspPackage( | |||
| 3109 | { | 3100 | { |
| 3110 | BURN_PACKAGE* pMspPackage = pExecuteAction->mspTarget.rgOrderedPatches[i].pPackage; | 3101 | BURN_PACKAGE* pMspPackage = pExecuteAction->mspTarget.rgOrderedPatches[i].pPackage; |
| 3111 | 3102 | ||
| 3112 | hr = UserExperienceOnExecutePatchTarget(&pEngineState->userExperience, pMspPackage->sczId, pExecuteAction->mspTarget.sczTargetProductCode); | 3103 | hr = BACallbackOnExecutePatchTarget(&pEngineState->userExperience, pMspPackage->sczId, pExecuteAction->mspTarget.sczTargetProductCode); |
| 3113 | ExitOnRootFailure(hr, "BA aborted execute MSP target."); | 3104 | ExitOnRootFailure(hr, "BA aborted execute MSP target."); |
| 3114 | } | 3105 | } |
| 3115 | 3106 | ||
| @@ -3177,14 +3168,14 @@ static HRESULT ExecuteMsuPackage( | |||
| 3177 | fBeginCalled = TRUE; | 3168 | fBeginCalled = TRUE; |
| 3178 | 3169 | ||
| 3179 | // Send package execute begin to BA. | 3170 | // Send package execute begin to BA. |
| 3180 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->msuPackage.action, INSTALLUILEVEL_NOCHANGE, FALSE); | 3171 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->msuPackage.action, INSTALLUILEVEL_NOCHANGE, FALSE); |
| 3181 | ExitOnRootFailure(hr, "BA aborted execute MSU package begin."); | 3172 | ExitOnRootFailure(hr, "BA aborted execute MSU package begin."); |
| 3182 | 3173 | ||
| 3183 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | 3174 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; |
| 3184 | message.dwUIHint = MB_OKCANCEL; | 3175 | message.dwUIHint = MB_OKCANCEL; |
| 3185 | message.progress.dwPercentage = fRollback ? 100 : 0; | 3176 | message.progress.dwPercentage = fRollback ? 100 : 0; |
| 3186 | nResult = GenericExecuteMessageHandler(&message, pContext); | 3177 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 3187 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 3178 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 3188 | ExitOnRootFailure(hr, "BA aborted MSU progress."); | 3179 | ExitOnRootFailure(hr, "BA aborted MSU progress."); |
| 3189 | 3180 | ||
| 3190 | fExecuted = TRUE; | 3181 | fExecuted = TRUE; |
| @@ -3205,7 +3196,7 @@ static HRESULT ExecuteMsuPackage( | |||
| 3205 | message.dwUIHint = MB_OKCANCEL; | 3196 | message.dwUIHint = MB_OKCANCEL; |
| 3206 | message.progress.dwPercentage = fRollback ? 0 : 100; | 3197 | message.progress.dwPercentage = fRollback ? 0 : 100; |
| 3207 | nResult = GenericExecuteMessageHandler(&message, pContext); | 3198 | nResult = GenericExecuteMessageHandler(&message, pContext); |
| 3208 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | 3199 | hr = BootstrapperApplicationInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); |
| 3209 | ExitOnRootFailure(hr, "BA aborted MSU progress."); | 3200 | ExitOnRootFailure(hr, "BA aborted MSU progress."); |
| 3210 | 3201 | ||
| 3211 | pContext->cExecutedPackages += fRollback ? -1 : 1; | 3202 | pContext->cExecutedPackages += fRollback ? -1 : 1; |
| @@ -3351,7 +3342,7 @@ static HRESULT ExecuteMsiBeginTransaction( | |||
| 3351 | } | 3342 | } |
| 3352 | 3343 | ||
| 3353 | fBeginCalled = TRUE; | 3344 | fBeginCalled = TRUE; |
| 3354 | hr = UserExperienceOnBeginMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); | 3345 | hr = BACallbackOnBeginMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); |
| 3355 | ExitOnRootFailure(hr, "BA aborted execute begin MSI transaction."); | 3346 | ExitOnRootFailure(hr, "BA aborted execute begin MSI transaction."); |
| 3356 | 3347 | ||
| 3357 | if (pEngineState->plan.fPerMachine) | 3348 | if (pEngineState->plan.fPerMachine) |
| @@ -3374,7 +3365,7 @@ static HRESULT ExecuteMsiBeginTransaction( | |||
| 3374 | LExit: | 3365 | LExit: |
| 3375 | if (fBeginCalled) | 3366 | if (fBeginCalled) |
| 3376 | { | 3367 | { |
| 3377 | UserExperienceOnBeginMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr); | 3368 | BACallbackOnBeginMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr); |
| 3378 | } | 3369 | } |
| 3379 | 3370 | ||
| 3380 | return hr; | 3371 | return hr; |
| @@ -3397,7 +3388,7 @@ static HRESULT ExecuteMsiCommitTransaction( | |||
| 3397 | } | 3388 | } |
| 3398 | 3389 | ||
| 3399 | fCommitBeginCalled = TRUE; | 3390 | fCommitBeginCalled = TRUE; |
| 3400 | hr = UserExperienceOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); | 3391 | hr = BACallbackOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); |
| 3401 | ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction."); | 3392 | ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction."); |
| 3402 | 3393 | ||
| 3403 | if (pEngineState->plan.fPerMachine) | 3394 | if (pEngineState->plan.fPerMachine) |
| @@ -3418,7 +3409,7 @@ static HRESULT ExecuteMsiCommitTransaction( | |||
| 3418 | LExit: | 3409 | LExit: |
| 3419 | if (fCommitBeginCalled) | 3410 | if (fCommitBeginCalled) |
| 3420 | { | 3411 | { |
| 3421 | UserExperienceOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr, *pRestart, &action); | 3412 | BACallbackOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr, *pRestart, &action); |
| 3422 | 3413 | ||
| 3423 | if (action == BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION_RESTART) | 3414 | if (action == BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION_RESTART) |
| 3424 | { | 3415 | { |
| @@ -3446,7 +3437,7 @@ static HRESULT ExecuteMsiRollbackTransaction( | |||
| 3446 | } | 3437 | } |
| 3447 | 3438 | ||
| 3448 | fRollbackBeginCalled = TRUE; | 3439 | fRollbackBeginCalled = TRUE; |
| 3449 | UserExperienceOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); | 3440 | BACallbackOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); |
| 3450 | 3441 | ||
| 3451 | if (pEngineState->plan.fPerMachine) | 3442 | if (pEngineState->plan.fPerMachine) |
| 3452 | { | 3443 | { |
| @@ -3465,7 +3456,7 @@ LExit: | |||
| 3465 | 3456 | ||
| 3466 | if (fRollbackBeginCalled) | 3457 | if (fRollbackBeginCalled) |
| 3467 | { | 3458 | { |
| 3468 | UserExperienceOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr, *pRestart, &action); | 3459 | BACallbackOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr, *pRestart, &action); |
| 3469 | 3460 | ||
| 3470 | if (action == BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION_RESTART) | 3461 | if (action == BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION_RESTART) |
| 3471 | { | 3462 | { |
| @@ -3531,7 +3522,7 @@ static HRESULT ExecuteUninstallMsiCompatiblePackage( | |||
| 3531 | fBeginCalled = TRUE; | 3522 | fBeginCalled = TRUE; |
| 3532 | 3523 | ||
| 3533 | // Send package execute begin to BA. | 3524 | // Send package execute begin to BA. |
| 3534 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pContext->wzExecutingPackageId, !fRollback, action, uiLevel, fDisableExternalUiHandler); | 3525 | hr = BACallbackOnExecutePackageBegin(&pEngineState->userExperience, pContext->wzExecutingPackageId, !fRollback, action, uiLevel, fDisableExternalUiHandler); |
| 3535 | ExitOnRootFailure(hr, "BA aborted execute MSI compatible package begin."); | 3526 | ExitOnRootFailure(hr, "BA aborted execute MSI compatible package begin."); |
| 3536 | 3527 | ||
| 3537 | // execute package | 3528 | // execute package |
| @@ -3622,14 +3613,14 @@ static int GenericExecuteMessageHandler( | |||
| 3622 | case GENERIC_EXECUTE_MESSAGE_PROGRESS: | 3613 | case GENERIC_EXECUTE_MESSAGE_PROGRESS: |
| 3623 | { | 3614 | { |
| 3624 | DWORD dwOverallProgress = pContext->cExecutePackagesTotal ? (pContext->cExecutedPackages * 100 + pMessage->progress.dwPercentage) / (pContext->cExecutePackagesTotal) : 0; | 3615 | DWORD dwOverallProgress = pContext->cExecutePackagesTotal ? (pContext->cExecutedPackages * 100 + pMessage->progress.dwPercentage) / (pContext->cExecutePackagesTotal) : 0; |
| 3625 | UserExperienceOnExecuteProgress(pContext->pUX, pContext->wzExecutingPackageId, pMessage->progress.dwPercentage, dwOverallProgress, &nResult); // ignore return value. | 3616 | BACallbackOnExecuteProgress(pContext->pUX, pContext->wzExecutingPackageId, pMessage->progress.dwPercentage, dwOverallProgress, &nResult); // ignore return value. |
| 3626 | } | 3617 | } |
| 3627 | break; | 3618 | break; |
| 3628 | 3619 | ||
| 3629 | case GENERIC_EXECUTE_MESSAGE_PROCESS_CANCEL: | 3620 | case GENERIC_EXECUTE_MESSAGE_PROCESS_CANCEL: |
| 3630 | { | 3621 | { |
| 3631 | BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION action = BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION_ABANDON; | 3622 | BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION action = BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION_ABANDON; |
| 3632 | UserExperienceOnExecuteProcessCancel(pContext->pUX, pContext->wzExecutingPackageId, pMessage->processCancel.dwProcessId, &action); // ignore return value. | 3623 | BACallbackOnExecuteProcessCancel(pContext->pUX, pContext->wzExecutingPackageId, pMessage->processCancel.dwProcessId, &action); // ignore return value. |
| 3633 | nResult = BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION_WAIT == action ? IDRETRY : IDIGNORE; | 3624 | nResult = BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION_WAIT == action ? IDRETRY : IDIGNORE; |
| 3634 | } | 3625 | } |
| 3635 | break; | 3626 | break; |
| @@ -3643,18 +3634,18 @@ static int GenericExecuteMessageHandler( | |||
| 3643 | break; | 3634 | break; |
| 3644 | 3635 | ||
| 3645 | case GENERIC_EXECUTE_MESSAGE_ERROR: | 3636 | case GENERIC_EXECUTE_MESSAGE_ERROR: |
| 3646 | UserExperienceOnError(pContext->pUX, BOOTSTRAPPER_ERROR_TYPE_EXE_PACKAGE, pContext->wzExecutingPackageId, pMessage->error.dwErrorCode, pMessage->error.wzMessage, pMessage->dwUIHint, 0, NULL, &nResult); // ignore return value. | 3637 | BACallbackOnError(pContext->pUX, BOOTSTRAPPER_ERROR_TYPE_EXE_PACKAGE, pContext->wzExecutingPackageId, pMessage->error.dwErrorCode, pMessage->error.wzMessage, pMessage->dwUIHint, 0, NULL, &nResult); // ignore return value. |
| 3647 | break; | 3638 | break; |
| 3648 | 3639 | ||
| 3649 | case GENERIC_EXECUTE_MESSAGE_NETFX_FILES_IN_USE: | 3640 | case GENERIC_EXECUTE_MESSAGE_NETFX_FILES_IN_USE: |
| 3650 | UserExperienceOnExecuteFilesInUse(pContext->pUX, pContext->wzExecutingPackageId, pMessage->filesInUse.cFiles, pMessage->filesInUse.rgwzFiles, BOOTSTRAPPER_FILES_IN_USE_TYPE_NETFX, &nResult); // ignore return value. | 3641 | BACallbackOnExecuteFilesInUse(pContext->pUX, pContext->wzExecutingPackageId, pMessage->filesInUse.cFiles, pMessage->filesInUse.rgwzFiles, BOOTSTRAPPER_FILES_IN_USE_TYPE_NETFX, &nResult); // ignore return value. |
| 3651 | fPassthrough = TRUE; | 3642 | fPassthrough = TRUE; |
| 3652 | break; | 3643 | break; |
| 3653 | } | 3644 | } |
| 3654 | 3645 | ||
| 3655 | if (!fPassthrough) | 3646 | if (!fPassthrough) |
| 3656 | { | 3647 | { |
| 3657 | nResult = UserExperienceCheckExecuteResult(pContext->pUX, pContext->fRollback, dwAllowedResults, nResult); | 3648 | nResult = BootstrapperApplicationCheckExecuteResult(pContext->pUX, pContext->fRollback, dwAllowedResults, nResult); |
| 3658 | } | 3649 | } |
| 3659 | 3650 | ||
| 3660 | return nResult; | 3651 | return nResult; |
| @@ -3676,32 +3667,32 @@ static int MsiExecuteMessageHandler( | |||
| 3676 | case WIU_MSI_EXECUTE_MESSAGE_PROGRESS: | 3667 | case WIU_MSI_EXECUTE_MESSAGE_PROGRESS: |
| 3677 | { | 3668 | { |
| 3678 | DWORD dwOverallProgress = pContext->cExecutePackagesTotal ? (pContext->cExecutedPackages * 100 + pMessage->progress.dwPercentage) / (pContext->cExecutePackagesTotal) : 0; | 3669 | DWORD dwOverallProgress = pContext->cExecutePackagesTotal ? (pContext->cExecutedPackages * 100 + pMessage->progress.dwPercentage) / (pContext->cExecutePackagesTotal) : 0; |
| 3679 | UserExperienceOnExecuteProgress(pContext->pUX, pContext->wzExecutingPackageId, pMessage->progress.dwPercentage, dwOverallProgress, &nResult); // ignore return value. | 3670 | BACallbackOnExecuteProgress(pContext->pUX, pContext->wzExecutingPackageId, pMessage->progress.dwPercentage, dwOverallProgress, &nResult); // ignore return value. |
| 3680 | } | 3671 | } |
| 3681 | break; | 3672 | break; |
| 3682 | 3673 | ||
| 3683 | case WIU_MSI_EXECUTE_MESSAGE_ERROR: | 3674 | case WIU_MSI_EXECUTE_MESSAGE_ERROR: |
| 3684 | nResult = pMessage->nResultRecommendation; | 3675 | nResult = pMessage->nResultRecommendation; |
| 3685 | UserExperienceOnError(pContext->pUX, BOOTSTRAPPER_ERROR_TYPE_WINDOWS_INSTALLER, pContext->wzExecutingPackageId, pMessage->error.dwErrorCode, pMessage->error.wzMessage, pMessage->dwUIHint, pMessage->cData, pMessage->rgwzData, &nResult); // ignore return value. | 3676 | BACallbackOnError(pContext->pUX, BOOTSTRAPPER_ERROR_TYPE_WINDOWS_INSTALLER, pContext->wzExecutingPackageId, pMessage->error.dwErrorCode, pMessage->error.wzMessage, pMessage->dwUIHint, pMessage->cData, pMessage->rgwzData, &nResult); // ignore return value. |
| 3686 | break; | 3677 | break; |
| 3687 | 3678 | ||
| 3688 | case WIU_MSI_EXECUTE_MESSAGE_MSI_MESSAGE: | 3679 | case WIU_MSI_EXECUTE_MESSAGE_MSI_MESSAGE: |
| 3689 | nResult = pMessage->nResultRecommendation; | 3680 | nResult = pMessage->nResultRecommendation; |
| 3690 | UserExperienceOnExecuteMsiMessage(pContext->pUX, pContext->wzExecutingPackageId, pMessage->msiMessage.mt, pMessage->dwUIHint, pMessage->msiMessage.wzMessage, pMessage->cData, pMessage->rgwzData, &nResult); // ignore return value. | 3681 | BACallbackOnExecuteMsiMessage(pContext->pUX, pContext->wzExecutingPackageId, pMessage->msiMessage.mt, pMessage->dwUIHint, pMessage->msiMessage.wzMessage, pMessage->cData, pMessage->rgwzData, &nResult); // ignore return value. |
| 3691 | break; | 3682 | break; |
| 3692 | 3683 | ||
| 3693 | case WIU_MSI_EXECUTE_MESSAGE_MSI_RM_FILES_IN_USE: | 3684 | case WIU_MSI_EXECUTE_MESSAGE_MSI_RM_FILES_IN_USE: |
| 3694 | fRestartManager = TRUE; | 3685 | fRestartManager = TRUE; |
| 3695 | __fallthrough; | 3686 | __fallthrough; |
| 3696 | case WIU_MSI_EXECUTE_MESSAGE_MSI_FILES_IN_USE: | 3687 | case WIU_MSI_EXECUTE_MESSAGE_MSI_FILES_IN_USE: |
| 3697 | UserExperienceOnExecuteFilesInUse(pContext->pUX, pContext->wzExecutingPackageId, pMessage->msiFilesInUse.cFiles, pMessage->msiFilesInUse.rgwzFiles, fRestartManager ? BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM : BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI, &nResult); // ignore return value. | 3688 | BACallbackOnExecuteFilesInUse(pContext->pUX, pContext->wzExecutingPackageId, pMessage->msiFilesInUse.cFiles, pMessage->msiFilesInUse.rgwzFiles, fRestartManager ? BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM : BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI, &nResult); // ignore return value. |
| 3698 | fPassthrough = TRUE; | 3689 | fPassthrough = TRUE; |
| 3699 | break; | 3690 | break; |
| 3700 | } | 3691 | } |
| 3701 | 3692 | ||
| 3702 | if (!fPassthrough) | 3693 | if (!fPassthrough) |
| 3703 | { | 3694 | { |
| 3704 | nResult = UserExperienceCheckExecuteResult(pContext->pUX, pContext->fRollback, dwAllowedResults, nResult); | 3695 | nResult = BootstrapperApplicationCheckExecuteResult(pContext->pUX, pContext->fRollback, dwAllowedResults, nResult); |
| 3705 | } | 3696 | } |
| 3706 | 3697 | ||
| 3707 | return nResult; | 3698 | return nResult; |
| @@ -3724,7 +3715,7 @@ static HRESULT ReportOverallProgressTicks( | |||
| 3724 | dwProgress = cOverallProgressTicksTotal ? (pApplyContext->cOverallProgressTicks * 100 / cOverallProgressTicksTotal) : 0; | 3715 | dwProgress = cOverallProgressTicksTotal ? (pApplyContext->cOverallProgressTicks * 100 / cOverallProgressTicksTotal) : 0; |
| 3725 | 3716 | ||
| 3726 | // TODO: consider sending different progress numbers in the future. | 3717 | // TODO: consider sending different progress numbers in the future. |
| 3727 | hr = UserExperienceOnProgress(pUX, fRollback, dwProgress, dwProgress); | 3718 | hr = BACallbackOnProgress(pUX, fRollback, dwProgress, dwProgress); |
| 3728 | 3719 | ||
| 3729 | ::LeaveCriticalSection(&pApplyContext->csApply); | 3720 | ::LeaveCriticalSection(&pApplyContext->csApply); |
| 3730 | 3721 | ||
| @@ -3755,7 +3746,7 @@ static HRESULT ExecutePackageComplete( | |||
| 3755 | } | 3746 | } |
| 3756 | 3747 | ||
| 3757 | // Send package execute complete to BA. | 3748 | // Send package execute complete to BA. |
| 3758 | UserExperienceOnExecutePackageComplete(pUX, wzPackageId, hr, *pRestart, &executePackageCompleteAction); | 3749 | BACallbackOnExecutePackageComplete(pUX, wzPackageId, hr, *pRestart, &executePackageCompleteAction); |
| 3759 | if (BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART == executePackageCompleteAction) | 3750 | if (BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART == executePackageCompleteAction) |
| 3760 | { | 3751 | { |
| 3761 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_INITIATED; | 3752 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_INITIATED; |
diff --git a/src/burn/engine/bacallback.cpp b/src/burn/engine/bacallback.cpp new file mode 100644 index 00000000..f4e6894d --- /dev/null +++ b/src/burn/engine/bacallback.cpp | |||
| @@ -0,0 +1,5893 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | // internal function declarations | ||
| 6 | |||
| 7 | static HRESULT FilterExecuteResult( | ||
| 8 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 9 | __in HRESULT hrStatus, | ||
| 10 | __in BOOL fRollback, | ||
| 11 | __in BOOL fCancel, | ||
| 12 | __in LPCWSTR sczEventName | ||
| 13 | ); | ||
| 14 | static HRESULT SendBAMessage( | ||
| 15 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 16 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
| 17 | __in BUFF_BUFFER* pBufferArgs, | ||
| 18 | __in BUFF_BUFFER* pBufferResults, | ||
| 19 | __in PIPE_RPC_RESULT* pResult | ||
| 20 | ); | ||
| 21 | static HRESULT SendBAMessageFromInactiveEngine( | ||
| 22 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 23 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
| 24 | __in BUFF_BUFFER* pBufferArgs, | ||
| 25 | __in BUFF_BUFFER* pBufferResults, | ||
| 26 | __in PIPE_RPC_RESULT* pResult | ||
| 27 | ); | ||
| 28 | static HRESULT CombineArgsAndResults( | ||
| 29 | __in BUFF_BUFFER* pBufferArgs, | ||
| 30 | __in BUFF_BUFFER* pBufferResults, | ||
| 31 | __in BUFF_BUFFER* pBufferCombined | ||
| 32 | ); | ||
| 33 | |||
| 34 | // function definitions | ||
| 35 | |||
| 36 | EXTERN_C HRESULT BACallbackOnApplyBegin( | ||
| 37 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 38 | __in DWORD dwPhaseCount | ||
| 39 | ) | ||
| 40 | { | ||
| 41 | HRESULT hr = S_OK; | ||
| 42 | BA_ONAPPLYBEGIN_ARGS args = { }; | ||
| 43 | BA_ONAPPLYBEGIN_RESULTS results = { }; | ||
| 44 | BUFF_BUFFER bufferArgs = { }; | ||
| 45 | BUFF_BUFFER bufferResults = { }; | ||
| 46 | PIPE_RPC_RESULT rpc = { }; | ||
| 47 | SIZE_T iBuffer = 0; | ||
| 48 | |||
| 49 | // Init structs. | ||
| 50 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 51 | args.dwPhaseCount = dwPhaseCount; | ||
| 52 | |||
| 53 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 54 | |||
| 55 | // Send args. | ||
| 56 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 57 | ExitOnFailure(hr, "Failed to write API version of OnApplyBegin args."); | ||
| 58 | |||
| 59 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwPhaseCount); | ||
| 60 | ExitOnFailure(hr, "Failed to write phase count of OnApplyBegin args command."); | ||
| 61 | |||
| 62 | // Send results. | ||
| 63 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 64 | ExitOnFailure(hr, "Failed to write API version of OnApplyBegin results."); | ||
| 65 | |||
| 66 | // Callback. | ||
| 67 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 68 | ExitOnFailure(hr, "BA OnApplyBegin failed."); | ||
| 69 | |||
| 70 | if (S_FALSE == hr) | ||
| 71 | { | ||
| 72 | ExitFunction(); | ||
| 73 | } | ||
| 74 | |||
| 75 | // Read results. | ||
| 76 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 77 | ExitOnFailure(hr, "Failed to read size of OnApplyBegin result."); | ||
| 78 | |||
| 79 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 80 | ExitOnFailure(hr, "Failed to read cancel of OnApplyBegin result."); | ||
| 81 | |||
| 82 | if (results.fCancel) | ||
| 83 | { | ||
| 84 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 85 | } | ||
| 86 | |||
| 87 | LExit: | ||
| 88 | PipeFreeRpcResult(&rpc); | ||
| 89 | ReleaseBuffer(bufferResults); | ||
| 90 | ReleaseBuffer(bufferArgs); | ||
| 91 | |||
| 92 | return hr; | ||
| 93 | } | ||
| 94 | |||
| 95 | EXTERN_C HRESULT BACallbackOnApplyComplete( | ||
| 96 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 97 | __in HRESULT hrStatus, | ||
| 98 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 99 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction | ||
| 100 | ) | ||
| 101 | { | ||
| 102 | HRESULT hr = S_OK; | ||
| 103 | BA_ONAPPLYCOMPLETE_ARGS args = { }; | ||
| 104 | BA_ONAPPLYCOMPLETE_RESULTS results = { }; | ||
| 105 | BUFF_BUFFER bufferArgs = { }; | ||
| 106 | BUFF_BUFFER bufferResults = { }; | ||
| 107 | PIPE_RPC_RESULT rpc = { }; | ||
| 108 | SIZE_T iBuffer = 0; | ||
| 109 | |||
| 110 | // Init structs. | ||
| 111 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 112 | args.hrStatus = hrStatus; | ||
| 113 | args.restart = restart; | ||
| 114 | args.recommendation = *pAction; | ||
| 115 | |||
| 116 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 117 | results.action = *pAction; | ||
| 118 | |||
| 119 | // Send args. | ||
| 120 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 121 | ExitOnFailure(hr, "Failed to write API version of OnApplyComplete args."); | ||
| 122 | |||
| 123 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 124 | ExitOnFailure(hr, "Failed to write status of OnApplyComplete args."); | ||
| 125 | |||
| 126 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.restart); | ||
| 127 | ExitOnFailure(hr, "Failed to write restart of OnApplyComplete args."); | ||
| 128 | |||
| 129 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 130 | ExitOnFailure(hr, "Failed to write recommended action of OnApplyComplete args."); | ||
| 131 | |||
| 132 | // Send results. | ||
| 133 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 134 | ExitOnFailure(hr, "Failed to write API version of OnApplyComplete results."); | ||
| 135 | |||
| 136 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 137 | ExitOnFailure(hr, "Failed to write default action of OnApplyComplete results."); | ||
| 138 | |||
| 139 | // Callback. | ||
| 140 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 141 | ExitOnFailure(hr, "BA OnApplyComplete failed."); | ||
| 142 | |||
| 143 | if (S_FALSE == hr) | ||
| 144 | { | ||
| 145 | ExitFunction(); | ||
| 146 | } | ||
| 147 | |||
| 148 | // Read results. | ||
| 149 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 150 | ExitOnFailure(hr, "Failed to read size of OnApplyComplete result."); | ||
| 151 | |||
| 152 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 153 | ExitOnFailure(hr, "Failed to read action of OnApplyComplete result."); | ||
| 154 | |||
| 155 | *pAction = results.action; | ||
| 156 | |||
| 157 | LExit: | ||
| 158 | PipeFreeRpcResult(&rpc); | ||
| 159 | ReleaseBuffer(bufferResults); | ||
| 160 | ReleaseBuffer(bufferArgs); | ||
| 161 | |||
| 162 | return hr; | ||
| 163 | } | ||
| 164 | |||
| 165 | EXTERN_C HRESULT BACallbackOnApplyDowngrade( | ||
| 166 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 167 | __inout HRESULT* phrStatus | ||
| 168 | ) | ||
| 169 | { | ||
| 170 | HRESULT hr = S_OK; | ||
| 171 | BA_ONAPPLYDOWNGRADE_ARGS args = { }; | ||
| 172 | BA_ONAPPLYDOWNGRADE_RESULTS results = { }; | ||
| 173 | BUFF_BUFFER bufferArgs = { }; | ||
| 174 | BUFF_BUFFER bufferResults = { }; | ||
| 175 | PIPE_RPC_RESULT rpc = { }; | ||
| 176 | SIZE_T iBuffer = 0; | ||
| 177 | |||
| 178 | // Init structs. | ||
| 179 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 180 | args.hrRecommended = *phrStatus; | ||
| 181 | |||
| 182 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 183 | results.hrStatus = *phrStatus; | ||
| 184 | |||
| 185 | // Send args. | ||
| 186 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 187 | ExitOnFailure(hr, "Failed to write API version of OnApplyDowngrade args."); | ||
| 188 | |||
| 189 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrRecommended); | ||
| 190 | ExitOnFailure(hr, "Failed to write recommended status of OnApplyDowngrade args."); | ||
| 191 | |||
| 192 | // Send results. | ||
| 193 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 194 | ExitOnFailure(hr, "Failed to write API version of OnApplyDowngrade results."); | ||
| 195 | |||
| 196 | hr = BuffWriteNumberToBuffer(&bufferResults, results.hrStatus); | ||
| 197 | ExitOnFailure(hr, "Failed to write default action of OnApplyDowngrade results."); | ||
| 198 | |||
| 199 | // Callback. | ||
| 200 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, &bufferArgs, &bufferResults, &rpc); | ||
| 201 | ExitOnFailure(hr, "BA OnApplyDowngrade failed."); | ||
| 202 | |||
| 203 | if (S_FALSE == hr) | ||
| 204 | { | ||
| 205 | ExitFunction(); | ||
| 206 | } | ||
| 207 | |||
| 208 | // Read results. | ||
| 209 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 210 | ExitOnFailure(hr, "Failed to read size of OnApplyDowngrade result."); | ||
| 211 | |||
| 212 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.hrStatus)); | ||
| 213 | ExitOnFailure(hr, "Failed to read action of OnApplyDowngrade result."); | ||
| 214 | |||
| 215 | *phrStatus = results.hrStatus; | ||
| 216 | |||
| 217 | LExit: | ||
| 218 | PipeFreeRpcResult(&rpc); | ||
| 219 | ReleaseBuffer(bufferResults); | ||
| 220 | ReleaseBuffer(bufferArgs); | ||
| 221 | |||
| 222 | return hr; | ||
| 223 | } | ||
| 224 | |||
| 225 | EXTERN_C HRESULT BACallbackOnBeginMsiTransactionBegin( | ||
| 226 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 227 | __in LPCWSTR wzTransactionId | ||
| 228 | ) | ||
| 229 | { | ||
| 230 | HRESULT hr = S_OK; | ||
| 231 | BA_ONBEGINMSITRANSACTIONBEGIN_ARGS args = { }; | ||
| 232 | BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS results = { }; | ||
| 233 | BUFF_BUFFER bufferArgs = { }; | ||
| 234 | BUFF_BUFFER bufferResults = { }; | ||
| 235 | PIPE_RPC_RESULT rpc = { }; | ||
| 236 | SIZE_T iBuffer = 0; | ||
| 237 | |||
| 238 | // Init structs. | ||
| 239 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 240 | args.wzTransactionId = wzTransactionId; | ||
| 241 | |||
| 242 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 243 | |||
| 244 | // Send args. | ||
| 245 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 246 | ExitOnFailure(hr, "Failed to write API version of OnBeginMsiTransactionBegin args."); | ||
| 247 | |||
| 248 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTransactionId); | ||
| 249 | ExitOnFailure(hr, "Failed to write recommended status of OnBeginMsiTransactionBegin args."); | ||
| 250 | |||
| 251 | // Send results. | ||
| 252 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 253 | ExitOnFailure(hr, "Failed to write API version of OnBeginMsiTransactionBegin results."); | ||
| 254 | |||
| 255 | // Callback. | ||
| 256 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 257 | ExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed."); | ||
| 258 | |||
| 259 | if (S_FALSE == hr) | ||
| 260 | { | ||
| 261 | ExitFunction(); | ||
| 262 | } | ||
| 263 | |||
| 264 | // Read results. | ||
| 265 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 266 | ExitOnFailure(hr, "Failed to read size of OnBeginMsiTransactionBegin result."); | ||
| 267 | |||
| 268 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 269 | ExitOnFailure(hr, "Failed to read action of OnBeginMsiTransactionBegin result."); | ||
| 270 | |||
| 271 | if (results.fCancel) | ||
| 272 | { | ||
| 273 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 274 | } | ||
| 275 | |||
| 276 | LExit: | ||
| 277 | PipeFreeRpcResult(&rpc); | ||
| 278 | ReleaseBuffer(bufferResults); | ||
| 279 | ReleaseBuffer(bufferArgs); | ||
| 280 | |||
| 281 | return hr; | ||
| 282 | } | ||
| 283 | |||
| 284 | EXTERN_C HRESULT BACallbackOnBeginMsiTransactionComplete( | ||
| 285 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 286 | __in LPCWSTR wzTransactionId, | ||
| 287 | __in HRESULT hrStatus | ||
| 288 | ) | ||
| 289 | { | ||
| 290 | HRESULT hr = S_OK; | ||
| 291 | BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS args = { }; | ||
| 292 | BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS results = { }; | ||
| 293 | BUFF_BUFFER bufferArgs = { }; | ||
| 294 | BUFF_BUFFER bufferResults = { }; | ||
| 295 | PIPE_RPC_RESULT rpc = { }; | ||
| 296 | |||
| 297 | // Init structs. | ||
| 298 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 299 | args.wzTransactionId = wzTransactionId; | ||
| 300 | args.hrStatus = hrStatus; | ||
| 301 | |||
| 302 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 303 | |||
| 304 | // Send args. | ||
| 305 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 306 | ExitOnFailure(hr, "Failed to write API version of OnBeginMsiTransactionComplete args."); | ||
| 307 | |||
| 308 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTransactionId); | ||
| 309 | ExitOnFailure(hr, "Failed to write recommended status of OnBeginMsiTransactionComplete args."); | ||
| 310 | |||
| 311 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 312 | ExitOnFailure(hr, "Failed to write status of OnBeginMsiTransactionComplete args."); | ||
| 313 | |||
| 314 | // Send results. | ||
| 315 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 316 | ExitOnFailure(hr, "Failed to write API version of OnBeginMsiTransactionComplete results."); | ||
| 317 | |||
| 318 | // Callback. | ||
| 319 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 320 | ExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed."); | ||
| 321 | |||
| 322 | if (S_FALSE == hr) | ||
| 323 | { | ||
| 324 | ExitFunction(); | ||
| 325 | } | ||
| 326 | |||
| 327 | LExit: | ||
| 328 | PipeFreeRpcResult(&rpc); | ||
| 329 | ReleaseBuffer(bufferResults); | ||
| 330 | ReleaseBuffer(bufferArgs); | ||
| 331 | |||
| 332 | return hr; | ||
| 333 | } | ||
| 334 | |||
| 335 | EXTERN_C HRESULT BACallbackOnCacheAcquireBegin( | ||
| 336 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 337 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 338 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 339 | __in_z LPWSTR* pwzSource, | ||
| 340 | __in_z LPWSTR* pwzDownloadUrl, | ||
| 341 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
| 342 | __out BOOTSTRAPPER_CACHE_OPERATION* pCacheOperation | ||
| 343 | ) | ||
| 344 | { | ||
| 345 | HRESULT hr = S_OK; | ||
| 346 | BA_ONCACHEACQUIREBEGIN_ARGS args = { }; | ||
| 347 | BA_ONCACHEACQUIREBEGIN_RESULTS results = { }; | ||
| 348 | BUFF_BUFFER bufferArgs = { }; | ||
| 349 | BUFF_BUFFER bufferResults = { }; | ||
| 350 | PIPE_RPC_RESULT rpc = { }; | ||
| 351 | SIZE_T iBuffer = 0; | ||
| 352 | |||
| 353 | *pCacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE; | ||
| 354 | |||
| 355 | // Init structs. | ||
| 356 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 357 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 358 | args.wzPayloadId = wzPayloadId; | ||
| 359 | args.wzSource = *pwzSource; | ||
| 360 | args.wzDownloadUrl = *pwzDownloadUrl; | ||
| 361 | args.wzPayloadContainerId = wzPayloadContainerId; | ||
| 362 | args.recommendation = *pCacheOperation; | ||
| 363 | |||
| 364 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 365 | results.action = *pCacheOperation; | ||
| 366 | |||
| 367 | // Send args. | ||
| 368 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 369 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireBegin args."); | ||
| 370 | |||
| 371 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 372 | ExitOnFailure(hr, "Failed to write package or container of OnCacheAcquireBegin args."); | ||
| 373 | |||
| 374 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 375 | ExitOnFailure(hr, "Failed to write payload id of OnCacheAcquireBegin args."); | ||
| 376 | |||
| 377 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzSource); | ||
| 378 | ExitOnFailure(hr, "Failed to write source of OnCacheAcquireBegin args."); | ||
| 379 | |||
| 380 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzDownloadUrl); | ||
| 381 | ExitOnFailure(hr, "Failed to write download url of OnCacheAcquireBegin args."); | ||
| 382 | |||
| 383 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadContainerId); | ||
| 384 | ExitOnFailure(hr, "Failed to write payload container id of OnCacheAcquireBegin args."); | ||
| 385 | |||
| 386 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 387 | ExitOnFailure(hr, "Failed to write recommendation of OnCacheAcquireBegin args."); | ||
| 388 | |||
| 389 | // Send results. | ||
| 390 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 391 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireBegin results."); | ||
| 392 | |||
| 393 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 394 | ExitOnFailure(hr, "Failed to write action of OnCacheAcquireBegin results."); | ||
| 395 | |||
| 396 | // Callback. | ||
| 397 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 398 | ExitOnFailure(hr, "BA OnCacheAcquireBegin failed."); | ||
| 399 | |||
| 400 | if (S_FALSE == hr) | ||
| 401 | { | ||
| 402 | ExitFunction(); | ||
| 403 | } | ||
| 404 | |||
| 405 | // Read results. | ||
| 406 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 407 | ExitOnFailure(hr, "Failed to read size of OnCacheAcquireBegin result."); | ||
| 408 | |||
| 409 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 410 | ExitOnFailure(hr, "Failed to read cancel of OnCacheAcquireBegin result."); | ||
| 411 | |||
| 412 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 413 | ExitOnFailure(hr, "Failed to read action of OnCacheAcquireBegin result."); | ||
| 414 | |||
| 415 | if (results.fCancel) | ||
| 416 | { | ||
| 417 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 418 | } | ||
| 419 | else | ||
| 420 | { | ||
| 421 | // Verify the BA requested an action that is possible. | ||
| 422 | if (BOOTSTRAPPER_CACHE_OPERATION_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || | ||
| 423 | BOOTSTRAPPER_CACHE_OPERATION_EXTRACT == results.action && wzPayloadContainerId || | ||
| 424 | BOOTSTRAPPER_CACHE_OPERATION_COPY == results.action || | ||
| 425 | BOOTSTRAPPER_CACHE_OPERATION_NONE == results.action) | ||
| 426 | { | ||
| 427 | *pCacheOperation = results.action; | ||
| 428 | } | ||
| 429 | } | ||
| 430 | |||
| 431 | LExit: | ||
| 432 | PipeFreeRpcResult(&rpc); | ||
| 433 | ReleaseBuffer(bufferResults); | ||
| 434 | ReleaseBuffer(bufferArgs); | ||
| 435 | |||
| 436 | return hr; | ||
| 437 | } | ||
| 438 | |||
| 439 | EXTERN_C HRESULT BACallbackOnCacheAcquireComplete( | ||
| 440 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 441 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 442 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 443 | __in HRESULT hrStatus, | ||
| 444 | __inout BOOL* pfRetry | ||
| 445 | ) | ||
| 446 | { | ||
| 447 | HRESULT hr = S_OK; | ||
| 448 | BA_ONCACHEACQUIRECOMPLETE_ARGS args = { }; | ||
| 449 | BA_ONCACHEACQUIRECOMPLETE_RESULTS results = { }; | ||
| 450 | BUFF_BUFFER bufferArgs = { }; | ||
| 451 | BUFF_BUFFER bufferResults = { }; | ||
| 452 | PIPE_RPC_RESULT rpc = { }; | ||
| 453 | SIZE_T iBuffer = 0; | ||
| 454 | |||
| 455 | // Init structs. | ||
| 456 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 457 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 458 | args.wzPayloadId = wzPayloadId; | ||
| 459 | args.hrStatus = hrStatus; | ||
| 460 | args.recommendation = *pfRetry ? BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY : BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_NONE; | ||
| 461 | |||
| 462 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 463 | results.action = args.recommendation; | ||
| 464 | |||
| 465 | // Send args. | ||
| 466 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 467 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireComplete args."); | ||
| 468 | |||
| 469 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 470 | ExitOnFailure(hr, "Failed to write package or container of OnCacheAcquireComplete args."); | ||
| 471 | |||
| 472 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 473 | ExitOnFailure(hr, "Failed to write payload id of OnCacheAcquireComplete args."); | ||
| 474 | |||
| 475 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 476 | ExitOnFailure(hr, "Failed to write status of OnCacheAcquireComplete args."); | ||
| 477 | |||
| 478 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 479 | ExitOnFailure(hr, "Failed to write recommendation of OnCacheAcquireComplete args."); | ||
| 480 | |||
| 481 | // Send results. | ||
| 482 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 483 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireComplete results."); | ||
| 484 | |||
| 485 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 486 | ExitOnFailure(hr, "Failed to write action of OnCacheAcquireComplete results."); | ||
| 487 | |||
| 488 | // Callback. | ||
| 489 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 490 | ExitOnFailure(hr, "BA OnCacheAcquireComplete failed."); | ||
| 491 | |||
| 492 | if (S_FALSE == hr) | ||
| 493 | { | ||
| 494 | ExitFunction(); | ||
| 495 | } | ||
| 496 | |||
| 497 | // Read results. | ||
| 498 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 499 | ExitOnFailure(hr, "Failed to read size of OnCacheAcquireComplete result."); | ||
| 500 | |||
| 501 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 502 | ExitOnFailure(hr, "Failed to read action of OnCacheAcquireComplete result."); | ||
| 503 | |||
| 504 | if (FAILED(hrStatus)) | ||
| 505 | { | ||
| 506 | *pfRetry = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY == results.action; | ||
| 507 | } | ||
| 508 | |||
| 509 | LExit: | ||
| 510 | PipeFreeRpcResult(&rpc); | ||
| 511 | ReleaseBuffer(bufferResults); | ||
| 512 | ReleaseBuffer(bufferArgs); | ||
| 513 | |||
| 514 | return hr; | ||
| 515 | } | ||
| 516 | |||
| 517 | EXTERN_C BAAPI BACallbackOnCacheAcquireProgress( | ||
| 518 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 519 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 520 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 521 | __in DWORD64 dw64Progress, | ||
| 522 | __in DWORD64 dw64Total, | ||
| 523 | __in DWORD dwOverallPercentage | ||
| 524 | ) | ||
| 525 | { | ||
| 526 | HRESULT hr = S_OK; | ||
| 527 | BA_ONCACHEACQUIREPROGRESS_ARGS args = { }; | ||
| 528 | BA_ONCACHEACQUIREPROGRESS_RESULTS results = { }; | ||
| 529 | BUFF_BUFFER bufferArgs = { }; | ||
| 530 | BUFF_BUFFER bufferResults = { }; | ||
| 531 | PIPE_RPC_RESULT rpc = { }; | ||
| 532 | SIZE_T iBuffer = 0; | ||
| 533 | |||
| 534 | // Init structs. | ||
| 535 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 536 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 537 | args.wzPayloadId = wzPayloadId; | ||
| 538 | args.dw64Progress = dw64Progress; | ||
| 539 | args.dw64Total = dw64Total; | ||
| 540 | args.dwOverallPercentage = dwOverallPercentage; | ||
| 541 | |||
| 542 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 543 | |||
| 544 | // Send args. | ||
| 545 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 546 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireProgress args."); | ||
| 547 | |||
| 548 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 549 | ExitOnFailure(hr, "Failed to write package or container of OnCacheAcquireProgress args."); | ||
| 550 | |||
| 551 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 552 | ExitOnFailure(hr, "Failed to write payload id of OnCacheAcquireProgress args."); | ||
| 553 | |||
| 554 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Progress); | ||
| 555 | ExitOnFailure(hr, "Failed to write progress of OnCacheAcquireProgress args."); | ||
| 556 | |||
| 557 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Total); | ||
| 558 | ExitOnFailure(hr, "Failed to write total progress of OnCacheAcquireProgress args."); | ||
| 559 | |||
| 560 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallPercentage); | ||
| 561 | ExitOnFailure(hr, "Failed to write overall percentage of OnCacheAcquireProgress args."); | ||
| 562 | |||
| 563 | // Send results. | ||
| 564 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 565 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireProgress results."); | ||
| 566 | |||
| 567 | // Callback. | ||
| 568 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &bufferArgs, &bufferResults, &rpc); | ||
| 569 | ExitOnFailure(hr, "BA OnCacheAcquireProgress failed."); | ||
| 570 | |||
| 571 | if (S_FALSE == hr) | ||
| 572 | { | ||
| 573 | ExitFunction(); | ||
| 574 | } | ||
| 575 | |||
| 576 | // Read results. | ||
| 577 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 578 | ExitOnFailure(hr, "Failed to read size of OnCacheAcquireProgress result."); | ||
| 579 | |||
| 580 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 581 | ExitOnFailure(hr, "Failed to read cancel of OnCacheAcquireProgress result."); | ||
| 582 | |||
| 583 | if (results.fCancel) | ||
| 584 | { | ||
| 585 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 586 | } | ||
| 587 | |||
| 588 | LExit: | ||
| 589 | PipeFreeRpcResult(&rpc); | ||
| 590 | ReleaseBuffer(bufferResults); | ||
| 591 | ReleaseBuffer(bufferArgs); | ||
| 592 | |||
| 593 | return hr; | ||
| 594 | } | ||
| 595 | |||
| 596 | EXTERN_C HRESULT BACallbackOnCacheAcquireResolving( | ||
| 597 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 598 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 599 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 600 | __in_ecount_z(cSearchPaths) LPWSTR* rgSearchPaths, | ||
| 601 | __in DWORD cSearchPaths, | ||
| 602 | __in BOOL fFoundLocal, | ||
| 603 | __in DWORD* pdwChosenSearchPath, | ||
| 604 | __in_z_opt LPWSTR* pwzDownloadUrl, | ||
| 605 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
| 606 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pCacheOperation | ||
| 607 | ) | ||
| 608 | { | ||
| 609 | HRESULT hr = S_OK; | ||
| 610 | BA_ONCACHEACQUIRERESOLVING_ARGS args = { }; | ||
| 611 | BA_ONCACHEACQUIRERESOLVING_RESULTS results = { }; | ||
| 612 | BUFF_BUFFER bufferArgs = { }; | ||
| 613 | BUFF_BUFFER bufferResults = { }; | ||
| 614 | PIPE_RPC_RESULT rpc = { }; | ||
| 615 | SIZE_T iBuffer = 0; | ||
| 616 | |||
| 617 | // Init structs. | ||
| 618 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 619 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 620 | args.wzPayloadId = wzPayloadId; | ||
| 621 | args.rgSearchPaths = const_cast<LPCWSTR*>(rgSearchPaths); | ||
| 622 | args.cSearchPaths = cSearchPaths; | ||
| 623 | args.fFoundLocal = fFoundLocal; | ||
| 624 | args.dwRecommendedSearchPath = *pdwChosenSearchPath; | ||
| 625 | args.wzDownloadUrl = *pwzDownloadUrl; | ||
| 626 | args.recommendation = *pCacheOperation; | ||
| 627 | |||
| 628 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 629 | results.dwChosenSearchPath = *pdwChosenSearchPath; | ||
| 630 | results.action = *pCacheOperation; | ||
| 631 | |||
| 632 | // Send args. | ||
| 633 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 634 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireResolving args."); | ||
| 635 | |||
| 636 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 637 | ExitOnFailure(hr, "Failed to write package or container of OnCacheAcquireResolving args."); | ||
| 638 | |||
| 639 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 640 | ExitOnFailure(hr, "Failed to write payload id of OnCacheAcquireResolving args."); | ||
| 641 | |||
| 642 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cSearchPaths); | ||
| 643 | ExitOnFailure(hr, "Failed to write count of search paths of OnCacheAcquireResolving args."); | ||
| 644 | |||
| 645 | for (DWORD i = 0; i < args.cSearchPaths; ++i) | ||
| 646 | { | ||
| 647 | hr = BuffWriteStringToBuffer(&bufferArgs, args.rgSearchPaths[i]); | ||
| 648 | ExitOnFailure(hr, "Failed to write search path[%u] of OnCacheAcquireResolving args.", i); | ||
| 649 | } | ||
| 650 | |||
| 651 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fFoundLocal); | ||
| 652 | ExitOnFailure(hr, "Failed to write found local of OnCacheAcquireResolving args."); | ||
| 653 | |||
| 654 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwRecommendedSearchPath); | ||
| 655 | ExitOnFailure(hr, "Failed to write recommended search path of OnCacheAcquireResolving args."); | ||
| 656 | |||
| 657 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzDownloadUrl); | ||
| 658 | ExitOnFailure(hr, "Failed to write download url of OnCacheAcquireResolving args."); | ||
| 659 | |||
| 660 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadContainerId); | ||
| 661 | ExitOnFailure(hr, "Failed to write payload container id of OnCacheAcquireResolving args."); | ||
| 662 | |||
| 663 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 664 | ExitOnFailure(hr, "Failed to write recommendation of OnCacheAcquireResolving args."); | ||
| 665 | |||
| 666 | // Send results. | ||
| 667 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 668 | ExitOnFailure(hr, "Failed to write API version of OnCacheAcquireResolving results."); | ||
| 669 | |||
| 670 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwChosenSearchPath); | ||
| 671 | ExitOnFailure(hr, "Failed to write chose search path of OnCacheAcquireResolving results."); | ||
| 672 | |||
| 673 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 674 | ExitOnFailure(hr, "Failed to write action of OnCacheAcquireResolving results."); | ||
| 675 | |||
| 676 | // Callback. | ||
| 677 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, &bufferArgs, &bufferResults, &rpc); | ||
| 678 | ExitOnFailure(hr, "BA OnCacheAcquireResolving failed."); | ||
| 679 | |||
| 680 | if (S_FALSE == hr) | ||
| 681 | { | ||
| 682 | ExitFunction(); | ||
| 683 | } | ||
| 684 | |||
| 685 | // Read results. | ||
| 686 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 687 | ExitOnFailure(hr, "Failed to read size of OnCacheAcquireResolving result."); | ||
| 688 | |||
| 689 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwChosenSearchPath); | ||
| 690 | ExitOnFailure(hr, "Failed to read chosen search path of OnCacheAcquireResolving result."); | ||
| 691 | |||
| 692 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 693 | ExitOnFailure(hr, "Failed to read action of OnCacheAcquireResolving result."); | ||
| 694 | |||
| 695 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 696 | ExitOnFailure(hr, "Failed to read cancel of OnCacheAcquireResolving result."); | ||
| 697 | |||
| 698 | if (results.fCancel) | ||
| 699 | { | ||
| 700 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 701 | } | ||
| 702 | else | ||
| 703 | { | ||
| 704 | // Verify the BA requested an action that is possible. | ||
| 705 | if (BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || | ||
| 706 | BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER == results.action && wzPayloadContainerId || | ||
| 707 | BOOTSTRAPPER_CACHE_RESOLVE_RETRY == results.action || | ||
| 708 | BOOTSTRAPPER_CACHE_RESOLVE_NONE == results.action) | ||
| 709 | { | ||
| 710 | *pCacheOperation = results.action; | ||
| 711 | } | ||
| 712 | else if (BOOTSTRAPPER_CACHE_RESOLVE_LOCAL == results.action && results.dwChosenSearchPath < cSearchPaths) | ||
| 713 | { | ||
| 714 | *pdwChosenSearchPath = results.dwChosenSearchPath; | ||
| 715 | *pCacheOperation = results.action; | ||
| 716 | } | ||
| 717 | } | ||
| 718 | |||
| 719 | LExit: | ||
| 720 | PipeFreeRpcResult(&rpc); | ||
| 721 | ReleaseBuffer(bufferResults); | ||
| 722 | ReleaseBuffer(bufferArgs); | ||
| 723 | |||
| 724 | return hr; | ||
| 725 | } | ||
| 726 | |||
| 727 | EXTERN_C HRESULT BACallbackOnCacheBegin( | ||
| 728 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 729 | ) | ||
| 730 | { | ||
| 731 | HRESULT hr = S_OK; | ||
| 732 | BA_ONCACHEBEGIN_ARGS args = { }; | ||
| 733 | BA_ONCACHEBEGIN_RESULTS results = { }; | ||
| 734 | BUFF_BUFFER bufferArgs = { }; | ||
| 735 | BUFF_BUFFER bufferResults = { }; | ||
| 736 | PIPE_RPC_RESULT rpc = { }; | ||
| 737 | SIZE_T iBuffer = 0; | ||
| 738 | |||
| 739 | // Init structs. | ||
| 740 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 741 | |||
| 742 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 743 | |||
| 744 | // Send args. | ||
| 745 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 746 | ExitOnFailure(hr, "Failed to write API version of OnCacheBegin args."); | ||
| 747 | |||
| 748 | // Send results. | ||
| 749 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 750 | ExitOnFailure(hr, "Failed to write API version of OnCacheBegin results."); | ||
| 751 | |||
| 752 | // Callback. | ||
| 753 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 754 | ExitOnFailure(hr, "BA OnCacheBegin failed."); | ||
| 755 | |||
| 756 | if (S_FALSE == hr) | ||
| 757 | { | ||
| 758 | ExitFunction(); | ||
| 759 | } | ||
| 760 | |||
| 761 | // Read results. | ||
| 762 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 763 | ExitOnFailure(hr, "Failed to read size of OnCacheBegin result."); | ||
| 764 | |||
| 765 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 766 | ExitOnFailure(hr, "Failed to read cancel of OnCacheBegin result."); | ||
| 767 | |||
| 768 | if (results.fCancel) | ||
| 769 | { | ||
| 770 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 771 | } | ||
| 772 | |||
| 773 | LExit: | ||
| 774 | PipeFreeRpcResult(&rpc); | ||
| 775 | ReleaseBuffer(bufferResults); | ||
| 776 | ReleaseBuffer(bufferArgs); | ||
| 777 | |||
| 778 | return hr; | ||
| 779 | } | ||
| 780 | |||
| 781 | EXTERN_C HRESULT BACallbackOnCacheComplete( | ||
| 782 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 783 | __in HRESULT hrStatus | ||
| 784 | ) | ||
| 785 | { | ||
| 786 | HRESULT hr = S_OK; | ||
| 787 | BA_ONCACHECOMPLETE_ARGS args = { }; | ||
| 788 | BA_ONCACHECOMPLETE_RESULTS results = { }; | ||
| 789 | BUFF_BUFFER bufferArgs = { }; | ||
| 790 | BUFF_BUFFER bufferResults = { }; | ||
| 791 | PIPE_RPC_RESULT rpc = { }; | ||
| 792 | |||
| 793 | // Init structs. | ||
| 794 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 795 | args.hrStatus = hrStatus; | ||
| 796 | |||
| 797 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 798 | |||
| 799 | // Send args. | ||
| 800 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 801 | ExitOnFailure(hr, "Failed to write API version of OnCacheComplete args."); | ||
| 802 | |||
| 803 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 804 | ExitOnFailure(hr, "Failed to write status of OnCacheComplete args."); | ||
| 805 | |||
| 806 | // Send results. | ||
| 807 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 808 | ExitOnFailure(hr, "Failed to write API version of OnCacheComplete results."); | ||
| 809 | |||
| 810 | // Callback. | ||
| 811 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 812 | ExitOnFailure(hr, "BA OnCacheComplete failed."); | ||
| 813 | |||
| 814 | if (S_FALSE == hr) | ||
| 815 | { | ||
| 816 | ExitFunction(); | ||
| 817 | } | ||
| 818 | |||
| 819 | LExit: | ||
| 820 | PipeFreeRpcResult(&rpc); | ||
| 821 | ReleaseBuffer(bufferResults); | ||
| 822 | ReleaseBuffer(bufferArgs); | ||
| 823 | |||
| 824 | return hr; | ||
| 825 | } | ||
| 826 | |||
| 827 | EXTERN_C BAAPI BACallbackOnCacheContainerOrPayloadVerifyBegin( | ||
| 828 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 829 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 830 | __in_z_opt LPCWSTR wzPayloadId | ||
| 831 | ) | ||
| 832 | { | ||
| 833 | HRESULT hr = S_OK; | ||
| 834 | BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS args = { }; | ||
| 835 | BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS results = { }; | ||
| 836 | BUFF_BUFFER bufferArgs = { }; | ||
| 837 | BUFF_BUFFER bufferResults = { }; | ||
| 838 | PIPE_RPC_RESULT rpc = { }; | ||
| 839 | SIZE_T iBuffer = 0; | ||
| 840 | |||
| 841 | // Init structs. | ||
| 842 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 843 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 844 | args.wzPayloadId = wzPayloadId; | ||
| 845 | |||
| 846 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 847 | |||
| 848 | // Send args. | ||
| 849 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 850 | ExitOnFailure(hr, "Failed to write API version of OnCacheContainerOrPayloadVerifyBegin args."); | ||
| 851 | |||
| 852 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 853 | ExitOnFailure(hr, "Failed to write package or container id of OnCacheContainerOrPayloadVerifyBegin args."); | ||
| 854 | |||
| 855 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 856 | ExitOnFailure(hr, "Failed to write payload id of OnCacheContainerOrPayloadVerifyBegin args."); | ||
| 857 | |||
| 858 | // Send results. | ||
| 859 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 860 | ExitOnFailure(hr, "Failed to write API version of OnCacheContainerOrPayloadVerifyBegin results."); | ||
| 861 | |||
| 862 | // Callback. | ||
| 863 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 864 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyBegin failed."); | ||
| 865 | |||
| 866 | if (S_FALSE == hr) | ||
| 867 | { | ||
| 868 | ExitFunction(); | ||
| 869 | } | ||
| 870 | |||
| 871 | // Read results. | ||
| 872 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 873 | ExitOnFailure(hr, "Failed to read size of OnCacheContainerOrPayloadVerifyBegin result."); | ||
| 874 | |||
| 875 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 876 | ExitOnFailure(hr, "Failed to read cancel of OnCacheContainerOrPayloadVerifyBegin result."); | ||
| 877 | |||
| 878 | if (results.fCancel) | ||
| 879 | { | ||
| 880 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 881 | } | ||
| 882 | |||
| 883 | LExit: | ||
| 884 | PipeFreeRpcResult(&rpc); | ||
| 885 | ReleaseBuffer(bufferResults); | ||
| 886 | ReleaseBuffer(bufferArgs); | ||
| 887 | |||
| 888 | return hr; | ||
| 889 | } | ||
| 890 | |||
| 891 | EXTERN_C HRESULT BACallbackOnCacheContainerOrPayloadVerifyComplete( | ||
| 892 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 893 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 894 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 895 | __in HRESULT hrStatus | ||
| 896 | ) | ||
| 897 | { | ||
| 898 | HRESULT hr = S_OK; | ||
| 899 | BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS args = { }; | ||
| 900 | BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS results = { }; | ||
| 901 | BUFF_BUFFER bufferArgs = { }; | ||
| 902 | BUFF_BUFFER bufferResults = { }; | ||
| 903 | PIPE_RPC_RESULT rpc = { }; | ||
| 904 | |||
| 905 | // Init structs. | ||
| 906 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 907 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 908 | args.wzPayloadId = wzPayloadId; | ||
| 909 | args.hrStatus = hrStatus; | ||
| 910 | |||
| 911 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 912 | |||
| 913 | // Send args. | ||
| 914 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 915 | ExitOnFailure(hr, "Failed to write API version of OnCacheContainerOrPayloadVerifyComplete args."); | ||
| 916 | |||
| 917 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 918 | ExitOnFailure(hr, "Failed to write package or container id of OnCacheContainerOrPayloadVerifyComplete args."); | ||
| 919 | |||
| 920 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 921 | ExitOnFailure(hr, "Failed to write payload id of OnCacheContainerOrPayloadVerifyComplete args."); | ||
| 922 | |||
| 923 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 924 | ExitOnFailure(hr, "Failed to write status of OnCacheContainerOrPayloadVerifyComplete args."); | ||
| 925 | |||
| 926 | // Send results. | ||
| 927 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 928 | ExitOnFailure(hr, "Failed to write API version of OnCacheContainerOrPayloadVerifyComplete results."); | ||
| 929 | |||
| 930 | // Callback. | ||
| 931 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 932 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyComplete failed."); | ||
| 933 | |||
| 934 | if (S_FALSE == hr) | ||
| 935 | { | ||
| 936 | ExitFunction(); | ||
| 937 | } | ||
| 938 | |||
| 939 | LExit: | ||
| 940 | PipeFreeRpcResult(&rpc); | ||
| 941 | ReleaseBuffer(bufferResults); | ||
| 942 | ReleaseBuffer(bufferArgs); | ||
| 943 | |||
| 944 | return hr; | ||
| 945 | } | ||
| 946 | |||
| 947 | EXTERN_C HRESULT BACallbackOnCacheContainerOrPayloadVerifyProgress( | ||
| 948 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 949 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 950 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 951 | __in DWORD64 dw64Progress, | ||
| 952 | __in DWORD64 dw64Total, | ||
| 953 | __in DWORD dwOverallPercentage | ||
| 954 | ) | ||
| 955 | { | ||
| 956 | HRESULT hr = S_OK; | ||
| 957 | BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS args = { }; | ||
| 958 | BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS results = { }; | ||
| 959 | BUFF_BUFFER bufferArgs = { }; | ||
| 960 | BUFF_BUFFER bufferResults = { }; | ||
| 961 | PIPE_RPC_RESULT rpc = { }; | ||
| 962 | SIZE_T iBuffer = 0; | ||
| 963 | |||
| 964 | // Init structs. | ||
| 965 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 966 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 967 | args.wzPayloadId = wzPayloadId; | ||
| 968 | args.dw64Progress = dw64Progress; | ||
| 969 | args.dw64Total = dw64Total; | ||
| 970 | args.dwOverallPercentage = dwOverallPercentage; | ||
| 971 | |||
| 972 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 973 | |||
| 974 | // Send args. | ||
| 975 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 976 | ExitOnFailure(hr, "Failed to write API version of OnCacheContainerOrPayloadVerifyProgress args."); | ||
| 977 | |||
| 978 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 979 | ExitOnFailure(hr, "Failed to write package or container id of OnCacheContainerOrPayloadVerifyProgress args."); | ||
| 980 | |||
| 981 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 982 | ExitOnFailure(hr, "Failed to write payload id of OnCacheContainerOrPayloadVerifyProgress args."); | ||
| 983 | |||
| 984 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Progress); | ||
| 985 | ExitOnFailure(hr, "Failed to write progress of OnCacheContainerOrPayloadVerifyProgress args."); | ||
| 986 | |||
| 987 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Total); | ||
| 988 | ExitOnFailure(hr, "Failed to write total progress of OnCacheContainerOrPayloadVerifyProgress args."); | ||
| 989 | |||
| 990 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallPercentage); | ||
| 991 | ExitOnFailure(hr, "Failed to write overall percentage of OnCacheContainerOrPayloadVerifyProgress args."); | ||
| 992 | |||
| 993 | // Send results. | ||
| 994 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 995 | ExitOnFailure(hr, "Failed to write API version of OnCacheContainerOrPayloadVerifyProgress results."); | ||
| 996 | |||
| 997 | // Callback. | ||
| 998 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, &bufferArgs, &bufferResults, &rpc); | ||
| 999 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyProgress failed."); | ||
| 1000 | |||
| 1001 | if (S_FALSE == hr) | ||
| 1002 | { | ||
| 1003 | ExitFunction(); | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | // Read results. | ||
| 1007 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1008 | ExitOnFailure(hr, "Failed to read size of OnCacheContainerOrPayloadVerifyProgress result."); | ||
| 1009 | |||
| 1010 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1011 | ExitOnFailure(hr, "Failed to read cancel of OnCacheContainerOrPayloadVerifyProgress result."); | ||
| 1012 | |||
| 1013 | if (results.fCancel) | ||
| 1014 | { | ||
| 1015 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1016 | } | ||
| 1017 | |||
| 1018 | LExit: | ||
| 1019 | PipeFreeRpcResult(&rpc); | ||
| 1020 | ReleaseBuffer(bufferResults); | ||
| 1021 | ReleaseBuffer(bufferArgs); | ||
| 1022 | |||
| 1023 | return hr; | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | EXTERN_C HRESULT BACallbackOnCachePackageBegin( | ||
| 1027 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1028 | __in_z LPCWSTR wzPackageId, | ||
| 1029 | __in DWORD cCachePayloads, | ||
| 1030 | __in DWORD64 dw64PackageCacheSize, | ||
| 1031 | __in BOOL fVital | ||
| 1032 | ) | ||
| 1033 | { | ||
| 1034 | HRESULT hr = S_OK; | ||
| 1035 | BA_ONCACHEPACKAGEBEGIN_ARGS args = { }; | ||
| 1036 | BA_ONCACHEPACKAGEBEGIN_RESULTS results = { }; | ||
| 1037 | BUFF_BUFFER bufferArgs = { }; | ||
| 1038 | BUFF_BUFFER bufferResults = { }; | ||
| 1039 | PIPE_RPC_RESULT rpc = { }; | ||
| 1040 | SIZE_T iBuffer = 0; | ||
| 1041 | |||
| 1042 | // Init structs. | ||
| 1043 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1044 | args.wzPackageId = wzPackageId; | ||
| 1045 | args.cCachePayloads = cCachePayloads; | ||
| 1046 | args.dw64PackageCacheSize = dw64PackageCacheSize; | ||
| 1047 | args.fVital = fVital; | ||
| 1048 | |||
| 1049 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1050 | |||
| 1051 | // Send args. | ||
| 1052 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1053 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageBegin args."); | ||
| 1054 | |||
| 1055 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 1056 | ExitOnFailure(hr, "Failed to write package id of OnCachePackageBegin args."); | ||
| 1057 | |||
| 1058 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cCachePayloads); | ||
| 1059 | ExitOnFailure(hr, "Failed to write count of cached payloads of OnCachePackageBegin args."); | ||
| 1060 | |||
| 1061 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64PackageCacheSize); | ||
| 1062 | ExitOnFailure(hr, "Failed to write package cache size of OnCachePackageBegin args."); | ||
| 1063 | |||
| 1064 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fVital); | ||
| 1065 | ExitOnFailure(hr, "Failed to write vital of OnCachePackageBegin args."); | ||
| 1066 | |||
| 1067 | // Send results. | ||
| 1068 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1069 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageBegin results."); | ||
| 1070 | |||
| 1071 | // Callback. | ||
| 1072 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 1073 | ExitOnFailure(hr, "BA OnCachePackageBegin failed."); | ||
| 1074 | |||
| 1075 | if (S_FALSE == hr) | ||
| 1076 | { | ||
| 1077 | ExitFunction(); | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | // Read results. | ||
| 1081 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1082 | ExitOnFailure(hr, "Failed to read size of OnCachePackageBegin result."); | ||
| 1083 | |||
| 1084 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1085 | ExitOnFailure(hr, "Failed to read cancel of OnCachePackageBegin result."); | ||
| 1086 | |||
| 1087 | if (results.fCancel) | ||
| 1088 | { | ||
| 1089 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1090 | } | ||
| 1091 | |||
| 1092 | LExit: | ||
| 1093 | PipeFreeRpcResult(&rpc); | ||
| 1094 | ReleaseBuffer(bufferResults); | ||
| 1095 | ReleaseBuffer(bufferArgs); | ||
| 1096 | |||
| 1097 | return hr; | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | EXTERN_C HRESULT BACallbackOnCachePackageComplete( | ||
| 1101 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1102 | __in_z LPCWSTR wzPackageId, | ||
| 1103 | __in HRESULT hrStatus, | ||
| 1104 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction | ||
| 1105 | ) | ||
| 1106 | { | ||
| 1107 | HRESULT hr = S_OK; | ||
| 1108 | BA_ONCACHEPACKAGECOMPLETE_ARGS args = { }; | ||
| 1109 | BA_ONCACHEPACKAGECOMPLETE_RESULTS results = { }; | ||
| 1110 | BUFF_BUFFER bufferArgs = { }; | ||
| 1111 | BUFF_BUFFER bufferResults = { }; | ||
| 1112 | PIPE_RPC_RESULT rpc = { }; | ||
| 1113 | SIZE_T iBuffer = 0; | ||
| 1114 | |||
| 1115 | // Init structs. | ||
| 1116 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1117 | args.wzPackageId = wzPackageId; | ||
| 1118 | args.hrStatus = hrStatus; | ||
| 1119 | args.recommendation = *pAction; | ||
| 1120 | |||
| 1121 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1122 | results.action = *pAction; | ||
| 1123 | |||
| 1124 | // Send args. | ||
| 1125 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1126 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageComplete args."); | ||
| 1127 | |||
| 1128 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 1129 | ExitOnFailure(hr, "Failed to write package id of OnCachePackageComplete args."); | ||
| 1130 | |||
| 1131 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 1132 | ExitOnFailure(hr, "Failed to write status of OnCachePackageComplete args."); | ||
| 1133 | |||
| 1134 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 1135 | ExitOnFailure(hr, "Failed to write recommendation of OnCachePackageComplete args."); | ||
| 1136 | |||
| 1137 | // Send results. | ||
| 1138 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1139 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageComplete results."); | ||
| 1140 | |||
| 1141 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 1142 | ExitOnFailure(hr, "Failed to write action of OnCachePackageComplete results."); | ||
| 1143 | |||
| 1144 | // Callback. | ||
| 1145 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 1146 | ExitOnFailure(hr, "BA OnCachePackageComplete failed."); | ||
| 1147 | |||
| 1148 | if (S_FALSE == hr) | ||
| 1149 | { | ||
| 1150 | ExitFunction(); | ||
| 1151 | } | ||
| 1152 | |||
| 1153 | // Read results. | ||
| 1154 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1155 | ExitOnFailure(hr, "Failed to read size of OnCachePackageComplete result."); | ||
| 1156 | |||
| 1157 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 1158 | ExitOnFailure(hr, "Failed to read cancel of OnCachePackageComplete result."); | ||
| 1159 | |||
| 1160 | if (FAILED(hrStatus)) | ||
| 1161 | { | ||
| 1162 | *pAction = results.action; | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | LExit: | ||
| 1166 | PipeFreeRpcResult(&rpc); | ||
| 1167 | ReleaseBuffer(bufferResults); | ||
| 1168 | ReleaseBuffer(bufferArgs); | ||
| 1169 | |||
| 1170 | return hr; | ||
| 1171 | } | ||
| 1172 | |||
| 1173 | EXTERN_C HRESULT BACallbackOnCachePackageNonVitalValidationFailure( | ||
| 1174 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1175 | __in_z LPCWSTR wzPackageId, | ||
| 1176 | __in HRESULT hrStatus, | ||
| 1177 | __inout BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION* pAction | ||
| 1178 | ) | ||
| 1179 | { | ||
| 1180 | HRESULT hr = S_OK; | ||
| 1181 | BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS args = { }; | ||
| 1182 | BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS results = { }; | ||
| 1183 | BUFF_BUFFER bufferArgs = { }; | ||
| 1184 | BUFF_BUFFER bufferResults = { }; | ||
| 1185 | PIPE_RPC_RESULT rpc = { }; | ||
| 1186 | SIZE_T iBuffer = 0; | ||
| 1187 | |||
| 1188 | // Init structs. | ||
| 1189 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1190 | args.wzPackageId = wzPackageId; | ||
| 1191 | args.hrStatus = hrStatus; | ||
| 1192 | args.recommendation = *pAction; | ||
| 1193 | |||
| 1194 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1195 | results.action = *pAction; | ||
| 1196 | |||
| 1197 | // Send args. | ||
| 1198 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1199 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageNonVitalValidationFailure args."); | ||
| 1200 | |||
| 1201 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 1202 | ExitOnFailure(hr, "Failed to write package id of OnCachePackageNonVitalValidationFailure args."); | ||
| 1203 | |||
| 1204 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 1205 | ExitOnFailure(hr, "Failed to write status of OnCachePackageNonVitalValidationFailure args."); | ||
| 1206 | |||
| 1207 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 1208 | ExitOnFailure(hr, "Failed to write recommendation of OnCachePackageNonVitalValidationFailure args."); | ||
| 1209 | |||
| 1210 | // Send results. | ||
| 1211 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1212 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageNonVitalValidationFailure results."); | ||
| 1213 | |||
| 1214 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 1215 | ExitOnFailure(hr, "Failed to write API version of OnCachePackageNonVitalValidationFailure results."); | ||
| 1216 | |||
| 1217 | // Callback. | ||
| 1218 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, &bufferArgs, &bufferResults, &rpc); | ||
| 1219 | ExitOnFailure(hr, "BA OnCachePackageNonVitalValidationFailure failed."); | ||
| 1220 | |||
| 1221 | if (S_FALSE == hr) | ||
| 1222 | { | ||
| 1223 | ExitFunction(); | ||
| 1224 | } | ||
| 1225 | |||
| 1226 | // Read results. | ||
| 1227 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1228 | ExitOnFailure(hr, "Failed to read size of OnCachePackageNonVitalValidationFailure result."); | ||
| 1229 | |||
| 1230 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 1231 | ExitOnFailure(hr, "Failed to read cancel of OnCachePackageNonVitalValidationFailure result."); | ||
| 1232 | |||
| 1233 | switch (results.action) | ||
| 1234 | { | ||
| 1235 | case BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_NONE: __fallthrough; | ||
| 1236 | case BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_ACQUIRE: | ||
| 1237 | *pAction = results.action; | ||
| 1238 | break; | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | LExit: | ||
| 1242 | PipeFreeRpcResult(&rpc); | ||
| 1243 | ReleaseBuffer(bufferResults); | ||
| 1244 | ReleaseBuffer(bufferArgs); | ||
| 1245 | |||
| 1246 | return hr; | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | EXTERN_C HRESULT BACallbackOnCachePayloadExtractBegin( | ||
| 1250 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1251 | __in_z_opt LPCWSTR wzContainerId, | ||
| 1252 | __in_z_opt LPCWSTR wzPayloadId | ||
| 1253 | ) | ||
| 1254 | { | ||
| 1255 | HRESULT hr = S_OK; | ||
| 1256 | BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS args = { }; | ||
| 1257 | BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS results = { }; | ||
| 1258 | BUFF_BUFFER bufferArgs = { }; | ||
| 1259 | BUFF_BUFFER bufferResults = { }; | ||
| 1260 | PIPE_RPC_RESULT rpc = { }; | ||
| 1261 | SIZE_T iBuffer = 0; | ||
| 1262 | |||
| 1263 | // Init structs. | ||
| 1264 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1265 | args.wzContainerId = wzContainerId; | ||
| 1266 | args.wzPayloadId = wzPayloadId; | ||
| 1267 | |||
| 1268 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1269 | |||
| 1270 | // Send args. | ||
| 1271 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1272 | ExitOnFailure(hr, "Failed to write API version of OnCachePayloadExtractBegin args."); | ||
| 1273 | |||
| 1274 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzContainerId); | ||
| 1275 | ExitOnFailure(hr, "Failed to write container id of OnCachePayloadExtractBegin args."); | ||
| 1276 | |||
| 1277 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 1278 | ExitOnFailure(hr, "Failed to write payload id of OnCachePayloadExtractBegin args."); | ||
| 1279 | |||
| 1280 | // Send results. | ||
| 1281 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1282 | ExitOnFailure(hr, "Failed to write API version of OnCachePayloadExtractBegin results."); | ||
| 1283 | |||
| 1284 | // Callback. | ||
| 1285 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 1286 | ExitOnFailure(hr, "BA OnCachePayloadExtractBegin failed."); | ||
| 1287 | |||
| 1288 | if (S_FALSE == hr) | ||
| 1289 | { | ||
| 1290 | ExitFunction(); | ||
| 1291 | } | ||
| 1292 | |||
| 1293 | // Read results. | ||
| 1294 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1295 | ExitOnFailure(hr, "Failed to read size of OnCachePayloadExtractBegin result."); | ||
| 1296 | |||
| 1297 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1298 | ExitOnFailure(hr, "Failed to read cancel of OnCachePayloadExtractBegin result."); | ||
| 1299 | |||
| 1300 | if (results.fCancel) | ||
| 1301 | { | ||
| 1302 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1303 | } | ||
| 1304 | |||
| 1305 | LExit: | ||
| 1306 | PipeFreeRpcResult(&rpc); | ||
| 1307 | ReleaseBuffer(bufferResults); | ||
| 1308 | ReleaseBuffer(bufferArgs); | ||
| 1309 | |||
| 1310 | return hr; | ||
| 1311 | } | ||
| 1312 | |||
| 1313 | EXTERN_C HRESULT BACallbackOnCachePayloadExtractComplete( | ||
| 1314 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1315 | __in_z_opt LPCWSTR wzContainerId, | ||
| 1316 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 1317 | __in HRESULT hrStatus | ||
| 1318 | ) | ||
| 1319 | { | ||
| 1320 | HRESULT hr = S_OK; | ||
| 1321 | BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS args = { }; | ||
| 1322 | BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS results = { }; | ||
| 1323 | BUFF_BUFFER bufferArgs = { }; | ||
| 1324 | BUFF_BUFFER bufferResults = { }; | ||
| 1325 | PIPE_RPC_RESULT rpc = { }; | ||
| 1326 | |||
| 1327 | // Init structs. | ||
| 1328 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1329 | args.wzContainerId = wzContainerId; | ||
| 1330 | args.wzPayloadId = wzPayloadId; | ||
| 1331 | args.hrStatus = hrStatus; | ||
| 1332 | |||
| 1333 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1334 | |||
| 1335 | // Send args. | ||
| 1336 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1337 | ExitOnFailure(hr, "Failed to write API version of OnCachePayloadExtractComplete args."); | ||
| 1338 | |||
| 1339 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzContainerId); | ||
| 1340 | ExitOnFailure(hr, "Failed to write container id of OnCachePayloadExtractComplete args."); | ||
| 1341 | |||
| 1342 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 1343 | ExitOnFailure(hr, "Failed to write payload id of OnCachePayloadExtractComplete args."); | ||
| 1344 | |||
| 1345 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 1346 | ExitOnFailure(hr, "Failed to write status of OnCachePayloadExtractComplete args."); | ||
| 1347 | |||
| 1348 | // Send results. | ||
| 1349 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1350 | ExitOnFailure(hr, "Failed to write API version of OnCachePayloadExtractComplete results."); | ||
| 1351 | |||
| 1352 | // Callback. | ||
| 1353 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 1354 | ExitOnFailure(hr, "BA OnCachePayloadExtractComplete failed."); | ||
| 1355 | |||
| 1356 | if (S_FALSE == hr) | ||
| 1357 | { | ||
| 1358 | ExitFunction(); | ||
| 1359 | } | ||
| 1360 | |||
| 1361 | LExit: | ||
| 1362 | PipeFreeRpcResult(&rpc); | ||
| 1363 | ReleaseBuffer(bufferResults); | ||
| 1364 | ReleaseBuffer(bufferArgs); | ||
| 1365 | |||
| 1366 | return hr; | ||
| 1367 | } | ||
| 1368 | |||
| 1369 | EXTERN_C HRESULT BACallbackOnCachePayloadExtractProgress( | ||
| 1370 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1371 | __in_z_opt LPCWSTR wzContainerId, | ||
| 1372 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 1373 | __in DWORD64 dw64Progress, | ||
| 1374 | __in DWORD64 dw64Total, | ||
| 1375 | __in DWORD dwOverallPercentage | ||
| 1376 | ) | ||
| 1377 | { | ||
| 1378 | HRESULT hr = S_OK; | ||
| 1379 | BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS args = { }; | ||
| 1380 | BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS results = { }; | ||
| 1381 | BUFF_BUFFER bufferArgs = { }; | ||
| 1382 | BUFF_BUFFER bufferResults = { }; | ||
| 1383 | PIPE_RPC_RESULT rpc = { }; | ||
| 1384 | SIZE_T iBuffer = 0; | ||
| 1385 | |||
| 1386 | // Init structs. | ||
| 1387 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1388 | args.wzContainerId = wzContainerId; | ||
| 1389 | args.wzPayloadId = wzPayloadId; | ||
| 1390 | args.dw64Progress = dw64Progress; | ||
| 1391 | args.dw64Total = dw64Total; | ||
| 1392 | args.dwOverallPercentage = dwOverallPercentage; | ||
| 1393 | |||
| 1394 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1395 | |||
| 1396 | // Send args. | ||
| 1397 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1398 | ExitOnFailure(hr, "Failed to write API version of OnCachePayloadExtractProgress args."); | ||
| 1399 | |||
| 1400 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzContainerId); | ||
| 1401 | ExitOnFailure(hr, "Failed to write container id of OnCachePayloadExtractProgress args."); | ||
| 1402 | |||
| 1403 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 1404 | ExitOnFailure(hr, "Failed to write payload id of OnCachePayloadExtractProgress args."); | ||
| 1405 | |||
| 1406 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Progress); | ||
| 1407 | ExitOnFailure(hr, "Failed to write progress of OnCachePayloadExtractProgress args."); | ||
| 1408 | |||
| 1409 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Total); | ||
| 1410 | ExitOnFailure(hr, "Failed to write total progress of OnCachePayloadExtractProgress args."); | ||
| 1411 | |||
| 1412 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallPercentage); | ||
| 1413 | ExitOnFailure(hr, "Failed to write overall percentage of OnCachePayloadExtractProgress args."); | ||
| 1414 | |||
| 1415 | // Send results. | ||
| 1416 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1417 | ExitOnFailure(hr, "Failed to write API version of OnCachePayloadExtractProgress results."); | ||
| 1418 | |||
| 1419 | // Callback. | ||
| 1420 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, &bufferArgs, &bufferResults, &rpc); | ||
| 1421 | ExitOnFailure(hr, "BA OnCachePayloadExtractProgress failed."); | ||
| 1422 | |||
| 1423 | if (S_FALSE == hr) | ||
| 1424 | { | ||
| 1425 | ExitFunction(); | ||
| 1426 | } | ||
| 1427 | |||
| 1428 | // Read results. | ||
| 1429 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1430 | ExitOnFailure(hr, "Failed to read size of OnCachePayloadExtractProgress result."); | ||
| 1431 | |||
| 1432 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1433 | ExitOnFailure(hr, "Failed to read cancel of OnCachePayloadExtractProgress result."); | ||
| 1434 | |||
| 1435 | if (results.fCancel) | ||
| 1436 | { | ||
| 1437 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1438 | } | ||
| 1439 | |||
| 1440 | LExit: | ||
| 1441 | PipeFreeRpcResult(&rpc); | ||
| 1442 | ReleaseBuffer(bufferResults); | ||
| 1443 | ReleaseBuffer(bufferArgs); | ||
| 1444 | |||
| 1445 | return hr; | ||
| 1446 | } | ||
| 1447 | |||
| 1448 | EXTERN_C HRESULT BACallbackOnCacheVerifyBegin( | ||
| 1449 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1450 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 1451 | __in_z_opt LPCWSTR wzPayloadId | ||
| 1452 | ) | ||
| 1453 | { | ||
| 1454 | HRESULT hr = S_OK; | ||
| 1455 | BA_ONCACHEVERIFYBEGIN_ARGS args = { }; | ||
| 1456 | BA_ONCACHEVERIFYBEGIN_RESULTS results = { }; | ||
| 1457 | BUFF_BUFFER bufferArgs = { }; | ||
| 1458 | BUFF_BUFFER bufferResults = { }; | ||
| 1459 | PIPE_RPC_RESULT rpc = { }; | ||
| 1460 | SIZE_T iBuffer = 0; | ||
| 1461 | |||
| 1462 | // Init structs. | ||
| 1463 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1464 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 1465 | args.wzPayloadId = wzPayloadId; | ||
| 1466 | |||
| 1467 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1468 | |||
| 1469 | // Send args. | ||
| 1470 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1471 | ExitOnFailure(hr, "Failed to write API version of OnCacheVerifyBegin args."); | ||
| 1472 | |||
| 1473 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 1474 | ExitOnFailure(hr, "Failed to write package or container id of OnCacheVerifyBegin args."); | ||
| 1475 | |||
| 1476 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 1477 | ExitOnFailure(hr, "Failed to write payload id of OnCacheVerifyBegin args."); | ||
| 1478 | |||
| 1479 | // Send results. | ||
| 1480 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1481 | ExitOnFailure(hr, "Failed to write API version of OnCacheVerifyBegin results."); | ||
| 1482 | |||
| 1483 | // Callback. | ||
| 1484 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 1485 | ExitOnFailure(hr, "BA OnCacheVerifyBegin failed."); | ||
| 1486 | |||
| 1487 | if (S_FALSE == hr) | ||
| 1488 | { | ||
| 1489 | ExitFunction(); | ||
| 1490 | } | ||
| 1491 | |||
| 1492 | // Read results. | ||
| 1493 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1494 | ExitOnFailure(hr, "Failed to read size of OnCacheVerifyBegin result."); | ||
| 1495 | |||
| 1496 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1497 | ExitOnFailure(hr, "Failed to read cancel of OnCacheVerifyBegin result."); | ||
| 1498 | |||
| 1499 | if (results.fCancel) | ||
| 1500 | { | ||
| 1501 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1502 | } | ||
| 1503 | |||
| 1504 | LExit: | ||
| 1505 | PipeFreeRpcResult(&rpc); | ||
| 1506 | ReleaseBuffer(bufferResults); | ||
| 1507 | ReleaseBuffer(bufferArgs); | ||
| 1508 | |||
| 1509 | return hr; | ||
| 1510 | } | ||
| 1511 | |||
| 1512 | EXTERN_C HRESULT BACallbackOnCacheVerifyComplete( | ||
| 1513 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1514 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 1515 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 1516 | __in HRESULT hrStatus, | ||
| 1517 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction | ||
| 1518 | ) | ||
| 1519 | { | ||
| 1520 | HRESULT hr = S_OK; | ||
| 1521 | BA_ONCACHEVERIFYCOMPLETE_ARGS args = { }; | ||
| 1522 | BA_ONCACHEVERIFYCOMPLETE_RESULTS results = { }; | ||
| 1523 | BUFF_BUFFER bufferArgs = { }; | ||
| 1524 | BUFF_BUFFER bufferResults = { }; | ||
| 1525 | PIPE_RPC_RESULT rpc = { }; | ||
| 1526 | SIZE_T iBuffer = 0; | ||
| 1527 | |||
| 1528 | // Init structs. | ||
| 1529 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1530 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 1531 | args.wzPayloadId = wzPayloadId; | ||
| 1532 | args.hrStatus = hrStatus; | ||
| 1533 | args.recommendation = *pAction; | ||
| 1534 | |||
| 1535 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1536 | results.action = *pAction; | ||
| 1537 | |||
| 1538 | // Send args. | ||
| 1539 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1540 | ExitOnFailure(hr, "Failed to write API version of OnCacheVerifyComplete args."); | ||
| 1541 | |||
| 1542 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 1543 | ExitOnFailure(hr, "Failed to write package or container id of OnCacheVerifyComplete args."); | ||
| 1544 | |||
| 1545 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 1546 | ExitOnFailure(hr, "Failed to write payload id of OnCacheVerifyComplete args."); | ||
| 1547 | |||
| 1548 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 1549 | ExitOnFailure(hr, "Failed to write status of OnCacheVerifyComplete args."); | ||
| 1550 | |||
| 1551 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 1552 | ExitOnFailure(hr, "Failed to write recommendation of OnCacheVerifyComplete args."); | ||
| 1553 | |||
| 1554 | // Send results. | ||
| 1555 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1556 | ExitOnFailure(hr, "Failed to write API version of OnCacheVerifyComplete results."); | ||
| 1557 | |||
| 1558 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 1559 | ExitOnFailure(hr, "Failed to write action of OnCacheVerifyComplete results."); | ||
| 1560 | |||
| 1561 | // Callback. | ||
| 1562 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 1563 | ExitOnFailure(hr, "BA OnCacheVerifyComplete failed."); | ||
| 1564 | |||
| 1565 | if (S_FALSE == hr) | ||
| 1566 | { | ||
| 1567 | ExitFunction(); | ||
| 1568 | } | ||
| 1569 | |||
| 1570 | // Read results. | ||
| 1571 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1572 | ExitOnFailure(hr, "Failed to read size of OnCacheVerifyComplete result."); | ||
| 1573 | |||
| 1574 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 1575 | ExitOnFailure(hr, "Failed to read action of OnCacheVerifyComplete result."); | ||
| 1576 | |||
| 1577 | if (FAILED(hrStatus)) | ||
| 1578 | { | ||
| 1579 | *pAction = results.action; | ||
| 1580 | } | ||
| 1581 | |||
| 1582 | LExit: | ||
| 1583 | PipeFreeRpcResult(&rpc); | ||
| 1584 | ReleaseBuffer(bufferResults); | ||
| 1585 | ReleaseBuffer(bufferArgs); | ||
| 1586 | |||
| 1587 | return hr; | ||
| 1588 | } | ||
| 1589 | |||
| 1590 | EXTERN_C HRESULT BACallbackOnCacheVerifyProgress( | ||
| 1591 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1592 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 1593 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 1594 | __in DWORD64 dw64Progress, | ||
| 1595 | __in DWORD64 dw64Total, | ||
| 1596 | __in DWORD dwOverallPercentage, | ||
| 1597 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep | ||
| 1598 | ) | ||
| 1599 | { | ||
| 1600 | HRESULT hr = S_OK; | ||
| 1601 | BA_ONCACHEVERIFYPROGRESS_ARGS args = { }; | ||
| 1602 | BA_ONCACHEVERIFYPROGRESS_RESULTS results = { }; | ||
| 1603 | BUFF_BUFFER bufferArgs = { }; | ||
| 1604 | BUFF_BUFFER bufferResults = { }; | ||
| 1605 | PIPE_RPC_RESULT rpc = { }; | ||
| 1606 | SIZE_T iBuffer = 0; | ||
| 1607 | |||
| 1608 | // Init structs. | ||
| 1609 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1610 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
| 1611 | args.wzPayloadId = wzPayloadId; | ||
| 1612 | args.dw64Progress = dw64Progress; | ||
| 1613 | args.dw64Total = dw64Total; | ||
| 1614 | args.dwOverallPercentage = dwOverallPercentage; | ||
| 1615 | args.verifyStep = verifyStep; | ||
| 1616 | |||
| 1617 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1618 | |||
| 1619 | // Send args. | ||
| 1620 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1621 | ExitOnFailure(hr, "Failed to write API version of OnCacheVerifyProgress args."); | ||
| 1622 | |||
| 1623 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId); | ||
| 1624 | ExitOnFailure(hr, "Failed to write package or container id of OnCacheVerifyProgress args."); | ||
| 1625 | |||
| 1626 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId); | ||
| 1627 | ExitOnFailure(hr, "Failed to write payload id of OnCacheVerifyProgress args."); | ||
| 1628 | |||
| 1629 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Progress); | ||
| 1630 | ExitOnFailure(hr, "Failed to write progress of OnCacheVerifyProgress args."); | ||
| 1631 | |||
| 1632 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Total); | ||
| 1633 | ExitOnFailure(hr, "Failed to write total progress of OnCacheVerifyProgress args."); | ||
| 1634 | |||
| 1635 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallPercentage); | ||
| 1636 | ExitOnFailure(hr, "Failed to write overall percentage of OnCacheVerifyProgress args."); | ||
| 1637 | |||
| 1638 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.verifyStep); | ||
| 1639 | ExitOnFailure(hr, "Failed to write verify step of OnCacheVerifyProgress args."); | ||
| 1640 | |||
| 1641 | // Send results. | ||
| 1642 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1643 | ExitOnFailure(hr, "Failed to write API version of OnCacheVerifyProgress results."); | ||
| 1644 | |||
| 1645 | // Callback. | ||
| 1646 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, &bufferArgs, &bufferResults, &rpc); | ||
| 1647 | ExitOnFailure(hr, "BA OnCacheVerifyProgress failed."); | ||
| 1648 | |||
| 1649 | if (S_FALSE == hr) | ||
| 1650 | { | ||
| 1651 | ExitFunction(); | ||
| 1652 | } | ||
| 1653 | |||
| 1654 | // Read results. | ||
| 1655 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1656 | ExitOnFailure(hr, "Failed to read size of OnCacheVerifyProgress result."); | ||
| 1657 | |||
| 1658 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1659 | ExitOnFailure(hr, "Failed to read cancel of OnCacheVerifyProgress result."); | ||
| 1660 | |||
| 1661 | if (results.fCancel) | ||
| 1662 | { | ||
| 1663 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1664 | } | ||
| 1665 | |||
| 1666 | LExit: | ||
| 1667 | PipeFreeRpcResult(&rpc); | ||
| 1668 | ReleaseBuffer(bufferResults); | ||
| 1669 | ReleaseBuffer(bufferArgs); | ||
| 1670 | |||
| 1671 | return hr; | ||
| 1672 | } | ||
| 1673 | |||
| 1674 | EXTERN_C HRESULT BACallbackOnCommitMsiTransactionBegin( | ||
| 1675 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1676 | __in LPCWSTR wzTransactionId | ||
| 1677 | ) | ||
| 1678 | { | ||
| 1679 | HRESULT hr = S_OK; | ||
| 1680 | BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS args = { }; | ||
| 1681 | BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS results = { }; | ||
| 1682 | BUFF_BUFFER bufferArgs = { }; | ||
| 1683 | BUFF_BUFFER bufferResults = { }; | ||
| 1684 | PIPE_RPC_RESULT rpc = { }; | ||
| 1685 | SIZE_T iBuffer = 0; | ||
| 1686 | |||
| 1687 | // Init structs. | ||
| 1688 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1689 | args.wzTransactionId = wzTransactionId; | ||
| 1690 | |||
| 1691 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1692 | |||
| 1693 | // Send args. | ||
| 1694 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1695 | ExitOnFailure(hr, "Failed to write API version of OnCommitMsiTransactionBegin args."); | ||
| 1696 | |||
| 1697 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTransactionId); | ||
| 1698 | ExitOnFailure(hr, "Failed to write transaction id of OnCommitMsiTransactionBegin args."); | ||
| 1699 | |||
| 1700 | // Send results. | ||
| 1701 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1702 | ExitOnFailure(hr, "Failed to write API version of OnCommitMsiTransactionBegin results."); | ||
| 1703 | |||
| 1704 | // Callback. | ||
| 1705 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 1706 | ExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed."); | ||
| 1707 | |||
| 1708 | if (S_FALSE == hr) | ||
| 1709 | { | ||
| 1710 | ExitFunction(); | ||
| 1711 | } | ||
| 1712 | |||
| 1713 | // Read results. | ||
| 1714 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1715 | ExitOnFailure(hr, "Failed to read size of OnCommitMsiTransactionBegin result."); | ||
| 1716 | |||
| 1717 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1718 | ExitOnFailure(hr, "Failed to read cancel of OnCommitMsiTransactionBegin result."); | ||
| 1719 | |||
| 1720 | if (results.fCancel) | ||
| 1721 | { | ||
| 1722 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1723 | } | ||
| 1724 | |||
| 1725 | LExit: | ||
| 1726 | PipeFreeRpcResult(&rpc); | ||
| 1727 | ReleaseBuffer(bufferResults); | ||
| 1728 | ReleaseBuffer(bufferArgs); | ||
| 1729 | |||
| 1730 | return hr; | ||
| 1731 | } | ||
| 1732 | |||
| 1733 | EXTERN_C HRESULT BACallbackOnCommitMsiTransactionComplete( | ||
| 1734 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1735 | __in LPCWSTR wzTransactionId, | ||
| 1736 | __in HRESULT hrStatus, | ||
| 1737 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 1738 | __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION* pAction | ||
| 1739 | ) | ||
| 1740 | { | ||
| 1741 | HRESULT hr = S_OK; | ||
| 1742 | BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS args = { }; | ||
| 1743 | BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS results = { }; | ||
| 1744 | BUFF_BUFFER bufferArgs = { }; | ||
| 1745 | BUFF_BUFFER bufferResults = { }; | ||
| 1746 | PIPE_RPC_RESULT rpc = { }; | ||
| 1747 | SIZE_T iBuffer = 0; | ||
| 1748 | |||
| 1749 | // Init structs. | ||
| 1750 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1751 | args.wzTransactionId = wzTransactionId; | ||
| 1752 | args.hrStatus = hrStatus; | ||
| 1753 | args.restart = restart; | ||
| 1754 | args.recommendation = *pAction; | ||
| 1755 | |||
| 1756 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1757 | results.action = *pAction; | ||
| 1758 | |||
| 1759 | // Send args. | ||
| 1760 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1761 | ExitOnFailure(hr, "Failed to write API version of OnCommitMsiTransactionComplete args."); | ||
| 1762 | |||
| 1763 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTransactionId); | ||
| 1764 | ExitOnFailure(hr, "Failed to write transaction id of OnCommitMsiTransactionComplete args."); | ||
| 1765 | |||
| 1766 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 1767 | ExitOnFailure(hr, "Failed to write status of OnCommitMsiTransactionComplete args."); | ||
| 1768 | |||
| 1769 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.restart); | ||
| 1770 | ExitOnFailure(hr, "Failed to write restart of OnCommitMsiTransactionComplete args."); | ||
| 1771 | |||
| 1772 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 1773 | ExitOnFailure(hr, "Failed to write recommendation of OnCommitMsiTransactionComplete args."); | ||
| 1774 | |||
| 1775 | // Send results. | ||
| 1776 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1777 | ExitOnFailure(hr, "Failed to write API version of OnCommitMsiTransactionComplete results."); | ||
| 1778 | |||
| 1779 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 1780 | ExitOnFailure(hr, "Failed to write API version of OnCommitMsiTransactionComplete results."); | ||
| 1781 | |||
| 1782 | // Callback. | ||
| 1783 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 1784 | ExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed."); | ||
| 1785 | |||
| 1786 | if (S_FALSE == hr) | ||
| 1787 | { | ||
| 1788 | ExitFunction(); | ||
| 1789 | } | ||
| 1790 | |||
| 1791 | // Read results. | ||
| 1792 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1793 | ExitOnFailure(hr, "Failed to read size of OnCommitMsiTransactionComplete result."); | ||
| 1794 | |||
| 1795 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 1796 | ExitOnFailure(hr, "Failed to read action of OnCommitMsiTransactionComplete result."); | ||
| 1797 | |||
| 1798 | *pAction = results.action; | ||
| 1799 | |||
| 1800 | LExit: | ||
| 1801 | PipeFreeRpcResult(&rpc); | ||
| 1802 | ReleaseBuffer(bufferResults); | ||
| 1803 | ReleaseBuffer(bufferArgs); | ||
| 1804 | |||
| 1805 | return hr; | ||
| 1806 | } | ||
| 1807 | |||
| 1808 | EXTERN_C HRESULT BACallbackOnCreate( | ||
| 1809 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1810 | __in BOOTSTRAPPER_COMMAND* pCommand | ||
| 1811 | ) | ||
| 1812 | { | ||
| 1813 | HRESULT hr = S_OK; | ||
| 1814 | BA_ONCREATE_ARGS args = { }; | ||
| 1815 | BA_ONCREATE_RESULTS results = { }; | ||
| 1816 | BUFF_BUFFER bufferArgs = { }; | ||
| 1817 | BUFF_BUFFER bufferResults = { }; | ||
| 1818 | PIPE_RPC_RESULT rpc = { }; | ||
| 1819 | |||
| 1820 | // Init structs. | ||
| 1821 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1822 | |||
| 1823 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1824 | |||
| 1825 | // Send args. | ||
| 1826 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1827 | ExitOnFailure(hr, "Failed to write API version of OnCreate args."); | ||
| 1828 | |||
| 1829 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->cbSize); | ||
| 1830 | ExitOnFailure(hr, "Failed to write size of OnCreate args command."); | ||
| 1831 | |||
| 1832 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->action); | ||
| 1833 | ExitOnFailure(hr, "Failed to write action of OnCreate args command."); | ||
| 1834 | |||
| 1835 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->display); | ||
| 1836 | ExitOnFailure(hr, "Failed to write display of OnCreate args command."); | ||
| 1837 | |||
| 1838 | hr = BuffWriteStringToBuffer(&bufferArgs, pCommand->wzCommandLine); | ||
| 1839 | ExitOnFailure(hr, "Failed to write command-line of OnCreate args command."); | ||
| 1840 | |||
| 1841 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->nCmdShow); | ||
| 1842 | ExitOnFailure(hr, "Failed to write show command of OnCreate args command."); | ||
| 1843 | |||
| 1844 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->resumeType); | ||
| 1845 | ExitOnFailure(hr, "Failed to write resume type of OnCreate args command."); | ||
| 1846 | |||
| 1847 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, reinterpret_cast<DWORD64>(pCommand->hwndSplashScreen)); | ||
| 1848 | ExitOnFailure(hr, "Failed to write splash screen handle of OnCreate args command."); | ||
| 1849 | |||
| 1850 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->relationType); | ||
| 1851 | ExitOnFailure(hr, "Failed to write relation type of OnCreate args command."); | ||
| 1852 | |||
| 1853 | hr = BuffWriteNumberToBuffer(&bufferArgs, pCommand->fPassthrough); | ||
| 1854 | ExitOnFailure(hr, "Failed to write passthrough of OnCreate args command."); | ||
| 1855 | |||
| 1856 | hr = BuffWriteStringToBuffer(&bufferArgs, pCommand->wzLayoutDirectory); | ||
| 1857 | ExitOnFailure(hr, "Failed to write layout directory of OnCreate args command."); | ||
| 1858 | |||
| 1859 | hr = BuffWriteStringToBuffer(&bufferArgs, pCommand->wzBootstrapperWorkingFolder); | ||
| 1860 | ExitOnFailure(hr, "Failed to write working folder of OnCreate args command."); | ||
| 1861 | |||
| 1862 | hr = BuffWriteStringToBuffer(&bufferArgs, pCommand->wzBootstrapperApplicationDataPath); | ||
| 1863 | ExitOnFailure(hr, "Failed to write application data path of OnCreate args command."); | ||
| 1864 | |||
| 1865 | // Send results. | ||
| 1866 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1867 | ExitOnFailure(hr, "Failed to write API version of OnCreate results."); | ||
| 1868 | |||
| 1869 | // Callback. | ||
| 1870 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCREATE, &bufferArgs, &bufferResults, &rpc); | ||
| 1871 | ExitOnFailure(hr, "BA OnCreate failed."); | ||
| 1872 | |||
| 1873 | if (S_FALSE == hr) | ||
| 1874 | { | ||
| 1875 | ExitFunction(); | ||
| 1876 | } | ||
| 1877 | |||
| 1878 | LExit: | ||
| 1879 | PipeFreeRpcResult(&rpc); | ||
| 1880 | ReleaseBuffer(bufferResults); | ||
| 1881 | ReleaseBuffer(bufferArgs); | ||
| 1882 | |||
| 1883 | return hr; | ||
| 1884 | } | ||
| 1885 | |||
| 1886 | EXTERN_C HRESULT BACallbackOnDestroy( | ||
| 1887 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1888 | __in BOOL fReload | ||
| 1889 | ) | ||
| 1890 | { | ||
| 1891 | HRESULT hr = S_OK; | ||
| 1892 | BA_ONDESTROY_ARGS args = { }; | ||
| 1893 | BA_ONDESTROY_RESULTS results = { }; | ||
| 1894 | BUFF_BUFFER bufferArgs = { }; | ||
| 1895 | BUFF_BUFFER bufferResults = { }; | ||
| 1896 | PIPE_RPC_RESULT rpc = { }; | ||
| 1897 | |||
| 1898 | // Init structs. | ||
| 1899 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1900 | args.fReload = fReload; | ||
| 1901 | |||
| 1902 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1903 | |||
| 1904 | // Send args. | ||
| 1905 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1906 | ExitOnFailure(hr, "Failed to write API version of OnDestroy args."); | ||
| 1907 | |||
| 1908 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fReload); | ||
| 1909 | ExitOnFailure(hr, "Failed to write reload of OnDestroy args."); | ||
| 1910 | |||
| 1911 | // Send results. | ||
| 1912 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1913 | ExitOnFailure(hr, "Failed to write API version of OnDestroy results."); | ||
| 1914 | |||
| 1915 | // Callback. | ||
| 1916 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY, &bufferArgs, &bufferResults, &rpc); | ||
| 1917 | ExitOnFailure(hr, "BA OnDestroy failed."); | ||
| 1918 | |||
| 1919 | if (S_FALSE == hr) | ||
| 1920 | { | ||
| 1921 | ExitFunction(); | ||
| 1922 | } | ||
| 1923 | |||
| 1924 | LExit: | ||
| 1925 | PipeFreeRpcResult(&rpc); | ||
| 1926 | ReleaseBuffer(bufferResults); | ||
| 1927 | ReleaseBuffer(bufferArgs); | ||
| 1928 | |||
| 1929 | return hr; | ||
| 1930 | } | ||
| 1931 | |||
| 1932 | EXTERN_C HRESULT BACallbackOnDetectBegin( | ||
| 1933 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 1934 | __in BOOL fCached, | ||
| 1935 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, | ||
| 1936 | __in DWORD cPackages | ||
| 1937 | ) | ||
| 1938 | { | ||
| 1939 | HRESULT hr = S_OK; | ||
| 1940 | BA_ONDETECTBEGIN_ARGS args = { }; | ||
| 1941 | BA_ONDETECTBEGIN_RESULTS results = { }; | ||
| 1942 | BUFF_BUFFER bufferArgs = { }; | ||
| 1943 | BUFF_BUFFER bufferResults = { }; | ||
| 1944 | PIPE_RPC_RESULT rpc = { }; | ||
| 1945 | SIZE_T iBuffer = 0; | ||
| 1946 | |||
| 1947 | // Init structs. | ||
| 1948 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1949 | args.registrationType = registrationType; | ||
| 1950 | args.cPackages = cPackages; | ||
| 1951 | args.fCached = fCached; | ||
| 1952 | |||
| 1953 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 1954 | |||
| 1955 | // Send args. | ||
| 1956 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 1957 | ExitOnFailure(hr, "Failed to write API version of OnDetectBegin args."); | ||
| 1958 | |||
| 1959 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.registrationType); | ||
| 1960 | ExitOnFailure(hr, "Failed to write restart of OnDetectBegin args."); | ||
| 1961 | |||
| 1962 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cPackages); | ||
| 1963 | ExitOnFailure(hr, "Failed to write package count of OnDetectBegin args."); | ||
| 1964 | |||
| 1965 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fCached); | ||
| 1966 | ExitOnFailure(hr, "Failed to write cached of OnDetectBegin args."); | ||
| 1967 | |||
| 1968 | // Send results. | ||
| 1969 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 1970 | ExitOnFailure(hr, "Failed to write API version of OnDetectBegin results."); | ||
| 1971 | |||
| 1972 | // Callback. | ||
| 1973 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 1974 | ExitOnFailure(hr, "BA OnDetectBegin failed."); | ||
| 1975 | |||
| 1976 | if (S_FALSE == hr) | ||
| 1977 | { | ||
| 1978 | ExitFunction(); | ||
| 1979 | } | ||
| 1980 | |||
| 1981 | // Read results. | ||
| 1982 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 1983 | ExitOnFailure(hr, "Failed to read size of OnDetectBegin result."); | ||
| 1984 | |||
| 1985 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 1986 | ExitOnFailure(hr, "Failed to read cancel of OnDetectBegin result."); | ||
| 1987 | |||
| 1988 | if (results.fCancel) | ||
| 1989 | { | ||
| 1990 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 1991 | } | ||
| 1992 | |||
| 1993 | LExit: | ||
| 1994 | PipeFreeRpcResult(&rpc); | ||
| 1995 | ReleaseBuffer(bufferResults); | ||
| 1996 | ReleaseBuffer(bufferArgs); | ||
| 1997 | |||
| 1998 | return hr; | ||
| 1999 | } | ||
| 2000 | |||
| 2001 | EXTERN_C HRESULT BACallbackOnDetectCompatibleMsiPackage( | ||
| 2002 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2003 | __in_z LPCWSTR wzPackageId, | ||
| 2004 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 2005 | __in VERUTIL_VERSION* pCompatiblePackageVersion | ||
| 2006 | ) | ||
| 2007 | { | ||
| 2008 | HRESULT hr = S_OK; | ||
| 2009 | BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS args = { }; | ||
| 2010 | BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS results = { }; | ||
| 2011 | BUFF_BUFFER bufferArgs = { }; | ||
| 2012 | BUFF_BUFFER bufferResults = { }; | ||
| 2013 | PIPE_RPC_RESULT rpc = { }; | ||
| 2014 | SIZE_T iBuffer = 0; | ||
| 2015 | |||
| 2016 | // Init structs. | ||
| 2017 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2018 | args.wzPackageId = wzPackageId; | ||
| 2019 | args.wzCompatiblePackageId = wzCompatiblePackageId; | ||
| 2020 | args.wzCompatiblePackageVersion = pCompatiblePackageVersion->sczVersion; | ||
| 2021 | |||
| 2022 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2023 | |||
| 2024 | // Send args. | ||
| 2025 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2026 | ExitOnFailure(hr, "Failed to write API version of OnDetectCompatibleMsiPackage args."); | ||
| 2027 | |||
| 2028 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2029 | ExitOnFailure(hr, "Failed to write package id of OnDetectCompatibleMsiPackage args."); | ||
| 2030 | |||
| 2031 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCompatiblePackageId); | ||
| 2032 | ExitOnFailure(hr, "Failed to write compatible package id of OnDetectCompatibleMsiPackage args."); | ||
| 2033 | |||
| 2034 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCompatiblePackageVersion); | ||
| 2035 | ExitOnFailure(hr, "Failed to write compatible package version of OnDetectCompatibleMsiPackage args."); | ||
| 2036 | |||
| 2037 | // Send results. | ||
| 2038 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2039 | ExitOnFailure(hr, "Failed to write API version of OnDetectCompatibleMsiPackage results."); | ||
| 2040 | |||
| 2041 | // Callback. | ||
| 2042 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 2043 | ExitOnFailure(hr, "BA OnDetectCompatibleMsiPackage failed."); | ||
| 2044 | |||
| 2045 | if (S_FALSE == hr) | ||
| 2046 | { | ||
| 2047 | ExitFunction(); | ||
| 2048 | } | ||
| 2049 | |||
| 2050 | // Read results. | ||
| 2051 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2052 | ExitOnFailure(hr, "Failed to read size of OnDetectCompatibleMsiPackage result."); | ||
| 2053 | |||
| 2054 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2055 | ExitOnFailure(hr, "Failed to read cancel of OnDetectCompatibleMsiPackage result."); | ||
| 2056 | |||
| 2057 | if (results.fCancel) | ||
| 2058 | { | ||
| 2059 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2060 | } | ||
| 2061 | |||
| 2062 | LExit: | ||
| 2063 | PipeFreeRpcResult(&rpc); | ||
| 2064 | ReleaseBuffer(bufferResults); | ||
| 2065 | ReleaseBuffer(bufferArgs); | ||
| 2066 | |||
| 2067 | return hr; | ||
| 2068 | } | ||
| 2069 | |||
| 2070 | EXTERN_C HRESULT BACallbackOnDetectComplete( | ||
| 2071 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2072 | __in HRESULT hrStatus, | ||
| 2073 | __in BOOL fEligibleForCleanup | ||
| 2074 | ) | ||
| 2075 | { | ||
| 2076 | HRESULT hr = S_OK; | ||
| 2077 | BA_ONDETECTCOMPLETE_ARGS args = { }; | ||
| 2078 | BA_ONDETECTCOMPLETE_RESULTS results = { }; | ||
| 2079 | BUFF_BUFFER bufferArgs = { }; | ||
| 2080 | BUFF_BUFFER bufferResults = { }; | ||
| 2081 | PIPE_RPC_RESULT rpc = { }; | ||
| 2082 | |||
| 2083 | // Init structs. | ||
| 2084 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2085 | args.hrStatus = hrStatus; | ||
| 2086 | args.fEligibleForCleanup = fEligibleForCleanup; | ||
| 2087 | |||
| 2088 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2089 | |||
| 2090 | // Send args. | ||
| 2091 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2092 | ExitOnFailure(hr, "Failed to write API version of OnDetectComplete args."); | ||
| 2093 | |||
| 2094 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 2095 | ExitOnFailure(hr, "Failed to write status of OnDetectComplete args."); | ||
| 2096 | |||
| 2097 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fEligibleForCleanup); | ||
| 2098 | ExitOnFailure(hr, "Failed to write eligible for cleanup of OnDetectComplete args."); | ||
| 2099 | |||
| 2100 | // Send results. | ||
| 2101 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2102 | ExitOnFailure(hr, "Failed to write API version of OnDetectComplete results."); | ||
| 2103 | |||
| 2104 | // Callback. | ||
| 2105 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 2106 | ExitOnFailure(hr, "BA OnDetectComplete failed."); | ||
| 2107 | |||
| 2108 | if (S_FALSE == hr) | ||
| 2109 | { | ||
| 2110 | ExitFunction(); | ||
| 2111 | } | ||
| 2112 | |||
| 2113 | LExit: | ||
| 2114 | PipeFreeRpcResult(&rpc); | ||
| 2115 | ReleaseBuffer(bufferResults); | ||
| 2116 | ReleaseBuffer(bufferArgs); | ||
| 2117 | |||
| 2118 | return hr; | ||
| 2119 | } | ||
| 2120 | |||
| 2121 | EXTERN_C HRESULT BACallbackOnDetectForwardCompatibleBundle( | ||
| 2122 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2123 | __in_z LPCWSTR wzBundleId, | ||
| 2124 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 2125 | __in_z LPCWSTR wzBundleTag, | ||
| 2126 | __in BOOL fPerMachine, | ||
| 2127 | __in VERUTIL_VERSION* pVersion, | ||
| 2128 | __in BOOL fMissingFromCache | ||
| 2129 | ) | ||
| 2130 | { | ||
| 2131 | HRESULT hr = S_OK; | ||
| 2132 | BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; | ||
| 2133 | BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; | ||
| 2134 | BUFF_BUFFER bufferArgs = { }; | ||
| 2135 | BUFF_BUFFER bufferResults = { }; | ||
| 2136 | PIPE_RPC_RESULT rpc = { }; | ||
| 2137 | SIZE_T iBuffer = 0; | ||
| 2138 | |||
| 2139 | // Init structs. | ||
| 2140 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2141 | args.wzBundleId = wzBundleId; | ||
| 2142 | args.relationType = relationType; | ||
| 2143 | args.wzBundleTag = wzBundleTag; | ||
| 2144 | args.fPerMachine = fPerMachine; | ||
| 2145 | args.wzVersion = pVersion->sczVersion; | ||
| 2146 | args.fMissingFromCache = fMissingFromCache; | ||
| 2147 | |||
| 2148 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2149 | |||
| 2150 | // Send args. | ||
| 2151 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2152 | ExitOnFailure(hr, "Failed to write API version of OnDetectForwardCompatibleBundle args."); | ||
| 2153 | |||
| 2154 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 2155 | ExitOnFailure(hr, "Failed to write bundle id of OnDetectForwardCompatibleBundle args."); | ||
| 2156 | |||
| 2157 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.relationType); | ||
| 2158 | ExitOnFailure(hr, "Failed to write relation type of OnDetectForwardCompatibleBundle args."); | ||
| 2159 | |||
| 2160 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleTag); | ||
| 2161 | ExitOnFailure(hr, "Failed to write bundle tag of OnDetectForwardCompatibleBundle args."); | ||
| 2162 | |||
| 2163 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPerMachine); | ||
| 2164 | ExitOnFailure(hr, "Failed to write per-machine of OnDetectForwardCompatibleBundle args."); | ||
| 2165 | |||
| 2166 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion); | ||
| 2167 | ExitOnFailure(hr, "Failed to write version of OnDetectForwardCompatibleBundle args."); | ||
| 2168 | |||
| 2169 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fMissingFromCache); | ||
| 2170 | ExitOnFailure(hr, "Failed to write missing from cache of OnDetectForwardCompatibleBundle args."); | ||
| 2171 | |||
| 2172 | // Send results. | ||
| 2173 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2174 | ExitOnFailure(hr, "Failed to write API version of OnDetectForwardCompatibleBundle results."); | ||
| 2175 | |||
| 2176 | // Callback. | ||
| 2177 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &bufferArgs, &bufferResults, &rpc); | ||
| 2178 | ExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed."); | ||
| 2179 | |||
| 2180 | if (S_FALSE == hr) | ||
| 2181 | { | ||
| 2182 | ExitFunction(); | ||
| 2183 | } | ||
| 2184 | |||
| 2185 | // Read results. | ||
| 2186 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2187 | ExitOnFailure(hr, "Failed to read size of OnDetectForwardCompatibleBundle result."); | ||
| 2188 | |||
| 2189 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2190 | ExitOnFailure(hr, "Failed to read cancel of OnDetectForwardCompatibleBundle result."); | ||
| 2191 | |||
| 2192 | if (results.fCancel) | ||
| 2193 | { | ||
| 2194 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2195 | } | ||
| 2196 | |||
| 2197 | LExit: | ||
| 2198 | PipeFreeRpcResult(&rpc); | ||
| 2199 | ReleaseBuffer(bufferResults); | ||
| 2200 | ReleaseBuffer(bufferArgs); | ||
| 2201 | |||
| 2202 | return hr; | ||
| 2203 | } | ||
| 2204 | |||
| 2205 | EXTERN_C HRESULT BACallbackOnDetectMsiFeature( | ||
| 2206 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2207 | __in_z LPCWSTR wzPackageId, | ||
| 2208 | __in_z LPCWSTR wzFeatureId, | ||
| 2209 | __in BOOTSTRAPPER_FEATURE_STATE state | ||
| 2210 | ) | ||
| 2211 | { | ||
| 2212 | HRESULT hr = S_OK; | ||
| 2213 | BA_ONDETECTMSIFEATURE_ARGS args = { }; | ||
| 2214 | BA_ONDETECTMSIFEATURE_RESULTS results = { }; | ||
| 2215 | BUFF_BUFFER bufferArgs = { }; | ||
| 2216 | BUFF_BUFFER bufferResults = { }; | ||
| 2217 | PIPE_RPC_RESULT rpc = { }; | ||
| 2218 | SIZE_T iBuffer = 0; | ||
| 2219 | |||
| 2220 | // Init structs. | ||
| 2221 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2222 | args.wzPackageId = wzPackageId; | ||
| 2223 | args.wzFeatureId = wzFeatureId; | ||
| 2224 | args.state = state; | ||
| 2225 | |||
| 2226 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2227 | |||
| 2228 | // Send args. | ||
| 2229 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2230 | ExitOnFailure(hr, "Failed to write API version of OnDetectMsiFeature args."); | ||
| 2231 | |||
| 2232 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2233 | ExitOnFailure(hr, "Failed to write package id of OnDetectMsiFeature args."); | ||
| 2234 | |||
| 2235 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzFeatureId); | ||
| 2236 | ExitOnFailure(hr, "Failed to write feature id of OnDetectMsiFeature args."); | ||
| 2237 | |||
| 2238 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.state); | ||
| 2239 | ExitOnFailure(hr, "Failed to write state of OnDetectMsiFeature args."); | ||
| 2240 | |||
| 2241 | // Send results. | ||
| 2242 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2243 | ExitOnFailure(hr, "Failed to write API version of OnDetectMsiFeature results."); | ||
| 2244 | |||
| 2245 | // Callback. | ||
| 2246 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &bufferArgs, &bufferResults, &rpc); | ||
| 2247 | ExitOnFailure(hr, "BA OnDetectMsiFeature failed."); | ||
| 2248 | |||
| 2249 | if (S_FALSE == hr) | ||
| 2250 | { | ||
| 2251 | ExitFunction(); | ||
| 2252 | } | ||
| 2253 | |||
| 2254 | // Read results. | ||
| 2255 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2256 | ExitOnFailure(hr, "Failed to read size of OnDetectMsiFeature result."); | ||
| 2257 | |||
| 2258 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2259 | ExitOnFailure(hr, "Failed to read cancel of OnDetectMsiFeature result."); | ||
| 2260 | |||
| 2261 | if (results.fCancel) | ||
| 2262 | { | ||
| 2263 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2264 | } | ||
| 2265 | |||
| 2266 | LExit: | ||
| 2267 | PipeFreeRpcResult(&rpc); | ||
| 2268 | ReleaseBuffer(bufferResults); | ||
| 2269 | ReleaseBuffer(bufferArgs); | ||
| 2270 | |||
| 2271 | return hr; | ||
| 2272 | } | ||
| 2273 | |||
| 2274 | EXTERN_C HRESULT BACallbackOnDetectPackageBegin( | ||
| 2275 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2276 | __in_z LPCWSTR wzPackageId | ||
| 2277 | ) | ||
| 2278 | { | ||
| 2279 | HRESULT hr = S_OK; | ||
| 2280 | BA_ONDETECTPACKAGEBEGIN_ARGS args = { }; | ||
| 2281 | BA_ONDETECTPACKAGEBEGIN_RESULTS results = { }; | ||
| 2282 | BUFF_BUFFER bufferArgs = { }; | ||
| 2283 | BUFF_BUFFER bufferResults = { }; | ||
| 2284 | PIPE_RPC_RESULT rpc = { }; | ||
| 2285 | SIZE_T iBuffer = 0; | ||
| 2286 | |||
| 2287 | // Init structs. | ||
| 2288 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2289 | args.wzPackageId = wzPackageId; | ||
| 2290 | |||
| 2291 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2292 | |||
| 2293 | // Send args. | ||
| 2294 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2295 | ExitOnFailure(hr, "Failed to write API version of OnDetectPackageBegin args."); | ||
| 2296 | |||
| 2297 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2298 | ExitOnFailure(hr, "Failed to write package id of OnDetectPackageBegin args."); | ||
| 2299 | |||
| 2300 | // Send results. | ||
| 2301 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2302 | ExitOnFailure(hr, "Failed to write API version of OnDetectPackageBegin results."); | ||
| 2303 | |||
| 2304 | // Callback. | ||
| 2305 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 2306 | ExitOnFailure(hr, "BA OnDetectPackageBegin failed."); | ||
| 2307 | |||
| 2308 | if (S_FALSE == hr) | ||
| 2309 | { | ||
| 2310 | ExitFunction(); | ||
| 2311 | } | ||
| 2312 | |||
| 2313 | // Read results. | ||
| 2314 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2315 | ExitOnFailure(hr, "Failed to read size of OnDetectPackageBegin result."); | ||
| 2316 | |||
| 2317 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2318 | ExitOnFailure(hr, "Failed to read cancel of OnDetectPackageBegin result."); | ||
| 2319 | |||
| 2320 | if (results.fCancel) | ||
| 2321 | { | ||
| 2322 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2323 | } | ||
| 2324 | |||
| 2325 | LExit: | ||
| 2326 | PipeFreeRpcResult(&rpc); | ||
| 2327 | ReleaseBuffer(bufferResults); | ||
| 2328 | ReleaseBuffer(bufferArgs); | ||
| 2329 | |||
| 2330 | return hr; | ||
| 2331 | } | ||
| 2332 | |||
| 2333 | EXTERN_C HRESULT BACallbackOnDetectPackageComplete( | ||
| 2334 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2335 | __in_z LPCWSTR wzPackageId, | ||
| 2336 | __in HRESULT hrStatus, | ||
| 2337 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
| 2338 | __in BOOL fCached | ||
| 2339 | ) | ||
| 2340 | { | ||
| 2341 | HRESULT hr = S_OK; | ||
| 2342 | BA_ONDETECTPACKAGECOMPLETE_ARGS args = { }; | ||
| 2343 | BA_ONDETECTPACKAGECOMPLETE_RESULTS results = { }; | ||
| 2344 | BUFF_BUFFER bufferArgs = { }; | ||
| 2345 | BUFF_BUFFER bufferResults = { }; | ||
| 2346 | PIPE_RPC_RESULT rpc = { }; | ||
| 2347 | |||
| 2348 | // Init structs. | ||
| 2349 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2350 | args.wzPackageId = wzPackageId; | ||
| 2351 | args.hrStatus = hrStatus; | ||
| 2352 | args.state = state; | ||
| 2353 | args.fCached = fCached; | ||
| 2354 | |||
| 2355 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2356 | |||
| 2357 | // Send args. | ||
| 2358 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2359 | ExitOnFailure(hr, "Failed to write API version of OnDetectPackageComplete args."); | ||
| 2360 | |||
| 2361 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2362 | ExitOnFailure(hr, "Failed to write package id of OnDetectPackageComplete args."); | ||
| 2363 | |||
| 2364 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 2365 | ExitOnFailure(hr, "Failed to write status of OnDetectPackageComplete args."); | ||
| 2366 | |||
| 2367 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.state); | ||
| 2368 | ExitOnFailure(hr, "Failed to write state of OnDetectPackageComplete args."); | ||
| 2369 | |||
| 2370 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fCached); | ||
| 2371 | ExitOnFailure(hr, "Failed to write cached of OnDetectPackageComplete args."); | ||
| 2372 | |||
| 2373 | // Send results. | ||
| 2374 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2375 | ExitOnFailure(hr, "Failed to write API version of OnDetectPackageComplete results."); | ||
| 2376 | |||
| 2377 | // Callback. | ||
| 2378 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 2379 | ExitOnFailure(hr, "BA OnDetectPackageComplete failed."); | ||
| 2380 | |||
| 2381 | if (S_FALSE == hr) | ||
| 2382 | { | ||
| 2383 | ExitFunction(); | ||
| 2384 | } | ||
| 2385 | |||
| 2386 | LExit: | ||
| 2387 | PipeFreeRpcResult(&rpc); | ||
| 2388 | ReleaseBuffer(bufferResults); | ||
| 2389 | ReleaseBuffer(bufferArgs); | ||
| 2390 | |||
| 2391 | return hr; | ||
| 2392 | } | ||
| 2393 | |||
| 2394 | EXTERN_C HRESULT BACallbackOnDetectRelatedBundle( | ||
| 2395 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2396 | __in_z LPCWSTR wzBundleId, | ||
| 2397 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 2398 | __in_z LPCWSTR wzBundleTag, | ||
| 2399 | __in BOOL fPerMachine, | ||
| 2400 | __in VERUTIL_VERSION* pVersion, | ||
| 2401 | __in BOOL fMissingFromCache | ||
| 2402 | ) | ||
| 2403 | { | ||
| 2404 | HRESULT hr = S_OK; | ||
| 2405 | BA_ONDETECTRELATEDBUNDLE_ARGS args = { }; | ||
| 2406 | BA_ONDETECTRELATEDBUNDLE_RESULTS results = { }; | ||
| 2407 | BUFF_BUFFER bufferArgs = { }; | ||
| 2408 | BUFF_BUFFER bufferResults = { }; | ||
| 2409 | PIPE_RPC_RESULT rpc = { }; | ||
| 2410 | SIZE_T iBuffer = 0; | ||
| 2411 | |||
| 2412 | // Init structs. | ||
| 2413 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2414 | args.wzBundleId = wzBundleId; | ||
| 2415 | args.relationType = relationType; | ||
| 2416 | args.wzBundleTag = wzBundleTag; | ||
| 2417 | args.fPerMachine = fPerMachine; | ||
| 2418 | args.wzVersion = pVersion->sczVersion; | ||
| 2419 | args.fMissingFromCache = fMissingFromCache; | ||
| 2420 | |||
| 2421 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2422 | |||
| 2423 | // Send args. | ||
| 2424 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2425 | ExitOnFailure(hr, "Failed to write API version of OnDetectRelatedBundle args."); | ||
| 2426 | |||
| 2427 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 2428 | ExitOnFailure(hr, "Failed to write bundle id of OnDetectRelatedBundle args."); | ||
| 2429 | |||
| 2430 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.relationType); | ||
| 2431 | ExitOnFailure(hr, "Failed to write relation type of OnDetectRelatedBundle args."); | ||
| 2432 | |||
| 2433 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleTag); | ||
| 2434 | ExitOnFailure(hr, "Failed to write bundle tag of OnDetectRelatedBundle args."); | ||
| 2435 | |||
| 2436 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPerMachine); | ||
| 2437 | ExitOnFailure(hr, "Failed to write per-machine of OnDetectRelatedBundle args."); | ||
| 2438 | |||
| 2439 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion); | ||
| 2440 | ExitOnFailure(hr, "Failed to write version of OnDetectRelatedBundle args."); | ||
| 2441 | |||
| 2442 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fMissingFromCache); | ||
| 2443 | ExitOnFailure(hr, "Failed to write cached of OnDetectRelatedBundle args."); | ||
| 2444 | |||
| 2445 | // Send results. | ||
| 2446 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2447 | ExitOnFailure(hr, "Failed to write API version of OnDetectRelatedBundle results."); | ||
| 2448 | |||
| 2449 | // Callback. | ||
| 2450 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &bufferArgs, &bufferResults, &rpc); | ||
| 2451 | ExitOnFailure(hr, "BA OnDetectRelatedBundle failed."); | ||
| 2452 | |||
| 2453 | if (S_FALSE == hr) | ||
| 2454 | { | ||
| 2455 | ExitFunction(); | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | // Read results. | ||
| 2459 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2460 | ExitOnFailure(hr, "Failed to read size of OnDetectRelatedBundle result."); | ||
| 2461 | |||
| 2462 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2463 | ExitOnFailure(hr, "Failed to read cancel of OnDetectRelatedBundle result."); | ||
| 2464 | |||
| 2465 | if (results.fCancel) | ||
| 2466 | { | ||
| 2467 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2468 | } | ||
| 2469 | |||
| 2470 | LExit: | ||
| 2471 | PipeFreeRpcResult(&rpc); | ||
| 2472 | ReleaseBuffer(bufferResults); | ||
| 2473 | ReleaseBuffer(bufferArgs); | ||
| 2474 | |||
| 2475 | return hr; | ||
| 2476 | } | ||
| 2477 | |||
| 2478 | EXTERN_C HRESULT BACallbackOnDetectRelatedBundlePackage( | ||
| 2479 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2480 | __in_z LPCWSTR wzPackageId, | ||
| 2481 | __in_z LPCWSTR wzBundleId, | ||
| 2482 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 2483 | __in BOOL fPerMachine, | ||
| 2484 | __in VERUTIL_VERSION* pVersion | ||
| 2485 | ) | ||
| 2486 | { | ||
| 2487 | HRESULT hr = S_OK; | ||
| 2488 | BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS args = { }; | ||
| 2489 | BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS results = { }; | ||
| 2490 | BUFF_BUFFER bufferArgs = { }; | ||
| 2491 | BUFF_BUFFER bufferResults = { }; | ||
| 2492 | PIPE_RPC_RESULT rpc = { }; | ||
| 2493 | SIZE_T iBuffer = 0; | ||
| 2494 | |||
| 2495 | // Init structs. | ||
| 2496 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2497 | args.wzPackageId = wzPackageId; | ||
| 2498 | args.wzBundleId = wzBundleId; | ||
| 2499 | args.relationType = relationType; | ||
| 2500 | args.fPerMachine = fPerMachine; | ||
| 2501 | args.wzVersion = pVersion->sczVersion; | ||
| 2502 | |||
| 2503 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2504 | |||
| 2505 | // Send args. | ||
| 2506 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2507 | ExitOnFailure(hr, "Failed to write API version of OnDetectRelatedBundlePackage args."); | ||
| 2508 | |||
| 2509 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2510 | ExitOnFailure(hr, "Failed to write package id of OnDetectRelatedBundlePackage args."); | ||
| 2511 | |||
| 2512 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 2513 | ExitOnFailure(hr, "Failed to write bundle id of OnDetectRelatedBundlePackage args."); | ||
| 2514 | |||
| 2515 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.relationType); | ||
| 2516 | ExitOnFailure(hr, "Failed to write relation type of OnDetectRelatedBundlePackage args."); | ||
| 2517 | |||
| 2518 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPerMachine); | ||
| 2519 | ExitOnFailure(hr, "Failed to write per-machine of OnDetectRelatedBundlePackage args."); | ||
| 2520 | |||
| 2521 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion); | ||
| 2522 | ExitOnFailure(hr, "Failed to write version of OnDetectRelatedBundlePackage args."); | ||
| 2523 | |||
| 2524 | // Send results. | ||
| 2525 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2526 | ExitOnFailure(hr, "Failed to write API version of OnDetectRelatedBundlePackage results."); | ||
| 2527 | |||
| 2528 | // Callback. | ||
| 2529 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 2530 | ExitOnFailure(hr, "BA OnDetectRelatedBundlePackage failed."); | ||
| 2531 | |||
| 2532 | if (S_FALSE == hr) | ||
| 2533 | { | ||
| 2534 | ExitFunction(); | ||
| 2535 | } | ||
| 2536 | |||
| 2537 | // Read results. | ||
| 2538 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2539 | ExitOnFailure(hr, "Failed to read size of OnDetectRelatedBundlePackage result."); | ||
| 2540 | |||
| 2541 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2542 | ExitOnFailure(hr, "Failed to read cancel of OnDetectRelatedBundlePackage result."); | ||
| 2543 | |||
| 2544 | if (results.fCancel) | ||
| 2545 | { | ||
| 2546 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2547 | } | ||
| 2548 | |||
| 2549 | LExit: | ||
| 2550 | PipeFreeRpcResult(&rpc); | ||
| 2551 | ReleaseBuffer(bufferResults); | ||
| 2552 | ReleaseBuffer(bufferArgs); | ||
| 2553 | |||
| 2554 | return hr; | ||
| 2555 | } | ||
| 2556 | |||
| 2557 | EXTERN_C HRESULT BACallbackOnDetectRelatedMsiPackage( | ||
| 2558 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2559 | __in_z LPCWSTR wzPackageId, | ||
| 2560 | __in_z LPCWSTR wzUpgradeCode, | ||
| 2561 | __in_z LPCWSTR wzProductCode, | ||
| 2562 | __in BOOL fPerMachine, | ||
| 2563 | __in VERUTIL_VERSION* pVersion, | ||
| 2564 | __in BOOTSTRAPPER_RELATED_OPERATION operation | ||
| 2565 | ) | ||
| 2566 | { | ||
| 2567 | HRESULT hr = S_OK; | ||
| 2568 | BA_ONDETECTRELATEDMSIPACKAGE_ARGS args = { }; | ||
| 2569 | BA_ONDETECTRELATEDMSIPACKAGE_RESULTS results = { }; | ||
| 2570 | BUFF_BUFFER bufferArgs = { }; | ||
| 2571 | BUFF_BUFFER bufferResults = { }; | ||
| 2572 | PIPE_RPC_RESULT rpc = { }; | ||
| 2573 | SIZE_T iBuffer = 0; | ||
| 2574 | |||
| 2575 | // Init structs. | ||
| 2576 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2577 | args.wzPackageId = wzPackageId; | ||
| 2578 | args.wzUpgradeCode = wzUpgradeCode; | ||
| 2579 | args.wzProductCode = wzProductCode; | ||
| 2580 | args.fPerMachine = fPerMachine; | ||
| 2581 | args.wzVersion = pVersion->sczVersion; | ||
| 2582 | args.operation = operation; | ||
| 2583 | |||
| 2584 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2585 | |||
| 2586 | // Send args. | ||
| 2587 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2588 | ExitOnFailure(hr, "Failed to write API version of OnDetectRelatedMsiPackage args."); | ||
| 2589 | |||
| 2590 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2591 | ExitOnFailure(hr, "Failed to write package id of OnDetectRelatedMsiPackage args."); | ||
| 2592 | |||
| 2593 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUpgradeCode); | ||
| 2594 | ExitOnFailure(hr, "Failed to write upgrade code of OnDetectRelatedMsiPackage args."); | ||
| 2595 | |||
| 2596 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzProductCode); | ||
| 2597 | ExitOnFailure(hr, "Failed to write product code of OnDetectRelatedMsiPackage args."); | ||
| 2598 | |||
| 2599 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPerMachine); | ||
| 2600 | ExitOnFailure(hr, "Failed to write per-machine of OnDetectRelatedMsiPackage args."); | ||
| 2601 | |||
| 2602 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion); | ||
| 2603 | ExitOnFailure(hr, "Failed to write version of OnDetectRelatedMsiPackage args."); | ||
| 2604 | |||
| 2605 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.operation); | ||
| 2606 | ExitOnFailure(hr, "Failed to write operation OnDetectRelatedMsiPackage args."); | ||
| 2607 | |||
| 2608 | // Send results. | ||
| 2609 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2610 | ExitOnFailure(hr, "Failed to write API version of OnDetectRelatedMsiPackage results."); | ||
| 2611 | |||
| 2612 | // Callback. | ||
| 2613 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 2614 | ExitOnFailure(hr, "BA OnDetectRelatedMsiPackage failed."); | ||
| 2615 | |||
| 2616 | if (S_FALSE == hr) | ||
| 2617 | { | ||
| 2618 | ExitFunction(); | ||
| 2619 | } | ||
| 2620 | |||
| 2621 | // Read results. | ||
| 2622 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2623 | ExitOnFailure(hr, "Failed to read size of OnDetectRelatedMsiPackage result."); | ||
| 2624 | |||
| 2625 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2626 | ExitOnFailure(hr, "Failed to read cancel of OnDetectRelatedMsiPackage result."); | ||
| 2627 | |||
| 2628 | if (results.fCancel) | ||
| 2629 | { | ||
| 2630 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2631 | } | ||
| 2632 | |||
| 2633 | LExit: | ||
| 2634 | PipeFreeRpcResult(&rpc); | ||
| 2635 | ReleaseBuffer(bufferResults); | ||
| 2636 | ReleaseBuffer(bufferArgs); | ||
| 2637 | |||
| 2638 | return hr; | ||
| 2639 | } | ||
| 2640 | |||
| 2641 | EXTERN_C HRESULT BACallbackOnDetectPatchTarget( | ||
| 2642 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2643 | __in_z LPCWSTR wzPackageId, | ||
| 2644 | __in_z LPCWSTR wzProductCode, | ||
| 2645 | __in BOOTSTRAPPER_PACKAGE_STATE patchState | ||
| 2646 | ) | ||
| 2647 | { | ||
| 2648 | HRESULT hr = S_OK; | ||
| 2649 | BA_ONDETECTPATCHTARGET_ARGS args = { }; | ||
| 2650 | BA_ONDETECTPATCHTARGET_RESULTS results = { }; | ||
| 2651 | BUFF_BUFFER bufferArgs = { }; | ||
| 2652 | BUFF_BUFFER bufferResults = { }; | ||
| 2653 | PIPE_RPC_RESULT rpc = { }; | ||
| 2654 | SIZE_T iBuffer = 0; | ||
| 2655 | |||
| 2656 | // Init structs. | ||
| 2657 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2658 | args.wzPackageId = wzPackageId; | ||
| 2659 | args.wzProductCode = wzProductCode; | ||
| 2660 | args.patchState = patchState; | ||
| 2661 | |||
| 2662 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2663 | |||
| 2664 | // Send args. | ||
| 2665 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2666 | ExitOnFailure(hr, "Failed to write API version of OnDetectPatchTarget args."); | ||
| 2667 | |||
| 2668 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 2669 | ExitOnFailure(hr, "Failed to write package id of OnDetectPatchTarget args."); | ||
| 2670 | |||
| 2671 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzProductCode); | ||
| 2672 | ExitOnFailure(hr, "Failed to write product code of OnDetectPatchTarget args."); | ||
| 2673 | |||
| 2674 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.patchState); | ||
| 2675 | ExitOnFailure(hr, "Failed to write patch state OnDetectPatchTarget args."); | ||
| 2676 | |||
| 2677 | // Send results. | ||
| 2678 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2679 | ExitOnFailure(hr, "Failed to write API version of OnDetectPatchTarget results."); | ||
| 2680 | |||
| 2681 | // Callback. | ||
| 2682 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, &bufferArgs, &bufferResults, &rpc); | ||
| 2683 | ExitOnFailure(hr, "BA OnDetectPatchTarget failed."); | ||
| 2684 | |||
| 2685 | if (S_FALSE == hr) | ||
| 2686 | { | ||
| 2687 | ExitFunction(); | ||
| 2688 | } | ||
| 2689 | |||
| 2690 | // Read results. | ||
| 2691 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2692 | ExitOnFailure(hr, "Failed to read size of OnDetectPatchTarget result."); | ||
| 2693 | |||
| 2694 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2695 | ExitOnFailure(hr, "Failed to read cancel of OnDetectPatchTarget result."); | ||
| 2696 | |||
| 2697 | if (results.fCancel) | ||
| 2698 | { | ||
| 2699 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2700 | } | ||
| 2701 | |||
| 2702 | LExit: | ||
| 2703 | PipeFreeRpcResult(&rpc); | ||
| 2704 | ReleaseBuffer(bufferResults); | ||
| 2705 | ReleaseBuffer(bufferArgs); | ||
| 2706 | |||
| 2707 | return hr; | ||
| 2708 | } | ||
| 2709 | |||
| 2710 | EXTERN_C HRESULT BACallbackOnDetectUpdate( | ||
| 2711 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2712 | __in_z_opt LPCWSTR wzUpdateLocation, | ||
| 2713 | __in DWORD64 dw64Size, | ||
| 2714 | __in_z_opt LPCWSTR wzHash, | ||
| 2715 | __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm, | ||
| 2716 | __in VERUTIL_VERSION* pVersion, | ||
| 2717 | __in_z_opt LPCWSTR wzTitle, | ||
| 2718 | __in_z_opt LPCWSTR wzSummary, | ||
| 2719 | __in_z_opt LPCWSTR wzContentType, | ||
| 2720 | __in_z_opt LPCWSTR wzContent, | ||
| 2721 | __inout BOOL* pfStopProcessingUpdates | ||
| 2722 | ) | ||
| 2723 | { | ||
| 2724 | HRESULT hr = S_OK; | ||
| 2725 | BA_ONDETECTUPDATE_ARGS args = { }; | ||
| 2726 | BA_ONDETECTUPDATE_RESULTS results = { }; | ||
| 2727 | BUFF_BUFFER bufferArgs = { }; | ||
| 2728 | BUFF_BUFFER bufferResults = { }; | ||
| 2729 | PIPE_RPC_RESULT rpc = { }; | ||
| 2730 | SIZE_T iBuffer = 0; | ||
| 2731 | |||
| 2732 | // Init structs. | ||
| 2733 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2734 | args.wzUpdateLocation = wzUpdateLocation; | ||
| 2735 | args.dw64Size = dw64Size; | ||
| 2736 | args.wzHash = wzHash; | ||
| 2737 | args.hashAlgorithm = hashAlgorithm; | ||
| 2738 | args.wzVersion = pVersion->sczVersion; | ||
| 2739 | args.wzTitle = wzTitle; | ||
| 2740 | args.wzSummary = wzSummary; | ||
| 2741 | args.wzContentType = wzContentType; | ||
| 2742 | args.wzContent = wzContent; | ||
| 2743 | |||
| 2744 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2745 | results.fStopProcessingUpdates = *pfStopProcessingUpdates; | ||
| 2746 | |||
| 2747 | // Send args. | ||
| 2748 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2749 | ExitOnFailure(hr, "Failed to write API version of OnDetectUpdate args."); | ||
| 2750 | |||
| 2751 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUpdateLocation); | ||
| 2752 | ExitOnFailure(hr, "Failed to write update location of OnDetectUpdate args."); | ||
| 2753 | |||
| 2754 | hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.dw64Size); | ||
| 2755 | ExitOnFailure(hr, "Failed to write update size OnDetectUpdate args."); | ||
| 2756 | |||
| 2757 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzHash); | ||
| 2758 | ExitOnFailure(hr, "Failed to write hash of OnDetectUpdate args."); | ||
| 2759 | |||
| 2760 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hashAlgorithm); | ||
| 2761 | ExitOnFailure(hr, "Failed to write hash algorithm OnDetectUpdate args."); | ||
| 2762 | |||
| 2763 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion); | ||
| 2764 | ExitOnFailure(hr, "Failed to write version of OnDetectUpdate args."); | ||
| 2765 | |||
| 2766 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTitle); | ||
| 2767 | ExitOnFailure(hr, "Failed to write title of OnDetectUpdate args."); | ||
| 2768 | |||
| 2769 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzSummary); | ||
| 2770 | ExitOnFailure(hr, "Failed to write summary of OnDetectUpdate args."); | ||
| 2771 | |||
| 2772 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzContentType); | ||
| 2773 | ExitOnFailure(hr, "Failed to write content type of OnDetectUpdate args."); | ||
| 2774 | |||
| 2775 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzContent); | ||
| 2776 | ExitOnFailure(hr, "Failed to write content of OnDetectUpdate args."); | ||
| 2777 | |||
| 2778 | // Send results. | ||
| 2779 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2780 | ExitOnFailure(hr, "Failed to write API version of OnDetectUpdate results."); | ||
| 2781 | |||
| 2782 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fStopProcessingUpdates); | ||
| 2783 | ExitOnFailure(hr, "Failed to write stop processing updates of OnDetectUpdate results."); | ||
| 2784 | |||
| 2785 | // Callback. | ||
| 2786 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &bufferArgs, &bufferResults, &rpc); | ||
| 2787 | ExitOnFailure(hr, "BA OnDetectUpdate failed."); | ||
| 2788 | |||
| 2789 | if (S_FALSE == hr) | ||
| 2790 | { | ||
| 2791 | ExitFunction(); | ||
| 2792 | } | ||
| 2793 | |||
| 2794 | // Read results. | ||
| 2795 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2796 | ExitOnFailure(hr, "Failed to read size of OnDetectUpdate result."); | ||
| 2797 | |||
| 2798 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2799 | ExitOnFailure(hr, "Failed to read cancel of OnDetectUpdate result."); | ||
| 2800 | |||
| 2801 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fStopProcessingUpdates)); | ||
| 2802 | ExitOnFailure(hr, "Failed to read stop processing updates of OnDetectUpdate result."); | ||
| 2803 | |||
| 2804 | if (results.fCancel) | ||
| 2805 | { | ||
| 2806 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2807 | } | ||
| 2808 | |||
| 2809 | *pfStopProcessingUpdates = results.fStopProcessingUpdates; | ||
| 2810 | |||
| 2811 | LExit: | ||
| 2812 | PipeFreeRpcResult(&rpc); | ||
| 2813 | ReleaseBuffer(bufferResults); | ||
| 2814 | ReleaseBuffer(bufferArgs); | ||
| 2815 | |||
| 2816 | return hr; | ||
| 2817 | } | ||
| 2818 | |||
| 2819 | EXTERN_C HRESULT BACallbackOnDetectUpdateBegin( | ||
| 2820 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2821 | __in_z LPCWSTR wzUpdateLocation, | ||
| 2822 | __inout BOOL* pfSkip | ||
| 2823 | ) | ||
| 2824 | { | ||
| 2825 | HRESULT hr = S_OK; | ||
| 2826 | BA_ONDETECTUPDATEBEGIN_ARGS args = { }; | ||
| 2827 | BA_ONDETECTUPDATEBEGIN_RESULTS results = { }; | ||
| 2828 | BUFF_BUFFER bufferArgs = { }; | ||
| 2829 | BUFF_BUFFER bufferResults = { }; | ||
| 2830 | PIPE_RPC_RESULT rpc = { }; | ||
| 2831 | SIZE_T iBuffer = 0; | ||
| 2832 | |||
| 2833 | // Init structs. | ||
| 2834 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2835 | args.wzUpdateLocation = wzUpdateLocation; | ||
| 2836 | |||
| 2837 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2838 | results.fSkip = *pfSkip; | ||
| 2839 | |||
| 2840 | // Send args. | ||
| 2841 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2842 | ExitOnFailure(hr, "Failed to write API version of OnDetectUpdateBegin args."); | ||
| 2843 | |||
| 2844 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUpdateLocation); | ||
| 2845 | ExitOnFailure(hr, "Failed to write update location of OnDetectUpdateBegin args."); | ||
| 2846 | |||
| 2847 | // Send results. | ||
| 2848 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2849 | ExitOnFailure(hr, "Failed to write API version of OnDetectUpdateBegin results."); | ||
| 2850 | |||
| 2851 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fSkip); | ||
| 2852 | ExitOnFailure(hr, "Failed to write skip of OnDetectUpdateBegin results."); | ||
| 2853 | |||
| 2854 | // Callback. | ||
| 2855 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 2856 | ExitOnFailure(hr, "BA OnDetectUpdateBegin failed."); | ||
| 2857 | |||
| 2858 | if (S_FALSE == hr) | ||
| 2859 | { | ||
| 2860 | ExitFunction(); | ||
| 2861 | } | ||
| 2862 | |||
| 2863 | // Read results. | ||
| 2864 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2865 | ExitOnFailure(hr, "Failed to read size of OnDetectUpdateBegin result."); | ||
| 2866 | |||
| 2867 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2868 | ExitOnFailure(hr, "Failed to read cancel of OnDetectUpdateBegin result."); | ||
| 2869 | |||
| 2870 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fSkip)); | ||
| 2871 | ExitOnFailure(hr, "Failed to read cancel of OnDetectUpdateBegin result."); | ||
| 2872 | |||
| 2873 | if (results.fCancel) | ||
| 2874 | { | ||
| 2875 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2876 | } | ||
| 2877 | |||
| 2878 | *pfSkip = results.fSkip; | ||
| 2879 | |||
| 2880 | LExit: | ||
| 2881 | PipeFreeRpcResult(&rpc); | ||
| 2882 | ReleaseBuffer(bufferResults); | ||
| 2883 | ReleaseBuffer(bufferArgs); | ||
| 2884 | |||
| 2885 | return hr; | ||
| 2886 | } | ||
| 2887 | |||
| 2888 | EXTERN_C HRESULT BACallbackOnDetectUpdateComplete( | ||
| 2889 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2890 | __in HRESULT hrStatus, | ||
| 2891 | __inout BOOL* pfIgnoreError | ||
| 2892 | ) | ||
| 2893 | { | ||
| 2894 | HRESULT hr = S_OK; | ||
| 2895 | BA_ONDETECTUPDATECOMPLETE_ARGS args = { }; | ||
| 2896 | BA_ONDETECTUPDATECOMPLETE_RESULTS results = { }; | ||
| 2897 | BUFF_BUFFER bufferArgs = { }; | ||
| 2898 | BUFF_BUFFER bufferResults = { }; | ||
| 2899 | PIPE_RPC_RESULT rpc = { }; | ||
| 2900 | SIZE_T iBuffer = 0; | ||
| 2901 | |||
| 2902 | // Init structs. | ||
| 2903 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2904 | args.hrStatus = hrStatus; | ||
| 2905 | |||
| 2906 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2907 | results.fIgnoreError = *pfIgnoreError; | ||
| 2908 | |||
| 2909 | // Send args. | ||
| 2910 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2911 | ExitOnFailure(hr, "Failed to write API version of OnDetectUpdateComplete args."); | ||
| 2912 | |||
| 2913 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 2914 | ExitOnFailure(hr, "Failed to write status of OnDetectUpdateComplete args."); | ||
| 2915 | |||
| 2916 | // Send results. | ||
| 2917 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2918 | ExitOnFailure(hr, "Failed to write API version of OnDetectUpdateComplete results."); | ||
| 2919 | |||
| 2920 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fIgnoreError); | ||
| 2921 | ExitOnFailure(hr, "Failed to write ignore error of OnDetectUpdateComplete results."); | ||
| 2922 | |||
| 2923 | // Callback. | ||
| 2924 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 2925 | ExitOnFailure(hr, "BA OnDetectUpdateComplete failed."); | ||
| 2926 | |||
| 2927 | if (S_FALSE == hr) | ||
| 2928 | { | ||
| 2929 | ExitFunction(); | ||
| 2930 | } | ||
| 2931 | |||
| 2932 | // Read results. | ||
| 2933 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2934 | ExitOnFailure(hr, "Failed to read size of OnDetectUpdateComplete result."); | ||
| 2935 | |||
| 2936 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fIgnoreError)); | ||
| 2937 | ExitOnFailure(hr, "Failed to read ignore error of OnDetectUpdateComplete result."); | ||
| 2938 | |||
| 2939 | if (FAILED(hrStatus)) | ||
| 2940 | { | ||
| 2941 | *pfIgnoreError = results.fIgnoreError; | ||
| 2942 | } | ||
| 2943 | |||
| 2944 | LExit: | ||
| 2945 | PipeFreeRpcResult(&rpc); | ||
| 2946 | ReleaseBuffer(bufferResults); | ||
| 2947 | ReleaseBuffer(bufferArgs); | ||
| 2948 | |||
| 2949 | return hr; | ||
| 2950 | } | ||
| 2951 | |||
| 2952 | EXTERN_C HRESULT BACallbackOnElevateBegin( | ||
| 2953 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 2954 | ) | ||
| 2955 | { | ||
| 2956 | HRESULT hr = S_OK; | ||
| 2957 | BA_ONELEVATEBEGIN_ARGS args = { }; | ||
| 2958 | BA_ONELEVATEBEGIN_RESULTS results = { }; | ||
| 2959 | BUFF_BUFFER bufferArgs = { }; | ||
| 2960 | BUFF_BUFFER bufferResults = { }; | ||
| 2961 | PIPE_RPC_RESULT rpc = { }; | ||
| 2962 | SIZE_T iBuffer = 0; | ||
| 2963 | |||
| 2964 | // Init structs. | ||
| 2965 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2966 | |||
| 2967 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 2968 | |||
| 2969 | // Send args. | ||
| 2970 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 2971 | ExitOnFailure(hr, "Failed to write API version of OnElevateBegin args."); | ||
| 2972 | |||
| 2973 | // Send results. | ||
| 2974 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 2975 | ExitOnFailure(hr, "Failed to write API version of OnElevateBegin results."); | ||
| 2976 | |||
| 2977 | // Callback. | ||
| 2978 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 2979 | ExitOnFailure(hr, "BA OnElevateBegin failed."); | ||
| 2980 | |||
| 2981 | if (S_FALSE == hr) | ||
| 2982 | { | ||
| 2983 | ExitFunction(); | ||
| 2984 | } | ||
| 2985 | |||
| 2986 | // Read results. | ||
| 2987 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 2988 | ExitOnFailure(hr, "Failed to read size of OnElevateBegin result."); | ||
| 2989 | |||
| 2990 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 2991 | ExitOnFailure(hr, "Failed to read cancel of OnElevateBegin result."); | ||
| 2992 | |||
| 2993 | if (results.fCancel) | ||
| 2994 | { | ||
| 2995 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 2996 | } | ||
| 2997 | |||
| 2998 | LExit: | ||
| 2999 | PipeFreeRpcResult(&rpc); | ||
| 3000 | ReleaseBuffer(bufferResults); | ||
| 3001 | ReleaseBuffer(bufferArgs); | ||
| 3002 | |||
| 3003 | return hr; | ||
| 3004 | } | ||
| 3005 | |||
| 3006 | EXTERN_C HRESULT BACallbackOnElevateComplete( | ||
| 3007 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3008 | __in HRESULT hrStatus | ||
| 3009 | ) | ||
| 3010 | { | ||
| 3011 | HRESULT hr = S_OK; | ||
| 3012 | BA_ONELEVATECOMPLETE_ARGS args = { }; | ||
| 3013 | BA_ONELEVATECOMPLETE_RESULTS results = { }; | ||
| 3014 | BUFF_BUFFER bufferArgs = { }; | ||
| 3015 | BUFF_BUFFER bufferResults = { }; | ||
| 3016 | PIPE_RPC_RESULT rpc = { }; | ||
| 3017 | |||
| 3018 | // Init structs. | ||
| 3019 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3020 | args.hrStatus = hrStatus; | ||
| 3021 | |||
| 3022 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3023 | |||
| 3024 | // Send args. | ||
| 3025 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3026 | ExitOnFailure(hr, "Failed to write API version of OnElevateComplete args."); | ||
| 3027 | |||
| 3028 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 3029 | ExitOnFailure(hr, "Failed to write status of OnElevateComplete args."); | ||
| 3030 | |||
| 3031 | // Send results. | ||
| 3032 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3033 | ExitOnFailure(hr, "Failed to write API version of OnElevateComplete results."); | ||
| 3034 | |||
| 3035 | // Callback. | ||
| 3036 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 3037 | ExitOnFailure(hr, "BA OnElevateComplete failed."); | ||
| 3038 | |||
| 3039 | if (S_FALSE == hr) | ||
| 3040 | { | ||
| 3041 | ExitFunction(); | ||
| 3042 | } | ||
| 3043 | |||
| 3044 | LExit: | ||
| 3045 | PipeFreeRpcResult(&rpc); | ||
| 3046 | ReleaseBuffer(bufferResults); | ||
| 3047 | ReleaseBuffer(bufferArgs); | ||
| 3048 | |||
| 3049 | return hr; | ||
| 3050 | } | ||
| 3051 | |||
| 3052 | EXTERN_C HRESULT BACallbackOnError( | ||
| 3053 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3054 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
| 3055 | __in_z_opt LPCWSTR wzPackageId, | ||
| 3056 | __in DWORD dwCode, | ||
| 3057 | __in_z_opt LPCWSTR wzError, | ||
| 3058 | __in DWORD dwUIHint, | ||
| 3059 | __in DWORD cData, | ||
| 3060 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
| 3061 | __inout int* pnResult | ||
| 3062 | ) | ||
| 3063 | { | ||
| 3064 | HRESULT hr = S_OK; | ||
| 3065 | BA_ONERROR_ARGS args = { }; | ||
| 3066 | BA_ONERROR_RESULTS results = { }; | ||
| 3067 | BUFF_BUFFER bufferArgs = { }; | ||
| 3068 | BUFF_BUFFER bufferResults = { }; | ||
| 3069 | PIPE_RPC_RESULT rpc = { }; | ||
| 3070 | SIZE_T iBuffer = 0; | ||
| 3071 | |||
| 3072 | // Init structs. | ||
| 3073 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3074 | args.errorType = errorType; | ||
| 3075 | args.wzPackageId = wzPackageId; | ||
| 3076 | args.dwCode = dwCode; | ||
| 3077 | args.wzError = wzError; | ||
| 3078 | args.dwUIHint = dwUIHint; | ||
| 3079 | args.cData = cData; | ||
| 3080 | args.rgwzData = rgwzData; | ||
| 3081 | args.nRecommendation = *pnResult; | ||
| 3082 | |||
| 3083 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3084 | results.nResult = *pnResult; | ||
| 3085 | |||
| 3086 | // Send args. | ||
| 3087 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3088 | ExitOnFailure(hr, "Failed to write API version of OnError args."); | ||
| 3089 | |||
| 3090 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.errorType); | ||
| 3091 | ExitOnFailure(hr, "Failed to write error type OnError args."); | ||
| 3092 | |||
| 3093 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3094 | ExitOnFailure(hr, "Failed to write package id of OnError args."); | ||
| 3095 | |||
| 3096 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwCode); | ||
| 3097 | ExitOnFailure(hr, "Failed to write code OnError args."); | ||
| 3098 | |||
| 3099 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzError); | ||
| 3100 | ExitOnFailure(hr, "Failed to write error of OnError args."); | ||
| 3101 | |||
| 3102 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwUIHint); | ||
| 3103 | ExitOnFailure(hr, "Failed to write UI hint OnError args."); | ||
| 3104 | |||
| 3105 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cData); | ||
| 3106 | ExitOnFailure(hr, "Failed to write count of data of OnError args."); | ||
| 3107 | |||
| 3108 | for (DWORD i = 0; i < args.cData; ++i) | ||
| 3109 | { | ||
| 3110 | hr = BuffWriteStringToBuffer(&bufferArgs, args.rgwzData[i]); | ||
| 3111 | ExitOnFailure(hr, "Failed to write data[%u] of OnError args.", i); | ||
| 3112 | } | ||
| 3113 | |||
| 3114 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.nRecommendation); | ||
| 3115 | ExitOnFailure(hr, "Failed to write recommendation of OnError args."); | ||
| 3116 | |||
| 3117 | // Send results. | ||
| 3118 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3119 | ExitOnFailure(hr, "Failed to write API version of OnError results."); | ||
| 3120 | |||
| 3121 | hr = BuffWriteNumberToBuffer(&bufferResults, results.nResult); | ||
| 3122 | ExitOnFailure(hr, "Failed to write result of OnError results."); | ||
| 3123 | |||
| 3124 | // Callback. | ||
| 3125 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &bufferArgs, &bufferResults, &rpc); | ||
| 3126 | ExitOnFailure(hr, "BA OnError failed."); | ||
| 3127 | |||
| 3128 | if (S_FALSE == hr) | ||
| 3129 | { | ||
| 3130 | ExitFunction(); | ||
| 3131 | } | ||
| 3132 | |||
| 3133 | // Read results. | ||
| 3134 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3135 | ExitOnFailure(hr, "Failed to read size of OnError result."); | ||
| 3136 | |||
| 3137 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.nResult)); | ||
| 3138 | ExitOnFailure(hr, "Failed to read result of OnError result."); | ||
| 3139 | |||
| 3140 | *pnResult = results.nResult; | ||
| 3141 | |||
| 3142 | LExit: | ||
| 3143 | PipeFreeRpcResult(&rpc); | ||
| 3144 | ReleaseBuffer(bufferResults); | ||
| 3145 | ReleaseBuffer(bufferArgs); | ||
| 3146 | |||
| 3147 | return hr; | ||
| 3148 | } | ||
| 3149 | |||
| 3150 | EXTERN_C HRESULT BACallbackOnExecuteBegin( | ||
| 3151 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3152 | __in DWORD cExecutingPackages | ||
| 3153 | ) | ||
| 3154 | { | ||
| 3155 | HRESULT hr = S_OK; | ||
| 3156 | BA_ONEXECUTEBEGIN_ARGS args = { }; | ||
| 3157 | BA_ONEXECUTEBEGIN_RESULTS results = { }; | ||
| 3158 | BUFF_BUFFER bufferArgs = { }; | ||
| 3159 | BUFF_BUFFER bufferResults = { }; | ||
| 3160 | PIPE_RPC_RESULT rpc = { }; | ||
| 3161 | SIZE_T iBuffer = 0; | ||
| 3162 | |||
| 3163 | // Init structs. | ||
| 3164 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3165 | args.cExecutingPackages = cExecutingPackages; | ||
| 3166 | |||
| 3167 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3168 | |||
| 3169 | // Send args. | ||
| 3170 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3171 | ExitOnFailure(hr, "Failed to write API version of OnExecuteBegin args."); | ||
| 3172 | |||
| 3173 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cExecutingPackages); | ||
| 3174 | ExitOnFailure(hr, "Failed to write executing packages OnExecuteBegin args."); | ||
| 3175 | |||
| 3176 | // Send results. | ||
| 3177 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3178 | ExitOnFailure(hr, "Failed to write API version of OnExecuteBegin results."); | ||
| 3179 | |||
| 3180 | // Callback. | ||
| 3181 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 3182 | ExitOnFailure(hr, "BA OnExecuteBegin failed."); | ||
| 3183 | |||
| 3184 | if (S_FALSE == hr) | ||
| 3185 | { | ||
| 3186 | ExitFunction(); | ||
| 3187 | } | ||
| 3188 | |||
| 3189 | // Read results. | ||
| 3190 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3191 | ExitOnFailure(hr, "Failed to read size of OnExecuteBegin result."); | ||
| 3192 | |||
| 3193 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 3194 | ExitOnFailure(hr, "Failed to read cancel of OnExecuteBegin result."); | ||
| 3195 | |||
| 3196 | if (results.fCancel) | ||
| 3197 | { | ||
| 3198 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 3199 | } | ||
| 3200 | |||
| 3201 | LExit: | ||
| 3202 | PipeFreeRpcResult(&rpc); | ||
| 3203 | ReleaseBuffer(bufferResults); | ||
| 3204 | ReleaseBuffer(bufferArgs); | ||
| 3205 | |||
| 3206 | return hr; | ||
| 3207 | } | ||
| 3208 | |||
| 3209 | EXTERN_C HRESULT BACallbackOnExecuteComplete( | ||
| 3210 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3211 | __in HRESULT hrStatus | ||
| 3212 | ) | ||
| 3213 | { | ||
| 3214 | HRESULT hr = S_OK; | ||
| 3215 | BA_ONEXECUTECOMPLETE_ARGS args = { }; | ||
| 3216 | BA_ONEXECUTECOMPLETE_RESULTS results = { }; | ||
| 3217 | BUFF_BUFFER bufferArgs = { }; | ||
| 3218 | BUFF_BUFFER bufferResults = { }; | ||
| 3219 | PIPE_RPC_RESULT rpc = { }; | ||
| 3220 | |||
| 3221 | // Init structs. | ||
| 3222 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3223 | args.hrStatus = hrStatus; | ||
| 3224 | |||
| 3225 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3226 | |||
| 3227 | // Send args. | ||
| 3228 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3229 | ExitOnFailure(hr, "Failed to write API version of OnExecuteComplete args."); | ||
| 3230 | |||
| 3231 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 3232 | ExitOnFailure(hr, "Failed to write status OnExecuteComplete args."); | ||
| 3233 | |||
| 3234 | // Send results. | ||
| 3235 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3236 | ExitOnFailure(hr, "Failed to write API version of OnExecuteComplete results."); | ||
| 3237 | |||
| 3238 | // Callback. | ||
| 3239 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 3240 | ExitOnFailure(hr, "BA OnExecuteComplete failed."); | ||
| 3241 | |||
| 3242 | if (S_FALSE == hr) | ||
| 3243 | { | ||
| 3244 | ExitFunction(); | ||
| 3245 | } | ||
| 3246 | |||
| 3247 | LExit: | ||
| 3248 | PipeFreeRpcResult(&rpc); | ||
| 3249 | ReleaseBuffer(bufferResults); | ||
| 3250 | ReleaseBuffer(bufferArgs); | ||
| 3251 | |||
| 3252 | return hr; | ||
| 3253 | } | ||
| 3254 | |||
| 3255 | EXTERN_C HRESULT BACallbackOnExecuteFilesInUse( | ||
| 3256 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3257 | __in_z LPCWSTR wzPackageId, | ||
| 3258 | __in DWORD cFiles, | ||
| 3259 | __in_ecount_z_opt(cFiles) LPCWSTR* rgwzFiles, | ||
| 3260 | __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, | ||
| 3261 | __inout int* pnResult | ||
| 3262 | ) | ||
| 3263 | { | ||
| 3264 | HRESULT hr = S_OK; | ||
| 3265 | BA_ONEXECUTEFILESINUSE_ARGS args = { }; | ||
| 3266 | BA_ONEXECUTEFILESINUSE_RESULTS results = { }; | ||
| 3267 | BUFF_BUFFER bufferArgs = { }; | ||
| 3268 | BUFF_BUFFER bufferResults = { }; | ||
| 3269 | PIPE_RPC_RESULT rpc = { }; | ||
| 3270 | SIZE_T iBuffer = 0; | ||
| 3271 | |||
| 3272 | // Init structs. | ||
| 3273 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3274 | args.wzPackageId = wzPackageId; | ||
| 3275 | args.cFiles = cFiles; | ||
| 3276 | args.rgwzFiles = rgwzFiles; | ||
| 3277 | args.nRecommendation = *pnResult; | ||
| 3278 | args.source = source; | ||
| 3279 | |||
| 3280 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3281 | results.nResult = *pnResult; | ||
| 3282 | |||
| 3283 | // Send args. | ||
| 3284 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3285 | ExitOnFailure(hr, "Failed to write API version of OnExecuteFilesInUse args."); | ||
| 3286 | |||
| 3287 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3288 | ExitOnFailure(hr, "Failed to write package id of OnExecuteFilesInUse args."); | ||
| 3289 | |||
| 3290 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cFiles); | ||
| 3291 | ExitOnFailure(hr, "Failed to write count of files of OnExecuteFilesInUse args."); | ||
| 3292 | |||
| 3293 | for (DWORD i = 0; i < args.cFiles; ++i) | ||
| 3294 | { | ||
| 3295 | hr = BuffWriteStringToBuffer(&bufferArgs, args.rgwzFiles[i]); | ||
| 3296 | ExitOnFailure(hr, "Failed to write file[%u] of OnExecuteFilesInUse args.", i); | ||
| 3297 | } | ||
| 3298 | |||
| 3299 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.nRecommendation); | ||
| 3300 | ExitOnFailure(hr, "Failed to write recommendation of OnExecuteFilesInUse args."); | ||
| 3301 | |||
| 3302 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.source); | ||
| 3303 | ExitOnFailure(hr, "Failed to write source of OnExecuteFilesInUse args."); | ||
| 3304 | |||
| 3305 | // Send results. | ||
| 3306 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3307 | ExitOnFailure(hr, "Failed to write API version of OnExecuteFilesInUse results."); | ||
| 3308 | |||
| 3309 | hr = BuffWriteNumberToBuffer(&bufferResults, results.nResult); | ||
| 3310 | ExitOnFailure(hr, "Failed to write result of OnExecuteFilesInUse results."); | ||
| 3311 | |||
| 3312 | // Callback. | ||
| 3313 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &bufferArgs, &bufferResults, &rpc); | ||
| 3314 | ExitOnFailure(hr, "BA OnExecuteFilesInUse failed."); | ||
| 3315 | |||
| 3316 | if (S_FALSE == hr) | ||
| 3317 | { | ||
| 3318 | ExitFunction(); | ||
| 3319 | } | ||
| 3320 | |||
| 3321 | // Read results. | ||
| 3322 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3323 | ExitOnFailure(hr, "Failed to read size of OnExecuteFilesInUse result."); | ||
| 3324 | |||
| 3325 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.nResult)); | ||
| 3326 | ExitOnFailure(hr, "Failed to read result of OnExecuteFilesInUse result."); | ||
| 3327 | |||
| 3328 | *pnResult = results.nResult; | ||
| 3329 | |||
| 3330 | LExit: | ||
| 3331 | PipeFreeRpcResult(&rpc); | ||
| 3332 | ReleaseBuffer(bufferResults); | ||
| 3333 | ReleaseBuffer(bufferArgs); | ||
| 3334 | |||
| 3335 | return hr; | ||
| 3336 | } | ||
| 3337 | |||
| 3338 | EXTERN_C HRESULT BACallbackOnExecuteMsiMessage( | ||
| 3339 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3340 | __in_z LPCWSTR wzPackageId, | ||
| 3341 | __in INSTALLMESSAGE messageType, | ||
| 3342 | __in DWORD dwUIHint, | ||
| 3343 | __in_z LPCWSTR wzMessage, | ||
| 3344 | __in DWORD cData, | ||
| 3345 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
| 3346 | __inout int* pnResult | ||
| 3347 | ) | ||
| 3348 | { | ||
| 3349 | HRESULT hr = S_OK; | ||
| 3350 | BA_ONEXECUTEMSIMESSAGE_ARGS args = { }; | ||
| 3351 | BA_ONEXECUTEMSIMESSAGE_RESULTS results = { }; | ||
| 3352 | BUFF_BUFFER bufferArgs = { }; | ||
| 3353 | BUFF_BUFFER bufferResults = { }; | ||
| 3354 | PIPE_RPC_RESULT rpc = { }; | ||
| 3355 | SIZE_T iBuffer = 0; | ||
| 3356 | |||
| 3357 | // Init structs. | ||
| 3358 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3359 | args.wzPackageId = wzPackageId; | ||
| 3360 | args.messageType = messageType; | ||
| 3361 | args.dwUIHint = dwUIHint; | ||
| 3362 | args.wzMessage = wzMessage; | ||
| 3363 | args.cData = cData; | ||
| 3364 | args.rgwzData = rgwzData; | ||
| 3365 | args.nRecommendation = *pnResult; | ||
| 3366 | |||
| 3367 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3368 | results.nResult = *pnResult; | ||
| 3369 | |||
| 3370 | // Send args. | ||
| 3371 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3372 | ExitOnFailure(hr, "Failed to write API version of OnExecuteMsiMessage args."); | ||
| 3373 | |||
| 3374 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3375 | ExitOnFailure(hr, "Failed to write package id of OnExecuteMsiMessage args."); | ||
| 3376 | |||
| 3377 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.messageType); | ||
| 3378 | ExitOnFailure(hr, "Failed to write message type OnExecuteMsiMessage args."); | ||
| 3379 | |||
| 3380 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwUIHint); | ||
| 3381 | ExitOnFailure(hr, "Failed to write UI hint OnExecuteMsiMessage args."); | ||
| 3382 | |||
| 3383 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzMessage); | ||
| 3384 | ExitOnFailure(hr, "Failed to write message of OnExecuteMsiMessage args."); | ||
| 3385 | |||
| 3386 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cData); | ||
| 3387 | ExitOnFailure(hr, "Failed to write count of data of OnExecuteMsiMessage args."); | ||
| 3388 | |||
| 3389 | for (DWORD i = 0; i < args.cData; ++i) | ||
| 3390 | { | ||
| 3391 | hr = BuffWriteStringToBuffer(&bufferArgs, args.rgwzData[i]); | ||
| 3392 | ExitOnFailure(hr, "Failed to write data[%u] of OnExecuteMsiMessage args.", i); | ||
| 3393 | } | ||
| 3394 | |||
| 3395 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.nRecommendation); | ||
| 3396 | ExitOnFailure(hr, "Failed to write recommendation of OnExecuteMsiMessage args."); | ||
| 3397 | |||
| 3398 | // Send results. | ||
| 3399 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3400 | ExitOnFailure(hr, "Failed to write API version of OnExecuteMsiMessage results."); | ||
| 3401 | |||
| 3402 | hr = BuffWriteNumberToBuffer(&bufferResults, results.nResult); | ||
| 3403 | ExitOnFailure(hr, "Failed to write result of OnExecuteMsiMessage results."); | ||
| 3404 | |||
| 3405 | // Callback. | ||
| 3406 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 3407 | ExitOnFailure(hr, "BA OnExecuteMsiMessage failed."); | ||
| 3408 | |||
| 3409 | if (S_FALSE == hr) | ||
| 3410 | { | ||
| 3411 | ExitFunction(); | ||
| 3412 | } | ||
| 3413 | |||
| 3414 | // Read results. | ||
| 3415 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3416 | ExitOnFailure(hr, "Failed to read size of OnExecuteMsiMessage result."); | ||
| 3417 | |||
| 3418 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.nResult)); | ||
| 3419 | ExitOnFailure(hr, "Failed to read cancel of OnExecuteMsiMessage result."); | ||
| 3420 | |||
| 3421 | *pnResult = results.nResult; | ||
| 3422 | |||
| 3423 | LExit: | ||
| 3424 | PipeFreeRpcResult(&rpc); | ||
| 3425 | ReleaseBuffer(bufferResults); | ||
| 3426 | ReleaseBuffer(bufferArgs); | ||
| 3427 | |||
| 3428 | return hr; | ||
| 3429 | } | ||
| 3430 | |||
| 3431 | EXTERN_C HRESULT BACallbackOnExecutePackageBegin( | ||
| 3432 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3433 | __in_z LPCWSTR wzPackageId, | ||
| 3434 | __in BOOL fExecute, | ||
| 3435 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
| 3436 | __in INSTALLUILEVEL uiLevel, | ||
| 3437 | __in BOOL fDisableExternalUiHandler | ||
| 3438 | ) | ||
| 3439 | { | ||
| 3440 | HRESULT hr = S_OK; | ||
| 3441 | BA_ONEXECUTEPACKAGEBEGIN_ARGS args = { }; | ||
| 3442 | BA_ONEXECUTEPACKAGEBEGIN_RESULTS results = { }; | ||
| 3443 | BUFF_BUFFER bufferArgs = { }; | ||
| 3444 | BUFF_BUFFER bufferResults = { }; | ||
| 3445 | PIPE_RPC_RESULT rpc = { }; | ||
| 3446 | SIZE_T iBuffer = 0; | ||
| 3447 | |||
| 3448 | // Init structs. | ||
| 3449 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3450 | args.wzPackageId = wzPackageId; | ||
| 3451 | args.fExecute = fExecute; | ||
| 3452 | args.action = action; | ||
| 3453 | args.uiLevel = uiLevel; | ||
| 3454 | args.fDisableExternalUiHandler = fDisableExternalUiHandler; | ||
| 3455 | |||
| 3456 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3457 | |||
| 3458 | // Send args. | ||
| 3459 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3460 | ExitOnFailure(hr, "Failed to write API version of OnExecutePackageBegin args."); | ||
| 3461 | |||
| 3462 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3463 | ExitOnFailure(hr, "Failed to write package id of OnExecutePackageBegin args."); | ||
| 3464 | |||
| 3465 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fExecute); | ||
| 3466 | ExitOnFailure(hr, "Failed to write execute OnExecutePackageBegin args."); | ||
| 3467 | |||
| 3468 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.action); | ||
| 3469 | ExitOnFailure(hr, "Failed to write action OnExecutePackageBegin args."); | ||
| 3470 | |||
| 3471 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.uiLevel); | ||
| 3472 | ExitOnFailure(hr, "Failed to write UI level of OnExecutePackageBegin args."); | ||
| 3473 | |||
| 3474 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fDisableExternalUiHandler); | ||
| 3475 | ExitOnFailure(hr, "Failed to write disable external UI handler of OnExecutePackageBegin args."); | ||
| 3476 | |||
| 3477 | // Send results. | ||
| 3478 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3479 | ExitOnFailure(hr, "Failed to write API version of OnExecutePackageBegin results."); | ||
| 3480 | |||
| 3481 | // Callback. | ||
| 3482 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 3483 | ExitOnFailure(hr, "BA OnExecutePackageBegin failed."); | ||
| 3484 | |||
| 3485 | if (S_FALSE == hr) | ||
| 3486 | { | ||
| 3487 | ExitFunction(); | ||
| 3488 | } | ||
| 3489 | |||
| 3490 | // Read results. | ||
| 3491 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3492 | ExitOnFailure(hr, "Failed to read size of OnExecutePackageBegin result."); | ||
| 3493 | |||
| 3494 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 3495 | ExitOnFailure(hr, "Failed to read cancel of OnExecutePackageBegin result."); | ||
| 3496 | |||
| 3497 | if (results.fCancel) | ||
| 3498 | { | ||
| 3499 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 3500 | } | ||
| 3501 | |||
| 3502 | LExit: | ||
| 3503 | PipeFreeRpcResult(&rpc); | ||
| 3504 | ReleaseBuffer(bufferResults); | ||
| 3505 | ReleaseBuffer(bufferArgs); | ||
| 3506 | |||
| 3507 | return hr; | ||
| 3508 | } | ||
| 3509 | |||
| 3510 | EXTERN_C HRESULT BACallbackOnExecutePackageComplete( | ||
| 3511 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3512 | __in_z LPCWSTR wzPackageId, | ||
| 3513 | __in HRESULT hrStatus, | ||
| 3514 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 3515 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction | ||
| 3516 | ) | ||
| 3517 | { | ||
| 3518 | HRESULT hr = S_OK; | ||
| 3519 | BA_ONEXECUTEPACKAGECOMPLETE_ARGS args = { }; | ||
| 3520 | BA_ONEXECUTEPACKAGECOMPLETE_RESULTS results = { }; | ||
| 3521 | BUFF_BUFFER bufferArgs = { }; | ||
| 3522 | BUFF_BUFFER bufferResults = { }; | ||
| 3523 | PIPE_RPC_RESULT rpc = { }; | ||
| 3524 | SIZE_T iBuffer = 0; | ||
| 3525 | |||
| 3526 | // Init structs. | ||
| 3527 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3528 | args.wzPackageId = wzPackageId; | ||
| 3529 | args.hrStatus = hrStatus; | ||
| 3530 | args.restart = restart; | ||
| 3531 | args.recommendation = *pAction; | ||
| 3532 | |||
| 3533 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3534 | results.action = *pAction; | ||
| 3535 | |||
| 3536 | // Send args. | ||
| 3537 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3538 | ExitOnFailure(hr, "Failed to write API version of OnExecutePackageComplete args."); | ||
| 3539 | |||
| 3540 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3541 | ExitOnFailure(hr, "Failed to write package id of OnExecutePackageComplete args."); | ||
| 3542 | |||
| 3543 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 3544 | ExitOnFailure(hr, "Failed to write status of OnExecutePackageComplete args."); | ||
| 3545 | |||
| 3546 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.restart); | ||
| 3547 | ExitOnFailure(hr, "Failed to write restart of OnExecutePackageComplete args."); | ||
| 3548 | |||
| 3549 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 3550 | ExitOnFailure(hr, "Failed to write recommendation of OnExecutePackageComplete args."); | ||
| 3551 | |||
| 3552 | // Send results. | ||
| 3553 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3554 | ExitOnFailure(hr, "Failed to write API version of OnExecutePackageComplete results."); | ||
| 3555 | |||
| 3556 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 3557 | ExitOnFailure(hr, "Failed to write action of OnExecutePackageComplete results."); | ||
| 3558 | |||
| 3559 | // Callback. | ||
| 3560 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 3561 | ExitOnFailure(hr, "BA OnExecutePackageComplete failed."); | ||
| 3562 | |||
| 3563 | if (S_FALSE == hr) | ||
| 3564 | { | ||
| 3565 | ExitFunction(); | ||
| 3566 | } | ||
| 3567 | |||
| 3568 | // Read results. | ||
| 3569 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3570 | ExitOnFailure(hr, "Failed to read size of OnExecutePackageComplete result."); | ||
| 3571 | |||
| 3572 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 3573 | ExitOnFailure(hr, "Failed to read action of OnExecutePackageComplete result."); | ||
| 3574 | |||
| 3575 | *pAction = results.action; | ||
| 3576 | |||
| 3577 | LExit: | ||
| 3578 | PipeFreeRpcResult(&rpc); | ||
| 3579 | ReleaseBuffer(bufferResults); | ||
| 3580 | ReleaseBuffer(bufferArgs); | ||
| 3581 | |||
| 3582 | return hr; | ||
| 3583 | } | ||
| 3584 | |||
| 3585 | EXTERN_C HRESULT BACallbackOnExecutePatchTarget( | ||
| 3586 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3587 | __in_z LPCWSTR wzPackageId, | ||
| 3588 | __in_z LPCWSTR wzTargetProductCode | ||
| 3589 | ) | ||
| 3590 | { | ||
| 3591 | HRESULT hr = S_OK; | ||
| 3592 | BA_ONEXECUTEPATCHTARGET_ARGS args = { }; | ||
| 3593 | BA_ONEXECUTEPATCHTARGET_RESULTS results = { }; | ||
| 3594 | BUFF_BUFFER bufferArgs = { }; | ||
| 3595 | BUFF_BUFFER bufferResults = { }; | ||
| 3596 | PIPE_RPC_RESULT rpc = { }; | ||
| 3597 | SIZE_T iBuffer = 0; | ||
| 3598 | |||
| 3599 | // Init structs. | ||
| 3600 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3601 | args.wzPackageId = wzPackageId; | ||
| 3602 | args.wzTargetProductCode = wzTargetProductCode; | ||
| 3603 | |||
| 3604 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3605 | |||
| 3606 | // Send args. | ||
| 3607 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3608 | ExitOnFailure(hr, "Failed to write API version of OnExecutePatchTarget args."); | ||
| 3609 | |||
| 3610 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3611 | ExitOnFailure(hr, "Failed to write package id of OnExecutePatchTarget args."); | ||
| 3612 | |||
| 3613 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTargetProductCode); | ||
| 3614 | ExitOnFailure(hr, "Failed to write target product code of OnExecutePatchTarget args."); | ||
| 3615 | |||
| 3616 | // Send results. | ||
| 3617 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3618 | ExitOnFailure(hr, "Failed to write API version of OnExecutePatchTarget results."); | ||
| 3619 | |||
| 3620 | // Callback. | ||
| 3621 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &bufferArgs, &bufferResults, &rpc); | ||
| 3622 | ExitOnFailure(hr, "BA OnExecutePatchTarget failed."); | ||
| 3623 | |||
| 3624 | if (S_FALSE == hr) | ||
| 3625 | { | ||
| 3626 | ExitFunction(); | ||
| 3627 | } | ||
| 3628 | |||
| 3629 | // Read results. | ||
| 3630 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3631 | ExitOnFailure(hr, "Failed to read size of OnExecutePatchTarget result."); | ||
| 3632 | |||
| 3633 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 3634 | ExitOnFailure(hr, "Failed to read cancel of OnExecutePatchTarget result."); | ||
| 3635 | |||
| 3636 | if (results.fCancel) | ||
| 3637 | { | ||
| 3638 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 3639 | } | ||
| 3640 | |||
| 3641 | LExit: | ||
| 3642 | PipeFreeRpcResult(&rpc); | ||
| 3643 | ReleaseBuffer(bufferResults); | ||
| 3644 | ReleaseBuffer(bufferArgs); | ||
| 3645 | |||
| 3646 | return hr; | ||
| 3647 | } | ||
| 3648 | |||
| 3649 | EXTERN_C HRESULT BACallbackOnExecuteProcessCancel( | ||
| 3650 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3651 | __in_z LPCWSTR wzPackageId, | ||
| 3652 | __in DWORD dwProcessId, | ||
| 3653 | __inout BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION* pAction | ||
| 3654 | ) | ||
| 3655 | { | ||
| 3656 | HRESULT hr = S_OK; | ||
| 3657 | BA_ONEXECUTEPROCESSCANCEL_ARGS args = { }; | ||
| 3658 | BA_ONEXECUTEPROCESSCANCEL_RESULTS results = { }; | ||
| 3659 | BUFF_BUFFER bufferArgs = { }; | ||
| 3660 | BUFF_BUFFER bufferResults = { }; | ||
| 3661 | PIPE_RPC_RESULT rpc = { }; | ||
| 3662 | SIZE_T iBuffer = 0; | ||
| 3663 | |||
| 3664 | // Init structs. | ||
| 3665 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3666 | args.wzPackageId = wzPackageId; | ||
| 3667 | args.dwProcessId = dwProcessId; | ||
| 3668 | args.recommendation = *pAction; | ||
| 3669 | |||
| 3670 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3671 | results.action = *pAction; | ||
| 3672 | |||
| 3673 | // Send args. | ||
| 3674 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3675 | ExitOnFailure(hr, "Failed to write API version of OnExecuteProcessCancel args."); | ||
| 3676 | |||
| 3677 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3678 | ExitOnFailure(hr, "Failed to write package id of OnExecuteProcessCancel args."); | ||
| 3679 | |||
| 3680 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwProcessId); | ||
| 3681 | ExitOnFailure(hr, "Failed to write process id of OnExecuteProcessCancel args."); | ||
| 3682 | |||
| 3683 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 3684 | ExitOnFailure(hr, "Failed to write recommendation of OnExecuteProcessCancel args."); | ||
| 3685 | |||
| 3686 | // Send results. | ||
| 3687 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3688 | ExitOnFailure(hr, "Failed to write API version of OnExecuteProcessCancel results."); | ||
| 3689 | |||
| 3690 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 3691 | ExitOnFailure(hr, "Failed to write action of OnExecuteProcessCancel results."); | ||
| 3692 | |||
| 3693 | // Callback. | ||
| 3694 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL, &bufferArgs, &bufferResults, &rpc); | ||
| 3695 | ExitOnFailure(hr, "BA OnExecuteProcessCancel failed."); | ||
| 3696 | |||
| 3697 | if (S_FALSE == hr) | ||
| 3698 | { | ||
| 3699 | ExitFunction(); | ||
| 3700 | } | ||
| 3701 | |||
| 3702 | // Read results. | ||
| 3703 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3704 | ExitOnFailure(hr, "Failed to read size of OnExecuteProcessCancel result."); | ||
| 3705 | |||
| 3706 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 3707 | ExitOnFailure(hr, "Failed to read action of OnExecuteProcessCancel result."); | ||
| 3708 | |||
| 3709 | *pAction = results.action; | ||
| 3710 | |||
| 3711 | LExit: | ||
| 3712 | PipeFreeRpcResult(&rpc); | ||
| 3713 | ReleaseBuffer(bufferResults); | ||
| 3714 | ReleaseBuffer(bufferArgs); | ||
| 3715 | |||
| 3716 | return hr; | ||
| 3717 | } | ||
| 3718 | |||
| 3719 | EXTERN_C HRESULT BACallbackOnExecuteProgress( | ||
| 3720 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3721 | __in_z LPCWSTR wzPackageId, | ||
| 3722 | __in DWORD dwProgressPercentage, | ||
| 3723 | __in DWORD dwOverallPercentage, | ||
| 3724 | __out int* pnResult | ||
| 3725 | ) | ||
| 3726 | { | ||
| 3727 | HRESULT hr = S_OK; | ||
| 3728 | BA_ONEXECUTEPROGRESS_ARGS args = { }; | ||
| 3729 | BA_ONEXECUTEPROGRESS_RESULTS results = { }; | ||
| 3730 | BUFF_BUFFER bufferArgs = { }; | ||
| 3731 | BUFF_BUFFER bufferResults = { }; | ||
| 3732 | PIPE_RPC_RESULT rpc = { }; | ||
| 3733 | SIZE_T iBuffer = 0; | ||
| 3734 | |||
| 3735 | // Init structs. | ||
| 3736 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3737 | args.wzPackageId = wzPackageId; | ||
| 3738 | args.dwProgressPercentage = dwProgressPercentage; | ||
| 3739 | args.dwOverallPercentage = dwOverallPercentage; | ||
| 3740 | |||
| 3741 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3742 | |||
| 3743 | // Send args. | ||
| 3744 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3745 | ExitOnFailure(hr, "Failed to write API version of OnExecuteProgress args."); | ||
| 3746 | |||
| 3747 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 3748 | ExitOnFailure(hr, "Failed to write package id of OnExecuteProgress args."); | ||
| 3749 | |||
| 3750 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwProgressPercentage); | ||
| 3751 | ExitOnFailure(hr, "Failed to write progress of OnExecuteProgress args."); | ||
| 3752 | |||
| 3753 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallPercentage); | ||
| 3754 | ExitOnFailure(hr, "Failed to write overall progress of OnExecuteProgress args."); | ||
| 3755 | |||
| 3756 | // Send results. | ||
| 3757 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3758 | ExitOnFailure(hr, "Failed to write API version of OnExecuteProgress results."); | ||
| 3759 | |||
| 3760 | // Callback. | ||
| 3761 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &bufferArgs, &bufferResults, &rpc); | ||
| 3762 | ExitOnFailure(hr, "BA OnExecuteProgress failed."); | ||
| 3763 | |||
| 3764 | if (S_FALSE == hr) | ||
| 3765 | { | ||
| 3766 | ExitFunction(); | ||
| 3767 | } | ||
| 3768 | |||
| 3769 | // Read results. | ||
| 3770 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3771 | ExitOnFailure(hr, "Failed to read size of OnExecuteProgress result."); | ||
| 3772 | |||
| 3773 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 3774 | ExitOnFailure(hr, "Failed to read cancel of OnExecuteProgress result."); | ||
| 3775 | |||
| 3776 | LExit: | ||
| 3777 | if (FAILED(hr)) | ||
| 3778 | { | ||
| 3779 | *pnResult = IDERROR; | ||
| 3780 | } | ||
| 3781 | else if (results.fCancel) | ||
| 3782 | { | ||
| 3783 | *pnResult = IDCANCEL; | ||
| 3784 | } | ||
| 3785 | else | ||
| 3786 | { | ||
| 3787 | *pnResult = IDNOACTION; | ||
| 3788 | } | ||
| 3789 | |||
| 3790 | PipeFreeRpcResult(&rpc); | ||
| 3791 | ReleaseBuffer(bufferResults); | ||
| 3792 | ReleaseBuffer(bufferArgs); | ||
| 3793 | |||
| 3794 | return hr; | ||
| 3795 | } | ||
| 3796 | |||
| 3797 | EXTERN_C HRESULT BACallbackOnLaunchApprovedExeBegin( | ||
| 3798 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 3799 | ) | ||
| 3800 | { | ||
| 3801 | HRESULT hr = S_OK; | ||
| 3802 | BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS args = { }; | ||
| 3803 | BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS results = { }; | ||
| 3804 | BUFF_BUFFER bufferArgs = { }; | ||
| 3805 | BUFF_BUFFER bufferResults = { }; | ||
| 3806 | PIPE_RPC_RESULT rpc = { }; | ||
| 3807 | SIZE_T iBuffer = 0; | ||
| 3808 | |||
| 3809 | // Init structs. | ||
| 3810 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3811 | |||
| 3812 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3813 | |||
| 3814 | // Send args. | ||
| 3815 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3816 | ExitOnFailure(hr, "Failed to write API version of OnLaunchApprovedExeBegin args."); | ||
| 3817 | |||
| 3818 | // Send results. | ||
| 3819 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3820 | ExitOnFailure(hr, "Failed to write API version of OnLaunchApprovedExeBegin results."); | ||
| 3821 | |||
| 3822 | // Callback. | ||
| 3823 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 3824 | ExitOnFailure(hr, "BA OnLaunchApprovedExeBegin failed."); | ||
| 3825 | |||
| 3826 | if (S_FALSE == hr) | ||
| 3827 | { | ||
| 3828 | ExitFunction(); | ||
| 3829 | } | ||
| 3830 | |||
| 3831 | // Read results. | ||
| 3832 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 3833 | ExitOnFailure(hr, "Failed to read size of OnLaunchApprovedExeBegin result."); | ||
| 3834 | |||
| 3835 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 3836 | ExitOnFailure(hr, "Failed to read cancel of OnLaunchApprovedExeBegin result."); | ||
| 3837 | |||
| 3838 | if (results.fCancel) | ||
| 3839 | { | ||
| 3840 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 3841 | } | ||
| 3842 | |||
| 3843 | LExit: | ||
| 3844 | PipeFreeRpcResult(&rpc); | ||
| 3845 | ReleaseBuffer(bufferResults); | ||
| 3846 | ReleaseBuffer(bufferArgs); | ||
| 3847 | |||
| 3848 | return hr; | ||
| 3849 | } | ||
| 3850 | |||
| 3851 | EXTERN_C HRESULT BACallbackOnLaunchApprovedExeComplete( | ||
| 3852 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3853 | __in HRESULT hrStatus, | ||
| 3854 | __in DWORD dwProcessId | ||
| 3855 | ) | ||
| 3856 | { | ||
| 3857 | HRESULT hr = S_OK; | ||
| 3858 | BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS args = { }; | ||
| 3859 | BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS results = { }; | ||
| 3860 | BUFF_BUFFER bufferArgs = { }; | ||
| 3861 | BUFF_BUFFER bufferResults = { }; | ||
| 3862 | PIPE_RPC_RESULT rpc = { }; | ||
| 3863 | |||
| 3864 | // Init structs. | ||
| 3865 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3866 | args.hrStatus = hrStatus; | ||
| 3867 | args.dwProcessId = dwProcessId; | ||
| 3868 | |||
| 3869 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3870 | |||
| 3871 | // Send args. | ||
| 3872 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3873 | ExitOnFailure(hr, "Failed to write API version of OnLaunchApprovedExeComplete args."); | ||
| 3874 | |||
| 3875 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 3876 | ExitOnFailure(hr, "Failed to write status of OnLaunchApprovedExeComplete args."); | ||
| 3877 | |||
| 3878 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwProcessId); | ||
| 3879 | ExitOnFailure(hr, "Failed to write process id of OnLaunchApprovedExeComplete args."); | ||
| 3880 | |||
| 3881 | // Send results. | ||
| 3882 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3883 | ExitOnFailure(hr, "Failed to write API version of OnLaunchApprovedExeComplete results."); | ||
| 3884 | |||
| 3885 | // Callback. | ||
| 3886 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 3887 | ExitOnFailure(hr, "BA OnLaunchApprovedExeComplete failed."); | ||
| 3888 | |||
| 3889 | if (S_FALSE == hr) | ||
| 3890 | { | ||
| 3891 | ExitFunction(); | ||
| 3892 | } | ||
| 3893 | |||
| 3894 | LExit: | ||
| 3895 | PipeFreeRpcResult(&rpc); | ||
| 3896 | ReleaseBuffer(bufferResults); | ||
| 3897 | ReleaseBuffer(bufferArgs); | ||
| 3898 | |||
| 3899 | return hr; | ||
| 3900 | } | ||
| 3901 | |||
| 3902 | EXTERN_C HRESULT BACallbackOnPauseAUBegin( | ||
| 3903 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 3904 | ) | ||
| 3905 | { | ||
| 3906 | HRESULT hr = S_OK; | ||
| 3907 | BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS args = { }; | ||
| 3908 | BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS results = { }; | ||
| 3909 | BUFF_BUFFER bufferArgs = { }; | ||
| 3910 | BUFF_BUFFER bufferResults = { }; | ||
| 3911 | PIPE_RPC_RESULT rpc = { }; | ||
| 3912 | |||
| 3913 | // Init structs. | ||
| 3914 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3915 | |||
| 3916 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3917 | |||
| 3918 | // Send args. | ||
| 3919 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3920 | ExitOnFailure(hr, "Failed to write API version of OnPauseAUBegin args."); | ||
| 3921 | |||
| 3922 | // Send results. | ||
| 3923 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3924 | ExitOnFailure(hr, "Failed to write API version of OnPauseAUBegin results."); | ||
| 3925 | |||
| 3926 | // Callback. | ||
| 3927 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 3928 | ExitOnFailure(hr, "BA OnPauseAUBegin failed."); | ||
| 3929 | |||
| 3930 | if (S_FALSE == hr) | ||
| 3931 | { | ||
| 3932 | ExitFunction(); | ||
| 3933 | } | ||
| 3934 | |||
| 3935 | LExit: | ||
| 3936 | PipeFreeRpcResult(&rpc); | ||
| 3937 | ReleaseBuffer(bufferResults); | ||
| 3938 | ReleaseBuffer(bufferArgs); | ||
| 3939 | |||
| 3940 | return hr; | ||
| 3941 | } | ||
| 3942 | |||
| 3943 | EXTERN_C HRESULT BACallbackOnPauseAUComplete( | ||
| 3944 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3945 | __in HRESULT hrStatus | ||
| 3946 | ) | ||
| 3947 | { | ||
| 3948 | HRESULT hr = S_OK; | ||
| 3949 | BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS args = { }; | ||
| 3950 | BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS results = { }; | ||
| 3951 | BUFF_BUFFER bufferArgs = { }; | ||
| 3952 | BUFF_BUFFER bufferResults = { }; | ||
| 3953 | PIPE_RPC_RESULT rpc = { }; | ||
| 3954 | |||
| 3955 | // Init structs. | ||
| 3956 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3957 | args.hrStatus = hrStatus; | ||
| 3958 | |||
| 3959 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 3960 | |||
| 3961 | // Send args. | ||
| 3962 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 3963 | ExitOnFailure(hr, "Failed to write API version of OnPauseAUComplete args."); | ||
| 3964 | |||
| 3965 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 3966 | ExitOnFailure(hr, "Failed to write status of OnPauseAUComplete args."); | ||
| 3967 | |||
| 3968 | // Send results. | ||
| 3969 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 3970 | ExitOnFailure(hr, "Failed to write API version of OnPauseAUComplete results."); | ||
| 3971 | |||
| 3972 | // Callback. | ||
| 3973 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 3974 | ExitOnFailure(hr, "BA OnPauseAUComplete failed."); | ||
| 3975 | |||
| 3976 | if (S_FALSE == hr) | ||
| 3977 | { | ||
| 3978 | ExitFunction(); | ||
| 3979 | } | ||
| 3980 | |||
| 3981 | LExit: | ||
| 3982 | PipeFreeRpcResult(&rpc); | ||
| 3983 | ReleaseBuffer(bufferResults); | ||
| 3984 | ReleaseBuffer(bufferArgs); | ||
| 3985 | |||
| 3986 | return hr; | ||
| 3987 | } | ||
| 3988 | |||
| 3989 | EXTERN_C HRESULT BACallbackOnPlanBegin( | ||
| 3990 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 3991 | __in DWORD cPackages | ||
| 3992 | ) | ||
| 3993 | { | ||
| 3994 | HRESULT hr = S_OK; | ||
| 3995 | BA_ONPLANBEGIN_ARGS args = { }; | ||
| 3996 | BA_ONPLANBEGIN_RESULTS results = { }; | ||
| 3997 | BUFF_BUFFER bufferArgs = { }; | ||
| 3998 | BUFF_BUFFER bufferResults = { }; | ||
| 3999 | PIPE_RPC_RESULT rpc = { }; | ||
| 4000 | SIZE_T iBuffer = 0; | ||
| 4001 | |||
| 4002 | // Init structs. | ||
| 4003 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4004 | args.cPackages = cPackages; | ||
| 4005 | |||
| 4006 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4007 | |||
| 4008 | // Send args. | ||
| 4009 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4010 | ExitOnFailure(hr, "Failed to write API version of OnPlanBegin args."); | ||
| 4011 | |||
| 4012 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.cPackages); | ||
| 4013 | ExitOnFailure(hr, "Failed to write count of packages of OnPlanBegin args."); | ||
| 4014 | |||
| 4015 | // Send results. | ||
| 4016 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4017 | ExitOnFailure(hr, "Failed to write API version of OnPlanBegin results."); | ||
| 4018 | |||
| 4019 | // Callback. | ||
| 4020 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 4021 | ExitOnFailure(hr, "BA OnPlanBegin failed."); | ||
| 4022 | |||
| 4023 | if (S_FALSE == hr) | ||
| 4024 | { | ||
| 4025 | ExitFunction(); | ||
| 4026 | } | ||
| 4027 | |||
| 4028 | // Read results. | ||
| 4029 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4030 | ExitOnFailure(hr, "Failed to read size of OnPlanBegin result."); | ||
| 4031 | |||
| 4032 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4033 | ExitOnFailure(hr, "Failed to read cancel of OnPlanBegin result."); | ||
| 4034 | |||
| 4035 | if (results.fCancel) | ||
| 4036 | { | ||
| 4037 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4038 | } | ||
| 4039 | |||
| 4040 | LExit: | ||
| 4041 | PipeFreeRpcResult(&rpc); | ||
| 4042 | ReleaseBuffer(bufferResults); | ||
| 4043 | ReleaseBuffer(bufferArgs); | ||
| 4044 | |||
| 4045 | return hr; | ||
| 4046 | } | ||
| 4047 | |||
| 4048 | EXTERN_C HRESULT BACallbackOnPlanCompatibleMsiPackageBegin( | ||
| 4049 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4050 | __in_z LPCWSTR wzPackageId, | ||
| 4051 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 4052 | __in VERUTIL_VERSION* pCompatiblePackageVersion, | ||
| 4053 | __inout BOOL* pfRequested | ||
| 4054 | ) | ||
| 4055 | { | ||
| 4056 | HRESULT hr = S_OK; | ||
| 4057 | BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS args = { }; | ||
| 4058 | BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS results = { }; | ||
| 4059 | BUFF_BUFFER bufferArgs = { }; | ||
| 4060 | BUFF_BUFFER bufferResults = { }; | ||
| 4061 | PIPE_RPC_RESULT rpc = { }; | ||
| 4062 | SIZE_T iBuffer = 0; | ||
| 4063 | |||
| 4064 | // Init structs. | ||
| 4065 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4066 | args.wzPackageId = wzPackageId; | ||
| 4067 | args.wzCompatiblePackageId = wzCompatiblePackageId; | ||
| 4068 | args.wzCompatiblePackageVersion = pCompatiblePackageVersion->sczVersion; | ||
| 4069 | args.fRecommendedRemove = *pfRequested; | ||
| 4070 | |||
| 4071 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4072 | results.fRequestRemove = *pfRequested; | ||
| 4073 | |||
| 4074 | // Send args. | ||
| 4075 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4076 | ExitOnFailure(hr, "Failed to write API version of OnPlanCompatibleMsiPackageBegin args."); | ||
| 4077 | |||
| 4078 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4079 | ExitOnFailure(hr, "Failed to write package id of OnPlanCompatibleMsiPackageBegin args."); | ||
| 4080 | |||
| 4081 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCompatiblePackageId); | ||
| 4082 | ExitOnFailure(hr, "Failed to write compatible package id of OnPlanCompatibleMsiPackageBegin args."); | ||
| 4083 | |||
| 4084 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCompatiblePackageVersion); | ||
| 4085 | ExitOnFailure(hr, "Failed to write compatible package version of OnPlanCompatibleMsiPackageBegin args."); | ||
| 4086 | |||
| 4087 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fRecommendedRemove); | ||
| 4088 | ExitOnFailure(hr, "Failed to write recommend remove of OnPlanCompatibleMsiPackageBegin args."); | ||
| 4089 | |||
| 4090 | // Send results. | ||
| 4091 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4092 | ExitOnFailure(hr, "Failed to write API version of OnPlanCompatibleMsiPackageBegin results."); | ||
| 4093 | |||
| 4094 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fRequestRemove); | ||
| 4095 | ExitOnFailure(hr, "Failed to write request remove of OnPlanCompatibleMsiPackageBegin results."); | ||
| 4096 | |||
| 4097 | // Callback. | ||
| 4098 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 4099 | ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageBegin failed."); | ||
| 4100 | |||
| 4101 | if (S_FALSE == hr) | ||
| 4102 | { | ||
| 4103 | ExitFunction(); | ||
| 4104 | } | ||
| 4105 | |||
| 4106 | // Read results. | ||
| 4107 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4108 | ExitOnFailure(hr, "Failed to read size of OnPlanCompatibleMsiPackageBegin result."); | ||
| 4109 | |||
| 4110 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4111 | ExitOnFailure(hr, "Failed to read cancel of OnPlanCompatibleMsiPackageBegin result."); | ||
| 4112 | |||
| 4113 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fRequestRemove)); | ||
| 4114 | ExitOnFailure(hr, "Failed to read requested remove of OnPlanCompatibleMsiPackageBegin result."); | ||
| 4115 | |||
| 4116 | if (results.fCancel) | ||
| 4117 | { | ||
| 4118 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4119 | } | ||
| 4120 | |||
| 4121 | *pfRequested = results.fRequestRemove; | ||
| 4122 | |||
| 4123 | LExit: | ||
| 4124 | PipeFreeRpcResult(&rpc); | ||
| 4125 | ReleaseBuffer(bufferResults); | ||
| 4126 | ReleaseBuffer(bufferArgs); | ||
| 4127 | |||
| 4128 | return hr; | ||
| 4129 | } | ||
| 4130 | |||
| 4131 | EXTERN_C HRESULT BACallbackOnPlanCompatibleMsiPackageComplete( | ||
| 4132 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4133 | __in_z LPCWSTR wzPackageId, | ||
| 4134 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 4135 | __in HRESULT hrStatus, | ||
| 4136 | __in BOOL fRequested | ||
| 4137 | ) | ||
| 4138 | { | ||
| 4139 | HRESULT hr = S_OK; | ||
| 4140 | BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS args = { }; | ||
| 4141 | BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS results = { }; | ||
| 4142 | BUFF_BUFFER bufferArgs = { }; | ||
| 4143 | BUFF_BUFFER bufferResults = { }; | ||
| 4144 | PIPE_RPC_RESULT rpc = { }; | ||
| 4145 | |||
| 4146 | // Init structs. | ||
| 4147 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4148 | args.wzPackageId = wzPackageId; | ||
| 4149 | args.wzCompatiblePackageId = wzCompatiblePackageId; | ||
| 4150 | args.hrStatus = hrStatus; | ||
| 4151 | args.fRequestedRemove = fRequested; | ||
| 4152 | |||
| 4153 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4154 | |||
| 4155 | // Send args. | ||
| 4156 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4157 | ExitOnFailure(hr, "Failed to write API version of OnPlanCompatibleMsiPackageComplete args."); | ||
| 4158 | |||
| 4159 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4160 | ExitOnFailure(hr, "Failed to write package id of OnPlanCompatibleMsiPackageComplete args."); | ||
| 4161 | |||
| 4162 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCompatiblePackageId); | ||
| 4163 | ExitOnFailure(hr, "Failed to write compatible package id of OnPlanCompatibleMsiPackageComplete args."); | ||
| 4164 | |||
| 4165 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 4166 | ExitOnFailure(hr, "Failed to write status of OnPlanCompatibleMsiPackageComplete args."); | ||
| 4167 | |||
| 4168 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fRequestedRemove); | ||
| 4169 | ExitOnFailure(hr, "Failed to write requested remove of OnPlanCompatibleMsiPackageComplete args."); | ||
| 4170 | |||
| 4171 | // Send results. | ||
| 4172 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4173 | ExitOnFailure(hr, "Failed to write API version of OnPlanCompatibleMsiPackageComplete results."); | ||
| 4174 | |||
| 4175 | // Callback. | ||
| 4176 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 4177 | ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageComplete failed."); | ||
| 4178 | |||
| 4179 | if (S_FALSE == hr) | ||
| 4180 | { | ||
| 4181 | ExitFunction(); | ||
| 4182 | } | ||
| 4183 | |||
| 4184 | LExit: | ||
| 4185 | PipeFreeRpcResult(&rpc); | ||
| 4186 | ReleaseBuffer(bufferResults); | ||
| 4187 | ReleaseBuffer(bufferArgs); | ||
| 4188 | |||
| 4189 | return hr; | ||
| 4190 | } | ||
| 4191 | |||
| 4192 | EXTERN_C HRESULT BACallbackOnPlanMsiFeature( | ||
| 4193 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4194 | __in_z LPCWSTR wzPackageId, | ||
| 4195 | __in_z LPCWSTR wzFeatureId, | ||
| 4196 | __inout BOOTSTRAPPER_FEATURE_STATE* pRequestedState | ||
| 4197 | ) | ||
| 4198 | { | ||
| 4199 | HRESULT hr = S_OK; | ||
| 4200 | BA_ONPLANMSIFEATURE_ARGS args = { }; | ||
| 4201 | BA_ONPLANMSIFEATURE_RESULTS results = { }; | ||
| 4202 | BUFF_BUFFER bufferArgs = { }; | ||
| 4203 | BUFF_BUFFER bufferResults = { }; | ||
| 4204 | PIPE_RPC_RESULT rpc = { }; | ||
| 4205 | SIZE_T iBuffer = 0; | ||
| 4206 | |||
| 4207 | // Init structs. | ||
| 4208 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4209 | args.wzPackageId = wzPackageId; | ||
| 4210 | args.wzFeatureId = wzFeatureId; | ||
| 4211 | args.recommendedState = *pRequestedState; | ||
| 4212 | |||
| 4213 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4214 | results.requestedState = *pRequestedState; | ||
| 4215 | |||
| 4216 | // Send args. | ||
| 4217 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4218 | ExitOnFailure(hr, "Failed to write API version of OnPlanMsiFeature args."); | ||
| 4219 | |||
| 4220 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4221 | ExitOnFailure(hr, "Failed to write package id of OnPlanMsiFeature args."); | ||
| 4222 | |||
| 4223 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzFeatureId); | ||
| 4224 | ExitOnFailure(hr, "Failed to write feature id of OnPlanMsiFeature args."); | ||
| 4225 | |||
| 4226 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedState); | ||
| 4227 | ExitOnFailure(hr, "Failed to write recommended state of OnPlanMsiFeature args."); | ||
| 4228 | |||
| 4229 | // Send results. | ||
| 4230 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4231 | ExitOnFailure(hr, "Failed to write API version of OnPlanMsiFeature results."); | ||
| 4232 | |||
| 4233 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedState); | ||
| 4234 | ExitOnFailure(hr, "Failed to write requested state of OnPlanMsiFeature results."); | ||
| 4235 | |||
| 4236 | // Callback. | ||
| 4237 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &bufferArgs, &bufferResults, &rpc); | ||
| 4238 | ExitOnFailure(hr, "BA OnPlanMsiFeature failed."); | ||
| 4239 | |||
| 4240 | if (S_FALSE == hr) | ||
| 4241 | { | ||
| 4242 | ExitFunction(); | ||
| 4243 | } | ||
| 4244 | |||
| 4245 | // Read results. | ||
| 4246 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4247 | ExitOnFailure(hr, "Failed to read size of OnPlanMsiFeature result."); | ||
| 4248 | |||
| 4249 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedState)); | ||
| 4250 | ExitOnFailure(hr, "Failed to read requested state of OnPlanMsiFeature result."); | ||
| 4251 | |||
| 4252 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4253 | ExitOnFailure(hr, "Failed to read cancel of OnPlanMsiFeature result."); | ||
| 4254 | |||
| 4255 | if (results.fCancel) | ||
| 4256 | { | ||
| 4257 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4258 | } | ||
| 4259 | |||
| 4260 | *pRequestedState = results.requestedState; | ||
| 4261 | |||
| 4262 | LExit: | ||
| 4263 | PipeFreeRpcResult(&rpc); | ||
| 4264 | ReleaseBuffer(bufferResults); | ||
| 4265 | ReleaseBuffer(bufferArgs); | ||
| 4266 | |||
| 4267 | return hr; | ||
| 4268 | } | ||
| 4269 | |||
| 4270 | EXTERN_C HRESULT BACallbackOnPlanComplete( | ||
| 4271 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4272 | __in HRESULT hrStatus | ||
| 4273 | ) | ||
| 4274 | { | ||
| 4275 | HRESULT hr = S_OK; | ||
| 4276 | BA_ONPLANCOMPLETE_ARGS args = { }; | ||
| 4277 | BA_ONPLANCOMPLETE_RESULTS results = { }; | ||
| 4278 | BUFF_BUFFER bufferArgs = { }; | ||
| 4279 | BUFF_BUFFER bufferResults = { }; | ||
| 4280 | PIPE_RPC_RESULT rpc = { }; | ||
| 4281 | |||
| 4282 | // Init structs. | ||
| 4283 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4284 | args.hrStatus = hrStatus; | ||
| 4285 | |||
| 4286 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4287 | |||
| 4288 | // Send args. | ||
| 4289 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4290 | ExitOnFailure(hr, "Failed to write API version of OnPlanComplete args."); | ||
| 4291 | |||
| 4292 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 4293 | ExitOnFailure(hr, "Failed to write status of OnPlanComplete args."); | ||
| 4294 | |||
| 4295 | // Send results. | ||
| 4296 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4297 | ExitOnFailure(hr, "Failed to write API version of OnPlanComplete results."); | ||
| 4298 | |||
| 4299 | // Callback. | ||
| 4300 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 4301 | ExitOnFailure(hr, "BA OnPlanComplete failed."); | ||
| 4302 | |||
| 4303 | if (S_FALSE == hr) | ||
| 4304 | { | ||
| 4305 | ExitFunction(); | ||
| 4306 | } | ||
| 4307 | |||
| 4308 | LExit: | ||
| 4309 | PipeFreeRpcResult(&rpc); | ||
| 4310 | ReleaseBuffer(bufferResults); | ||
| 4311 | ReleaseBuffer(bufferArgs); | ||
| 4312 | |||
| 4313 | return hr; | ||
| 4314 | } | ||
| 4315 | |||
| 4316 | EXTERN_C HRESULT BACallbackOnPlanForwardCompatibleBundle( | ||
| 4317 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4318 | __in_z LPCWSTR wzBundleId, | ||
| 4319 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 4320 | __in_z LPCWSTR wzBundleTag, | ||
| 4321 | __in BOOL fPerMachine, | ||
| 4322 | __in VERUTIL_VERSION* pVersion, | ||
| 4323 | __inout BOOL* pfIgnoreBundle | ||
| 4324 | ) | ||
| 4325 | { | ||
| 4326 | HRESULT hr = S_OK; | ||
| 4327 | BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; | ||
| 4328 | BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; | ||
| 4329 | BUFF_BUFFER bufferArgs = { }; | ||
| 4330 | BUFF_BUFFER bufferResults = { }; | ||
| 4331 | PIPE_RPC_RESULT rpc = { }; | ||
| 4332 | SIZE_T iBuffer = 0; | ||
| 4333 | |||
| 4334 | // Init structs. | ||
| 4335 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4336 | args.wzBundleId = wzBundleId; | ||
| 4337 | args.relationType = relationType; | ||
| 4338 | args.wzBundleTag = wzBundleTag; | ||
| 4339 | args.fPerMachine = fPerMachine; | ||
| 4340 | args.wzVersion = pVersion->sczVersion; | ||
| 4341 | args.fRecommendedIgnoreBundle = *pfIgnoreBundle; | ||
| 4342 | |||
| 4343 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4344 | results.fIgnoreBundle = *pfIgnoreBundle; | ||
| 4345 | |||
| 4346 | // Send args. | ||
| 4347 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4348 | ExitOnFailure(hr, "Failed to write API version of OnPlanForwardCompatibleBundle args."); | ||
| 4349 | |||
| 4350 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 4351 | ExitOnFailure(hr, "Failed to write bundle id of OnPlanForwardCompatibleBundle args."); | ||
| 4352 | |||
| 4353 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.relationType); | ||
| 4354 | ExitOnFailure(hr, "Failed to write relation type of OnPlanForwardCompatibleBundle args."); | ||
| 4355 | |||
| 4356 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleTag); | ||
| 4357 | ExitOnFailure(hr, "Failed to write bundle tag of OnPlanForwardCompatibleBundle args."); | ||
| 4358 | |||
| 4359 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPerMachine); | ||
| 4360 | ExitOnFailure(hr, "Failed to write per-machine of OnPlanForwardCompatibleBundle args."); | ||
| 4361 | |||
| 4362 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion); | ||
| 4363 | ExitOnFailure(hr, "Failed to write version of OnPlanForwardCompatibleBundle args."); | ||
| 4364 | |||
| 4365 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fRecommendedIgnoreBundle); | ||
| 4366 | ExitOnFailure(hr, "Failed to write recommended ignore bundle of OnPlanForwardCompatibleBundle args."); | ||
| 4367 | |||
| 4368 | // Send results. | ||
| 4369 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4370 | ExitOnFailure(hr, "Failed to write API version of OnPlanForwardCompatibleBundle results."); | ||
| 4371 | |||
| 4372 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fIgnoreBundle); | ||
| 4373 | ExitOnFailure(hr, "Failed to write ignore bundle of OnPlanForwardCompatibleBundle results."); | ||
| 4374 | |||
| 4375 | // Callback. | ||
| 4376 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &bufferArgs, &bufferResults, &rpc); | ||
| 4377 | ExitOnFailure(hr, "BA OnPlanForwardCompatibleBundle failed."); | ||
| 4378 | |||
| 4379 | if (S_FALSE == hr) | ||
| 4380 | { | ||
| 4381 | ExitFunction(); | ||
| 4382 | } | ||
| 4383 | |||
| 4384 | // Read results. | ||
| 4385 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4386 | ExitOnFailure(hr, "Failed to read size of OnPlanForwardCompatibleBundle result."); | ||
| 4387 | |||
| 4388 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4389 | ExitOnFailure(hr, "Failed to read cancel of OnPlanForwardCompatibleBundle result."); | ||
| 4390 | |||
| 4391 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fIgnoreBundle)); | ||
| 4392 | ExitOnFailure(hr, "Failed to read ignore bundle of OnPlanForwardCompatibleBundle result."); | ||
| 4393 | |||
| 4394 | if (results.fCancel) | ||
| 4395 | { | ||
| 4396 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4397 | } | ||
| 4398 | |||
| 4399 | *pfIgnoreBundle = results.fIgnoreBundle; | ||
| 4400 | |||
| 4401 | LExit: | ||
| 4402 | PipeFreeRpcResult(&rpc); | ||
| 4403 | ReleaseBuffer(bufferResults); | ||
| 4404 | ReleaseBuffer(bufferArgs); | ||
| 4405 | |||
| 4406 | return hr; | ||
| 4407 | } | ||
| 4408 | |||
| 4409 | EXTERN_C HRESULT BACallbackOnPlanMsiPackage( | ||
| 4410 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4411 | __in_z LPCWSTR wzPackageId, | ||
| 4412 | __in BOOL fExecute, | ||
| 4413 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
| 4414 | __inout BURN_MSI_PROPERTY* pActionMsiProperty, | ||
| 4415 | __inout INSTALLUILEVEL* pUiLevel, | ||
| 4416 | __inout BOOL* pfDisableExternalUiHandler, | ||
| 4417 | __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning | ||
| 4418 | ) | ||
| 4419 | { | ||
| 4420 | HRESULT hr = S_OK; | ||
| 4421 | BA_ONPLANMSIPACKAGE_ARGS args = { }; | ||
| 4422 | BA_ONPLANMSIPACKAGE_RESULTS results = { }; | ||
| 4423 | BUFF_BUFFER bufferArgs = { }; | ||
| 4424 | BUFF_BUFFER bufferResults = { }; | ||
| 4425 | PIPE_RPC_RESULT rpc = { }; | ||
| 4426 | SIZE_T iBuffer = 0; | ||
| 4427 | |||
| 4428 | // Init structs. | ||
| 4429 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4430 | args.wzPackageId = wzPackageId; | ||
| 4431 | args.fExecute = fExecute; | ||
| 4432 | args.action = action; | ||
| 4433 | args.recommendedFileVersioning = *pFileVersioning; | ||
| 4434 | |||
| 4435 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4436 | results.actionMsiProperty = *pActionMsiProperty; | ||
| 4437 | results.uiLevel = *pUiLevel; | ||
| 4438 | results.fDisableExternalUiHandler = *pfDisableExternalUiHandler; | ||
| 4439 | results.fileVersioning = args.recommendedFileVersioning; | ||
| 4440 | |||
| 4441 | // Send args. | ||
| 4442 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4443 | ExitOnFailure(hr, "Failed to write API version of OnPlanMsiPackage args."); | ||
| 4444 | |||
| 4445 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4446 | ExitOnFailure(hr, "Failed to write package id of OnPlanMsiPackage args."); | ||
| 4447 | |||
| 4448 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fExecute); | ||
| 4449 | ExitOnFailure(hr, "Failed to write execute of OnPlanMsiPackage args."); | ||
| 4450 | |||
| 4451 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.action); | ||
| 4452 | ExitOnFailure(hr, "Failed to write action of OnPlanMsiPackage args."); | ||
| 4453 | |||
| 4454 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedFileVersioning); | ||
| 4455 | ExitOnFailure(hr, "Failed to write recommended file versioning of OnPlanMsiPackage args."); | ||
| 4456 | |||
| 4457 | // Send results. | ||
| 4458 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4459 | ExitOnFailure(hr, "Failed to write API version of OnPlanMsiPackage results."); | ||
| 4460 | |||
| 4461 | hr = BuffWriteNumberToBuffer(&bufferResults, results.actionMsiProperty); | ||
| 4462 | ExitOnFailure(hr, "Failed to write action msi property of OnPlanMsiPackage results."); | ||
| 4463 | |||
| 4464 | hr = BuffWriteNumberToBuffer(&bufferResults, results.uiLevel); | ||
| 4465 | ExitOnFailure(hr, "Failed to write UI level of OnPlanMsiPackage results."); | ||
| 4466 | |||
| 4467 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fDisableExternalUiHandler); | ||
| 4468 | ExitOnFailure(hr, "Failed to write disable external UI handler of OnPlanMsiPackage results."); | ||
| 4469 | |||
| 4470 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fileVersioning); | ||
| 4471 | ExitOnFailure(hr, "Failed to write file versioning of OnPlanMsiPackage results."); | ||
| 4472 | |||
| 4473 | // Callback. | ||
| 4474 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 4475 | ExitOnFailure(hr, "BA OnPlanMsiPackage failed."); | ||
| 4476 | |||
| 4477 | if (S_FALSE == hr) | ||
| 4478 | { | ||
| 4479 | ExitFunction(); | ||
| 4480 | } | ||
| 4481 | |||
| 4482 | // Read results. | ||
| 4483 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4484 | ExitOnFailure(hr, "Failed to read size of OnPlanMsiPackage result."); | ||
| 4485 | |||
| 4486 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4487 | ExitOnFailure(hr, "Failed to read cancel of OnPlanMsiPackage result."); | ||
| 4488 | |||
| 4489 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.actionMsiProperty)); | ||
| 4490 | ExitOnFailure(hr, "Failed to read action MSI property of OnPlanMsiPackage result."); | ||
| 4491 | |||
| 4492 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.uiLevel)); | ||
| 4493 | ExitOnFailure(hr, "Failed to read UI level of OnPlanMsiPackage result."); | ||
| 4494 | |||
| 4495 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fDisableExternalUiHandler)); | ||
| 4496 | ExitOnFailure(hr, "Failed to read disable external UI handler of OnPlanMsiPackage result."); | ||
| 4497 | |||
| 4498 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fileVersioning)); | ||
| 4499 | ExitOnFailure(hr, "Failed to read file versioning of OnPlanMsiPackage result."); | ||
| 4500 | |||
| 4501 | if (results.fCancel) | ||
| 4502 | { | ||
| 4503 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4504 | } | ||
| 4505 | |||
| 4506 | *pActionMsiProperty = results.actionMsiProperty; | ||
| 4507 | *pUiLevel = results.uiLevel; | ||
| 4508 | *pfDisableExternalUiHandler = results.fDisableExternalUiHandler; | ||
| 4509 | *pFileVersioning = results.fileVersioning; | ||
| 4510 | |||
| 4511 | LExit: | ||
| 4512 | PipeFreeRpcResult(&rpc); | ||
| 4513 | ReleaseBuffer(bufferResults); | ||
| 4514 | ReleaseBuffer(bufferArgs); | ||
| 4515 | |||
| 4516 | return hr; | ||
| 4517 | } | ||
| 4518 | |||
| 4519 | EXTERN_C HRESULT BACallbackOnPlannedCompatiblePackage( | ||
| 4520 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4521 | __in_z LPCWSTR wzPackageId, | ||
| 4522 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 4523 | __in BOOL fRemove | ||
| 4524 | ) | ||
| 4525 | { | ||
| 4526 | HRESULT hr = S_OK; | ||
| 4527 | BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS args = { }; | ||
| 4528 | BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS results = { }; | ||
| 4529 | BUFF_BUFFER bufferArgs = { }; | ||
| 4530 | BUFF_BUFFER bufferResults = { }; | ||
| 4531 | PIPE_RPC_RESULT rpc = { }; | ||
| 4532 | |||
| 4533 | // Init structs. | ||
| 4534 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4535 | args.wzPackageId = wzPackageId; | ||
| 4536 | args.wzCompatiblePackageId = wzCompatiblePackageId; | ||
| 4537 | args.fRemove = fRemove; | ||
| 4538 | |||
| 4539 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4540 | |||
| 4541 | // Send args. | ||
| 4542 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4543 | ExitOnFailure(hr, "Failed to write API version of OnPlannedCompatiblePackage args."); | ||
| 4544 | |||
| 4545 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4546 | ExitOnFailure(hr, "Failed to write package id of OnPlannedCompatiblePackage args."); | ||
| 4547 | |||
| 4548 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCompatiblePackageId); | ||
| 4549 | ExitOnFailure(hr, "Failed to write compatible package id of OnPlannedCompatiblePackage args."); | ||
| 4550 | |||
| 4551 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fRemove); | ||
| 4552 | ExitOnFailure(hr, "Failed to write remove of OnPlannedCompatiblePackage args."); | ||
| 4553 | |||
| 4554 | // Send results. | ||
| 4555 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4556 | ExitOnFailure(hr, "Failed to write API version of OnPlannedCompatiblePackage results."); | ||
| 4557 | |||
| 4558 | // Callback. | ||
| 4559 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 4560 | ExitOnFailure(hr, "BA OnPlannedCompatiblePackage failed."); | ||
| 4561 | |||
| 4562 | if (S_FALSE == hr) | ||
| 4563 | { | ||
| 4564 | ExitFunction(); | ||
| 4565 | } | ||
| 4566 | |||
| 4567 | LExit: | ||
| 4568 | PipeFreeRpcResult(&rpc); | ||
| 4569 | ReleaseBuffer(bufferResults); | ||
| 4570 | ReleaseBuffer(bufferArgs); | ||
| 4571 | |||
| 4572 | return hr; | ||
| 4573 | } | ||
| 4574 | |||
| 4575 | EXTERN_C HRESULT BACallbackOnPlannedPackage( | ||
| 4576 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4577 | __in_z LPCWSTR wzPackageId, | ||
| 4578 | __in BOOTSTRAPPER_ACTION_STATE execute, | ||
| 4579 | __in BOOTSTRAPPER_ACTION_STATE rollback, | ||
| 4580 | __in BOOL fPlannedCache, | ||
| 4581 | __in BOOL fPlannedUncache | ||
| 4582 | ) | ||
| 4583 | { | ||
| 4584 | HRESULT hr = S_OK; | ||
| 4585 | BA_ONPLANNEDPACKAGE_ARGS args = { }; | ||
| 4586 | BA_ONPLANNEDPACKAGE_RESULTS results = { }; | ||
| 4587 | BUFF_BUFFER bufferArgs = { }; | ||
| 4588 | BUFF_BUFFER bufferResults = { }; | ||
| 4589 | PIPE_RPC_RESULT rpc = { }; | ||
| 4590 | |||
| 4591 | // Init structs. | ||
| 4592 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4593 | args.wzPackageId = wzPackageId; | ||
| 4594 | args.execute = execute; | ||
| 4595 | args.rollback = rollback; | ||
| 4596 | args.fPlannedCache = fPlannedCache; | ||
| 4597 | args.fPlannedUncache = fPlannedUncache; | ||
| 4598 | |||
| 4599 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4600 | |||
| 4601 | // Send args. | ||
| 4602 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4603 | ExitOnFailure(hr, "Failed to write API version of OnPlannedPackage args."); | ||
| 4604 | |||
| 4605 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4606 | ExitOnFailure(hr, "Failed to write package id of OnPlannedPackage args."); | ||
| 4607 | |||
| 4608 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.execute); | ||
| 4609 | ExitOnFailure(hr, "Failed to write execute of OnPlannedPackage args."); | ||
| 4610 | |||
| 4611 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.rollback); | ||
| 4612 | ExitOnFailure(hr, "Failed to write rollback of OnPlannedPackage args."); | ||
| 4613 | |||
| 4614 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPlannedCache); | ||
| 4615 | ExitOnFailure(hr, "Failed to write planned cache of OnPlannedPackage args."); | ||
| 4616 | |||
| 4617 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fPlannedUncache); | ||
| 4618 | ExitOnFailure(hr, "Failed to write planned uncache of OnPlannedPackage args."); | ||
| 4619 | |||
| 4620 | // Send results. | ||
| 4621 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4622 | ExitOnFailure(hr, "Failed to write API version of OnPlannedPackage results."); | ||
| 4623 | |||
| 4624 | // Callback. | ||
| 4625 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, &bufferArgs, &bufferResults, &rpc); | ||
| 4626 | ExitOnFailure(hr, "BA OnPlannedPackage failed."); | ||
| 4627 | |||
| 4628 | if (S_FALSE == hr) | ||
| 4629 | { | ||
| 4630 | ExitFunction(); | ||
| 4631 | } | ||
| 4632 | |||
| 4633 | LExit: | ||
| 4634 | PipeFreeRpcResult(&rpc); | ||
| 4635 | ReleaseBuffer(bufferResults); | ||
| 4636 | ReleaseBuffer(bufferArgs); | ||
| 4637 | |||
| 4638 | return hr; | ||
| 4639 | } | ||
| 4640 | |||
| 4641 | EXTERN_C HRESULT BACallbackOnPlanPackageBegin( | ||
| 4642 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4643 | __in_z LPCWSTR wzPackageId, | ||
| 4644 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
| 4645 | __in BOOL fCached, | ||
| 4646 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | ||
| 4647 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | ||
| 4648 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | ||
| 4649 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType | ||
| 4650 | ) | ||
| 4651 | { | ||
| 4652 | HRESULT hr = S_OK; | ||
| 4653 | BA_ONPLANPACKAGEBEGIN_ARGS args = { }; | ||
| 4654 | BA_ONPLANPACKAGEBEGIN_RESULTS results = { }; | ||
| 4655 | BUFF_BUFFER bufferArgs = { }; | ||
| 4656 | BUFF_BUFFER bufferResults = { }; | ||
| 4657 | PIPE_RPC_RESULT rpc = { }; | ||
| 4658 | SIZE_T iBuffer = 0; | ||
| 4659 | |||
| 4660 | // Init structs. | ||
| 4661 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4662 | args.wzPackageId = wzPackageId; | ||
| 4663 | args.state = state; | ||
| 4664 | args.fCached = fCached; | ||
| 4665 | args.installCondition = installCondition; | ||
| 4666 | args.repairCondition = repairCondition; | ||
| 4667 | args.recommendedState = *pRequestedState; | ||
| 4668 | args.recommendedCacheType = *pRequestedCacheType; | ||
| 4669 | |||
| 4670 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4671 | results.requestedState = *pRequestedState; | ||
| 4672 | results.requestedCacheType = *pRequestedCacheType; | ||
| 4673 | |||
| 4674 | // Send args. | ||
| 4675 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4676 | ExitOnFailure(hr, "Failed to write API version of OnPlanPackageBegin args."); | ||
| 4677 | |||
| 4678 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4679 | ExitOnFailure(hr, "Failed to write package id of OnPlanPackageBegin args."); | ||
| 4680 | |||
| 4681 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.state); | ||
| 4682 | ExitOnFailure(hr, "Failed to write state of OnPlanPackageBegin args."); | ||
| 4683 | |||
| 4684 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fCached); | ||
| 4685 | ExitOnFailure(hr, "Failed to write cached of OnPlanPackageBegin args."); | ||
| 4686 | |||
| 4687 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.installCondition); | ||
| 4688 | ExitOnFailure(hr, "Failed to write install condition of OnPlanPackageBegin args."); | ||
| 4689 | |||
| 4690 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.repairCondition); | ||
| 4691 | ExitOnFailure(hr, "Failed to write repair condition of OnPlanPackageBegin args."); | ||
| 4692 | |||
| 4693 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedState); | ||
| 4694 | ExitOnFailure(hr, "Failed to write recommended state of OnPlanPackageBegin args."); | ||
| 4695 | |||
| 4696 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedCacheType); | ||
| 4697 | ExitOnFailure(hr, "Failed to write recommended cache type of OnPlanPackageBegin args."); | ||
| 4698 | |||
| 4699 | // Send results. | ||
| 4700 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4701 | ExitOnFailure(hr, "Failed to write API version of OnPlanPackageBegin results."); | ||
| 4702 | |||
| 4703 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedState); | ||
| 4704 | ExitOnFailure(hr, "Failed to write requested state of OnPlanPackageBegin results."); | ||
| 4705 | |||
| 4706 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedCacheType); | ||
| 4707 | ExitOnFailure(hr, "Failed to write requested cache type of OnPlanPackageBegin results."); | ||
| 4708 | |||
| 4709 | // Callback. | ||
| 4710 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 4711 | ExitOnFailure(hr, "BA OnPlanPackageBegin failed."); | ||
| 4712 | |||
| 4713 | if (S_FALSE == hr) | ||
| 4714 | { | ||
| 4715 | ExitFunction(); | ||
| 4716 | } | ||
| 4717 | |||
| 4718 | // Read results. | ||
| 4719 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4720 | ExitOnFailure(hr, "Failed to read size of OnPlanPackageBegin result."); | ||
| 4721 | |||
| 4722 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4723 | ExitOnFailure(hr, "Failed to read cancel of OnPlanPackageBegin result."); | ||
| 4724 | |||
| 4725 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedState)); | ||
| 4726 | ExitOnFailure(hr, "Failed to read requested state of OnPlanPackageBegin result."); | ||
| 4727 | |||
| 4728 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedCacheType)); | ||
| 4729 | ExitOnFailure(hr, "Failed to read requested cache type of OnPlanPackageBegin result."); | ||
| 4730 | |||
| 4731 | if (results.fCancel) | ||
| 4732 | { | ||
| 4733 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4734 | } | ||
| 4735 | |||
| 4736 | *pRequestedState = results.requestedState; | ||
| 4737 | |||
| 4738 | if (BOOTSTRAPPER_CACHE_TYPE_REMOVE <= results.requestedCacheType && BOOTSTRAPPER_CACHE_TYPE_FORCE >= results.requestedCacheType) | ||
| 4739 | { | ||
| 4740 | *pRequestedCacheType = results.requestedCacheType; | ||
| 4741 | } | ||
| 4742 | |||
| 4743 | LExit: | ||
| 4744 | PipeFreeRpcResult(&rpc); | ||
| 4745 | ReleaseBuffer(bufferResults); | ||
| 4746 | ReleaseBuffer(bufferArgs); | ||
| 4747 | |||
| 4748 | return hr; | ||
| 4749 | } | ||
| 4750 | |||
| 4751 | EXTERN_C HRESULT BACallbackOnPlanPackageComplete( | ||
| 4752 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4753 | __in_z LPCWSTR wzPackageId, | ||
| 4754 | __in HRESULT hrStatus, | ||
| 4755 | __in BOOTSTRAPPER_REQUEST_STATE requested | ||
| 4756 | ) | ||
| 4757 | { | ||
| 4758 | HRESULT hr = S_OK; | ||
| 4759 | BA_ONPLANPACKAGECOMPLETE_ARGS args = { }; | ||
| 4760 | BA_ONPLANPACKAGECOMPLETE_RESULTS results = { }; | ||
| 4761 | BUFF_BUFFER bufferArgs = { }; | ||
| 4762 | BUFF_BUFFER bufferResults = { }; | ||
| 4763 | PIPE_RPC_RESULT rpc = { }; | ||
| 4764 | |||
| 4765 | // Init structs. | ||
| 4766 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4767 | args.wzPackageId = wzPackageId; | ||
| 4768 | args.hrStatus = hrStatus; | ||
| 4769 | args.requested = requested; | ||
| 4770 | |||
| 4771 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4772 | |||
| 4773 | // Send args. | ||
| 4774 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4775 | ExitOnFailure(hr, "Failed to write API version of OnPlanPackageComplete args."); | ||
| 4776 | |||
| 4777 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 4778 | ExitOnFailure(hr, "Failed to write package id of OnPlanPackageComplete args."); | ||
| 4779 | |||
| 4780 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 4781 | ExitOnFailure(hr, "Failed to write status of OnPlanPackageComplete args."); | ||
| 4782 | |||
| 4783 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.requested); | ||
| 4784 | ExitOnFailure(hr, "Failed to write requested of OnPlanPackageComplete args."); | ||
| 4785 | |||
| 4786 | // Send results. | ||
| 4787 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4788 | ExitOnFailure(hr, "Failed to write API version of OnPlanPackageComplete results."); | ||
| 4789 | |||
| 4790 | // Callback. | ||
| 4791 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 4792 | ExitOnFailure(hr, "BA OnPlanPackageComplete failed."); | ||
| 4793 | |||
| 4794 | if (S_FALSE == hr) | ||
| 4795 | { | ||
| 4796 | ExitFunction(); | ||
| 4797 | } | ||
| 4798 | |||
| 4799 | LExit: | ||
| 4800 | PipeFreeRpcResult(&rpc); | ||
| 4801 | ReleaseBuffer(bufferResults); | ||
| 4802 | ReleaseBuffer(bufferArgs); | ||
| 4803 | |||
| 4804 | return hr; | ||
| 4805 | } | ||
| 4806 | |||
| 4807 | EXTERN_C HRESULT BACallbackOnPlanRelatedBundle( | ||
| 4808 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4809 | __in_z LPCWSTR wzBundleId, | ||
| 4810 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
| 4811 | ) | ||
| 4812 | { | ||
| 4813 | HRESULT hr = S_OK; | ||
| 4814 | BA_ONPLANRELATEDBUNDLE_ARGS args = { }; | ||
| 4815 | BA_ONPLANRELATEDBUNDLE_RESULTS results = { }; | ||
| 4816 | BUFF_BUFFER bufferArgs = { }; | ||
| 4817 | BUFF_BUFFER bufferResults = { }; | ||
| 4818 | PIPE_RPC_RESULT rpc = { }; | ||
| 4819 | SIZE_T iBuffer = 0; | ||
| 4820 | |||
| 4821 | // Init structs. | ||
| 4822 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4823 | args.wzBundleId = wzBundleId; | ||
| 4824 | args.recommendedState = *pRequestedState; | ||
| 4825 | |||
| 4826 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4827 | results.requestedState = *pRequestedState; | ||
| 4828 | |||
| 4829 | // Send args. | ||
| 4830 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4831 | ExitOnFailure(hr, "Failed to write API version of OnPlanRelatedBundle args."); | ||
| 4832 | |||
| 4833 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 4834 | ExitOnFailure(hr, "Failed to write bundle id of OnPlanRelatedBundle args."); | ||
| 4835 | |||
| 4836 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedState); | ||
| 4837 | ExitOnFailure(hr, "Failed to write recommended state of OnPlanRelatedBundle args."); | ||
| 4838 | |||
| 4839 | // Send results. | ||
| 4840 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4841 | ExitOnFailure(hr, "Failed to write API version of OnPlanRelatedBundle results."); | ||
| 4842 | |||
| 4843 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedState); | ||
| 4844 | ExitOnFailure(hr, "Failed to write requested state of OnPlanRelatedBundle results."); | ||
| 4845 | |||
| 4846 | // Callback. | ||
| 4847 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &bufferArgs, &bufferResults, &rpc); | ||
| 4848 | ExitOnFailure(hr, "BA OnPlanRelatedBundle failed."); | ||
| 4849 | |||
| 4850 | if (S_FALSE == hr) | ||
| 4851 | { | ||
| 4852 | ExitFunction(); | ||
| 4853 | } | ||
| 4854 | |||
| 4855 | // Read results. | ||
| 4856 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4857 | ExitOnFailure(hr, "Failed to read size of OnPlanRelatedBundle result."); | ||
| 4858 | |||
| 4859 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4860 | ExitOnFailure(hr, "Failed to read cancel of OnPlanRelatedBundle result."); | ||
| 4861 | |||
| 4862 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedState)); | ||
| 4863 | ExitOnFailure(hr, "Failed to read requested state of OnPlanRelatedBundle result."); | ||
| 4864 | |||
| 4865 | if (results.fCancel) | ||
| 4866 | { | ||
| 4867 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4868 | } | ||
| 4869 | |||
| 4870 | *pRequestedState = results.requestedState; | ||
| 4871 | |||
| 4872 | LExit: | ||
| 4873 | PipeFreeRpcResult(&rpc); | ||
| 4874 | ReleaseBuffer(bufferResults); | ||
| 4875 | ReleaseBuffer(bufferArgs); | ||
| 4876 | |||
| 4877 | return hr; | ||
| 4878 | } | ||
| 4879 | |||
| 4880 | EXTERN_C HRESULT BACallbackOnPlanRelatedBundleType( | ||
| 4881 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4882 | __in_z LPCWSTR wzBundleId, | ||
| 4883 | __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType | ||
| 4884 | ) | ||
| 4885 | { | ||
| 4886 | HRESULT hr = S_OK; | ||
| 4887 | BA_ONPLANRELATEDBUNDLETYPE_ARGS args = { }; | ||
| 4888 | BA_ONPLANRELATEDBUNDLETYPE_RESULTS results = { }; | ||
| 4889 | BUFF_BUFFER bufferArgs = { }; | ||
| 4890 | BUFF_BUFFER bufferResults = { }; | ||
| 4891 | PIPE_RPC_RESULT rpc = { }; | ||
| 4892 | SIZE_T iBuffer = 0; | ||
| 4893 | |||
| 4894 | // Init structs. | ||
| 4895 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4896 | args.wzBundleId = wzBundleId; | ||
| 4897 | args.recommendedType = *pRequestedType; | ||
| 4898 | |||
| 4899 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4900 | results.requestedType = *pRequestedType; | ||
| 4901 | |||
| 4902 | // Send args. | ||
| 4903 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4904 | ExitOnFailure(hr, "Failed to write API version of OnPlanRelatedBundleType args."); | ||
| 4905 | |||
| 4906 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 4907 | ExitOnFailure(hr, "Failed to write bundle id of OnPlanRelatedBundleType args."); | ||
| 4908 | |||
| 4909 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedType); | ||
| 4910 | ExitOnFailure(hr, "Failed to write recommended type of OnPlanRelatedBundleType args."); | ||
| 4911 | |||
| 4912 | // Send results. | ||
| 4913 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4914 | ExitOnFailure(hr, "Failed to write API version of OnPlanRelatedBundleType results."); | ||
| 4915 | |||
| 4916 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedType); | ||
| 4917 | ExitOnFailure(hr, "Failed to write requested type of OnPlanRelatedBundleType results."); | ||
| 4918 | |||
| 4919 | // Callback. | ||
| 4920 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, &bufferArgs, &bufferResults, &rpc); | ||
| 4921 | ExitOnFailure(hr, "BA OnPlanRelatedBundleType failed."); | ||
| 4922 | |||
| 4923 | if (S_FALSE == hr) | ||
| 4924 | { | ||
| 4925 | ExitFunction(); | ||
| 4926 | } | ||
| 4927 | |||
| 4928 | // Read results. | ||
| 4929 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 4930 | ExitOnFailure(hr, "Failed to read size of OnPlanRelatedBundleType result."); | ||
| 4931 | |||
| 4932 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 4933 | ExitOnFailure(hr, "Failed to read cancel of OnPlanRelatedBundleType result."); | ||
| 4934 | |||
| 4935 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedType)); | ||
| 4936 | ExitOnFailure(hr, "Failed to read requested type of OnPlanRelatedBundleType result."); | ||
| 4937 | |||
| 4938 | if (results.fCancel) | ||
| 4939 | { | ||
| 4940 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 4941 | } | ||
| 4942 | |||
| 4943 | *pRequestedType = results.requestedType; | ||
| 4944 | |||
| 4945 | LExit: | ||
| 4946 | PipeFreeRpcResult(&rpc); | ||
| 4947 | ReleaseBuffer(bufferResults); | ||
| 4948 | ReleaseBuffer(bufferArgs); | ||
| 4949 | |||
| 4950 | return hr; | ||
| 4951 | } | ||
| 4952 | |||
| 4953 | EXTERN_C HRESULT BACallbackOnPlanRestoreRelatedBundle( | ||
| 4954 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 4955 | __in_z LPCWSTR wzBundleId, | ||
| 4956 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
| 4957 | ) | ||
| 4958 | { | ||
| 4959 | HRESULT hr = S_OK; | ||
| 4960 | BA_ONPLANRESTORERELATEDBUNDLE_ARGS args = { }; | ||
| 4961 | BA_ONPLANRESTORERELATEDBUNDLE_RESULTS results = { }; | ||
| 4962 | BUFF_BUFFER bufferArgs = { }; | ||
| 4963 | BUFF_BUFFER bufferResults = { }; | ||
| 4964 | PIPE_RPC_RESULT rpc = { }; | ||
| 4965 | SIZE_T iBuffer = 0; | ||
| 4966 | |||
| 4967 | // Init structs. | ||
| 4968 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4969 | args.wzBundleId = wzBundleId; | ||
| 4970 | args.recommendedState = *pRequestedState; | ||
| 4971 | |||
| 4972 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 4973 | results.requestedState = *pRequestedState; | ||
| 4974 | |||
| 4975 | // Send args. | ||
| 4976 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 4977 | ExitOnFailure(hr, "Failed to write API version of OnPlanRestoreRelatedBundle args."); | ||
| 4978 | |||
| 4979 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId); | ||
| 4980 | ExitOnFailure(hr, "Failed to write bundle id of OnPlanRestoreRelatedBundle args."); | ||
| 4981 | |||
| 4982 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedState); | ||
| 4983 | ExitOnFailure(hr, "Failed to write recommended state of OnPlanRestoreRelatedBundle args."); | ||
| 4984 | |||
| 4985 | // Send results. | ||
| 4986 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 4987 | ExitOnFailure(hr, "Failed to write API version of OnPlanRestoreRelatedBundle results."); | ||
| 4988 | |||
| 4989 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedState); | ||
| 4990 | ExitOnFailure(hr, "Failed to write requested state of OnPlanRestoreRelatedBundle results."); | ||
| 4991 | |||
| 4992 | // Callback. | ||
| 4993 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, &bufferArgs, &bufferResults, &rpc); | ||
| 4994 | ExitOnFailure(hr, "BA OnPlanRestoreRelatedBundle failed."); | ||
| 4995 | |||
| 4996 | if (S_FALSE == hr) | ||
| 4997 | { | ||
| 4998 | ExitFunction(); | ||
| 4999 | } | ||
| 5000 | |||
| 5001 | // Read results. | ||
| 5002 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5003 | ExitOnFailure(hr, "Failed to read size of OnPlanRestoreRelatedBundle result."); | ||
| 5004 | |||
| 5005 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 5006 | ExitOnFailure(hr, "Failed to read cancel of OnPlanRestoreRelatedBundle result."); | ||
| 5007 | |||
| 5008 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedState)); | ||
| 5009 | ExitOnFailure(hr, "Failed to read requested state of OnPlanRestoreRelatedBundle result."); | ||
| 5010 | |||
| 5011 | if (results.fCancel) | ||
| 5012 | { | ||
| 5013 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 5014 | } | ||
| 5015 | |||
| 5016 | *pRequestedState = results.requestedState; | ||
| 5017 | |||
| 5018 | LExit: | ||
| 5019 | PipeFreeRpcResult(&rpc); | ||
| 5020 | ReleaseBuffer(bufferResults); | ||
| 5021 | ReleaseBuffer(bufferArgs); | ||
| 5022 | |||
| 5023 | return hr; | ||
| 5024 | } | ||
| 5025 | |||
| 5026 | EXTERN_C HRESULT BACallbackOnPlanRollbackBoundary( | ||
| 5027 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5028 | __in_z LPCWSTR wzRollbackBoundaryId, | ||
| 5029 | __inout BOOL* pfTransaction | ||
| 5030 | ) | ||
| 5031 | { | ||
| 5032 | HRESULT hr = S_OK; | ||
| 5033 | BA_ONPLANROLLBACKBOUNDARY_ARGS args = { }; | ||
| 5034 | BA_ONPLANROLLBACKBOUNDARY_RESULTS results = { }; | ||
| 5035 | BUFF_BUFFER bufferArgs = { }; | ||
| 5036 | BUFF_BUFFER bufferResults = { }; | ||
| 5037 | PIPE_RPC_RESULT rpc = { }; | ||
| 5038 | SIZE_T iBuffer = 0; | ||
| 5039 | |||
| 5040 | // Init structs. | ||
| 5041 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5042 | args.wzRollbackBoundaryId = wzRollbackBoundaryId; | ||
| 5043 | args.fRecommendedTransaction = *pfTransaction; | ||
| 5044 | |||
| 5045 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5046 | results.fTransaction = *pfTransaction; | ||
| 5047 | |||
| 5048 | // Send args. | ||
| 5049 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5050 | ExitOnFailure(hr, "Failed to write API version of OnPlanRollbackBoundary args."); | ||
| 5051 | |||
| 5052 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzRollbackBoundaryId); | ||
| 5053 | ExitOnFailure(hr, "Failed to write rollback boundary id of OnPlanRollbackBoundary args."); | ||
| 5054 | |||
| 5055 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.fRecommendedTransaction); | ||
| 5056 | ExitOnFailure(hr, "Failed to write recommended transaction of OnPlanRollbackBoundary args."); | ||
| 5057 | |||
| 5058 | // Send results. | ||
| 5059 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5060 | ExitOnFailure(hr, "Failed to write API version of OnPlanRollbackBoundary results."); | ||
| 5061 | |||
| 5062 | hr = BuffWriteNumberToBuffer(&bufferResults, results.fTransaction); | ||
| 5063 | ExitOnFailure(hr, "Failed to write transaction of OnPlanRollbackBoundary results."); | ||
| 5064 | |||
| 5065 | // Callback. | ||
| 5066 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, &bufferArgs, &bufferResults, &rpc); | ||
| 5067 | ExitOnFailure(hr, "BA OnPlanRollbackBoundary failed."); | ||
| 5068 | |||
| 5069 | if (S_FALSE == hr) | ||
| 5070 | { | ||
| 5071 | ExitFunction(); | ||
| 5072 | } | ||
| 5073 | |||
| 5074 | // Read results. | ||
| 5075 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5076 | ExitOnFailure(hr, "Failed to read size of OnPlanRollbackBoundary result."); | ||
| 5077 | |||
| 5078 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fTransaction)); | ||
| 5079 | ExitOnFailure(hr, "Failed to read transaction of OnPlanRollbackBoundary result."); | ||
| 5080 | |||
| 5081 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 5082 | ExitOnFailure(hr, "Failed to read cancel of OnPlanRollbackBoundary result."); | ||
| 5083 | |||
| 5084 | if (results.fCancel) | ||
| 5085 | { | ||
| 5086 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 5087 | } | ||
| 5088 | |||
| 5089 | *pfTransaction = results.fTransaction; | ||
| 5090 | |||
| 5091 | LExit: | ||
| 5092 | PipeFreeRpcResult(&rpc); | ||
| 5093 | ReleaseBuffer(bufferResults); | ||
| 5094 | ReleaseBuffer(bufferArgs); | ||
| 5095 | |||
| 5096 | return hr; | ||
| 5097 | } | ||
| 5098 | |||
| 5099 | EXTERN_C HRESULT BACallbackOnPlanPatchTarget( | ||
| 5100 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5101 | __in_z LPCWSTR wzPackageId, | ||
| 5102 | __in_z LPCWSTR wzProductCode, | ||
| 5103 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
| 5104 | ) | ||
| 5105 | { | ||
| 5106 | HRESULT hr = S_OK; | ||
| 5107 | BA_ONPLANPATCHTARGET_ARGS args = { }; | ||
| 5108 | BA_ONPLANPATCHTARGET_RESULTS results = { }; | ||
| 5109 | BUFF_BUFFER bufferArgs = { }; | ||
| 5110 | BUFF_BUFFER bufferResults = { }; | ||
| 5111 | PIPE_RPC_RESULT rpc = { }; | ||
| 5112 | SIZE_T iBuffer = 0; | ||
| 5113 | |||
| 5114 | // Init structs. | ||
| 5115 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5116 | args.wzPackageId = wzPackageId; | ||
| 5117 | args.wzProductCode = wzProductCode; | ||
| 5118 | args.recommendedState = *pRequestedState; | ||
| 5119 | |||
| 5120 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5121 | results.requestedState = *pRequestedState; | ||
| 5122 | |||
| 5123 | // Send args. | ||
| 5124 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5125 | ExitOnFailure(hr, "Failed to write API version of OnPlanPatchTarget args."); | ||
| 5126 | |||
| 5127 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageId); | ||
| 5128 | ExitOnFailure(hr, "Failed to write package id of OnPlanPatchTarget args."); | ||
| 5129 | |||
| 5130 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzProductCode); | ||
| 5131 | ExitOnFailure(hr, "Failed to write product code of OnPlanPatchTarget args."); | ||
| 5132 | |||
| 5133 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedState); | ||
| 5134 | ExitOnFailure(hr, "Failed to write recommended state of OnPlanPatchTarget args."); | ||
| 5135 | |||
| 5136 | // Send results. | ||
| 5137 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5138 | ExitOnFailure(hr, "Failed to write API version of OnPlanPatchTarget results."); | ||
| 5139 | |||
| 5140 | hr = BuffWriteNumberToBuffer(&bufferResults, results.requestedState); | ||
| 5141 | ExitOnFailure(hr, "Failed to write requested state of OnPlanPatchTarget results."); | ||
| 5142 | |||
| 5143 | // Callback. | ||
| 5144 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, &bufferArgs, &bufferResults, &rpc); | ||
| 5145 | ExitOnFailure(hr, "BA OnPlanPatchTarget failed."); | ||
| 5146 | |||
| 5147 | if (S_FALSE == hr) | ||
| 5148 | { | ||
| 5149 | ExitFunction(); | ||
| 5150 | } | ||
| 5151 | |||
| 5152 | // Read results. | ||
| 5153 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5154 | ExitOnFailure(hr, "Failed to read size of OnPlanPatchTarget result."); | ||
| 5155 | |||
| 5156 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 5157 | ExitOnFailure(hr, "Failed to read cancel of OnPlanPatchTarget result."); | ||
| 5158 | |||
| 5159 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.requestedState)); | ||
| 5160 | ExitOnFailure(hr, "Failed to read requrested state of OnPlanPatchTarget result."); | ||
| 5161 | |||
| 5162 | if (results.fCancel) | ||
| 5163 | { | ||
| 5164 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 5165 | } | ||
| 5166 | |||
| 5167 | *pRequestedState = results.requestedState; | ||
| 5168 | |||
| 5169 | LExit: | ||
| 5170 | PipeFreeRpcResult(&rpc); | ||
| 5171 | ReleaseBuffer(bufferResults); | ||
| 5172 | ReleaseBuffer(bufferArgs); | ||
| 5173 | |||
| 5174 | return hr; | ||
| 5175 | } | ||
| 5176 | |||
| 5177 | EXTERN_C HRESULT BACallbackOnProgress( | ||
| 5178 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5179 | __in BOOL fRollback, | ||
| 5180 | __in DWORD dwProgressPercentage, | ||
| 5181 | __in DWORD dwOverallPercentage | ||
| 5182 | ) | ||
| 5183 | { | ||
| 5184 | HRESULT hr = S_OK; | ||
| 5185 | BA_ONPROGRESS_ARGS args = { }; | ||
| 5186 | BA_ONPROGRESS_RESULTS results = { }; | ||
| 5187 | BUFF_BUFFER bufferArgs = { }; | ||
| 5188 | BUFF_BUFFER bufferResults = { }; | ||
| 5189 | PIPE_RPC_RESULT rpc = { }; | ||
| 5190 | SIZE_T iBuffer = 0; | ||
| 5191 | |||
| 5192 | // Init structs. | ||
| 5193 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5194 | args.dwProgressPercentage = dwProgressPercentage; | ||
| 5195 | args.dwOverallPercentage = dwOverallPercentage; | ||
| 5196 | |||
| 5197 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5198 | |||
| 5199 | // Send args. | ||
| 5200 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5201 | ExitOnFailure(hr, "Failed to write API version of OnProgress args."); | ||
| 5202 | |||
| 5203 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwProgressPercentage); | ||
| 5204 | ExitOnFailure(hr, "Failed to write progress of OnProgress args."); | ||
| 5205 | |||
| 5206 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallPercentage); | ||
| 5207 | ExitOnFailure(hr, "Failed to write overall progress of OnProgress args."); | ||
| 5208 | |||
| 5209 | // Send results. | ||
| 5210 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5211 | ExitOnFailure(hr, "Failed to write API version of OnProgress results."); | ||
| 5212 | |||
| 5213 | // Callback. | ||
| 5214 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &bufferArgs, &bufferResults, &rpc); | ||
| 5215 | ExitOnFailure(hr, "BA OnProgress failed."); | ||
| 5216 | |||
| 5217 | if (S_FALSE == hr) | ||
| 5218 | { | ||
| 5219 | ExitFunction(); | ||
| 5220 | } | ||
| 5221 | |||
| 5222 | // Read results. | ||
| 5223 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5224 | ExitOnFailure(hr, "Failed to read size of OnProgress result."); | ||
| 5225 | |||
| 5226 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 5227 | ExitOnFailure(hr, "Failed to read cancel of OnProgress result."); | ||
| 5228 | |||
| 5229 | LExit: | ||
| 5230 | hr = FilterExecuteResult(pUserExperience, hr, fRollback, results.fCancel, L"OnProgress"); | ||
| 5231 | |||
| 5232 | PipeFreeRpcResult(&rpc); | ||
| 5233 | ReleaseBuffer(bufferResults); | ||
| 5234 | ReleaseBuffer(bufferArgs); | ||
| 5235 | |||
| 5236 | return hr; | ||
| 5237 | } | ||
| 5238 | |||
| 5239 | EXTERN_C HRESULT BACallbackOnRegisterBegin( | ||
| 5240 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5241 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | ||
| 5242 | ) | ||
| 5243 | { | ||
| 5244 | HRESULT hr = S_OK; | ||
| 5245 | BA_ONREGISTERBEGIN_ARGS args = { }; | ||
| 5246 | BA_ONREGISTERBEGIN_RESULTS results = { }; | ||
| 5247 | BUFF_BUFFER bufferArgs = { }; | ||
| 5248 | BUFF_BUFFER bufferResults = { }; | ||
| 5249 | PIPE_RPC_RESULT rpc = { }; | ||
| 5250 | SIZE_T iBuffer = 0; | ||
| 5251 | |||
| 5252 | // Init structs. | ||
| 5253 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5254 | args.recommendedRegistrationType = *pRegistrationType; | ||
| 5255 | |||
| 5256 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5257 | results.registrationType = *pRegistrationType; | ||
| 5258 | |||
| 5259 | // Send args. | ||
| 5260 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5261 | ExitOnFailure(hr, "Failed to write API version of OnRegisterBegin args."); | ||
| 5262 | |||
| 5263 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedRegistrationType); | ||
| 5264 | ExitOnFailure(hr, "Failed to write recommended registration type of OnRegisterBegin args."); | ||
| 5265 | |||
| 5266 | // Send results. | ||
| 5267 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5268 | ExitOnFailure(hr, "Failed to write API version of OnRegisterBegin results."); | ||
| 5269 | |||
| 5270 | hr = BuffWriteNumberToBuffer(&bufferResults, results.registrationType); | ||
| 5271 | ExitOnFailure(hr, "Failed to write registration type of OnRegisterBegin results."); | ||
| 5272 | |||
| 5273 | // Callback. | ||
| 5274 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 5275 | ExitOnFailure(hr, "BA OnRegisterBegin failed."); | ||
| 5276 | |||
| 5277 | if (S_FALSE == hr) | ||
| 5278 | { | ||
| 5279 | ExitFunction(); | ||
| 5280 | } | ||
| 5281 | |||
| 5282 | // Read results. | ||
| 5283 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5284 | ExitOnFailure(hr, "Failed to read size of OnRegisterBegin result."); | ||
| 5285 | |||
| 5286 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.fCancel)); | ||
| 5287 | ExitOnFailure(hr, "Failed to read cancel of OnRegisterBegin result."); | ||
| 5288 | |||
| 5289 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.registrationType)); | ||
| 5290 | ExitOnFailure(hr, "Failed to read registration type of OnRegisterBegin result."); | ||
| 5291 | |||
| 5292 | if (results.fCancel) | ||
| 5293 | { | ||
| 5294 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 5295 | } | ||
| 5296 | else if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE < results.registrationType && BOOTSTRAPPER_REGISTRATION_TYPE_FULL >= results.registrationType) | ||
| 5297 | { | ||
| 5298 | *pRegistrationType = results.registrationType; | ||
| 5299 | } | ||
| 5300 | |||
| 5301 | LExit: | ||
| 5302 | PipeFreeRpcResult(&rpc); | ||
| 5303 | ReleaseBuffer(bufferResults); | ||
| 5304 | ReleaseBuffer(bufferArgs); | ||
| 5305 | |||
| 5306 | return hr; | ||
| 5307 | } | ||
| 5308 | |||
| 5309 | EXTERN_C HRESULT BACallbackOnRegisterComplete( | ||
| 5310 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5311 | __in HRESULT hrStatus | ||
| 5312 | ) | ||
| 5313 | { | ||
| 5314 | HRESULT hr = S_OK; | ||
| 5315 | BA_ONREGISTERCOMPLETE_ARGS args = { }; | ||
| 5316 | BA_ONREGISTERCOMPLETE_RESULTS results = { }; | ||
| 5317 | BUFF_BUFFER bufferArgs = { }; | ||
| 5318 | BUFF_BUFFER bufferResults = { }; | ||
| 5319 | PIPE_RPC_RESULT rpc = { }; | ||
| 5320 | |||
| 5321 | // Init structs. | ||
| 5322 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5323 | args.hrStatus = hrStatus; | ||
| 5324 | |||
| 5325 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5326 | |||
| 5327 | // Send args. | ||
| 5328 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5329 | ExitOnFailure(hr, "Failed to write API version of OnRegisterComplete args."); | ||
| 5330 | |||
| 5331 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 5332 | ExitOnFailure(hr, "Failed to write status type of OnRegisterComplete args."); | ||
| 5333 | |||
| 5334 | // Send results. | ||
| 5335 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5336 | ExitOnFailure(hr, "Failed to write API version of OnRegisterComplete results."); | ||
| 5337 | |||
| 5338 | // Callback. | ||
| 5339 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 5340 | ExitOnFailure(hr, "BA OnRegisterComplete failed."); | ||
| 5341 | |||
| 5342 | if (S_FALSE == hr) | ||
| 5343 | { | ||
| 5344 | ExitFunction(); | ||
| 5345 | } | ||
| 5346 | |||
| 5347 | LExit: | ||
| 5348 | PipeFreeRpcResult(&rpc); | ||
| 5349 | ReleaseBuffer(bufferResults); | ||
| 5350 | ReleaseBuffer(bufferArgs); | ||
| 5351 | |||
| 5352 | return hr; | ||
| 5353 | } | ||
| 5354 | |||
| 5355 | EXTERN_C HRESULT BACallbackOnRollbackMsiTransactionBegin( | ||
| 5356 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5357 | __in LPCWSTR wzTransactionId | ||
| 5358 | ) | ||
| 5359 | { | ||
| 5360 | HRESULT hr = S_OK; | ||
| 5361 | BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS args = { }; | ||
| 5362 | BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS results = { }; | ||
| 5363 | BUFF_BUFFER bufferArgs = { }; | ||
| 5364 | BUFF_BUFFER bufferResults = { }; | ||
| 5365 | PIPE_RPC_RESULT rpc = { }; | ||
| 5366 | |||
| 5367 | // Init structs. | ||
| 5368 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5369 | args.wzTransactionId = wzTransactionId; | ||
| 5370 | |||
| 5371 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5372 | |||
| 5373 | // Send args. | ||
| 5374 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5375 | ExitOnFailure(hr, "Failed to write API version of OnRollbackMsiTransactionBegin args."); | ||
| 5376 | |||
| 5377 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTransactionId); | ||
| 5378 | ExitOnFailure(hr, "Failed to write transaction id of OnRollbackMsiTransactionBegin args."); | ||
| 5379 | |||
| 5380 | // Send results. | ||
| 5381 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5382 | ExitOnFailure(hr, "Failed to write API version of OnRollbackMsiTransactionBegin results."); | ||
| 5383 | |||
| 5384 | // Callback. | ||
| 5385 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 5386 | ExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed."); | ||
| 5387 | |||
| 5388 | if (S_FALSE == hr) | ||
| 5389 | { | ||
| 5390 | ExitFunction(); | ||
| 5391 | } | ||
| 5392 | |||
| 5393 | LExit: | ||
| 5394 | PipeFreeRpcResult(&rpc); | ||
| 5395 | ReleaseBuffer(bufferResults); | ||
| 5396 | ReleaseBuffer(bufferArgs); | ||
| 5397 | |||
| 5398 | return hr; | ||
| 5399 | } | ||
| 5400 | |||
| 5401 | EXTERN_C HRESULT BACallbackOnRollbackMsiTransactionComplete( | ||
| 5402 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5403 | __in LPCWSTR wzTransactionId, | ||
| 5404 | __in HRESULT hrStatus, | ||
| 5405 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 5406 | __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION *pAction | ||
| 5407 | ) | ||
| 5408 | { | ||
| 5409 | HRESULT hr = S_OK; | ||
| 5410 | BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS args = { }; | ||
| 5411 | BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS results = { }; | ||
| 5412 | BUFF_BUFFER bufferArgs = { }; | ||
| 5413 | BUFF_BUFFER bufferResults = { }; | ||
| 5414 | PIPE_RPC_RESULT rpc = { }; | ||
| 5415 | SIZE_T iBuffer = 0; | ||
| 5416 | |||
| 5417 | // Init structs. | ||
| 5418 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5419 | args.wzTransactionId = wzTransactionId; | ||
| 5420 | args.hrStatus = hrStatus; | ||
| 5421 | args.restart = restart; | ||
| 5422 | args.recommendation = *pAction; | ||
| 5423 | |||
| 5424 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5425 | results.action = *pAction; | ||
| 5426 | |||
| 5427 | // Send args. | ||
| 5428 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5429 | ExitOnFailure(hr, "Failed to write API version of OnRollbackMsiTransactionComplete args."); | ||
| 5430 | |||
| 5431 | hr = BuffWriteStringToBuffer(&bufferArgs, args.wzTransactionId); | ||
| 5432 | ExitOnFailure(hr, "Failed to write transaction id of OnRollbackMsiTransactionComplete args."); | ||
| 5433 | |||
| 5434 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 5435 | ExitOnFailure(hr, "Failed to write status type of OnRollbackMsiTransactionComplete args."); | ||
| 5436 | |||
| 5437 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.restart); | ||
| 5438 | ExitOnFailure(hr, "Failed to write restart of OnRollbackMsiTransactionComplete args."); | ||
| 5439 | |||
| 5440 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendation); | ||
| 5441 | ExitOnFailure(hr, "Failed to write recommedation of OnRollbackMsiTransactionComplete args."); | ||
| 5442 | |||
| 5443 | // Send results. | ||
| 5444 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5445 | ExitOnFailure(hr, "Failed to write API version of OnRollbackMsiTransactionComplete results."); | ||
| 5446 | |||
| 5447 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 5448 | ExitOnFailure(hr, "Failed to write action of OnRollbackMsiTransactionComplete results."); | ||
| 5449 | |||
| 5450 | // Callback. | ||
| 5451 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 5452 | ExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed."); | ||
| 5453 | |||
| 5454 | if (S_FALSE == hr) | ||
| 5455 | { | ||
| 5456 | ExitFunction(); | ||
| 5457 | } | ||
| 5458 | |||
| 5459 | // Read results. | ||
| 5460 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5461 | ExitOnFailure(hr, "Failed to read size of OnRollbackMsiTransactionComplete result."); | ||
| 5462 | |||
| 5463 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 5464 | ExitOnFailure(hr, "Failed to read cancel of OnRollbackMsiTransactionComplete result."); | ||
| 5465 | |||
| 5466 | *pAction = results.action; | ||
| 5467 | |||
| 5468 | LExit: | ||
| 5469 | PipeFreeRpcResult(&rpc); | ||
| 5470 | ReleaseBuffer(bufferResults); | ||
| 5471 | ReleaseBuffer(bufferArgs); | ||
| 5472 | |||
| 5473 | return hr; | ||
| 5474 | } | ||
| 5475 | |||
| 5476 | EXTERN_C HRESULT BACallbackOnShutdown( | ||
| 5477 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5478 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction | ||
| 5479 | ) | ||
| 5480 | { | ||
| 5481 | HRESULT hr = S_OK; | ||
| 5482 | BA_ONSHUTDOWN_ARGS args = { sizeof(args) }; | ||
| 5483 | BA_ONSHUTDOWN_RESULTS results = { sizeof(results) }; | ||
| 5484 | BUFF_BUFFER bufferArgs = { }; | ||
| 5485 | BUFF_BUFFER bufferResults = { }; | ||
| 5486 | PIPE_RPC_RESULT rpc = { }; | ||
| 5487 | SIZE_T iBuffer = 0; | ||
| 5488 | |||
| 5489 | // Init structs. | ||
| 5490 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5491 | |||
| 5492 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5493 | results.action = *pAction; | ||
| 5494 | |||
| 5495 | // Send args. | ||
| 5496 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5497 | ExitOnFailure(hr, "Failed to write API version of OnShutdown args."); | ||
| 5498 | |||
| 5499 | // Send results. | ||
| 5500 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5501 | ExitOnFailure(hr, "Failed to write API version of OnShutdown results."); | ||
| 5502 | |||
| 5503 | hr = BuffWriteNumberToBuffer(&bufferResults, results.action); | ||
| 5504 | ExitOnFailure(hr, "Failed to write action of OnShutdown results."); | ||
| 5505 | |||
| 5506 | // Callback. | ||
| 5507 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &bufferArgs, &bufferResults, &rpc); | ||
| 5508 | ExitOnFailure(hr, "BA OnShutdown failed."); | ||
| 5509 | |||
| 5510 | if (S_FALSE == hr) | ||
| 5511 | { | ||
| 5512 | ExitFunction(); | ||
| 5513 | } | ||
| 5514 | |||
| 5515 | // Read results. | ||
| 5516 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5517 | ExitOnFailure(hr, "Failed to read size of OnShutdown result."); | ||
| 5518 | |||
| 5519 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.action)); | ||
| 5520 | ExitOnFailure(hr, "Failed to read result action of OnShutdown result."); | ||
| 5521 | |||
| 5522 | *pAction = results.action; | ||
| 5523 | |||
| 5524 | LExit: | ||
| 5525 | PipeFreeRpcResult(&rpc); | ||
| 5526 | ReleaseBuffer(bufferResults); | ||
| 5527 | ReleaseBuffer(bufferArgs); | ||
| 5528 | |||
| 5529 | return hr; | ||
| 5530 | } | ||
| 5531 | |||
| 5532 | EXTERN_C HRESULT BACallbackOnStartup( | ||
| 5533 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 5534 | ) | ||
| 5535 | { | ||
| 5536 | HRESULT hr = S_OK; | ||
| 5537 | BA_ONSTARTUP_ARGS args = { }; | ||
| 5538 | BA_ONSTARTUP_RESULTS results = { }; | ||
| 5539 | BUFF_BUFFER bufferArgs = { }; | ||
| 5540 | BUFF_BUFFER bufferResults = { }; | ||
| 5541 | PIPE_RPC_RESULT rpc = { }; | ||
| 5542 | |||
| 5543 | // Init structs. | ||
| 5544 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5545 | |||
| 5546 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5547 | |||
| 5548 | // Send args. | ||
| 5549 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5550 | ExitOnFailure(hr, "Failed to write API version of OnStartup args."); | ||
| 5551 | |||
| 5552 | // Send results. | ||
| 5553 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5554 | ExitOnFailure(hr, "Failed to write API version of OnStartup results."); | ||
| 5555 | |||
| 5556 | // Callback. | ||
| 5557 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &bufferArgs, &bufferResults, &rpc); | ||
| 5558 | ExitOnFailure(hr, "BA OnStartup failed."); | ||
| 5559 | |||
| 5560 | if (S_FALSE == hr) | ||
| 5561 | { | ||
| 5562 | ExitFunction(); | ||
| 5563 | } | ||
| 5564 | |||
| 5565 | LExit: | ||
| 5566 | PipeFreeRpcResult(&rpc); | ||
| 5567 | ReleaseBuffer(bufferResults); | ||
| 5568 | ReleaseBuffer(bufferArgs); | ||
| 5569 | |||
| 5570 | return hr; | ||
| 5571 | } | ||
| 5572 | |||
| 5573 | EXTERN_C HRESULT BACallbackOnSystemRestorePointBegin( | ||
| 5574 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 5575 | ) | ||
| 5576 | { | ||
| 5577 | HRESULT hr = S_OK; | ||
| 5578 | BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS args = { }; | ||
| 5579 | BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS results = { }; | ||
| 5580 | BUFF_BUFFER bufferArgs = { }; | ||
| 5581 | BUFF_BUFFER bufferResults = { }; | ||
| 5582 | PIPE_RPC_RESULT rpc = { }; | ||
| 5583 | |||
| 5584 | // Init structs. | ||
| 5585 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5586 | |||
| 5587 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5588 | |||
| 5589 | // Send args. | ||
| 5590 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5591 | ExitOnFailure(hr, "Failed to write API version of OnSystemRestorePointBegin args."); | ||
| 5592 | |||
| 5593 | // Send results. | ||
| 5594 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5595 | ExitOnFailure(hr, "Failed to write API version of OnSystemRestorePointBegin results."); | ||
| 5596 | |||
| 5597 | // Callback. | ||
| 5598 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 5599 | ExitOnFailure(hr, "BA OnSystemRestorePointBegin failed."); | ||
| 5600 | |||
| 5601 | if (S_FALSE == hr) | ||
| 5602 | { | ||
| 5603 | ExitFunction(); | ||
| 5604 | } | ||
| 5605 | |||
| 5606 | LExit: | ||
| 5607 | PipeFreeRpcResult(&rpc); | ||
| 5608 | ReleaseBuffer(bufferResults); | ||
| 5609 | ReleaseBuffer(bufferArgs); | ||
| 5610 | |||
| 5611 | return hr; | ||
| 5612 | } | ||
| 5613 | |||
| 5614 | EXTERN_C HRESULT BACallbackOnSystemRestorePointComplete( | ||
| 5615 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5616 | __in HRESULT hrStatus | ||
| 5617 | ) | ||
| 5618 | { | ||
| 5619 | HRESULT hr = S_OK; | ||
| 5620 | BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS args = { }; | ||
| 5621 | BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS results = { }; | ||
| 5622 | BUFF_BUFFER bufferArgs = { }; | ||
| 5623 | BUFF_BUFFER bufferResults = { }; | ||
| 5624 | PIPE_RPC_RESULT rpc = { }; | ||
| 5625 | |||
| 5626 | // Init structs. | ||
| 5627 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5628 | args.hrStatus = hrStatus; | ||
| 5629 | |||
| 5630 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5631 | |||
| 5632 | // Send args. | ||
| 5633 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5634 | ExitOnFailure(hr, "Failed to write API version of OnSystemRestorePointComplete args."); | ||
| 5635 | |||
| 5636 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 5637 | ExitOnFailure(hr, "Failed to write status of OnSystemRestorePointComplete args."); | ||
| 5638 | |||
| 5639 | // Send results. | ||
| 5640 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5641 | ExitOnFailure(hr, "Failed to write API version of OnSystemRestorePointComplete results."); | ||
| 5642 | |||
| 5643 | // Callback. | ||
| 5644 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 5645 | ExitOnFailure(hr, "BA OnSystemRestorePointComplete failed."); | ||
| 5646 | |||
| 5647 | if (S_FALSE == hr) | ||
| 5648 | { | ||
| 5649 | ExitFunction(); | ||
| 5650 | } | ||
| 5651 | |||
| 5652 | LExit: | ||
| 5653 | PipeFreeRpcResult(&rpc); | ||
| 5654 | ReleaseBuffer(bufferResults); | ||
| 5655 | ReleaseBuffer(bufferArgs); | ||
| 5656 | |||
| 5657 | return hr; | ||
| 5658 | } | ||
| 5659 | |||
| 5660 | EXTERN_C HRESULT BACallbackOnUnregisterBegin( | ||
| 5661 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5662 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | ||
| 5663 | ) | ||
| 5664 | { | ||
| 5665 | HRESULT hr = S_OK; | ||
| 5666 | BA_ONUNREGISTERBEGIN_ARGS args = { }; | ||
| 5667 | BA_ONUNREGISTERBEGIN_RESULTS results = { }; | ||
| 5668 | BUFF_BUFFER bufferArgs = { }; | ||
| 5669 | BUFF_BUFFER bufferResults = { }; | ||
| 5670 | PIPE_RPC_RESULT rpc = { }; | ||
| 5671 | SIZE_T iBuffer = 0; | ||
| 5672 | |||
| 5673 | // Init structs. | ||
| 5674 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5675 | args.recommendedRegistrationType = *pRegistrationType; | ||
| 5676 | |||
| 5677 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5678 | results.registrationType = *pRegistrationType; | ||
| 5679 | |||
| 5680 | // Send args. | ||
| 5681 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5682 | ExitOnFailure(hr, "Failed to write API version of OnUnregisterBegin args."); | ||
| 5683 | |||
| 5684 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.recommendedRegistrationType); | ||
| 5685 | ExitOnFailure(hr, "Failed to write recommended registration type of OnUnregisterBegin args."); | ||
| 5686 | |||
| 5687 | // Send results. | ||
| 5688 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5689 | ExitOnFailure(hr, "Failed to write API version of OnUnregisterBegin results."); | ||
| 5690 | |||
| 5691 | hr = BuffWriteNumberToBuffer(&bufferResults, results.registrationType); | ||
| 5692 | ExitOnFailure(hr, "Failed to write registration type of OnUnregisterBegin results."); | ||
| 5693 | |||
| 5694 | // Callback. | ||
| 5695 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &bufferArgs, &bufferResults, &rpc); | ||
| 5696 | ExitOnFailure(hr, "BA OnUnregisterBegin failed."); | ||
| 5697 | |||
| 5698 | if (S_FALSE == hr) | ||
| 5699 | { | ||
| 5700 | ExitFunction(); | ||
| 5701 | } | ||
| 5702 | |||
| 5703 | // Read results. | ||
| 5704 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion); | ||
| 5705 | ExitOnFailure(hr, "Failed to read size of OnUnregisterBegin result."); | ||
| 5706 | |||
| 5707 | hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.registrationType)); | ||
| 5708 | ExitOnFailure(hr, "Failed to read registration type of OnUnregisterBegin result."); | ||
| 5709 | |||
| 5710 | if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE < results.registrationType && BOOTSTRAPPER_REGISTRATION_TYPE_FULL >= results.registrationType) | ||
| 5711 | { | ||
| 5712 | *pRegistrationType = results.registrationType; | ||
| 5713 | } | ||
| 5714 | |||
| 5715 | LExit: | ||
| 5716 | PipeFreeRpcResult(&rpc); | ||
| 5717 | ReleaseBuffer(bufferResults); | ||
| 5718 | ReleaseBuffer(bufferArgs); | ||
| 5719 | |||
| 5720 | return hr; | ||
| 5721 | } | ||
| 5722 | |||
| 5723 | EXTERN_C HRESULT BACallbackOnUnregisterComplete( | ||
| 5724 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5725 | __in HRESULT hrStatus | ||
| 5726 | ) | ||
| 5727 | { | ||
| 5728 | HRESULT hr = S_OK; | ||
| 5729 | BA_ONUNREGISTERCOMPLETE_ARGS args = { }; | ||
| 5730 | BA_ONUNREGISTERCOMPLETE_RESULTS results = { }; | ||
| 5731 | BUFF_BUFFER bufferArgs = { }; | ||
| 5732 | BUFF_BUFFER bufferResults = { }; | ||
| 5733 | PIPE_RPC_RESULT rpc = { }; | ||
| 5734 | |||
| 5735 | // Init structs. | ||
| 5736 | args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5737 | args.hrStatus = hrStatus; | ||
| 5738 | |||
| 5739 | results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION; | ||
| 5740 | |||
| 5741 | // Send args. | ||
| 5742 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion); | ||
| 5743 | ExitOnFailure(hr, "Failed to write API version of OnUnregisterComplete args."); | ||
| 5744 | |||
| 5745 | hr = BuffWriteNumberToBuffer(&bufferArgs, args.hrStatus); | ||
| 5746 | ExitOnFailure(hr, "Failed to write status of OnUnregisterComplete args."); | ||
| 5747 | |||
| 5748 | // Send results. | ||
| 5749 | hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion); | ||
| 5750 | ExitOnFailure(hr, "Failed to write API version of OnUnregisterComplete results."); | ||
| 5751 | |||
| 5752 | // Callback. | ||
| 5753 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &bufferArgs, &bufferResults, &rpc); | ||
| 5754 | ExitOnFailure(hr, "BA OnUnregisterComplete failed."); | ||
| 5755 | |||
| 5756 | if (S_FALSE == hr) | ||
| 5757 | { | ||
| 5758 | ExitFunction(); | ||
| 5759 | } | ||
| 5760 | |||
| 5761 | LExit: | ||
| 5762 | PipeFreeRpcResult(&rpc); | ||
| 5763 | ReleaseBuffer(bufferResults); | ||
| 5764 | ReleaseBuffer(bufferArgs); | ||
| 5765 | |||
| 5766 | return hr; | ||
| 5767 | } | ||
| 5768 | |||
| 5769 | // internal functions | ||
| 5770 | |||
| 5771 | // This filters the BA's responses to events during apply. | ||
| 5772 | // If an apply thread failed, then return its error so this thread will bail out. | ||
| 5773 | // During rollback, the BA can't cancel. | ||
| 5774 | static HRESULT FilterExecuteResult( | ||
| 5775 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5776 | __in HRESULT hrStatus, | ||
| 5777 | __in BOOL fRollback, | ||
| 5778 | __in BOOL fCancel, | ||
| 5779 | __in LPCWSTR sczEventName | ||
| 5780 | ) | ||
| 5781 | { | ||
| 5782 | HRESULT hr = hrStatus; | ||
| 5783 | HRESULT hrApplyError = pUserExperience->hrApplyError; // make sure to use the same value for the whole method, since it can be changed in other threads. | ||
| 5784 | |||
| 5785 | // If we failed return that error unless this is rollback which should roll on. | ||
| 5786 | if (FAILED(hrApplyError) && !fRollback) | ||
| 5787 | { | ||
| 5788 | hr = hrApplyError; | ||
| 5789 | } | ||
| 5790 | else if (fRollback) | ||
| 5791 | { | ||
| 5792 | if (fCancel) | ||
| 5793 | { | ||
| 5794 | LogId(REPORT_STANDARD, MSG_APPLY_CANCEL_IGNORED_DURING_ROLLBACK, sczEventName); | ||
| 5795 | } | ||
| 5796 | // TODO: since cancel isn't allowed, should the BA's HRESULT be ignored as well? | ||
| 5797 | // In the previous code, they could still alter rollback by returning IDERROR. | ||
| 5798 | } | ||
| 5799 | else | ||
| 5800 | { | ||
| 5801 | ExitOnFailure(hr, "BA %ls failed.", sczEventName); | ||
| 5802 | |||
| 5803 | if (fCancel) | ||
| 5804 | { | ||
| 5805 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
| 5806 | } | ||
| 5807 | } | ||
| 5808 | |||
| 5809 | LExit: | ||
| 5810 | return hr; | ||
| 5811 | } | ||
| 5812 | |||
| 5813 | static HRESULT SendBAMessage( | ||
| 5814 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5815 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
| 5816 | __in BUFF_BUFFER* pBufferArgs, | ||
| 5817 | __in BUFF_BUFFER* pBufferResults, | ||
| 5818 | __in PIPE_RPC_RESULT* pResult | ||
| 5819 | ) | ||
| 5820 | { | ||
| 5821 | HRESULT hr = S_OK; | ||
| 5822 | BUFF_BUFFER buffer = { }; | ||
| 5823 | |||
| 5824 | if (PipeRpcInitialized(&pUserExperience->hBARpcPipe)) | ||
| 5825 | { | ||
| 5826 | // Send the combined counted args and results buffer to the BA. | ||
| 5827 | hr = CombineArgsAndResults(pBufferArgs, pBufferResults, &buffer); | ||
| 5828 | if (SUCCEEDED(hr)) | ||
| 5829 | { | ||
| 5830 | hr = PipeRpcRequest(&pUserExperience->hBARpcPipe, message, buffer.pbData, buffer.cbData, pResult); | ||
| 5831 | } | ||
| 5832 | } | ||
| 5833 | else | ||
| 5834 | { | ||
| 5835 | hr = S_FALSE; | ||
| 5836 | } | ||
| 5837 | |||
| 5838 | ReleaseBuffer(buffer); | ||
| 5839 | return hr; | ||
| 5840 | } | ||
| 5841 | |||
| 5842 | static HRESULT SendBAMessageFromInactiveEngine( | ||
| 5843 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 5844 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
| 5845 | __in BUFF_BUFFER* pBufferArgs, | ||
| 5846 | __in BUFF_BUFFER* pBufferResults, | ||
| 5847 | __in PIPE_RPC_RESULT* pResult | ||
| 5848 | ) | ||
| 5849 | { | ||
| 5850 | HRESULT hr = S_OK; | ||
| 5851 | BUFF_BUFFER buffer = { }; | ||
| 5852 | |||
| 5853 | if (PipeRpcInitialized(&pUserExperience->hBARpcPipe)) | ||
| 5854 | { | ||
| 5855 | BootstrapperApplicationDeactivateEngine(pUserExperience); | ||
| 5856 | |||
| 5857 | // Send the combined counted args and results buffer to the BA. | ||
| 5858 | hr = CombineArgsAndResults(pBufferArgs, pBufferResults, &buffer); | ||
| 5859 | if (SUCCEEDED(hr)) | ||
| 5860 | { | ||
| 5861 | hr = PipeRpcRequest(&pUserExperience->hBARpcPipe, message, buffer.pbData, buffer.cbData, pResult); | ||
| 5862 | } | ||
| 5863 | |||
| 5864 | BootstrapperApplicationActivateEngine(pUserExperience); | ||
| 5865 | } | ||
| 5866 | else | ||
| 5867 | { | ||
| 5868 | hr = S_FALSE; | ||
| 5869 | } | ||
| 5870 | |||
| 5871 | ReleaseBuffer(buffer); | ||
| 5872 | return hr; | ||
| 5873 | } | ||
| 5874 | |||
| 5875 | static HRESULT CombineArgsAndResults( | ||
| 5876 | __in BUFF_BUFFER* pBufferArgs, | ||
| 5877 | __in BUFF_BUFFER* pBufferResults, | ||
| 5878 | __in BUFF_BUFFER* pBufferCombined | ||
| 5879 | ) | ||
| 5880 | { | ||
| 5881 | HRESULT hr = S_OK; | ||
| 5882 | |||
| 5883 | // Write args to buffer. | ||
| 5884 | hr = BuffWriteStreamToBuffer(pBufferCombined, pBufferArgs->pbData, pBufferArgs->cbData); | ||
| 5885 | ExitOnFailure(hr, "Failed to write args buffer."); | ||
| 5886 | |||
| 5887 | // Write results to buffer. | ||
| 5888 | hr = BuffWriteStreamToBuffer(pBufferCombined, pBufferResults->pbData, pBufferResults->cbData); | ||
| 5889 | ExitOnFailure(hr, "Failed to write results buffer."); | ||
| 5890 | |||
| 5891 | LExit: | ||
| 5892 | return hr; | ||
| 5893 | } | ||
diff --git a/src/burn/engine/bacallback.h b/src/burn/engine/bacallback.h new file mode 100644 index 00000000..8d1f41c4 --- /dev/null +++ b/src/burn/engine/bacallback.h | |||
| @@ -0,0 +1,520 @@ | |||
| 1 | #pragma once | ||
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 3 | |||
| 4 | |||
| 5 | #if defined(__cplusplus) | ||
| 6 | extern "C" { | ||
| 7 | #endif | ||
| 8 | |||
| 9 | // structs | ||
| 10 | |||
| 11 | |||
| 12 | // function declarations | ||
| 13 | |||
| 14 | HRESULT BACallbackOnApplyBegin( | ||
| 15 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 16 | __in DWORD dwPhaseCount | ||
| 17 | ); | ||
| 18 | HRESULT BACallbackOnApplyComplete( | ||
| 19 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 20 | __in HRESULT hrStatus, | ||
| 21 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 22 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction | ||
| 23 | ); | ||
| 24 | HRESULT BACallbackOnApplyDowngrade( | ||
| 25 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 26 | __inout HRESULT* phrStatus | ||
| 27 | ); | ||
| 28 | HRESULT BACallbackOnBeginMsiTransactionBegin( | ||
| 29 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 30 | __in LPCWSTR wzTransactionId | ||
| 31 | ); | ||
| 32 | HRESULT BACallbackOnBeginMsiTransactionComplete( | ||
| 33 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 34 | __in LPCWSTR wzTransactionId, | ||
| 35 | __in HRESULT hrStatus | ||
| 36 | ); | ||
| 37 | HRESULT BACallbackOnCacheAcquireBegin( | ||
| 38 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 39 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 40 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 41 | __in_z LPWSTR* pwzSource, | ||
| 42 | __in_z LPWSTR* pwzDownloadUrl, | ||
| 43 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
| 44 | __out BOOTSTRAPPER_CACHE_OPERATION* pCacheOperation | ||
| 45 | ); | ||
| 46 | HRESULT BACallbackOnCacheAcquireComplete( | ||
| 47 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 48 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 49 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 50 | __in HRESULT hrStatus, | ||
| 51 | __inout BOOL* pfRetry | ||
| 52 | ); | ||
| 53 | HRESULT BACallbackOnCacheAcquireProgress( | ||
| 54 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 55 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 56 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 57 | __in DWORD64 dw64Progress, | ||
| 58 | __in DWORD64 dw64Total, | ||
| 59 | __in DWORD dwOverallPercentage | ||
| 60 | ); | ||
| 61 | HRESULT BACallbackOnCacheAcquireResolving( | ||
| 62 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 63 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 64 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 65 | __in_z LPWSTR* rgSearchPaths, | ||
| 66 | __in DWORD cSearchPaths, | ||
| 67 | __in BOOL fFoundLocal, | ||
| 68 | __in DWORD* pdwChosenSearchPath, | ||
| 69 | __in_z_opt LPWSTR* pwzDownloadUrl, | ||
| 70 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
| 71 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pCacheOperation | ||
| 72 | ); | ||
| 73 | HRESULT BACallbackOnCacheBegin( | ||
| 74 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 75 | ); | ||
| 76 | HRESULT BACallbackOnCacheComplete( | ||
| 77 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 78 | __in HRESULT hrStatus | ||
| 79 | ); | ||
| 80 | HRESULT BACallbackOnCacheContainerOrPayloadVerifyBegin( | ||
| 81 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 82 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 83 | __in_z_opt LPCWSTR wzPayloadId | ||
| 84 | ); | ||
| 85 | HRESULT BACallbackOnCacheContainerOrPayloadVerifyComplete( | ||
| 86 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 87 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 88 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 89 | __in HRESULT hrStatus | ||
| 90 | ); | ||
| 91 | HRESULT BACallbackOnCacheContainerOrPayloadVerifyProgress( | ||
| 92 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 93 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 94 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 95 | __in DWORD64 dw64Progress, | ||
| 96 | __in DWORD64 dw64Total, | ||
| 97 | __in DWORD dwOverallPercentage | ||
| 98 | ); | ||
| 99 | HRESULT BACallbackOnCachePackageBegin( | ||
| 100 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 101 | __in_z LPCWSTR wzPackageId, | ||
| 102 | __in DWORD cCachePayloads, | ||
| 103 | __in DWORD64 dw64PackageCacheSize, | ||
| 104 | __in BOOL fVital | ||
| 105 | ); | ||
| 106 | HRESULT BACallbackOnCachePackageNonVitalValidationFailure( | ||
| 107 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 108 | __in_z LPCWSTR wzPackageId, | ||
| 109 | __in HRESULT hrStatus, | ||
| 110 | __inout BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION* pAction | ||
| 111 | ); | ||
| 112 | HRESULT BACallbackOnCachePackageComplete( | ||
| 113 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 114 | __in_z LPCWSTR wzPackageId, | ||
| 115 | __in HRESULT hrStatus, | ||
| 116 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction | ||
| 117 | ); | ||
| 118 | HRESULT BACallbackOnCachePayloadExtractBegin( | ||
| 119 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 120 | __in_z_opt LPCWSTR wzContainerId, | ||
| 121 | __in_z_opt LPCWSTR wzPayloadId | ||
| 122 | ); | ||
| 123 | HRESULT BACallbackOnCachePayloadExtractComplete( | ||
| 124 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 125 | __in_z_opt LPCWSTR wzContainerId, | ||
| 126 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 127 | __in HRESULT hrStatus | ||
| 128 | ); | ||
| 129 | HRESULT BACallbackOnCachePayloadExtractProgress( | ||
| 130 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 131 | __in_z_opt LPCWSTR wzContainerId, | ||
| 132 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 133 | __in DWORD64 dw64Progress, | ||
| 134 | __in DWORD64 dw64Total, | ||
| 135 | __in DWORD dwOverallPercentage | ||
| 136 | ); | ||
| 137 | HRESULT BACallbackOnCacheVerifyBegin( | ||
| 138 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 139 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 140 | __in_z_opt LPCWSTR wzPayloadId | ||
| 141 | ); | ||
| 142 | HRESULT BACallbackOnCacheVerifyComplete( | ||
| 143 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 144 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 145 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 146 | __in HRESULT hrStatus, | ||
| 147 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction | ||
| 148 | ); | ||
| 149 | HRESULT BACallbackOnCacheVerifyProgress( | ||
| 150 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 151 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
| 152 | __in_z_opt LPCWSTR wzPayloadId, | ||
| 153 | __in DWORD64 dw64Progress, | ||
| 154 | __in DWORD64 dw64Total, | ||
| 155 | __in DWORD dwOverallPercentage, | ||
| 156 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep | ||
| 157 | ); | ||
| 158 | HRESULT BACallbackOnCommitMsiTransactionBegin( | ||
| 159 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 160 | __in LPCWSTR wzTransactionId | ||
| 161 | ); | ||
| 162 | HRESULT BACallbackOnCommitMsiTransactionComplete( | ||
| 163 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 164 | __in LPCWSTR wzTransactionId, | ||
| 165 | __in HRESULT hrStatus, | ||
| 166 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 167 | __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION* pAction | ||
| 168 | ); | ||
| 169 | HRESULT BACallbackOnCreate( | ||
| 170 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 171 | __in BOOTSTRAPPER_COMMAND* pCommand | ||
| 172 | ); | ||
| 173 | HRESULT BACallbackOnDestroy( | ||
| 174 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 175 | __in BOOL fReload | ||
| 176 | ); | ||
| 177 | HRESULT BACallbackOnDetectBegin( | ||
| 178 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 179 | __in BOOL fCached, | ||
| 180 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, | ||
| 181 | __in DWORD cPackages | ||
| 182 | ); | ||
| 183 | HRESULT BACallbackOnDetectCompatibleMsiPackage( | ||
| 184 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 185 | __in_z LPCWSTR wzPackageId, | ||
| 186 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 187 | __in VERUTIL_VERSION* pCompatiblePackageVersion | ||
| 188 | ); | ||
| 189 | HRESULT BACallbackOnDetectComplete( | ||
| 190 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 191 | __in HRESULT hrStatus, | ||
| 192 | __in BOOL fEligibleForCleanup | ||
| 193 | ); | ||
| 194 | HRESULT BACallbackOnDetectForwardCompatibleBundle( | ||
| 195 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 196 | __in_z LPCWSTR wzBundleId, | ||
| 197 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 198 | __in_z LPCWSTR wzBundleTag, | ||
| 199 | __in BOOL fPerMachine, | ||
| 200 | __in VERUTIL_VERSION* pVersion, | ||
| 201 | __in BOOL fMissingFromCache | ||
| 202 | ); | ||
| 203 | HRESULT BACallbackOnDetectMsiFeature( | ||
| 204 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 205 | __in_z LPCWSTR wzPackageId, | ||
| 206 | __in_z LPCWSTR wzFeatureId, | ||
| 207 | __in BOOTSTRAPPER_FEATURE_STATE state | ||
| 208 | ); | ||
| 209 | HRESULT BACallbackOnDetectPackageBegin( | ||
| 210 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 211 | __in_z LPCWSTR wzPackageId | ||
| 212 | ); | ||
| 213 | HRESULT BACallbackOnDetectPackageComplete( | ||
| 214 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 215 | __in_z LPCWSTR wzPackageId, | ||
| 216 | __in HRESULT hrStatus, | ||
| 217 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
| 218 | __in BOOL fCached | ||
| 219 | ); | ||
| 220 | HRESULT BACallbackOnDetectRelatedBundle( | ||
| 221 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 222 | __in_z LPCWSTR wzBundleId, | ||
| 223 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 224 | __in_z LPCWSTR wzBundleTag, | ||
| 225 | __in BOOL fPerMachine, | ||
| 226 | __in VERUTIL_VERSION* pVersion, | ||
| 227 | __in BOOL fMissingFromCache | ||
| 228 | ); | ||
| 229 | HRESULT BACallbackOnDetectRelatedBundlePackage( | ||
| 230 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 231 | __in_z LPCWSTR wzPackageId, | ||
| 232 | __in_z LPCWSTR wzBundleId, | ||
| 233 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 234 | __in BOOL fPerMachine, | ||
| 235 | __in VERUTIL_VERSION* pVersion | ||
| 236 | ); | ||
| 237 | HRESULT BACallbackOnDetectRelatedMsiPackage( | ||
| 238 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 239 | __in_z LPCWSTR wzPackageId, | ||
| 240 | __in_z LPCWSTR wzUpgradeCode, | ||
| 241 | __in_z LPCWSTR wzProductCode, | ||
| 242 | __in BOOL fPerMachine, | ||
| 243 | __in VERUTIL_VERSION* pVersion, | ||
| 244 | __in BOOTSTRAPPER_RELATED_OPERATION operation | ||
| 245 | ); | ||
| 246 | HRESULT BACallbackOnDetectPatchTarget( | ||
| 247 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 248 | __in_z LPCWSTR wzPackageId, | ||
| 249 | __in_z LPCWSTR wzProductCode, | ||
| 250 | __in BOOTSTRAPPER_PACKAGE_STATE patchState | ||
| 251 | ); | ||
| 252 | HRESULT BACallbackOnDetectUpdate( | ||
| 253 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 254 | __in_z_opt LPCWSTR wzUpdateLocation, | ||
| 255 | __in DWORD64 dw64Size, | ||
| 256 | __in_z_opt LPCWSTR wzHash, | ||
| 257 | __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm, | ||
| 258 | __in VERUTIL_VERSION* pVersion, | ||
| 259 | __in_z_opt LPCWSTR wzTitle, | ||
| 260 | __in_z_opt LPCWSTR wzSummary, | ||
| 261 | __in_z_opt LPCWSTR wzContentType, | ||
| 262 | __in_z_opt LPCWSTR wzContent, | ||
| 263 | __inout BOOL* pfStopProcessingUpdates | ||
| 264 | ); | ||
| 265 | HRESULT BACallbackOnDetectUpdateBegin( | ||
| 266 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 267 | __in_z LPCWSTR wzUpdateLocation, | ||
| 268 | __inout BOOL* pfSkip | ||
| 269 | ); | ||
| 270 | HRESULT BACallbackOnDetectUpdateComplete( | ||
| 271 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 272 | __in HRESULT hrStatus, | ||
| 273 | __inout BOOL* pfIgnoreError | ||
| 274 | ); | ||
| 275 | HRESULT BACallbackOnElevateBegin( | ||
| 276 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 277 | ); | ||
| 278 | HRESULT BACallbackOnElevateComplete( | ||
| 279 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 280 | __in HRESULT hrStatus | ||
| 281 | ); | ||
| 282 | HRESULT BACallbackOnError( | ||
| 283 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 284 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
| 285 | __in_z_opt LPCWSTR wzPackageId, | ||
| 286 | __in DWORD dwCode, | ||
| 287 | __in_z_opt LPCWSTR wzError, | ||
| 288 | __in DWORD dwUIHint, | ||
| 289 | __in DWORD cData, | ||
| 290 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
| 291 | __inout int* pnResult | ||
| 292 | ); | ||
| 293 | HRESULT BACallbackOnExecuteBegin( | ||
| 294 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 295 | __in DWORD cExecutingPackages | ||
| 296 | ); | ||
| 297 | HRESULT BACallbackOnExecuteComplete( | ||
| 298 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 299 | __in HRESULT hrStatus | ||
| 300 | ); | ||
| 301 | HRESULT BACallbackOnExecuteFilesInUse( | ||
| 302 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 303 | __in_z LPCWSTR wzPackageId, | ||
| 304 | __in DWORD cFiles, | ||
| 305 | __in_ecount_z_opt(cFiles) LPCWSTR* rgwzFiles, | ||
| 306 | __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, | ||
| 307 | __inout int* pnResult | ||
| 308 | ); | ||
| 309 | HRESULT BACallbackOnExecuteMsiMessage( | ||
| 310 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 311 | __in_z LPCWSTR wzPackageId, | ||
| 312 | __in INSTALLMESSAGE messageType, | ||
| 313 | __in DWORD dwUIHint, | ||
| 314 | __in_z LPCWSTR wzMessage, | ||
| 315 | __in DWORD cData, | ||
| 316 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
| 317 | __inout int* pnResult | ||
| 318 | ); | ||
| 319 | HRESULT BACallbackOnExecutePackageBegin( | ||
| 320 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 321 | __in_z LPCWSTR wzPackageId, | ||
| 322 | __in BOOL fExecute, | ||
| 323 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
| 324 | __in INSTALLUILEVEL uiLevel, | ||
| 325 | __in BOOL fDisableExternalUiHandler | ||
| 326 | ); | ||
| 327 | HRESULT BACallbackOnExecutePackageComplete( | ||
| 328 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 329 | __in_z LPCWSTR wzPackageId, | ||
| 330 | __in HRESULT hrStatus, | ||
| 331 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 332 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction | ||
| 333 | ); | ||
| 334 | HRESULT BACallbackOnExecutePatchTarget( | ||
| 335 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 336 | __in_z LPCWSTR wzPackageId, | ||
| 337 | __in_z LPCWSTR wzTargetProductCode | ||
| 338 | ); | ||
| 339 | HRESULT BACallbackOnExecuteProcessCancel( | ||
| 340 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 341 | __in_z LPCWSTR wzPackageId, | ||
| 342 | __in DWORD dwProcessId, | ||
| 343 | __inout BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION* pAction | ||
| 344 | ); | ||
| 345 | HRESULT BACallbackOnExecuteProgress( | ||
| 346 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 347 | __in_z LPCWSTR wzPackageId, | ||
| 348 | __in DWORD dwProgressPercentage, | ||
| 349 | __in DWORD dwOverallPercentage, | ||
| 350 | __out int* pnResult | ||
| 351 | ); | ||
| 352 | HRESULT BACallbackOnLaunchApprovedExeBegin( | ||
| 353 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 354 | ); | ||
| 355 | HRESULT BACallbackOnLaunchApprovedExeComplete( | ||
| 356 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 357 | __in HRESULT hrStatus, | ||
| 358 | __in DWORD dwProcessId | ||
| 359 | ); | ||
| 360 | HRESULT BACallbackOnPauseAUBegin( | ||
| 361 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 362 | ); | ||
| 363 | HRESULT BACallbackOnPauseAUComplete( | ||
| 364 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 365 | __in HRESULT hrStatus | ||
| 366 | ); | ||
| 367 | HRESULT BACallbackOnPlanBegin( | ||
| 368 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 369 | __in DWORD cPackages | ||
| 370 | ); | ||
| 371 | HRESULT BACallbackOnPlanCompatibleMsiPackageBegin( | ||
| 372 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 373 | __in_z LPCWSTR wzPackageId, | ||
| 374 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 375 | __in VERUTIL_VERSION* pCompatiblePackageVersion, | ||
| 376 | __inout BOOL* pfRequested | ||
| 377 | ); | ||
| 378 | HRESULT BACallbackOnPlanCompatibleMsiPackageComplete( | ||
| 379 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 380 | __in_z LPCWSTR wzPackageId, | ||
| 381 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 382 | __in HRESULT hrStatus, | ||
| 383 | __in BOOL fRequested | ||
| 384 | ); | ||
| 385 | HRESULT BACallbackOnPlanComplete( | ||
| 386 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 387 | __in HRESULT hrStatus | ||
| 388 | ); | ||
| 389 | HRESULT BACallbackOnPlanForwardCompatibleBundle( | ||
| 390 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 391 | __in_z LPCWSTR wzBundleId, | ||
| 392 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
| 393 | __in_z LPCWSTR wzBundleTag, | ||
| 394 | __in BOOL fPerMachine, | ||
| 395 | __in VERUTIL_VERSION* pVersion, | ||
| 396 | __inout BOOL* pfIgnoreBundle | ||
| 397 | ); | ||
| 398 | HRESULT BACallbackOnPlanMsiFeature( | ||
| 399 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 400 | __in_z LPCWSTR wzPackageId, | ||
| 401 | __in_z LPCWSTR wzFeatureId, | ||
| 402 | __inout BOOTSTRAPPER_FEATURE_STATE* pRequestedState | ||
| 403 | ); | ||
| 404 | HRESULT BACallbackOnPlanMsiPackage( | ||
| 405 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 406 | __in_z LPCWSTR wzPackageId, | ||
| 407 | __in BOOL fExecute, | ||
| 408 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
| 409 | __inout BURN_MSI_PROPERTY* pActionMsiProperty, | ||
| 410 | __inout INSTALLUILEVEL* pUiLevel, | ||
| 411 | __inout BOOL* pfDisableExternalUiHandler, | ||
| 412 | __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning | ||
| 413 | ); | ||
| 414 | HRESULT BACallbackOnPlannedCompatiblePackage( | ||
| 415 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 416 | __in_z LPCWSTR wzPackageId, | ||
| 417 | __in_z LPCWSTR wzCompatiblePackageId, | ||
| 418 | __in BOOL fRemove | ||
| 419 | ); | ||
| 420 | HRESULT BACallbackOnPlannedPackage( | ||
| 421 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 422 | __in_z LPCWSTR wzPackageId, | ||
| 423 | __in BOOTSTRAPPER_ACTION_STATE execute, | ||
| 424 | __in BOOTSTRAPPER_ACTION_STATE rollback, | ||
| 425 | __in BOOL fPlannedCache, | ||
| 426 | __in BOOL fPlannedUncache | ||
| 427 | ); | ||
| 428 | HRESULT BACallbackOnPlanPackageBegin( | ||
| 429 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 430 | __in_z LPCWSTR wzPackageId, | ||
| 431 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
| 432 | __in BOOL fCached, | ||
| 433 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | ||
| 434 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | ||
| 435 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | ||
| 436 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType | ||
| 437 | ); | ||
| 438 | HRESULT BACallbackOnPlanPackageComplete( | ||
| 439 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 440 | __in_z LPCWSTR wzPackageId, | ||
| 441 | __in HRESULT hrStatus, | ||
| 442 | __in BOOTSTRAPPER_REQUEST_STATE requested | ||
| 443 | ); | ||
| 444 | HRESULT BACallbackOnPlanRelatedBundle( | ||
| 445 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 446 | __in_z LPCWSTR wzBundleId, | ||
| 447 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
| 448 | ); | ||
| 449 | HRESULT BACallbackOnPlanRelatedBundleType( | ||
| 450 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 451 | __in_z LPCWSTR wzBundleId, | ||
| 452 | __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType | ||
| 453 | ); | ||
| 454 | HRESULT BACallbackOnPlanRestoreRelatedBundle( | ||
| 455 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 456 | __in_z LPCWSTR wzBundleId, | ||
| 457 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
| 458 | ); | ||
| 459 | HRESULT BACallbackOnPlanRollbackBoundary( | ||
| 460 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 461 | __in_z LPCWSTR wzRollbackBoundaryId, | ||
| 462 | __inout BOOL *pfTransaction | ||
| 463 | ); | ||
| 464 | HRESULT BACallbackOnPlanPatchTarget( | ||
| 465 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 466 | __in_z LPCWSTR wzPackageId, | ||
| 467 | __in_z LPCWSTR wzProductCode, | ||
| 468 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
| 469 | ); | ||
| 470 | HRESULT BACallbackOnProgress( | ||
| 471 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 472 | __in BOOL fRollback, | ||
| 473 | __in DWORD dwProgressPercentage, | ||
| 474 | __in DWORD dwOverallPercentage | ||
| 475 | ); | ||
| 476 | HRESULT BACallbackOnRegisterBegin( | ||
| 477 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 478 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | ||
| 479 | ); | ||
| 480 | HRESULT BACallbackOnRegisterComplete( | ||
| 481 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 482 | __in HRESULT hrStatus | ||
| 483 | ); | ||
| 484 | HRESULT BACallbackOnRollbackMsiTransactionBegin( | ||
| 485 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 486 | __in LPCWSTR wzTransactionId | ||
| 487 | ); | ||
| 488 | HRESULT BACallbackOnRollbackMsiTransactionComplete( | ||
| 489 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 490 | __in LPCWSTR wzTransactionId, | ||
| 491 | __in HRESULT hrStatus, | ||
| 492 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
| 493 | __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION* pAction | ||
| 494 | ); | ||
| 495 | HRESULT BACallbackOnShutdown( | ||
| 496 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 497 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction | ||
| 498 | ); | ||
| 499 | HRESULT BACallbackOnStartup( | ||
| 500 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 501 | ); | ||
| 502 | HRESULT BACallbackOnSystemRestorePointBegin( | ||
| 503 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 504 | ); | ||
| 505 | HRESULT BACallbackOnSystemRestorePointComplete( | ||
| 506 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 507 | __in HRESULT hrStatus | ||
| 508 | ); | ||
| 509 | HRESULT BACallbackOnUnregisterBegin( | ||
| 510 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 511 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | ||
| 512 | ); | ||
| 513 | HRESULT BACallbackOnUnregisterComplete( | ||
| 514 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 515 | __in HRESULT hrStatus | ||
| 516 | ); | ||
| 517 | |||
| 518 | #if defined(__cplusplus) | ||
| 519 | } | ||
| 520 | #endif | ||
diff --git a/src/burn/engine/baengine.cpp b/src/burn/engine/baengine.cpp new file mode 100644 index 00000000..e63836f4 --- /dev/null +++ b/src/burn/engine/baengine.cpp | |||
| @@ -0,0 +1,1532 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | |||
| 6 | static DWORD WINAPI BAEngineMessagePumpThreadProc( | ||
| 7 | __in LPVOID lpThreadParameter | ||
| 8 | ); | ||
| 9 | static void CALLBACK FreeQueueItem( | ||
| 10 | __in void* pvValue, | ||
| 11 | __in void* /*pvContext*/ | ||
| 12 | ); | ||
| 13 | |||
| 14 | |||
| 15 | extern "C" HRESULT BAEngineCreateContext( | ||
| 16 | __in BURN_ENGINE_STATE *pEngineState, | ||
| 17 | __inout BAENGINE_CONTEXT** ppContext | ||
| 18 | ) | ||
| 19 | { | ||
| 20 | HRESULT hr = S_OK; | ||
| 21 | BAENGINE_CONTEXT* pContext = NULL; | ||
| 22 | |||
| 23 | pContext = static_cast<BAENGINE_CONTEXT*>(MemAlloc(sizeof(BAENGINE_CONTEXT), TRUE)); | ||
| 24 | ExitOnNull(pContext, hr, E_OUTOFMEMORY, "Failed to allocate bootstrapper application engine context."); | ||
| 25 | |||
| 26 | ::InitializeCriticalSection(&pContext->csQueue); | ||
| 27 | |||
| 28 | pContext->hQueueSemaphore = ::CreateSemaphoreW(NULL, 0, LONG_MAX, NULL); | ||
| 29 | ExitOnNullWithLastError(pContext->hQueueSemaphore, hr, "Failed to create semaphore for queue."); | ||
| 30 | |||
| 31 | hr = QueCreate(&pContext->hQueue); | ||
| 32 | ExitOnFailure(hr, "Failed to create queue for bootstrapper engine."); | ||
| 33 | |||
| 34 | pContext->pEngineState = pEngineState; | ||
| 35 | |||
| 36 | *ppContext = pContext; | ||
| 37 | pContext = NULL; | ||
| 38 | |||
| 39 | LExit: | ||
| 40 | if (pContext) | ||
| 41 | { | ||
| 42 | BAEngineFreeContext(pContext); | ||
| 43 | pContext = NULL; | ||
| 44 | } | ||
| 45 | |||
| 46 | return hr; | ||
| 47 | } | ||
| 48 | |||
| 49 | extern "C" void BAEngineFreeContext( | ||
| 50 | __in BAENGINE_CONTEXT* pContext | ||
| 51 | ) | ||
| 52 | { | ||
| 53 | PipeRpcUninitiailize(&pContext->hRpcPipe); | ||
| 54 | ReleaseQueue(pContext->hQueue, FreeQueueItem, pContext); | ||
| 55 | ReleaseHandle(pContext->hQueueSemaphore); | ||
| 56 | ::DeleteCriticalSection(&pContext->csQueue); | ||
| 57 | } | ||
| 58 | |||
| 59 | extern "C" void DAPI BAEngineFreeAction( | ||
| 60 | __in BAENGINE_ACTION * pAction | ||
| 61 | ) | ||
| 62 | { | ||
| 63 | switch (pAction->dwMessage) | ||
| 64 | { | ||
| 65 | case WM_BURN_LAUNCH_APPROVED_EXE: | ||
| 66 | ApprovedExesUninitializeLaunch(&pAction->launchApprovedExe); | ||
| 67 | break; | ||
| 68 | } | ||
| 69 | |||
| 70 | MemFree(pAction); | ||
| 71 | } | ||
| 72 | |||
| 73 | extern "C" HRESULT BAEngineStartListening( | ||
| 74 | __in BAENGINE_CONTEXT *pContext, | ||
| 75 | __in HANDLE hBAEnginePipe | ||
| 76 | ) | ||
| 77 | { | ||
| 78 | HRESULT hr = S_OK; | ||
| 79 | |||
| 80 | if (PipeRpcInitialized(&pContext->hRpcPipe)) | ||
| 81 | { | ||
| 82 | ExitWithRootFailure(hr, E_INVALIDARG, "Bootstrapper application engine already listening on a pipe."); | ||
| 83 | } | ||
| 84 | |||
| 85 | PipeRpcInitialize(&pContext->hRpcPipe, hBAEnginePipe, TRUE); | ||
| 86 | |||
| 87 | pContext->hThread = ::CreateThread(NULL, 0, BAEngineMessagePumpThreadProc, pContext, 0, NULL); | ||
| 88 | ExitOnNullWithLastError(pContext->hThread, hr, "Failed to create bootstrapper application engine thread."); | ||
| 89 | |||
| 90 | LExit: | ||
| 91 | return hr; | ||
| 92 | } | ||
| 93 | |||
| 94 | extern "C" HRESULT BAEngineStopListening( | ||
| 95 | __in BAENGINE_CONTEXT * pContext | ||
| 96 | ) | ||
| 97 | { | ||
| 98 | HRESULT hr = S_OK; | ||
| 99 | |||
| 100 | // If the pipe was open, this should cause the bootstrapper application engine pipe thread to stop pumping messages and exit. | ||
| 101 | if (PipeRpcInitialized(&pContext->hRpcPipe)) | ||
| 102 | { | ||
| 103 | PipeWriteDisconnect(pContext->hRpcPipe.hPipe); | ||
| 104 | |||
| 105 | PipeRpcUninitiailize(&pContext->hRpcPipe); | ||
| 106 | } | ||
| 107 | |||
| 108 | if (pContext->hThread) | ||
| 109 | { | ||
| 110 | hr = AppWaitForSingleObject(pContext->hThread, INFINITE); | ||
| 111 | |||
| 112 | ReleaseHandle(pContext->hThread); // always release the thread, no matter if we were able to wait for it to join or not. | ||
| 113 | |||
| 114 | ExitOnFailure(hr, "Failed to wait for bootstrapper application engine pipe thread."); | ||
| 115 | } | ||
| 116 | |||
| 117 | LExit: | ||
| 118 | return hr; | ||
| 119 | } | ||
| 120 | |||
| 121 | static void CALLBACK FreeQueueItem( | ||
| 122 | __in void* pvValue, | ||
| 123 | __in void* /*pvContext*/ | ||
| 124 | ) | ||
| 125 | { | ||
| 126 | BAENGINE_ACTION* pAction = reinterpret_cast<BAENGINE_ACTION*>(pvValue); | ||
| 127 | |||
| 128 | LogId(REPORT_WARNING, MSG_IGNORE_OPERATION_AFTER_QUIT, LoggingBurnMessageToString(pAction->dwMessage)); | ||
| 129 | |||
| 130 | BAEngineFreeAction(pAction); | ||
| 131 | MemFree(pAction); | ||
| 132 | } | ||
| 133 | |||
| 134 | static HRESULT BAEngineGetPackageCount( | ||
| 135 | __in BAENGINE_CONTEXT* pContext, | ||
| 136 | __in BUFF_READER* pReaderArgs, | ||
| 137 | __in BUFF_READER* pReaderResults, | ||
| 138 | __in BUFF_BUFFER* pBuffer | ||
| 139 | ) | ||
| 140 | { | ||
| 141 | HRESULT hr = S_OK; | ||
| 142 | BAENGINE_GETPACKAGECOUNT_ARGS args = { }; | ||
| 143 | BAENGINE_GETPACKAGECOUNT_RESULTS results = { }; | ||
| 144 | |||
| 145 | // Read args. | ||
| 146 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 147 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetPackageCount args."); | ||
| 148 | |||
| 149 | // Read results. | ||
| 150 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 151 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetPackageCount results."); | ||
| 152 | |||
| 153 | // Execute. | ||
| 154 | ExternalEngineGetPackageCount(pContext->pEngineState, &results.cPackages); | ||
| 155 | |||
| 156 | // Write results. | ||
| 157 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 158 | ExitOnFailure(hr, "Failed to write size of BAEngineGetPackageCount struct."); | ||
| 159 | |||
| 160 | hr = BuffWriteNumberToBuffer(pBuffer, results.cPackages); | ||
| 161 | ExitOnFailure(hr, "Failed to write length of value of BAEngineGetPackageCount struct."); | ||
| 162 | |||
| 163 | LExit: | ||
| 164 | return hr; | ||
| 165 | } | ||
| 166 | |||
| 167 | static HRESULT BAEngineGetVariableNumeric( | ||
| 168 | __in BAENGINE_CONTEXT* pContext, | ||
| 169 | __in BUFF_READER* pReaderArgs, | ||
| 170 | __in BUFF_READER* pReaderResults, | ||
| 171 | __in BUFF_BUFFER* pBuffer | ||
| 172 | ) | ||
| 173 | { | ||
| 174 | HRESULT hr = S_OK; | ||
| 175 | BAENGINE_GETVARIABLENUMERIC_ARGS args = { }; | ||
| 176 | BAENGINE_GETVARIABLENUMERIC_RESULTS results = { }; | ||
| 177 | LPWSTR sczVariable = NULL; | ||
| 178 | |||
| 179 | // Read args. | ||
| 180 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 181 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableNumeric args."); | ||
| 182 | |||
| 183 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 184 | ExitOnFailure(hr, "Failed to read variable name of BAEngineGetVariableNumeric args."); | ||
| 185 | |||
| 186 | args.wzVariable = sczVariable; | ||
| 187 | |||
| 188 | // Read results. | ||
| 189 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 190 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableNumeric results."); | ||
| 191 | |||
| 192 | // Execute. | ||
| 193 | hr = ExternalEngineGetVariableNumeric(pContext->pEngineState, args.wzVariable, &results.llValue); | ||
| 194 | |||
| 195 | // Write results. | ||
| 196 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 197 | ExitOnFailure(hr, "Failed to write size of BAEngineGetVariableNumeric struct."); | ||
| 198 | |||
| 199 | hr = BuffWriteNumber64ToBuffer(pBuffer, (DWORD64)results.llValue); | ||
| 200 | ExitOnFailure(hr, "Failed to write length of value of BAEngineGetVariableNumeric struct."); | ||
| 201 | |||
| 202 | LExit: | ||
| 203 | ReleaseStr(sczVariable); | ||
| 204 | return hr; | ||
| 205 | } | ||
| 206 | |||
| 207 | static HRESULT BAEngineGetVariableString( | ||
| 208 | __in BAENGINE_CONTEXT* pContext, | ||
| 209 | __in BUFF_READER* pReaderArgs, | ||
| 210 | __in BUFF_READER* pReaderResults, | ||
| 211 | __in BUFF_BUFFER* pBuffer | ||
| 212 | ) | ||
| 213 | { | ||
| 214 | HRESULT hr = S_OK; | ||
| 215 | BAENGINE_GETVARIABLESTRING_ARGS args = { }; | ||
| 216 | BAENGINE_GETVARIABLESTRING_RESULTS results = { }; | ||
| 217 | LPWSTR sczVariable = NULL; | ||
| 218 | LPWSTR sczValue = NULL; | ||
| 219 | DWORD cchValue = 0; | ||
| 220 | |||
| 221 | // Read args. | ||
| 222 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 223 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableString args."); | ||
| 224 | |||
| 225 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 226 | ExitOnFailure(hr, "Failed to read variable name of BAEngineGetVariableString args."); | ||
| 227 | |||
| 228 | args.wzVariable = sczVariable; | ||
| 229 | |||
| 230 | // Read results. | ||
| 231 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 232 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableString results."); | ||
| 233 | |||
| 234 | hr = BuffReaderReadNumber(pReaderResults, &cchValue); | ||
| 235 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableString results."); | ||
| 236 | |||
| 237 | results.cchValue = cchValue; | ||
| 238 | |||
| 239 | // Execute. | ||
| 240 | hr = VariableGetString(&pContext->pEngineState->variables, args.wzVariable, &sczValue); | ||
| 241 | if (E_NOTFOUND == hr) | ||
| 242 | { | ||
| 243 | ExitFunction(); | ||
| 244 | } | ||
| 245 | ExitOnFailure(hr, "Failed to get string variable: %ls", sczVariable); | ||
| 246 | |||
| 247 | results.cchValue = lstrlenW(sczValue); | ||
| 248 | results.wzValue = sczValue; | ||
| 249 | |||
| 250 | // Write results. | ||
| 251 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 252 | ExitOnFailure(hr, "Failed to write size of BAEngineGetVariableString struct."); | ||
| 253 | |||
| 254 | hr = BuffWriteNumberToBuffer(pBuffer, results.cchValue); | ||
| 255 | ExitOnFailure(hr, "Failed to write length of value of BAEngineGetVariableString struct."); | ||
| 256 | |||
| 257 | hr = BuffWriteStringToBuffer(pBuffer, results.wzValue); | ||
| 258 | ExitOnFailure(hr, "Failed to write value of BAEngineGetVariableString struct."); | ||
| 259 | |||
| 260 | LExit: | ||
| 261 | ReleaseStr(sczValue); | ||
| 262 | ReleaseStr(sczVariable); | ||
| 263 | |||
| 264 | return hr; | ||
| 265 | } | ||
| 266 | |||
| 267 | static HRESULT BAEngineGetVariableVersion( | ||
| 268 | __in BAENGINE_CONTEXT* pContext, | ||
| 269 | __in BUFF_READER* pReaderArgs, | ||
| 270 | __in BUFF_READER* pReaderResults, | ||
| 271 | __in BUFF_BUFFER* pBuffer | ||
| 272 | ) | ||
| 273 | { | ||
| 274 | HRESULT hr = S_OK; | ||
| 275 | BAENGINE_GETVARIABLEVERSION_ARGS args = { }; | ||
| 276 | BAENGINE_GETVARIABLEVERSION_RESULTS results = { }; | ||
| 277 | LPWSTR sczVariable = NULL; | ||
| 278 | VERUTIL_VERSION* pVersion = NULL; | ||
| 279 | DWORD cchValue = 0; | ||
| 280 | |||
| 281 | // Read args. | ||
| 282 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 283 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableVersion args."); | ||
| 284 | |||
| 285 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 286 | ExitOnFailure(hr, "Failed to read variable name of BAEngineGetVariableVersion args."); | ||
| 287 | |||
| 288 | args.wzVariable = sczVariable; | ||
| 289 | |||
| 290 | // Read results. | ||
| 291 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 292 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableVersion results."); | ||
| 293 | |||
| 294 | hr = BuffReaderReadNumber(pReaderResults, &cchValue); | ||
| 295 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetVariableVersion results."); | ||
| 296 | |||
| 297 | results.cchValue = cchValue; | ||
| 298 | |||
| 299 | // Execute. | ||
| 300 | hr = VariableGetVersion(&pContext->pEngineState->variables, args.wzVariable, &pVersion); | ||
| 301 | ExitOnFailure(hr, "Failed to get version variable: %ls", sczVariable); | ||
| 302 | |||
| 303 | results.cchValue = lstrlenW(pVersion->sczVersion); | ||
| 304 | results.wzValue = pVersion->sczVersion; | ||
| 305 | |||
| 306 | // Write results. | ||
| 307 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 308 | ExitOnFailure(hr, "Failed to write size of BAEngineGetVariableVersion struct."); | ||
| 309 | |||
| 310 | hr = BuffWriteNumberToBuffer(pBuffer, results.cchValue); | ||
| 311 | ExitOnFailure(hr, "Failed to write length of value of BAEngineGetVariableVersion struct."); | ||
| 312 | |||
| 313 | hr = BuffWriteStringToBuffer(pBuffer, results.wzValue); | ||
| 314 | ExitOnFailure(hr, "Failed to write value of BAEngineGetVariableVersion struct."); | ||
| 315 | |||
| 316 | LExit: | ||
| 317 | ReleaseVerutilVersion(pVersion); | ||
| 318 | ReleaseStr(sczVariable); | ||
| 319 | |||
| 320 | return hr; | ||
| 321 | } | ||
| 322 | |||
| 323 | static HRESULT BAEngineGetRelatedBundleVariable( | ||
| 324 | __in BAENGINE_CONTEXT* /* pContext */, | ||
| 325 | __in BUFF_READER* pReaderArgs, | ||
| 326 | __in BUFF_READER* pReaderResults, | ||
| 327 | __in BUFF_BUFFER* pBuffer | ||
| 328 | ) | ||
| 329 | { | ||
| 330 | HRESULT hr = S_OK; | ||
| 331 | BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { }; | ||
| 332 | BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { }; | ||
| 333 | LPWSTR sczBundleId = NULL; | ||
| 334 | LPWSTR sczVariable = NULL; | ||
| 335 | LPWSTR sczValue = NULL; | ||
| 336 | |||
| 337 | // Read args. | ||
| 338 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 339 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetRelatedBundleVariable args."); | ||
| 340 | |||
| 341 | hr = BuffReaderReadString(pReaderArgs, &sczBundleId); | ||
| 342 | ExitOnFailure(hr, "Failed to read bundle id of BAEngineGetRelatedBundleVariable args."); | ||
| 343 | |||
| 344 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 345 | ExitOnFailure(hr, "Failed to read variable name of BAEngineGetRelatedBundleVariable args."); | ||
| 346 | |||
| 347 | args.wzBundleId = sczBundleId; | ||
| 348 | args.wzVariable = sczVariable; | ||
| 349 | |||
| 350 | // Read results. | ||
| 351 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 352 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetRelatedBundleVariable results."); | ||
| 353 | |||
| 354 | hr = BuffReaderReadNumber(pReaderResults, &results.cchValue); // ignored, overwritten below. | ||
| 355 | ExitOnFailure(hr, "Failed to read API version of BAEngineGetRelatedBundleVariable results."); | ||
| 356 | |||
| 357 | // Execute. | ||
| 358 | hr = BundleGetBundleVariable(args.wzBundleId, args.wzVariable, &sczValue); | ||
| 359 | ExitOnFailure(hr, "Failed to get related bundle variable: %ls", sczVariable); | ||
| 360 | |||
| 361 | results.cchValue = lstrlenW(sczValue); | ||
| 362 | results.wzValue = sczValue; | ||
| 363 | |||
| 364 | // Write results. | ||
| 365 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 366 | ExitOnFailure(hr, "Failed to write size of BAEngineGetRelatedBundleVariable struct."); | ||
| 367 | |||
| 368 | hr = BuffWriteNumberToBuffer(pBuffer, results.cchValue); | ||
| 369 | ExitOnFailure(hr, "Failed to write length of value of BAEngineGetRelatedBundleVariable struct."); | ||
| 370 | |||
| 371 | hr = BuffWriteStringToBuffer(pBuffer, results.wzValue); | ||
| 372 | ExitOnFailure(hr, "Failed to write value of BAEngineGetRelatedBundleVariable struct."); | ||
| 373 | |||
| 374 | LExit: | ||
| 375 | ReleaseStr(sczValue); | ||
| 376 | ReleaseStr(sczVariable); | ||
| 377 | ReleaseStr(sczBundleId); | ||
| 378 | |||
| 379 | return hr; | ||
| 380 | } | ||
| 381 | |||
| 382 | static HRESULT BAEngineFormatString( | ||
| 383 | __in BAENGINE_CONTEXT* pContext, | ||
| 384 | __in BUFF_READER* pReaderArgs, | ||
| 385 | __in BUFF_READER* pReaderResults, | ||
| 386 | __in BUFF_BUFFER* pBuffer | ||
| 387 | ) | ||
| 388 | { | ||
| 389 | HRESULT hr = S_OK; | ||
| 390 | BAENGINE_FORMATSTRING_ARGS args = { }; | ||
| 391 | BAENGINE_FORMATSTRING_RESULTS results = { }; | ||
| 392 | LPWSTR sczIn = NULL; | ||
| 393 | LPWSTR sczOut = NULL; | ||
| 394 | SIZE_T cchOut = 0; | ||
| 395 | |||
| 396 | // Read args. | ||
| 397 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 398 | ExitOnFailure(hr, "Failed to read API version of BAEngineFormatString args."); | ||
| 399 | |||
| 400 | hr = BuffReaderReadString(pReaderArgs, &sczIn); | ||
| 401 | ExitOnFailure(hr, "Failed to read string to format of BAEngineFormatString args."); | ||
| 402 | |||
| 403 | args.wzIn = sczIn; | ||
| 404 | |||
| 405 | // Read results. | ||
| 406 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 407 | ExitOnFailure(hr, "Failed to read API version of BAEngineFormatString results."); | ||
| 408 | |||
| 409 | hr = BuffReaderReadNumber(pReaderResults, &results.cchOut); // ignored, overwritten below. | ||
| 410 | ExitOnFailure(hr, "Failed to read allowed length of formatted string of BAEngineFormatString results."); | ||
| 411 | |||
| 412 | // Execute. | ||
| 413 | hr = VariableFormatString(&pContext->pEngineState->variables, args.wzIn, &sczOut, &cchOut); | ||
| 414 | ExitOnFailure(hr, "Failed to format string"); | ||
| 415 | |||
| 416 | results.cchOut = (cchOut > DWORD_MAX) ? DWORD_MAX : static_cast<DWORD>(cchOut); | ||
| 417 | results.wzOut = sczOut; | ||
| 418 | |||
| 419 | // Write results. | ||
| 420 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 421 | ExitOnFailure(hr, "Failed to write size of BAEngineFormatString struct."); | ||
| 422 | |||
| 423 | hr = BuffWriteNumberToBuffer(pBuffer, results.cchOut); | ||
| 424 | ExitOnFailure(hr, "Failed to write length of formatted string of BAEngineFormatString struct."); | ||
| 425 | |||
| 426 | hr = BuffWriteStringToBuffer(pBuffer, results.wzOut); | ||
| 427 | ExitOnFailure(hr, "Failed to write formatted string of BAEngineFormatString struct."); | ||
| 428 | |||
| 429 | LExit: | ||
| 430 | ReleaseStr(sczOut); | ||
| 431 | ReleaseStr(sczIn); | ||
| 432 | |||
| 433 | return hr; | ||
| 434 | } | ||
| 435 | |||
| 436 | static HRESULT BAEngineEscapeString( | ||
| 437 | __in BAENGINE_CONTEXT* /* pContext */, | ||
| 438 | __in BUFF_READER* pReaderArgs, | ||
| 439 | __in BUFF_READER* pReaderResults, | ||
| 440 | __in BUFF_BUFFER* pBuffer | ||
| 441 | ) | ||
| 442 | { | ||
| 443 | HRESULT hr = S_OK; | ||
| 444 | BAENGINE_ESCAPESTRING_ARGS args = { }; | ||
| 445 | BAENGINE_ESCAPESTRING_RESULTS results = { }; | ||
| 446 | LPWSTR sczIn = NULL; | ||
| 447 | LPWSTR sczOut = NULL; | ||
| 448 | |||
| 449 | // Read args. | ||
| 450 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 451 | ExitOnFailure(hr, "Failed to read API version of BAEngineEscapeString args."); | ||
| 452 | |||
| 453 | hr = BuffReaderReadString(pReaderArgs, &sczIn); | ||
| 454 | ExitOnFailure(hr, "Failed to read string to escape of BAEngineEscapeString args."); | ||
| 455 | |||
| 456 | args.wzIn = sczIn; | ||
| 457 | |||
| 458 | // Read results. | ||
| 459 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 460 | ExitOnFailure(hr, "Failed to read API version of BAEngineEscapeString results."); | ||
| 461 | |||
| 462 | hr = BuffReaderReadNumber(pReaderResults, &results.cchOut); // ignored, overwritten below. | ||
| 463 | ExitOnFailure(hr, "Failed to read allowed length of escaped string of BAEngineEscapeString results."); | ||
| 464 | |||
| 465 | // Execute. | ||
| 466 | hr = VariableEscapeString(args.wzIn, &sczOut); | ||
| 467 | ExitOnFailure(hr, "Failed to format string"); | ||
| 468 | |||
| 469 | results.cchOut = lstrlenW(sczOut); | ||
| 470 | results.wzOut = sczOut; | ||
| 471 | |||
| 472 | // Write results. | ||
| 473 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 474 | ExitOnFailure(hr, "Failed to write size of BAEngineEscapeString struct."); | ||
| 475 | |||
| 476 | hr = BuffWriteNumberToBuffer(pBuffer, results.cchOut); | ||
| 477 | ExitOnFailure(hr, "Failed to write length of formatted string of BAEngineEscapeString struct."); | ||
| 478 | |||
| 479 | hr = BuffWriteStringToBuffer(pBuffer, results.wzOut); | ||
| 480 | ExitOnFailure(hr, "Failed to write formatted string of BAEngineEscapeString struct."); | ||
| 481 | |||
| 482 | LExit: | ||
| 483 | ReleaseStr(sczOut); | ||
| 484 | ReleaseStr(sczIn); | ||
| 485 | |||
| 486 | return hr; | ||
| 487 | } | ||
| 488 | |||
| 489 | static HRESULT BAEngineEvaluateCondition( | ||
| 490 | __in BAENGINE_CONTEXT* pContext, | ||
| 491 | __in BUFF_READER* pReaderArgs, | ||
| 492 | __in BUFF_READER* pReaderResults, | ||
| 493 | __in BUFF_BUFFER* pBuffer | ||
| 494 | ) | ||
| 495 | { | ||
| 496 | HRESULT hr = S_OK; | ||
| 497 | BAENGINE_EVALUATECONDITION_ARGS args = { }; | ||
| 498 | BAENGINE_EVALUATECONDITION_RESULTS results = { }; | ||
| 499 | LPWSTR sczCondition = NULL; | ||
| 500 | |||
| 501 | // Read args. | ||
| 502 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 503 | ExitOnFailure(hr, "Failed to read API version of BAEngineEvaluateCondition args."); | ||
| 504 | |||
| 505 | hr = BuffReaderReadString(pReaderArgs, &sczCondition); | ||
| 506 | ExitOnFailure(hr, "Failed to read condition of BAEngineEvaluateCondition args."); | ||
| 507 | |||
| 508 | args.wzCondition = sczCondition; | ||
| 509 | |||
| 510 | // Read results. | ||
| 511 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 512 | ExitOnFailure(hr, "Failed to read API version of BAEngineEvaluateCondition results."); | ||
| 513 | |||
| 514 | // Execute. | ||
| 515 | hr = ConditionEvaluate(&pContext->pEngineState->variables, args.wzCondition, &results.f); | ||
| 516 | ExitOnFailure(hr, "Failed to evalute condition."); | ||
| 517 | |||
| 518 | // Write results. | ||
| 519 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 520 | ExitOnFailure(hr, "Failed to write size of BAEngineEvaluateCondition struct."); | ||
| 521 | |||
| 522 | hr = BuffWriteNumberToBuffer(pBuffer, results.f); | ||
| 523 | ExitOnFailure(hr, "Failed to result of BAEngineEvaluateCondition struct."); | ||
| 524 | |||
| 525 | LExit: | ||
| 526 | ReleaseStr(sczCondition); | ||
| 527 | |||
| 528 | return hr; | ||
| 529 | } | ||
| 530 | |||
| 531 | static HRESULT BAEngineLog( | ||
| 532 | __in BUFF_READER* pReaderArgs, | ||
| 533 | __in BUFF_READER* pReaderResults, | ||
| 534 | __in BUFF_BUFFER* pBuffer | ||
| 535 | ) | ||
| 536 | { | ||
| 537 | HRESULT hr = S_OK; | ||
| 538 | BAENGINE_LOG_ARGS args = { }; | ||
| 539 | BAENGINE_LOG_RESULTS results = { }; | ||
| 540 | LPWSTR sczMessage = NULL; | ||
| 541 | REPORT_LEVEL rl = REPORT_NONE; | ||
| 542 | |||
| 543 | // Read args. | ||
| 544 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 545 | ExitOnFailure(hr, "Failed to read API version of BAEngineLog args."); | ||
| 546 | |||
| 547 | hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.level)); | ||
| 548 | ExitOnFailure(hr, "Failed to read API version of BAEngineLog args."); | ||
| 549 | |||
| 550 | hr = BuffReaderReadString(pReaderArgs, &sczMessage); | ||
| 551 | ExitOnFailure(hr, "Failed to read variable name of BAEngineLog args."); | ||
| 552 | |||
| 553 | switch (args.level) | ||
| 554 | { | ||
| 555 | case BOOTSTRAPPER_LOG_LEVEL_STANDARD: | ||
| 556 | rl = REPORT_STANDARD; | ||
| 557 | break; | ||
| 558 | |||
| 559 | case BOOTSTRAPPER_LOG_LEVEL_VERBOSE: | ||
| 560 | rl = REPORT_VERBOSE; | ||
| 561 | break; | ||
| 562 | |||
| 563 | case BOOTSTRAPPER_LOG_LEVEL_DEBUG: | ||
| 564 | rl = REPORT_DEBUG; | ||
| 565 | break; | ||
| 566 | |||
| 567 | case BOOTSTRAPPER_LOG_LEVEL_ERROR: | ||
| 568 | rl = REPORT_ERROR; | ||
| 569 | break; | ||
| 570 | |||
| 571 | default: | ||
| 572 | ExitFunction1(hr = E_INVALIDARG); | ||
| 573 | } | ||
| 574 | |||
| 575 | args.wzMessage = sczMessage; | ||
| 576 | |||
| 577 | // Read results. | ||
| 578 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 579 | ExitOnFailure(hr, "Failed to read API version of BAEngineLog results."); | ||
| 580 | |||
| 581 | // Execute. | ||
| 582 | hr = ExternalEngineLog(rl, args.wzMessage); | ||
| 583 | ExitOnFailure(hr, "Failed to log BA message."); | ||
| 584 | |||
| 585 | // Write results. | ||
| 586 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 587 | ExitOnFailure(hr, "Failed to write size of BAEngineLog struct."); | ||
| 588 | |||
| 589 | LExit: | ||
| 590 | ReleaseStr(sczMessage); | ||
| 591 | return hr; | ||
| 592 | } | ||
| 593 | |||
| 594 | static HRESULT BAEngineSendEmbeddedError( | ||
| 595 | __in BAENGINE_CONTEXT* pContext, | ||
| 596 | __in BUFF_READER* pReaderArgs, | ||
| 597 | __in BUFF_READER* pReaderResults, | ||
| 598 | __in BUFF_BUFFER* pBuffer | ||
| 599 | ) | ||
| 600 | { | ||
| 601 | HRESULT hr = S_OK; | ||
| 602 | BAENGINE_SENDEMBEDDEDERROR_ARGS args = { }; | ||
| 603 | BAENGINE_SENDEMBEDDEDERROR_RESULTS results = { }; | ||
| 604 | LPWSTR sczMessage = NULL; | ||
| 605 | |||
| 606 | // Read args. | ||
| 607 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 608 | ExitOnFailure(hr, "Failed to read API version of BAEngineSendEmbeddedError args."); | ||
| 609 | |||
| 610 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwErrorCode); | ||
| 611 | ExitOnFailure(hr, "Failed to read error code of BAEngineSendEmbeddedError args."); | ||
| 612 | |||
| 613 | hr = BuffReaderReadString(pReaderArgs, &sczMessage); | ||
| 614 | ExitOnFailure(hr, "Failed to read condition of BAEngineSendEmbeddedError args."); | ||
| 615 | |||
| 616 | args.wzMessage = sczMessage; | ||
| 617 | |||
| 618 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwUIHint); | ||
| 619 | ExitOnFailure(hr, "Failed to read UI hint of BAEngineSendEmbeddedError args."); | ||
| 620 | |||
| 621 | // Read results. | ||
| 622 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 623 | ExitOnFailure(hr, "Failed to read API version of BAEngineSendEmbeddedError results."); | ||
| 624 | |||
| 625 | // Execute. | ||
| 626 | hr = ExternalEngineSendEmbeddedError(pContext->pEngineState, args.dwErrorCode, args.wzMessage, args.dwUIHint, &results.nResult); | ||
| 627 | ExitOnFailure(hr, "Failed to send embedded error."); | ||
| 628 | |||
| 629 | // Write results. | ||
| 630 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 631 | ExitOnFailure(hr, "Failed to write size of BAEngineSendEmbeddedError struct."); | ||
| 632 | |||
| 633 | hr = BuffWriteNumberToBuffer(pBuffer, results.nResult); | ||
| 634 | ExitOnFailure(hr, "Failed to result of BAEngineSendEmbeddedError struct."); | ||
| 635 | |||
| 636 | LExit: | ||
| 637 | ReleaseStr(sczMessage); | ||
| 638 | return hr; | ||
| 639 | } | ||
| 640 | |||
| 641 | static HRESULT BAEngineSendEmbeddedProgress( | ||
| 642 | __in BAENGINE_CONTEXT* pContext, | ||
| 643 | __in BUFF_READER* pReaderArgs, | ||
| 644 | __in BUFF_READER* pReaderResults, | ||
| 645 | __in BUFF_BUFFER* pBuffer | ||
| 646 | ) | ||
| 647 | { | ||
| 648 | HRESULT hr = S_OK; | ||
| 649 | BAENGINE_SENDEMBEDDEDPROGRESS_ARGS args = { }; | ||
| 650 | BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS results = { }; | ||
| 651 | |||
| 652 | // Read args. | ||
| 653 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 654 | ExitOnFailure(hr, "Failed to read API version of BAEngineSendEmbeddedProgress args."); | ||
| 655 | |||
| 656 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwProgressPercentage); | ||
| 657 | ExitOnFailure(hr, "Failed to read progress of BAEngineSendEmbeddedProgress args."); | ||
| 658 | |||
| 659 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallProgressPercentage); | ||
| 660 | ExitOnFailure(hr, "Failed to read overall progress of BAEngineSendEmbeddedProgress args."); | ||
| 661 | |||
| 662 | // Read results. | ||
| 663 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 664 | ExitOnFailure(hr, "Failed to read API version of BAEngineSendEmbeddedProgress results."); | ||
| 665 | |||
| 666 | // Execute. | ||
| 667 | hr = ExternalEngineSendEmbeddedProgress(pContext->pEngineState, args.dwProgressPercentage, args.dwOverallProgressPercentage, &results.nResult); | ||
| 668 | ExitOnFailure(hr, "Failed to send embedded error."); | ||
| 669 | |||
| 670 | // Write results. | ||
| 671 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 672 | ExitOnFailure(hr, "Failed to write size of BAEngineSendEmbeddedProgress struct."); | ||
| 673 | |||
| 674 | hr = BuffWriteNumberToBuffer(pBuffer, results.nResult); | ||
| 675 | ExitOnFailure(hr, "Failed to result of BAEngineSendEmbeddedProgress struct."); | ||
| 676 | |||
| 677 | LExit: | ||
| 678 | return hr; | ||
| 679 | } | ||
| 680 | |||
| 681 | static HRESULT BAEngineSetUpdate( | ||
| 682 | __in BAENGINE_CONTEXT* pContext, | ||
| 683 | __in BUFF_READER* pReaderArgs, | ||
| 684 | __in BUFF_READER* pReaderResults, | ||
| 685 | __in BUFF_BUFFER* pBuffer | ||
| 686 | ) | ||
| 687 | { | ||
| 688 | HRESULT hr = S_OK; | ||
| 689 | BAENGINE_SETUPDATE_ARGS args = { }; | ||
| 690 | BAENGINE_SETUPDATE_RESULTS results = { }; | ||
| 691 | LPWSTR sczLocalSource = NULL; | ||
| 692 | LPWSTR sczDownloadSource = NULL; | ||
| 693 | LPWSTR sczHash = NULL; | ||
| 694 | LPWSTR sczUpdatePackageId = NULL; | ||
| 695 | |||
| 696 | // Read args. | ||
| 697 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 698 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetUpdate args."); | ||
| 699 | |||
| 700 | hr = BuffReaderReadString(pReaderArgs, &sczLocalSource); | ||
| 701 | ExitOnFailure(hr, "Failed to read local source of BAEngineSetUpdate args."); | ||
| 702 | |||
| 703 | args.wzLocalSource = sczLocalSource; | ||
| 704 | |||
| 705 | hr = BuffReaderReadString(pReaderArgs, &sczDownloadSource); | ||
| 706 | ExitOnFailure(hr, "Failed to read download source of BAEngineSetUpdate args."); | ||
| 707 | |||
| 708 | args.wzDownloadSource = sczDownloadSource; | ||
| 709 | |||
| 710 | hr = BuffReaderReadNumber64(pReaderArgs, &args.qwSize); | ||
| 711 | ExitOnFailure(hr, "Failed to read update size of BAEngineSetUpdate args."); | ||
| 712 | |||
| 713 | hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hashType)); | ||
| 714 | ExitOnFailure(hr, "Failed to read hash type of BAEngineSetUpdate args."); | ||
| 715 | |||
| 716 | hr = BuffReaderReadString(pReaderArgs, &sczHash); | ||
| 717 | ExitOnFailure(hr, "Failed to read hash of BAEngineSetUpdate args."); | ||
| 718 | |||
| 719 | args.wzHash = sczHash; | ||
| 720 | |||
| 721 | hr = BuffReaderReadString(pReaderArgs, &sczUpdatePackageId); | ||
| 722 | ExitOnFailure(hr, "Failed to read update package id of BAEngineSetUpdate args."); | ||
| 723 | |||
| 724 | args.wzUpdatePackageId = sczUpdatePackageId; | ||
| 725 | |||
| 726 | // Read results. | ||
| 727 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 728 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetUpdate results."); | ||
| 729 | |||
| 730 | // Execute. | ||
| 731 | hr = ExternalEngineSetUpdate(pContext->pEngineState, args.wzLocalSource, args.wzDownloadSource, args.qwSize, args.hashType, args.wzHash, args.wzUpdatePackageId); | ||
| 732 | ExitOnFailure(hr, "Failed to set update."); | ||
| 733 | |||
| 734 | // Write results. | ||
| 735 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 736 | ExitOnFailure(hr, "Failed to write size of BAEngineSetUpdate struct."); | ||
| 737 | |||
| 738 | LExit: | ||
| 739 | ReleaseStr(sczUpdatePackageId); | ||
| 740 | ReleaseStr(sczHash); | ||
| 741 | ReleaseStr(sczDownloadSource); | ||
| 742 | ReleaseStr(sczLocalSource); | ||
| 743 | return hr; | ||
| 744 | } | ||
| 745 | |||
| 746 | static HRESULT BAEngineSetLocalSource( | ||
| 747 | __in BAENGINE_CONTEXT* pContext, | ||
| 748 | __in BUFF_READER* pReaderArgs, | ||
| 749 | __in BUFF_READER* pReaderResults, | ||
| 750 | __in BUFF_BUFFER* pBuffer | ||
| 751 | ) | ||
| 752 | { | ||
| 753 | HRESULT hr = S_OK; | ||
| 754 | BAENGINE_SETLOCALSOURCE_ARGS args = { }; | ||
| 755 | BAENGINE_SETLOCALSOURCE_RESULTS results = { }; | ||
| 756 | LPWSTR sczPackageOrContainerId = NULL; | ||
| 757 | LPWSTR sczPayloadId = NULL; | ||
| 758 | LPWSTR sczPath = NULL; | ||
| 759 | |||
| 760 | // Read args. | ||
| 761 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 762 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetLocalSource args."); | ||
| 763 | |||
| 764 | hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId); | ||
| 765 | ExitOnFailure(hr, "Failed to read package or container id of BAEngineSetLocalSource args."); | ||
| 766 | |||
| 767 | args.wzPackageOrContainerId = sczPackageOrContainerId; | ||
| 768 | |||
| 769 | hr = BuffReaderReadString(pReaderArgs, &sczPayloadId); | ||
| 770 | ExitOnFailure(hr, "Failed to read payload id of BAEngineSetLocalSource args."); | ||
| 771 | |||
| 772 | args.wzPayloadId = sczPayloadId; | ||
| 773 | |||
| 774 | hr = BuffReaderReadString(pReaderArgs, &sczPath); | ||
| 775 | ExitOnFailure(hr, "Failed to read path of BAEngineSetLocalSource args."); | ||
| 776 | |||
| 777 | args.wzPath = sczPath; | ||
| 778 | |||
| 779 | // Read results. | ||
| 780 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 781 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetLocalSource results."); | ||
| 782 | |||
| 783 | // Execute. | ||
| 784 | hr = ExternalEngineSetLocalSource(pContext->pEngineState, args.wzPackageOrContainerId, args.wzPayloadId, args.wzPath); | ||
| 785 | ExitOnFailure(hr, "Failed to set local source."); | ||
| 786 | |||
| 787 | // Write results. | ||
| 788 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 789 | ExitOnFailure(hr, "Failed to write size of BAEngineSetLocalSource struct."); | ||
| 790 | |||
| 791 | LExit: | ||
| 792 | ReleaseStr(sczPath); | ||
| 793 | ReleaseStr(sczPayloadId); | ||
| 794 | ReleaseStr(sczPackageOrContainerId); | ||
| 795 | return hr; | ||
| 796 | } | ||
| 797 | |||
| 798 | static HRESULT BAEngineSetDownloadSource( | ||
| 799 | __in BAENGINE_CONTEXT* pContext, | ||
| 800 | __in BUFF_READER* pReaderArgs, | ||
| 801 | __in BUFF_READER* pReaderResults, | ||
| 802 | __in BUFF_BUFFER* pBuffer | ||
| 803 | ) | ||
| 804 | { | ||
| 805 | HRESULT hr = S_OK; | ||
| 806 | BAENGINE_SETDOWNLOADSOURCE_ARGS args = { }; | ||
| 807 | BAENGINE_SETDOWNLOADSOURCE_RESULTS results = { }; | ||
| 808 | LPWSTR sczPackageOrContainerId = NULL; | ||
| 809 | LPWSTR sczPayloadId = NULL; | ||
| 810 | LPWSTR sczUrl = NULL; | ||
| 811 | LPWSTR sczUser = NULL; | ||
| 812 | LPWSTR sczPassword = NULL; | ||
| 813 | LPWSTR sczAuthorizationHeader = NULL; | ||
| 814 | |||
| 815 | // Read args. | ||
| 816 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 817 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetDownloadSource args."); | ||
| 818 | |||
| 819 | hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId); | ||
| 820 | ExitOnFailure(hr, "Failed to read package or container id of BAEngineSetDownloadSource args."); | ||
| 821 | |||
| 822 | args.wzPackageOrContainerId = sczPackageOrContainerId; | ||
| 823 | |||
| 824 | hr = BuffReaderReadString(pReaderArgs, &sczPayloadId); | ||
| 825 | ExitOnFailure(hr, "Failed to read payload id of BAEngineSetDownloadSource args."); | ||
| 826 | |||
| 827 | args.wzPayloadId = sczPayloadId; | ||
| 828 | |||
| 829 | hr = BuffReaderReadString(pReaderArgs, &sczUrl); | ||
| 830 | ExitOnFailure(hr, "Failed to read url of BAEngineSetDownloadSource args."); | ||
| 831 | |||
| 832 | args.wzUrl = sczUrl; | ||
| 833 | |||
| 834 | hr = BuffReaderReadString(pReaderArgs, &sczUser); | ||
| 835 | ExitOnFailure(hr, "Failed to read user of BAEngineSetDownloadSource args."); | ||
| 836 | |||
| 837 | args.wzUser = sczUser; | ||
| 838 | |||
| 839 | hr = BuffReaderReadString(pReaderArgs, &sczPassword); | ||
| 840 | ExitOnFailure(hr, "Failed to read password of BAEngineSetDownloadSource args."); | ||
| 841 | |||
| 842 | args.wzPassword = sczPassword; | ||
| 843 | |||
| 844 | hr = BuffReaderReadString(pReaderArgs, &sczAuthorizationHeader); | ||
| 845 | ExitOnFailure(hr, "Failed to read authorization header of BAEngineSetDownloadSource args."); | ||
| 846 | |||
| 847 | args.wzAuthorizationHeader = sczAuthorizationHeader; | ||
| 848 | |||
| 849 | // Read results. | ||
| 850 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 851 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetDownloadSource results."); | ||
| 852 | |||
| 853 | // Execute. | ||
| 854 | hr = ExternalEngineSetDownloadSource(pContext->pEngineState, args.wzPackageOrContainerId, args.wzPayloadId, args.wzUrl, args.wzUser, args.wzPassword, args.wzAuthorizationHeader); | ||
| 855 | ExitOnFailure(hr, "Failed to set download source."); | ||
| 856 | |||
| 857 | // Write results. | ||
| 858 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 859 | ExitOnFailure(hr, "Failed to write size of BAEngineSetDownloadSource struct."); | ||
| 860 | |||
| 861 | LExit: | ||
| 862 | ReleaseStr(sczAuthorizationHeader); | ||
| 863 | ReleaseStr(sczPassword); | ||
| 864 | ReleaseStr(sczUser); | ||
| 865 | ReleaseStr(sczUrl); | ||
| 866 | ReleaseStr(sczPayloadId); | ||
| 867 | ReleaseStr(sczPackageOrContainerId); | ||
| 868 | return hr; | ||
| 869 | } | ||
| 870 | |||
| 871 | |||
| 872 | static HRESULT BAEngineSetVariableNumeric( | ||
| 873 | __in BAENGINE_CONTEXT* pContext, | ||
| 874 | __in BUFF_READER* pReaderArgs, | ||
| 875 | __in BUFF_READER* pReaderResults, | ||
| 876 | __in BUFF_BUFFER* pBuffer | ||
| 877 | ) | ||
| 878 | { | ||
| 879 | HRESULT hr = S_OK; | ||
| 880 | BAENGINE_SETVARIABLENUMERIC_ARGS args = { }; | ||
| 881 | BAENGINE_SETVARIABLENUMERIC_RESULTS results = { }; | ||
| 882 | LPWSTR sczVariable = NULL; | ||
| 883 | |||
| 884 | // Read args. | ||
| 885 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 886 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetVariableNumeric args."); | ||
| 887 | |||
| 888 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 889 | ExitOnFailure(hr, "Failed to read variable of BAEngineSetVariableNumeric args."); | ||
| 890 | |||
| 891 | args.wzVariable = sczVariable; | ||
| 892 | |||
| 893 | hr = BuffReaderReadNumber64(pReaderArgs, reinterpret_cast<DWORD64*>(&args.llValue)); | ||
| 894 | ExitOnFailure(hr, "Failed to read formatted flag of BAEngineSetVariableNumeric results."); | ||
| 895 | |||
| 896 | // Read results. | ||
| 897 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 898 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetVariableNumeric results."); | ||
| 899 | |||
| 900 | // Execute. | ||
| 901 | hr = ExternalEngineSetVariableNumeric(pContext->pEngineState, args.wzVariable, args.llValue); | ||
| 902 | ExitOnFailure(hr, "Failed to set numeric variable."); | ||
| 903 | |||
| 904 | // Write results. | ||
| 905 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 906 | ExitOnFailure(hr, "Failed to write size of BAEngineSetVariableNumeric struct."); | ||
| 907 | |||
| 908 | LExit: | ||
| 909 | ReleaseStr(sczVariable); | ||
| 910 | return hr; | ||
| 911 | } | ||
| 912 | |||
| 913 | static HRESULT BAEngineSetVariableString( | ||
| 914 | __in BAENGINE_CONTEXT* pContext, | ||
| 915 | __in BUFF_READER* pReaderArgs, | ||
| 916 | __in BUFF_READER* pReaderResults, | ||
| 917 | __in BUFF_BUFFER* pBuffer | ||
| 918 | ) | ||
| 919 | { | ||
| 920 | HRESULT hr = S_OK; | ||
| 921 | BAENGINE_SETVARIABLESTRING_ARGS args = { }; | ||
| 922 | BAENGINE_SETVARIABLESTRING_RESULTS results = { }; | ||
| 923 | LPWSTR sczVariable = NULL; | ||
| 924 | LPWSTR sczValue = NULL; | ||
| 925 | |||
| 926 | // Read args. | ||
| 927 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 928 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetVariableString args."); | ||
| 929 | |||
| 930 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 931 | ExitOnFailure(hr, "Failed to read variable of BAEngineSetVariableString args."); | ||
| 932 | |||
| 933 | args.wzVariable = sczVariable; | ||
| 934 | |||
| 935 | hr = BuffReaderReadString(pReaderArgs, &sczValue); | ||
| 936 | ExitOnFailure(hr, "Failed to read value of BAEngineSetVariableString args."); | ||
| 937 | |||
| 938 | args.wzValue = sczValue; | ||
| 939 | |||
| 940 | hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fFormatted)); | ||
| 941 | ExitOnFailure(hr, "Failed to read formatted flag of BAEngineSetVariableString results."); | ||
| 942 | |||
| 943 | // Read results. | ||
| 944 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 945 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetVariableString results."); | ||
| 946 | |||
| 947 | // Execute. | ||
| 948 | hr = ExternalEngineSetVariableString(pContext->pEngineState, args.wzVariable, args.wzValue, args.fFormatted); | ||
| 949 | ExitOnFailure(hr, "Failed to set string variable."); | ||
| 950 | |||
| 951 | // Write results. | ||
| 952 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 953 | ExitOnFailure(hr, "Failed to write size of BAEngineSetVariableString struct."); | ||
| 954 | |||
| 955 | LExit: | ||
| 956 | ReleaseStr(sczValue); | ||
| 957 | ReleaseStr(sczVariable); | ||
| 958 | return hr; | ||
| 959 | } | ||
| 960 | |||
| 961 | static HRESULT BAEngineSetVariableVersion( | ||
| 962 | __in BAENGINE_CONTEXT* pContext, | ||
| 963 | __in BUFF_READER* pReaderArgs, | ||
| 964 | __in BUFF_READER* pReaderResults, | ||
| 965 | __in BUFF_BUFFER* pBuffer | ||
| 966 | ) | ||
| 967 | { | ||
| 968 | HRESULT hr = S_OK; | ||
| 969 | BAENGINE_SETVARIABLEVERSION_ARGS args = { }; | ||
| 970 | BAENGINE_SETVARIABLEVERSION_RESULTS results = { }; | ||
| 971 | LPWSTR sczVariable = NULL; | ||
| 972 | LPWSTR sczValue = NULL; | ||
| 973 | |||
| 974 | // Read args. | ||
| 975 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 976 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetVariableVersion args."); | ||
| 977 | |||
| 978 | hr = BuffReaderReadString(pReaderArgs, &sczVariable); | ||
| 979 | ExitOnFailure(hr, "Failed to read variable of BAEngineSetVariableVersion args."); | ||
| 980 | |||
| 981 | args.wzVariable = sczVariable; | ||
| 982 | |||
| 983 | hr = BuffReaderReadString(pReaderArgs, &sczValue); | ||
| 984 | ExitOnFailure(hr, "Failed to read value of BAEngineSetVariableVersion args."); | ||
| 985 | |||
| 986 | args.wzValue = sczValue; | ||
| 987 | |||
| 988 | // Read results. | ||
| 989 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 990 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetVariableVersion results."); | ||
| 991 | |||
| 992 | // Execute. | ||
| 993 | hr = ExternalEngineSetVariableVersion(pContext->pEngineState, args.wzVariable, args.wzValue); | ||
| 994 | ExitOnFailure(hr, "Failed to set variable version."); | ||
| 995 | |||
| 996 | // Write results. | ||
| 997 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 998 | ExitOnFailure(hr, "Failed to write size of BAEngineSetVariableVersion struct."); | ||
| 999 | |||
| 1000 | LExit: | ||
| 1001 | ReleaseStr(sczValue); | ||
| 1002 | ReleaseStr(sczVariable); | ||
| 1003 | return hr; | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | static HRESULT BAEngineCloseSplashScreen( | ||
| 1007 | __in BAENGINE_CONTEXT* pContext, | ||
| 1008 | __in BUFF_READER* pReaderArgs, | ||
| 1009 | __in BUFF_READER* pReaderResults, | ||
| 1010 | __in BUFF_BUFFER* pBuffer | ||
| 1011 | ) | ||
| 1012 | { | ||
| 1013 | HRESULT hr = S_OK; | ||
| 1014 | BAENGINE_CLOSESPLASHSCREEN_ARGS args = { }; | ||
| 1015 | BAENGINE_CLOSESPLASHSCREEN_RESULTS results = { }; | ||
| 1016 | |||
| 1017 | // Read args. | ||
| 1018 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1019 | ExitOnFailure(hr, "Failed to read API version of BAEngineCloseSplashScreen args."); | ||
| 1020 | |||
| 1021 | // Read results. | ||
| 1022 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1023 | ExitOnFailure(hr, "Failed to read API version of BAEngineCloseSplashScreen results."); | ||
| 1024 | |||
| 1025 | // Execute. | ||
| 1026 | ExternalEngineCloseSplashScreen(pContext->pEngineState); | ||
| 1027 | |||
| 1028 | // Write results. | ||
| 1029 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1030 | ExitOnFailure(hr, "Failed to write size of BAEngineCloseSplashScreen struct."); | ||
| 1031 | |||
| 1032 | LExit: | ||
| 1033 | return hr; | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | static HRESULT BAEngineCompareVersions( | ||
| 1037 | __in BAENGINE_CONTEXT* /* pContext */, | ||
| 1038 | __in BUFF_READER* pReaderArgs, | ||
| 1039 | __in BUFF_READER* pReaderResults, | ||
| 1040 | __in BUFF_BUFFER* pBuffer | ||
| 1041 | ) | ||
| 1042 | { | ||
| 1043 | HRESULT hr = S_OK; | ||
| 1044 | BAENGINE_COMPAREVERSIONS_ARGS args = { }; | ||
| 1045 | BAENGINE_COMPAREVERSIONS_RESULTS results = { }; | ||
| 1046 | LPWSTR sczVersion1 = NULL; | ||
| 1047 | LPWSTR sczVersion2 = NULL; | ||
| 1048 | |||
| 1049 | // Read args. | ||
| 1050 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1051 | ExitOnFailure(hr, "Failed to read API version of BAEngineCompareVersions args."); | ||
| 1052 | |||
| 1053 | hr = BuffReaderReadString(pReaderArgs, &sczVersion1); | ||
| 1054 | ExitOnFailure(hr, "Failed to read first input of BAEngineCompareVersions args."); | ||
| 1055 | |||
| 1056 | args.wzVersion1 = sczVersion1; | ||
| 1057 | |||
| 1058 | hr = BuffReaderReadString(pReaderArgs, &sczVersion2); | ||
| 1059 | ExitOnFailure(hr, "Failed to read second input of BAEngineCompareVersions args."); | ||
| 1060 | |||
| 1061 | args.wzVersion2 = sczVersion2; | ||
| 1062 | |||
| 1063 | // Read results. | ||
| 1064 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1065 | ExitOnFailure(hr, "Failed to read API version of BAEngineCompareVersions results."); | ||
| 1066 | |||
| 1067 | // Execute. | ||
| 1068 | hr = ExternalEngineCompareVersions(args.wzVersion1, args.wzVersion2, &results.nResult); | ||
| 1069 | ExitOnFailure(hr, "Failed to compare versions."); | ||
| 1070 | |||
| 1071 | // Write results. | ||
| 1072 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1073 | ExitOnFailure(hr, "Failed to write size of BAEngineCompareVersions struct."); | ||
| 1074 | |||
| 1075 | hr = BuffWriteNumberToBuffer(pBuffer, results.nResult); | ||
| 1076 | ExitOnFailure(hr, "Failed to result of BAEngineCompareVersions struct."); | ||
| 1077 | |||
| 1078 | LExit: | ||
| 1079 | ReleaseStr(sczVersion2); | ||
| 1080 | ReleaseStr(sczVersion1); | ||
| 1081 | |||
| 1082 | return hr; | ||
| 1083 | } | ||
| 1084 | |||
| 1085 | static HRESULT BAEngineDetect( | ||
| 1086 | __in BAENGINE_CONTEXT* pContext, | ||
| 1087 | __in BUFF_READER* pReaderArgs, | ||
| 1088 | __in BUFF_READER* pReaderResults, | ||
| 1089 | __in BUFF_BUFFER* pBuffer | ||
| 1090 | ) | ||
| 1091 | { | ||
| 1092 | HRESULT hr = S_OK; | ||
| 1093 | BAENGINE_DETECT_ARGS args = { }; | ||
| 1094 | BAENGINE_DETECT_RESULTS results = { }; | ||
| 1095 | |||
| 1096 | // Read args. | ||
| 1097 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1098 | ExitOnFailure(hr, "Failed to read API version of BAEngineDetect args."); | ||
| 1099 | |||
| 1100 | hr = BuffReaderReadNumber64(pReaderArgs, &args.hwndParent); | ||
| 1101 | ExitOnFailure(hr, "Failed to read parent window of BAEngineDetect args."); | ||
| 1102 | |||
| 1103 | // Read results. | ||
| 1104 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1105 | ExitOnFailure(hr, "Failed to read API version of BAEngineDetect results."); | ||
| 1106 | |||
| 1107 | // Execute. | ||
| 1108 | hr = ExternalEngineDetect(pContext, reinterpret_cast<HWND>(args.hwndParent)); | ||
| 1109 | ExitOnFailure(hr, "Failed to detect in the engine."); | ||
| 1110 | |||
| 1111 | // Pack result. | ||
| 1112 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1113 | ExitOnFailure(hr, "Failed to write size of BAEngineDetect struct."); | ||
| 1114 | |||
| 1115 | LExit: | ||
| 1116 | return hr; | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | static HRESULT BAEnginePlan( | ||
| 1120 | __in BAENGINE_CONTEXT* pContext, | ||
| 1121 | __in BUFF_READER* pReaderArgs, | ||
| 1122 | __in BUFF_READER* pReaderResults, | ||
| 1123 | __in BUFF_BUFFER* pBuffer | ||
| 1124 | ) | ||
| 1125 | { | ||
| 1126 | HRESULT hr = S_OK; | ||
| 1127 | BAENGINE_PLAN_ARGS args = { }; | ||
| 1128 | BAENGINE_PLAN_RESULTS results = { }; | ||
| 1129 | |||
| 1130 | // Read args. | ||
| 1131 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1132 | ExitOnFailure(hr, "Failed to read API version of BAEnginePlan args."); | ||
| 1133 | |||
| 1134 | hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.action)); | ||
| 1135 | ExitOnFailure(hr, "Failed to read plan action of BAEnginePlan args."); | ||
| 1136 | |||
| 1137 | // Read results. | ||
| 1138 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1139 | ExitOnFailure(hr, "Failed to read API version of BAEnginePlan results."); | ||
| 1140 | |||
| 1141 | // Execute. | ||
| 1142 | hr = ExternalEnginePlan(pContext, args.action); | ||
| 1143 | ExitOnFailure(hr, "Failed to plan in the engine."); | ||
| 1144 | |||
| 1145 | // Pack result. | ||
| 1146 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1147 | ExitOnFailure(hr, "Failed to write size of BAEnginePlan struct."); | ||
| 1148 | |||
| 1149 | LExit: | ||
| 1150 | return hr; | ||
| 1151 | } | ||
| 1152 | |||
| 1153 | static HRESULT BAEngineElevate( | ||
| 1154 | __in BAENGINE_CONTEXT* pContext, | ||
| 1155 | __in BUFF_READER* pReaderArgs, | ||
| 1156 | __in BUFF_READER* pReaderResults, | ||
| 1157 | __in BUFF_BUFFER* pBuffer | ||
| 1158 | ) | ||
| 1159 | { | ||
| 1160 | HRESULT hr = S_OK; | ||
| 1161 | BAENGINE_ELEVATE_ARGS args = { }; | ||
| 1162 | BAENGINE_ELEVATE_RESULTS results = { }; | ||
| 1163 | |||
| 1164 | // Read args. | ||
| 1165 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1166 | ExitOnFailure(hr, "Failed to read API version of BAEngineElevate args."); | ||
| 1167 | |||
| 1168 | hr = BuffReaderReadNumber64(pReaderArgs, &args.hwndParent); | ||
| 1169 | ExitOnFailure(hr, "Failed to read parent window of BAEngineElevate args."); | ||
| 1170 | |||
| 1171 | // Read results. | ||
| 1172 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1173 | ExitOnFailure(hr, "Failed to read API version of BAEngineElevate results."); | ||
| 1174 | |||
| 1175 | // Execute. | ||
| 1176 | hr = ExternalEngineElevate(pContext, reinterpret_cast<HWND>(args.hwndParent)); | ||
| 1177 | ExitOnFailure(hr, "Failed to detect in the engine."); | ||
| 1178 | |||
| 1179 | // Pack result. | ||
| 1180 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1181 | ExitOnFailure(hr, "Failed to write size of BAEngineElevate struct."); | ||
| 1182 | |||
| 1183 | LExit: | ||
| 1184 | return hr; | ||
| 1185 | } | ||
| 1186 | |||
| 1187 | static HRESULT BAEngineApply( | ||
| 1188 | __in BAENGINE_CONTEXT* pContext, | ||
| 1189 | __in BUFF_READER* pReaderArgs, | ||
| 1190 | __in BUFF_READER* pReaderResults, | ||
| 1191 | __in BUFF_BUFFER* pBuffer | ||
| 1192 | ) | ||
| 1193 | { | ||
| 1194 | HRESULT hr = S_OK; | ||
| 1195 | BAENGINE_APPLY_ARGS args = { }; | ||
| 1196 | BAENGINE_APPLY_RESULTS results = { }; | ||
| 1197 | |||
| 1198 | // Read args. | ||
| 1199 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1200 | ExitOnFailure(hr, "Failed to read API version of BAEngineApply args."); | ||
| 1201 | |||
| 1202 | hr = BuffReaderReadNumber64(pReaderArgs, &args.hwndParent); | ||
| 1203 | ExitOnFailure(hr, "Failed to read parent window of BAEngineApply args."); | ||
| 1204 | |||
| 1205 | // Read results. | ||
| 1206 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1207 | ExitOnFailure(hr, "Failed to read API version of BAEngineApply results."); | ||
| 1208 | |||
| 1209 | // Execute. | ||
| 1210 | hr = ExternalEngineApply(pContext, reinterpret_cast<HWND>(args.hwndParent)); | ||
| 1211 | ExitOnFailure(hr, "Failed to detect in the engine."); | ||
| 1212 | |||
| 1213 | // Pack result. | ||
| 1214 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1215 | ExitOnFailure(hr, "Failed to write size of BAEngineApply struct."); | ||
| 1216 | |||
| 1217 | LExit: | ||
| 1218 | return hr; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | static HRESULT BAEngineQuit( | ||
| 1222 | __in BAENGINE_CONTEXT* pContext, | ||
| 1223 | __in BUFF_READER* pReaderArgs, | ||
| 1224 | __in BUFF_READER* pReaderResults, | ||
| 1225 | __in BUFF_BUFFER* pBuffer | ||
| 1226 | ) | ||
| 1227 | { | ||
| 1228 | HRESULT hr = S_OK; | ||
| 1229 | BAENGINE_QUIT_ARGS args = { }; | ||
| 1230 | BAENGINE_QUIT_RESULTS results = { }; | ||
| 1231 | |||
| 1232 | // Read args. | ||
| 1233 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1234 | ExitOnFailure(hr, "Failed to read API version of BAEngineQuit args."); | ||
| 1235 | |||
| 1236 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwExitCode); | ||
| 1237 | ExitOnFailure(hr, "Failed to read API version of BAEngineQuit args."); | ||
| 1238 | |||
| 1239 | // Read results. | ||
| 1240 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1241 | ExitOnFailure(hr, "Failed to read API version of BAEngineQuit results."); | ||
| 1242 | |||
| 1243 | // Execute. | ||
| 1244 | hr = ExternalEngineQuit(pContext, args.dwExitCode); | ||
| 1245 | ExitOnFailure(hr, "Failed to quit the engine."); | ||
| 1246 | |||
| 1247 | // Pack result. | ||
| 1248 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1249 | ExitOnFailure(hr, "Failed to write size of BAEngineQuit struct."); | ||
| 1250 | |||
| 1251 | LExit: | ||
| 1252 | return hr; | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | static HRESULT BAEngineLaunchApprovedExe( | ||
| 1256 | __in BAENGINE_CONTEXT* pContext, | ||
| 1257 | __in BUFF_READER* pReaderArgs, | ||
| 1258 | __in BUFF_READER* pReaderResults, | ||
| 1259 | __in BUFF_BUFFER* pBuffer | ||
| 1260 | ) | ||
| 1261 | { | ||
| 1262 | HRESULT hr = S_OK; | ||
| 1263 | BAENGINE_LAUNCHAPPROVEDEXE_ARGS args = { }; | ||
| 1264 | BAENGINE_LAUNCHAPPROVEDEXE_RESULTS results = { }; | ||
| 1265 | LPWSTR sczApprovedExeForElevationId = NULL; | ||
| 1266 | LPWSTR sczArguments = NULL; | ||
| 1267 | |||
| 1268 | // Read args. | ||
| 1269 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1270 | ExitOnFailure(hr, "Failed to read API version of BAEngineLaunchApprovedExe args."); | ||
| 1271 | |||
| 1272 | hr = BuffReaderReadNumber64(pReaderArgs, &args.hwndParent); | ||
| 1273 | ExitOnFailure(hr, "Failed to read parent window of BAEngineLaunchApprovedExe args."); | ||
| 1274 | |||
| 1275 | hr = BuffReaderReadString(pReaderArgs, &sczApprovedExeForElevationId); | ||
| 1276 | ExitOnFailure(hr, "Failed to read approved exe elevation id of BAEngineLaunchApprovedExe args."); | ||
| 1277 | |||
| 1278 | args.wzApprovedExeForElevationId = sczApprovedExeForElevationId; | ||
| 1279 | |||
| 1280 | hr = BuffReaderReadString(pReaderArgs, &sczArguments); | ||
| 1281 | ExitOnFailure(hr, "Failed to read arguments of BAEngineLaunchApprovedExe args."); | ||
| 1282 | |||
| 1283 | args.wzArguments = sczArguments; | ||
| 1284 | |||
| 1285 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwWaitForInputIdleTimeout); | ||
| 1286 | ExitOnFailure(hr, "Failed to read wait for idle input timeout of BAEngineLaunchApprovedExe args."); | ||
| 1287 | |||
| 1288 | // Read results. | ||
| 1289 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1290 | ExitOnFailure(hr, "Failed to read API version of BAEngineLaunchApprovedExe results."); | ||
| 1291 | |||
| 1292 | // Execute. | ||
| 1293 | hr = ExternalEngineLaunchApprovedExe(pContext, reinterpret_cast<HWND>(args.hwndParent), args.wzApprovedExeForElevationId, args.wzArguments, args.dwWaitForInputIdleTimeout); | ||
| 1294 | ExitOnFailure(hr, "Failed to quit the engine."); | ||
| 1295 | |||
| 1296 | // Pack result. | ||
| 1297 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1298 | ExitOnFailure(hr, "Failed to write size of BAEngineLaunchApprovedExe struct."); | ||
| 1299 | |||
| 1300 | LExit: | ||
| 1301 | ReleaseStr(sczArguments); | ||
| 1302 | ReleaseStr(sczApprovedExeForElevationId); | ||
| 1303 | return hr; | ||
| 1304 | } | ||
| 1305 | |||
| 1306 | static HRESULT BAEngineSetUpdateSource( | ||
| 1307 | __in BAENGINE_CONTEXT* pContext, | ||
| 1308 | __in BUFF_READER* pReaderArgs, | ||
| 1309 | __in BUFF_READER* pReaderResults, | ||
| 1310 | __in BUFF_BUFFER* pBuffer | ||
| 1311 | ) | ||
| 1312 | { | ||
| 1313 | HRESULT hr = S_OK; | ||
| 1314 | BAENGINE_SETUPDATESOURCE_ARGS args = { }; | ||
| 1315 | BAENGINE_SETUPDATESOURCE_RESULTS results = { }; | ||
| 1316 | LPWSTR sczUrl = NULL; | ||
| 1317 | LPWSTR sczAuthorizationHeader = NULL; | ||
| 1318 | |||
| 1319 | // Read args. | ||
| 1320 | hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion); | ||
| 1321 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetUpdateSource args."); | ||
| 1322 | |||
| 1323 | hr = BuffReaderReadString(pReaderArgs, &sczUrl); | ||
| 1324 | ExitOnFailure(hr, "Failed to read url of BAEngineSetUpdateSource args."); | ||
| 1325 | |||
| 1326 | args.wzUrl = sczUrl; | ||
| 1327 | |||
| 1328 | hr = BuffReaderReadString(pReaderArgs, &sczAuthorizationHeader); | ||
| 1329 | ExitOnFailure(hr, "Failed to read authorization header of BAEngineSetUpdateSource args."); | ||
| 1330 | |||
| 1331 | args.wzAuthorizationHeader = sczAuthorizationHeader; | ||
| 1332 | |||
| 1333 | // Read results. | ||
| 1334 | hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion); | ||
| 1335 | ExitOnFailure(hr, "Failed to read API version of BAEngineSetUpdateSource results."); | ||
| 1336 | |||
| 1337 | // Execute. | ||
| 1338 | hr = ExternalEngineSetUpdateSource(pContext->pEngineState, args.wzUrl, args.wzAuthorizationHeader); | ||
| 1339 | ExitOnFailure(hr, "Failed to set update source in the engine."); | ||
| 1340 | |||
| 1341 | // Pack result. | ||
| 1342 | hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results)); | ||
| 1343 | ExitOnFailure(hr, "Failed to write size of BAEngineSetUpdateSource struct."); | ||
| 1344 | |||
| 1345 | LExit: | ||
| 1346 | ReleaseStr(sczAuthorizationHeader); | ||
| 1347 | ReleaseStr(sczUrl); | ||
| 1348 | |||
| 1349 | return hr; | ||
| 1350 | } | ||
| 1351 | |||
| 1352 | static HRESULT ParseArgsAndResults( | ||
| 1353 | __in_bcount(cbData) LPCBYTE pbData, | ||
| 1354 | __in SIZE_T cbData, | ||
| 1355 | __in BUFF_READER* pBufferArgs, | ||
| 1356 | __in BUFF_READER* pBufferResults | ||
| 1357 | ) | ||
| 1358 | { | ||
| 1359 | HRESULT hr = S_OK; | ||
| 1360 | SIZE_T iData = 0; | ||
| 1361 | DWORD dw = 0; | ||
| 1362 | |||
| 1363 | // Get the args reader size and point to the data just after the size. | ||
| 1364 | hr = BuffReadNumber(pbData, cbData, &iData, &dw); | ||
| 1365 | ExitOnFailure(hr, "Failed to parse size of args"); | ||
| 1366 | |||
| 1367 | pBufferArgs->pbData = pbData + iData; | ||
| 1368 | pBufferArgs->cbData = dw; | ||
| 1369 | pBufferArgs->iBuffer = 0; | ||
| 1370 | |||
| 1371 | // Get the results reader size and point to the data just after the size. | ||
| 1372 | hr = ::SIZETAdd(iData, dw, &iData); | ||
| 1373 | ExitOnFailure(hr, "Failed to advance index beyond args"); | ||
| 1374 | |||
| 1375 | hr = BuffReadNumber(pbData, cbData, &iData, &dw); | ||
| 1376 | ExitOnFailure(hr, "Failed to parse size of results"); | ||
| 1377 | |||
| 1378 | pBufferResults->pbData = pbData + iData; | ||
| 1379 | pBufferResults->cbData = dw; | ||
| 1380 | pBufferResults->iBuffer = 0; | ||
| 1381 | |||
| 1382 | LExit: | ||
| 1383 | return hr; | ||
| 1384 | } | ||
| 1385 | |||
| 1386 | HRESULT WINAPI EngineForApplicationProc( | ||
| 1387 | __in BAENGINE_CONTEXT* pContext, | ||
| 1388 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
| 1389 | __in_bcount(cbData) LPCBYTE pbData, | ||
| 1390 | __in SIZE_T cbData | ||
| 1391 | ) | ||
| 1392 | { | ||
| 1393 | HRESULT hr = S_OK; | ||
| 1394 | BUFF_READER readerArgs = { }; | ||
| 1395 | BUFF_READER readerResults = { }; | ||
| 1396 | BUFF_BUFFER bufferResponse = { }; | ||
| 1397 | |||
| 1398 | hr = ParseArgsAndResults(pbData, cbData, &readerArgs, &readerResults); | ||
| 1399 | if (SUCCEEDED(hr)) | ||
| 1400 | { | ||
| 1401 | switch (message) | ||
| 1402 | { | ||
| 1403 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT: | ||
| 1404 | hr = BAEngineGetPackageCount(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1405 | break; | ||
| 1406 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC: | ||
| 1407 | hr = BAEngineGetVariableNumeric(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1408 | break; | ||
| 1409 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING: | ||
| 1410 | hr = BAEngineGetVariableString(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1411 | break; | ||
| 1412 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION: | ||
| 1413 | hr = BAEngineGetVariableVersion(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1414 | break; | ||
| 1415 | case BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING: | ||
| 1416 | hr = BAEngineFormatString(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1417 | break; | ||
| 1418 | case BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING: | ||
| 1419 | hr = BAEngineEscapeString(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1420 | break; | ||
| 1421 | case BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION: | ||
| 1422 | hr = BAEngineEvaluateCondition(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1423 | break; | ||
| 1424 | case BOOTSTRAPPER_ENGINE_MESSAGE_LOG: | ||
| 1425 | hr = BAEngineLog(&readerArgs, &readerResults, &bufferResponse); | ||
| 1426 | break; | ||
| 1427 | case BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR: | ||
| 1428 | hr = BAEngineSendEmbeddedError(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1429 | break; | ||
| 1430 | case BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS: | ||
| 1431 | hr = BAEngineSendEmbeddedProgress(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1432 | break; | ||
| 1433 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE: | ||
| 1434 | hr = BAEngineSetUpdate(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1435 | break; | ||
| 1436 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE: | ||
| 1437 | hr = BAEngineSetLocalSource(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1438 | break; | ||
| 1439 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE: | ||
| 1440 | hr = BAEngineSetDownloadSource(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1441 | break; | ||
| 1442 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC: | ||
| 1443 | hr = BAEngineSetVariableNumeric(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1444 | break; | ||
| 1445 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING: | ||
| 1446 | hr = BAEngineSetVariableString(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1447 | break; | ||
| 1448 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION: | ||
| 1449 | hr = BAEngineSetVariableVersion(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1450 | break; | ||
| 1451 | case BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN: | ||
| 1452 | hr = BAEngineCloseSplashScreen(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1453 | break; | ||
| 1454 | case BOOTSTRAPPER_ENGINE_MESSAGE_DETECT: | ||
| 1455 | hr = BAEngineDetect(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1456 | break; | ||
| 1457 | case BOOTSTRAPPER_ENGINE_MESSAGE_PLAN: | ||
| 1458 | hr = BAEnginePlan(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1459 | break; | ||
| 1460 | case BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE: | ||
| 1461 | hr = BAEngineElevate(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1462 | break; | ||
| 1463 | case BOOTSTRAPPER_ENGINE_MESSAGE_APPLY: | ||
| 1464 | hr = BAEngineApply(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1465 | break; | ||
| 1466 | case BOOTSTRAPPER_ENGINE_MESSAGE_QUIT: | ||
| 1467 | hr = BAEngineQuit(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1468 | break; | ||
| 1469 | case BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE: | ||
| 1470 | hr = BAEngineLaunchApprovedExe(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1471 | break; | ||
| 1472 | case BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE: | ||
| 1473 | hr = BAEngineSetUpdateSource(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1474 | break; | ||
| 1475 | case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS: | ||
| 1476 | hr = BAEngineCompareVersions(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1477 | break; | ||
| 1478 | case BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE: | ||
| 1479 | hr = BAEngineGetRelatedBundleVariable(pContext, &readerArgs, &readerResults, &bufferResponse); | ||
| 1480 | break; | ||
| 1481 | default: | ||
| 1482 | hr = E_NOTIMPL; | ||
| 1483 | break; | ||
| 1484 | } | ||
| 1485 | } | ||
| 1486 | |||
| 1487 | hr = PipeRpcResponse(&pContext->hRpcPipe, message, hr, bufferResponse.pbData, bufferResponse.cbData); | ||
| 1488 | ExitOnFailure(hr, "Failed to send engine result to bootstrapper application."); | ||
| 1489 | |||
| 1490 | LExit: | ||
| 1491 | ReleaseBuffer(bufferResponse); | ||
| 1492 | return hr; | ||
| 1493 | } | ||
| 1494 | |||
| 1495 | static DWORD WINAPI BAEngineMessagePumpThreadProc( | ||
| 1496 | __in LPVOID lpThreadParameter | ||
| 1497 | ) | ||
| 1498 | { | ||
| 1499 | HRESULT hr = S_OK; | ||
| 1500 | BOOL fComInitialized = FALSE; | ||
| 1501 | BAENGINE_CONTEXT* pContext = reinterpret_cast<BAENGINE_CONTEXT*>(lpThreadParameter); | ||
| 1502 | PIPE_MESSAGE msg = { }; | ||
| 1503 | |||
| 1504 | // initialize COM | ||
| 1505 | hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); | ||
| 1506 | ExitOnFailure(hr, "Failed to initialize COM."); | ||
| 1507 | fComInitialized = TRUE; | ||
| 1508 | |||
| 1509 | // Pump messages from bootstrapper application for engine messages until the pipe is closed. | ||
| 1510 | while (S_OK == (hr = PipeRpcReadMessage(&pContext->hRpcPipe, &msg))) | ||
| 1511 | { | ||
| 1512 | EngineForApplicationProc(pContext, static_cast<BOOTSTRAPPER_ENGINE_MESSAGE>(msg.dwMessageType), reinterpret_cast<LPCBYTE>(msg.pvData), msg.cbData); | ||
| 1513 | |||
| 1514 | ReleasePipeMessage(&msg); | ||
| 1515 | } | ||
| 1516 | ExitOnFailure(hr, "Failed to get message over bootstrapper application pipe"); | ||
| 1517 | |||
| 1518 | if (S_FALSE == hr) | ||
| 1519 | { | ||
| 1520 | hr = S_OK; | ||
| 1521 | } | ||
| 1522 | |||
| 1523 | LExit: | ||
| 1524 | ReleasePipeMessage(&msg); | ||
| 1525 | |||
| 1526 | if (fComInitialized) | ||
| 1527 | { | ||
| 1528 | ::CoUninitialize(); | ||
| 1529 | } | ||
| 1530 | |||
| 1531 | return (DWORD)hr; | ||
| 1532 | } | ||
diff --git a/src/burn/engine/EngineForApplication.h b/src/burn/engine/baengine.h index bf86b7ee..97cfea9c 100644 --- a/src/burn/engine/EngineForApplication.h +++ b/src/burn/engine/baengine.h | |||
| @@ -8,15 +8,18 @@ extern "C" { | |||
| 8 | 8 | ||
| 9 | // structs | 9 | // structs |
| 10 | 10 | ||
| 11 | typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT | 11 | typedef struct _BAENGINE_CONTEXT |
| 12 | { | 12 | { |
| 13 | BURN_ENGINE_STATE* pEngineState; | 13 | BURN_ENGINE_STATE* pEngineState; |
| 14 | QUEUTIL_QUEUE_HANDLE hQueue; | 14 | QUEUTIL_QUEUE_HANDLE hQueue; |
| 15 | HANDLE hQueueSemaphore; | 15 | HANDLE hQueueSemaphore; |
| 16 | CRITICAL_SECTION csQueue; | 16 | CRITICAL_SECTION csQueue; |
| 17 | } BOOTSTRAPPER_ENGINE_CONTEXT; | ||
| 18 | 17 | ||
| 19 | typedef struct _BOOTSTRAPPER_ENGINE_ACTION | 18 | PIPE_RPC_HANDLE hRpcPipe; |
| 19 | HANDLE hThread; | ||
| 20 | } BAENGINE_CONTEXT; | ||
| 21 | |||
| 22 | typedef struct _BAENGINE_ACTION | ||
| 20 | { | 23 | { |
| 21 | WM_BURN dwMessage; | 24 | WM_BURN dwMessage; |
| 22 | union | 25 | union |
| @@ -43,16 +46,38 @@ typedef struct _BOOTSTRAPPER_ENGINE_ACTION | |||
| 43 | DWORD dwExitCode; | 46 | DWORD dwExitCode; |
| 44 | } quit; | 47 | } quit; |
| 45 | }; | 48 | }; |
| 46 | } BOOTSTRAPPER_ENGINE_ACTION; | 49 | } BAENGINE_ACTION; |
| 47 | 50 | ||
| 48 | // function declarations | 51 | // function declarations |
| 49 | 52 | ||
| 53 | HRESULT BAEngineCreateContext( | ||
| 54 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 55 | __inout BAENGINE_CONTEXT** ppContext | ||
| 56 | ); | ||
| 57 | |||
| 58 | void BAEngineFreeContext( | ||
| 59 | __in BAENGINE_CONTEXT* pContext | ||
| 60 | ); | ||
| 61 | |||
| 62 | void DAPI BAEngineFreeAction( | ||
| 63 | __in BAENGINE_ACTION* pAction | ||
| 64 | ); | ||
| 65 | |||
| 66 | HRESULT BAEngineStartListening( | ||
| 67 | __in BAENGINE_CONTEXT* pContext, | ||
| 68 | __in HANDLE hBAEnginePipe | ||
| 69 | ); | ||
| 70 | |||
| 71 | HRESULT BAEngineStopListening( | ||
| 72 | __in BAENGINE_CONTEXT * pContext | ||
| 73 | ); | ||
| 74 | |||
| 50 | HRESULT WINAPI EngineForApplicationProc( | 75 | HRESULT WINAPI EngineForApplicationProc( |
| 76 | __in BAENGINE_CONTEXT* pvContext, | ||
| 51 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | 77 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, |
| 52 | __in const LPVOID pvArgs, | 78 | __in_bcount(cbArgs) const LPVOID pvArgs, |
| 53 | __inout LPVOID pvResults, | 79 | __in DWORD /*cbArgs*/ |
| 54 | __in_opt LPVOID pvContext | 80 | ); |
| 55 | ); | ||
| 56 | 81 | ||
| 57 | #if defined(__cplusplus) | 82 | #if defined(__cplusplus) |
| 58 | } | 83 | } |
diff --git a/src/burn/engine/bootstrapperapplication.cpp b/src/burn/engine/bootstrapperapplication.cpp new file mode 100644 index 00000000..402f7015 --- /dev/null +++ b/src/burn/engine/bootstrapperapplication.cpp | |||
| @@ -0,0 +1,692 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | static const LPCWSTR BA_PIPE_NAME_FORMAT_STRING = L"%ls.BA"; | ||
| 6 | static const LPCWSTR ENGINE_PIPE_NAME_FORMAT_STRING = L"%ls.BAEngine"; | ||
| 7 | |||
| 8 | // internal function declarations | ||
| 9 | |||
| 10 | static HRESULT CreateBootstrapperApplicationPipes( | ||
| 11 | __in_z LPCWSTR wzBasePipeName, | ||
| 12 | __out HANDLE* phBAPipe, | ||
| 13 | __out HANDLE* phBAEnginePipe | ||
| 14 | ); | ||
| 15 | static HRESULT CreateBootstrapperApplicationProcess( | ||
| 16 | __in_z LPCWSTR wzBootstrapperApplicationPath, | ||
| 17 | __in int nCmdShow, | ||
| 18 | __in_z LPCWSTR wzPipeName, | ||
| 19 | __in_z LPCWSTR wzSecret, | ||
| 20 | __out HANDLE* phProcess | ||
| 21 | ); | ||
| 22 | static void Disconnect( | ||
| 23 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 24 | ); | ||
| 25 | static int FilterResult( | ||
| 26 | __in DWORD dwAllowedResults, | ||
| 27 | __in int nResult | ||
| 28 | ); | ||
| 29 | static HRESULT WaitForBootstrapperApplicationConnect( | ||
| 30 | __in HANDLE hBAProcess, | ||
| 31 | __in HANDLE hBAPipe, | ||
| 32 | __in HANDLE hBAEnginePipe, | ||
| 33 | __in_z LPCWSTR wzSecret | ||
| 34 | ); | ||
| 35 | static HRESULT VerifyPipeSecret( | ||
| 36 | __in HANDLE hPipe, | ||
| 37 | __in_z LPCWSTR wzSecret | ||
| 38 | ); | ||
| 39 | |||
| 40 | |||
| 41 | // function definitions | ||
| 42 | |||
| 43 | EXTERN_C HRESULT BootstrapperApplicationParseFromXml( | ||
| 44 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 45 | __in IXMLDOMNode* pixnBundle | ||
| 46 | ) | ||
| 47 | { | ||
| 48 | HRESULT hr = S_OK; | ||
| 49 | IXMLDOMNode* pixnUserExperienceNode = NULL; | ||
| 50 | LPWSTR sczPrimaryId = NULL; | ||
| 51 | LPWSTR sczSecondaryId = NULL; | ||
| 52 | BOOL fFoundSecondary = FALSE; | ||
| 53 | |||
| 54 | // select UX node | ||
| 55 | hr = XmlSelectSingleNode(pixnBundle, L"UX", &pixnUserExperienceNode); | ||
| 56 | if (S_FALSE == hr) | ||
| 57 | { | ||
| 58 | hr = E_NOTFOUND; | ||
| 59 | } | ||
| 60 | ExitOnFailure(hr, "Failed to select user experience node."); | ||
| 61 | |||
| 62 | // @PrimaryPayloadId | ||
| 63 | hr = XmlGetAttributeEx(pixnUserExperienceNode, L"PrimaryPayloadId", &sczPrimaryId); | ||
| 64 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @PrimaryPayloadId."); | ||
| 65 | |||
| 66 | // @SecondaryPayloadId | ||
| 67 | hr = XmlGetAttributeEx(pixnUserExperienceNode, L"SecondaryPayloadId", &sczSecondaryId); | ||
| 68 | ExitOnOptionalXmlQueryFailure(hr, fFoundSecondary, "Failed to get @SecondaryPayloadId."); | ||
| 69 | |||
| 70 | // parse payloads | ||
| 71 | hr = PayloadsParseFromXml(&pUserExperience->payloads, NULL, NULL, pixnUserExperienceNode); | ||
| 72 | ExitOnFailure(hr, "Failed to parse user experience payloads."); | ||
| 73 | |||
| 74 | // make sure we have at least one payload | ||
| 75 | if (0 == pUserExperience->payloads.cPayloads) | ||
| 76 | { | ||
| 77 | hr = E_UNEXPECTED; | ||
| 78 | ExitOnFailure(hr, "Too few UX payloads."); | ||
| 79 | } | ||
| 80 | |||
| 81 | // Find the primary and secondary bootstrapper application payloads. | ||
| 82 | for (DWORD i = 0; i < pUserExperience->payloads.cPayloads; ++i) | ||
| 83 | { | ||
| 84 | BURN_PAYLOAD* pPayload = pUserExperience->payloads.rgPayloads + i; | ||
| 85 | |||
| 86 | if (!pUserExperience->pPrimaryExePayload && CSTR_EQUAL == ::CompareStringOrdinal(pPayload->sczKey, -1, sczPrimaryId, -1, FALSE)) | ||
| 87 | { | ||
| 88 | pUserExperience->pPrimaryExePayload = pPayload; | ||
| 89 | } | ||
| 90 | else if (fFoundSecondary && !pUserExperience->pSecondaryExePayload && CSTR_EQUAL == ::CompareStringOrdinal(pPayload->sczKey, -1, sczSecondaryId, -1, FALSE)) | ||
| 91 | { | ||
| 92 | pUserExperience->pSecondaryExePayload = pPayload; | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | if (!pUserExperience->pPrimaryExePayload) | ||
| 97 | { | ||
| 98 | hr = E_UNEXPECTED; | ||
| 99 | ExitOnFailure(hr, "Failed to find primary bootstrapper application payload."); | ||
| 100 | } | ||
| 101 | |||
| 102 | LExit: | ||
| 103 | ReleaseStr(sczSecondaryId); | ||
| 104 | ReleaseStr(sczPrimaryId); | ||
| 105 | ReleaseObject(pixnUserExperienceNode); | ||
| 106 | |||
| 107 | return hr; | ||
| 108 | } | ||
| 109 | |||
| 110 | EXTERN_C void BootstrapperApplicationUninitialize( | ||
| 111 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 112 | ) | ||
| 113 | { | ||
| 114 | if (pUserExperience->pEngineContext) | ||
| 115 | { | ||
| 116 | BAEngineFreeContext(pUserExperience->pEngineContext); | ||
| 117 | pUserExperience->pEngineContext = NULL; | ||
| 118 | } | ||
| 119 | |||
| 120 | ReleaseStr(pUserExperience->sczTempDirectory); | ||
| 121 | PayloadsUninitialize(&pUserExperience->payloads); | ||
| 122 | |||
| 123 | // clear struct | ||
| 124 | memset(pUserExperience, 0, sizeof(BURN_USER_EXPERIENCE)); | ||
| 125 | } | ||
| 126 | |||
| 127 | EXTERN_C HRESULT BootstrapperApplicationStart( | ||
| 128 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 129 | __in BOOL fSecondary | ||
| 130 | ) | ||
| 131 | { | ||
| 132 | HRESULT hr = S_OK; | ||
| 133 | LPWSTR sczBasePipeName = NULL; | ||
| 134 | LPWSTR sczSecret = NULL; | ||
| 135 | HANDLE hBAPipe = INVALID_HANDLE_VALUE; | ||
| 136 | HANDLE hBAEnginePipe = INVALID_HANDLE_VALUE; | ||
| 137 | BAENGINE_CONTEXT* pEngineContext = NULL; | ||
| 138 | |||
| 139 | BURN_USER_EXPERIENCE* pUserExperience = &pEngineState->userExperience; | ||
| 140 | BOOTSTRAPPER_COMMAND* pCommand = &pEngineState->command; | ||
| 141 | LPCWSTR wzBootstrapperApplicationPath = fSecondary && pUserExperience->pSecondaryExePayload ? pUserExperience->pSecondaryExePayload->sczLocalFilePath : pUserExperience->pPrimaryExePayload->sczLocalFilePath; | ||
| 142 | |||
| 143 | if (!wzBootstrapperApplicationPath) | ||
| 144 | { | ||
| 145 | hr = E_UNEXPECTED; | ||
| 146 | ExitOnFailure(hr, "Failed to find bootstrapper application path."); | ||
| 147 | } | ||
| 148 | |||
| 149 | hr = BurnPipeCreateNameAndSecret(&sczBasePipeName, &sczSecret); | ||
| 150 | ExitOnFailure(hr, "Failed to create bootstrapper application pipename and secret"); | ||
| 151 | |||
| 152 | hr = CreateBootstrapperApplicationPipes(sczBasePipeName, &hBAPipe, &hBAEnginePipe); | ||
| 153 | ExitOnFailure(hr, "Failed to create bootstrapper application pipes"); | ||
| 154 | |||
| 155 | hr = CreateBootstrapperApplicationProcess(wzBootstrapperApplicationPath, pCommand->nCmdShow, sczBasePipeName, sczSecret, &pUserExperience->hBAProcess); | ||
| 156 | ExitOnFailure(hr, "Failed to create bootstrapper application process: %ls", wzBootstrapperApplicationPath); | ||
| 157 | |||
| 158 | hr = WaitForBootstrapperApplicationConnect(pUserExperience->hBAProcess, hBAPipe, hBAEnginePipe, sczSecret); | ||
| 159 | ExitOnFailure(hr, "Failed while waiting for bootstrapper application to connect."); | ||
| 160 | |||
| 161 | hr = BAEngineCreateContext(pEngineState, &pEngineContext); | ||
| 162 | ExitOnFailure(hr, "Failed to create bootstrapper application engine context."); | ||
| 163 | |||
| 164 | pUserExperience->pEngineContext = pEngineContext; | ||
| 165 | pEngineContext = NULL; | ||
| 166 | |||
| 167 | PipeRpcInitialize(&pUserExperience->hBARpcPipe, hBAPipe, TRUE); | ||
| 168 | hBAPipe = INVALID_HANDLE_VALUE; | ||
| 169 | |||
| 170 | hr = BAEngineStartListening(pUserExperience->pEngineContext, hBAEnginePipe); | ||
| 171 | ExitOnFailure(hr, "Failed to start listening to bootstrapper application engine pipe."); | ||
| 172 | |||
| 173 | hBAEnginePipe = INVALID_HANDLE_VALUE; | ||
| 174 | |||
| 175 | hr = BACallbackOnCreate(pUserExperience, pCommand); | ||
| 176 | ExitOnFailure(hr, "Failed to create bootstrapper application"); | ||
| 177 | |||
| 178 | LExit: | ||
| 179 | if (pEngineContext) | ||
| 180 | { | ||
| 181 | BAEngineFreeContext(pEngineContext); | ||
| 182 | pEngineContext = NULL; | ||
| 183 | } | ||
| 184 | |||
| 185 | ReleasePipeHandle(hBAEnginePipe); | ||
| 186 | ReleasePipeHandle(hBAPipe); | ||
| 187 | ReleaseStr(sczSecret); | ||
| 188 | ReleaseStr(sczBasePipeName); | ||
| 189 | |||
| 190 | return hr; | ||
| 191 | } | ||
| 192 | |||
| 193 | EXTERN_C HRESULT BootstrapperApplicationStop( | ||
| 194 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 195 | __inout BOOL* pfReload | ||
| 196 | ) | ||
| 197 | { | ||
| 198 | HRESULT hr = S_OK; | ||
| 199 | DWORD dwExitCode = ERROR_SUCCESS; | ||
| 200 | |||
| 201 | BACallbackOnDestroy(pUserExperience, *pfReload); | ||
| 202 | |||
| 203 | Disconnect(pUserExperience); | ||
| 204 | |||
| 205 | if (pUserExperience->pEngineContext) | ||
| 206 | { | ||
| 207 | BAEngineStopListening(pUserExperience->pEngineContext); | ||
| 208 | } | ||
| 209 | |||
| 210 | if (pUserExperience->hBAProcess) | ||
| 211 | { | ||
| 212 | hr = AppWaitForSingleObject(pUserExperience->hBAProcess, INFINITE); | ||
| 213 | |||
| 214 | ::GetExitCodeProcess(pUserExperience->hBAProcess, &dwExitCode); | ||
| 215 | |||
| 216 | ReleaseHandle(pUserExperience->hBAProcess); | ||
| 217 | } | ||
| 218 | |||
| 219 | // If the bootstrapper application process has already requested to reload, no need | ||
| 220 | // to check any further. But if the bootstrapper application process exited | ||
| 221 | // with anything but success then fallback to the other bootstrapper application. | ||
| 222 | // This should enable bootstrapper applications that fail to start due to missing | ||
| 223 | // prerequisites to fallback to the prerequisite bootstrapper application to install | ||
| 224 | // the necessary prerequisites. | ||
| 225 | if (!*pfReload) | ||
| 226 | { | ||
| 227 | *pfReload = (ERROR_SUCCESS != dwExitCode); | ||
| 228 | } | ||
| 229 | |||
| 230 | return hr; | ||
| 231 | } | ||
| 232 | |||
| 233 | EXTERN_C int BootstrapperApplicationCheckExecuteResult( | ||
| 234 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 235 | __in BOOL fRollback, | ||
| 236 | __in DWORD dwAllowedResults, | ||
| 237 | __in int nResult | ||
| 238 | ) | ||
| 239 | { | ||
| 240 | // Do not allow canceling while rolling back. | ||
| 241 | if (fRollback && (IDCANCEL == nResult || IDABORT == nResult)) | ||
| 242 | { | ||
| 243 | nResult = IDNOACTION; | ||
| 244 | } | ||
| 245 | else if (FAILED(pUserExperience->hrApplyError) && !fRollback) // if we failed cancel except not during rollback. | ||
| 246 | { | ||
| 247 | nResult = IDCANCEL; | ||
| 248 | } | ||
| 249 | |||
| 250 | nResult = FilterResult(dwAllowedResults, nResult); | ||
| 251 | |||
| 252 | return nResult; | ||
| 253 | } | ||
| 254 | |||
| 255 | EXTERN_C HRESULT BootstrapperApplicationInterpretExecuteResult( | ||
| 256 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 257 | __in BOOL fRollback, | ||
| 258 | __in DWORD dwAllowedResults, | ||
| 259 | __in int nResult | ||
| 260 | ) | ||
| 261 | { | ||
| 262 | HRESULT hr = S_OK; | ||
| 263 | |||
| 264 | // If we failed return that error unless this is rollback which should roll on. | ||
| 265 | if (FAILED(pUserExperience->hrApplyError) && !fRollback) | ||
| 266 | { | ||
| 267 | hr = pUserExperience->hrApplyError; | ||
| 268 | } | ||
| 269 | else | ||
| 270 | { | ||
| 271 | int nCheckedResult = BootstrapperApplicationCheckExecuteResult(pUserExperience, fRollback, dwAllowedResults, nResult); | ||
| 272 | hr = IDOK == nCheckedResult || IDNOACTION == nCheckedResult ? S_OK : IDCANCEL == nCheckedResult || IDABORT == nCheckedResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE); | ||
| 273 | } | ||
| 274 | |||
| 275 | return hr; | ||
| 276 | } | ||
| 277 | |||
| 278 | EXTERN_C HRESULT BootstrapperApplicationEnsureWorkingFolder( | ||
| 279 | __in BURN_CACHE* pCache, | ||
| 280 | __deref_out_z LPWSTR* psczUserExperienceWorkingFolder | ||
| 281 | ) | ||
| 282 | { | ||
| 283 | HRESULT hr = S_OK; | ||
| 284 | LPWSTR sczWorkingFolder = NULL; | ||
| 285 | |||
| 286 | hr = CacheEnsureBaseWorkingFolder(pCache, &sczWorkingFolder); | ||
| 287 | ExitOnFailure(hr, "Failed to create working folder."); | ||
| 288 | |||
| 289 | hr = StrAllocFormatted(psczUserExperienceWorkingFolder, L"%ls%ls\\", sczWorkingFolder, L".ba"); | ||
| 290 | ExitOnFailure(hr, "Failed to calculate the bootstrapper application working path."); | ||
| 291 | |||
| 292 | hr = DirEnsureExists(*psczUserExperienceWorkingFolder, NULL); | ||
| 293 | ExitOnFailure(hr, "Failed create bootstrapper application working folder."); | ||
| 294 | |||
| 295 | LExit: | ||
| 296 | ReleaseStr(sczWorkingFolder); | ||
| 297 | |||
| 298 | return hr; | ||
| 299 | } | ||
| 300 | |||
| 301 | |||
| 302 | EXTERN_C HRESULT BootstrapperApplicationRemove( | ||
| 303 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 304 | ) | ||
| 305 | { | ||
| 306 | HRESULT hr = S_OK; | ||
| 307 | |||
| 308 | // Remove temporary UX directory | ||
| 309 | if (pUserExperience->sczTempDirectory) | ||
| 310 | { | ||
| 311 | hr = DirEnsureDeleteEx(pUserExperience->sczTempDirectory, DIR_DELETE_FILES | DIR_DELETE_RECURSE | DIR_DELETE_SCHEDULE); | ||
| 312 | TraceError(hr, "Could not delete bootstrapper application folder. Some files will be left in the temp folder."); | ||
| 313 | } | ||
| 314 | |||
| 315 | //LExit: | ||
| 316 | return hr; | ||
| 317 | } | ||
| 318 | |||
| 319 | EXTERN_C int BootstrapperApplicationSendError( | ||
| 320 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 321 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
| 322 | __in_z_opt LPCWSTR wzPackageId, | ||
| 323 | __in HRESULT hrCode, | ||
| 324 | __in_z_opt LPCWSTR wzError, | ||
| 325 | __in DWORD uiFlags, | ||
| 326 | __in int nRecommendation | ||
| 327 | ) | ||
| 328 | { | ||
| 329 | int nResult = nRecommendation; | ||
| 330 | DWORD dwCode = HRESULT_CODE(hrCode); | ||
| 331 | LPWSTR sczError = NULL; | ||
| 332 | |||
| 333 | // If no error string was provided, try to get the error string from the HRESULT. | ||
| 334 | if (!wzError) | ||
| 335 | { | ||
| 336 | if (SUCCEEDED(StrAllocFromError(&sczError, hrCode, NULL))) | ||
| 337 | { | ||
| 338 | wzError = sczError; | ||
| 339 | } | ||
| 340 | } | ||
| 341 | |||
| 342 | BACallbackOnError(pUserExperience, errorType, wzPackageId, dwCode, wzError, uiFlags, 0, NULL, &nResult); // ignore return value. | ||
| 343 | |||
| 344 | ReleaseStr(sczError); | ||
| 345 | return nResult; | ||
| 346 | } | ||
| 347 | |||
| 348 | EXTERN_C void BootstrapperApplicationActivateEngine( | ||
| 349 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 350 | ) | ||
| 351 | { | ||
| 352 | ::EnterCriticalSection(&pUserExperience->csEngineActive); | ||
| 353 | AssertSz(!pUserExperience->fEngineActive, "Engine should have been deactivated before activating it."); | ||
| 354 | pUserExperience->fEngineActive = TRUE; | ||
| 355 | ::LeaveCriticalSection(&pUserExperience->csEngineActive); | ||
| 356 | } | ||
| 357 | |||
| 358 | EXTERN_C void BootstrapperApplicationDeactivateEngine( | ||
| 359 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 360 | ) | ||
| 361 | { | ||
| 362 | ::EnterCriticalSection(&pUserExperience->csEngineActive); | ||
| 363 | AssertSz(pUserExperience->fEngineActive, "Engine should have been active before deactivating it."); | ||
| 364 | pUserExperience->fEngineActive = FALSE; | ||
| 365 | ::LeaveCriticalSection(&pUserExperience->csEngineActive); | ||
| 366 | } | ||
| 367 | |||
| 368 | EXTERN_C HRESULT BootstrapperApplicationEnsureEngineInactive( | ||
| 369 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 370 | ) | ||
| 371 | { | ||
| 372 | // Make a slight optimization here by ignoring the critical section, because all callers should have needed to enter it for their operation anyway. | ||
| 373 | HRESULT hr = pUserExperience->fEngineActive ? HRESULT_FROM_WIN32(ERROR_BUSY) : S_OK; | ||
| 374 | ExitOnRootFailure(hr, "Engine is active, cannot proceed."); | ||
| 375 | |||
| 376 | LExit: | ||
| 377 | return hr; | ||
| 378 | } | ||
| 379 | |||
| 380 | EXTERN_C void BootstrapperApplicationExecuteReset( | ||
| 381 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 382 | ) | ||
| 383 | { | ||
| 384 | pUserExperience->hrApplyError = S_OK; | ||
| 385 | pUserExperience->hwndApply = NULL; | ||
| 386 | } | ||
| 387 | |||
| 388 | EXTERN_C void BootstrapperApplicationExecutePhaseComplete( | ||
| 389 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 390 | __in HRESULT hrResult | ||
| 391 | ) | ||
| 392 | { | ||
| 393 | if (FAILED(hrResult)) | ||
| 394 | { | ||
| 395 | pUserExperience->hrApplyError = hrResult; | ||
| 396 | } | ||
| 397 | } | ||
| 398 | |||
| 399 | |||
| 400 | // internal function definitions | ||
| 401 | |||
| 402 | static HRESULT CreateBootstrapperApplicationPipes( | ||
| 403 | __in_z LPCWSTR wzBasePipeName, | ||
| 404 | __out HANDLE* phBAPipe, | ||
| 405 | __out HANDLE* phBAEnginePipe | ||
| 406 | ) | ||
| 407 | { | ||
| 408 | HRESULT hr = S_OK; | ||
| 409 | LPWSTR sczPipeName = NULL; | ||
| 410 | HANDLE hBAPipe = INVALID_HANDLE_VALUE; | ||
| 411 | HANDLE hBAEnginePipe = INVALID_HANDLE_VALUE; | ||
| 412 | |||
| 413 | // Create the bootstrapper application pipe. | ||
| 414 | hr = StrAllocFormatted(&sczPipeName, BA_PIPE_NAME_FORMAT_STRING, wzBasePipeName); | ||
| 415 | ExitOnFailure(hr, "Failed to allocate full name of bootstrapper pipe: %ls", wzBasePipeName); | ||
| 416 | |||
| 417 | hr = PipeCreate(sczPipeName, NULL, &hBAPipe); | ||
| 418 | ExitOnFailure(hr, "Failed to create cache pipe: %ls", sczPipeName); | ||
| 419 | |||
| 420 | // Create the bootstrapper application's engine pipe. | ||
| 421 | hr = StrAllocFormatted(&sczPipeName, ENGINE_PIPE_NAME_FORMAT_STRING, wzBasePipeName); | ||
| 422 | ExitOnFailure(hr, "Failed to allocate full name of bootstrapper application engine pipe: %ls", wzBasePipeName); | ||
| 423 | |||
| 424 | hr = PipeCreate(sczPipeName, NULL, &hBAEnginePipe); | ||
| 425 | ExitOnFailure(hr, "Failed to create cache pipe: %ls", sczPipeName); | ||
| 426 | |||
| 427 | *phBAEnginePipe = hBAEnginePipe; | ||
| 428 | hBAEnginePipe = INVALID_HANDLE_VALUE; | ||
| 429 | |||
| 430 | *phBAPipe = hBAPipe; | ||
| 431 | hBAPipe = INVALID_HANDLE_VALUE; | ||
| 432 | |||
| 433 | LExit: | ||
| 434 | ReleasePipeHandle(hBAEnginePipe); | ||
| 435 | ReleasePipeHandle(hBAPipe); | ||
| 436 | |||
| 437 | return hr; | ||
| 438 | } | ||
| 439 | |||
| 440 | static HRESULT CreateBootstrapperApplicationProcess( | ||
| 441 | __in_z LPCWSTR wzBootstrapperApplicationPath, | ||
| 442 | __in int nCmdShow, | ||
| 443 | __in_z LPCWSTR wzPipeName, | ||
| 444 | __in_z LPCWSTR wzSecret, | ||
| 445 | __out HANDLE* phProcess | ||
| 446 | ) | ||
| 447 | { | ||
| 448 | HRESULT hr = S_OK; | ||
| 449 | LPWSTR sczParameters = NULL; | ||
| 450 | LPWSTR sczFullCommandLine = NULL; | ||
| 451 | PROCESS_INFORMATION pi = { }; | ||
| 452 | |||
| 453 | hr = StrAllocFormatted(&sczParameters, L"-%ls %llu -%ls %ls %ls", BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_API_VERSION, BOOTSTRAPPER_APPLICATION_API_VERSION, BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_PIPE_NAME, wzPipeName, wzSecret); | ||
| 454 | ExitOnFailure(hr, "Failed to allocate parameters for bootstrapper application process."); | ||
| 455 | |||
| 456 | hr = StrAllocFormattedSecure(&sczFullCommandLine, L"\"%ls\" %ls", wzBootstrapperApplicationPath, sczParameters); | ||
| 457 | ExitOnFailure(hr, "Failed to allocate full command-line for bootstrapper application process."); | ||
| 458 | |||
| 459 | hr = CoreCreateProcess(wzBootstrapperApplicationPath, sczFullCommandLine, FALSE, 0, NULL, static_cast<WORD>(nCmdShow), &pi); | ||
| 460 | ExitOnFailure(hr, "Failed to launch bootstrapper application process: %ls", sczFullCommandLine); | ||
| 461 | |||
| 462 | *phProcess = pi.hProcess; | ||
| 463 | pi.hProcess = NULL; | ||
| 464 | |||
| 465 | LExit: | ||
| 466 | ReleaseHandle(pi.hThread); | ||
| 467 | ReleaseHandle(pi.hProcess); | ||
| 468 | StrSecureZeroFreeString(sczFullCommandLine); | ||
| 469 | StrSecureZeroFreeString(sczParameters); | ||
| 470 | |||
| 471 | return hr; | ||
| 472 | } | ||
| 473 | |||
| 474 | static void Disconnect( | ||
| 475 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 476 | ) | ||
| 477 | { | ||
| 478 | if (PipeRpcInitialized(&pUserExperience->hBARpcPipe)) | ||
| 479 | { | ||
| 480 | PipeWriteDisconnect(pUserExperience->hBARpcPipe.hPipe); | ||
| 481 | |||
| 482 | PipeRpcUninitiailize(&pUserExperience->hBARpcPipe); | ||
| 483 | } | ||
| 484 | } | ||
| 485 | |||
| 486 | static int FilterResult( | ||
| 487 | __in DWORD dwAllowedResults, | ||
| 488 | __in int nResult | ||
| 489 | ) | ||
| 490 | { | ||
| 491 | if (IDNOACTION == nResult || IDERROR == nResult) // do nothing and errors pass through. | ||
| 492 | { | ||
| 493 | } | ||
| 494 | else | ||
| 495 | { | ||
| 496 | switch (dwAllowedResults) | ||
| 497 | { | ||
| 498 | case MB_OK: | ||
| 499 | nResult = IDOK; | ||
| 500 | break; | ||
| 501 | |||
| 502 | case MB_OKCANCEL: | ||
| 503 | if (IDOK == nResult || IDYES == nResult) | ||
| 504 | { | ||
| 505 | nResult = IDOK; | ||
| 506 | } | ||
| 507 | else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) | ||
| 508 | { | ||
| 509 | nResult = IDCANCEL; | ||
| 510 | } | ||
| 511 | else | ||
| 512 | { | ||
| 513 | nResult = IDNOACTION; | ||
| 514 | } | ||
| 515 | break; | ||
| 516 | |||
| 517 | case MB_ABORTRETRYIGNORE: | ||
| 518 | if (IDCANCEL == nResult || IDABORT == nResult) | ||
| 519 | { | ||
| 520 | nResult = IDABORT; | ||
| 521 | } | ||
| 522 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult) | ||
| 523 | { | ||
| 524 | nResult = IDRETRY; | ||
| 525 | } | ||
| 526 | else if (IDIGNORE == nResult) | ||
| 527 | { | ||
| 528 | nResult = IDIGNORE; | ||
| 529 | } | ||
| 530 | else | ||
| 531 | { | ||
| 532 | nResult = IDNOACTION; | ||
| 533 | } | ||
| 534 | break; | ||
| 535 | |||
| 536 | case MB_YESNO: | ||
| 537 | if (IDOK == nResult || IDYES == nResult) | ||
| 538 | { | ||
| 539 | nResult = IDYES; | ||
| 540 | } | ||
| 541 | else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) | ||
| 542 | { | ||
| 543 | nResult = IDNO; | ||
| 544 | } | ||
| 545 | else | ||
| 546 | { | ||
| 547 | nResult = IDNOACTION; | ||
| 548 | } | ||
| 549 | break; | ||
| 550 | |||
| 551 | case MB_YESNOCANCEL: | ||
| 552 | if (IDOK == nResult || IDYES == nResult) | ||
| 553 | { | ||
| 554 | nResult = IDYES; | ||
| 555 | } | ||
| 556 | else if (IDNO == nResult) | ||
| 557 | { | ||
| 558 | nResult = IDNO; | ||
| 559 | } | ||
| 560 | else if (IDCANCEL == nResult || IDABORT == nResult) | ||
| 561 | { | ||
| 562 | nResult = IDCANCEL; | ||
| 563 | } | ||
| 564 | else | ||
| 565 | { | ||
| 566 | nResult = IDNOACTION; | ||
| 567 | } | ||
| 568 | break; | ||
| 569 | |||
| 570 | case MB_RETRYCANCEL: | ||
| 571 | if (IDRETRY == nResult || IDTRYAGAIN == nResult) | ||
| 572 | { | ||
| 573 | nResult = IDRETRY; | ||
| 574 | } | ||
| 575 | else if (IDCANCEL == nResult || IDABORT == nResult) | ||
| 576 | { | ||
| 577 | nResult = IDABORT; | ||
| 578 | } | ||
| 579 | else | ||
| 580 | { | ||
| 581 | nResult = IDNOACTION; | ||
| 582 | } | ||
| 583 | break; | ||
| 584 | |||
| 585 | case MB_CANCELTRYCONTINUE: | ||
| 586 | if (IDCANCEL == nResult || IDABORT == nResult) | ||
| 587 | { | ||
| 588 | nResult = IDABORT; | ||
| 589 | } | ||
| 590 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult) | ||
| 591 | { | ||
| 592 | nResult = IDRETRY; | ||
| 593 | } | ||
| 594 | else if (IDCONTINUE == nResult || IDIGNORE == nResult) | ||
| 595 | { | ||
| 596 | nResult = IDCONTINUE; | ||
| 597 | } | ||
| 598 | else | ||
| 599 | { | ||
| 600 | nResult = IDNOACTION; | ||
| 601 | } | ||
| 602 | break; | ||
| 603 | |||
| 604 | case BURN_MB_RETRYTRYAGAIN: // custom return code. | ||
| 605 | if (IDRETRY != nResult && IDTRYAGAIN != nResult) | ||
| 606 | { | ||
| 607 | nResult = IDNOACTION; | ||
| 608 | } | ||
| 609 | break; | ||
| 610 | |||
| 611 | default: | ||
| 612 | AssertSz(FALSE, "Unknown allowed results."); | ||
| 613 | break; | ||
| 614 | } | ||
| 615 | } | ||
| 616 | |||
| 617 | return nResult; | ||
| 618 | } | ||
| 619 | |||
| 620 | static HRESULT WaitForBootstrapperApplicationConnect( | ||
| 621 | __in HANDLE hBAProcess, | ||
| 622 | __in HANDLE hBAPipe, | ||
| 623 | __in HANDLE hBAEnginePipe, | ||
| 624 | __in_z LPCWSTR wzSecret | ||
| 625 | ) | ||
| 626 | { | ||
| 627 | HRESULT hr = S_OK; | ||
| 628 | HANDLE hPipes[2] = { hBAPipe, hBAEnginePipe }; | ||
| 629 | |||
| 630 | for (DWORD i = 0; i < countof(hPipes); ++i) | ||
| 631 | { | ||
| 632 | HANDLE hPipe = hPipes[i]; | ||
| 633 | |||
| 634 | hr = PipeServerWaitForClientConnect(hBAProcess, hPipe); | ||
| 635 | ExitOnFailure(hr, "Failed to wait for bootstrapper application to connect to pipe."); | ||
| 636 | |||
| 637 | hr = VerifyPipeSecret(hPipe, wzSecret); | ||
| 638 | ExitOnFailure(hr, "Failed to verify bootstrapper application pipe"); | ||
| 639 | } | ||
| 640 | |||
| 641 | LExit: | ||
| 642 | return hr; | ||
| 643 | } | ||
| 644 | |||
| 645 | static HRESULT VerifyPipeSecret( | ||
| 646 | __in HANDLE hPipe, | ||
| 647 | __in_z LPCWSTR wzSecret | ||
| 648 | ) | ||
| 649 | { | ||
| 650 | HRESULT hr = S_OK; | ||
| 651 | HRESULT hrResponse = S_OK; | ||
| 652 | LPWSTR sczVerificationSecret = NULL; | ||
| 653 | DWORD cbVerificationSecret = 0; | ||
| 654 | |||
| 655 | // Read the verification secret. | ||
| 656 | hr = FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(&cbVerificationSecret), sizeof(cbVerificationSecret)); | ||
| 657 | ExitOnFailure(hr, "Failed to read size of verification secret from bootstrapper application pipe."); | ||
| 658 | |||
| 659 | if (255 < cbVerificationSecret / sizeof(WCHAR)) | ||
| 660 | { | ||
| 661 | hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA); | ||
| 662 | ExitOnRootFailure(hr, "Verification secret from bootstrapper application is too big."); | ||
| 663 | } | ||
| 664 | |||
| 665 | hr = StrAlloc(&sczVerificationSecret, cbVerificationSecret / sizeof(WCHAR) + 1); | ||
| 666 | ExitOnFailure(hr, "Failed to allocate buffer for bootstrapper application verification secret."); | ||
| 667 | |||
| 668 | FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(sczVerificationSecret), cbVerificationSecret); | ||
| 669 | ExitOnFailure(hr, "Failed to read verification secret from bootstrapper application pipe."); | ||
| 670 | |||
| 671 | // Verify the secrets match. | ||
| 672 | if (CSTR_EQUAL != ::CompareStringOrdinal(sczVerificationSecret, -1, wzSecret, -1, FALSE)) | ||
| 673 | { | ||
| 674 | hrResponse = HRESULT_FROM_WIN32(ERROR_INVALID_DATA); | ||
| 675 | } | ||
| 676 | |||
| 677 | // Send the response. | ||
| 678 | hr = FileWriteHandle(hPipe, reinterpret_cast<LPBYTE>(&hrResponse), sizeof(hrResponse)); | ||
| 679 | ExitOnFailure(hr, "Failed to write response to pipe."); | ||
| 680 | |||
| 681 | if (FAILED(hrResponse)) | ||
| 682 | { | ||
| 683 | hr = hrResponse; | ||
| 684 | ExitOnRootFailure(hr, "Verification secret from bootstrapper application does not match."); | ||
| 685 | } | ||
| 686 | |||
| 687 | LExit: | ||
| 688 | |||
| 689 | ReleaseStr(sczVerificationSecret); | ||
| 690 | |||
| 691 | return hr; | ||
| 692 | } | ||
diff --git a/src/burn/engine/bootstrapperapplication.h b/src/burn/engine/bootstrapperapplication.h new file mode 100644 index 00000000..c092fedf --- /dev/null +++ b/src/burn/engine/bootstrapperapplication.h | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | #pragma once | ||
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 3 | |||
| 4 | #define BAAPI HRESULT __stdcall | ||
| 5 | |||
| 6 | #if defined(__cplusplus) | ||
| 7 | extern "C" { | ||
| 8 | #endif | ||
| 9 | |||
| 10 | |||
| 11 | // constants | ||
| 12 | |||
| 13 | const DWORD BURN_MB_RETRYTRYAGAIN = 0x10; | ||
| 14 | const DWORD64 BOOTSTRAPPER_APPLICATION_API_VERSION = MAKEQWORDVERSION(2024, 1, 1, 0); | ||
| 15 | |||
| 16 | |||
| 17 | // structs | ||
| 18 | |||
| 19 | typedef struct _BURN_USER_EXPERIENCE | ||
| 20 | { | ||
| 21 | BURN_PAYLOADS payloads; | ||
| 22 | |||
| 23 | BURN_PAYLOAD* pPrimaryExePayload; | ||
| 24 | BURN_PAYLOAD* pSecondaryExePayload; | ||
| 25 | |||
| 26 | //HMODULE hUXModule; | ||
| 27 | //PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBAProc; | ||
| 28 | //LPVOID pvBAProcContext; | ||
| 29 | HANDLE hBAProcess; | ||
| 30 | PIPE_RPC_HANDLE hBARpcPipe; | ||
| 31 | BAENGINE_CONTEXT* pEngineContext; | ||
| 32 | |||
| 33 | LPWSTR sczTempDirectory; | ||
| 34 | |||
| 35 | CRITICAL_SECTION csEngineActive; // Changing the engine active state in the user experience must be | ||
| 36 | // syncronized through this critical section. | ||
| 37 | // Note: The engine must never do a UX callback while in this critical section. | ||
| 38 | |||
| 39 | BOOL fEngineActive; // Indicates that the engine is currently active with one of the execution | ||
| 40 | // steps (detect, plan, apply), and cannot accept requests from the UX. | ||
| 41 | // This flag should be cleared by the engine prior to UX callbacks that | ||
| 42 | // allow altering of the engine state. | ||
| 43 | |||
| 44 | HRESULT hrApplyError; // Tracks if an error occurs during apply that requires the cache or | ||
| 45 | // execute threads to bail. | ||
| 46 | |||
| 47 | HWND hwndApply; // The window handle provided at the beginning of Apply(). Only valid | ||
| 48 | // during apply. | ||
| 49 | |||
| 50 | HWND hwndDetect; // The window handle provided at the beginning of Detect(). Only valid | ||
| 51 | // during Detect. | ||
| 52 | |||
| 53 | DWORD dwExitCode; // Exit code returned by the user experience for the engine overall. | ||
| 54 | } BURN_USER_EXPERIENCE; | ||
| 55 | |||
| 56 | |||
| 57 | // functions | ||
| 58 | |||
| 59 | /******************************************************************* | ||
| 60 | BootstrapperApplicationParseFromXml - parses the bootstrapper application | ||
| 61 | data embedded in the bundle. | ||
| 62 | |||
| 63 | *******************************************************************/ | ||
| 64 | HRESULT BootstrapperApplicationParseFromXml( | ||
| 65 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 66 | __in IXMLDOMNode* pixnBundle | ||
| 67 | ); | ||
| 68 | |||
| 69 | /******************************************************************* | ||
| 70 | BootstrapperApplicationUninitialize - uninitializes the bootstrapper | ||
| 71 | application data. | ||
| 72 | |||
| 73 | *******************************************************************/ | ||
| 74 | void BootstrapperApplicationUninitialize( | ||
| 75 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 76 | ); | ||
| 77 | |||
| 78 | /******************************************************************* | ||
| 79 | BootstrapperApplicationStart - starts the bootstrapper application | ||
| 80 | process and creates the bootstrapper application in it. | ||
| 81 | |||
| 82 | *******************************************************************/ | ||
| 83 | HRESULT BootstrapperApplicationStart( | ||
| 84 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 85 | __in BOOL fSecondary | ||
| 86 | ); | ||
| 87 | |||
| 88 | /******************************************************************* | ||
| 89 | BootstrapperApplicationStop - destroys the bootstrapper application | ||
| 90 | in the bootstrapper application process, disconnects and waits | ||
| 91 | for the process to exit. | ||
| 92 | |||
| 93 | *******************************************************************/ | ||
| 94 | HRESULT BootstrapperApplicationStop( | ||
| 95 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 96 | __inout BOOL* pfReload | ||
| 97 | ); | ||
| 98 | |||
| 99 | int BootstrapperApplicationCheckExecuteResult( | ||
| 100 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 101 | __in BOOL fRollback, | ||
| 102 | __in DWORD dwAllowedResults, | ||
| 103 | __in int nResult | ||
| 104 | ); | ||
| 105 | |||
| 106 | HRESULT BootstrapperApplicationInterpretExecuteResult( | ||
| 107 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 108 | __in BOOL fRollback, | ||
| 109 | __in DWORD dwAllowedResults, | ||
| 110 | __in int nResult | ||
| 111 | ); | ||
| 112 | |||
| 113 | HRESULT BootstrapperApplicationEnsureWorkingFolder( | ||
| 114 | __in BURN_CACHE* pCache, | ||
| 115 | __deref_out_z LPWSTR* psczUserExperienceWorkingFolder | ||
| 116 | ); | ||
| 117 | |||
| 118 | HRESULT BootstrapperApplicationRemove( | ||
| 119 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 120 | ); | ||
| 121 | |||
| 122 | int BootstrapperApplicationSendError( | ||
| 123 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 124 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
| 125 | __in_z_opt LPCWSTR wzPackageId, | ||
| 126 | __in HRESULT hrCode, | ||
| 127 | __in_z_opt LPCWSTR wzError, | ||
| 128 | __in DWORD uiFlags, | ||
| 129 | __in int nRecommendation | ||
| 130 | ); | ||
| 131 | |||
| 132 | void BootstrapperApplicationActivateEngine( | ||
| 133 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 134 | ); | ||
| 135 | |||
| 136 | void BootstrapperApplicationDeactivateEngine( | ||
| 137 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 138 | ); | ||
| 139 | |||
| 140 | /******************************************************************** | ||
| 141 | BootstrapperApplicationEnsureEngineInactive - Verifies the engine is inactive. | ||
| 142 | The caller MUST enter the csActive critical section before calling. | ||
| 143 | |||
| 144 | *********************************************************************/ | ||
| 145 | HRESULT BootstrapperApplicationEnsureEngineInactive( | ||
| 146 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 147 | ); | ||
| 148 | |||
| 149 | void BootstrapperApplicationExecuteReset( | ||
| 150 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 151 | ); | ||
| 152 | |||
| 153 | void BootstrapperApplicationExecutePhaseComplete( | ||
| 154 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 155 | __in HRESULT hrResult | ||
| 156 | ); | ||
| 157 | |||
| 158 | #if defined(__cplusplus) | ||
| 159 | } | ||
| 160 | #endif | ||
diff --git a/src/burn/engine/bundlepackageengine.cpp b/src/burn/engine/bundlepackageengine.cpp index d3f59e5d..90262638 100644 --- a/src/burn/engine/bundlepackageengine.cpp +++ b/src/burn/engine/bundlepackageengine.cpp | |||
| @@ -719,7 +719,7 @@ static BUNDLE_QUERY_CALLBACK_RESULT CALLBACK QueryRelatedBundlesCallback( | |||
| 719 | result = BUNDLE_QUERY_CALLBACK_RESULT_CANCEL; | 719 | result = BUNDLE_QUERY_CALLBACK_RESULT_CANCEL; |
| 720 | 720 | ||
| 721 | // Pass to BA. | 721 | // Pass to BA. |
| 722 | hr = UserExperienceOnDetectRelatedBundlePackage(pContext->pUserExperience, pPackage->sczId, pBundle->wzBundleId, relationType, fPerMachine, pVersion); | 722 | hr = BACallbackOnDetectRelatedBundlePackage(pContext->pUserExperience, pPackage->sczId, pBundle->wzBundleId, relationType, fPerMachine, pVersion); |
| 723 | ExitOnRootFailure(hr, "BA aborted detect related BUNDLE package."); | 723 | ExitOnRootFailure(hr, "BA aborted detect related BUNDLE package."); |
| 724 | 724 | ||
| 725 | result = BUNDLE_QUERY_CALLBACK_RESULT_CONTINUE; | 725 | result = BUNDLE_QUERY_CALLBACK_RESULT_CONTINUE; |
diff --git a/src/burn/engine/burnpipe.cpp b/src/burn/engine/burnpipe.cpp index d106e7ae..25d602b1 100644 --- a/src/burn/engine/burnpipe.cpp +++ b/src/burn/engine/burnpipe.cpp | |||
| @@ -305,7 +305,7 @@ extern "C" HRESULT BurnPipeWaitForChildConnect( | |||
| 305 | { | 305 | { |
| 306 | HANDLE hPipe = hPipes[i]; | 306 | HANDLE hPipe = hPipes[i]; |
| 307 | 307 | ||
| 308 | hr = PipeServerWaitForClientConnect(hPipe); | 308 | hr = PipeServerWaitForClientConnect(pConnection->hProcess, hPipe); |
| 309 | ExitOnRootFailure(hr, "Failed to wait for child to connect to pipe."); | 309 | ExitOnRootFailure(hr, "Failed to wait for child to connect to pipe."); |
| 310 | 310 | ||
| 311 | // Prove we are the one that created the elevated process by passing the secret. | 311 | // Prove we are the one that created the elevated process by passing the secret. |
| @@ -355,7 +355,7 @@ extern "C" HRESULT BurnPipeTerminateLoggingPipe( | |||
| 355 | ExitOnFailure(hr, "Failed to post complete message to logging pipe."); | 355 | ExitOnFailure(hr, "Failed to post complete message to logging pipe."); |
| 356 | 356 | ||
| 357 | LExit: | 357 | LExit: |
| 358 | ReleaseBuffer(pbData); | 358 | ReleaseMem(pbData); |
| 359 | 359 | ||
| 360 | return hr; | 360 | return hr; |
| 361 | } | 361 | } |
| @@ -419,7 +419,7 @@ extern "C" HRESULT BurnPipeTerminateChildProcess( | |||
| 419 | #endif | 419 | #endif |
| 420 | 420 | ||
| 421 | LExit: | 421 | LExit: |
| 422 | ReleaseBuffer(pbData); | 422 | ReleaseMem(pbData); |
| 423 | 423 | ||
| 424 | return hr; | 424 | return hr; |
| 425 | } | 425 | } |
diff --git a/src/burn/engine/cache.cpp b/src/burn/engine/cache.cpp index 251cd24b..c0ac3ecd 100644 --- a/src/burn/engine/cache.cpp +++ b/src/burn/engine/cache.cpp | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #include "precomp.h" | 3 | #include "precomp.h" |
| 4 | 4 | ||
| 5 | static const LPCWSTR BUNDLE_CLEAN_ROOM_WORKING_FOLDER_NAME = L".cr"; | ||
| 6 | static const LPCWSTR BUNDLE_WORKING_FOLDER_NAME = L".be"; | 5 | static const LPCWSTR BUNDLE_WORKING_FOLDER_NAME = L".be"; |
| 7 | static const LPCWSTR UNVERIFIED_CACHE_FOLDER_NAME = L".unverified"; | 6 | static const LPCWSTR UNVERIFIED_CACHE_FOLDER_NAME = L".unverified"; |
| 8 | static const LPCWSTR PACKAGE_CACHE_FOLDER_NAME = L"Package Cache"; | 7 | static const LPCWSTR PACKAGE_CACHE_FOLDER_NAME = L"Package Cache"; |
| @@ -242,8 +241,7 @@ LExit: | |||
| 242 | extern "C" HRESULT CacheInitializeSources( | 241 | extern "C" HRESULT CacheInitializeSources( |
| 243 | __in BURN_CACHE* pCache, | 242 | __in BURN_CACHE* pCache, |
| 244 | __in BURN_REGISTRATION* pRegistration, | 243 | __in BURN_REGISTRATION* pRegistration, |
| 245 | __in BURN_VARIABLES* pVariables, | 244 | __in BURN_VARIABLES* pVariables |
| 246 | __in BURN_ENGINE_COMMAND* pInternalCommand | ||
| 247 | ) | 245 | ) |
| 248 | { | 246 | { |
| 249 | Assert(!pCache->fInitializedCacheSources); | 247 | Assert(!pCache->fInitializedCacheSources); |
| @@ -255,7 +253,6 @@ extern "C" HRESULT CacheInitializeSources( | |||
| 255 | LPWSTR sczOriginalSource = NULL; | 253 | LPWSTR sczOriginalSource = NULL; |
| 256 | LPWSTR sczOriginalSourceFolder = NULL; | 254 | LPWSTR sczOriginalSourceFolder = NULL; |
| 257 | BOOL fPathEqual = FALSE; | 255 | BOOL fPathEqual = FALSE; |
| 258 | LPCWSTR wzSourceProcessPath = pInternalCommand->sczSourceProcessPath; | ||
| 259 | 256 | ||
| 260 | hr = PathForCurrentProcess(&sczCurrentPath, NULL); | 257 | hr = PathForCurrentProcess(&sczCurrentPath, NULL); |
| 261 | ExitOnFailure(hr, "Failed to get current process path."); | 258 | ExitOnFailure(hr, "Failed to get current process path."); |
| @@ -272,15 +269,7 @@ extern "C" HRESULT CacheInitializeSources( | |||
| 272 | 269 | ||
| 273 | pCache->fRunningFromCache = fPathEqual; | 270 | pCache->fRunningFromCache = fPathEqual; |
| 274 | 271 | ||
| 275 | // If a source process path was not provided (e.g. we are not being | 272 | hr = PathGetDirectory(sczCurrentPath, &pCache->sczSourceProcessFolder); |
| 276 | // run in a clean room) then use the current process path as the | ||
| 277 | // source process path. | ||
| 278 | if (!wzSourceProcessPath) | ||
| 279 | { | ||
| 280 | wzSourceProcessPath = sczCurrentPath; | ||
| 281 | } | ||
| 282 | |||
| 283 | hr = PathGetDirectory(wzSourceProcessPath, &pCache->sczSourceProcessFolder); | ||
| 284 | ExitOnFailure(hr, "Failed to initialize cache source folder."); | 273 | ExitOnFailure(hr, "Failed to initialize cache source folder."); |
| 285 | 274 | ||
| 286 | // If we're not running from the cache, ensure the original source is set. | 275 | // If we're not running from the cache, ensure the original source is set. |
| @@ -288,15 +277,14 @@ extern "C" HRESULT CacheInitializeSources( | |||
| 288 | { | 277 | { |
| 289 | // If the original source has not been set already then set it where the bundle is | 278 | // If the original source has not been set already then set it where the bundle is |
| 290 | // running from right now. This value will be persisted and we'll use it when launched | 279 | // running from right now. This value will be persisted and we'll use it when launched |
| 291 | // from the clean room or package cache since none of our packages will be relative to | 280 | // from the package cache since none of our packages will be relative to those locations. |
| 292 | // those locations. | ||
| 293 | hr = VariableGetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, &sczOriginalSource); | 281 | hr = VariableGetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, &sczOriginalSource); |
| 294 | if (E_NOTFOUND == hr) | 282 | if (E_NOTFOUND == hr) |
| 295 | { | 283 | { |
| 296 | hr = VariableSetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, wzSourceProcessPath, FALSE, FALSE); | 284 | hr = VariableSetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, sczCurrentPath, FALSE, FALSE); |
| 297 | ExitOnFailure(hr, "Failed to set original source variable."); | 285 | ExitOnFailure(hr, "Failed to set original source variable."); |
| 298 | 286 | ||
| 299 | hr = StrAllocString(&sczOriginalSource, wzSourceProcessPath, 0); | 287 | hr = StrAllocString(&sczOriginalSource, sczCurrentPath, 0); |
| 300 | ExitOnFailure(hr, "Failed to copy current path to original source."); | 288 | ExitOnFailure(hr, "Failed to copy current path to original source."); |
| 301 | } | 289 | } |
| 302 | 290 | ||
| @@ -899,30 +887,6 @@ extern "C" HRESULT CachePreparePackage( | |||
| 899 | return hr; | 887 | return hr; |
| 900 | } | 888 | } |
| 901 | 889 | ||
| 902 | extern "C" HRESULT CacheBundleToCleanRoom( | ||
| 903 | __in BURN_CACHE* pCache, | ||
| 904 | __in BURN_SECTION* pSection, | ||
| 905 | __deref_out_z_opt LPWSTR* psczCleanRoomBundlePath | ||
| 906 | ) | ||
| 907 | { | ||
| 908 | HRESULT hr = S_OK; | ||
| 909 | LPWSTR sczSourcePath = NULL; | ||
| 910 | LPWSTR wzExecutableName = NULL; | ||
| 911 | |||
| 912 | hr = PathForCurrentProcess(&sczSourcePath, NULL); | ||
| 913 | ExitOnFailure(hr, "Failed to get current path for process to cache to clean room."); | ||
| 914 | |||
| 915 | wzExecutableName = PathFile(sczSourcePath); | ||
| 916 | |||
| 917 | hr = CopyEngineToWorkingFolder(pCache, sczSourcePath, BUNDLE_CLEAN_ROOM_WORKING_FOLDER_NAME, wzExecutableName, pSection, psczCleanRoomBundlePath); | ||
| 918 | ExitOnFailure(hr, "Failed to cache bundle to clean room."); | ||
| 919 | |||
| 920 | LExit: | ||
| 921 | ReleaseStr(sczSourcePath); | ||
| 922 | |||
| 923 | return hr; | ||
| 924 | } | ||
| 925 | |||
| 926 | extern "C" HRESULT CacheBundleToWorkingDirectory( | 890 | extern "C" HRESULT CacheBundleToWorkingDirectory( |
| 927 | __in BURN_CACHE* pCache, | 891 | __in BURN_CACHE* pCache, |
| 928 | __in_z LPCWSTR wzExecutableName, | 892 | __in_z LPCWSTR wzExecutableName, |
diff --git a/src/burn/engine/cache.h b/src/burn/engine/cache.h index cc28166e..3f0ba749 100644 --- a/src/burn/engine/cache.h +++ b/src/burn/engine/cache.h | |||
| @@ -90,8 +90,7 @@ HRESULT CacheInitialize( | |||
| 90 | HRESULT CacheInitializeSources( | 90 | HRESULT CacheInitializeSources( |
| 91 | __in BURN_CACHE* pCache, | 91 | __in BURN_CACHE* pCache, |
| 92 | __in BURN_REGISTRATION* pRegistration, | 92 | __in BURN_REGISTRATION* pRegistration, |
| 93 | __in BURN_VARIABLES* pVariables, | 93 | __in BURN_VARIABLES* pVariables |
| 94 | __in BURN_ENGINE_COMMAND* pInternalCommand | ||
| 95 | ); | 94 | ); |
| 96 | HRESULT CacheEnsureAcquisitionFolder( | 95 | HRESULT CacheEnsureAcquisitionFolder( |
| 97 | __in BURN_CACHE* pCache | 96 | __in BURN_CACHE* pCache |
| @@ -171,11 +170,6 @@ HRESULT CachePreparePackage( | |||
| 171 | __in BURN_CACHE* pCache, | 170 | __in BURN_CACHE* pCache, |
| 172 | __in BURN_PACKAGE* pPackage | 171 | __in BURN_PACKAGE* pPackage |
| 173 | ); | 172 | ); |
| 174 | HRESULT CacheBundleToCleanRoom( | ||
| 175 | __in BURN_CACHE* pCache, | ||
| 176 | __in BURN_SECTION* pSection, | ||
| 177 | __deref_out_z_opt LPWSTR* psczCleanRoomBundlePath | ||
| 178 | ); | ||
| 179 | HRESULT CacheBundleToWorkingDirectory( | 173 | HRESULT CacheBundleToWorkingDirectory( |
| 180 | __in BURN_CACHE* pCache, | 174 | __in BURN_CACHE* pCache, |
| 181 | __in_z LPCWSTR wzExecutableName, | 175 | __in_z LPCWSTR wzExecutableName, |
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index ca2e41c2..ae74fdfd 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
| @@ -43,11 +43,6 @@ static HRESULT EscapeAndAppendArgumentToCommandLineFormattedArgs( | |||
| 43 | __in __format_string LPCWSTR wzFormat, | 43 | __in __format_string LPCWSTR wzFormat, |
| 44 | __in va_list args | 44 | __in va_list args |
| 45 | ); | 45 | ); |
| 46 | static HRESULT AppendLayoutToCommandLine( | ||
| 47 | __in BOOTSTRAPPER_ACTION action, | ||
| 48 | __in_z LPCWSTR wzLayoutDirectory, | ||
| 49 | __deref_inout_z LPWSTR* psczCommandLine | ||
| 50 | ); | ||
| 51 | static HRESULT GetSanitizedCommandLine( | 46 | static HRESULT GetSanitizedCommandLine( |
| 52 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 47 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| 53 | __in BOOTSTRAPPER_COMMAND* pCommand, | 48 | __in BOOTSTRAPPER_COMMAND* pCommand, |
| @@ -151,18 +146,6 @@ extern "C" HRESULT CoreInitialize( | |||
| 151 | ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable."); | 146 | ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable."); |
| 152 | } | 147 | } |
| 153 | 148 | ||
| 154 | if (pEngineState->internalCommand.sczSourceProcessPath) | ||
| 155 | { | ||
| 156 | hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_PATH, pEngineState->internalCommand.sczSourceProcessPath, TRUE, FALSE); | ||
| 157 | ExitOnFailure(hr, "Failed to set source process path variable."); | ||
| 158 | |||
| 159 | hr = PathGetDirectory(pEngineState->internalCommand.sczSourceProcessPath, &sczSourceProcessFolder); | ||
| 160 | ExitOnFailure(hr, "Failed to get source process folder from path."); | ||
| 161 | |||
| 162 | hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_FOLDER, sczSourceProcessFolder, TRUE, FALSE); | ||
| 163 | ExitOnFailure(hr, "Failed to set source process folder variable."); | ||
| 164 | } | ||
| 165 | |||
| 166 | // Set BURN_BUNDLE_ORIGINAL_SOURCE, if it was passed in on the command line. | 149 | // Set BURN_BUNDLE_ORIGINAL_SOURCE, if it was passed in on the command line. |
| 167 | // Needs to be done after ManifestLoadXmlFromBuffer. | 150 | // Needs to be done after ManifestLoadXmlFromBuffer. |
| 168 | if (pEngineState->internalCommand.sczOriginalSource) | 151 | if (pEngineState->internalCommand.sczOriginalSource) |
| @@ -171,9 +154,9 @@ extern "C" HRESULT CoreInitialize( | |||
| 171 | ExitOnFailure(hr, "Failed to set original source variable."); | 154 | ExitOnFailure(hr, "Failed to set original source variable."); |
| 172 | } | 155 | } |
| 173 | 156 | ||
| 174 | if (BURN_MODE_UNTRUSTED == pEngineState->internalCommand.mode || BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) | 157 | if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) |
| 175 | { | 158 | { |
| 176 | hr = CacheInitializeSources(&pEngineState->cache, &pEngineState->registration, &pEngineState->variables, &pEngineState->internalCommand); | 159 | hr = CacheInitializeSources(&pEngineState->cache, &pEngineState->registration, &pEngineState->variables); |
| 177 | ExitOnFailure(hr, "Failed to initialize internal cache source functionality."); | 160 | ExitOnFailure(hr, "Failed to initialize internal cache source functionality."); |
| 178 | } | 161 | } |
| 179 | 162 | ||
| @@ -182,7 +165,7 @@ extern "C" HRESULT CoreInitialize( | |||
| 182 | if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) | 165 | if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) |
| 183 | { | 166 | { |
| 184 | // Extract all UX payloads to working folder. | 167 | // Extract all UX payloads to working folder. |
| 185 | hr = UserExperienceEnsureWorkingFolder(&pEngineState->cache, &pEngineState->userExperience.sczTempDirectory); | 168 | hr = BootstrapperApplicationEnsureWorkingFolder(&pEngineState->cache, &pEngineState->userExperience.sczTempDirectory); |
| 186 | ExitOnFailure(hr, "Failed to get unique temporary folder for bootstrapper application."); | 169 | ExitOnFailure(hr, "Failed to get unique temporary folder for bootstrapper application."); |
| 187 | 170 | ||
| 188 | hr = PayloadExtractUXContainer(&pEngineState->userExperience.payloads, &containerContext, pEngineState->userExperience.sczTempDirectory); | 171 | hr = PayloadExtractUXContainer(&pEngineState->userExperience.payloads, &containerContext, pEngineState->userExperience.sczTempDirectory); |
| @@ -297,7 +280,7 @@ extern "C" HRESULT CoreQueryRegistration( | |||
| 297 | } | 280 | } |
| 298 | 281 | ||
| 299 | LExit: | 282 | LExit: |
| 300 | ReleaseBuffer(pbBuffer); | 283 | ReleaseMem(pbBuffer); |
| 301 | 284 | ||
| 302 | return hr; | 285 | return hr; |
| 303 | } | 286 | } |
| @@ -324,7 +307,7 @@ extern "C" HRESULT CoreDetect( | |||
| 324 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); | 307 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); |
| 325 | 308 | ||
| 326 | fDetectBegan = TRUE; | 309 | fDetectBegan = TRUE; |
| 327 | hr = UserExperienceOnDetectBegin(&pEngineState->userExperience, pEngineState->registration.fCached, pEngineState->registration.detectedRegistrationType, pEngineState->packages.cPackages); | 310 | hr = BACallbackOnDetectBegin(&pEngineState->userExperience, pEngineState->registration.fCached, pEngineState->registration.detectedRegistrationType, pEngineState->packages.cPackages); |
| 328 | ExitOnRootFailure(hr, "UX aborted detect begin."); | 311 | ExitOnRootFailure(hr, "UX aborted detect begin."); |
| 329 | 312 | ||
| 330 | pEngineState->userExperience.hwndDetect = hwndParent; | 313 | pEngineState->userExperience.hwndDetect = hwndParent; |
| @@ -429,7 +412,7 @@ LExit: | |||
| 429 | 412 | ||
| 430 | if (fDetectBegan) | 413 | if (fDetectBegan) |
| 431 | { | 414 | { |
| 432 | UserExperienceOnDetectComplete(&pEngineState->userExperience, hr, pEngineState->registration.fEligibleForCleanup); | 415 | BACallbackOnDetectComplete(&pEngineState->userExperience, hr, pEngineState->registration.fEligibleForCleanup); |
| 433 | } | 416 | } |
| 434 | 417 | ||
| 435 | pEngineState->userExperience.hwndDetect = NULL; | 418 | pEngineState->userExperience.hwndDetect = NULL; |
| @@ -453,7 +436,7 @@ extern "C" HRESULT CorePlan( | |||
| 453 | LogId(REPORT_STANDARD, MSG_PLAN_BEGIN, pEngineState->packages.cPackages, LoggingBurnActionToString(action)); | 436 | LogId(REPORT_STANDARD, MSG_PLAN_BEGIN, pEngineState->packages.cPackages, LoggingBurnActionToString(action)); |
| 454 | 437 | ||
| 455 | fPlanBegan = TRUE; | 438 | fPlanBegan = TRUE; |
| 456 | hr = UserExperienceOnPlanBegin(&pEngineState->userExperience, pEngineState->packages.cPackages); | 439 | hr = BACallbackOnPlanBegin(&pEngineState->userExperience, pEngineState->packages.cPackages); |
| 457 | ExitOnRootFailure(hr, "BA aborted plan begin."); | 440 | ExitOnRootFailure(hr, "BA aborted plan begin."); |
| 458 | 441 | ||
| 459 | if (!pEngineState->fDetected) | 442 | if (!pEngineState->fDetected) |
| @@ -583,7 +566,7 @@ LExit: | |||
| 583 | 566 | ||
| 584 | if (fPlanBegan) | 567 | if (fPlanBegan) |
| 585 | { | 568 | { |
| 586 | UserExperienceOnPlanComplete(&pEngineState->userExperience, hr); | 569 | BACallbackOnPlanComplete(&pEngineState->userExperience, hr); |
| 587 | } | 570 | } |
| 588 | 571 | ||
| 589 | LogId(REPORT_STANDARD, MSG_PLAN_COMPLETE, hr); | 572 | LogId(REPORT_STANDARD, MSG_PLAN_COMPLETE, hr); |
| @@ -674,13 +657,13 @@ extern "C" HRESULT CoreApply( | |||
| 674 | ++dwPhaseCount; | 657 | ++dwPhaseCount; |
| 675 | } | 658 | } |
| 676 | 659 | ||
| 677 | hr = UserExperienceOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); | 660 | hr = BACallbackOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); |
| 678 | ExitOnRootFailure(hr, "BA aborted apply begin."); | 661 | ExitOnRootFailure(hr, "BA aborted apply begin."); |
| 679 | 662 | ||
| 680 | if (pEngineState->plan.fDowngrade) | 663 | if (pEngineState->plan.fDowngrade) |
| 681 | { | 664 | { |
| 682 | hr = HRESULT_FROM_WIN32(ERROR_PRODUCT_VERSION); | 665 | hr = HRESULT_FROM_WIN32(ERROR_PRODUCT_VERSION); |
| 683 | UserExperienceOnApplyDowngrade(&pEngineState->userExperience, &hr); | 666 | BACallbackOnApplyDowngrade(&pEngineState->userExperience, &hr); |
| 684 | 667 | ||
| 685 | ExitFunction(); | 668 | ExitFunction(); |
| 686 | } | 669 | } |
| @@ -767,7 +750,7 @@ extern "C" HRESULT CoreApply( | |||
| 767 | if (pEngineState->plan.cExecuteActions) | 750 | if (pEngineState->plan.cExecuteActions) |
| 768 | { | 751 | { |
| 769 | hr = ApplyExecute(pEngineState, &applyContext, &fSuspend, &restart); | 752 | hr = ApplyExecute(pEngineState, &applyContext, &fSuspend, &restart); |
| 770 | UserExperienceExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that execute completed. | 753 | BootstrapperApplicationExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that execute completed. |
| 771 | } | 754 | } |
| 772 | 755 | ||
| 773 | // Wait for cache thread to terminate, this should return immediately unless we're waiting for layout to complete. | 756 | // Wait for cache thread to terminate, this should return immediately unless we're waiting for layout to complete. |
| @@ -847,7 +830,7 @@ LExit: | |||
| 847 | 830 | ||
| 848 | if (fApplyBegan) | 831 | if (fApplyBegan) |
| 849 | { | 832 | { |
| 850 | UserExperienceOnApplyComplete(&pEngineState->userExperience, hr, restart, &applyCompleteAction); | 833 | BACallbackOnApplyComplete(&pEngineState->userExperience, hr, restart, &applyCompleteAction); |
| 851 | if (BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART == applyCompleteAction) | 834 | if (BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART == applyCompleteAction) |
| 852 | { | 835 | { |
| 853 | pEngineState->fRestart = TRUE; | 836 | pEngineState->fRestart = TRUE; |
| @@ -869,7 +852,7 @@ extern "C" HRESULT CoreLaunchApprovedExe( | |||
| 869 | 852 | ||
| 870 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_BEGIN, pLaunchApprovedExe->sczId); | 853 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_BEGIN, pLaunchApprovedExe->sczId); |
| 871 | 854 | ||
| 872 | hr = UserExperienceOnLaunchApprovedExeBegin(&pEngineState->userExperience); | 855 | hr = BACallbackOnLaunchApprovedExeBegin(&pEngineState->userExperience); |
| 873 | ExitOnRootFailure(hr, "BA aborted LaunchApprovedExe begin."); | 856 | ExitOnRootFailure(hr, "BA aborted LaunchApprovedExe begin."); |
| 874 | 857 | ||
| 875 | // Elevate. | 858 | // Elevate. |
| @@ -880,7 +863,7 @@ extern "C" HRESULT CoreLaunchApprovedExe( | |||
| 880 | hr = ElevationLaunchApprovedExe(pEngineState->companionConnection.hPipe, pLaunchApprovedExe, &dwProcessId); | 863 | hr = ElevationLaunchApprovedExe(pEngineState->companionConnection.hPipe, pLaunchApprovedExe, &dwProcessId); |
| 881 | 864 | ||
| 882 | LExit: | 865 | LExit: |
| 883 | UserExperienceOnLaunchApprovedExeComplete(&pEngineState->userExperience, hr, dwProcessId); | 866 | BACallbackOnLaunchApprovedExeComplete(&pEngineState->userExperience, hr, dwProcessId); |
| 884 | 867 | ||
| 885 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_COMPLETE, hr, dwProcessId); | 868 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_COMPLETE, hr, dwProcessId); |
| 886 | 869 | ||
| @@ -888,7 +871,7 @@ LExit: | |||
| 888 | } | 871 | } |
| 889 | 872 | ||
| 890 | extern "C" void CoreQuit( | 873 | extern "C" void CoreQuit( |
| 891 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 874 | __in BAENGINE_CONTEXT* pEngineContext, |
| 892 | __in DWORD dwExitCode | 875 | __in DWORD dwExitCode |
| 893 | ) | 876 | ) |
| 894 | { | 877 | { |
| @@ -942,7 +925,7 @@ extern "C" HRESULT CoreSaveEngineState( | |||
| 942 | } | 925 | } |
| 943 | 926 | ||
| 944 | LExit: | 927 | LExit: |
| 945 | ReleaseBuffer(pbBuffer); | 928 | ReleaseMem(pbBuffer); |
| 946 | 929 | ||
| 947 | return hr; | 930 | return hr; |
| 948 | } | 931 | } |
| @@ -1087,95 +1070,6 @@ LExit: | |||
| 1087 | return hr; | 1070 | return hr; |
| 1088 | } | 1071 | } |
| 1089 | 1072 | ||
| 1090 | extern "C" HRESULT CoreCreateCleanRoomCommandLine( | ||
| 1091 | __deref_inout_z LPWSTR* psczCommandLine, | ||
| 1092 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 1093 | __in_z LPCWSTR wzCleanRoomBundlePath, | ||
| 1094 | __in_z LPCWSTR wzCurrentProcessPath, | ||
| 1095 | __inout HANDLE* phFileAttached, | ||
| 1096 | __inout HANDLE* phFileSelf | ||
| 1097 | ) | ||
| 1098 | { | ||
| 1099 | HRESULT hr = S_OK; | ||
| 1100 | BOOTSTRAPPER_COMMAND* pCommand = &pEngineState->command; | ||
| 1101 | BURN_ENGINE_COMMAND* pInternalCommand = &pEngineState->internalCommand; | ||
| 1102 | |||
| 1103 | // The clean room switch must always be at the front of the command line so | ||
| 1104 | // the EngineInCleanRoom function will operate correctly. | ||
| 1105 | hr = StrAllocFormatted(psczCommandLine, L"-%ls=\"%ls\"", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, wzCurrentProcessPath); | ||
| 1106 | ExitOnFailure(hr, "Failed to allocate parameters for unelevated process."); | ||
| 1107 | |||
| 1108 | // Send a file handle for the child Burn process to access the attached container. | ||
| 1109 | hr = CoreAppendFileHandleAttachedToCommandLine(pEngineState->section.hEngineFile, phFileAttached, psczCommandLine); | ||
| 1110 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED); | ||
| 1111 | |||
| 1112 | // Grab a file handle for the child Burn process. | ||
| 1113 | hr = CoreAppendFileHandleSelfToCommandLine(wzCleanRoomBundlePath, phFileSelf, psczCommandLine, NULL); | ||
| 1114 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); | ||
| 1115 | |||
| 1116 | hr = CoreAppendSplashScreenWindowToCommandLine(pCommand->hwndSplashScreen, psczCommandLine); | ||
| 1117 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_SPLASH_SCREEN); | ||
| 1118 | |||
| 1119 | if (pInternalCommand->sczLogFile) | ||
| 1120 | { | ||
| 1121 | LPCWSTR wzLogParameter = (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pInternalCommand->dwLoggingAttributes) ? L"xlog" : L"log"; | ||
| 1122 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls", wzLogParameter); | ||
| 1123 | ExitOnFailure(hr, "Failed to append logging switch."); | ||
| 1124 | |||
| 1125 | hr = AppAppendCommandLineArgument(psczCommandLine, pInternalCommand->sczLogFile); | ||
| 1126 | ExitOnFailure(hr, "Failed to append custom log path."); | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | hr = AppendLayoutToCommandLine(pCommand->action, pCommand->wzLayoutDirectory, psczCommandLine); | ||
| 1130 | ExitOnFailure(hr, "Failed to append layout."); | ||
| 1131 | |||
| 1132 | switch (pInternalCommand->automaticUpdates) | ||
| 1133 | { | ||
| 1134 | case BURN_AU_PAUSE_ACTION_NONE: | ||
| 1135 | hr = StrAllocConcat(psczCommandLine, L" /noaupause", 0); | ||
| 1136 | ExitOnFailure(hr, "Failed to append /noaupause."); | ||
| 1137 | break; | ||
| 1138 | case BURN_AU_PAUSE_ACTION_IFELEVATED_NORESUME: | ||
| 1139 | hr = StrAllocConcat(psczCommandLine, L" /keepaupaused", 0); | ||
| 1140 | ExitOnFailure(hr, "Failed to append /keepaupaused."); | ||
| 1141 | break; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | // TODO: This should only be added if it was enabled from the command line. | ||
| 1145 | if (pInternalCommand->fDisableSystemRestore) | ||
| 1146 | { | ||
| 1147 | hr = StrAllocConcat(psczCommandLine, L" /disablesystemrestore", 0); | ||
| 1148 | ExitOnFailure(hr, "Failed to append /disablesystemrestore."); | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | if (pInternalCommand->sczOriginalSource) | ||
| 1152 | { | ||
| 1153 | hr = StrAllocConcat(psczCommandLine, L" /originalsource", 0); | ||
| 1154 | ExitOnFailure(hr, "Failed to append /originalsource."); | ||
| 1155 | |||
| 1156 | hr = AppAppendCommandLineArgument(psczCommandLine, pInternalCommand->sczOriginalSource); | ||
| 1157 | ExitOnFailure(hr, "Failed to append original source."); | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | if (pEngineState->embeddedConnection.sczName) | ||
| 1161 | { | ||
| 1162 | hr = StrAllocConcatFormatted(psczCommandLine, L" -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_EMBEDDED, pEngineState->embeddedConnection.sczName, pEngineState->embeddedConnection.sczSecret, pEngineState->embeddedConnection.dwProcessId); | ||
| 1163 | ExitOnFailure(hr, "Failed to allocate embedded command."); | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | if (pInternalCommand->sczIgnoreDependencies) | ||
| 1167 | { | ||
| 1168 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES, pInternalCommand->sczIgnoreDependencies); | ||
| 1169 | ExitOnFailure(hr, "Failed to append ignored dependencies to command-line."); | ||
| 1170 | } | ||
| 1171 | |||
| 1172 | hr = CoreRecreateCommandLine(psczCommandLine, pCommand->action, pInternalCommand, pCommand, pCommand->relationType, pCommand->fPassthrough); | ||
| 1173 | ExitOnFailure(hr, "Failed to recreate clean room command-line."); | ||
| 1174 | |||
| 1175 | LExit: | ||
| 1176 | return hr; | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | extern "C" HRESULT CoreCreatePassthroughBundleCommandLine( | 1073 | extern "C" HRESULT CoreCreatePassthroughBundleCommandLine( |
| 1180 | __deref_inout_z LPWSTR* psczCommandLine, | 1074 | __deref_inout_z LPWSTR* psczCommandLine, |
| 1181 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 1075 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| @@ -1201,9 +1095,6 @@ extern "C" HRESULT CoreCreateResumeCommandLine( | |||
| 1201 | { | 1095 | { |
| 1202 | HRESULT hr = S_OK; | 1096 | HRESULT hr = S_OK; |
| 1203 | 1097 | ||
| 1204 | hr = StrAllocFormatted(psczCommandLine, L"/%ls", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | ||
| 1205 | ExitOnFailure(hr, "Failed to alloc resume command-line."); | ||
| 1206 | |||
| 1207 | if (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pPlan->pInternalCommand->dwLoggingAttributes) | 1098 | if (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pPlan->pInternalCommand->dwLoggingAttributes) |
| 1208 | { | 1099 | { |
| 1209 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_LOG_MODE, L"x"); | 1100 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_LOG_MODE, L"x"); |
| @@ -1694,40 +1585,6 @@ extern "C" HRESULT CoreParseCommandLine( | |||
| 1694 | 1585 | ||
| 1695 | i += 2; | 1586 | i += 2; |
| 1696 | } | 1587 | } |
| 1697 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM), BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM))) | ||
| 1698 | { | ||
| 1699 | if (0 != i) | ||
| 1700 | { | ||
| 1701 | fInvalidCommandLine = TRUE; | ||
| 1702 | TraceLog(E_INVALIDARG, "Clean room command-line switch must be first argument on command-line."); | ||
| 1703 | } | ||
| 1704 | |||
| 1705 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) | ||
| 1706 | { | ||
| 1707 | pInternalCommand->mode = BURN_MODE_NORMAL; | ||
| 1708 | } | ||
| 1709 | else | ||
| 1710 | { | ||
| 1711 | fInvalidCommandLine = TRUE; | ||
| 1712 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | ||
| 1713 | } | ||
| 1714 | |||
| 1715 | // Get a pointer to the next character after the switch. | ||
| 1716 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM)]; | ||
| 1717 | if (L'\0' != wzParam[0]) | ||
| 1718 | { | ||
| 1719 | if (L'=' != wzParam[0]) | ||
| 1720 | { | ||
| 1721 | fInvalidCommandLine = TRUE; | ||
| 1722 | TraceLog(E_INVALIDARG, "Invalid switch: %ls", argv[i]); | ||
| 1723 | } | ||
| 1724 | else if (L'\0' != wzParam[1]) | ||
| 1725 | { | ||
| 1726 | hr = PathExpand(&pInternalCommand->sczSourceProcessPath, wzParam + 1, PATH_EXPAND_FULLPATH); | ||
| 1727 | ExitOnFailure(hr, "Failed to copy source process path."); | ||
| 1728 | } | ||
| 1729 | } | ||
| 1730 | } | ||
| 1731 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT), BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT, lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT))) | 1588 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT), BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT, lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT))) |
| 1732 | { | 1589 | { |
| 1733 | // Get a pointer to the next character after the switch. | 1590 | // Get a pointer to the next character after the switch. |
| @@ -1762,13 +1619,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
| 1762 | switch (pInternalCommand->mode) | 1619 | switch (pInternalCommand->mode) |
| 1763 | { | 1620 | { |
| 1764 | case BURN_MODE_UNKNOWN: | 1621 | case BURN_MODE_UNKNOWN: |
| 1765 | // Set mode to UNTRUSTED to ensure multiple modes weren't specified. | ||
| 1766 | pInternalCommand->mode = BURN_MODE_UNTRUSTED; | ||
| 1767 | break; | ||
| 1768 | case BURN_MODE_NORMAL: | 1622 | case BURN_MODE_NORMAL: |
| 1769 | // The initialization code already assumes that the | ||
| 1770 | // clean room switch is at the beginning of the command line, | ||
| 1771 | // so it's safe to assume that the mode is NORMAL in the clean room. | ||
| 1772 | pInternalCommand->mode = BURN_MODE_EMBEDDED; | 1623 | pInternalCommand->mode = BURN_MODE_EMBEDDED; |
| 1773 | break; | 1624 | break; |
| 1774 | default: | 1625 | default: |
| @@ -2012,7 +1863,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
| 2012 | 1863 | ||
| 2013 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) | 1864 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) |
| 2014 | { | 1865 | { |
| 2015 | pInternalCommand->mode = BURN_MODE_UNTRUSTED; | 1866 | pInternalCommand->mode = BURN_MODE_NORMAL; |
| 2016 | } | 1867 | } |
| 2017 | 1868 | ||
| 2018 | LExit: | 1869 | LExit: |
| @@ -2132,18 +1983,6 @@ LExit: | |||
| 2132 | return hr; | 1983 | return hr; |
| 2133 | } | 1984 | } |
| 2134 | 1985 | ||
| 2135 | extern "C" void DAPI CoreBootstrapperEngineActionUninitialize( | ||
| 2136 | __in BOOTSTRAPPER_ENGINE_ACTION* pAction | ||
| 2137 | ) | ||
| 2138 | { | ||
| 2139 | switch (pAction->dwMessage) | ||
| 2140 | { | ||
| 2141 | case WM_BURN_LAUNCH_APPROVED_EXE: | ||
| 2142 | ApprovedExesUninitializeLaunch(&pAction->launchApprovedExe); | ||
| 2143 | break; | ||
| 2144 | } | ||
| 2145 | } | ||
| 2146 | |||
| 2147 | // internal helper functions | 1986 | // internal helper functions |
| 2148 | 1987 | ||
| 2149 | static HRESULT AppendEscapedArgumentToCommandLine( | 1988 | static HRESULT AppendEscapedArgumentToCommandLine( |
| @@ -2219,30 +2058,6 @@ LExit: | |||
| 2219 | return hr; | 2058 | return hr; |
| 2220 | } | 2059 | } |
| 2221 | 2060 | ||
| 2222 | static HRESULT AppendLayoutToCommandLine( | ||
| 2223 | __in BOOTSTRAPPER_ACTION action, | ||
| 2224 | __in_z LPCWSTR wzLayoutDirectory, | ||
| 2225 | __deref_inout_z LPWSTR* psczCommandLine | ||
| 2226 | ) | ||
| 2227 | { | ||
| 2228 | HRESULT hr = S_OK; | ||
| 2229 | |||
| 2230 | if (BOOTSTRAPPER_ACTION_LAYOUT == action || wzLayoutDirectory) | ||
| 2231 | { | ||
| 2232 | hr = StrAllocConcat(psczCommandLine, L" /layout", 0); | ||
| 2233 | ExitOnFailure(hr, "Failed to append layout switch."); | ||
| 2234 | |||
| 2235 | if (wzLayoutDirectory) | ||
| 2236 | { | ||
| 2237 | hr = AppAppendCommandLineArgument(psczCommandLine, wzLayoutDirectory); | ||
| 2238 | ExitOnFailure(hr, "Failed to append layout directory."); | ||
| 2239 | } | ||
| 2240 | } | ||
| 2241 | |||
| 2242 | LExit: | ||
| 2243 | return hr; | ||
| 2244 | } | ||
| 2245 | |||
| 2246 | static HRESULT GetSanitizedCommandLine( | 2061 | static HRESULT GetSanitizedCommandLine( |
| 2247 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 2062 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| 2248 | __in BOOTSTRAPPER_COMMAND* pCommand, | 2063 | __in BOOTSTRAPPER_COMMAND* pCommand, |
| @@ -2347,7 +2162,7 @@ static HRESULT DetectPackage( | |||
| 2347 | BOOL fBegan = FALSE; | 2162 | BOOL fBegan = FALSE; |
| 2348 | 2163 | ||
| 2349 | fBegan = TRUE; | 2164 | fBegan = TRUE; |
| 2350 | hr = UserExperienceOnDetectPackageBegin(&pEngineState->userExperience, pPackage->sczId); | 2165 | hr = BACallbackOnDetectPackageBegin(&pEngineState->userExperience, pPackage->sczId); |
| 2351 | ExitOnRootFailure(hr, "BA aborted detect package begin."); | 2166 | ExitOnRootFailure(hr, "BA aborted detect package begin."); |
| 2352 | 2167 | ||
| 2353 | // Detect the cache state of the package. | 2168 | // Detect the cache state of the package. |
| @@ -2389,7 +2204,7 @@ LExit: | |||
| 2389 | 2204 | ||
| 2390 | if (fBegan) | 2205 | if (fBegan) |
| 2391 | { | 2206 | { |
| 2392 | UserExperienceOnDetectPackageComplete(&pEngineState->userExperience, pPackage->sczId, hr, pPackage->currentState, pPackage->fCached); | 2207 | BACallbackOnDetectPackageComplete(&pEngineState->userExperience, pPackage->sczId, hr, pPackage->currentState, pPackage->fCached); |
| 2393 | } | 2208 | } |
| 2394 | 2209 | ||
| 2395 | return hr; | 2210 | return hr; |
| @@ -2465,7 +2280,7 @@ static DWORD WINAPI CacheThreadProc( | |||
| 2465 | hr = ApplyCache(pEngineState->section.hSourceEngineFile, &pEngineState->userExperience, &pEngineState->variables, &pEngineState->plan, pEngineState->companionConnection.hCachePipe, pContext->pApplyContext); | 2280 | hr = ApplyCache(pEngineState->section.hSourceEngineFile, &pEngineState->userExperience, &pEngineState->variables, &pEngineState->plan, pEngineState->companionConnection.hCachePipe, pContext->pApplyContext); |
| 2466 | 2281 | ||
| 2467 | LExit: | 2282 | LExit: |
| 2468 | UserExperienceExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that cache completed. | 2283 | BootstrapperApplicationExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that cache completed. |
| 2469 | 2284 | ||
| 2470 | if (fComInitialized) | 2285 | if (fComInitialized) |
| 2471 | { | 2286 | { |
diff --git a/src/burn/engine/core.h b/src/burn/engine/core.h index 1e672651..787100b7 100644 --- a/src/burn/engine/core.h +++ b/src/burn/engine/core.h | |||
| @@ -13,7 +13,6 @@ const LPCWSTR BURN_POLICY_REGISTRY_PATH = L"WiX\\Burn"; | |||
| 13 | 13 | ||
| 14 | const LPCWSTR BURN_COMMANDLINE_SWITCH_PARENT = L"parent"; | 14 | const LPCWSTR BURN_COMMANDLINE_SWITCH_PARENT = L"parent"; |
| 15 | const LPCWSTR BURN_COMMANDLINE_SWITCH_PARENT_NONE = L"parent:none"; | 15 | const LPCWSTR BURN_COMMANDLINE_SWITCH_PARENT_NONE = L"parent:none"; |
| 16 | const LPCWSTR BURN_COMMANDLINE_SWITCH_CLEAN_ROOM = L"burn.clean.room"; | ||
| 17 | const LPCWSTR BURN_COMMANDLINE_SWITCH_WORKING_DIRECTORY = L"burn.engine.working.directory"; | 16 | const LPCWSTR BURN_COMMANDLINE_SWITCH_WORKING_DIRECTORY = L"burn.engine.working.directory"; |
| 18 | const LPCWSTR BURN_COMMANDLINE_SWITCH_ELEVATED = L"burn.elevated"; | 17 | const LPCWSTR BURN_COMMANDLINE_SWITCH_ELEVATED = L"burn.elevated"; |
| 19 | const LPCWSTR BURN_COMMANDLINE_SWITCH_EMBEDDED = L"burn.embedded"; | 18 | const LPCWSTR BURN_COMMANDLINE_SWITCH_EMBEDDED = L"burn.embedded"; |
| @@ -47,8 +46,6 @@ const LPCWSTR BURN_BUNDLE_FORCED_RESTART_PACKAGE = L"WixBundleForcedRestartPacka | |||
| 47 | const LPCWSTR BURN_BUNDLE_INSTALLED = L"WixBundleInstalled"; | 46 | const LPCWSTR BURN_BUNDLE_INSTALLED = L"WixBundleInstalled"; |
| 48 | const LPCWSTR BURN_BUNDLE_ELEVATED = L"WixBundleElevated"; | 47 | const LPCWSTR BURN_BUNDLE_ELEVATED = L"WixBundleElevated"; |
| 49 | const LPCWSTR BURN_BUNDLE_PROVIDER_KEY = L"WixBundleProviderKey"; | 48 | const LPCWSTR BURN_BUNDLE_PROVIDER_KEY = L"WixBundleProviderKey"; |
| 50 | const LPCWSTR BURN_BUNDLE_SOURCE_PROCESS_PATH = L"WixBundleSourceProcessPath"; | ||
| 51 | const LPCWSTR BURN_BUNDLE_SOURCE_PROCESS_FOLDER = L"WixBundleSourceProcessFolder"; | ||
| 52 | const LPCWSTR BURN_BUNDLE_TAG = L"WixBundleTag"; | 49 | const LPCWSTR BURN_BUNDLE_TAG = L"WixBundleTag"; |
| 53 | const LPCWSTR BURN_BUNDLE_UILEVEL = L"WixBundleUILevel"; | 50 | const LPCWSTR BURN_BUNDLE_UILEVEL = L"WixBundleUILevel"; |
| 54 | const LPCWSTR BURN_BUNDLE_VERSION = L"WixBundleVersion"; | 51 | const LPCWSTR BURN_BUNDLE_VERSION = L"WixBundleVersion"; |
| @@ -68,7 +65,6 @@ const LPCWSTR BURN_BUNDLE_LAST_USED_SOURCE = L"WixBundleLastUsedSource"; | |||
| 68 | enum BURN_MODE | 65 | enum BURN_MODE |
| 69 | { | 66 | { |
| 70 | BURN_MODE_UNKNOWN, | 67 | BURN_MODE_UNKNOWN, |
| 71 | BURN_MODE_UNTRUSTED, | ||
| 72 | BURN_MODE_NORMAL, | 68 | BURN_MODE_NORMAL, |
| 73 | BURN_MODE_ELEVATED, | 69 | BURN_MODE_ELEVATED, |
| 74 | BURN_MODE_EMBEDDED, | 70 | BURN_MODE_EMBEDDED, |
| @@ -115,7 +111,6 @@ typedef struct _BURN_ENGINE_COMMAND | |||
| 115 | LPWSTR sczAncestors; | 111 | LPWSTR sczAncestors; |
| 116 | LPWSTR sczIgnoreDependencies; | 112 | LPWSTR sczIgnoreDependencies; |
| 117 | 113 | ||
| 118 | LPWSTR sczSourceProcessPath; | ||
| 119 | LPWSTR sczOriginalSource; | 114 | LPWSTR sczOriginalSource; |
| 120 | LPWSTR sczEngineWorkingDirectory; | 115 | LPWSTR sczEngineWorkingDirectory; |
| 121 | 116 | ||
| @@ -263,7 +258,7 @@ HRESULT CoreLaunchApprovedExe( | |||
| 263 | __in BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe | 258 | __in BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe |
| 264 | ); | 259 | ); |
| 265 | void CoreQuit( | 260 | void CoreQuit( |
| 266 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 261 | __in BAENGINE_CONTEXT* pEngineContext, |
| 267 | __in DWORD dwExitCode | 262 | __in DWORD dwExitCode |
| 268 | ); | 263 | ); |
| 269 | HRESULT CoreSaveEngineState( | 264 | HRESULT CoreSaveEngineState( |
| @@ -272,14 +267,6 @@ HRESULT CoreSaveEngineState( | |||
| 272 | LPCWSTR CoreRelationTypeToCommandLineString( | 267 | LPCWSTR CoreRelationTypeToCommandLineString( |
| 273 | __in BOOTSTRAPPER_RELATION_TYPE relationType | 268 | __in BOOTSTRAPPER_RELATION_TYPE relationType |
| 274 | ); | 269 | ); |
| 275 | HRESULT CoreCreateCleanRoomCommandLine( | ||
| 276 | __deref_inout_z LPWSTR* psczCommandLine, | ||
| 277 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 278 | __in_z LPCWSTR wzCleanRoomBundlePath, | ||
| 279 | __in_z LPCWSTR wzCurrentProcessPath, | ||
| 280 | __inout HANDLE* phFileAttached, | ||
| 281 | __inout HANDLE* phFileSelf | ||
| 282 | ); | ||
| 283 | HRESULT CoreCreatePassthroughBundleCommandLine( | 270 | HRESULT CoreCreatePassthroughBundleCommandLine( |
| 284 | __deref_inout_z LPWSTR* psczCommandLine, | 271 | __deref_inout_z LPWSTR* psczCommandLine, |
| 285 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 272 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| @@ -361,9 +348,6 @@ HRESULT DAPI CoreCloseElevatedLoggingThread( | |||
| 361 | HRESULT DAPI CoreWaitForUnelevatedLoggingThread( | 348 | HRESULT DAPI CoreWaitForUnelevatedLoggingThread( |
| 362 | __in HANDLE hUnelevatedLoggingThread | 349 | __in HANDLE hUnelevatedLoggingThread |
| 363 | ); | 350 | ); |
| 364 | void DAPI CoreBootstrapperEngineActionUninitialize( | ||
| 365 | __in BOOTSTRAPPER_ENGINE_ACTION* pAction | ||
| 366 | ); | ||
| 367 | 351 | ||
| 368 | #if defined(__cplusplus) | 352 | #if defined(__cplusplus) |
| 369 | } | 353 | } |
diff --git a/src/burn/engine/detect.cpp b/src/burn/engine/detect.cpp index f573e259..18820c5d 100644 --- a/src/burn/engine/detect.cpp +++ b/src/burn/engine/detect.cpp | |||
| @@ -143,7 +143,7 @@ extern "C" HRESULT DetectForwardCompatibleBundles( | |||
| 143 | pRegistration->fForwardCompatibleBundleExists = TRUE; | 143 | pRegistration->fForwardCompatibleBundleExists = TRUE; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, !pRelatedBundle->package.fCached); | 146 | hr = BACallbackOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, !pRelatedBundle->package.fCached); |
| 147 | ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); | 147 | ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); |
| 148 | 148 | ||
| 149 | LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->detectRelationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRelatedBundle->package.fCached)); | 149 | LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->detectRelationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRelatedBundle->package.fCached)); |
| @@ -174,7 +174,7 @@ extern "C" HRESULT DetectReportRelatedBundles( | |||
| 174 | 174 | ||
| 175 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->detectRelationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRelatedBundle->package.fCached)); | 175 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->detectRelationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRelatedBundle->package.fCached)); |
| 176 | 176 | ||
| 177 | hr = UserExperienceOnDetectRelatedBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, !pRelatedBundle->package.fCached); | 177 | hr = BACallbackOnDetectRelatedBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, !pRelatedBundle->package.fCached); |
| 178 | ExitOnRootFailure(hr, "BA aborted detect related bundle."); | 178 | ExitOnRootFailure(hr, "BA aborted detect related bundle."); |
| 179 | 179 | ||
| 180 | // For now, if any related bundles will be executed during uninstall by default then never automatically clean up the bundle. | 180 | // For now, if any related bundles will be executed during uninstall by default then never automatically clean up the bundle. |
| @@ -223,7 +223,7 @@ extern "C" HRESULT DetectUpdate( | |||
| 223 | hr = StrAllocString(&sczOriginalSource, pUpdate->sczUpdateSource, 0); | 223 | hr = StrAllocString(&sczOriginalSource, pUpdate->sczUpdateSource, 0); |
| 224 | ExitOnFailure(hr, "Failed to duplicate update feed source."); | 224 | ExitOnFailure(hr, "Failed to duplicate update feed source."); |
| 225 | 225 | ||
| 226 | hr = UserExperienceOnDetectUpdateBegin(pUX, sczOriginalSource, &fSkip); | 226 | hr = BACallbackOnDetectUpdateBegin(pUX, sczOriginalSource, &fSkip); |
| 227 | ExitOnRootFailure(hr, "BA aborted detect update begin."); | 227 | ExitOnRootFailure(hr, "BA aborted detect update begin."); |
| 228 | 228 | ||
| 229 | if (!fSkip) | 229 | if (!fSkip) |
| @@ -237,7 +237,7 @@ LExit: | |||
| 237 | 237 | ||
| 238 | if (fBeginCalled) | 238 | if (fBeginCalled) |
| 239 | { | 239 | { |
| 240 | UserExperienceOnDetectUpdateComplete(pUX, hr, &fIgnoreError); | 240 | BACallbackOnDetectUpdateComplete(pUX, hr, &fIgnoreError); |
| 241 | if (fIgnoreError) | 241 | if (fIgnoreError) |
| 242 | { | 242 | { |
| 243 | hr = S_OK; | 243 | hr = S_OK; |
| @@ -270,8 +270,8 @@ static HRESULT WINAPI AuthenticationRequired( | |||
| 270 | hr = StrAllocFromError(&sczError, HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED), NULL); | 270 | hr = StrAllocFromError(&sczError, HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED), NULL); |
| 271 | ExitOnFailure(hr, "Failed to allocation error string."); | 271 | ExitOnFailure(hr, "Failed to allocation error string."); |
| 272 | 272 | ||
| 273 | UserExperienceOnError(pAuthenticationData->pUX, errorType, pAuthenticationData->wzPackageOrContainerId, ERROR_ACCESS_DENIED, sczError, MB_RETRYCANCEL, 0, NULL, &nResult); // ignore return value. | 273 | BACallbackOnError(pAuthenticationData->pUX, errorType, pAuthenticationData->wzPackageOrContainerId, ERROR_ACCESS_DENIED, sczError, MB_RETRYCANCEL, 0, NULL, &nResult); // ignore return value. |
| 274 | nResult = UserExperienceCheckExecuteResult(pAuthenticationData->pUX, FALSE, BURN_MB_RETRYTRYAGAIN, nResult); | 274 | nResult = BootstrapperApplicationCheckExecuteResult(pAuthenticationData->pUX, FALSE, BURN_MB_RETRYTRYAGAIN, nResult); |
| 275 | if (IDTRYAGAIN == nResult && pAuthenticationData->pUX->hwndDetect) | 275 | if (IDTRYAGAIN == nResult && pAuthenticationData->pUX->hwndDetect) |
| 276 | { | 276 | { |
| 277 | er = ::InternetErrorDlg(pAuthenticationData->pUX->hwndDetect, hUrl, ERROR_INTERNET_INCORRECT_PASSWORD, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, NULL); | 277 | er = ::InternetErrorDlg(pAuthenticationData->pUX->hwndDetect, hUrl, ERROR_INTERNET_INCORRECT_PASSWORD, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, NULL); |
| @@ -356,6 +356,7 @@ LExit: | |||
| 356 | ReleaseStr(downloadSource.sczUrl); | 356 | ReleaseStr(downloadSource.sczUrl); |
| 357 | ReleaseStr(downloadSource.sczUser); | 357 | ReleaseStr(downloadSource.sczUser); |
| 358 | ReleaseStr(downloadSource.sczPassword); | 358 | ReleaseStr(downloadSource.sczPassword); |
| 359 | ReleaseStr(downloadSource.sczAuthorizationHeader); | ||
| 359 | ReleaseStr(sczUpdateId); | 360 | ReleaseStr(sczUpdateId); |
| 360 | ReleaseStr(sczError); | 361 | ReleaseStr(sczError); |
| 361 | return hr; | 362 | return hr; |
| @@ -411,7 +412,7 @@ static HRESULT DetectAtomFeedUpdate( | |||
| 411 | hashType = BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512; | 412 | hashType = BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512; |
| 412 | } | 413 | } |
| 413 | 414 | ||
| 414 | hr = UserExperienceOnDetectUpdate(pUX, | 415 | hr = BACallbackOnDetectUpdate(pUX, |
| 415 | pEnclosure ? pEnclosure->wzUrl : NULL, | 416 | pEnclosure ? pEnclosure->wzUrl : NULL, |
| 416 | pEnclosure ? pEnclosure->dw64Size : 0, | 417 | pEnclosure ? pEnclosure->dw64Size : 0, |
| 417 | wzHash, | 418 | wzHash, |
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp index f357a8fc..924d2184 100644 --- a/src/burn/engine/elevation.cpp +++ b/src/burn/engine/elevation.cpp | |||
| @@ -420,7 +420,7 @@ extern "C" HRESULT ElevationElevate( | |||
| 420 | HRESULT hr = S_OK; | 420 | HRESULT hr = S_OK; |
| 421 | int nResult = IDOK; | 421 | int nResult = IDOK; |
| 422 | 422 | ||
| 423 | hr = UserExperienceOnElevateBegin(&pEngineState->userExperience); | 423 | hr = BACallbackOnElevateBegin(&pEngineState->userExperience); |
| 424 | ExitOnRootFailure(hr, "BA aborted elevation requirement."); | 424 | ExitOnRootFailure(hr, "BA aborted elevation requirement."); |
| 425 | 425 | ||
| 426 | hr = BurnPipeCreateNameAndSecret(&pEngineState->companionConnection.sczName, &pEngineState->companionConnection.sczSecret); | 426 | hr = BurnPipeCreateNameAndSecret(&pEngineState->companionConnection.sczName, &pEngineState->companionConnection.sczSecret); |
| @@ -458,7 +458,7 @@ extern "C" HRESULT ElevationElevate( | |||
| 458 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 458 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | nResult = UserExperienceSendError(&pEngineState->userExperience, BOOTSTRAPPER_ERROR_TYPE_ELEVATE, NULL, hr, NULL, MB_ICONERROR | MB_RETRYCANCEL, IDNOACTION); | 461 | nResult = BootstrapperApplicationSendError(&pEngineState->userExperience, BOOTSTRAPPER_ERROR_TYPE_ELEVATE, NULL, hr, NULL, MB_ICONERROR | MB_RETRYCANCEL, IDNOACTION); |
| 462 | } | 462 | } |
| 463 | } while (IDRETRY == nResult); | 463 | } while (IDRETRY == nResult); |
| 464 | ExitOnFailure(hr, "Failed to elevate."); | 464 | ExitOnFailure(hr, "Failed to elevate."); |
| @@ -469,7 +469,7 @@ LExit: | |||
| 469 | BurnPipeConnectionUninitialize(&pEngineState->companionConnection); | 469 | BurnPipeConnectionUninitialize(&pEngineState->companionConnection); |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | UserExperienceOnElevateComplete(&pEngineState->userExperience, hr); | 472 | BACallbackOnElevateComplete(&pEngineState->userExperience, hr); |
| 473 | 473 | ||
| 474 | return hr; | 474 | return hr; |
| 475 | } | 475 | } |
| @@ -511,15 +511,15 @@ extern "C" HRESULT ElevationApplyInitialize( | |||
| 511 | // Best effort to keep the sequence of BA events sane. | 511 | // Best effort to keep the sequence of BA events sane. |
| 512 | if (context.fPauseCompleteNeeded) | 512 | if (context.fPauseCompleteNeeded) |
| 513 | { | 513 | { |
| 514 | UserExperienceOnPauseAUComplete(pBA, hr); | 514 | BACallbackOnPauseAUComplete(pBA, hr); |
| 515 | } | 515 | } |
| 516 | if (context.fSrpCompleteNeeded) | 516 | if (context.fSrpCompleteNeeded) |
| 517 | { | 517 | { |
| 518 | UserExperienceOnSystemRestorePointComplete(pBA, hr); | 518 | BACallbackOnSystemRestorePointComplete(pBA, hr); |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | LExit: | 521 | LExit: |
| 522 | ReleaseBuffer(pbData); | 522 | ReleaseMem(pbData); |
| 523 | 523 | ||
| 524 | return hr; | 524 | return hr; |
| 525 | } | 525 | } |
| @@ -540,7 +540,7 @@ extern "C" HRESULT ElevationApplyUninitialize( | |||
| 540 | hr = (HRESULT)dwResult; | 540 | hr = (HRESULT)dwResult; |
| 541 | 541 | ||
| 542 | LExit: | 542 | LExit: |
| 543 | ReleaseBuffer(pbData); | 543 | ReleaseMem(pbData); |
| 544 | 544 | ||
| 545 | return hr; | 545 | return hr; |
| 546 | } | 546 | } |
| @@ -598,7 +598,7 @@ extern "C" HRESULT ElevationSessionBegin( | |||
| 598 | hr = (HRESULT)dwResult; | 598 | hr = (HRESULT)dwResult; |
| 599 | 599 | ||
| 600 | LExit: | 600 | LExit: |
| 601 | ReleaseBuffer(pbData); | 601 | ReleaseMem(pbData); |
| 602 | 602 | ||
| 603 | return hr; | 603 | return hr; |
| 604 | } | 604 | } |
| @@ -644,7 +644,7 @@ extern "C" HRESULT ElevationSessionEnd( | |||
| 644 | hr = (HRESULT)dwResult; | 644 | hr = (HRESULT)dwResult; |
| 645 | 645 | ||
| 646 | LExit: | 646 | LExit: |
| 647 | ReleaseBuffer(pbData); | 647 | ReleaseMem(pbData); |
| 648 | 648 | ||
| 649 | return hr; | 649 | return hr; |
| 650 | } | 650 | } |
| @@ -693,7 +693,7 @@ extern "C" HRESULT ElevationCachePreparePackage( | |||
| 693 | hr = (HRESULT)dwResult; | 693 | hr = (HRESULT)dwResult; |
| 694 | 694 | ||
| 695 | LExit: | 695 | LExit: |
| 696 | ReleaseBuffer(pbData); | 696 | ReleaseMem(pbData); |
| 697 | 697 | ||
| 698 | return hr; | 698 | return hr; |
| 699 | } | 699 | } |
| @@ -743,7 +743,7 @@ extern "C" HRESULT ElevationCacheCompletePayload( | |||
| 743 | hr = (HRESULT)dwResult; | 743 | hr = (HRESULT)dwResult; |
| 744 | 744 | ||
| 745 | LExit: | 745 | LExit: |
| 746 | ReleaseBuffer(pbData); | 746 | ReleaseMem(pbData); |
| 747 | 747 | ||
| 748 | return hr; | 748 | return hr; |
| 749 | } | 749 | } |
| @@ -781,7 +781,7 @@ extern "C" HRESULT ElevationCacheVerifyPayload( | |||
| 781 | hr = (HRESULT)dwResult; | 781 | hr = (HRESULT)dwResult; |
| 782 | 782 | ||
| 783 | LExit: | 783 | LExit: |
| 784 | ReleaseBuffer(pbData); | 784 | ReleaseMem(pbData); |
| 785 | 785 | ||
| 786 | return hr; | 786 | return hr; |
| 787 | } | 787 | } |
| @@ -834,7 +834,7 @@ extern "C" HRESULT ElevationProcessDependentRegistration( | |||
| 834 | hr = (HRESULT)dwResult; | 834 | hr = (HRESULT)dwResult; |
| 835 | 835 | ||
| 836 | LExit: | 836 | LExit: |
| 837 | ReleaseBuffer(pbData); | 837 | ReleaseMem(pbData); |
| 838 | 838 | ||
| 839 | return hr; | 839 | return hr; |
| 840 | } | 840 | } |
| @@ -895,7 +895,7 @@ extern "C" HRESULT ElevationExecuteRelatedBundle( | |||
| 895 | *pRestart = context.restart; | 895 | *pRestart = context.restart; |
| 896 | 896 | ||
| 897 | LExit: | 897 | LExit: |
| 898 | ReleaseBuffer(pbData); | 898 | ReleaseMem(pbData); |
| 899 | 899 | ||
| 900 | return hr; | 900 | return hr; |
| 901 | } | 901 | } |
| @@ -959,7 +959,7 @@ extern "C" HRESULT ElevationExecuteBundlePackage( | |||
| 959 | *pRestart = context.restart; | 959 | *pRestart = context.restart; |
| 960 | 960 | ||
| 961 | LExit: | 961 | LExit: |
| 962 | ReleaseBuffer(pbData); | 962 | ReleaseMem(pbData); |
| 963 | 963 | ||
| 964 | return hr; | 964 | return hr; |
| 965 | } | 965 | } |
| @@ -1014,7 +1014,7 @@ extern "C" HRESULT ElevationExecuteExePackage( | |||
| 1014 | *pRestart = context.restart; | 1014 | *pRestart = context.restart; |
| 1015 | 1015 | ||
| 1016 | LExit: | 1016 | LExit: |
| 1017 | ReleaseBuffer(pbData); | 1017 | ReleaseMem(pbData); |
| 1018 | 1018 | ||
| 1019 | return hr; | 1019 | return hr; |
| 1020 | } | 1020 | } |
| @@ -1042,7 +1042,7 @@ extern "C" HRESULT ElevationMsiBeginTransaction( | |||
| 1042 | hr = static_cast<HRESULT>(dwResult); | 1042 | hr = static_cast<HRESULT>(dwResult); |
| 1043 | 1043 | ||
| 1044 | LExit: | 1044 | LExit: |
| 1045 | ReleaseBuffer(pbData); | 1045 | ReleaseMem(pbData); |
| 1046 | 1046 | ||
| 1047 | return hr; | 1047 | return hr; |
| 1048 | } | 1048 | } |
| @@ -1079,7 +1079,7 @@ extern "C" HRESULT ElevationMsiCommitTransaction( | |||
| 1079 | *pRestart = context.restart; | 1079 | *pRestart = context.restart; |
| 1080 | 1080 | ||
| 1081 | LExit: | 1081 | LExit: |
| 1082 | ReleaseBuffer(pbData); | 1082 | ReleaseMem(pbData); |
| 1083 | 1083 | ||
| 1084 | return hr; | 1084 | return hr; |
| 1085 | } | 1085 | } |
| @@ -1116,7 +1116,7 @@ extern "C" HRESULT ElevationMsiRollbackTransaction( | |||
| 1116 | *pRestart = context.restart; | 1116 | *pRestart = context.restart; |
| 1117 | 1117 | ||
| 1118 | LExit: | 1118 | LExit: |
| 1119 | ReleaseBuffer(pbData); | 1119 | ReleaseMem(pbData); |
| 1120 | 1120 | ||
| 1121 | return hr; | 1121 | return hr; |
| 1122 | } | 1122 | } |
| @@ -1203,7 +1203,7 @@ extern "C" HRESULT ElevationExecuteMsiPackage( | |||
| 1203 | *pRestart = context.restart; | 1203 | *pRestart = context.restart; |
| 1204 | 1204 | ||
| 1205 | LExit: | 1205 | LExit: |
| 1206 | ReleaseBuffer(pbData); | 1206 | ReleaseMem(pbData); |
| 1207 | 1207 | ||
| 1208 | return hr; | 1208 | return hr; |
| 1209 | } | 1209 | } |
| @@ -1283,7 +1283,7 @@ extern "C" HRESULT ElevationExecuteMspPackage( | |||
| 1283 | *pRestart = context.restart; | 1283 | *pRestart = context.restart; |
| 1284 | 1284 | ||
| 1285 | LExit: | 1285 | LExit: |
| 1286 | ReleaseBuffer(pbData); | 1286 | ReleaseMem(pbData); |
| 1287 | 1287 | ||
| 1288 | return hr; | 1288 | return hr; |
| 1289 | } | 1289 | } |
| @@ -1335,7 +1335,7 @@ extern "C" HRESULT ElevationExecuteMsuPackage( | |||
| 1335 | *pRestart = context.restart; | 1335 | *pRestart = context.restart; |
| 1336 | 1336 | ||
| 1337 | LExit: | 1337 | LExit: |
| 1338 | ReleaseBuffer(pbData); | 1338 | ReleaseMem(pbData); |
| 1339 | 1339 | ||
| 1340 | return hr; | 1340 | return hr; |
| 1341 | } | 1341 | } |
| @@ -1388,7 +1388,7 @@ extern "C" HRESULT ElevationUninstallMsiCompatiblePackage( | |||
| 1388 | *pRestart = context.restart; | 1388 | *pRestart = context.restart; |
| 1389 | 1389 | ||
| 1390 | LExit: | 1390 | LExit: |
| 1391 | ReleaseBuffer(pbData); | 1391 | ReleaseMem(pbData); |
| 1392 | 1392 | ||
| 1393 | return hr; | 1393 | return hr; |
| 1394 | } | 1394 | } |
| @@ -1425,7 +1425,7 @@ extern "C" HRESULT ElevationExecutePackageProviderAction( | |||
| 1425 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_PACKAGE_PROVIDER message to per-machine process."); | 1425 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_PACKAGE_PROVIDER message to per-machine process."); |
| 1426 | 1426 | ||
| 1427 | LExit: | 1427 | LExit: |
| 1428 | ReleaseBuffer(pbData); | 1428 | ReleaseMem(pbData); |
| 1429 | 1429 | ||
| 1430 | return hr; | 1430 | return hr; |
| 1431 | } | 1431 | } |
| @@ -1465,7 +1465,7 @@ extern "C" HRESULT ElevationExecutePackageDependencyAction( | |||
| 1465 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_PACKAGE_DEPENDENCY message to per-machine process."); | 1465 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_PACKAGE_DEPENDENCY message to per-machine process."); |
| 1466 | 1466 | ||
| 1467 | LExit: | 1467 | LExit: |
| 1468 | ReleaseBuffer(pbData); | 1468 | ReleaseMem(pbData); |
| 1469 | 1469 | ||
| 1470 | return hr; | 1470 | return hr; |
| 1471 | } | 1471 | } |
| @@ -1494,7 +1494,7 @@ extern "C" HRESULT ElevationCleanCompatiblePackage( | |||
| 1494 | hr = (HRESULT)dwResult; | 1494 | hr = (HRESULT)dwResult; |
| 1495 | 1495 | ||
| 1496 | LExit: | 1496 | LExit: |
| 1497 | ReleaseBuffer(pbData); | 1497 | ReleaseMem(pbData); |
| 1498 | 1498 | ||
| 1499 | return hr; | 1499 | return hr; |
| 1500 | } | 1500 | } |
| @@ -1524,7 +1524,7 @@ extern "C" HRESULT ElevationCleanPackage( | |||
| 1524 | hr = (HRESULT)dwResult; | 1524 | hr = (HRESULT)dwResult; |
| 1525 | 1525 | ||
| 1526 | LExit: | 1526 | LExit: |
| 1527 | ReleaseBuffer(pbData); | 1527 | ReleaseMem(pbData); |
| 1528 | 1528 | ||
| 1529 | return hr; | 1529 | return hr; |
| 1530 | } | 1530 | } |
| @@ -1559,7 +1559,7 @@ extern "C" HRESULT ElevationLaunchApprovedExe( | |||
| 1559 | *pdwProcessId = context.dwProcessId; | 1559 | *pdwProcessId = context.dwProcessId; |
| 1560 | 1560 | ||
| 1561 | LExit: | 1561 | LExit: |
| 1562 | ReleaseBuffer(pbData); | 1562 | ReleaseMem(pbData); |
| 1563 | 1563 | ||
| 1564 | return hr; | 1564 | return hr; |
| 1565 | } | 1565 | } |
| @@ -1756,7 +1756,7 @@ static HRESULT ProcessApplyInitializeMessages( | |||
| 1756 | { | 1756 | { |
| 1757 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_PAUSE_AU_BEGIN: | 1757 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_PAUSE_AU_BEGIN: |
| 1758 | pContext->fPauseCompleteNeeded = TRUE; | 1758 | pContext->fPauseCompleteNeeded = TRUE; |
| 1759 | hrBA = UserExperienceOnPauseAUBegin(pContext->pBA); | 1759 | hrBA = BACallbackOnPauseAUBegin(pContext->pBA); |
| 1760 | break; | 1760 | break; |
| 1761 | 1761 | ||
| 1762 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_PAUSE_AU_COMPLETE: | 1762 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_PAUSE_AU_COMPLETE: |
| @@ -1765,18 +1765,18 @@ static HRESULT ProcessApplyInitializeMessages( | |||
| 1765 | ExitOnFailure(hr, "Failed to read pause AU hrStatus."); | 1765 | ExitOnFailure(hr, "Failed to read pause AU hrStatus."); |
| 1766 | 1766 | ||
| 1767 | pContext->fPauseCompleteNeeded = FALSE; | 1767 | pContext->fPauseCompleteNeeded = FALSE; |
| 1768 | hrBA = UserExperienceOnPauseAUComplete(pContext->pBA, hrStatus); | 1768 | hrBA = BACallbackOnPauseAUComplete(pContext->pBA, hrStatus); |
| 1769 | break; | 1769 | break; |
| 1770 | 1770 | ||
| 1771 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_SYSTEM_RESTORE_POINT_BEGIN: | 1771 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_SYSTEM_RESTORE_POINT_BEGIN: |
| 1772 | if (pContext->fPauseCompleteNeeded) | 1772 | if (pContext->fPauseCompleteNeeded) |
| 1773 | { | 1773 | { |
| 1774 | pContext->fPauseCompleteNeeded = FALSE; | 1774 | pContext->fPauseCompleteNeeded = FALSE; |
| 1775 | hrBA = UserExperienceOnPauseAUComplete(pContext->pBA, E_INVALIDSTATE); | 1775 | hrBA = BACallbackOnPauseAUComplete(pContext->pBA, E_INVALIDSTATE); |
| 1776 | } | 1776 | } |
| 1777 | 1777 | ||
| 1778 | pContext->fSrpCompleteNeeded = TRUE; | 1778 | pContext->fSrpCompleteNeeded = TRUE; |
| 1779 | hrBA = UserExperienceOnSystemRestorePointBegin(pContext->pBA); | 1779 | hrBA = BACallbackOnSystemRestorePointBegin(pContext->pBA); |
| 1780 | break; | 1780 | break; |
| 1781 | 1781 | ||
| 1782 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_SYSTEM_RESTORE_POINT_COMPLETE: | 1782 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_SYSTEM_RESTORE_POINT_COMPLETE: |
| @@ -1785,7 +1785,7 @@ static HRESULT ProcessApplyInitializeMessages( | |||
| 1785 | ExitOnFailure(hr, "Failed to read system restore point hrStatus."); | 1785 | ExitOnFailure(hr, "Failed to read system restore point hrStatus."); |
| 1786 | 1786 | ||
| 1787 | pContext->fSrpCompleteNeeded = FALSE; | 1787 | pContext->fSrpCompleteNeeded = FALSE; |
| 1788 | hrBA = UserExperienceOnSystemRestorePointComplete(pContext->pBA, hrStatus); | 1788 | hrBA = BACallbackOnSystemRestorePointComplete(pContext->pBA, hrStatus); |
| 1789 | break; | 1789 | break; |
| 1790 | 1790 | ||
| 1791 | default: | 1791 | default: |
| @@ -1930,7 +1930,7 @@ static HRESULT ProcessGenericExecuteMessages( | |||
| 1930 | ExitOnFailure(hr, "Failed to read error code."); | 1930 | ExitOnFailure(hr, "Failed to read error code."); |
| 1931 | 1931 | ||
| 1932 | hr = BuffReadString((BYTE*)pMsg->pvData, pMsg->cbData, &iData, &sczMessage); | 1932 | hr = BuffReadString((BYTE*)pMsg->pvData, pMsg->cbData, &iData, &sczMessage); |
| 1933 | ExitOnFailure(hr, "Failed to read message."); | 1933 | ExitOnFailure(hr, "Failed to read error message."); |
| 1934 | 1934 | ||
| 1935 | message.error.wzMessage = sczMessage; | 1935 | message.error.wzMessage = sczMessage; |
| 1936 | break; | 1936 | break; |
| @@ -2042,7 +2042,7 @@ static HRESULT ProcessMsiPackageMessages( | |||
| 2042 | ExitOnFailure(hr, "Failed to read error code."); | 2042 | ExitOnFailure(hr, "Failed to read error code."); |
| 2043 | 2043 | ||
| 2044 | hr = BuffReadString((BYTE*)pMsg->pvData, pMsg->cbData, &iData, &sczMessage); | 2044 | hr = BuffReadString((BYTE*)pMsg->pvData, pMsg->cbData, &iData, &sczMessage); |
| 2045 | ExitOnFailure(hr, "Failed to read message."); | 2045 | ExitOnFailure(hr, "Failed to read MSI execute error message."); |
| 2046 | message.error.wzMessage = sczMessage; | 2046 | message.error.wzMessage = sczMessage; |
| 2047 | break; | 2047 | break; |
| 2048 | 2048 | ||
| @@ -2051,10 +2051,10 @@ static HRESULT ProcessMsiPackageMessages( | |||
| 2051 | message.type = WIU_MSI_EXECUTE_MESSAGE_MSI_MESSAGE; | 2051 | message.type = WIU_MSI_EXECUTE_MESSAGE_MSI_MESSAGE; |
| 2052 | 2052 | ||
| 2053 | hr = BuffReadNumber((BYTE*)pMsg->pvData, pMsg->cbData, &iData, (DWORD*)&message.msiMessage.mt); | 2053 | hr = BuffReadNumber((BYTE*)pMsg->pvData, pMsg->cbData, &iData, (DWORD*)&message.msiMessage.mt); |
| 2054 | ExitOnFailure(hr, "Failed to read message type."); | 2054 | ExitOnFailure(hr, "Failed to read MSI execute message type."); |
| 2055 | 2055 | ||
| 2056 | hr = BuffReadString((BYTE*)pMsg->pvData, pMsg->cbData, &iData, &sczMessage); | 2056 | hr = BuffReadString((BYTE*)pMsg->pvData, pMsg->cbData, &iData, &sczMessage); |
| 2057 | ExitOnFailure(hr, "Failed to read message."); | 2057 | ExitOnFailure(hr, "Failed to read MSI execute message."); |
| 2058 | message.msiMessage.wzMessage = sczMessage; | 2058 | message.msiMessage.wzMessage = sczMessage; |
| 2059 | break; | 2059 | break; |
| 2060 | 2060 | ||
| @@ -3558,7 +3558,7 @@ static HRESULT CALLBACK BurnCacheMessageHandler( | |||
| 3558 | hr = dwResult; | 3558 | hr = dwResult; |
| 3559 | 3559 | ||
| 3560 | LExit: | 3560 | LExit: |
| 3561 | ReleaseBuffer(pbData); | 3561 | ReleaseMem(pbData); |
| 3562 | 3562 | ||
| 3563 | return hr; | 3563 | return hr; |
| 3564 | } | 3564 | } |
| @@ -3593,7 +3593,7 @@ static DWORD CALLBACK ElevatedProgressRoutine( | |||
| 3593 | ExitOnFailure(hr, "Failed to send progress routine message to per-user process."); | 3593 | ExitOnFailure(hr, "Failed to send progress routine message to per-user process."); |
| 3594 | 3594 | ||
| 3595 | LExit: | 3595 | LExit: |
| 3596 | ReleaseBuffer(pbData); | 3596 | ReleaseMem(pbData); |
| 3597 | 3597 | ||
| 3598 | return dwResult; | 3598 | return dwResult; |
| 3599 | } | 3599 | } |
| @@ -3668,7 +3668,7 @@ static int GenericExecuteMessageHandler( | |||
| 3668 | ExitOnFailure(hr, "Failed to send message to per-user process."); | 3668 | ExitOnFailure(hr, "Failed to send message to per-user process."); |
| 3669 | 3669 | ||
| 3670 | LExit: | 3670 | LExit: |
| 3671 | ReleaseBuffer(pbData); | 3671 | ReleaseMem(pbData); |
| 3672 | 3672 | ||
| 3673 | return nResult; | 3673 | return nResult; |
| 3674 | } | 3674 | } |
| @@ -3747,7 +3747,7 @@ static int MsiExecuteMessageHandler( | |||
| 3747 | 3747 | ||
| 3748 | default: | 3748 | default: |
| 3749 | hr = E_UNEXPECTED; | 3749 | hr = E_UNEXPECTED; |
| 3750 | ExitOnFailure(hr, "Invalid message type: %d", pMessage->type); | 3750 | ExitOnFailure(hr, "Invalid MSI execute message type: %d", pMessage->type); |
| 3751 | } | 3751 | } |
| 3752 | 3752 | ||
| 3753 | // send message | 3753 | // send message |
| @@ -3755,7 +3755,7 @@ static int MsiExecuteMessageHandler( | |||
| 3755 | ExitOnFailure(hr, "Failed to send msi message to per-user process."); | 3755 | ExitOnFailure(hr, "Failed to send msi message to per-user process."); |
| 3756 | 3756 | ||
| 3757 | LExit: | 3757 | LExit: |
| 3758 | ReleaseBuffer(pbData); | 3758 | ReleaseMem(pbData); |
| 3759 | 3759 | ||
| 3760 | return nResult; | 3760 | return nResult; |
| 3761 | } | 3761 | } |
| @@ -3895,7 +3895,7 @@ static HRESULT OnLaunchApprovedExe( | |||
| 3895 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_LAUNCH_APPROVED_EXE_PROCESSID message to per-user process."); | 3895 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_LAUNCH_APPROVED_EXE_PROCESSID message to per-user process."); |
| 3896 | 3896 | ||
| 3897 | LExit: | 3897 | LExit: |
| 3898 | ReleaseBuffer(pbSendData); | 3898 | ReleaseMem(pbSendData); |
| 3899 | ApprovedExesUninitializeLaunch(pLaunchApprovedExe); | 3899 | ApprovedExesUninitializeLaunch(pLaunchApprovedExe); |
| 3900 | return hr; | 3900 | return hr; |
| 3901 | } | 3901 | } |
| @@ -4056,7 +4056,7 @@ static HRESULT ElevatedOnPauseAUComplete( | |||
| 4056 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_PAUSE_AU_COMPLETE message to per-user process."); | 4056 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_PAUSE_AU_COMPLETE message to per-user process."); |
| 4057 | 4057 | ||
| 4058 | LExit: | 4058 | LExit: |
| 4059 | ReleaseBuffer(pbSendData); | 4059 | ReleaseMem(pbSendData); |
| 4060 | 4060 | ||
| 4061 | return hr; | 4061 | return hr; |
| 4062 | } | 4062 | } |
| @@ -4092,7 +4092,7 @@ static HRESULT ElevatedOnSystemRestorePointComplete( | |||
| 4092 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_SYSTEM_RESTORE_POINT_COMPLETE message to per-user process."); | 4092 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE_SYSTEM_RESTORE_POINT_COMPLETE message to per-user process."); |
| 4093 | 4093 | ||
| 4094 | LExit: | 4094 | LExit: |
| 4095 | ReleaseBuffer(pbSendData); | 4095 | ReleaseMem(pbSendData); |
| 4096 | 4096 | ||
| 4097 | return hr; | 4097 | return hr; |
| 4098 | } | 4098 | } |
| @@ -4114,7 +4114,7 @@ static HRESULT ElevatedOnExecuteActionComplete( | |||
| 4114 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_ACTION_COMPLETE message to per-user process."); | 4114 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_ACTION_COMPLETE message to per-user process."); |
| 4115 | 4115 | ||
| 4116 | LExit: | 4116 | LExit: |
| 4117 | ReleaseBuffer(pbSendData); | 4117 | ReleaseMem(pbSendData); |
| 4118 | 4118 | ||
| 4119 | return hr; | 4119 | return hr; |
| 4120 | } | 4120 | } |
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index f5ea5332..9daa18a1 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
| @@ -16,9 +16,11 @@ static HRESULT InitializeEngineState( | |||
| 16 | static void UninitializeEngineState( | 16 | static void UninitializeEngineState( |
| 17 | __in BURN_ENGINE_STATE* pEngineState | 17 | __in BURN_ENGINE_STATE* pEngineState |
| 18 | ); | 18 | ); |
| 19 | #if 0 | ||
| 19 | static HRESULT RunUntrusted( | 20 | static HRESULT RunUntrusted( |
| 20 | __in BURN_ENGINE_STATE* pEngineState | 21 | __in BURN_ENGINE_STATE* pEngineState |
| 21 | ); | 22 | ); |
| 23 | #endif | ||
| 22 | static HRESULT RunNormal( | 24 | static HRESULT RunNormal( |
| 23 | __in HINSTANCE hInstance, | 25 | __in HINSTANCE hInstance, |
| 24 | __in BURN_ENGINE_STATE* pEngineState | 26 | __in BURN_ENGINE_STATE* pEngineState |
| @@ -38,12 +40,13 @@ static HRESULT RunRunOnce( | |||
| 38 | ); | 40 | ); |
| 39 | static HRESULT RunApplication( | 41 | static HRESULT RunApplication( |
| 40 | __in BURN_ENGINE_STATE* pEngineState, | 42 | __in BURN_ENGINE_STATE* pEngineState, |
| 43 | __in BOOL fSecondaryBootstrapperApplication, | ||
| 41 | __out BOOL* pfReloadApp, | 44 | __out BOOL* pfReloadApp, |
| 42 | __out BOOL* pfSkipCleanup | 45 | __out BOOL* pfSkipCleanup |
| 43 | ); | 46 | ); |
| 44 | static HRESULT ProcessMessage( | 47 | static HRESULT ProcessMessage( |
| 45 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 48 | __in BAENGINE_CONTEXT* pEngineContext, |
| 46 | __in BOOTSTRAPPER_ENGINE_ACTION* pAction | 49 | __in BAENGINE_ACTION* pAction |
| 47 | ); | 50 | ); |
| 48 | static HRESULT DAPI RedirectLoggingOverPipe( | 51 | static HRESULT DAPI RedirectLoggingOverPipe( |
| 49 | __in_z LPCSTR szString, | 52 | __in_z LPCSTR szString, |
| @@ -72,28 +75,6 @@ static void CALLBACK BurnTraceError( | |||
| 72 | 75 | ||
| 73 | // function definitions | 76 | // function definitions |
| 74 | 77 | ||
| 75 | extern "C" BOOL EngineInCleanRoom( | ||
| 76 | __in_z_opt LPCWSTR wzCommandLine | ||
| 77 | ) | ||
| 78 | { | ||
| 79 | // Be very careful with the functions you call from here. | ||
| 80 | // This function will be called before ::SetDefaultDllDirectories() | ||
| 81 | // has been called so dependencies outside of kernel32.dll are | ||
| 82 | // very likely to introduce DLL hijacking opportunities. | ||
| 83 | |||
| 84 | static DWORD cchCleanRoomSwitch = lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | ||
| 85 | |||
| 86 | // This check is wholly dependent on the clean room command line switch being | ||
| 87 | // present at the beginning of the command line. Since Burn is the only thing | ||
| 88 | // that should be setting this command line option, that is in our control. | ||
| 89 | BOOL fInCleanRoom = (wzCommandLine && | ||
| 90 | (wzCommandLine[0] == L'-' || wzCommandLine[0] == L'/') && | ||
| 91 | CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, wzCommandLine + 1, cchCleanRoomSwitch, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, cchCleanRoomSwitch) | ||
| 92 | ); | ||
| 93 | |||
| 94 | return fInCleanRoom; | ||
| 95 | } | ||
| 96 | |||
| 97 | extern "C" HRESULT EngineRun( | 78 | extern "C" HRESULT EngineRun( |
| 98 | __in HINSTANCE hInstance, | 79 | __in HINSTANCE hInstance, |
| 99 | __in HANDLE hEngineFile, | 80 | __in HANDLE hEngineFile, |
| @@ -113,7 +94,6 @@ extern "C" HRESULT EngineRun( | |||
| 113 | SYSTEM_INFO si = { }; | 94 | SYSTEM_INFO si = { }; |
| 114 | RTL_OSVERSIONINFOEXW ovix = { }; | 95 | RTL_OSVERSIONINFOEXW ovix = { }; |
| 115 | LPWSTR sczExePath = NULL; | 96 | LPWSTR sczExePath = NULL; |
| 116 | BOOL fRunUntrusted = FALSE; | ||
| 117 | BOOL fRunNormal = FALSE; | 97 | BOOL fRunNormal = FALSE; |
| 118 | BOOL fRunElevated = FALSE; | 98 | BOOL fRunElevated = FALSE; |
| 119 | BOOL fRunRunOnce = FALSE; | 99 | BOOL fRunRunOnce = FALSE; |
| @@ -214,25 +194,18 @@ extern "C" HRESULT EngineRun( | |||
| 214 | // Select run mode. | 194 | // Select run mode. |
| 215 | switch (engineState.internalCommand.mode) | 195 | switch (engineState.internalCommand.mode) |
| 216 | { | 196 | { |
| 217 | case BURN_MODE_UNTRUSTED: | ||
| 218 | fRunUntrusted = TRUE; | ||
| 219 | |||
| 220 | hr = RunUntrusted(&engineState); | ||
| 221 | ExitOnFailure(hr, "Failed to run untrusted mode."); | ||
| 222 | break; | ||
| 223 | |||
| 224 | case BURN_MODE_NORMAL: | 197 | case BURN_MODE_NORMAL: |
| 225 | fRunNormal = TRUE; | 198 | fRunNormal = TRUE; |
| 226 | 199 | ||
| 227 | hr = RunNormal(hInstance, &engineState); | 200 | hr = RunNormal(hInstance, &engineState); |
| 228 | ExitOnFailure(hr, "Failed to run per-user mode."); | 201 | ExitOnFailure(hr, "Failed to run normal mode."); |
| 229 | break; | 202 | break; |
| 230 | 203 | ||
| 231 | case BURN_MODE_ELEVATED: | 204 | case BURN_MODE_ELEVATED: |
| 232 | fRunElevated = TRUE; | 205 | fRunElevated = TRUE; |
| 233 | 206 | ||
| 234 | hr = RunElevated(hInstance, wzCommandLine, &engineState); | 207 | hr = RunElevated(hInstance, wzCommandLine, &engineState); |
| 235 | ExitOnFailure(hr, "Failed to run per-machine mode."); | 208 | ExitOnFailure(hr, "Failed to run elevated mode."); |
| 236 | break; | 209 | break; |
| 237 | 210 | ||
| 238 | case BURN_MODE_EMBEDDED: | 211 | case BURN_MODE_EMBEDDED: |
| @@ -266,7 +239,7 @@ LExit: | |||
| 266 | LoggingOpenFailed(); | 239 | LoggingOpenFailed(); |
| 267 | } | 240 | } |
| 268 | 241 | ||
| 269 | UserExperienceRemove(&engineState.userExperience); | 242 | BootstrapperApplicationRemove(&engineState.userExperience); |
| 270 | 243 | ||
| 271 | CacheRemoveBaseWorkingFolder(&engineState.cache); | 244 | CacheRemoveBaseWorkingFolder(&engineState.cache); |
| 272 | CacheUninitialize(&engineState.cache); | 245 | CacheUninitialize(&engineState.cache); |
| @@ -284,10 +257,6 @@ LExit: | |||
| 284 | { | 257 | { |
| 285 | LogId(REPORT_STANDARD, MSG_EXITING, FAILED(hr) ? (int)hr : *pdwExitCode, LoggingBoolToString(engineState.fRestart)); | 258 | LogId(REPORT_STANDARD, MSG_EXITING, FAILED(hr) ? (int)hr : *pdwExitCode, LoggingBoolToString(engineState.fRestart)); |
| 286 | } | 259 | } |
| 287 | else if (fRunUntrusted) | ||
| 288 | { | ||
| 289 | LogId(REPORT_STANDARD, MSG_EXITING_CLEAN_ROOM, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 290 | } | ||
| 291 | else if (fRunRunOnce) | 260 | else if (fRunRunOnce) |
| 292 | { | 261 | { |
| 293 | LogId(REPORT_STANDARD, MSG_EXITING_RUN_ONCE, FAILED(hr) ? (int)hr : *pdwExitCode); | 262 | LogId(REPORT_STANDARD, MSG_EXITING_RUN_ONCE, FAILED(hr) ? (int)hr : *pdwExitCode); |
| @@ -452,7 +421,7 @@ static void UninitializeEngineState( | |||
| 452 | BurnExtensionUninitialize(&pEngineState->extensions); | 421 | BurnExtensionUninitialize(&pEngineState->extensions); |
| 453 | 422 | ||
| 454 | ::DeleteCriticalSection(&pEngineState->userExperience.csEngineActive); | 423 | ::DeleteCriticalSection(&pEngineState->userExperience.csEngineActive); |
| 455 | UserExperienceUninitialize(&pEngineState->userExperience); | 424 | BootstrapperApplicationUninitialize(&pEngineState->userExperience); |
| 456 | 425 | ||
| 457 | ApprovedExesUninitialize(&pEngineState->approvedExes); | 426 | ApprovedExesUninitialize(&pEngineState->approvedExes); |
| 458 | DependencyUninitialize(&pEngineState->dependencies); | 427 | DependencyUninitialize(&pEngineState->dependencies); |
| @@ -475,7 +444,6 @@ static void UninitializeEngineState( | |||
| 475 | ReleaseStr(pEngineState->internalCommand.sczIgnoreDependencies); | 444 | ReleaseStr(pEngineState->internalCommand.sczIgnoreDependencies); |
| 476 | ReleaseStr(pEngineState->internalCommand.sczLogFile); | 445 | ReleaseStr(pEngineState->internalCommand.sczLogFile); |
| 477 | ReleaseStr(pEngineState->internalCommand.sczOriginalSource); | 446 | ReleaseStr(pEngineState->internalCommand.sczOriginalSource); |
| 478 | ReleaseStr(pEngineState->internalCommand.sczSourceProcessPath); | ||
| 479 | ReleaseStr(pEngineState->internalCommand.sczEngineWorkingDirectory); | 447 | ReleaseStr(pEngineState->internalCommand.sczEngineWorkingDirectory); |
| 480 | 448 | ||
| 481 | ReleaseStr(pEngineState->log.sczExtension); | 449 | ReleaseStr(pEngineState->log.sczExtension); |
| @@ -489,82 +457,6 @@ static void UninitializeEngineState( | |||
| 489 | memset(pEngineState, 0, sizeof(BURN_ENGINE_STATE)); | 457 | memset(pEngineState, 0, sizeof(BURN_ENGINE_STATE)); |
| 490 | } | 458 | } |
| 491 | 459 | ||
| 492 | static HRESULT RunUntrusted( | ||
| 493 | __in BURN_ENGINE_STATE* pEngineState | ||
| 494 | ) | ||
| 495 | { | ||
| 496 | HRESULT hr = S_OK; | ||
| 497 | LPWSTR sczCurrentProcessPath = NULL; | ||
| 498 | LPWSTR wzCleanRoomBundlePath = NULL; | ||
| 499 | LPWSTR sczCachedCleanRoomBundlePath = NULL; | ||
| 500 | LPWSTR sczParameters = NULL; | ||
| 501 | LPWSTR sczFullCommandLine = NULL; | ||
| 502 | PROCESS_INFORMATION pi = { }; | ||
| 503 | HANDLE hFileAttached = NULL; | ||
| 504 | HANDLE hFileSelf = NULL; | ||
| 505 | HANDLE hProcess = NULL; | ||
| 506 | |||
| 507 | // Initialize logging. | ||
| 508 | hr = LoggingOpen(&pEngineState->log, &pEngineState->internalCommand, &pEngineState->command, &pEngineState->variables, pEngineState->registration.sczDisplayName); | ||
| 509 | ExitOnFailure(hr, "Failed to open clean room log."); | ||
| 510 | |||
| 511 | hr = PathForCurrentProcess(&sczCurrentProcessPath, NULL); | ||
| 512 | ExitOnFailure(hr, "Failed to get path for current process."); | ||
| 513 | |||
| 514 | // If we're running from the package cache, we're in a secure | ||
| 515 | // folder (DLLs cannot be inserted here for hijacking purposes) | ||
| 516 | // so just launch the current process's path as the clean room | ||
| 517 | // process. Technically speaking, we'd be able to skip creating | ||
| 518 | // a clean room process at all (since we're already running from | ||
| 519 | // a secure folder) but it makes the code that only wants to run | ||
| 520 | // in clean room more complicated if we don't launch an explicit | ||
| 521 | // clean room process. | ||
| 522 | if (CacheBundleRunningFromCache(&pEngineState->cache)) | ||
| 523 | { | ||
| 524 | wzCleanRoomBundlePath = sczCurrentProcessPath; | ||
| 525 | } | ||
| 526 | else | ||
| 527 | { | ||
| 528 | hr = CacheBundleToCleanRoom(&pEngineState->cache, &pEngineState->section, &sczCachedCleanRoomBundlePath); | ||
| 529 | ExitOnFailure(hr, "Failed to cache to clean room."); | ||
| 530 | |||
| 531 | wzCleanRoomBundlePath = sczCachedCleanRoomBundlePath; | ||
| 532 | } | ||
| 533 | |||
| 534 | hr = CoreCreateCleanRoomCommandLine(&sczParameters, pEngineState, wzCleanRoomBundlePath, sczCurrentProcessPath, &hFileAttached, &hFileSelf); | ||
| 535 | ExitOnFailure(hr, "Failed to create clean room command-line."); | ||
| 536 | |||
| 537 | hr = StrAllocFormattedSecure(&sczFullCommandLine, L"\"%ls\" %ls", wzCleanRoomBundlePath, sczParameters); | ||
| 538 | ExitOnFailure(hr, "Failed to allocate full command-line."); | ||
| 539 | |||
| 540 | hr = CoreCreateProcess(wzCleanRoomBundlePath, sczFullCommandLine, TRUE, 0, NULL, static_cast<WORD>(pEngineState->command.nCmdShow), &pi); | ||
| 541 | ExitOnFailure(hr, "Failed to launch clean room process: %ls", sczFullCommandLine); | ||
| 542 | |||
| 543 | hProcess = pi.hProcess; | ||
| 544 | pi.hProcess = NULL; | ||
| 545 | |||
| 546 | hr = ProcWaitForCompletion(hProcess, INFINITE, &pEngineState->userExperience.dwExitCode); | ||
| 547 | ExitOnFailure(hr, "Failed to wait for clean room process: %ls", wzCleanRoomBundlePath); | ||
| 548 | |||
| 549 | LExit: | ||
| 550 | // If the splash screen is still around, close it. | ||
| 551 | if (::IsWindow(pEngineState->command.hwndSplashScreen)) | ||
| 552 | { | ||
| 553 | ::PostMessageW(pEngineState->command.hwndSplashScreen, WM_CLOSE, 0, 0); | ||
| 554 | } | ||
| 555 | |||
| 556 | ReleaseHandle(pi.hThread); | ||
| 557 | ReleaseFileHandle(hFileSelf); | ||
| 558 | ReleaseFileHandle(hFileAttached); | ||
| 559 | ReleaseHandle(hProcess); | ||
| 560 | StrSecureZeroFreeString(sczFullCommandLine); | ||
| 561 | StrSecureZeroFreeString(sczParameters); | ||
| 562 | ReleaseStr(sczCachedCleanRoomBundlePath); | ||
| 563 | ReleaseStr(sczCurrentProcessPath); | ||
| 564 | |||
| 565 | return hr; | ||
| 566 | } | ||
| 567 | |||
| 568 | static HRESULT RunNormal( | 460 | static HRESULT RunNormal( |
| 569 | __in HINSTANCE hInstance, | 461 | __in HINSTANCE hInstance, |
| 570 | __in BURN_ENGINE_STATE* pEngineState | 462 | __in BURN_ENGINE_STATE* pEngineState |
| @@ -574,9 +466,10 @@ static HRESULT RunNormal( | |||
| 574 | LPWSTR sczOriginalSource = NULL; | 466 | LPWSTR sczOriginalSource = NULL; |
| 575 | LPWSTR sczCopiedOriginalSource = NULL; | 467 | LPWSTR sczCopiedOriginalSource = NULL; |
| 576 | BOOL fContinueExecution = TRUE; | 468 | BOOL fContinueExecution = TRUE; |
| 577 | BOOL fReloadApp = FALSE; | 469 | BOOL fReloadApp = TRUE; |
| 578 | BOOL fSkipCleanup = FALSE; | 470 | BOOL fSkipCleanup = FALSE; |
| 579 | BURN_EXTENSION_ENGINE_CONTEXT extensionEngineContext = { }; | 471 | BURN_EXTENSION_ENGINE_CONTEXT extensionEngineContext = { }; |
| 472 | BOOL fRunSecondaryBootstrapperApplication = FALSE; | ||
| 580 | 473 | ||
| 581 | // Initialize logging. | 474 | // Initialize logging. |
| 582 | hr = LoggingOpen(&pEngineState->log, &pEngineState->internalCommand, &pEngineState->command, &pEngineState->variables, pEngineState->registration.sczDisplayName); | 475 | hr = LoggingOpen(&pEngineState->log, &pEngineState->internalCommand, &pEngineState->command, &pEngineState->variables, pEngineState->registration.sczDisplayName); |
| @@ -644,14 +537,27 @@ static HRESULT RunNormal( | |||
| 644 | hr = BurnExtensionLoad(&pEngineState->extensions, &extensionEngineContext); | 537 | hr = BurnExtensionLoad(&pEngineState->extensions, &extensionEngineContext); |
| 645 | ExitOnFailure(hr, "Failed to load BundleExtensions."); | 538 | ExitOnFailure(hr, "Failed to load BundleExtensions."); |
| 646 | 539 | ||
| 647 | do | 540 | // The secondary bootstrapper application only gets one chance to execute. That means |
| 541 | // first time through we run the primary bootstrapper application and on reload we run | ||
| 542 | // the secondary bootstrapper application, and if the secondary bootstrapper application | ||
| 543 | // requests a reload, we load the primary bootstrapper application one last time. | ||
| 544 | for (DWORD i = 0; i < 3 && fReloadApp; i++) | ||
| 648 | { | 545 | { |
| 649 | fReloadApp = FALSE; | 546 | fReloadApp = FALSE; |
| 650 | pEngineState->fQuit = FALSE; | 547 | pEngineState->fQuit = FALSE; |
| 651 | 548 | ||
| 652 | hr = RunApplication(pEngineState, &fReloadApp, &fSkipCleanup); | 549 | hr = RunApplication(pEngineState, fRunSecondaryBootstrapperApplication, &fReloadApp, &fSkipCleanup); |
| 653 | ExitOnFailure(hr, "Failed while running "); | 550 | |
| 654 | } while (fReloadApp); | 551 | // If reloading, switch to the other bootstrapper application. |
| 552 | if (fReloadApp) | ||
| 553 | { | ||
| 554 | fRunSecondaryBootstrapperApplication = !fRunSecondaryBootstrapperApplication; | ||
| 555 | } | ||
| 556 | else if (FAILED(hr)) | ||
| 557 | { | ||
| 558 | break; | ||
| 559 | } | ||
| 560 | } | ||
| 655 | 561 | ||
| 656 | LExit: | 562 | LExit: |
| 657 | if (!fSkipCleanup) | 563 | if (!fSkipCleanup) |
| @@ -790,73 +696,64 @@ LExit: | |||
| 790 | return hr; | 696 | return hr; |
| 791 | } | 697 | } |
| 792 | 698 | ||
| 793 | static void CALLBACK FreeQueueItem( | ||
| 794 | __in void* pvValue, | ||
| 795 | __in void* /*pvContext*/ | ||
| 796 | ) | ||
| 797 | { | ||
| 798 | BOOTSTRAPPER_ENGINE_ACTION* pAction = reinterpret_cast<BOOTSTRAPPER_ENGINE_ACTION*>(pvValue); | ||
| 799 | |||
| 800 | LogId(REPORT_WARNING, MSG_IGNORE_OPERATION_AFTER_QUIT, LoggingBurnMessageToString(pAction->dwMessage)); | ||
| 801 | |||
| 802 | CoreBootstrapperEngineActionUninitialize(pAction); | ||
| 803 | MemFree(pAction); | ||
| 804 | } | ||
| 805 | |||
| 806 | static HRESULT RunApplication( | 699 | static HRESULT RunApplication( |
| 807 | __in BURN_ENGINE_STATE* pEngineState, | 700 | __in BURN_ENGINE_STATE* pEngineState, |
| 701 | __in BOOL fSecondaryBootstrapperApplication, | ||
| 808 | __out BOOL* pfReloadApp, | 702 | __out BOOL* pfReloadApp, |
| 809 | __out BOOL* pfSkipCleanup | 703 | __out BOOL* pfSkipCleanup |
| 810 | ) | 704 | ) |
| 811 | { | 705 | { |
| 812 | HRESULT hr = S_OK; | 706 | HRESULT hr = S_OK; |
| 813 | BOOTSTRAPPER_ENGINE_CONTEXT engineContext = { }; | ||
| 814 | BOOL fStartupCalled = FALSE; | 707 | BOOL fStartupCalled = FALSE; |
| 708 | BAENGINE_CONTEXT* pEngineContext = NULL; | ||
| 709 | HANDLE rghWait[2] = { }; | ||
| 710 | DWORD dwSignaled = 0; | ||
| 711 | BAENGINE_ACTION* pAction = NULL; | ||
| 815 | BOOTSTRAPPER_SHUTDOWN_ACTION shutdownAction = BOOTSTRAPPER_SHUTDOWN_ACTION_NONE; | 712 | BOOTSTRAPPER_SHUTDOWN_ACTION shutdownAction = BOOTSTRAPPER_SHUTDOWN_ACTION_NONE; |
| 816 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | ||
| 817 | |||
| 818 | // Setup the bootstrapper engine. | ||
| 819 | engineContext.pEngineState = pEngineState; | ||
| 820 | 713 | ||
| 821 | ::InitializeCriticalSection(&engineContext.csQueue); | 714 | // Start the bootstrapper application. |
| 822 | 715 | hr = BootstrapperApplicationStart(pEngineState, fSecondaryBootstrapperApplication); | |
| 823 | engineContext.hQueueSemaphore = ::CreateSemaphoreW(NULL, 0, LONG_MAX, NULL); | 716 | ExitOnFailure(hr, "Failed to start bootstrapper application."); |
| 824 | ExitOnNullWithLastError(engineContext.hQueueSemaphore, hr, "Failed to create semaphore for queue."); | ||
| 825 | |||
| 826 | hr = QueCreate(&engineContext.hQueue); | ||
| 827 | ExitOnFailure(hr, "Failed to create queue for bootstrapper engine."); | ||
| 828 | 717 | ||
| 829 | // Load the bootstrapper application. | 718 | pEngineContext = pEngineState->userExperience.pEngineContext; |
| 830 | hr = UserExperienceLoad(&pEngineState->userExperience, &engineContext, &pEngineState->command); | ||
| 831 | ExitOnFailure(hr, "Failed to load BA."); | ||
| 832 | 719 | ||
| 833 | fStartupCalled = TRUE; | 720 | fStartupCalled = TRUE; |
| 834 | hr = UserExperienceOnStartup(&pEngineState->userExperience); | 721 | hr = BACallbackOnStartup(&pEngineState->userExperience); |
| 835 | ExitOnFailure(hr, "Failed to start bootstrapper application."); | 722 | ExitOnFailure(hr, "Failed to start bootstrapper application."); |
| 836 | 723 | ||
| 724 | rghWait[0] = pEngineState->userExperience.hBAProcess; | ||
| 725 | rghWait[1] = pEngineContext->hQueueSemaphore; | ||
| 726 | |||
| 837 | while (!pEngineState->fQuit) | 727 | while (!pEngineState->fQuit) |
| 838 | { | 728 | { |
| 839 | hr = AppWaitForSingleObject(engineContext.hQueueSemaphore, INFINITE); | 729 | hr = AppWaitForMultipleObjects(countof(rghWait), rghWait, FALSE, INFINITE, &dwSignaled); |
| 840 | ExitOnFailure(hr, "Failed to wait on queue event."); | 730 | ExitOnFailure(hr, "Failed to wait on queue event."); |
| 841 | 731 | ||
| 842 | ::EnterCriticalSection(&engineContext.csQueue); | 732 | // If the bootstrapper application process exited, bail. |
| 733 | if (0 == dwSignaled) | ||
| 734 | { | ||
| 735 | pEngineState->fQuit = TRUE; | ||
| 736 | break; | ||
| 737 | } | ||
| 738 | |||
| 739 | ::EnterCriticalSection(&pEngineContext->csQueue); | ||
| 843 | 740 | ||
| 844 | hr = QueDequeue(engineContext.hQueue, reinterpret_cast<void**>(&pAction)); | 741 | hr = QueDequeue(pEngineContext->hQueue, reinterpret_cast<void**>(&pAction)); |
| 845 | 742 | ||
| 846 | ::LeaveCriticalSection(&engineContext.csQueue); | 743 | ::LeaveCriticalSection(&pEngineContext->csQueue); |
| 847 | 744 | ||
| 848 | ExitOnFailure(hr, "Failed to dequeue action."); | 745 | ExitOnFailure(hr, "Failed to dequeue action."); |
| 849 | 746 | ||
| 850 | ProcessMessage(&engineContext, pAction); | 747 | ProcessMessage(pEngineContext, pAction); |
| 851 | 748 | ||
| 852 | CoreBootstrapperEngineActionUninitialize(pAction); | 749 | BAEngineFreeAction(pAction); |
| 853 | MemFree(pAction); | 750 | pAction = NULL; |
| 854 | } | 751 | } |
| 855 | 752 | ||
| 856 | LExit: | 753 | LExit: |
| 857 | if (fStartupCalled) | 754 | if (fStartupCalled) |
| 858 | { | 755 | { |
| 859 | UserExperienceOnShutdown(&pEngineState->userExperience, &shutdownAction); | 756 | BACallbackOnShutdown(&pEngineState->userExperience, &shutdownAction); |
| 860 | if (BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART == shutdownAction) | 757 | if (BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART == shutdownAction) |
| 861 | { | 758 | { |
| 862 | LogId(REPORT_STANDARD, MSG_BA_REQUESTED_RESTART, LoggingBoolToString(pEngineState->fRestart)); | 759 | LogId(REPORT_STANDARD, MSG_BA_REQUESTED_RESTART, LoggingBoolToString(pEngineState->fRestart)); |
| @@ -873,26 +770,34 @@ LExit: | |||
| 873 | *pfSkipCleanup = TRUE; | 770 | *pfSkipCleanup = TRUE; |
| 874 | } | 771 | } |
| 875 | } | 772 | } |
| 773 | else // if the bootstrapper application did not start, there won't be anything to clean up. | ||
| 774 | { | ||
| 775 | *pfSkipCleanup = TRUE; | ||
| 776 | } | ||
| 876 | 777 | ||
| 877 | // Unload BA. | 778 | // Stop the BA. |
| 878 | UserExperienceUnload(&pEngineState->userExperience, *pfReloadApp); | 779 | BootstrapperApplicationStop(&pEngineState->userExperience, pfReloadApp); |
| 879 | 780 | ||
| 880 | ::DeleteCriticalSection(&engineContext.csQueue); | 781 | if (*pfReloadApp && !pEngineState->userExperience.pSecondaryExePayload) |
| 881 | ReleaseHandle(engineContext.hQueueSemaphore); | 782 | { |
| 882 | ReleaseQueue(engineContext.hQueue, FreeQueueItem, &engineContext); | 783 | // If the BA requested a reload but we do not have a secondary EXE, |
| 784 | // then log a message and do not reload. | ||
| 785 | LogId(REPORT_STANDARD, MSG_BA_NO_SECONDARY_BOOSTRAPPER_SO_RELOAD_NOT_SUPPORTED); | ||
| 786 | *pfReloadApp = FALSE; | ||
| 787 | } | ||
| 883 | 788 | ||
| 884 | return hr; | 789 | return hr; |
| 885 | } | 790 | } |
| 886 | 791 | ||
| 887 | static HRESULT ProcessMessage( | 792 | static HRESULT ProcessMessage( |
| 888 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 793 | __in BAENGINE_CONTEXT* pEngineContext, |
| 889 | __in BOOTSTRAPPER_ENGINE_ACTION* pAction | 794 | __in BAENGINE_ACTION* pAction |
| 890 | ) | 795 | ) |
| 891 | { | 796 | { |
| 892 | HRESULT hr = S_OK; | 797 | HRESULT hr = S_OK; |
| 893 | BURN_ENGINE_STATE* pEngineState = pEngineContext->pEngineState; | 798 | BURN_ENGINE_STATE* pEngineState = pEngineContext->pEngineState; |
| 894 | 799 | ||
| 895 | UserExperienceActivateEngine(&pEngineState->userExperience); | 800 | BootstrapperApplicationActivateEngine(&pEngineState->userExperience); |
| 896 | 801 | ||
| 897 | switch (pAction->dwMessage) | 802 | switch (pAction->dwMessage) |
| 898 | { | 803 | { |
| @@ -921,7 +826,7 @@ static HRESULT ProcessMessage( | |||
| 921 | break; | 826 | break; |
| 922 | } | 827 | } |
| 923 | 828 | ||
| 924 | UserExperienceDeactivateEngine(&pEngineState->userExperience); | 829 | BootstrapperApplicationDeactivateEngine(&pEngineState->userExperience); |
| 925 | 830 | ||
| 926 | return hr; | 831 | return hr; |
| 927 | } | 832 | } |
| @@ -971,7 +876,7 @@ static HRESULT LogStringOverPipe( | |||
| 971 | hr = (HRESULT)dwResult; | 876 | hr = (HRESULT)dwResult; |
| 972 | 877 | ||
| 973 | LExit: | 878 | LExit: |
| 974 | ReleaseBuffer(pbData); | 879 | ReleaseMem(pbData); |
| 975 | 880 | ||
| 976 | return hr; | 881 | return hr; |
| 977 | } | 882 | } |
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index 39aea60e..932b6931 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc | |||
| @@ -253,6 +253,13 @@ Language=English | |||
| 253 | Bootstrapper application already requested to quit, ignoring request: '%1!hs!'. | 253 | Bootstrapper application already requested to quit, ignoring request: '%1!hs!'. |
| 254 | . | 254 | . |
| 255 | 255 | ||
| 256 | MessageId=59 | ||
| 257 | Severity=Warning | ||
| 258 | SymbolicName=MSG_BA_NO_SECONDARY_BOOSTRAPPER_SO_RELOAD_NOT_SUPPORTED | ||
| 259 | Language=English | ||
| 260 | Bootstrapper application requested reload but there is no secondary bootstrapper application, ignoring the request to reload. | ||
| 261 | . | ||
| 262 | |||
| 256 | MessageId=100 | 263 | MessageId=100 |
| 257 | Severity=Success | 264 | Severity=Success |
| 258 | SymbolicName=MSG_DETECT_BEGIN | 265 | SymbolicName=MSG_DETECT_BEGIN |
| @@ -1076,7 +1083,7 @@ MessageId=381 | |||
| 1076 | Severity=Warning | 1083 | Severity=Warning |
| 1077 | SymbolicName=MSG_APPLY_CANCEL_IGNORED_DURING_ROLLBACK | 1084 | SymbolicName=MSG_APPLY_CANCEL_IGNORED_DURING_ROLLBACK |
| 1078 | Language=English | 1085 | Language=English |
| 1079 | Ignoring application request to cancel from %1!ls! during rollback. | 1086 | Ignoring application request to cancel from %1!ls! during rollback. |
| 1080 | . | 1087 | . |
| 1081 | 1088 | ||
| 1082 | MessageId=382 | 1089 | MessageId=382 |
diff --git a/src/burn/engine/engine.vcxproj b/src/burn/engine/engine.vcxproj index 152e9cec..7a2447f8 100644 --- a/src/burn/engine/engine.vcxproj +++ b/src/burn/engine/engine.vcxproj | |||
| @@ -47,17 +47,20 @@ | |||
| 47 | 47 | ||
| 48 | <ImportGroup Label="ExtensionSettings"> | 48 | <ImportGroup Label="ExtensionSettings"> |
| 49 | </ImportGroup> | 49 | </ImportGroup> |
| 50 | |||
| 50 | <ImportGroup Label="Shared"> | 51 | <ImportGroup Label="Shared"> |
| 51 | </ImportGroup> | 52 | </ImportGroup> |
| 52 | 53 | ||
| 53 | <ItemGroup> | 54 | <ItemGroup> |
| 54 | <ClCompile Include="apply.cpp" /> | 55 | <ClCompile Include="apply.cpp" /> |
| 55 | <ClCompile Include="approvedexe.cpp" /> | 56 | <ClCompile Include="approvedexe.cpp" /> |
| 57 | <ClCompile Include="bacallback.cpp" /> | ||
| 58 | <ClCompile Include="bootstrapperapplication.cpp" /> | ||
| 56 | <ClCompile Include="bundlepackageengine.cpp" /> | 59 | <ClCompile Include="bundlepackageengine.cpp" /> |
| 57 | <ClCompile Include="burnextension.cpp" /> | 60 | <ClCompile Include="burnextension.cpp" /> |
| 58 | <ClCompile Include="detect.cpp" /> | 61 | <ClCompile Include="detect.cpp" /> |
| 59 | <ClCompile Include="embedded.cpp" /> | 62 | <ClCompile Include="embedded.cpp" /> |
| 60 | <ClCompile Include="EngineForApplication.cpp" /> | 63 | <ClCompile Include="baengine.cpp" /> |
| 61 | <ClCompile Include="EngineForExtension.cpp" /> | 64 | <ClCompile Include="EngineForExtension.cpp" /> |
| 62 | <ClCompile Include="externalengine.cpp" /> | 65 | <ClCompile Include="externalengine.cpp" /> |
| 63 | <ClCompile Include="cabextract.cpp" /> | 66 | <ClCompile Include="cabextract.cpp" /> |
| @@ -99,10 +102,12 @@ | |||
| 99 | <ItemGroup> | 102 | <ItemGroup> |
| 100 | <ClInclude Include="apply.h" /> | 103 | <ClInclude Include="apply.h" /> |
| 101 | <ClInclude Include="approvedexe.h" /> | 104 | <ClInclude Include="approvedexe.h" /> |
| 102 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\BootstrapperApplication.h" /> | 105 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\batypes.h" /> |
| 103 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\BootstrapperEngine.h" /> | 106 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\baenginetypes.h" /> |
| 104 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\BundleExtension.h" /> | 107 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\BundleExtension.h" /> |
| 105 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\BundleExtensionEngine.h" /> | 108 | <ClInclude Include="..\..\api\burn\WixToolset.BootstrapperCore.Native\inc\BundleExtensionEngine.h" /> |
| 109 | <ClInclude Include="bacallback.h" /> | ||
| 110 | <ClInclude Include="bootstrapperapplication.h" /> | ||
| 106 | <ClInclude Include="bundlepackageengine.h" /> | 111 | <ClInclude Include="bundlepackageengine.h" /> |
| 107 | <ClInclude Include="burnextension.h" /> | 112 | <ClInclude Include="burnextension.h" /> |
| 108 | <ClInclude Include="cabextract.h" /> | 113 | <ClInclude Include="cabextract.h" /> |
| @@ -114,7 +119,7 @@ | |||
| 114 | <ClInclude Include="detect.h" /> | 119 | <ClInclude Include="detect.h" /> |
| 115 | <ClInclude Include="elevation.h" /> | 120 | <ClInclude Include="elevation.h" /> |
| 116 | <ClInclude Include="embedded.h" /> | 121 | <ClInclude Include="embedded.h" /> |
| 117 | <ClInclude Include="EngineForApplication.h" /> | 122 | <ClInclude Include="baengine.h" /> |
| 118 | <ClInclude Include="EngineForExtension.h" /> | 123 | <ClInclude Include="EngineForExtension.h" /> |
| 119 | <ClInclude Include="exeengine.h" /> | 124 | <ClInclude Include="exeengine.h" /> |
| 120 | <ClInclude Include="externalengine.h" /> | 125 | <ClInclude Include="externalengine.h" /> |
| @@ -164,32 +169,14 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> | |||
| 164 | <szVerMajorMinorBuild>$(rmj).$(rmm).$(rup).$(rpr)</szVerMajorMinorBuild> | 169 | <szVerMajorMinorBuild>$(rmj).$(rmm).$(rup).$(rpr)</szVerMajorMinorBuild> |
| 165 | <szInformationalVersion>$(InformationalVersion)</szInformationalVersion> | 170 | <szInformationalVersion>$(InformationalVersion)</szInformationalVersion> |
| 166 | </PropertyGroup> | 171 | </PropertyGroup> |
| 167 | |||
| 168 | <ItemGroup> | 172 | <ItemGroup> |
| 169 | <BurnVersionLines Include=" | 173 | <BurnVersionLines Include="
// <auto-generated/>
#ifndef _VERSION_FILE_H_
#define _VERSION_FILE_H_

#define szVerMajorMinorBuild "$(szVerMajorMinorBuild)"
#define wzVerMajorMinorBuild L"$(szVerMajorMinorBuild)"
#define rmj $(rmj)
#define rmm $(rmm)
#define rup $(rup)
#define rpr $(rpr)
#define szInformationalVersion "$(szInformationalVersion)"
#define wzInformationalVersion L"$(szInformationalVersion)"

#endif
" /> |
| 170 | // <auto-generated/> | ||
| 171 | #ifndef _VERSION_FILE_H_ | ||
| 172 | #define _VERSION_FILE_H_ | ||
| 173 | |||
| 174 | #define szVerMajorMinorBuild "$(szVerMajorMinorBuild)" | ||
| 175 | #define wzVerMajorMinorBuild L"$(szVerMajorMinorBuild)" | ||
| 176 | #define rmj $(rmj) | ||
| 177 | #define rmm $(rmm) | ||
| 178 | #define rup $(rup) | ||
| 179 | #define rpr $(rpr) | ||
| 180 | #define szInformationalVersion "$(szInformationalVersion)" | ||
| 181 | #define wzInformationalVersion L"$(szInformationalVersion)" | ||
| 182 | |||
| 183 | #endif | ||
| 184 | "/> | ||
| 185 | </ItemGroup> | 174 | </ItemGroup> |
| 186 | |||
| 187 | <WriteLinesToFile Overwrite="true" File="$(BurnGeneratedHeaderDirectory)engine.version.h" Lines="@(BurnVersionLines)" /> | 175 | <WriteLinesToFile Overwrite="true" File="$(BurnGeneratedHeaderDirectory)engine.version.h" Lines="@(BurnVersionLines)" /> |
| 188 | </Target> | 176 | </Target> |
| 189 | 177 | ||
| 190 | <ItemGroup> | 178 | <ItemGroup> |
| 191 | <PackageReference Include="WixToolset.DUtil" /> | 179 | <PackageReference Include="WixToolset.DUtil" /> |
| 192 | |||
| 193 | <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" /> | 180 | <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" /> |
| 194 | </ItemGroup> | 181 | </ItemGroup> |
| 195 | 182 | ||
diff --git a/src/burn/engine/externalengine.cpp b/src/burn/engine/externalengine.cpp index df01d53b..1c775e23 100644 --- a/src/burn/engine/externalengine.cpp +++ b/src/burn/engine/externalengine.cpp | |||
| @@ -14,8 +14,8 @@ static HRESULT ProcessUnknownEmbeddedMessages( | |||
| 14 | __out DWORD* pdwResult | 14 | __out DWORD* pdwResult |
| 15 | ); | 15 | ); |
| 16 | static HRESULT EnqueueAction( | 16 | static HRESULT EnqueueAction( |
| 17 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 17 | __in BAENGINE_CONTEXT* pEngineContext, |
| 18 | __inout BOOTSTRAPPER_ENGINE_ACTION** ppAction | 18 | __inout BAENGINE_ACTION** ppAction |
| 19 | ); | 19 | ); |
| 20 | 20 | ||
| 21 | // function definitions | 21 | // function definitions |
| @@ -227,7 +227,7 @@ HRESULT ExternalEngineSendEmbeddedError( | |||
| 227 | *pnResult = static_cast<int>(dwResult); | 227 | *pnResult = static_cast<int>(dwResult); |
| 228 | 228 | ||
| 229 | LExit: | 229 | LExit: |
| 230 | ReleaseBuffer(pbData); | 230 | ReleaseMem(pbData); |
| 231 | 231 | ||
| 232 | return hr; | 232 | return hr; |
| 233 | } | 233 | } |
| @@ -262,7 +262,7 @@ HRESULT ExternalEngineSendEmbeddedProgress( | |||
| 262 | *pnResult = static_cast<int>(dwResult); | 262 | *pnResult = static_cast<int>(dwResult); |
| 263 | 263 | ||
| 264 | LExit: | 264 | LExit: |
| 265 | ReleaseBuffer(pbData); | 265 | ReleaseMem(pbData); |
| 266 | 266 | ||
| 267 | return hr; | 267 | return hr; |
| 268 | } | 268 | } |
| @@ -273,25 +273,25 @@ HRESULT ExternalEngineSetUpdate( | |||
| 273 | __in_z_opt LPCWSTR wzDownloadSource, | 273 | __in_z_opt LPCWSTR wzDownloadSource, |
| 274 | __in const DWORD64 qwSize, | 274 | __in const DWORD64 qwSize, |
| 275 | __in const BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, | 275 | __in const BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, |
| 276 | __in_opt LPCWSTR wzHash | 276 | __in_opt LPCWSTR wzHash, |
| 277 | __in_z_opt LPCWSTR wzUpdatePackageId | ||
| 277 | ) | 278 | ) |
| 278 | { | 279 | { |
| 279 | HRESULT hr = S_OK; | 280 | HRESULT hr = S_OK; |
| 280 | BOOL fLeaveCriticalSection = FALSE; | 281 | BOOL fLeaveCriticalSection = FALSE; |
| 281 | LPWSTR sczFilePath = NULL; | 282 | LPWSTR sczFileRelativePath = NULL; |
| 282 | LPWSTR sczCommandline = NULL; | 283 | LPWSTR sczCommandline = NULL; |
| 283 | LPWSTR sczPreviousId = NULL; | ||
| 284 | LPCWSTR wzNewId = NULL; | ||
| 285 | UUID guid = { }; | 284 | UUID guid = { }; |
| 286 | WCHAR wzGuid[39]; | 285 | WCHAR wzCacheId[39]; |
| 287 | RPC_STATUS rs = RPC_S_OK; | 286 | RPC_STATUS rs = RPC_S_OK; |
| 288 | BOOL fRemove = (!wzLocalSource || !*wzLocalSource) && (!wzDownloadSource || !*wzDownloadSource); | 287 | BOOL fRemove = (!wzLocalSource || !*wzLocalSource) && (!wzDownloadSource || !*wzDownloadSource); |
| 289 | 288 | ||
| 290 | UserExperienceOnSetUpdateBegin(&pEngineState->userExperience); | 289 | // Consider allowing the BA to pass this name in, like the UpdatePackageId can be passed in. |
| 290 | LPCWSTR wzFileName = NULL; | ||
| 291 | 291 | ||
| 292 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); | 292 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); |
| 293 | fLeaveCriticalSection = TRUE; | 293 | fLeaveCriticalSection = TRUE; |
| 294 | hr = UserExperienceEnsureEngineInactive(&pEngineState->userExperience); | 294 | hr = BootstrapperApplicationEnsureEngineInactive(&pEngineState->userExperience); |
| 295 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); | 295 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); |
| 296 | 296 | ||
| 297 | if (!fRemove) | 297 | if (!fRemove) |
| @@ -306,8 +306,6 @@ HRESULT ExternalEngineSetUpdate( | |||
| 306 | } | 306 | } |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | sczPreviousId = pEngineState->update.package.sczId; | ||
| 310 | pEngineState->update.package.sczId = NULL; | ||
| 311 | UpdateUninitialize(&pEngineState->update); | 309 | UpdateUninitialize(&pEngineState->update); |
| 312 | 310 | ||
| 313 | if (fRemove) | 311 | if (fRemove) |
| @@ -318,31 +316,46 @@ HRESULT ExternalEngineSetUpdate( | |||
| 318 | hr = CoreCreateUpdateBundleCommandLine(&sczCommandline, &pEngineState->internalCommand, &pEngineState->command); | 316 | hr = CoreCreateUpdateBundleCommandLine(&sczCommandline, &pEngineState->internalCommand, &pEngineState->command); |
| 319 | ExitOnFailure(hr, "Failed to create command-line for update bundle."); | 317 | ExitOnFailure(hr, "Failed to create command-line for update bundle."); |
| 320 | 318 | ||
| 321 | // Bundles would fail to use the downloaded update bundle, as the running bundle would be one of the search paths. | 319 | // Always generate a new CacheId for a location to where we can download then cache the update bundle. This running |
| 322 | // 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. | 320 | // bundle will clean that cached location when it is done while the update bundle caches itself in its official cache |
| 321 | // location during its execution. | ||
| 323 | rs = ::UuidCreate(&guid); | 322 | rs = ::UuidCreate(&guid); |
| 324 | hr = HRESULT_FROM_RPC(rs); | 323 | hr = HRESULT_FROM_RPC(rs); |
| 325 | ExitOnFailure(hr, "Failed to create bundle update guid."); | 324 | ExitOnFailure(hr, "Failed to create bundle update guid."); |
| 326 | 325 | ||
| 327 | if (!::StringFromGUID2(guid, wzGuid, countof(wzGuid))) | 326 | if (!::StringFromGUID2(guid, wzCacheId, countof(wzCacheId))) |
| 328 | { | 327 | { |
| 329 | hr = E_OUTOFMEMORY; | 328 | hr = E_INSUFFICIENT_BUFFER; |
| 330 | ExitOnRootFailure(hr, "Failed to convert bundle update guid into string."); | 329 | ExitOnRootFailure(hr, "Failed to convert bundle update guid into string."); |
| 331 | } | 330 | } |
| 332 | 331 | ||
| 333 | hr = StrAllocFormatted(&sczFilePath, L"%ls\\%ls", wzGuid, pEngineState->registration.sczExecutableName); | 332 | // If the update package id is not provided, use the cache id. |
| 333 | if (!wzUpdatePackageId || !*wzUpdatePackageId) | ||
| 334 | { | ||
| 335 | wzUpdatePackageId = wzCacheId; | ||
| 336 | } | ||
| 337 | |||
| 338 | // If the file name is not provided, use the current bundle's name. Not a great option but it is the best we have. | ||
| 339 | if (!wzFileName || !*wzFileName) | ||
| 340 | { | ||
| 341 | wzFileName = pEngineState->registration.sczExecutableName; | ||
| 342 | } | ||
| 343 | |||
| 344 | // Download the update bundle into a relative folder using the update package id. Ths is important because this running bundle is | ||
| 345 | // in the root of one of search paths used in source resolution. Thus, if when wzFileName is the same as the running bundle, the | ||
| 346 | // running bundle will be found first and the updated bundle will not actually be downloaded. | ||
| 347 | hr = StrAllocFormatted(&sczFileRelativePath, L"%ls\\%ls", wzUpdatePackageId, wzFileName); | ||
| 334 | ExitOnFailure(hr, "Failed to build bundle update file path."); | 348 | ExitOnFailure(hr, "Failed to build bundle update file path."); |
| 335 | 349 | ||
| 336 | if (!wzLocalSource || !*wzLocalSource) | 350 | if (!wzLocalSource || !*wzLocalSource) |
| 337 | { | 351 | { |
| 338 | wzLocalSource = sczFilePath; | 352 | wzLocalSource = sczFileRelativePath; |
| 339 | } | 353 | } |
| 340 | 354 | ||
| 341 | hr = PseudoBundleInitializeUpdateBundle(&pEngineState->update.package, wzGuid, pEngineState->registration.sczId, sczFilePath, wzLocalSource, wzDownloadSource, qwSize, sczCommandline, wzHash); | 355 | hr = PseudoBundleInitializeUpdateBundle(&pEngineState->update.package, wzUpdatePackageId, wzCacheId, sczFileRelativePath, wzLocalSource, wzDownloadSource, qwSize, sczCommandline, wzHash); |
| 342 | ExitOnFailure(hr, "Failed to set update bundle."); | 356 | ExitOnFailure(hr, "Failed to set update bundle."); |
| 343 | 357 | ||
| 344 | pEngineState->update.fUpdateAvailable = TRUE; | 358 | pEngineState->update.fUpdateAvailable = TRUE; |
| 345 | wzNewId = wzGuid; | ||
| 346 | 359 | ||
| 347 | LExit: | 360 | LExit: |
| 348 | if (fLeaveCriticalSection) | 361 | if (fLeaveCriticalSection) |
| @@ -350,11 +363,8 @@ LExit: | |||
| 350 | ::LeaveCriticalSection(&pEngineState->userExperience.csEngineActive); | 363 | ::LeaveCriticalSection(&pEngineState->userExperience.csEngineActive); |
| 351 | } | 364 | } |
| 352 | 365 | ||
| 353 | UserExperienceOnSetUpdateComplete(&pEngineState->userExperience, hr, sczPreviousId, wzNewId); | ||
| 354 | |||
| 355 | ReleaseStr(sczPreviousId); | ||
| 356 | ReleaseStr(sczCommandline); | 366 | ReleaseStr(sczCommandline); |
| 357 | ReleaseStr(sczFilePath); | 367 | ReleaseStr(sczFileRelativePath); |
| 358 | 368 | ||
| 359 | return hr; | 369 | return hr; |
| 360 | } | 370 | } |
| @@ -371,7 +381,7 @@ HRESULT ExternalEngineSetLocalSource( | |||
| 371 | BURN_PAYLOAD* pPayload = NULL; | 381 | BURN_PAYLOAD* pPayload = NULL; |
| 372 | 382 | ||
| 373 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); | 383 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); |
| 374 | hr = UserExperienceEnsureEngineInactive(&pEngineState->userExperience); | 384 | hr = BootstrapperApplicationEnsureEngineInactive(&pEngineState->userExperience); |
| 375 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); | 385 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); |
| 376 | 386 | ||
| 377 | if (!wzPath || !*wzPath) | 387 | if (!wzPath || !*wzPath) |
| @@ -411,7 +421,8 @@ HRESULT ExternalEngineSetDownloadSource( | |||
| 411 | __in_z_opt LPCWSTR wzPayloadId, | 421 | __in_z_opt LPCWSTR wzPayloadId, |
| 412 | __in_z_opt LPCWSTR wzUrl, | 422 | __in_z_opt LPCWSTR wzUrl, |
| 413 | __in_z_opt LPCWSTR wzUser, | 423 | __in_z_opt LPCWSTR wzUser, |
| 414 | __in_z_opt LPCWSTR wzPassword | 424 | __in_z_opt LPCWSTR wzPassword, |
| 425 | __in_z_opt LPCWSTR wzAuthorizationHeader | ||
| 415 | ) | 426 | ) |
| 416 | { | 427 | { |
| 417 | HRESULT hr = S_OK; | 428 | HRESULT hr = S_OK; |
| @@ -420,7 +431,7 @@ HRESULT ExternalEngineSetDownloadSource( | |||
| 420 | DOWNLOAD_SOURCE* pDownloadSource = NULL; | 431 | DOWNLOAD_SOURCE* pDownloadSource = NULL; |
| 421 | 432 | ||
| 422 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); | 433 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); |
| 423 | hr = UserExperienceEnsureEngineInactive(&pEngineState->userExperience); | 434 | hr = BootstrapperApplicationEnsureEngineInactive(&pEngineState->userExperience); |
| 424 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); | 435 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); |
| 425 | 436 | ||
| 426 | if (wzPayloadId && *wzPayloadId) | 437 | if (wzPayloadId && *wzPayloadId) |
| @@ -443,7 +454,16 @@ HRESULT ExternalEngineSetDownloadSource( | |||
| 443 | ExitOnFailure(hr, "BA did not provide container or payload id."); | 454 | ExitOnFailure(hr, "BA did not provide container or payload id."); |
| 444 | } | 455 | } |
| 445 | 456 | ||
| 446 | if (wzUrl && *wzUrl) | 457 | if (wzAuthorizationHeader && *wzAuthorizationHeader) |
| 458 | { | ||
| 459 | hr = StrAllocString(&pDownloadSource->sczAuthorizationHeader, wzAuthorizationHeader, 0); | ||
| 460 | ExitOnFailure(hr, "Failed to set download authorization header."); | ||
| 461 | |||
| 462 | // Authorization header means no user. | ||
| 463 | ReleaseNullStr(pDownloadSource->sczUser); | ||
| 464 | ReleaseNullStr(pDownloadSource->sczPassword); | ||
| 465 | } | ||
| 466 | else if (wzUrl && *wzUrl) | ||
| 447 | { | 467 | { |
| 448 | hr = StrAllocString(&pDownloadSource->sczUrl, wzUrl, 0); | 468 | hr = StrAllocString(&pDownloadSource->sczUrl, wzUrl, 0); |
| 449 | ExitOnFailure(hr, "Failed to set download URL."); | 469 | ExitOnFailure(hr, "Failed to set download URL."); |
| @@ -462,6 +482,9 @@ HRESULT ExternalEngineSetDownloadSource( | |||
| 462 | { | 482 | { |
| 463 | ReleaseNullStr(pDownloadSource->sczPassword); | 483 | ReleaseNullStr(pDownloadSource->sczPassword); |
| 464 | } | 484 | } |
| 485 | |||
| 486 | // User means no authorization header. | ||
| 487 | ReleaseNullStr(pDownloadSource->sczAuthorizationHeader); | ||
| 465 | } | 488 | } |
| 466 | else // no user means no password either. | 489 | else // no user means no password either. |
| 467 | { | 490 | { |
| @@ -586,15 +609,15 @@ HRESULT ExternalEngineCompareVersions( | |||
| 586 | } | 609 | } |
| 587 | 610 | ||
| 588 | HRESULT ExternalEngineDetect( | 611 | HRESULT ExternalEngineDetect( |
| 589 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 612 | __in BAENGINE_CONTEXT* pEngineContext, |
| 590 | __in_opt const HWND hwndParent | 613 | __in_opt const HWND hwndParent |
| 591 | ) | 614 | ) |
| 592 | { | 615 | { |
| 593 | HRESULT hr = S_OK; | 616 | HRESULT hr = S_OK; |
| 594 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | 617 | BAENGINE_ACTION* pAction = NULL; |
| 595 | 618 | ||
| 596 | pAction = (BOOTSTRAPPER_ENGINE_ACTION*)MemAlloc(sizeof(BOOTSTRAPPER_ENGINE_ACTION), TRUE); | 619 | pAction = (BAENGINE_ACTION*)MemAlloc(sizeof(BAENGINE_ACTION), TRUE); |
| 597 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BOOTSTRAPPER_ENGINE_ACTION"); | 620 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BAENGINE_ACTION"); |
| 598 | 621 | ||
| 599 | pAction->dwMessage = WM_BURN_DETECT; | 622 | pAction->dwMessage = WM_BURN_DETECT; |
| 600 | pAction->detect.hwndParent = hwndParent; | 623 | pAction->detect.hwndParent = hwndParent; |
| @@ -609,20 +632,20 @@ LExit: | |||
| 609 | } | 632 | } |
| 610 | 633 | ||
| 611 | HRESULT ExternalEnginePlan( | 634 | HRESULT ExternalEnginePlan( |
| 612 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 635 | __in BAENGINE_CONTEXT* pEngineContext, |
| 613 | __in const BOOTSTRAPPER_ACTION action | 636 | __in const BOOTSTRAPPER_ACTION action |
| 614 | ) | 637 | ) |
| 615 | { | 638 | { |
| 616 | HRESULT hr = S_OK; | 639 | HRESULT hr = S_OK; |
| 617 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | 640 | BAENGINE_ACTION* pAction = NULL; |
| 618 | 641 | ||
| 619 | if (BOOTSTRAPPER_ACTION_LAYOUT > action || BOOTSTRAPPER_ACTION_UPDATE_REPLACE_EMBEDDED < action) | 642 | if (BOOTSTRAPPER_ACTION_LAYOUT > action || BOOTSTRAPPER_ACTION_UPDATE_REPLACE_EMBEDDED < action) |
| 620 | { | 643 | { |
| 621 | ExitOnRootFailure(hr = E_INVALIDARG, "BA passed invalid action to Plan: %u.", action); | 644 | ExitOnRootFailure(hr = E_INVALIDARG, "BA passed invalid action to Plan: %u.", action); |
| 622 | } | 645 | } |
| 623 | 646 | ||
| 624 | pAction = (BOOTSTRAPPER_ENGINE_ACTION*)MemAlloc(sizeof(BOOTSTRAPPER_ENGINE_ACTION), TRUE); | 647 | pAction = (BAENGINE_ACTION*)MemAlloc(sizeof(BAENGINE_ACTION), TRUE); |
| 625 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BOOTSTRAPPER_ENGINE_ACTION"); | 648 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BAENGINE_ACTION"); |
| 626 | 649 | ||
| 627 | pAction->dwMessage = WM_BURN_PLAN; | 650 | pAction->dwMessage = WM_BURN_PLAN; |
| 628 | pAction->plan.action = action; | 651 | pAction->plan.action = action; |
| @@ -637,20 +660,20 @@ LExit: | |||
| 637 | } | 660 | } |
| 638 | 661 | ||
| 639 | HRESULT ExternalEngineElevate( | 662 | HRESULT ExternalEngineElevate( |
| 640 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 663 | __in BAENGINE_CONTEXT* pEngineContext, |
| 641 | __in_opt const HWND hwndParent | 664 | __in_opt const HWND hwndParent |
| 642 | ) | 665 | ) |
| 643 | { | 666 | { |
| 644 | HRESULT hr = S_OK; | 667 | HRESULT hr = S_OK; |
| 645 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | 668 | BAENGINE_ACTION* pAction = NULL; |
| 646 | 669 | ||
| 647 | if (INVALID_HANDLE_VALUE != pEngineContext->pEngineState->companionConnection.hPipe) | 670 | if (INVALID_HANDLE_VALUE != pEngineContext->pEngineState->companionConnection.hPipe) |
| 648 | { | 671 | { |
| 649 | ExitFunction1(hr = HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED)); | 672 | ExitFunction1(hr = HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED)); |
| 650 | } | 673 | } |
| 651 | 674 | ||
| 652 | pAction = (BOOTSTRAPPER_ENGINE_ACTION*)MemAlloc(sizeof(BOOTSTRAPPER_ENGINE_ACTION), TRUE); | 675 | pAction = (BAENGINE_ACTION*)MemAlloc(sizeof(BAENGINE_ACTION), TRUE); |
| 653 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BOOTSTRAPPER_ENGINE_ACTION"); | 676 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BAENGINE_ACTION"); |
| 654 | 677 | ||
| 655 | pAction->dwMessage = WM_BURN_ELEVATE; | 678 | pAction->dwMessage = WM_BURN_ELEVATE; |
| 656 | pAction->elevate.hwndParent = hwndParent; | 679 | pAction->elevate.hwndParent = hwndParent; |
| @@ -665,12 +688,12 @@ LExit: | |||
| 665 | } | 688 | } |
| 666 | 689 | ||
| 667 | HRESULT ExternalEngineApply( | 690 | HRESULT ExternalEngineApply( |
| 668 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 691 | __in BAENGINE_CONTEXT* pEngineContext, |
| 669 | __in_opt const HWND hwndParent | 692 | __in_opt const HWND hwndParent |
| 670 | ) | 693 | ) |
| 671 | { | 694 | { |
| 672 | HRESULT hr = S_OK; | 695 | HRESULT hr = S_OK; |
| 673 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | 696 | BAENGINE_ACTION* pAction = NULL; |
| 674 | 697 | ||
| 675 | ExitOnNull(hwndParent, hr, E_INVALIDARG, "BA passed NULL hwndParent to Apply."); | 698 | ExitOnNull(hwndParent, hr, E_INVALIDARG, "BA passed NULL hwndParent to Apply."); |
| 676 | if (!::IsWindow(hwndParent)) | 699 | if (!::IsWindow(hwndParent)) |
| @@ -678,8 +701,8 @@ HRESULT ExternalEngineApply( | |||
| 678 | ExitOnRootFailure(hr = E_INVALIDARG, "BA passed invalid hwndParent to Apply."); | 701 | ExitOnRootFailure(hr = E_INVALIDARG, "BA passed invalid hwndParent to Apply."); |
| 679 | } | 702 | } |
| 680 | 703 | ||
| 681 | pAction = (BOOTSTRAPPER_ENGINE_ACTION*)MemAlloc(sizeof(BOOTSTRAPPER_ENGINE_ACTION), TRUE); | 704 | pAction = (BAENGINE_ACTION*)MemAlloc(sizeof(BAENGINE_ACTION), TRUE); |
| 682 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BOOTSTRAPPER_ENGINE_ACTION"); | 705 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BAENGINE_ACTION"); |
| 683 | 706 | ||
| 684 | pAction->dwMessage = WM_BURN_APPLY; | 707 | pAction->dwMessage = WM_BURN_APPLY; |
| 685 | pAction->apply.hwndParent = hwndParent; | 708 | pAction->apply.hwndParent = hwndParent; |
| @@ -694,15 +717,15 @@ LExit: | |||
| 694 | } | 717 | } |
| 695 | 718 | ||
| 696 | HRESULT ExternalEngineQuit( | 719 | HRESULT ExternalEngineQuit( |
| 697 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 720 | __in BAENGINE_CONTEXT* pEngineContext, |
| 698 | __in const DWORD dwExitCode | 721 | __in const DWORD dwExitCode |
| 699 | ) | 722 | ) |
| 700 | { | 723 | { |
| 701 | HRESULT hr = S_OK; | 724 | HRESULT hr = S_OK; |
| 702 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | 725 | BAENGINE_ACTION* pAction = NULL; |
| 703 | 726 | ||
| 704 | pAction = (BOOTSTRAPPER_ENGINE_ACTION*)MemAlloc(sizeof(BOOTSTRAPPER_ENGINE_ACTION), TRUE); | 727 | pAction = (BAENGINE_ACTION*)MemAlloc(sizeof(BAENGINE_ACTION), TRUE); |
| 705 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BOOTSTRAPPER_ENGINE_ACTION"); | 728 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BAENGINE_ACTION"); |
| 706 | 729 | ||
| 707 | pAction->dwMessage = WM_BURN_QUIT; | 730 | pAction->dwMessage = WM_BURN_QUIT; |
| 708 | pAction->quit.dwExitCode = dwExitCode; | 731 | pAction->quit.dwExitCode = dwExitCode; |
| @@ -717,7 +740,7 @@ LExit: | |||
| 717 | } | 740 | } |
| 718 | 741 | ||
| 719 | HRESULT ExternalEngineLaunchApprovedExe( | 742 | HRESULT ExternalEngineLaunchApprovedExe( |
| 720 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 743 | __in BAENGINE_CONTEXT* pEngineContext, |
| 721 | __in_opt const HWND hwndParent, | 744 | __in_opt const HWND hwndParent, |
| 722 | __in_z LPCWSTR wzApprovedExeForElevationId, | 745 | __in_z LPCWSTR wzApprovedExeForElevationId, |
| 723 | __in_z_opt LPCWSTR wzArguments, | 746 | __in_z_opt LPCWSTR wzArguments, |
| @@ -727,7 +750,7 @@ HRESULT ExternalEngineLaunchApprovedExe( | |||
| 727 | HRESULT hr = S_OK; | 750 | HRESULT hr = S_OK; |
| 728 | BURN_APPROVED_EXE* pApprovedExe = NULL; | 751 | BURN_APPROVED_EXE* pApprovedExe = NULL; |
| 729 | BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe = NULL; | 752 | BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe = NULL; |
| 730 | BOOTSTRAPPER_ENGINE_ACTION* pAction = NULL; | 753 | BAENGINE_ACTION* pAction = NULL; |
| 731 | 754 | ||
| 732 | if (!wzApprovedExeForElevationId || !*wzApprovedExeForElevationId) | 755 | if (!wzApprovedExeForElevationId || !*wzApprovedExeForElevationId) |
| 733 | { | 756 | { |
| @@ -737,8 +760,8 @@ HRESULT ExternalEngineLaunchApprovedExe( | |||
| 737 | hr = ApprovedExesFindById(&pEngineContext->pEngineState->approvedExes, wzApprovedExeForElevationId, &pApprovedExe); | 760 | hr = ApprovedExesFindById(&pEngineContext->pEngineState->approvedExes, wzApprovedExeForElevationId, &pApprovedExe); |
| 738 | ExitOnFailure(hr, "BA requested unknown approved exe with id: %ls", wzApprovedExeForElevationId); | 761 | ExitOnFailure(hr, "BA requested unknown approved exe with id: %ls", wzApprovedExeForElevationId); |
| 739 | 762 | ||
| 740 | pAction = (BOOTSTRAPPER_ENGINE_ACTION*)MemAlloc(sizeof(BOOTSTRAPPER_ENGINE_ACTION), TRUE); | 763 | pAction = (BAENGINE_ACTION*)MemAlloc(sizeof(BAENGINE_ACTION), TRUE); |
| 741 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BOOTSTRAPPER_ENGINE_ACTION"); | 764 | ExitOnNull(pAction, hr, E_OUTOFMEMORY, "Failed to alloc BAENGINE_ACTION"); |
| 742 | 765 | ||
| 743 | pAction->dwMessage = WM_BURN_LAUNCH_APPROVED_EXE; | 766 | pAction->dwMessage = WM_BURN_LAUNCH_APPROVED_EXE; |
| 744 | pLaunchApprovedExe = &pAction->launchApprovedExe; | 767 | pLaunchApprovedExe = &pAction->launchApprovedExe; |
| @@ -762,8 +785,7 @@ HRESULT ExternalEngineLaunchApprovedExe( | |||
| 762 | LExit: | 785 | LExit: |
| 763 | if (pAction) | 786 | if (pAction) |
| 764 | { | 787 | { |
| 765 | CoreBootstrapperEngineActionUninitialize(pAction); | 788 | BAEngineFreeAction(pAction); |
| 766 | MemFree(pAction); | ||
| 767 | } | 789 | } |
| 768 | 790 | ||
| 769 | return hr; | 791 | return hr; |
| @@ -771,7 +793,8 @@ LExit: | |||
| 771 | 793 | ||
| 772 | HRESULT ExternalEngineSetUpdateSource( | 794 | HRESULT ExternalEngineSetUpdateSource( |
| 773 | __in BURN_ENGINE_STATE* pEngineState, | 795 | __in BURN_ENGINE_STATE* pEngineState, |
| 774 | __in_z LPCWSTR wzUrl | 796 | __in_z LPCWSTR wzUrl, |
| 797 | __in_z_opt LPCWSTR wzAuthorizationHeader | ||
| 775 | ) | 798 | ) |
| 776 | { | 799 | { |
| 777 | HRESULT hr = S_OK; | 800 | HRESULT hr = S_OK; |
| @@ -779,16 +802,27 @@ HRESULT ExternalEngineSetUpdateSource( | |||
| 779 | 802 | ||
| 780 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); | 803 | ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive); |
| 781 | fLeaveCriticalSection = TRUE; | 804 | fLeaveCriticalSection = TRUE; |
| 782 | hr = UserExperienceEnsureEngineInactive(&pEngineState->userExperience); | 805 | hr = BootstrapperApplicationEnsureEngineInactive(&pEngineState->userExperience); |
| 783 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); | 806 | ExitOnFailure(hr, "Engine is active, cannot change engine state."); |
| 784 | 807 | ||
| 785 | if (wzUrl && *wzUrl) | 808 | if (wzUrl && *wzUrl) |
| 786 | { | 809 | { |
| 787 | hr = StrAllocString(&pEngineState->update.sczUpdateSource, wzUrl, 0); | 810 | hr = StrAllocString(&pEngineState->update.sczUpdateSource, wzUrl, 0); |
| 788 | ExitOnFailure(hr, "Failed to set feed download URL."); | 811 | ExitOnFailure(hr, "Failed to set feed download URL."); |
| 812 | |||
| 813 | if (wzAuthorizationHeader && *wzAuthorizationHeader) | ||
| 814 | { | ||
| 815 | hr = StrAllocString(&pEngineState->update.sczAuthorizationHeader, wzAuthorizationHeader, 0); | ||
| 816 | ExitOnFailure(hr, "Failed to set feed authorization header."); | ||
| 817 | } | ||
| 818 | else | ||
| 819 | { | ||
| 820 | ReleaseNullStr(pEngineState->update.sczAuthorizationHeader); | ||
| 821 | } | ||
| 789 | } | 822 | } |
| 790 | else // no URL provided means clear out the whole download source. | 823 | else // no URL provided means clear out the whole download source. |
| 791 | { | 824 | { |
| 825 | ReleaseNullStr(pEngineState->update.sczAuthorizationHeader); | ||
| 792 | ReleaseNullStr(pEngineState->update.sczUpdateSource); | 826 | ReleaseNullStr(pEngineState->update.sczUpdateSource); |
| 793 | } | 827 | } |
| 794 | 828 | ||
| @@ -810,14 +844,23 @@ HRESULT ExternalEngineGetRelatedBundleVariable( | |||
| 810 | ) | 844 | ) |
| 811 | { | 845 | { |
| 812 | HRESULT hr = S_OK; | 846 | HRESULT hr = S_OK; |
| 847 | LPWSTR sczValue = NULL; | ||
| 848 | |||
| 813 | if (wzVariable && *wzVariable && pcchValue) | 849 | if (wzVariable && *wzVariable && pcchValue) |
| 814 | { | 850 | { |
| 815 | hr = BundleGetBundleVariableFixed(wzBundleId, wzVariable, wzValue, pcchValue); | 851 | hr = BundleGetBundleVariable(wzBundleId, wzVariable, &sczValue); |
| 852 | if (SUCCEEDED(hr)) | ||
| 853 | { | ||
| 854 | hr = CopyStringToExternal(sczValue, wzValue, pcchValue); | ||
| 855 | } | ||
| 816 | } | 856 | } |
| 817 | else | 857 | else |
| 818 | { | 858 | { |
| 819 | hr = E_INVALIDARG; | 859 | hr = E_INVALIDARG; |
| 820 | } | 860 | } |
| 861 | |||
| 862 | StrSecureZeroFreeString(sczValue); | ||
| 863 | |||
| 821 | return hr; | 864 | return hr; |
| 822 | } | 865 | } |
| 823 | 866 | ||
| @@ -888,8 +931,8 @@ static HRESULT ProcessUnknownEmbeddedMessages( | |||
| 888 | } | 931 | } |
| 889 | 932 | ||
| 890 | static HRESULT EnqueueAction( | 933 | static HRESULT EnqueueAction( |
| 891 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 934 | __in BAENGINE_CONTEXT* pEngineContext, |
| 892 | __inout BOOTSTRAPPER_ENGINE_ACTION** ppAction | 935 | __inout BAENGINE_ACTION** ppAction |
| 893 | ) | 936 | ) |
| 894 | { | 937 | { |
| 895 | HRESULT hr = S_OK; | 938 | HRESULT hr = S_OK; |
diff --git a/src/burn/engine/externalengine.h b/src/burn/engine/externalengine.h index 0c8a8cbb..3569392d 100644 --- a/src/burn/engine/externalengine.h +++ b/src/burn/engine/externalengine.h | |||
| @@ -81,7 +81,8 @@ HRESULT ExternalEngineSetUpdate( | |||
| 81 | __in_z_opt LPCWSTR wzDownloadSource, | 81 | __in_z_opt LPCWSTR wzDownloadSource, |
| 82 | __in const DWORD64 qwSize, | 82 | __in const DWORD64 qwSize, |
| 83 | __in const BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, | 83 | __in const BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, |
| 84 | __in_opt LPCWSTR wzHash | 84 | __in_opt LPCWSTR wzHash, |
| 85 | __in_opt LPCWSTR wzUpdatePackageId | ||
| 85 | ); | 86 | ); |
| 86 | 87 | ||
| 87 | HRESULT ExternalEngineSetLocalSource( | 88 | HRESULT ExternalEngineSetLocalSource( |
| @@ -97,7 +98,8 @@ HRESULT ExternalEngineSetDownloadSource( | |||
| 97 | __in_z_opt LPCWSTR wzPayloadId, | 98 | __in_z_opt LPCWSTR wzPayloadId, |
| 98 | __in_z_opt LPCWSTR wzUrl, | 99 | __in_z_opt LPCWSTR wzUrl, |
| 99 | __in_z_opt LPCWSTR wzUser, | 100 | __in_z_opt LPCWSTR wzUser, |
| 100 | __in_z_opt LPCWSTR wzPassword | 101 | __in_z_opt LPCWSTR wzPassword, |
| 102 | __in_z_opt LPCWSTR wzAuthorizationHeader | ||
| 101 | ); | 103 | ); |
| 102 | 104 | ||
| 103 | HRESULT ExternalEngineSetVariableNumeric( | 105 | HRESULT ExternalEngineSetVariableNumeric( |
| @@ -138,32 +140,32 @@ HRESULT ExternalEngineGetRelatedBundleVariable( | |||
| 138 | ); | 140 | ); |
| 139 | 141 | ||
| 140 | HRESULT ExternalEngineDetect( | 142 | HRESULT ExternalEngineDetect( |
| 141 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 143 | __in BAENGINE_CONTEXT* pEngineContext, |
| 142 | __in_opt const HWND hwndParent | 144 | __in_opt const HWND hwndParent |
| 143 | ); | 145 | ); |
| 144 | 146 | ||
| 145 | HRESULT ExternalEnginePlan( | 147 | HRESULT ExternalEnginePlan( |
| 146 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 148 | __in BAENGINE_CONTEXT* pEngineContext, |
| 147 | __in const BOOTSTRAPPER_ACTION action | 149 | __in const BOOTSTRAPPER_ACTION action |
| 148 | ); | 150 | ); |
| 149 | 151 | ||
| 150 | HRESULT ExternalEngineElevate( | 152 | HRESULT ExternalEngineElevate( |
| 151 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 153 | __in BAENGINE_CONTEXT* pEngineContext, |
| 152 | __in_opt const HWND hwndParent | 154 | __in_opt const HWND hwndParent |
| 153 | ); | 155 | ); |
| 154 | 156 | ||
| 155 | HRESULT ExternalEngineApply( | 157 | HRESULT ExternalEngineApply( |
| 156 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 158 | __in BAENGINE_CONTEXT* pEngineContext, |
| 157 | __in_opt const HWND hwndParent | 159 | __in_opt const HWND hwndParent |
| 158 | ); | 160 | ); |
| 159 | 161 | ||
| 160 | HRESULT ExternalEngineQuit( | 162 | HRESULT ExternalEngineQuit( |
| 161 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 163 | __in BAENGINE_CONTEXT* pEngineContext, |
| 162 | __in const DWORD dwExitCode | 164 | __in const DWORD dwExitCode |
| 163 | ); | 165 | ); |
| 164 | 166 | ||
| 165 | HRESULT ExternalEngineLaunchApprovedExe( | 167 | HRESULT ExternalEngineLaunchApprovedExe( |
| 166 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 168 | __in BAENGINE_CONTEXT* pEngineContext, |
| 167 | __in_opt const HWND hwndParent, | 169 | __in_opt const HWND hwndParent, |
| 168 | __in_z LPCWSTR wzApprovedExeForElevationId, | 170 | __in_z LPCWSTR wzApprovedExeForElevationId, |
| 169 | __in_z_opt LPCWSTR wzArguments, | 171 | __in_z_opt LPCWSTR wzArguments, |
| @@ -172,7 +174,8 @@ HRESULT ExternalEngineLaunchApprovedExe( | |||
| 172 | 174 | ||
| 173 | HRESULT ExternalEngineSetUpdateSource( | 175 | HRESULT ExternalEngineSetUpdateSource( |
| 174 | __in BURN_ENGINE_STATE* pEngineState, | 176 | __in BURN_ENGINE_STATE* pEngineState, |
| 175 | __in_z LPCWSTR wzUrl | 177 | __in_z LPCWSTR wzUrl, |
| 178 | __in_z_opt LPCWSTR wzAuthorizationHeader | ||
| 176 | ); | 179 | ); |
| 177 | 180 | ||
| 178 | HRESULT WINAPI ExternalEngineValidateMessageParameter( | 181 | HRESULT WINAPI ExternalEngineValidateMessageParameter( |
diff --git a/src/burn/engine/inc/engine.h b/src/burn/engine/inc/engine.h index 9b29dd84..33d9e77b 100644 --- a/src/burn/engine/inc/engine.h +++ b/src/burn/engine/inc/engine.h | |||
| @@ -19,10 +19,6 @@ extern "C" { | |||
| 19 | 19 | ||
| 20 | // function declarations | 20 | // function declarations |
| 21 | 21 | ||
| 22 | BOOL EngineInCleanRoom( | ||
| 23 | __in_z_opt LPCWSTR wzCommandLine | ||
| 24 | ); | ||
| 25 | |||
| 26 | HRESULT EngineRun( | 22 | HRESULT EngineRun( |
| 27 | __in HINSTANCE hInstance, | 23 | __in HINSTANCE hInstance, |
| 28 | __in HANDLE hEngineFile, | 24 | __in HANDLE hEngineFile, |
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp index 630598ae..f381193f 100644 --- a/src/burn/engine/logging.cpp +++ b/src/burn/engine/logging.cpp | |||
| @@ -74,9 +74,6 @@ extern "C" HRESULT LoggingOpen( | |||
| 74 | 74 | ||
| 75 | switch (pInternalCommand->mode) | 75 | switch (pInternalCommand->mode) |
| 76 | { | 76 | { |
| 77 | case BURN_MODE_UNTRUSTED: | ||
| 78 | wzPostfix = L".cleanroom"; | ||
| 79 | break; | ||
| 80 | case BURN_MODE_ELEVATED: | 77 | case BURN_MODE_ELEVATED: |
| 81 | wzPostfix = L".elevated"; | 78 | wzPostfix = L".elevated"; |
| 82 | break; | 79 | break; |
| @@ -1014,7 +1011,7 @@ static HRESULT InitializeLogging( | |||
| 1014 | 1011 | ||
| 1015 | // The untrusted process needs a separate log file. | 1012 | // The untrusted process needs a separate log file. |
| 1016 | // TODO: Burn crashes if they do try to use the same log file. | 1013 | // TODO: Burn crashes if they do try to use the same log file. |
| 1017 | if (pInternalCommand->sczLogFile && BURN_MODE_UNTRUSTED != pInternalCommand->mode) | 1014 | if (pInternalCommand->sczLogFile) |
| 1018 | { | 1015 | { |
| 1019 | hr = StrAllocString(&pLog->sczPath, pInternalCommand->sczLogFile, 0); | 1016 | hr = StrAllocString(&pLog->sczPath, pInternalCommand->sczLogFile, 0); |
| 1020 | ExitOnFailure(hr, "Failed to copy log file path from command line."); | 1017 | ExitOnFailure(hr, "Failed to copy log file path from command line."); |
diff --git a/src/burn/engine/manifest.cpp b/src/burn/engine/manifest.cpp index c0d67c19..266d1987 100644 --- a/src/burn/engine/manifest.cpp +++ b/src/burn/engine/manifest.cpp | |||
| @@ -104,7 +104,7 @@ static HRESULT ParseFromXml( | |||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | // parse built-in condition | 107 | // parse built-in condition |
| 108 | hr = ConditionGlobalParseFromXml(&pEngineState->condition, pixeBundle); | 108 | hr = ConditionGlobalParseFromXml(&pEngineState->condition, pixeBundle); |
| 109 | ExitOnFailure(hr, "Failed to parse global condition."); | 109 | ExitOnFailure(hr, "Failed to parse global condition."); |
| 110 | 110 | ||
| @@ -113,8 +113,8 @@ static HRESULT ParseFromXml( | |||
| 113 | ExitOnFailure(hr, "Failed to parse variables."); | 113 | ExitOnFailure(hr, "Failed to parse variables."); |
| 114 | 114 | ||
| 115 | // parse user experience | 115 | // parse user experience |
| 116 | hr = UserExperienceParseFromXml(&pEngineState->userExperience, pixeBundle); | 116 | hr = BootstrapperApplicationParseFromXml(&pEngineState->userExperience, pixeBundle); |
| 117 | ExitOnFailure(hr, "Failed to parse user experience."); | 117 | ExitOnFailure(hr, "Failed to parse bootstrapper application."); |
| 118 | 118 | ||
| 119 | // parse extensions | 119 | // parse extensions |
| 120 | hr = BurnExtensionParseFromXml(&pEngineState->extensions, &pEngineState->userExperience.payloads, pixeBundle); | 120 | hr = BurnExtensionParseFromXml(&pEngineState->extensions, &pEngineState->userExperience.payloads, pixeBundle); |
diff --git a/src/burn/engine/msiengine.cpp b/src/burn/engine/msiengine.cpp index 32b6660e..d5268b17 100644 --- a/src/burn/engine/msiengine.cpp +++ b/src/burn/engine/msiengine.cpp | |||
| @@ -489,7 +489,7 @@ extern "C" HRESULT MsiEngineDetectPackage( | |||
| 489 | { | 489 | { |
| 490 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_PACKAGE, pPackage->Msi.sczProductCode, LoggingPerMachineToString(pPackage->fPerMachine), pVersion->sczVersion, pPackage->Msi.dwLanguage, LoggingRelatedOperationToString(pPackage->Msi.operation)); | 490 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_PACKAGE, pPackage->Msi.sczProductCode, LoggingPerMachineToString(pPackage->fPerMachine), pVersion->sczVersion, pPackage->Msi.dwLanguage, LoggingRelatedOperationToString(pPackage->Msi.operation)); |
| 491 | 491 | ||
| 492 | hr = UserExperienceOnDetectRelatedMsiPackage(pUserExperience, pPackage->sczId, pPackage->Msi.sczUpgradeCode, pPackage->Msi.sczProductCode, pPackage->fPerMachine, pVersion, pPackage->Msi.operation); | 492 | hr = BACallbackOnDetectRelatedMsiPackage(pUserExperience, pPackage->sczId, pPackage->Msi.sczUpgradeCode, pPackage->Msi.sczProductCode, pPackage->fPerMachine, pVersion, pPackage->Msi.operation); |
| 493 | ExitOnRootFailure(hr, "BA aborted detect related MSI package."); | 493 | ExitOnRootFailure(hr, "BA aborted detect related MSI package."); |
| 494 | } | 494 | } |
| 495 | } | 495 | } |
| @@ -651,7 +651,7 @@ extern "C" HRESULT MsiEngineDetectPackage( | |||
| 651 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_PACKAGE, wzProductCode, LoggingPerMachineToString(fPerMachine), pVersion->sczVersion, uLcid, LoggingRelatedOperationToString(relatedMsiOperation)); | 651 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_PACKAGE, wzProductCode, LoggingPerMachineToString(fPerMachine), pVersion->sczVersion, uLcid, LoggingRelatedOperationToString(relatedMsiOperation)); |
| 652 | 652 | ||
| 653 | // Pass to BA. | 653 | // Pass to BA. |
| 654 | hr = UserExperienceOnDetectRelatedMsiPackage(pUserExperience, pPackage->sczId, pRelatedMsi->sczUpgradeCode, wzProductCode, fPerMachine, pVersion, relatedMsiOperation); | 654 | hr = BACallbackOnDetectRelatedMsiPackage(pUserExperience, pPackage->sczId, pRelatedMsi->sczUpgradeCode, wzProductCode, fPerMachine, pVersion, relatedMsiOperation); |
| 655 | ExitOnRootFailure(hr, "BA aborted detect related MSI package."); | 655 | ExitOnRootFailure(hr, "BA aborted detect related MSI package."); |
| 656 | } | 656 | } |
| 657 | } | 657 | } |
| @@ -700,7 +700,7 @@ extern "C" HRESULT MsiEngineDetectPackage( | |||
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | // Pass to BA. | 702 | // Pass to BA. |
| 703 | hr = UserExperienceOnDetectMsiFeature(pUserExperience, pPackage->sczId, pFeature->sczId, pFeature->currentState); | 703 | hr = BACallbackOnDetectMsiFeature(pUserExperience, pPackage->sczId, pFeature->sczId, pFeature->currentState); |
| 704 | ExitOnRootFailure(hr, "BA aborted detect MSI feature."); | 704 | ExitOnRootFailure(hr, "BA aborted detect MSI feature."); |
| 705 | } | 705 | } |
| 706 | } | 706 | } |
| @@ -747,7 +747,7 @@ extern "C" HRESULT MsiEngineDetectPackage( | |||
| 747 | 747 | ||
| 748 | LogId(REPORT_STANDARD, MSG_DETECTED_COMPATIBLE_PACKAGE_FROM_PROVIDER, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczProviderKey, wzCompatibleProductCode, wzCompatibleInstalledVersion, pPackage->Msi.sczProductCode); | 748 | LogId(REPORT_STANDARD, MSG_DETECTED_COMPATIBLE_PACKAGE_FROM_PROVIDER, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczProviderKey, wzCompatibleProductCode, wzCompatibleInstalledVersion, pPackage->Msi.sczProductCode); |
| 749 | 749 | ||
| 750 | hr = UserExperienceOnDetectCompatibleMsiPackage(pUserExperience, pPackage->sczId, wzCompatibleProductCode, pPackage->compatiblePackage.Msi.pVersion); | 750 | hr = BACallbackOnDetectCompatibleMsiPackage(pUserExperience, pPackage->sczId, wzCompatibleProductCode, pPackage->compatiblePackage.Msi.pVersion); |
| 751 | ExitOnRootFailure(hr, "BA aborted detect compatible MSI package."); | 751 | ExitOnRootFailure(hr, "BA aborted detect compatible MSI package."); |
| 752 | } | 752 | } |
| 753 | } | 753 | } |
| @@ -828,7 +828,7 @@ extern "C" HRESULT MsiEnginePlanInitializePackage( | |||
| 828 | pFeature->requested = pFeature->defaultRequested; | 828 | pFeature->requested = pFeature->defaultRequested; |
| 829 | 829 | ||
| 830 | // Send plan MSI feature message to BA. | 830 | // Send plan MSI feature message to BA. |
| 831 | hr = UserExperienceOnPlanMsiFeature(pUserExperience, pPackage->sczId, pFeature->sczId, &pFeature->requested); | 831 | hr = BACallbackOnPlanMsiFeature(pUserExperience, pPackage->sczId, pFeature->sczId, &pFeature->requested); |
| 832 | ExitOnRootFailure(hr, "BA aborted plan MSI feature."); | 832 | ExitOnRootFailure(hr, "BA aborted plan MSI feature."); |
| 833 | } | 833 | } |
| 834 | } | 834 | } |
| @@ -840,8 +840,8 @@ extern "C" HRESULT MsiEnginePlanInitializePackage( | |||
| 840 | pPackage->compatiblePackage.fDefaultRequested = BOOTSTRAPPER_ACTION_UNINSTALL == overallAction || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == overallAction; | 840 | pPackage->compatiblePackage.fDefaultRequested = BOOTSTRAPPER_ACTION_UNINSTALL == overallAction || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == overallAction; |
| 841 | pPackage->compatiblePackage.fRequested = pPackage->compatiblePackage.fDefaultRequested; | 841 | pPackage->compatiblePackage.fRequested = pPackage->compatiblePackage.fDefaultRequested; |
| 842 | 842 | ||
| 843 | hr = UserExperienceOnPlanCompatibleMsiPackageBegin(pUserExperience, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pPackage->compatiblePackage.Msi.pVersion, &pPackage->compatiblePackage.fRequested); | 843 | hr = BACallbackOnPlanCompatibleMsiPackageBegin(pUserExperience, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pPackage->compatiblePackage.Msi.pVersion, &pPackage->compatiblePackage.fRequested); |
| 844 | UserExperienceOnPlanCompatibleMsiPackageComplete(pUserExperience, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, hr, pPackage->compatiblePackage.fRequested); | 844 | BACallbackOnPlanCompatibleMsiPackageComplete(pUserExperience, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, hr, pPackage->compatiblePackage.fRequested); |
| 845 | ExitOnRootFailure(hr, "BA aborted plan compatible MSI package begin."); | 845 | ExitOnRootFailure(hr, "BA aborted plan compatible MSI package begin."); |
| 846 | } | 846 | } |
| 847 | 847 | ||
| @@ -1679,7 +1679,7 @@ extern "C" HRESULT MsiEnginePlanPackageOptions( | |||
| 1679 | break; | 1679 | break; |
| 1680 | } | 1680 | } |
| 1681 | 1681 | ||
| 1682 | return UserExperienceOnPlanMsiPackage(pUserExperience, wzPackageId, fExecute, actionState, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler, pFileVersioning); | 1682 | return BACallbackOnPlanMsiPackage(pUserExperience, wzPackageId, fExecute, actionState, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler, pFileVersioning); |
| 1683 | } | 1683 | } |
| 1684 | 1684 | ||
| 1685 | extern "C" void MsiEngineUpdateInstallRegistrationState( | 1685 | extern "C" void MsiEngineUpdateInstallRegistrationState( |
diff --git a/src/burn/engine/mspengine.cpp b/src/burn/engine/mspengine.cpp index 089262e1..c057c06d 100644 --- a/src/burn/engine/mspengine.cpp +++ b/src/burn/engine/mspengine.cpp | |||
| @@ -324,7 +324,7 @@ extern "C" HRESULT MspEngineDetectPackage( | |||
| 324 | } | 324 | } |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | hr = UserExperienceOnDetectPatchTarget(pUserExperience, pPackage->sczId, pTargetProduct->wzTargetProductCode, pTargetProduct->patchPackageState); | 327 | hr = BACallbackOnDetectPatchTarget(pUserExperience, pPackage->sczId, pTargetProduct->wzTargetProductCode, pTargetProduct->patchPackageState); |
| 328 | ExitOnRootFailure(hr, "BA aborted detect patch target."); | 328 | ExitOnRootFailure(hr, "BA aborted detect patch target."); |
| 329 | } | 329 | } |
| 330 | } | 330 | } |
| @@ -358,7 +358,7 @@ extern "C" HRESULT MspEnginePlanInitializePackage( | |||
| 358 | 358 | ||
| 359 | pTargetProduct->defaultRequested = pTargetProduct->requested = pPackage->requested; | 359 | pTargetProduct->defaultRequested = pTargetProduct->requested = pPackage->requested; |
| 360 | 360 | ||
| 361 | hr = UserExperienceOnPlanPatchTarget(pUserExperience, pPackage->sczId, pTargetProduct->wzTargetProductCode, &pTargetProduct->requested); | 361 | hr = BACallbackOnPlanPatchTarget(pUserExperience, pPackage->sczId, pTargetProduct->wzTargetProductCode, &pTargetProduct->requested); |
| 362 | ExitOnRootFailure(hr, "BA aborted plan patch target."); | 362 | ExitOnRootFailure(hr, "BA aborted plan patch target."); |
| 363 | } | 363 | } |
| 364 | 364 | ||
diff --git a/src/burn/engine/payload.cpp b/src/burn/engine/payload.cpp index fe3d673e..1d8328e3 100644 --- a/src/burn/engine/payload.cpp +++ b/src/burn/engine/payload.cpp | |||
| @@ -244,6 +244,7 @@ extern "C" void PayloadUninitialize( | |||
| 244 | ReleaseStr(pPayload->downloadSource.sczUrl); | 244 | ReleaseStr(pPayload->downloadSource.sczUrl); |
| 245 | ReleaseStr(pPayload->downloadSource.sczUser); | 245 | ReleaseStr(pPayload->downloadSource.sczUser); |
| 246 | ReleaseStr(pPayload->downloadSource.sczPassword); | 246 | ReleaseStr(pPayload->downloadSource.sczPassword); |
| 247 | ReleaseStr(pPayload->downloadSource.sczAuthorizationHeader); | ||
| 247 | ReleaseStr(pPayload->sczUnverifiedPath); | 248 | ReleaseStr(pPayload->sczUnverifiedPath); |
| 248 | } | 249 | } |
| 249 | } | 250 | } |
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index b7703869..be281827 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
| @@ -441,15 +441,11 @@ extern "C" HRESULT PlanLayoutBundle( | |||
| 441 | hr = VariableGetString(pVariables, BURN_BUNDLE_LAYOUT_DIRECTORY, &sczLayoutDirectory); | 441 | hr = VariableGetString(pVariables, BURN_BUNDLE_LAYOUT_DIRECTORY, &sczLayoutDirectory); |
| 442 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. | 442 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. |
| 443 | { | 443 | { |
| 444 | hr = VariableGetString(pVariables, BURN_BUNDLE_SOURCE_PROCESS_FOLDER, &sczLayoutDirectory); | 444 | hr = PathForCurrentProcess(&sczExecutablePath, NULL); |
| 445 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. | 445 | ExitOnFailure(hr, "Failed to get path for current executing process as layout directory."); |
| 446 | { | ||
| 447 | hr = PathForCurrentProcess(&sczExecutablePath, NULL); | ||
| 448 | ExitOnFailure(hr, "Failed to get path for current executing process as layout directory."); | ||
| 449 | 446 | ||
| 450 | hr = PathGetDirectory(sczExecutablePath, &sczLayoutDirectory); | 447 | hr = PathGetDirectory(sczExecutablePath, &sczLayoutDirectory); |
| 451 | ExitOnFailure(hr, "Failed to get executing process as layout directory."); | 448 | ExitOnFailure(hr, "Failed to get executing process as layout directory."); |
| 452 | } | ||
| 453 | } | 449 | } |
| 454 | ExitOnFailure(hr, "Failed to get bundle layout directory property."); | 450 | ExitOnFailure(hr, "Failed to get bundle layout directory property."); |
| 455 | 451 | ||
| @@ -538,7 +534,7 @@ extern "C" HRESULT PlanForwardCompatibleBundles( | |||
| 538 | 534 | ||
| 539 | fIgnoreBundle = fRecommendIgnore; | 535 | fIgnoreBundle = fRecommendIgnore; |
| 540 | 536 | ||
| 541 | hr = UserExperienceOnPlanForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); | 537 | hr = BACallbackOnPlanForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); |
| 542 | ExitOnRootFailure(hr, "BA aborted plan forward compatible bundle."); | 538 | ExitOnRootFailure(hr, "BA aborted plan forward compatible bundle."); |
| 543 | 539 | ||
| 544 | if (!fIgnoreBundle) | 540 | if (!fIgnoreBundle) |
| @@ -564,7 +560,7 @@ extern "C" HRESULT PlanPackages( | |||
| 564 | ) | 560 | ) |
| 565 | { | 561 | { |
| 566 | HRESULT hr = S_OK; | 562 | HRESULT hr = S_OK; |
| 567 | 563 | ||
| 568 | hr = PlanPackagesHelper(pPackages->rgPackages, pPackages->cPackages, pUX, pPlan, pLog, pVariables); | 564 | hr = PlanPackagesHelper(pPackages->rgPackages, pPackages->cPackages, pUX, pPlan, pLog, pVariables); |
| 569 | 565 | ||
| 570 | return hr; | 566 | return hr; |
| @@ -896,11 +892,11 @@ static HRESULT PlanPackagesHelper( | |||
| 896 | DWORD iPackage = fReverseOrder ? cPackages - 1 - i : i; | 892 | DWORD iPackage = fReverseOrder ? cPackages - 1 - i : i; |
| 897 | BURN_PACKAGE* pPackage = rgPackages + iPackage; | 893 | BURN_PACKAGE* pPackage = rgPackages + iPackage; |
| 898 | 894 | ||
| 899 | UserExperienceOnPlannedPackage(pUX, pPackage->sczId, pPackage->execute, pPackage->rollback, NULL != pPackage->hCacheEvent, pPackage->fPlannedUncache); | 895 | BACallbackOnPlannedPackage(pUX, pPackage->sczId, pPackage->execute, pPackage->rollback, NULL != pPackage->hCacheEvent, pPackage->fPlannedUncache); |
| 900 | 896 | ||
| 901 | if (pPackage->compatiblePackage.fPlannable) | 897 | if (pPackage->compatiblePackage.fPlannable) |
| 902 | { | 898 | { |
| 903 | UserExperienceOnPlannedCompatiblePackage(pUX, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pPackage->compatiblePackage.fRemove); | 899 | BACallbackOnPlannedCompatiblePackage(pUX, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pPackage->compatiblePackage.fRemove); |
| 904 | } | 900 | } |
| 905 | } | 901 | } |
| 906 | 902 | ||
| @@ -961,7 +957,7 @@ static HRESULT InitializePackage( | |||
| 961 | pPackage->requested = pPackage->defaultRequested; | 957 | pPackage->requested = pPackage->defaultRequested; |
| 962 | fBeginCalled = TRUE; | 958 | fBeginCalled = TRUE; |
| 963 | 959 | ||
| 964 | hr = UserExperienceOnPlanPackageBegin(pUX, pPackage->sczId, pPackage->currentState, pPackage->fCached, installCondition, repairCondition, &pPackage->requested, &pPackage->cacheType); | 960 | hr = BACallbackOnPlanPackageBegin(pUX, pPackage->sczId, pPackage->currentState, pPackage->fCached, installCondition, repairCondition, &pPackage->requested, &pPackage->cacheType); |
| 965 | ExitOnRootFailure(hr, "BA aborted plan package begin."); | 961 | ExitOnRootFailure(hr, "BA aborted plan package begin."); |
| 966 | 962 | ||
| 967 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type) | 963 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type) |
| @@ -973,7 +969,7 @@ static HRESULT InitializePackage( | |||
| 973 | LExit: | 969 | LExit: |
| 974 | if (fBeginCalled) | 970 | if (fBeginCalled) |
| 975 | { | 971 | { |
| 976 | UserExperienceOnPlanPackageComplete(pUX, pPackage->sczId, hr, pPackage->requested); | 972 | BACallbackOnPlanPackageComplete(pUX, pPackage->sczId, hr, pPackage->requested); |
| 977 | } | 973 | } |
| 978 | 974 | ||
| 979 | return hr; | 975 | return hr; |
| @@ -1375,7 +1371,7 @@ extern "C" HRESULT PlanRelatedBundlesInitialize( | |||
| 1375 | 1371 | ||
| 1376 | pRelatedBundle->planRelationType = pRelatedBundle->defaultPlanRelationType; | 1372 | pRelatedBundle->planRelationType = pRelatedBundle->defaultPlanRelationType; |
| 1377 | 1373 | ||
| 1378 | hr = UserExperienceOnPlanRelatedBundleType(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->planRelationType); | 1374 | hr = BACallbackOnPlanRelatedBundleType(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->planRelationType); |
| 1379 | ExitOnRootFailure(hr, "BA aborted plan related bundle type."); | 1375 | ExitOnRootFailure(hr, "BA aborted plan related bundle type."); |
| 1380 | 1376 | ||
| 1381 | if (BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE == pRelatedBundle->planRelationType && | 1377 | if (BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE == pRelatedBundle->planRelationType && |
| @@ -1462,7 +1458,7 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
| 1462 | 1458 | ||
| 1463 | pRelatedBundle->package.defaultRequested = pRelatedBundle->package.requested; | 1459 | pRelatedBundle->package.defaultRequested = pRelatedBundle->package.requested; |
| 1464 | 1460 | ||
| 1465 | hr = UserExperienceOnPlanRelatedBundle(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->package.requested); | 1461 | hr = BACallbackOnPlanRelatedBundle(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->package.requested); |
| 1466 | ExitOnRootFailure(hr, "BA aborted plan related bundle."); | 1462 | ExitOnRootFailure(hr, "BA aborted plan related bundle."); |
| 1467 | 1463 | ||
| 1468 | // If uninstalling and the dependent related bundle may be executed, ignore its provider key to allow for downgrades with ref-counting. | 1464 | // If uninstalling and the dependent related bundle may be executed, ignore its provider key to allow for downgrades with ref-counting. |
| @@ -1662,7 +1658,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
| 1662 | 1658 | ||
| 1663 | pRelatedBundle->defaultRequestedRestore = pRelatedBundle->requestedRestore = BOOTSTRAPPER_REQUEST_STATE_FORCE_PRESENT; | 1659 | pRelatedBundle->defaultRequestedRestore = pRelatedBundle->requestedRestore = BOOTSTRAPPER_REQUEST_STATE_FORCE_PRESENT; |
| 1664 | 1660 | ||
| 1665 | hr = UserExperienceOnPlanRestoreRelatedBundle(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->requestedRestore); | 1661 | hr = BACallbackOnPlanRestoreRelatedBundle(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->requestedRestore); |
| 1666 | ExitOnRootFailure(hr, "BA aborted plan restore related bundle."); | 1662 | ExitOnRootFailure(hr, "BA aborted plan restore related bundle."); |
| 1667 | 1663 | ||
| 1668 | switch (pRelatedBundle->requestedRestore) | 1664 | switch (pRelatedBundle->requestedRestore) |
| @@ -1966,7 +1962,7 @@ extern "C" HRESULT PlanRollbackBoundaryBegin( | |||
| 1966 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START; | 1962 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START; |
| 1967 | pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; | 1963 | pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; |
| 1968 | 1964 | ||
| 1969 | hr = UserExperienceOnPlanRollbackBoundary(pUX, pRollbackBoundary->sczId, &pRollbackBoundary->fTransaction); | 1965 | hr = BACallbackOnPlanRollbackBoundary(pUX, pRollbackBoundary->sczId, &pRollbackBoundary->fTransaction); |
| 1970 | ExitOnRootFailure(hr, "BA aborted plan rollback boundary."); | 1966 | ExitOnRootFailure(hr, "BA aborted plan rollback boundary."); |
| 1971 | 1967 | ||
| 1972 | // Only use MSI transaction if authored and the BA requested it. | 1968 | // Only use MSI transaction if authored and the BA requested it. |
diff --git a/src/burn/engine/platform.h b/src/burn/engine/platform.h index 5896a5ca..e355e793 100644 --- a/src/burn/engine/platform.h +++ b/src/burn/engine/platform.h | |||
| @@ -27,10 +27,11 @@ enum WM_BURN | |||
| 27 | // forward declare | 27 | // forward declare |
| 28 | 28 | ||
| 29 | enum BURN_MODE; | 29 | enum BURN_MODE; |
| 30 | typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT BOOTSTRAPPER_ENGINE_CONTEXT; | 30 | typedef struct _BAENGINE_CONTEXT BAENGINE_CONTEXT; |
| 31 | typedef struct _BOOTSTRAPPER_ENGINE_ACTION BOOTSTRAPPER_ENGINE_ACTION; | 31 | typedef struct _BAENGINE_ACTION BAENGINE_ACTION; |
| 32 | typedef struct _BURN_CACHE BURN_CACHE; | 32 | typedef struct _BURN_CACHE BURN_CACHE; |
| 33 | typedef struct _BURN_DEPENDENCIES BURN_DEPENDENCIES; | 33 | typedef struct _BURN_DEPENDENCIES BURN_DEPENDENCIES; |
| 34 | typedef struct _BURN_ENGINE_STATE BURN_ENGINE_STATE; | ||
| 34 | typedef struct _BURN_ENGINE_COMMAND BURN_ENGINE_COMMAND; | 35 | typedef struct _BURN_ENGINE_COMMAND BURN_ENGINE_COMMAND; |
| 35 | typedef struct _BURN_LOGGING BURN_LOGGING; | 36 | typedef struct _BURN_LOGGING BURN_LOGGING; |
| 36 | typedef struct _BURN_PACKAGES BURN_PACKAGES; | 37 | typedef struct _BURN_PACKAGES BURN_PACKAGES; |
diff --git a/src/burn/engine/precomp.h b/src/burn/engine/precomp.h index 50df77ca..1150b2a0 100644 --- a/src/burn/engine/precomp.h +++ b/src/burn/engine/precomp.h | |||
| @@ -61,8 +61,8 @@ | |||
| 61 | #include <dpiutil.h> | 61 | #include <dpiutil.h> |
| 62 | #include <butil.h> | 62 | #include <butil.h> |
| 63 | 63 | ||
| 64 | #include "BootstrapperEngine.h" | 64 | #include "baenginetypes.h" |
| 65 | #include "BootstrapperApplication.h" | 65 | #include "batypes.h" |
| 66 | #include "BundleExtensionEngine.h" | 66 | #include "BundleExtensionEngine.h" |
| 67 | #include "BundleExtension.h" | 67 | #include "BundleExtension.h" |
| 68 | 68 | ||
| @@ -77,6 +77,7 @@ | |||
| 77 | #include "cabextract.h" | 77 | #include "cabextract.h" |
| 78 | #include "burnextension.h" | 78 | #include "burnextension.h" |
| 79 | #include "search.h" | 79 | #include "search.h" |
| 80 | #include "bootstrapperapplication.h" | ||
| 80 | #include "userexperience.h" | 81 | #include "userexperience.h" |
| 81 | #include "package.h" | 82 | #include "package.h" |
| 82 | #include "update.h" | 83 | #include "update.h" |
| @@ -104,7 +105,8 @@ | |||
| 104 | #include "netfxchainer.h" | 105 | #include "netfxchainer.h" |
| 105 | 106 | ||
| 106 | #include "externalengine.h" | 107 | #include "externalengine.h" |
| 107 | #include "EngineForApplication.h" | 108 | #include "bacallback.h" |
| 109 | #include "baengine.h" | ||
| 108 | #include "EngineForExtension.h" | 110 | #include "EngineForExtension.h" |
| 109 | #include "engine.messages.h" | 111 | #include "engine.messages.h" |
| 110 | #include "engine.version.h" | 112 | #include "engine.version.h" |
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index 01ed30d7..fd8a32a4 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
| @@ -299,7 +299,7 @@ LExit: | |||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | /******************************************************************* | 301 | /******************************************************************* |
| 302 | RegistrationUninitialize - | 302 | RegistrationUninitialize - |
| 303 | 303 | ||
| 304 | *******************************************************************/ | 304 | *******************************************************************/ |
| 305 | extern "C" void RegistrationUninitialize( | 305 | extern "C" void RegistrationUninitialize( |
| @@ -550,7 +550,7 @@ LExit: | |||
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | /******************************************************************* | 552 | /******************************************************************* |
| 553 | RegistrationDetectRelatedBundles - finds the bundles with same | 553 | RegistrationDetectRelatedBundles - finds the bundles with same |
| 554 | upgrade/detect/addon/patch codes. | 554 | upgrade/detect/addon/patch codes. |
| 555 | 555 | ||
| 556 | *******************************************************************/ | 556 | *******************************************************************/ |
| @@ -761,7 +761,7 @@ extern "C" HRESULT RegistrationSessionBegin( | |||
| 761 | else if (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON != pRegistration->modify) // if support modify (aka: did not disable anything) | 761 | else if (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON != pRegistration->modify) // if support modify (aka: did not disable anything) |
| 762 | { | 762 | { |
| 763 | // ModifyPath: [path to exe] /modify | 763 | // ModifyPath: [path to exe] /modify |
| 764 | hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_MODIFY_PATH, L"\"%ls\" /%ls /modify", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | 764 | hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_MODIFY_PATH, L"\"%ls\" /modify", pRegistration->sczCacheExecutablePath); |
| 765 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_MODIFY_PATH); | 765 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_MODIFY_PATH); |
| 766 | 766 | ||
| 767 | // NoElevateOnModify: 1 | 767 | // NoElevateOnModify: 1 |
| @@ -793,14 +793,14 @@ extern "C" HRESULT RegistrationSessionBegin( | |||
| 793 | } | 793 | } |
| 794 | 794 | ||
| 795 | // QuietUninstallString: [path to exe] /uninstall /quiet | 795 | // QuietUninstallString: [path to exe] /uninstall /quiet |
| 796 | hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING, L"\"%ls\" /%ls /uninstall /quiet", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | 796 | hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING, L"\"%ls\" /uninstall /quiet", pRegistration->sczCacheExecutablePath); |
| 797 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING); | 797 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING); |
| 798 | 798 | ||
| 799 | // UninstallString, [path to exe] | 799 | // UninstallString, [path to exe] |
| 800 | // If the modify button is to be disabled, we'll add "/modify" to the uninstall string because the button is "Uninstall/Change". Otherwise, | 800 | // If the modify button is to be disabled, we'll add "/modify" to the uninstall string because the button is "Uninstall/Change". Otherwise, |
| 801 | // it's just the "Uninstall" button so we add "/uninstall" to make the program just go away. | 801 | // it's just the "Uninstall" button so we add "/uninstall" to make the program just go away. |
| 802 | LPCWSTR wzUninstallParameters = (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON == pRegistration->modify) ? L"/modify" : L" /uninstall"; | 802 | LPCWSTR wzUninstallParameters = (BURN_REGISTRATION_MODIFY_DISABLE_BUTTON == pRegistration->modify) ? L"/modify" : L" /uninstall"; |
| 803 | hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_UNINSTALL_STRING, L"\"%ls\" /%ls %ls", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, wzUninstallParameters); | 803 | hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_UNINSTALL_STRING, L"\"%ls\" %ls", pRegistration->sczCacheExecutablePath, wzUninstallParameters); |
| 804 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_UNINSTALL_STRING); | 804 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_UNINSTALL_STRING); |
| 805 | 805 | ||
| 806 | if (pRegistration->softwareTags.cSoftwareTags) | 806 | if (pRegistration->softwareTags.cSoftwareTags) |
| @@ -1281,7 +1281,7 @@ static HRESULT UpdateResumeMode( | |||
| 1281 | if ((BURN_RESUME_MODE_ACTIVE == resumeMode || fRestartInitiated) && !pRegistration->fDisableResume) | 1281 | if ((BURN_RESUME_MODE_ACTIVE == resumeMode || fRestartInitiated) && !pRegistration->fDisableResume) |
| 1282 | { | 1282 | { |
| 1283 | // append RunOnce switch | 1283 | // append RunOnce switch |
| 1284 | hr = StrAllocFormatted(&sczRunOnceCommandLine, L"\"%ls\" /%ls /%ls", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, BURN_COMMANDLINE_SWITCH_RUNONCE); | 1284 | hr = StrAllocFormatted(&sczRunOnceCommandLine, L"\"%ls\" /%ls", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_RUNONCE); |
| 1285 | ExitOnFailure(hr, "Failed to format resume command line for RunOnce."); | 1285 | ExitOnFailure(hr, "Failed to format resume command line for RunOnce."); |
| 1286 | 1286 | ||
| 1287 | // write run key | 1287 | // write run key |
diff --git a/src/burn/engine/splashscreen.cpp b/src/burn/engine/splashscreen.cpp index b9dc9f55..0bfa00aa 100644 --- a/src/burn/engine/splashscreen.cpp +++ b/src/burn/engine/splashscreen.cpp | |||
| @@ -337,7 +337,7 @@ static HRESULT LoadSplashScreen( | |||
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | pSplashScreen->hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, BURN_SPLASHSCREEN_CLASS_WINDOW, pContext->wzCaption, WS_POPUP | WS_VISIBLE, x, y, pSplashScreen->size.cx, pSplashScreen->size.cy, HWND_DESKTOP, NULL, pContext->hInstance, pSplashScreen); | 339 | pSplashScreen->hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, BURN_SPLASHSCREEN_CLASS_WINDOW, pContext->wzCaption, WS_POPUP | WS_VISIBLE, x, y, pSplashScreen->size.cx, pSplashScreen->size.cy, HWND_DESKTOP, NULL, pContext->hInstance, pSplashScreen); |
| 340 | ExitOnNullWithLastError(pSplashScreen->hWnd, hr, "Failed to create window."); | 340 | ExitOnNullWithLastError(pSplashScreen->hWnd, hr, "Failed to create splash screen window."); |
| 341 | 341 | ||
| 342 | LExit: | 342 | LExit: |
| 343 | MemFree(pMonitorContext); | 343 | MemFree(pMonitorContext); |
diff --git a/src/burn/engine/uithread.cpp b/src/burn/engine/uithread.cpp index 8ddd51bd..9beb9f80 100644 --- a/src/burn/engine/uithread.cpp +++ b/src/burn/engine/uithread.cpp | |||
| @@ -124,7 +124,7 @@ static DWORD WINAPI ThreadProc( | |||
| 124 | 124 | ||
| 125 | // Create the window to handle reboots without activating it. | 125 | // Create the window to handle reboots without activating it. |
| 126 | hWnd = ::CreateWindowExW(WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info); | 126 | hWnd = ::CreateWindowExW(WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info); |
| 127 | ExitOnNullWithLastError(hWnd, hr, "Failed to create window."); | 127 | ExitOnNullWithLastError(hWnd, hr, "Failed to create Burn UI thread window."); |
| 128 | 128 | ||
| 129 | ::ShowWindow(hWnd, SW_SHOWNA); | 129 | ::ShowWindow(hWnd, SW_SHOWNA); |
| 130 | 130 | ||
diff --git a/src/burn/engine/update.cpp b/src/burn/engine/update.cpp index b04fa9a4..70cb8a8d 100644 --- a/src/burn/engine/update.cpp +++ b/src/burn/engine/update.cpp | |||
| @@ -39,6 +39,7 @@ extern "C" void UpdateUninitialize( | |||
| 39 | { | 39 | { |
| 40 | PackageUninitialize(&pUpdate->package); | 40 | PackageUninitialize(&pUpdate->package); |
| 41 | 41 | ||
| 42 | ReleaseStr(pUpdate->sczAuthorizationHeader); | ||
| 42 | ReleaseStr(pUpdate->sczUpdateSource); | 43 | ReleaseStr(pUpdate->sczUpdateSource); |
| 43 | memset(pUpdate, 0, sizeof(BURN_UPDATE)); | 44 | memset(pUpdate, 0, sizeof(BURN_UPDATE)); |
| 44 | } | 45 | } |
diff --git a/src/burn/engine/update.h b/src/burn/engine/update.h index 67d40481..ef45c4cf 100644 --- a/src/burn/engine/update.h +++ b/src/burn/engine/update.h | |||
| @@ -13,6 +13,7 @@ typedef struct _BURN_UPDATE | |||
| 13 | { | 13 | { |
| 14 | BOOL fUpdateAvailable; | 14 | BOOL fUpdateAvailable; |
| 15 | LPWSTR sczUpdateSource; | 15 | LPWSTR sczUpdateSource; |
| 16 | LPWSTR sczAuthorizationHeader; | ||
| 16 | 17 | ||
| 17 | BURN_PACKAGE package; | 18 | BURN_PACKAGE package; |
| 18 | } BURN_UPDATE; | 19 | } BURN_UPDATE; |
diff --git a/src/burn/engine/userexperience.cpp b/src/burn/engine/userexperience.cpp index 372ca901..99561f35 100644 --- a/src/burn/engine/userexperience.cpp +++ b/src/burn/engine/userexperience.cpp | |||
| @@ -4,88 +4,60 @@ | |||
| 4 | 4 | ||
| 5 | // internal function declarations | 5 | // internal function declarations |
| 6 | 6 | ||
| 7 | static int FilterResult( | 7 | // static int FilterResult( |
| 8 | __in DWORD dwAllowedResults, | 8 | // __in DWORD dwAllowedResults, |
| 9 | __in int nResult | 9 | // __in int nResult |
| 10 | ); | 10 | // ); |
| 11 | 11 | ||
| 12 | static HRESULT FilterExecuteResult( | 12 | // static HRESULT FilterExecuteResult( |
| 13 | __in BURN_USER_EXPERIENCE* pUserExperience, | 13 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 14 | __in HRESULT hrStatus, | 14 | // __in HRESULT hrStatus, |
| 15 | __in BOOL fRollback, | 15 | // __in BOOL fRollback, |
| 16 | __in BOOL fCancel, | 16 | // __in BOOL fCancel, |
| 17 | __in LPCWSTR sczEventName | 17 | // __in LPCWSTR sczEventName |
| 18 | ); | 18 | // ); |
| 19 | 19 | ||
| 20 | static HRESULT SendBAMessage( | 20 | // static HRESULT SendBAMessage( |
| 21 | __in BURN_USER_EXPERIENCE* pUserExperience, | 21 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 22 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | 22 | // __in BOOTSTRAPPER_APPLICATION_MESSAGE message, |
| 23 | __in const LPVOID pvArgs, | 23 | // __in_bcount(cbArgs) const LPVOID pvArgs, |
| 24 | __inout LPVOID pvResults | 24 | // __in const DWORD cbArgs, |
| 25 | ); | 25 | // __in PIPE_RPC_RESULT* pResult |
| 26 | 26 | // ); | |
| 27 | static HRESULT SendBAMessageFromInactiveEngine( | 27 | |
| 28 | __in BURN_USER_EXPERIENCE* pUserExperience, | 28 | // static HRESULT SendBAMessageFromInactiveEngine( |
| 29 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | 29 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 30 | __in const LPVOID pvArgs, | 30 | // __in BOOTSTRAPPER_APPLICATION_MESSAGE message, |
| 31 | __inout LPVOID pvResults | 31 | // __in const LPVOID pvArgs, |
| 32 | ); | 32 | // __in const DWORD cbArgs, |
| 33 | // __in PIPE_RPC_RESULT* pResult | ||
| 34 | // ); | ||
| 33 | 35 | ||
| 34 | 36 | ||
| 35 | // function definitions | 37 | // function definitions |
| 36 | 38 | ||
| 37 | /******************************************************************* | 39 | // /******************************************************************* |
| 38 | UserExperienceParseFromXml - | 40 | // UserExperienceUninitialize - |
| 39 | |||
| 40 | *******************************************************************/ | ||
| 41 | extern "C" HRESULT UserExperienceParseFromXml( | ||
| 42 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 43 | __in IXMLDOMNode* pixnBundle | ||
| 44 | ) | ||
| 45 | { | ||
| 46 | HRESULT hr = S_OK; | ||
| 47 | IXMLDOMNode* pixnUserExperienceNode = NULL; | ||
| 48 | |||
| 49 | // select UX node | ||
| 50 | hr = XmlSelectSingleNode(pixnBundle, L"UX", &pixnUserExperienceNode); | ||
| 51 | if (S_FALSE == hr) | ||
| 52 | { | ||
| 53 | hr = E_NOTFOUND; | ||
| 54 | } | ||
| 55 | ExitOnFailure(hr, "Failed to select user experience node."); | ||
| 56 | |||
| 57 | // parse payloads | ||
| 58 | hr = PayloadsParseFromXml(&pUserExperience->payloads, NULL, NULL, pixnUserExperienceNode); | ||
| 59 | ExitOnFailure(hr, "Failed to parse user experience payloads."); | ||
| 60 | |||
| 61 | // make sure we have at least one payload | ||
| 62 | if (0 == pUserExperience->payloads.cPayloads) | ||
| 63 | { | ||
| 64 | hr = E_UNEXPECTED; | ||
| 65 | ExitOnFailure(hr, "Too few UX payloads."); | ||
| 66 | } | ||
| 67 | |||
| 68 | LExit: | ||
| 69 | ReleaseObject(pixnUserExperienceNode); | ||
| 70 | 41 | ||
| 71 | return hr; | 42 | // *******************************************************************/ |
| 72 | } | 43 | // extern "C" void UserExperienceUninitialize( |
| 44 | // __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 45 | // ) | ||
| 46 | // { | ||
| 47 | // if (pUserExperience->pEngineContext) | ||
| 48 | // { | ||
| 49 | // BAEngineFreeContext(pUserExperience->pEngineContext); | ||
| 50 | // pUserExperience->pEngineContext = NULL; | ||
| 51 | // } | ||
| 73 | 52 | ||
| 74 | /******************************************************************* | 53 | // ReleaseStr(pUserExperience->sczTempDirectory); |
| 75 | UserExperienceUninitialize - | 54 | // PayloadsUninitialize(&pUserExperience->payloads); |
| 76 | 55 | ||
| 77 | *******************************************************************/ | 56 | // // clear struct |
| 78 | extern "C" void UserExperienceUninitialize( | 57 | // memset(pUserExperience, 0, sizeof(BURN_USER_EXPERIENCE)); |
| 79 | __in BURN_USER_EXPERIENCE* pUserExperience | 58 | // } |
| 80 | ) | ||
| 81 | { | ||
| 82 | ReleaseStr(pUserExperience->sczTempDirectory); | ||
| 83 | PayloadsUninitialize(&pUserExperience->payloads); | ||
| 84 | |||
| 85 | // clear struct | ||
| 86 | memset(pUserExperience, 0, sizeof(BURN_USER_EXPERIENCE)); | ||
| 87 | } | ||
| 88 | 59 | ||
| 60 | #ifdef TODO_DELETE | ||
| 89 | /******************************************************************* | 61 | /******************************************************************* |
| 90 | UserExperienceLoad - | 62 | UserExperienceLoad - |
| 91 | 63 | ||
| @@ -167,2848 +139,2820 @@ extern "C" HRESULT UserExperienceUnload( | |||
| 167 | //LExit: | 139 | //LExit: |
| 168 | return hr; | 140 | return hr; |
| 169 | } | 141 | } |
| 170 | 142 | #endif | |
| 171 | extern "C" HRESULT UserExperienceEnsureWorkingFolder( | 143 | |
| 172 | __in BURN_CACHE* pCache, | 144 | // EXTERN_C BAAPI UserExperienceOnApplyBegin( |
| 173 | __deref_out_z LPWSTR* psczUserExperienceWorkingFolder | 145 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 174 | ) | 146 | // __in DWORD dwPhaseCount |
| 175 | { | 147 | // ) |
| 176 | HRESULT hr = S_OK; | 148 | // { |
| 177 | LPWSTR sczWorkingFolder = NULL; | 149 | // HRESULT hr = S_OK; |
| 178 | 150 | // BA_ONAPPLYBEGIN_ARGS args = { }; | |
| 179 | hr = CacheEnsureBaseWorkingFolder(pCache, &sczWorkingFolder); | 151 | // BA_ONAPPLYBEGIN_RESULTS results = { }; |
| 180 | ExitOnFailure(hr, "Failed to create working folder."); | 152 | // PIPE_RPC_RESULT result = { }; |
| 181 | 153 | ||
| 182 | hr = StrAllocFormatted(psczUserExperienceWorkingFolder, L"%ls%ls\\", sczWorkingFolder, L".ba"); | 154 | // args.cbSize = sizeof(args); |
| 183 | ExitOnFailure(hr, "Failed to calculate the bootstrapper application working path."); | 155 | // args.dwPhaseCount = dwPhaseCount; |
| 184 | 156 | ||
| 185 | hr = DirEnsureExists(*psczUserExperienceWorkingFolder, NULL); | 157 | // results.cbSize = sizeof(results); |
| 186 | ExitOnFailure(hr, "Failed create bootstrapper application working folder."); | 158 | |
| 187 | 159 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, args.cbSize, &result); | |
| 188 | LExit: | 160 | // ExitOnFailure(hr, "BA OnApplyBegin failed."); |
| 189 | ReleaseStr(sczWorkingFolder); | 161 | |
| 190 | 162 | // if (results.fCancel) | |
| 191 | return hr; | 163 | // { |
| 192 | } | 164 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 193 | 165 | // } | |
| 194 | 166 | ||
| 195 | extern "C" HRESULT UserExperienceRemove( | 167 | // LExit: |
| 196 | __in BURN_USER_EXPERIENCE* pUserExperience | 168 | // return hr; |
| 197 | ) | 169 | // } |
| 198 | { | 170 | |
| 199 | HRESULT hr = S_OK; | 171 | // EXTERN_C BAAPI UserExperienceOnApplyComplete( |
| 200 | 172 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 201 | // Remove temporary UX directory | 173 | // __in HRESULT hrStatus, |
| 202 | if (pUserExperience->sczTempDirectory) | 174 | // __in BOOTSTRAPPER_APPLY_RESTART restart, |
| 203 | { | 175 | // __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction |
| 204 | hr = DirEnsureDeleteEx(pUserExperience->sczTempDirectory, DIR_DELETE_FILES | DIR_DELETE_RECURSE | DIR_DELETE_SCHEDULE); | 176 | // ) |
| 205 | TraceError(hr, "Could not delete bootstrapper application folder. Some files will be left in the temp folder."); | 177 | // { |
| 206 | } | 178 | // HRESULT hr = S_OK; |
| 207 | 179 | // BA_ONAPPLYCOMPLETE_ARGS args = { }; | |
| 208 | //LExit: | 180 | // BA_ONAPPLYCOMPLETE_RESULTS results = { }; |
| 209 | return hr; | 181 | // PIPE_RPC_RESULT result = { }; |
| 210 | } | 182 | |
| 211 | 183 | // args.cbSize = sizeof(args); | |
| 212 | extern "C" int UserExperienceSendError( | 184 | // args.hrStatus = hrStatus; |
| 213 | __in BURN_USER_EXPERIENCE* pUserExperience, | 185 | // args.restart = restart; |
| 214 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | 186 | // args.recommendation = *pAction; |
| 215 | __in_z_opt LPCWSTR wzPackageId, | 187 | |
| 216 | __in HRESULT hrCode, | 188 | // results.cbSize = sizeof(results); |
| 217 | __in_z_opt LPCWSTR wzError, | 189 | // results.action = *pAction; |
| 218 | __in DWORD uiFlags, | 190 | |
| 219 | __in int nRecommendation | 191 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, args.cbSize, &result); |
| 220 | ) | 192 | // ExitOnFailure(hr, "BA OnApplyComplete failed."); |
| 221 | { | 193 | |
| 222 | int nResult = nRecommendation; | 194 | // *pAction = results.action; |
| 223 | DWORD dwCode = HRESULT_CODE(hrCode); | 195 | |
| 224 | LPWSTR sczError = NULL; | 196 | // LExit: |
| 225 | 197 | // return hr; | |
| 226 | // If no error string was provided, try to get the error string from the HRESULT. | 198 | // } |
| 227 | if (!wzError) | 199 | |
| 228 | { | 200 | // EXTERN_C BAAPI UserExperienceOnApplyDowngrade( |
| 229 | if (SUCCEEDED(StrAllocFromError(&sczError, hrCode, NULL))) | 201 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 230 | { | 202 | // __inout HRESULT* phrStatus |
| 231 | wzError = sczError; | 203 | // ) |
| 232 | } | 204 | // { |
| 233 | } | 205 | // HRESULT hr = S_OK; |
| 234 | 206 | // BA_ONAPPLYDOWNGRADE_ARGS args = { }; | |
| 235 | UserExperienceOnError(pUserExperience, errorType, wzPackageId, dwCode, wzError, uiFlags, 0, NULL, &nResult); // ignore return value. | 207 | // BA_ONAPPLYDOWNGRADE_RESULTS results = { }; |
| 236 | 208 | // PIPE_RPC_RESULT result = { }; | |
| 237 | ReleaseStr(sczError); | 209 | |
| 238 | return nResult; | 210 | // args.cbSize = sizeof(args); |
| 239 | } | 211 | // args.hrRecommended = *phrStatus; |
| 240 | 212 | ||
| 241 | extern "C" void UserExperienceActivateEngine( | 213 | // results.cbSize = sizeof(results); |
| 242 | __in BURN_USER_EXPERIENCE* pUserExperience | 214 | // results.hrStatus = *phrStatus; |
| 243 | ) | 215 | |
| 244 | { | 216 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, &args, args.cbSize, &result); |
| 245 | ::EnterCriticalSection(&pUserExperience->csEngineActive); | 217 | // ExitOnFailure(hr, "BA OnApplyDowngrade failed."); |
| 246 | AssertSz(!pUserExperience->fEngineActive, "Engine should have been deactivated before activating it."); | 218 | |
| 247 | pUserExperience->fEngineActive = TRUE; | 219 | // *phrStatus = results.hrStatus; |
| 248 | ::LeaveCriticalSection(&pUserExperience->csEngineActive); | 220 | |
| 249 | } | 221 | // LExit: |
| 250 | 222 | // return hr; | |
| 251 | extern "C" void UserExperienceDeactivateEngine( | 223 | // } |
| 252 | __in BURN_USER_EXPERIENCE* pUserExperience | 224 | |
| 253 | ) | 225 | // EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin( |
| 254 | { | 226 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 255 | ::EnterCriticalSection(&pUserExperience->csEngineActive); | 227 | // __in LPCWSTR wzTransactionId |
| 256 | AssertSz(pUserExperience->fEngineActive, "Engine should have been active before deactivating it."); | 228 | // ) |
| 257 | pUserExperience->fEngineActive = FALSE; | 229 | // { |
| 258 | ::LeaveCriticalSection(&pUserExperience->csEngineActive); | 230 | // HRESULT hr = S_OK; |
| 259 | } | 231 | // BA_ONBEGINMSITRANSACTIONBEGIN_ARGS args = { }; |
| 260 | 232 | // BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS results = { }; | |
| 261 | extern "C" HRESULT UserExperienceEnsureEngineInactive( | 233 | // PIPE_RPC_RESULT result = { }; |
| 262 | __in BURN_USER_EXPERIENCE* pUserExperience | 234 | |
| 263 | ) | 235 | // args.cbSize = sizeof(args); |
| 264 | { | 236 | // args.wzTransactionId = wzTransactionId; |
| 265 | // Make a slight optimization here by ignoring the critical section, because all callers should have needed to enter it for their operation anyway. | 237 | |
| 266 | HRESULT hr = pUserExperience->fEngineActive ? HRESULT_FROM_WIN32(ERROR_BUSY) : S_OK; | 238 | // results.cbSize = sizeof(results); |
| 267 | ExitOnRootFailure(hr, "Engine is active, cannot proceed."); | 239 | |
| 268 | 240 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, args.cbSize, &result); | |
| 269 | LExit: | 241 | // ExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed."); |
| 270 | return hr; | 242 | |
| 271 | } | 243 | // if (results.fCancel) |
| 272 | 244 | // { | |
| 273 | extern "C" void UserExperienceExecuteReset( | 245 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 274 | __in BURN_USER_EXPERIENCE* pUserExperience | 246 | // } |
| 275 | ) | 247 | |
| 276 | { | 248 | // LExit: |
| 277 | pUserExperience->hrApplyError = S_OK; | 249 | // return hr; |
| 278 | pUserExperience->hwndApply = NULL; | 250 | // } |
| 279 | } | 251 | |
| 280 | 252 | // EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionComplete( | |
| 281 | extern "C" void UserExperienceExecutePhaseComplete( | 253 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 282 | __in BURN_USER_EXPERIENCE* pUserExperience, | 254 | // __in LPCWSTR wzTransactionId, |
| 283 | __in HRESULT hrResult | 255 | // __in HRESULT hrStatus |
| 284 | ) | 256 | // ) |
| 285 | { | 257 | // { |
| 286 | if (FAILED(hrResult)) | 258 | // HRESULT hr = S_OK; |
| 287 | { | 259 | // BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS args = { }; |
| 288 | pUserExperience->hrApplyError = hrResult; | 260 | // BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS results = { }; |
| 289 | } | 261 | // PIPE_RPC_RESULT result = { }; |
| 290 | } | 262 | |
| 291 | 263 | // args.cbSize = sizeof(args); | |
| 292 | EXTERN_C BAAPI UserExperienceOnApplyBegin( | 264 | // args.wzTransactionId = wzTransactionId; |
| 293 | __in BURN_USER_EXPERIENCE* pUserExperience, | 265 | // args.hrStatus = hrStatus; |
| 294 | __in DWORD dwPhaseCount | 266 | |
| 295 | ) | 267 | // results.cbSize = sizeof(results); |
| 296 | { | 268 | |
| 297 | HRESULT hr = S_OK; | 269 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, args.cbSize, &result); |
| 298 | BA_ONAPPLYBEGIN_ARGS args = { }; | 270 | // ExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed."); |
| 299 | BA_ONAPPLYBEGIN_RESULTS results = { }; | 271 | |
| 300 | 272 | // LExit: | |
| 301 | args.cbSize = sizeof(args); | 273 | // return hr; |
| 302 | args.dwPhaseCount = dwPhaseCount; | 274 | // } |
| 303 | 275 | ||
| 304 | results.cbSize = sizeof(results); | 276 | // EXTERN_C BAAPI UserExperienceOnCacheAcquireBegin( |
| 305 | 277 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 306 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, &results); | 278 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 307 | ExitOnFailure(hr, "BA OnApplyBegin failed."); | 279 | // __in_z_opt LPCWSTR wzPayloadId, |
| 308 | 280 | // __in_z LPWSTR* pwzSource, | |
| 309 | if (results.fCancel) | 281 | // __in_z LPWSTR* pwzDownloadUrl, |
| 310 | { | 282 | // __in_z_opt LPCWSTR wzPayloadContainerId, |
| 311 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 283 | // __out BOOTSTRAPPER_CACHE_OPERATION* pCacheOperation |
| 312 | } | 284 | // ) |
| 313 | 285 | // { | |
| 314 | LExit: | 286 | // HRESULT hr = S_OK; |
| 315 | return hr; | 287 | // BA_ONCACHEACQUIREBEGIN_ARGS args = { }; |
| 316 | } | 288 | // BA_ONCACHEACQUIREBEGIN_RESULTS results = { }; |
| 317 | 289 | // PIPE_RPC_RESULT result = { }; | |
| 318 | EXTERN_C BAAPI UserExperienceOnApplyComplete( | 290 | |
| 319 | __in BURN_USER_EXPERIENCE* pUserExperience, | 291 | // *pCacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE; |
| 320 | __in HRESULT hrStatus, | 292 | |
| 321 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 293 | // args.cbSize = sizeof(args); |
| 322 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction | 294 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 323 | ) | 295 | // args.wzPayloadId = wzPayloadId; |
| 324 | { | 296 | // args.wzSource = *pwzSource; |
| 325 | HRESULT hr = S_OK; | 297 | // args.wzDownloadUrl = *pwzDownloadUrl; |
| 326 | BA_ONAPPLYCOMPLETE_ARGS args = { }; | 298 | // args.wzPayloadContainerId = wzPayloadContainerId; |
| 327 | BA_ONAPPLYCOMPLETE_RESULTS results = { }; | 299 | // args.recommendation = *pCacheOperation; |
| 328 | 300 | ||
| 329 | args.cbSize = sizeof(args); | 301 | // results.cbSize = sizeof(results); |
| 330 | args.hrStatus = hrStatus; | 302 | // results.action = *pCacheOperation; |
| 331 | args.restart = restart; | 303 | |
| 332 | args.recommendation = *pAction; | 304 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, args.cbSize, &result); |
| 333 | 305 | // ExitOnFailure(hr, "BA OnCacheAcquireBegin failed."); | |
| 334 | results.cbSize = sizeof(results); | 306 | |
| 335 | results.action = *pAction; | 307 | // if (results.fCancel) |
| 336 | 308 | // { | |
| 337 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, &results); | 309 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 338 | ExitOnFailure(hr, "BA OnApplyComplete failed."); | 310 | // } |
| 339 | 311 | // else | |
| 340 | *pAction = results.action; | 312 | // { |
| 341 | 313 | // // Verify the BA requested an action that is possible. | |
| 342 | LExit: | 314 | // if (BOOTSTRAPPER_CACHE_OPERATION_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || |
| 343 | return hr; | 315 | // BOOTSTRAPPER_CACHE_OPERATION_EXTRACT == results.action && wzPayloadContainerId || |
| 344 | } | 316 | // BOOTSTRAPPER_CACHE_OPERATION_COPY == results.action || |
| 345 | 317 | // BOOTSTRAPPER_CACHE_OPERATION_NONE == results.action) | |
| 346 | EXTERN_C BAAPI UserExperienceOnApplyDowngrade( | 318 | // { |
| 347 | __in BURN_USER_EXPERIENCE* pUserExperience, | 319 | // *pCacheOperation = results.action; |
| 348 | __inout HRESULT* phrStatus | 320 | // } |
| 349 | ) | 321 | // } |
| 350 | { | 322 | |
| 351 | HRESULT hr = S_OK; | 323 | // LExit: |
| 352 | BA_ONAPPLYDOWNGRADE_ARGS args = { }; | 324 | // return hr; |
| 353 | BA_ONAPPLYDOWNGRADE_RESULTS results = { }; | 325 | // } |
| 354 | 326 | ||
| 355 | args.cbSize = sizeof(args); | 327 | // EXTERN_C BAAPI UserExperienceOnCacheAcquireComplete( |
| 356 | args.hrRecommended = *phrStatus; | 328 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 357 | 329 | // __in_z_opt LPCWSTR wzPackageOrContainerId, | |
| 358 | results.cbSize = sizeof(results); | 330 | // __in_z_opt LPCWSTR wzPayloadId, |
| 359 | results.hrStatus = *phrStatus; | 331 | // __in HRESULT hrStatus, |
| 360 | 332 | // __inout BOOL* pfRetry | |
| 361 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, &args, &results); | 333 | // ) |
| 362 | ExitOnFailure(hr, "BA OnApplyDowngrade failed."); | 334 | // { |
| 363 | 335 | // HRESULT hr = S_OK; | |
| 364 | *phrStatus = results.hrStatus; | 336 | // BA_ONCACHEACQUIRECOMPLETE_ARGS args = { }; |
| 365 | 337 | // BA_ONCACHEACQUIRECOMPLETE_RESULTS results = { }; | |
| 366 | LExit: | 338 | // PIPE_RPC_RESULT result = { }; |
| 367 | return hr; | 339 | |
| 368 | } | 340 | // args.cbSize = sizeof(args); |
| 369 | 341 | // args.wzPackageOrContainerId = wzPackageOrContainerId; | |
| 370 | EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin( | 342 | // args.wzPayloadId = wzPayloadId; |
| 371 | __in BURN_USER_EXPERIENCE* pUserExperience, | 343 | // args.hrStatus = hrStatus; |
| 372 | __in LPCWSTR wzTransactionId | 344 | // args.recommendation = *pfRetry ? BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY : BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_NONE; |
| 373 | ) | 345 | |
| 374 | { | 346 | // results.cbSize = sizeof(results); |
| 375 | HRESULT hr = S_OK; | 347 | // results.action = args.recommendation; |
| 376 | BA_ONBEGINMSITRANSACTIONBEGIN_ARGS args = { }; | 348 | |
| 377 | BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS results = { }; | 349 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, args.cbSize, &result); |
| 378 | 350 | // ExitOnFailure(hr, "BA OnCacheAcquireComplete failed."); | |
| 379 | args.cbSize = sizeof(args); | 351 | |
| 380 | args.wzTransactionId = wzTransactionId; | 352 | // if (FAILED(hrStatus)) |
| 381 | 353 | // { | |
| 382 | results.cbSize = sizeof(results); | 354 | // *pfRetry = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY == results.action; |
| 383 | 355 | // } | |
| 384 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results); | 356 | |
| 385 | ExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed."); | 357 | // LExit: |
| 386 | 358 | // return hr; | |
| 387 | if (results.fCancel) | 359 | // } |
| 388 | { | 360 | |
| 389 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 361 | // EXTERN_C BAAPI UserExperienceOnCacheAcquireProgress( |
| 390 | } | 362 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 391 | 363 | // __in_z_opt LPCWSTR wzPackageOrContainerId, | |
| 392 | LExit: | 364 | // __in_z_opt LPCWSTR wzPayloadId, |
| 393 | return hr; | 365 | // __in DWORD64 dw64Progress, |
| 394 | } | 366 | // __in DWORD64 dw64Total, |
| 395 | 367 | // __in DWORD dwOverallPercentage | |
| 396 | EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionComplete( | 368 | // ) |
| 397 | __in BURN_USER_EXPERIENCE* pUserExperience, | 369 | // { |
| 398 | __in LPCWSTR wzTransactionId, | 370 | // HRESULT hr = S_OK; |
| 399 | __in HRESULT hrStatus | 371 | // BA_ONCACHEACQUIREPROGRESS_ARGS args = { }; |
| 400 | ) | 372 | // BA_ONCACHEACQUIREPROGRESS_RESULTS results = { }; |
| 401 | { | 373 | // PIPE_RPC_RESULT result = { }; |
| 402 | HRESULT hr = S_OK; | 374 | |
| 403 | BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS args = { }; | 375 | // args.cbSize = sizeof(args); |
| 404 | BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS results = { }; | 376 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 405 | 377 | // args.wzPayloadId = wzPayloadId; | |
| 406 | args.cbSize = sizeof(args); | 378 | // args.dw64Progress = dw64Progress; |
| 407 | args.wzTransactionId = wzTransactionId; | 379 | // args.dw64Total = dw64Total; |
| 408 | args.hrStatus = hrStatus; | 380 | // args.dwOverallPercentage = dwOverallPercentage; |
| 409 | 381 | ||
| 410 | results.cbSize = sizeof(results); | 382 | // results.cbSize = sizeof(results); |
| 411 | 383 | ||
| 412 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results); | 384 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, args.cbSize, &result); |
| 413 | ExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed."); | 385 | // ExitOnFailure(hr, "BA OnCacheAcquireProgress failed."); |
| 414 | 386 | ||
| 415 | LExit: | 387 | // if (results.fCancel) |
| 416 | return hr; | 388 | // { |
| 417 | } | 389 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 418 | 390 | // } | |
| 419 | EXTERN_C BAAPI UserExperienceOnCacheAcquireBegin( | 391 | |
| 420 | __in BURN_USER_EXPERIENCE* pUserExperience, | 392 | // LExit: |
| 421 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 393 | // return hr; |
| 422 | __in_z_opt LPCWSTR wzPayloadId, | 394 | // } |
| 423 | __in_z LPWSTR* pwzSource, | 395 | |
| 424 | __in_z LPWSTR* pwzDownloadUrl, | 396 | // EXTERN_C BAAPI UserExperienceOnCacheAcquireResolving( |
| 425 | __in_z_opt LPCWSTR wzPayloadContainerId, | 397 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 426 | __out BOOTSTRAPPER_CACHE_OPERATION* pCacheOperation | 398 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 427 | ) | 399 | // __in_z_opt LPCWSTR wzPayloadId, |
| 428 | { | 400 | // __in_z LPWSTR* rgSearchPaths, |
| 429 | HRESULT hr = S_OK; | 401 | // __in DWORD cSearchPaths, |
| 430 | BA_ONCACHEACQUIREBEGIN_ARGS args = { }; | 402 | // __in BOOL fFoundLocal, |
| 431 | BA_ONCACHEACQUIREBEGIN_RESULTS results = { }; | 403 | // __in DWORD* pdwChosenSearchPath, |
| 432 | *pCacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE; | 404 | // __in_z_opt LPWSTR* pwzDownloadUrl, |
| 433 | 405 | // __in_z_opt LPCWSTR wzPayloadContainerId, | |
| 434 | args.cbSize = sizeof(args); | 406 | // __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pCacheOperation |
| 435 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 407 | // ) |
| 436 | args.wzPayloadId = wzPayloadId; | 408 | // { |
| 437 | args.wzSource = *pwzSource; | 409 | // HRESULT hr = S_OK; |
| 438 | args.wzDownloadUrl = *pwzDownloadUrl; | 410 | // BA_ONCACHEACQUIRERESOLVING_ARGS args = { }; |
| 439 | args.wzPayloadContainerId = wzPayloadContainerId; | 411 | // BA_ONCACHEACQUIRERESOLVING_RESULTS results = { }; |
| 440 | args.recommendation = *pCacheOperation; | 412 | // PIPE_RPC_RESULT result = { }; |
| 441 | 413 | ||
| 442 | results.cbSize = sizeof(results); | 414 | // args.cbSize = sizeof(args); |
| 443 | results.action = *pCacheOperation; | 415 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 444 | 416 | // args.wzPayloadId = wzPayloadId; | |
| 445 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, &results); | 417 | // args.rgSearchPaths = const_cast<LPCWSTR*>(rgSearchPaths); |
| 446 | ExitOnFailure(hr, "BA OnCacheAcquireBegin failed."); | 418 | // args.cSearchPaths = cSearchPaths; |
| 447 | 419 | // args.fFoundLocal = fFoundLocal; | |
| 448 | if (results.fCancel) | 420 | // args.dwRecommendedSearchPath = *pdwChosenSearchPath; |
| 449 | { | 421 | // args.wzDownloadUrl = *pwzDownloadUrl; |
| 450 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 422 | // args.recommendation = *pCacheOperation; |
| 451 | } | 423 | |
| 452 | else | 424 | // results.cbSize = sizeof(results); |
| 453 | { | 425 | // results.dwChosenSearchPath = *pdwChosenSearchPath; |
| 454 | // Verify the BA requested an action that is possible. | 426 | // results.action = *pCacheOperation; |
| 455 | if (BOOTSTRAPPER_CACHE_OPERATION_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || | 427 | |
| 456 | BOOTSTRAPPER_CACHE_OPERATION_EXTRACT == results.action && wzPayloadContainerId || | 428 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, &args, args.cbSize, &result); |
| 457 | BOOTSTRAPPER_CACHE_OPERATION_COPY == results.action || | 429 | // ExitOnFailure(hr, "BA OnCacheAcquireResolving failed."); |
| 458 | BOOTSTRAPPER_CACHE_OPERATION_NONE == results.action) | 430 | |
| 459 | { | 431 | // if (results.fCancel) |
| 460 | *pCacheOperation = results.action; | 432 | // { |
| 461 | } | 433 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 462 | } | 434 | // } |
| 463 | 435 | // else | |
| 464 | LExit: | 436 | // { |
| 465 | return hr; | 437 | // // Verify the BA requested an action that is possible. |
| 466 | } | 438 | // if (BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || |
| 467 | 439 | // BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER == results.action && wzPayloadContainerId || | |
| 468 | EXTERN_C BAAPI UserExperienceOnCacheAcquireComplete( | 440 | // BOOTSTRAPPER_CACHE_RESOLVE_RETRY == results.action || |
| 469 | __in BURN_USER_EXPERIENCE* pUserExperience, | 441 | // BOOTSTRAPPER_CACHE_RESOLVE_NONE == results.action) |
| 470 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 442 | // { |
| 471 | __in_z_opt LPCWSTR wzPayloadId, | 443 | // *pCacheOperation = results.action; |
| 472 | __in HRESULT hrStatus, | 444 | // } |
| 473 | __inout BOOL* pfRetry | 445 | // else if (BOOTSTRAPPER_CACHE_RESOLVE_LOCAL == results.action && results.dwChosenSearchPath < cSearchPaths) |
| 474 | ) | 446 | // { |
| 475 | { | 447 | // *pdwChosenSearchPath = results.dwChosenSearchPath; |
| 476 | HRESULT hr = S_OK; | 448 | // *pCacheOperation = results.action; |
| 477 | BA_ONCACHEACQUIRECOMPLETE_ARGS args = { }; | 449 | // } |
| 478 | BA_ONCACHEACQUIRECOMPLETE_RESULTS results = { }; | 450 | // } |
| 479 | 451 | ||
| 480 | args.cbSize = sizeof(args); | 452 | // LExit: |
| 481 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 453 | // return hr; |
| 482 | args.wzPayloadId = wzPayloadId; | 454 | // } |
| 483 | args.hrStatus = hrStatus; | 455 | |
| 484 | args.recommendation = *pfRetry ? BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY : BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_NONE; | 456 | // EXTERN_C BAAPI UserExperienceOnCacheBegin( |
| 485 | 457 | // __in BURN_USER_EXPERIENCE* pUserExperience | |
| 486 | results.cbSize = sizeof(results); | 458 | // ) |
| 487 | results.action = args.recommendation; | 459 | // { |
| 488 | 460 | // HRESULT hr = S_OK; | |
| 489 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, &results); | 461 | // BA_ONCACHEBEGIN_ARGS args = { }; |
| 490 | ExitOnFailure(hr, "BA OnCacheAcquireComplete failed."); | 462 | // BA_ONCACHEBEGIN_RESULTS results = { }; |
| 491 | 463 | // PIPE_RPC_RESULT result = { }; | |
| 492 | if (FAILED(hrStatus)) | 464 | |
| 493 | { | 465 | // args.cbSize = sizeof(args); |
| 494 | *pfRetry = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY == results.action; | 466 | |
| 495 | } | 467 | // results.cbSize = sizeof(results); |
| 496 | 468 | ||
| 497 | LExit: | 469 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, args.cbSize, &result); |
| 498 | return hr; | 470 | // ExitOnFailure(hr, "BA OnCacheBegin failed."); |
| 499 | } | 471 | |
| 500 | 472 | // if (results.fCancel) | |
| 501 | EXTERN_C BAAPI UserExperienceOnCacheAcquireProgress( | 473 | // { |
| 502 | __in BURN_USER_EXPERIENCE* pUserExperience, | 474 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 503 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 475 | // } |
| 504 | __in_z_opt LPCWSTR wzPayloadId, | 476 | |
| 505 | __in DWORD64 dw64Progress, | 477 | // LExit: |
| 506 | __in DWORD64 dw64Total, | 478 | // return hr; |
| 507 | __in DWORD dwOverallPercentage | 479 | // } |
| 508 | ) | 480 | |
| 509 | { | 481 | // EXTERN_C BAAPI UserExperienceOnCacheComplete( |
| 510 | HRESULT hr = S_OK; | 482 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 511 | BA_ONCACHEACQUIREPROGRESS_ARGS args = { }; | 483 | // __in HRESULT hrStatus |
| 512 | BA_ONCACHEACQUIREPROGRESS_RESULTS results = { }; | 484 | // ) |
| 513 | 485 | // { | |
| 514 | args.cbSize = sizeof(args); | 486 | // HRESULT hr = S_OK; |
| 515 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 487 | // BA_ONCACHECOMPLETE_ARGS args = { }; |
| 516 | args.wzPayloadId = wzPayloadId; | 488 | // BA_ONCACHECOMPLETE_RESULTS results = { }; |
| 517 | args.dw64Progress = dw64Progress; | 489 | // PIPE_RPC_RESULT result = { }; |
| 518 | args.dw64Total = dw64Total; | 490 | |
| 519 | args.dwOverallPercentage = dwOverallPercentage; | 491 | // args.cbSize = sizeof(args); |
| 520 | 492 | // args.hrStatus = hrStatus; | |
| 521 | results.cbSize = sizeof(results); | 493 | |
| 522 | 494 | // results.cbSize = sizeof(results); | |
| 523 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, &results); | 495 | |
| 524 | ExitOnFailure(hr, "BA OnCacheAcquireProgress failed."); | 496 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, args.cbSize, &result); |
| 525 | 497 | // ExitOnFailure(hr, "BA OnCacheComplete failed."); | |
| 526 | if (results.fCancel) | 498 | |
| 527 | { | 499 | // LExit: |
| 528 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 500 | // return hr; |
| 529 | } | 501 | // } |
| 530 | 502 | ||
| 531 | LExit: | 503 | // EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyBegin( |
| 532 | return hr; | 504 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 533 | } | 505 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 534 | 506 | // __in_z_opt LPCWSTR wzPayloadId | |
| 535 | EXTERN_C BAAPI UserExperienceOnCacheAcquireResolving( | 507 | // ) |
| 536 | __in BURN_USER_EXPERIENCE* pUserExperience, | 508 | // { |
| 537 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 509 | // HRESULT hr = S_OK; |
| 538 | __in_z_opt LPCWSTR wzPayloadId, | 510 | // BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS args = { }; |
| 539 | __in_z LPWSTR* rgSearchPaths, | 511 | // BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS results = { }; |
| 540 | __in DWORD cSearchPaths, | 512 | // PIPE_RPC_RESULT result = { }; |
| 541 | __in BOOL fFoundLocal, | 513 | |
| 542 | __in DWORD* pdwChosenSearchPath, | 514 | // args.cbSize = sizeof(args); |
| 543 | __in_z_opt LPWSTR* pwzDownloadUrl, | 515 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 544 | __in_z_opt LPCWSTR wzPayloadContainerId, | 516 | // args.wzPayloadId = wzPayloadId; |
| 545 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pCacheOperation | 517 | |
| 546 | ) | 518 | // results.cbSize = sizeof(results); |
| 547 | { | 519 | |
| 548 | HRESULT hr = S_OK; | 520 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, &args, args.cbSize, &result); |
| 549 | BA_ONCACHEACQUIRERESOLVING_ARGS args = { }; | 521 | // ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyBegin failed."); |
| 550 | BA_ONCACHEACQUIRERESOLVING_RESULTS results = { }; | 522 | |
| 551 | 523 | // if (results.fCancel) | |
| 552 | args.cbSize = sizeof(args); | 524 | // { |
| 553 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 525 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 554 | args.wzPayloadId = wzPayloadId; | 526 | // } |
| 555 | args.rgSearchPaths = const_cast<LPCWSTR*>(rgSearchPaths); | 527 | |
| 556 | args.cSearchPaths = cSearchPaths; | 528 | // LExit: |
| 557 | args.fFoundLocal = fFoundLocal; | 529 | // return hr; |
| 558 | args.dwRecommendedSearchPath = *pdwChosenSearchPath; | 530 | // } |
| 559 | args.wzDownloadUrl = *pwzDownloadUrl; | 531 | |
| 560 | args.recommendation = *pCacheOperation; | 532 | // EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyComplete( |
| 561 | 533 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 562 | results.cbSize = sizeof(results); | 534 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 563 | results.dwChosenSearchPath = *pdwChosenSearchPath; | 535 | // __in_z_opt LPCWSTR wzPayloadId, |
| 564 | results.action = *pCacheOperation; | 536 | // __in HRESULT hrStatus |
| 565 | 537 | // ) | |
| 566 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, &args, &results); | 538 | // { |
| 567 | ExitOnFailure(hr, "BA OnCacheAcquireResolving failed."); | 539 | // HRESULT hr = S_OK; |
| 568 | 540 | // BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS args = { }; | |
| 569 | if (results.fCancel) | 541 | // BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS results = { }; |
| 570 | { | 542 | // PIPE_RPC_RESULT result = { }; |
| 571 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 543 | |
| 572 | } | 544 | // args.cbSize = sizeof(args); |
| 573 | else | 545 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 574 | { | 546 | // args.wzPayloadId = wzPayloadId; |
| 575 | // Verify the BA requested an action that is possible. | 547 | // args.hrStatus = hrStatus; |
| 576 | if (BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || | 548 | |
| 577 | BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER == results.action && wzPayloadContainerId || | 549 | // results.cbSize = sizeof(results); |
| 578 | BOOTSTRAPPER_CACHE_RESOLVE_RETRY == results.action || | 550 | |
| 579 | BOOTSTRAPPER_CACHE_RESOLVE_NONE == results.action) | 551 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, &args, args.cbSize, &result); |
| 580 | { | 552 | // ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyComplete failed."); |
| 581 | *pCacheOperation = results.action; | 553 | |
| 582 | } | 554 | // LExit: |
| 583 | else if (BOOTSTRAPPER_CACHE_RESOLVE_LOCAL == results.action && results.dwChosenSearchPath < cSearchPaths) | 555 | // return hr; |
| 584 | { | 556 | // } |
| 585 | *pdwChosenSearchPath = results.dwChosenSearchPath; | 557 | |
| 586 | *pCacheOperation = results.action; | 558 | // EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyProgress( |
| 587 | } | 559 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 588 | } | 560 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 589 | 561 | // __in_z_opt LPCWSTR wzPayloadId, | |
| 590 | LExit: | 562 | // __in DWORD64 dw64Progress, |
| 591 | return hr; | 563 | // __in DWORD64 dw64Total, |
| 592 | } | 564 | // __in DWORD dwOverallPercentage |
| 593 | 565 | // ) | |
| 594 | EXTERN_C BAAPI UserExperienceOnCacheBegin( | 566 | // { |
| 595 | __in BURN_USER_EXPERIENCE* pUserExperience | 567 | // HRESULT hr = S_OK; |
| 596 | ) | 568 | // BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS args = { }; |
| 597 | { | 569 | // BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS results = { }; |
| 598 | HRESULT hr = S_OK; | 570 | // PIPE_RPC_RESULT result = { }; |
| 599 | BA_ONCACHEBEGIN_ARGS args = { }; | 571 | |
| 600 | BA_ONCACHEBEGIN_RESULTS results = { }; | 572 | // args.cbSize = sizeof(args); |
| 601 | 573 | // args.wzPackageOrContainerId = wzPackageOrContainerId; | |
| 602 | args.cbSize = sizeof(args); | 574 | // args.wzPayloadId = wzPayloadId; |
| 603 | 575 | // args.dw64Progress = dw64Progress; | |
| 604 | results.cbSize = sizeof(results); | 576 | // args.dw64Total = dw64Total; |
| 605 | 577 | // args.dwOverallPercentage = dwOverallPercentage; | |
| 606 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, &results); | 578 | |
| 607 | ExitOnFailure(hr, "BA OnCacheBegin failed."); | 579 | // results.cbSize = sizeof(results); |
| 608 | 580 | ||
| 609 | if (results.fCancel) | 581 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, &args, args.cbSize, &result); |
| 610 | { | 582 | // ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyProgress failed."); |
| 611 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 583 | |
| 612 | } | 584 | // if (results.fCancel) |
| 613 | 585 | // { | |
| 614 | LExit: | 586 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 615 | return hr; | 587 | // } |
| 616 | } | 588 | |
| 617 | 589 | // LExit: | |
| 618 | EXTERN_C BAAPI UserExperienceOnCacheComplete( | 590 | // return hr; |
| 619 | __in BURN_USER_EXPERIENCE* pUserExperience, | 591 | // } |
| 620 | __in HRESULT hrStatus | 592 | |
| 621 | ) | 593 | // EXTERN_C BAAPI UserExperienceOnCachePackageBegin( |
| 622 | { | 594 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 623 | HRESULT hr = S_OK; | 595 | // __in_z LPCWSTR wzPackageId, |
| 624 | BA_ONCACHECOMPLETE_ARGS args = { }; | 596 | // __in DWORD cCachePayloads, |
| 625 | BA_ONCACHECOMPLETE_RESULTS results = { }; | 597 | // __in DWORD64 dw64PackageCacheSize, |
| 626 | 598 | // __in BOOL fVital | |
| 627 | args.cbSize = sizeof(args); | 599 | // ) |
| 628 | args.hrStatus = hrStatus; | 600 | // { |
| 629 | 601 | // HRESULT hr = S_OK; | |
| 630 | results.cbSize = sizeof(results); | 602 | // BA_ONCACHEPACKAGEBEGIN_ARGS args = { }; |
| 631 | 603 | // BA_ONCACHEPACKAGEBEGIN_RESULTS results = { }; | |
| 632 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, &results); | 604 | // PIPE_RPC_RESULT result = { }; |
| 633 | ExitOnFailure(hr, "BA OnCacheComplete failed."); | 605 | |
| 634 | 606 | // args.cbSize = sizeof(args); | |
| 635 | LExit: | 607 | // args.wzPackageId = wzPackageId; |
| 636 | return hr; | 608 | // args.cCachePayloads = cCachePayloads; |
| 637 | } | 609 | // args.dw64PackageCacheSize = dw64PackageCacheSize; |
| 638 | 610 | // args.fVital = fVital; | |
| 639 | EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyBegin( | 611 | |
| 640 | __in BURN_USER_EXPERIENCE* pUserExperience, | 612 | // results.cbSize = sizeof(results); |
| 641 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 613 | |
| 642 | __in_z_opt LPCWSTR wzPayloadId | 614 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, args.cbSize, &result); |
| 643 | ) | 615 | // ExitOnFailure(hr, "BA OnCachePackageBegin failed."); |
| 644 | { | 616 | |
| 645 | HRESULT hr = S_OK; | 617 | // if (results.fCancel) |
| 646 | BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS args = { }; | 618 | // { |
| 647 | BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS results = { }; | 619 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 648 | 620 | // } | |
| 649 | args.cbSize = sizeof(args); | 621 | |
| 650 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 622 | // LExit: |
| 651 | args.wzPayloadId = wzPayloadId; | 623 | // return hr; |
| 652 | 624 | // } | |
| 653 | results.cbSize = sizeof(results); | 625 | |
| 654 | 626 | // EXTERN_C BAAPI UserExperienceOnCachePackageComplete( | |
| 655 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, &args, &results); | 627 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 656 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyBegin failed."); | 628 | // __in_z LPCWSTR wzPackageId, |
| 657 | 629 | // __in HRESULT hrStatus, | |
| 658 | if (results.fCancel) | 630 | // __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction |
| 659 | { | 631 | // ) |
| 660 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 632 | // { |
| 661 | } | 633 | // HRESULT hr = S_OK; |
| 662 | 634 | // BA_ONCACHEPACKAGECOMPLETE_ARGS args = { }; | |
| 663 | LExit: | 635 | // BA_ONCACHEPACKAGECOMPLETE_RESULTS results = { }; |
| 664 | return hr; | 636 | // PIPE_RPC_RESULT result = { }; |
| 665 | } | 637 | |
| 666 | 638 | // args.cbSize = sizeof(args); | |
| 667 | EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyComplete( | 639 | // args.wzPackageId = wzPackageId; |
| 668 | __in BURN_USER_EXPERIENCE* pUserExperience, | 640 | // args.hrStatus = hrStatus; |
| 669 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 641 | // args.recommendation = *pAction; |
| 670 | __in_z_opt LPCWSTR wzPayloadId, | 642 | |
| 671 | __in HRESULT hrStatus | 643 | // results.cbSize = sizeof(results); |
| 672 | ) | 644 | // results.action = *pAction; |
| 673 | { | 645 | |
| 674 | HRESULT hr = S_OK; | 646 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, args.cbSize, &result); |
| 675 | BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS args = { }; | 647 | // ExitOnFailure(hr, "BA OnCachePackageComplete failed."); |
| 676 | BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS results = { }; | 648 | |
| 677 | 649 | // if (FAILED(hrStatus)) | |
| 678 | args.cbSize = sizeof(args); | 650 | // { |
| 679 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 651 | // *pAction = results.action; |
| 680 | args.wzPayloadId = wzPayloadId; | 652 | // } |
| 681 | args.hrStatus = hrStatus; | 653 | |
| 682 | 654 | // LExit: | |
| 683 | results.cbSize = sizeof(results); | 655 | // return hr; |
| 684 | 656 | // } | |
| 685 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, &args, &results); | 657 | |
| 686 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyComplete failed."); | 658 | // EXTERN_C BAAPI UserExperienceOnCachePackageNonVitalValidationFailure( |
| 687 | 659 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 688 | LExit: | 660 | // __in_z LPCWSTR wzPackageId, |
| 689 | return hr; | 661 | // __in HRESULT hrStatus, |
| 690 | } | 662 | // __inout BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION* pAction |
| 691 | 663 | // ) | |
| 692 | EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyProgress( | 664 | // { |
| 693 | __in BURN_USER_EXPERIENCE* pUserExperience, | 665 | // HRESULT hr = S_OK; |
| 694 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 666 | // BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS args = { }; |
| 695 | __in_z_opt LPCWSTR wzPayloadId, | 667 | // BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS results = { }; |
| 696 | __in DWORD64 dw64Progress, | 668 | // PIPE_RPC_RESULT result = { }; |
| 697 | __in DWORD64 dw64Total, | 669 | |
| 698 | __in DWORD dwOverallPercentage | 670 | // args.cbSize = sizeof(args); |
| 699 | ) | 671 | // args.wzPackageId = wzPackageId; |
| 700 | { | 672 | // args.hrStatus = hrStatus; |
| 701 | HRESULT hr = S_OK; | 673 | // args.recommendation = *pAction; |
| 702 | BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS args = { }; | 674 | |
| 703 | BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS results = { }; | 675 | // results.cbSize = sizeof(results); |
| 704 | 676 | // results.action = *pAction; | |
| 705 | args.cbSize = sizeof(args); | 677 | |
| 706 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 678 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, &args, args.cbSize, &result); |
| 707 | args.wzPayloadId = wzPayloadId; | 679 | // ExitOnFailure(hr, "BA OnCachePackageNonVitalValidationFailure failed."); |
| 708 | args.dw64Progress = dw64Progress; | 680 | |
| 709 | args.dw64Total = dw64Total; | 681 | // switch (results.action) |
| 710 | args.dwOverallPercentage = dwOverallPercentage; | 682 | // { |
| 711 | 683 | // case BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_NONE: __fallthrough; | |
| 712 | results.cbSize = sizeof(results); | 684 | // case BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_ACQUIRE: |
| 713 | 685 | // *pAction = results.action; | |
| 714 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, &args, &results); | 686 | // break; |
| 715 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyProgress failed."); | 687 | // } |
| 716 | 688 | ||
| 717 | if (results.fCancel) | 689 | // LExit: |
| 718 | { | 690 | // return hr; |
| 719 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 691 | // } |
| 720 | } | 692 | |
| 721 | 693 | // EXTERN_C BAAPI UserExperienceOnCachePayloadExtractBegin( | |
| 722 | LExit: | 694 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 723 | return hr; | 695 | // __in_z_opt LPCWSTR wzContainerId, |
| 724 | } | 696 | // __in_z_opt LPCWSTR wzPayloadId |
| 725 | 697 | // ) | |
| 726 | EXTERN_C BAAPI UserExperienceOnCachePackageBegin( | 698 | // { |
| 727 | __in BURN_USER_EXPERIENCE* pUserExperience, | 699 | // HRESULT hr = S_OK; |
| 728 | __in_z LPCWSTR wzPackageId, | 700 | // BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS args = { }; |
| 729 | __in DWORD cCachePayloads, | 701 | // BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS results = { }; |
| 730 | __in DWORD64 dw64PackageCacheSize, | 702 | // PIPE_RPC_RESULT result = { }; |
| 731 | __in BOOL fVital | 703 | |
| 732 | ) | 704 | // args.cbSize = sizeof(args); |
| 733 | { | 705 | // args.wzContainerId = wzContainerId; |
| 734 | HRESULT hr = S_OK; | 706 | // args.wzPayloadId = wzPayloadId; |
| 735 | BA_ONCACHEPACKAGEBEGIN_ARGS args = { }; | 707 | |
| 736 | BA_ONCACHEPACKAGEBEGIN_RESULTS results = { }; | 708 | // results.cbSize = sizeof(results); |
| 737 | 709 | ||
| 738 | args.cbSize = sizeof(args); | 710 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, &args, args.cbSize, &result); |
| 739 | args.wzPackageId = wzPackageId; | 711 | // ExitOnFailure(hr, "BA OnCachePayloadExtractBegin failed."); |
| 740 | args.cCachePayloads = cCachePayloads; | 712 | |
| 741 | args.dw64PackageCacheSize = dw64PackageCacheSize; | 713 | // if (results.fCancel) |
| 742 | args.fVital = fVital; | 714 | // { |
| 743 | 715 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 744 | results.cbSize = sizeof(results); | 716 | // } |
| 745 | 717 | ||
| 746 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, &results); | 718 | // LExit: |
| 747 | ExitOnFailure(hr, "BA OnCachePackageBegin failed."); | 719 | // return hr; |
| 748 | 720 | // } | |
| 749 | if (results.fCancel) | 721 | |
| 750 | { | 722 | // EXTERN_C BAAPI UserExperienceOnCachePayloadExtractComplete( |
| 751 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 723 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 752 | } | 724 | // __in_z_opt LPCWSTR wzContainerId, |
| 753 | 725 | // __in_z_opt LPCWSTR wzPayloadId, | |
| 754 | LExit: | 726 | // __in HRESULT hrStatus |
| 755 | return hr; | 727 | // ) |
| 756 | } | 728 | // { |
| 757 | 729 | // HRESULT hr = S_OK; | |
| 758 | EXTERN_C BAAPI UserExperienceOnCachePackageComplete( | 730 | // BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS args = { }; |
| 759 | __in BURN_USER_EXPERIENCE* pUserExperience, | 731 | // BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS results = { }; |
| 760 | __in_z LPCWSTR wzPackageId, | 732 | // PIPE_RPC_RESULT result = { }; |
| 761 | __in HRESULT hrStatus, | 733 | |
| 762 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction | 734 | // args.cbSize = sizeof(args); |
| 763 | ) | 735 | // args.wzContainerId = wzContainerId; |
| 764 | { | 736 | // args.wzPayloadId = wzPayloadId; |
| 765 | HRESULT hr = S_OK; | 737 | // args.hrStatus = hrStatus; |
| 766 | BA_ONCACHEPACKAGECOMPLETE_ARGS args = { }; | 738 | |
| 767 | BA_ONCACHEPACKAGECOMPLETE_RESULTS results = { }; | 739 | // results.cbSize = sizeof(results); |
| 768 | 740 | ||
| 769 | args.cbSize = sizeof(args); | 741 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, &args, args.cbSize, &result); |
| 770 | args.wzPackageId = wzPackageId; | 742 | // ExitOnFailure(hr, "BA OnCachePayloadExtractComplete failed."); |
| 771 | args.hrStatus = hrStatus; | 743 | |
| 772 | args.recommendation = *pAction; | 744 | // LExit: |
| 773 | 745 | // return hr; | |
| 774 | results.cbSize = sizeof(results); | 746 | // } |
| 775 | results.action = *pAction; | 747 | |
| 776 | 748 | // EXTERN_C BAAPI UserExperienceOnCachePayloadExtractProgress( | |
| 777 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, &results); | 749 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 778 | ExitOnFailure(hr, "BA OnCachePackageComplete failed."); | 750 | // __in_z_opt LPCWSTR wzContainerId, |
| 779 | 751 | // __in_z_opt LPCWSTR wzPayloadId, | |
| 780 | if (FAILED(hrStatus)) | 752 | // __in DWORD64 dw64Progress, |
| 781 | { | 753 | // __in DWORD64 dw64Total, |
| 782 | *pAction = results.action; | 754 | // __in DWORD dwOverallPercentage |
| 783 | } | 755 | // ) |
| 784 | 756 | // { | |
| 785 | LExit: | 757 | // HRESULT hr = S_OK; |
| 786 | return hr; | 758 | // BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS args = { }; |
| 787 | } | 759 | // BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS results = { }; |
| 788 | 760 | // PIPE_RPC_RESULT result = { }; | |
| 789 | EXTERN_C BAAPI UserExperienceOnCachePackageNonVitalValidationFailure( | 761 | |
| 790 | __in BURN_USER_EXPERIENCE* pUserExperience, | 762 | // args.cbSize = sizeof(args); |
| 791 | __in_z LPCWSTR wzPackageId, | 763 | // args.wzContainerId = wzContainerId; |
| 792 | __in HRESULT hrStatus, | 764 | // args.wzPayloadId = wzPayloadId; |
| 793 | __inout BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION* pAction | 765 | // args.dw64Progress = dw64Progress; |
| 794 | ) | 766 | // args.dw64Total = dw64Total; |
| 795 | { | 767 | // args.dwOverallPercentage = dwOverallPercentage; |
| 796 | HRESULT hr = S_OK; | 768 | |
| 797 | BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS args = { }; | 769 | // results.cbSize = sizeof(results); |
| 798 | BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS results = { }; | 770 | |
| 799 | 771 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, &args, args.cbSize, &result); | |
| 800 | args.cbSize = sizeof(args); | 772 | // ExitOnFailure(hr, "BA OnCachePayloadExtractProgress failed."); |
| 801 | args.wzPackageId = wzPackageId; | 773 | |
| 802 | args.hrStatus = hrStatus; | 774 | // if (results.fCancel) |
| 803 | args.recommendation = *pAction; | 775 | // { |
| 804 | 776 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 805 | results.cbSize = sizeof(results); | 777 | // } |
| 806 | results.action = *pAction; | 778 | |
| 807 | 779 | // LExit: | |
| 808 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, &args, &results); | 780 | // return hr; |
| 809 | ExitOnFailure(hr, "BA OnCachePackageNonVitalValidationFailure failed."); | 781 | // } |
| 810 | 782 | ||
| 811 | switch (results.action) | 783 | // EXTERN_C BAAPI UserExperienceOnCacheVerifyBegin( |
| 812 | { | 784 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 813 | case BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_NONE: __fallthrough; | 785 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 814 | case BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION_ACQUIRE: | 786 | // __in_z_opt LPCWSTR wzPayloadId |
| 815 | *pAction = results.action; | 787 | // ) |
| 816 | break; | 788 | // { |
| 817 | } | 789 | // HRESULT hr = S_OK; |
| 818 | 790 | // BA_ONCACHEVERIFYBEGIN_ARGS args = { }; | |
| 819 | LExit: | 791 | // BA_ONCACHEVERIFYBEGIN_RESULTS results = { }; |
| 820 | return hr; | 792 | // PIPE_RPC_RESULT result = { }; |
| 821 | } | 793 | |
| 822 | 794 | // args.cbSize = sizeof(args); | |
| 823 | EXTERN_C BAAPI UserExperienceOnCachePayloadExtractBegin( | 795 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 824 | __in BURN_USER_EXPERIENCE* pUserExperience, | 796 | // args.wzPayloadId = wzPayloadId; |
| 825 | __in_z_opt LPCWSTR wzContainerId, | 797 | |
| 826 | __in_z_opt LPCWSTR wzPayloadId | 798 | // results.cbSize = sizeof(results); |
| 827 | ) | 799 | |
| 828 | { | 800 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, args.cbSize, &result); |
| 829 | HRESULT hr = S_OK; | 801 | // ExitOnFailure(hr, "BA OnCacheVerifyBegin failed."); |
| 830 | BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS args = { }; | 802 | |
| 831 | BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS results = { }; | 803 | // if (results.fCancel) |
| 832 | 804 | // { | |
| 833 | args.cbSize = sizeof(args); | 805 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 834 | args.wzContainerId = wzContainerId; | 806 | // } |
| 835 | args.wzPayloadId = wzPayloadId; | 807 | |
| 836 | 808 | // LExit: | |
| 837 | results.cbSize = sizeof(results); | 809 | // return hr; |
| 838 | 810 | // } | |
| 839 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, &args, &results); | 811 | |
| 840 | ExitOnFailure(hr, "BA OnCachePayloadExtractBegin failed."); | 812 | // EXTERN_C BAAPI UserExperienceOnCacheVerifyComplete( |
| 841 | 813 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 842 | if (results.fCancel) | 814 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 843 | { | 815 | // __in_z_opt LPCWSTR wzPayloadId, |
| 844 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 816 | // __in HRESULT hrStatus, |
| 845 | } | 817 | // __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction |
| 846 | 818 | // ) | |
| 847 | LExit: | 819 | // { |
| 848 | return hr; | 820 | // HRESULT hr = S_OK; |
| 849 | } | 821 | // BA_ONCACHEVERIFYCOMPLETE_ARGS args = { }; |
| 850 | 822 | // BA_ONCACHEVERIFYCOMPLETE_RESULTS results = { }; | |
| 851 | EXTERN_C BAAPI UserExperienceOnCachePayloadExtractComplete( | 823 | // PIPE_RPC_RESULT result = { }; |
| 852 | __in BURN_USER_EXPERIENCE* pUserExperience, | 824 | |
| 853 | __in_z_opt LPCWSTR wzContainerId, | 825 | // args.cbSize = sizeof(args); |
| 854 | __in_z_opt LPCWSTR wzPayloadId, | 826 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 855 | __in HRESULT hrStatus | 827 | // args.wzPayloadId = wzPayloadId; |
| 856 | ) | 828 | // args.hrStatus = hrStatus; |
| 857 | { | 829 | // args.recommendation = *pAction; |
| 858 | HRESULT hr = S_OK; | 830 | |
| 859 | BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS args = { }; | 831 | // results.cbSize = sizeof(results); |
| 860 | BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS results = { }; | 832 | // results.action = *pAction; |
| 861 | 833 | ||
| 862 | args.cbSize = sizeof(args); | 834 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, args.cbSize, &result); |
| 863 | args.wzContainerId = wzContainerId; | 835 | // ExitOnFailure(hr, "BA OnCacheVerifyComplete failed."); |
| 864 | args.wzPayloadId = wzPayloadId; | 836 | |
| 865 | args.hrStatus = hrStatus; | 837 | // if (FAILED(hrStatus)) |
| 866 | 838 | // { | |
| 867 | results.cbSize = sizeof(results); | 839 | // *pAction = results.action; |
| 868 | 840 | // } | |
| 869 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, &args, &results); | 841 | |
| 870 | ExitOnFailure(hr, "BA OnCachePayloadExtractComplete failed."); | 842 | // LExit: |
| 871 | 843 | // return hr; | |
| 872 | LExit: | 844 | // } |
| 873 | return hr; | 845 | |
| 874 | } | 846 | // EXTERN_C BAAPI UserExperienceOnCacheVerifyProgress( |
| 875 | 847 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 876 | EXTERN_C BAAPI UserExperienceOnCachePayloadExtractProgress( | 848 | // __in_z_opt LPCWSTR wzPackageOrContainerId, |
| 877 | __in BURN_USER_EXPERIENCE* pUserExperience, | 849 | // __in_z_opt LPCWSTR wzPayloadId, |
| 878 | __in_z_opt LPCWSTR wzContainerId, | 850 | // __in DWORD64 dw64Progress, |
| 879 | __in_z_opt LPCWSTR wzPayloadId, | 851 | // __in DWORD64 dw64Total, |
| 880 | __in DWORD64 dw64Progress, | 852 | // __in DWORD dwOverallPercentage, |
| 881 | __in DWORD64 dw64Total, | 853 | // __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep |
| 882 | __in DWORD dwOverallPercentage | 854 | // ) |
| 883 | ) | 855 | // { |
| 884 | { | 856 | // HRESULT hr = S_OK; |
| 885 | HRESULT hr = S_OK; | 857 | // BA_ONCACHEVERIFYPROGRESS_ARGS args = { }; |
| 886 | BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS args = { }; | 858 | // BA_ONCACHEVERIFYPROGRESS_RESULTS results = { }; |
| 887 | BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS results = { }; | 859 | // PIPE_RPC_RESULT result = { }; |
| 888 | 860 | ||
| 889 | args.cbSize = sizeof(args); | 861 | // args.cbSize = sizeof(args); |
| 890 | args.wzContainerId = wzContainerId; | 862 | // args.wzPackageOrContainerId = wzPackageOrContainerId; |
| 891 | args.wzPayloadId = wzPayloadId; | 863 | // args.wzPayloadId = wzPayloadId; |
| 892 | args.dw64Progress = dw64Progress; | 864 | // args.dw64Progress = dw64Progress; |
| 893 | args.dw64Total = dw64Total; | 865 | // args.dw64Total = dw64Total; |
| 894 | args.dwOverallPercentage = dwOverallPercentage; | 866 | // args.dwOverallPercentage = dwOverallPercentage; |
| 895 | 867 | // args.verifyStep = verifyStep; | |
| 896 | results.cbSize = sizeof(results); | 868 | |
| 897 | 869 | // results.cbSize = sizeof(results); | |
| 898 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, &args, &results); | 870 | |
| 899 | ExitOnFailure(hr, "BA OnCachePayloadExtractProgress failed."); | 871 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, &args, args.cbSize, &result); |
| 900 | 872 | // ExitOnFailure(hr, "BA OnCacheVerifyProgress failed."); | |
| 901 | if (results.fCancel) | 873 | |
| 902 | { | 874 | // if (results.fCancel) |
| 903 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 875 | // { |
| 904 | } | 876 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 905 | 877 | // } | |
| 906 | LExit: | 878 | |
| 907 | return hr; | 879 | // LExit: |
| 908 | } | 880 | // return hr; |
| 909 | 881 | // } | |
| 910 | EXTERN_C BAAPI UserExperienceOnCacheVerifyBegin( | 882 | |
| 911 | __in BURN_USER_EXPERIENCE* pUserExperience, | 883 | // EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionBegin( |
| 912 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 884 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 913 | __in_z_opt LPCWSTR wzPayloadId | 885 | // __in LPCWSTR wzTransactionId |
| 914 | ) | 886 | // ) |
| 915 | { | 887 | // { |
| 916 | HRESULT hr = S_OK; | 888 | // HRESULT hr = S_OK; |
| 917 | BA_ONCACHEVERIFYBEGIN_ARGS args = { }; | 889 | // BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS args = { }; |
| 918 | BA_ONCACHEVERIFYBEGIN_RESULTS results = { }; | 890 | // BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS results = { }; |
| 919 | 891 | // PIPE_RPC_RESULT result = { }; | |
| 920 | args.cbSize = sizeof(args); | 892 | |
| 921 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 893 | // args.cbSize = sizeof(args); |
| 922 | args.wzPayloadId = wzPayloadId; | 894 | // args.wzTransactionId = wzTransactionId; |
| 923 | 895 | ||
| 924 | results.cbSize = sizeof(results); | 896 | // results.cbSize = sizeof(results); |
| 925 | 897 | ||
| 926 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, &results); | 898 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, args.cbSize, &result); |
| 927 | ExitOnFailure(hr, "BA OnCacheVerifyBegin failed."); | 899 | // ExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed."); |
| 928 | 900 | ||
| 929 | if (results.fCancel) | 901 | // if (results.fCancel) |
| 930 | { | 902 | // { |
| 931 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 903 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 932 | } | 904 | // } |
| 933 | 905 | ||
| 934 | LExit: | 906 | // LExit: |
| 935 | return hr; | 907 | // return hr; |
| 936 | } | 908 | // } |
| 937 | 909 | ||
| 938 | EXTERN_C BAAPI UserExperienceOnCacheVerifyComplete( | 910 | // EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionComplete( |
| 939 | __in BURN_USER_EXPERIENCE* pUserExperience, | 911 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 940 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 912 | // __in LPCWSTR wzTransactionId, |
| 941 | __in_z_opt LPCWSTR wzPayloadId, | 913 | // __in HRESULT hrStatus, |
| 942 | __in HRESULT hrStatus, | 914 | // __in BOOTSTRAPPER_APPLY_RESTART restart, |
| 943 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction | 915 | // __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION* pAction |
| 944 | ) | 916 | // ) |
| 945 | { | 917 | // { |
| 946 | HRESULT hr = S_OK; | 918 | // HRESULT hr = S_OK; |
| 947 | BA_ONCACHEVERIFYCOMPLETE_ARGS args = { }; | 919 | // BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS args = { }; |
| 948 | BA_ONCACHEVERIFYCOMPLETE_RESULTS results = { }; | 920 | // BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS results = { }; |
| 949 | 921 | // PIPE_RPC_RESULT result = { }; | |
| 950 | args.cbSize = sizeof(args); | 922 | |
| 951 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 923 | // args.cbSize = sizeof(args); |
| 952 | args.wzPayloadId = wzPayloadId; | 924 | // args.wzTransactionId = wzTransactionId; |
| 953 | args.hrStatus = hrStatus; | 925 | // args.hrStatus = hrStatus; |
| 954 | args.recommendation = *pAction; | 926 | // args.restart = restart; |
| 955 | 927 | // args.recommendation = *pAction; | |
| 956 | results.cbSize = sizeof(results); | 928 | |
| 957 | results.action = *pAction; | 929 | // results.cbSize = sizeof(results); |
| 958 | 930 | // results.action = *pAction; | |
| 959 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, &results); | 931 | |
| 960 | ExitOnFailure(hr, "BA OnCacheVerifyComplete failed."); | 932 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, args.cbSize, &result); |
| 961 | 933 | // ExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed."); | |
| 962 | if (FAILED(hrStatus)) | 934 | |
| 963 | { | 935 | // *pAction = results.action; |
| 964 | *pAction = results.action; | 936 | |
| 965 | } | 937 | // LExit: |
| 966 | 938 | // return hr; | |
| 967 | LExit: | 939 | // } |
| 968 | return hr; | 940 | |
| 969 | } | 941 | // EXTERN_C BAAPI UserExperienceOnDetectBegin( |
| 970 | 942 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 971 | EXTERN_C BAAPI UserExperienceOnCacheVerifyProgress( | 943 | // __in BOOL fCached, |
| 972 | __in BURN_USER_EXPERIENCE* pUserExperience, | 944 | // __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, |
| 973 | __in_z_opt LPCWSTR wzPackageOrContainerId, | 945 | // __in DWORD cPackages |
| 974 | __in_z_opt LPCWSTR wzPayloadId, | 946 | // ) |
| 975 | __in DWORD64 dw64Progress, | 947 | // { |
| 976 | __in DWORD64 dw64Total, | 948 | // HRESULT hr = S_OK; |
| 977 | __in DWORD dwOverallPercentage, | 949 | // BA_ONDETECTBEGIN_ARGS args = { }; |
| 978 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep | 950 | // BA_ONDETECTBEGIN_RESULTS results = { }; |
| 979 | ) | 951 | // PIPE_RPC_RESULT result = { }; |
| 980 | { | 952 | |
| 981 | HRESULT hr = S_OK; | 953 | // args.cbSize = sizeof(args); |
| 982 | BA_ONCACHEVERIFYPROGRESS_ARGS args = { }; | 954 | // args.cPackages = cPackages; |
| 983 | BA_ONCACHEVERIFYPROGRESS_RESULTS results = { }; | 955 | // args.registrationType = registrationType; |
| 984 | 956 | // args.fCached = fCached; | |
| 985 | args.cbSize = sizeof(args); | 957 | |
| 986 | args.wzPackageOrContainerId = wzPackageOrContainerId; | 958 | // results.cbSize = sizeof(results); |
| 987 | args.wzPayloadId = wzPayloadId; | 959 | |
| 988 | args.dw64Progress = dw64Progress; | 960 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, args.cbSize, &result); |
| 989 | args.dw64Total = dw64Total; | 961 | // ExitOnFailure(hr, "BA OnDetectBegin failed."); |
| 990 | args.dwOverallPercentage = dwOverallPercentage; | 962 | |
| 991 | args.verifyStep = verifyStep; | 963 | // if (results.fCancel) |
| 992 | 964 | // { | |
| 993 | results.cbSize = sizeof(results); | 965 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 994 | 966 | // } | |
| 995 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, &args, &results); | 967 | |
| 996 | ExitOnFailure(hr, "BA OnCacheVerifyProgress failed."); | 968 | // LExit: |
| 997 | 969 | // return hr; | |
| 998 | if (results.fCancel) | 970 | // } |
| 999 | { | 971 | |
| 1000 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 972 | // EXTERN_C BAAPI UserExperienceOnDetectCompatibleMsiPackage( |
| 1001 | } | 973 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1002 | 974 | // __in_z LPCWSTR wzPackageId, | |
| 1003 | LExit: | 975 | // __in_z LPCWSTR wzCompatiblePackageId, |
| 1004 | return hr; | 976 | // __in VERUTIL_VERSION* pCompatiblePackageVersion |
| 1005 | } | 977 | // ) |
| 1006 | 978 | // { | |
| 1007 | EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionBegin( | 979 | // HRESULT hr = S_OK; |
| 1008 | __in BURN_USER_EXPERIENCE* pUserExperience, | 980 | // BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS args = { }; |
| 1009 | __in LPCWSTR wzTransactionId | 981 | // BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS results = { }; |
| 1010 | ) | 982 | // PIPE_RPC_RESULT result = { }; |
| 1011 | { | 983 | |
| 1012 | HRESULT hr = S_OK; | 984 | // args.cbSize = sizeof(args); |
| 1013 | BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS args = { }; | 985 | // args.wzPackageId = wzPackageId; |
| 1014 | BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS results = { }; | 986 | // args.wzCompatiblePackageId = wzCompatiblePackageId; |
| 1015 | 987 | // args.wzCompatiblePackageVersion = pCompatiblePackageVersion->sczVersion; | |
| 1016 | args.cbSize = sizeof(args); | 988 | |
| 1017 | args.wzTransactionId = wzTransactionId; | 989 | // results.cbSize = sizeof(results); |
| 1018 | 990 | ||
| 1019 | results.cbSize = sizeof(results); | 991 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &args, args.cbSize, &result); |
| 1020 | 992 | // ExitOnFailure(hr, "BA OnDetectCompatibleMsiPackage failed."); | |
| 1021 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results); | 993 | |
| 1022 | ExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed."); | 994 | // if (results.fCancel) |
| 1023 | 995 | // { | |
| 1024 | if (results.fCancel) | 996 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1025 | { | 997 | // } |
| 1026 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 998 | |
| 1027 | } | 999 | // LExit: |
| 1028 | 1000 | // return hr; | |
| 1029 | LExit: | 1001 | // } |
| 1030 | return hr; | 1002 | |
| 1031 | } | 1003 | // EXTERN_C BAAPI UserExperienceOnDetectComplete( |
| 1032 | 1004 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1033 | EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionComplete( | 1005 | // __in HRESULT hrStatus, |
| 1034 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1006 | // __in BOOL fEligibleForCleanup |
| 1035 | __in LPCWSTR wzTransactionId, | 1007 | // ) |
| 1036 | __in HRESULT hrStatus, | 1008 | // { |
| 1037 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 1009 | // HRESULT hr = S_OK; |
| 1038 | __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION* pAction | 1010 | // BA_ONDETECTCOMPLETE_ARGS args = { }; |
| 1039 | ) | 1011 | // BA_ONDETECTCOMPLETE_RESULTS results = { }; |
| 1040 | { | 1012 | // PIPE_RPC_RESULT result = { }; |
| 1041 | HRESULT hr = S_OK; | 1013 | |
| 1042 | BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS args = { }; | 1014 | // args.cbSize = sizeof(args); |
| 1043 | BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS results = { }; | 1015 | // args.hrStatus = hrStatus; |
| 1044 | 1016 | // args.fEligibleForCleanup = fEligibleForCleanup; | |
| 1045 | args.cbSize = sizeof(args); | 1017 | |
| 1046 | args.wzTransactionId = wzTransactionId; | 1018 | // results.cbSize = sizeof(results); |
| 1047 | args.hrStatus = hrStatus; | 1019 | |
| 1048 | args.restart = restart; | 1020 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, args.cbSize, &result); |
| 1049 | args.recommendation = *pAction; | 1021 | // ExitOnFailure(hr, "BA OnDetectComplete failed."); |
| 1050 | 1022 | ||
| 1051 | results.cbSize = sizeof(results); | 1023 | // LExit: |
| 1052 | results.action = *pAction; | 1024 | // return hr; |
| 1053 | 1025 | // } | |
| 1054 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results); | 1026 | |
| 1055 | ExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed."); | 1027 | // EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle( |
| 1056 | 1028 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1057 | *pAction = results.action; | 1029 | // __in_z LPCWSTR wzBundleId, |
| 1058 | 1030 | // __in BOOTSTRAPPER_RELATION_TYPE relationType, | |
| 1059 | LExit: | 1031 | // __in_z LPCWSTR wzBundleTag, |
| 1060 | return hr; | 1032 | // __in BOOL fPerMachine, |
| 1061 | } | 1033 | // __in VERUTIL_VERSION* pVersion, |
| 1062 | 1034 | // __in BOOL fMissingFromCache | |
| 1063 | EXTERN_C BAAPI UserExperienceOnDetectBegin( | 1035 | // ) |
| 1064 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1036 | // { |
| 1065 | __in BOOL fCached, | 1037 | // HRESULT hr = S_OK; |
| 1066 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, | 1038 | // BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; |
| 1067 | __in DWORD cPackages | 1039 | // BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; |
| 1068 | ) | 1040 | // PIPE_RPC_RESULT result = { }; |
| 1069 | { | 1041 | |
| 1070 | HRESULT hr = S_OK; | 1042 | // args.cbSize = sizeof(args); |
| 1071 | BA_ONDETECTBEGIN_ARGS args = { }; | 1043 | // args.wzBundleId = wzBundleId; |
| 1072 | BA_ONDETECTBEGIN_RESULTS results = { }; | 1044 | // args.relationType = relationType; |
| 1073 | 1045 | // args.wzBundleTag = wzBundleTag; | |
| 1074 | args.cbSize = sizeof(args); | 1046 | // args.fPerMachine = fPerMachine; |
| 1075 | args.cPackages = cPackages; | 1047 | // args.wzVersion = pVersion->sczVersion; |
| 1076 | args.registrationType = registrationType; | 1048 | // args.fMissingFromCache = fMissingFromCache; |
| 1077 | args.fCached = fCached; | 1049 | |
| 1078 | 1050 | // results.cbSize = sizeof(results); | |
| 1079 | results.cbSize = sizeof(results); | 1051 | |
| 1080 | 1052 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, args.cbSize, &result); | |
| 1081 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, &results); | 1053 | // ExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed."); |
| 1082 | ExitOnFailure(hr, "BA OnDetectBegin failed."); | 1054 | |
| 1083 | 1055 | // if (results.fCancel) | |
| 1084 | if (results.fCancel) | 1056 | // { |
| 1085 | { | 1057 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1086 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1058 | // } |
| 1087 | } | 1059 | |
| 1088 | 1060 | // LExit: | |
| 1089 | LExit: | 1061 | // return hr; |
| 1090 | return hr; | 1062 | // } |
| 1091 | } | 1063 | |
| 1092 | 1064 | // EXTERN_C BAAPI UserExperienceOnDetectMsiFeature( | |
| 1093 | EXTERN_C BAAPI UserExperienceOnDetectCompatibleMsiPackage( | 1065 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1094 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1066 | // __in_z LPCWSTR wzPackageId, |
| 1095 | __in_z LPCWSTR wzPackageId, | 1067 | // __in_z LPCWSTR wzFeatureId, |
| 1096 | __in_z LPCWSTR wzCompatiblePackageId, | 1068 | // __in BOOTSTRAPPER_FEATURE_STATE state |
| 1097 | __in VERUTIL_VERSION* pCompatiblePackageVersion | 1069 | // ) |
| 1098 | ) | 1070 | // { |
| 1099 | { | 1071 | // HRESULT hr = S_OK; |
| 1100 | HRESULT hr = S_OK; | 1072 | // BA_ONDETECTMSIFEATURE_ARGS args = { }; |
| 1101 | BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS args = { }; | 1073 | // BA_ONDETECTMSIFEATURE_RESULTS results = { }; |
| 1102 | BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS results = { }; | 1074 | // PIPE_RPC_RESULT result = { }; |
| 1103 | 1075 | ||
| 1104 | args.cbSize = sizeof(args); | 1076 | // args.cbSize = sizeof(args); |
| 1105 | args.wzPackageId = wzPackageId; | 1077 | // args.wzPackageId = wzPackageId; |
| 1106 | args.wzCompatiblePackageId = wzCompatiblePackageId; | 1078 | // args.wzFeatureId = wzFeatureId; |
| 1107 | args.wzCompatiblePackageVersion = pCompatiblePackageVersion->sczVersion; | 1079 | // args.state = state; |
| 1108 | 1080 | ||
| 1109 | results.cbSize = sizeof(results); | 1081 | // results.cbSize = sizeof(results); |
| 1110 | 1082 | ||
| 1111 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &args, &results); | 1083 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, args.cbSize, &result); |
| 1112 | ExitOnFailure(hr, "BA OnDetectCompatibleMsiPackage failed."); | 1084 | // ExitOnFailure(hr, "BA OnDetectMsiFeature failed."); |
| 1113 | 1085 | ||
| 1114 | if (results.fCancel) | 1086 | // if (results.fCancel) |
| 1115 | { | 1087 | // { |
| 1116 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1088 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1117 | } | 1089 | // } |
| 1118 | 1090 | ||
| 1119 | LExit: | 1091 | // LExit: |
| 1120 | return hr; | 1092 | // return hr; |
| 1121 | } | 1093 | // } |
| 1122 | 1094 | ||
| 1123 | EXTERN_C BAAPI UserExperienceOnDetectComplete( | 1095 | // EXTERN_C BAAPI UserExperienceOnDetectPackageBegin( |
| 1124 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1096 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1125 | __in HRESULT hrStatus, | 1097 | // __in_z LPCWSTR wzPackageId |
| 1126 | __in BOOL fEligibleForCleanup | 1098 | // ) |
| 1127 | ) | 1099 | // { |
| 1128 | { | 1100 | // HRESULT hr = S_OK; |
| 1129 | HRESULT hr = S_OK; | 1101 | // BA_ONDETECTPACKAGEBEGIN_ARGS args = { }; |
| 1130 | BA_ONDETECTCOMPLETE_ARGS args = { }; | 1102 | // BA_ONDETECTPACKAGEBEGIN_RESULTS results = { }; |
| 1131 | BA_ONDETECTCOMPLETE_RESULTS results = { }; | 1103 | // PIPE_RPC_RESULT result = { }; |
| 1132 | 1104 | ||
| 1133 | args.cbSize = sizeof(args); | 1105 | // args.cbSize = sizeof(args); |
| 1134 | args.hrStatus = hrStatus; | 1106 | // args.wzPackageId = wzPackageId; |
| 1135 | args.fEligibleForCleanup = fEligibleForCleanup; | 1107 | |
| 1136 | 1108 | // results.cbSize = sizeof(results); | |
| 1137 | results.cbSize = sizeof(results); | 1109 | |
| 1138 | 1110 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, args.cbSize, &result); | |
| 1139 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, &results); | 1111 | // ExitOnFailure(hr, "BA OnDetectPackageBegin failed."); |
| 1140 | ExitOnFailure(hr, "BA OnDetectComplete failed."); | 1112 | |
| 1141 | 1113 | // if (results.fCancel) | |
| 1142 | LExit: | 1114 | // { |
| 1143 | return hr; | 1115 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1144 | } | 1116 | // } |
| 1145 | 1117 | ||
| 1146 | EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle( | 1118 | // LExit: |
| 1147 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1119 | // return hr; |
| 1148 | __in_z LPCWSTR wzBundleId, | 1120 | // } |
| 1149 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 1121 | |
| 1150 | __in_z LPCWSTR wzBundleTag, | 1122 | // EXTERN_C BAAPI UserExperienceOnDetectPackageComplete( |
| 1151 | __in BOOL fPerMachine, | 1123 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1152 | __in VERUTIL_VERSION* pVersion, | 1124 | // __in_z LPCWSTR wzPackageId, |
| 1153 | __in BOOL fMissingFromCache | 1125 | // __in HRESULT hrStatus, |
| 1154 | ) | 1126 | // __in BOOTSTRAPPER_PACKAGE_STATE state, |
| 1155 | { | 1127 | // __in BOOL fCached |
| 1156 | HRESULT hr = S_OK; | 1128 | // ) |
| 1157 | BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; | 1129 | // { |
| 1158 | BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; | 1130 | // HRESULT hr = S_OK; |
| 1159 | 1131 | // BA_ONDETECTPACKAGECOMPLETE_ARGS args = { }; | |
| 1160 | args.cbSize = sizeof(args); | 1132 | // BA_ONDETECTPACKAGECOMPLETE_RESULTS results = { }; |
| 1161 | args.wzBundleId = wzBundleId; | 1133 | // PIPE_RPC_RESULT result = { }; |
| 1162 | args.relationType = relationType; | 1134 | |
| 1163 | args.wzBundleTag = wzBundleTag; | 1135 | // args.cbSize = sizeof(args); |
| 1164 | args.fPerMachine = fPerMachine; | 1136 | // args.wzPackageId = wzPackageId; |
| 1165 | args.wzVersion = pVersion->sczVersion; | 1137 | // args.hrStatus = hrStatus; |
| 1166 | args.fMissingFromCache = fMissingFromCache; | 1138 | // args.state = state; |
| 1167 | 1139 | // args.fCached = fCached; | |
| 1168 | results.cbSize = sizeof(results); | 1140 | |
| 1169 | 1141 | // results.cbSize = sizeof(results); | |
| 1170 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results); | 1142 | |
| 1171 | ExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed."); | 1143 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, args.cbSize, &result); |
| 1172 | 1144 | // ExitOnFailure(hr, "BA OnDetectPackageComplete failed."); | |
| 1173 | if (results.fCancel) | 1145 | |
| 1174 | { | 1146 | // LExit: |
| 1175 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1147 | // return hr; |
| 1176 | } | 1148 | // } |
| 1177 | 1149 | ||
| 1178 | LExit: | 1150 | // EXTERN_C BAAPI UserExperienceOnDetectRelatedBundle( |
| 1179 | return hr; | 1151 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1180 | } | 1152 | // __in_z LPCWSTR wzBundleId, |
| 1181 | 1153 | // __in BOOTSTRAPPER_RELATION_TYPE relationType, | |
| 1182 | EXTERN_C BAAPI UserExperienceOnDetectMsiFeature( | 1154 | // __in_z LPCWSTR wzBundleTag, |
| 1183 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1155 | // __in BOOL fPerMachine, |
| 1184 | __in_z LPCWSTR wzPackageId, | 1156 | // __in VERUTIL_VERSION* pVersion, |
| 1185 | __in_z LPCWSTR wzFeatureId, | 1157 | // __in BOOL fMissingFromCache |
| 1186 | __in BOOTSTRAPPER_FEATURE_STATE state | 1158 | // ) |
| 1187 | ) | 1159 | // { |
| 1188 | { | 1160 | // HRESULT hr = S_OK; |
| 1189 | HRESULT hr = S_OK; | 1161 | // BA_ONDETECTRELATEDBUNDLE_ARGS args = { }; |
| 1190 | BA_ONDETECTMSIFEATURE_ARGS args = { }; | 1162 | // BA_ONDETECTRELATEDBUNDLE_RESULTS results = { }; |
| 1191 | BA_ONDETECTMSIFEATURE_RESULTS results = { }; | 1163 | // PIPE_RPC_RESULT result = { }; |
| 1192 | 1164 | ||
| 1193 | args.cbSize = sizeof(args); | 1165 | // args.cbSize = sizeof(args); |
| 1194 | args.wzPackageId = wzPackageId; | 1166 | // args.wzBundleId = wzBundleId; |
| 1195 | args.wzFeatureId = wzFeatureId; | 1167 | // args.relationType = relationType; |
| 1196 | args.state = state; | 1168 | // args.wzBundleTag = wzBundleTag; |
| 1197 | 1169 | // args.fPerMachine = fPerMachine; | |
| 1198 | results.cbSize = sizeof(results); | 1170 | // args.wzVersion = pVersion->sczVersion; |
| 1199 | 1171 | // args.fMissingFromCache = fMissingFromCache; | |
| 1200 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, &results); | 1172 | |
| 1201 | ExitOnFailure(hr, "BA OnDetectMsiFeature failed."); | 1173 | // results.cbSize = sizeof(results); |
| 1202 | 1174 | ||
| 1203 | if (results.fCancel) | 1175 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, args.cbSize, &result); |
| 1204 | { | 1176 | // ExitOnFailure(hr, "BA OnDetectRelatedBundle failed."); |
| 1205 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1177 | |
| 1206 | } | 1178 | // if (results.fCancel) |
| 1207 | 1179 | // { | |
| 1208 | LExit: | 1180 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1209 | return hr; | 1181 | // } |
| 1210 | } | 1182 | |
| 1211 | 1183 | // LExit: | |
| 1212 | EXTERN_C BAAPI UserExperienceOnDetectPackageBegin( | 1184 | // return hr; |
| 1213 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1185 | // } |
| 1214 | __in_z LPCWSTR wzPackageId | 1186 | |
| 1215 | ) | 1187 | // EXTERN_C BAAPI UserExperienceOnDetectRelatedBundlePackage( |
| 1216 | { | 1188 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1217 | HRESULT hr = S_OK; | 1189 | // __in_z LPCWSTR wzPackageId, |
| 1218 | BA_ONDETECTPACKAGEBEGIN_ARGS args = { }; | 1190 | // __in_z LPCWSTR wzBundleId, |
| 1219 | BA_ONDETECTPACKAGEBEGIN_RESULTS results = { }; | 1191 | // __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 1220 | 1192 | // __in BOOL fPerMachine, | |
| 1221 | args.cbSize = sizeof(args); | 1193 | // __in VERUTIL_VERSION* pVersion |
| 1222 | args.wzPackageId = wzPackageId; | 1194 | // ) |
| 1223 | 1195 | // { | |
| 1224 | results.cbSize = sizeof(results); | 1196 | // HRESULT hr = S_OK; |
| 1225 | 1197 | // BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS args = { }; | |
| 1226 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, &results); | 1198 | // BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS results = { }; |
| 1227 | ExitOnFailure(hr, "BA OnDetectPackageBegin failed."); | 1199 | // PIPE_RPC_RESULT result = { }; |
| 1228 | 1200 | ||
| 1229 | if (results.fCancel) | 1201 | // args.cbSize = sizeof(args); |
| 1230 | { | 1202 | // args.wzPackageId = wzPackageId; |
| 1231 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1203 | // args.wzBundleId = wzBundleId; |
| 1232 | } | 1204 | // args.relationType = relationType; |
| 1233 | 1205 | // args.fPerMachine = fPerMachine; | |
| 1234 | LExit: | 1206 | // args.wzVersion = pVersion->sczVersion; |
| 1235 | return hr; | 1207 | |
| 1236 | } | 1208 | // results.cbSize = sizeof(results); |
| 1237 | 1209 | ||
| 1238 | EXTERN_C BAAPI UserExperienceOnDetectPackageComplete( | 1210 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, &args, args.cbSize, &result); |
| 1239 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1211 | // ExitOnFailure(hr, "BA OnDetectRelatedBundlePackage failed."); |
| 1240 | __in_z LPCWSTR wzPackageId, | 1212 | |
| 1241 | __in HRESULT hrStatus, | 1213 | // if (results.fCancel) |
| 1242 | __in BOOTSTRAPPER_PACKAGE_STATE state, | 1214 | // { |
| 1243 | __in BOOL fCached | 1215 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1244 | ) | 1216 | // } |
| 1245 | { | 1217 | |
| 1246 | HRESULT hr = S_OK; | 1218 | // LExit: |
| 1247 | BA_ONDETECTPACKAGECOMPLETE_ARGS args = { }; | 1219 | // return hr; |
| 1248 | BA_ONDETECTPACKAGECOMPLETE_RESULTS results = { }; | 1220 | // } |
| 1249 | 1221 | ||
| 1250 | args.cbSize = sizeof(args); | 1222 | // EXTERN_C BAAPI UserExperienceOnDetectRelatedMsiPackage( |
| 1251 | args.wzPackageId = wzPackageId; | 1223 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1252 | args.hrStatus = hrStatus; | 1224 | // __in_z LPCWSTR wzPackageId, |
| 1253 | args.state = state; | 1225 | // __in_z LPCWSTR wzUpgradeCode, |
| 1254 | args.fCached = fCached; | 1226 | // __in_z LPCWSTR wzProductCode, |
| 1255 | 1227 | // __in BOOL fPerMachine, | |
| 1256 | results.cbSize = sizeof(results); | 1228 | // __in VERUTIL_VERSION* pVersion, |
| 1257 | 1229 | // __in BOOTSTRAPPER_RELATED_OPERATION operation | |
| 1258 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, &results); | 1230 | // ) |
| 1259 | ExitOnFailure(hr, "BA OnDetectPackageComplete failed."); | 1231 | // { |
| 1260 | 1232 | // HRESULT hr = S_OK; | |
| 1261 | LExit: | 1233 | // BA_ONDETECTRELATEDMSIPACKAGE_ARGS args = { }; |
| 1262 | return hr; | 1234 | // BA_ONDETECTRELATEDMSIPACKAGE_RESULTS results = { }; |
| 1263 | } | 1235 | // PIPE_RPC_RESULT result = { }; |
| 1264 | 1236 | ||
| 1265 | EXTERN_C BAAPI UserExperienceOnDetectRelatedBundle( | 1237 | // args.cbSize = sizeof(args); |
| 1266 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1238 | // args.wzPackageId = wzPackageId; |
| 1267 | __in_z LPCWSTR wzBundleId, | 1239 | // args.wzUpgradeCode = wzUpgradeCode; |
| 1268 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 1240 | // args.wzProductCode = wzProductCode; |
| 1269 | __in_z LPCWSTR wzBundleTag, | 1241 | // args.fPerMachine = fPerMachine; |
| 1270 | __in BOOL fPerMachine, | 1242 | // args.wzVersion = pVersion->sczVersion; |
| 1271 | __in VERUTIL_VERSION* pVersion, | 1243 | // args.operation = operation; |
| 1272 | __in BOOL fMissingFromCache | 1244 | |
| 1273 | ) | 1245 | // results.cbSize = sizeof(results); |
| 1274 | { | 1246 | |
| 1275 | HRESULT hr = S_OK; | 1247 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, args.cbSize, &result); |
| 1276 | BA_ONDETECTRELATEDBUNDLE_ARGS args = { }; | 1248 | // ExitOnFailure(hr, "BA OnDetectRelatedMsiPackage failed."); |
| 1277 | BA_ONDETECTRELATEDBUNDLE_RESULTS results = { }; | 1249 | |
| 1278 | 1250 | // if (results.fCancel) | |
| 1279 | args.cbSize = sizeof(args); | 1251 | // { |
| 1280 | args.wzBundleId = wzBundleId; | 1252 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1281 | args.relationType = relationType; | 1253 | // } |
| 1282 | args.wzBundleTag = wzBundleTag; | 1254 | |
| 1283 | args.fPerMachine = fPerMachine; | 1255 | // LExit: |
| 1284 | args.wzVersion = pVersion->sczVersion; | 1256 | // return hr; |
| 1285 | args.fMissingFromCache = fMissingFromCache; | 1257 | // } |
| 1286 | 1258 | ||
| 1287 | results.cbSize = sizeof(results); | 1259 | // EXTERN_C BAAPI UserExperienceOnDetectPatchTarget( |
| 1288 | 1260 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1289 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, &results); | 1261 | // __in_z LPCWSTR wzPackageId, |
| 1290 | ExitOnFailure(hr, "BA OnDetectRelatedBundle failed."); | 1262 | // __in_z LPCWSTR wzProductCode, |
| 1291 | 1263 | // __in BOOTSTRAPPER_PACKAGE_STATE patchState | |
| 1292 | if (results.fCancel) | 1264 | // ) |
| 1293 | { | 1265 | // { |
| 1294 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1266 | // HRESULT hr = S_OK; |
| 1295 | } | 1267 | // BA_ONDETECTPATCHTARGET_ARGS args = { }; |
| 1296 | 1268 | // BA_ONDETECTPATCHTARGET_RESULTS results = { }; | |
| 1297 | LExit: | 1269 | // PIPE_RPC_RESULT result = { }; |
| 1298 | return hr; | 1270 | |
| 1299 | } | 1271 | // args.cbSize = sizeof(args); |
| 1300 | 1272 | // args.wzPackageId = wzPackageId; | |
| 1301 | EXTERN_C BAAPI UserExperienceOnDetectRelatedBundlePackage( | 1273 | // args.wzProductCode = wzProductCode; |
| 1302 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1274 | // args.patchState = patchState; |
| 1303 | __in_z LPCWSTR wzPackageId, | 1275 | |
| 1304 | __in_z LPCWSTR wzBundleId, | 1276 | // results.cbSize = sizeof(results); |
| 1305 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 1277 | |
| 1306 | __in BOOL fPerMachine, | 1278 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, &args, args.cbSize, &result); |
| 1307 | __in VERUTIL_VERSION* pVersion | 1279 | // ExitOnFailure(hr, "BA OnDetectPatchTarget failed."); |
| 1308 | ) | 1280 | |
| 1309 | { | 1281 | // if (results.fCancel) |
| 1310 | HRESULT hr = S_OK; | 1282 | // { |
| 1311 | BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS args = { }; | 1283 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1312 | BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS results = { }; | 1284 | // } |
| 1313 | 1285 | ||
| 1314 | args.cbSize = sizeof(args); | 1286 | // LExit: |
| 1315 | args.wzPackageId = wzPackageId; | 1287 | // return hr; |
| 1316 | args.wzBundleId = wzBundleId; | 1288 | // } |
| 1317 | args.relationType = relationType; | 1289 | |
| 1318 | args.fPerMachine = fPerMachine; | 1290 | // EXTERN_C BAAPI UserExperienceOnDetectUpdate( |
| 1319 | args.wzVersion = pVersion->sczVersion; | 1291 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1320 | 1292 | // __in_z_opt LPCWSTR wzUpdateLocation, | |
| 1321 | results.cbSize = sizeof(results); | 1293 | // __in DWORD64 dw64Size, |
| 1322 | 1294 | // __in_z_opt LPCWSTR wzHash, | |
| 1323 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, &args, &results); | 1295 | // __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm, |
| 1324 | ExitOnFailure(hr, "BA OnDetectRelatedBundlePackage failed."); | 1296 | // __in VERUTIL_VERSION* pVersion, |
| 1325 | 1297 | // __in_z_opt LPCWSTR wzTitle, | |
| 1326 | if (results.fCancel) | 1298 | // __in_z_opt LPCWSTR wzSummary, |
| 1327 | { | 1299 | // __in_z_opt LPCWSTR wzContentType, |
| 1328 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1300 | // __in_z_opt LPCWSTR wzContent, |
| 1329 | } | 1301 | // __inout BOOL* pfStopProcessingUpdates |
| 1330 | 1302 | // ) | |
| 1331 | LExit: | 1303 | // { |
| 1332 | return hr; | 1304 | // HRESULT hr = S_OK; |
| 1333 | } | 1305 | // BA_ONDETECTUPDATE_ARGS args = { }; |
| 1334 | 1306 | // BA_ONDETECTUPDATE_RESULTS results = { }; | |
| 1335 | EXTERN_C BAAPI UserExperienceOnDetectRelatedMsiPackage( | 1307 | // PIPE_RPC_RESULT result = { }; |
| 1336 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1308 | |
| 1337 | __in_z LPCWSTR wzPackageId, | 1309 | // args.cbSize = sizeof(args); |
| 1338 | __in_z LPCWSTR wzUpgradeCode, | 1310 | // args.wzUpdateLocation = wzUpdateLocation; |
| 1339 | __in_z LPCWSTR wzProductCode, | 1311 | // args.dw64Size = dw64Size; |
| 1340 | __in BOOL fPerMachine, | 1312 | // args.wzHash = wzHash; |
| 1341 | __in VERUTIL_VERSION* pVersion, | 1313 | // args.hashAlgorithm = hashAlgorithm; |
| 1342 | __in BOOTSTRAPPER_RELATED_OPERATION operation | 1314 | // args.wzVersion = pVersion->sczVersion; |
| 1343 | ) | 1315 | // args.wzTitle = wzTitle; |
| 1344 | { | 1316 | // args.wzSummary = wzSummary; |
| 1345 | HRESULT hr = S_OK; | 1317 | // args.wzContentType = wzContentType; |
| 1346 | BA_ONDETECTRELATEDMSIPACKAGE_ARGS args = { }; | 1318 | // args.wzContent = wzContent; |
| 1347 | BA_ONDETECTRELATEDMSIPACKAGE_RESULTS results = { }; | 1319 | |
| 1348 | 1320 | // results.cbSize = sizeof(results); | |
| 1349 | args.cbSize = sizeof(args); | 1321 | // results.fStopProcessingUpdates = *pfStopProcessingUpdates; |
| 1350 | args.wzPackageId = wzPackageId; | 1322 | |
| 1351 | args.wzUpgradeCode = wzUpgradeCode; | 1323 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, args.cbSize, &result); |
| 1352 | args.wzProductCode = wzProductCode; | 1324 | // ExitOnFailure(hr, "BA OnDetectUpdate failed."); |
| 1353 | args.fPerMachine = fPerMachine; | 1325 | |
| 1354 | args.wzVersion = pVersion->sczVersion; | 1326 | // if (results.fCancel) |
| 1355 | args.operation = operation; | 1327 | // { |
| 1356 | 1328 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 1357 | results.cbSize = sizeof(results); | 1329 | // } |
| 1358 | 1330 | ||
| 1359 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, &results); | 1331 | // *pfStopProcessingUpdates = results.fStopProcessingUpdates; |
| 1360 | ExitOnFailure(hr, "BA OnDetectRelatedMsiPackage failed."); | 1332 | |
| 1361 | 1333 | // LExit: | |
| 1362 | if (results.fCancel) | 1334 | // return hr; |
| 1363 | { | 1335 | // } |
| 1364 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1336 | |
| 1365 | } | 1337 | // EXTERN_C BAAPI UserExperienceOnDetectUpdateBegin( |
| 1366 | 1338 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1367 | LExit: | 1339 | // __in_z LPCWSTR wzUpdateLocation, |
| 1368 | return hr; | 1340 | // __inout BOOL* pfSkip |
| 1369 | } | 1341 | // ) |
| 1370 | 1342 | // { | |
| 1371 | EXTERN_C BAAPI UserExperienceOnDetectPatchTarget( | 1343 | // HRESULT hr = S_OK; |
| 1372 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1344 | // BA_ONDETECTUPDATEBEGIN_ARGS args = { }; |
| 1373 | __in_z LPCWSTR wzPackageId, | 1345 | // BA_ONDETECTUPDATEBEGIN_RESULTS results = { }; |
| 1374 | __in_z LPCWSTR wzProductCode, | 1346 | // PIPE_RPC_RESULT result = { }; |
| 1375 | __in BOOTSTRAPPER_PACKAGE_STATE patchState | 1347 | |
| 1376 | ) | 1348 | // args.cbSize = sizeof(args); |
| 1377 | { | 1349 | // args.wzUpdateLocation = wzUpdateLocation; |
| 1378 | HRESULT hr = S_OK; | 1350 | |
| 1379 | BA_ONDETECTPATCHTARGET_ARGS args = { }; | 1351 | // results.cbSize = sizeof(results); |
| 1380 | BA_ONDETECTPATCHTARGET_RESULTS results = { }; | 1352 | // results.fSkip = *pfSkip; |
| 1381 | 1353 | ||
| 1382 | args.cbSize = sizeof(args); | 1354 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, args.cbSize, &result); |
| 1383 | args.wzPackageId = wzPackageId; | 1355 | // ExitOnFailure(hr, "BA OnDetectUpdateBegin failed."); |
| 1384 | args.wzProductCode = wzProductCode; | 1356 | |
| 1385 | args.patchState = patchState; | 1357 | // if (results.fCancel) |
| 1386 | 1358 | // { | |
| 1387 | results.cbSize = sizeof(results); | 1359 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1388 | 1360 | // } | |
| 1389 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, &args, &results); | 1361 | // *pfSkip = results.fSkip; |
| 1390 | ExitOnFailure(hr, "BA OnDetectPatchTarget failed."); | 1362 | |
| 1391 | 1363 | // LExit: | |
| 1392 | if (results.fCancel) | 1364 | // return hr; |
| 1393 | { | 1365 | // } |
| 1394 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1366 | |
| 1395 | } | 1367 | // EXTERN_C BAAPI UserExperienceOnDetectUpdateComplete( |
| 1396 | 1368 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1397 | LExit: | 1369 | // __in HRESULT hrStatus, |
| 1398 | return hr; | 1370 | // __inout BOOL* pfIgnoreError |
| 1399 | } | 1371 | // ) |
| 1400 | 1372 | // { | |
| 1401 | EXTERN_C BAAPI UserExperienceOnDetectUpdate( | 1373 | // HRESULT hr = S_OK; |
| 1402 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1374 | // BA_ONDETECTUPDATECOMPLETE_ARGS args = { }; |
| 1403 | __in_z_opt LPCWSTR wzUpdateLocation, | 1375 | // BA_ONDETECTUPDATECOMPLETE_RESULTS results = { }; |
| 1404 | __in DWORD64 dw64Size, | 1376 | // PIPE_RPC_RESULT result = { }; |
| 1405 | __in_z_opt LPCWSTR wzHash, | 1377 | |
| 1406 | __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm, | 1378 | // args.cbSize = sizeof(args); |
| 1407 | __in VERUTIL_VERSION* pVersion, | 1379 | // args.hrStatus = hrStatus; |
| 1408 | __in_z_opt LPCWSTR wzTitle, | 1380 | |
| 1409 | __in_z_opt LPCWSTR wzSummary, | 1381 | // results.cbSize = sizeof(results); |
| 1410 | __in_z_opt LPCWSTR wzContentType, | 1382 | // results.fIgnoreError = *pfIgnoreError; |
| 1411 | __in_z_opt LPCWSTR wzContent, | 1383 | |
| 1412 | __inout BOOL* pfStopProcessingUpdates | 1384 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, args.cbSize, &result); |
| 1413 | ) | 1385 | // ExitOnFailure(hr, "BA OnDetectUpdateComplete failed."); |
| 1414 | { | 1386 | |
| 1415 | HRESULT hr = S_OK; | 1387 | // if (FAILED(hrStatus)) |
| 1416 | BA_ONDETECTUPDATE_ARGS args = { }; | 1388 | // { |
| 1417 | BA_ONDETECTUPDATE_RESULTS results = { }; | 1389 | // *pfIgnoreError = results.fIgnoreError; |
| 1418 | 1390 | // } | |
| 1419 | args.cbSize = sizeof(args); | 1391 | |
| 1420 | args.wzUpdateLocation = wzUpdateLocation; | 1392 | // LExit: |
| 1421 | args.dw64Size = dw64Size; | 1393 | // return hr; |
| 1422 | args.wzHash = wzHash; | 1394 | // } |
| 1423 | args.hashAlgorithm = hashAlgorithm; | 1395 | |
| 1424 | args.wzVersion = pVersion->sczVersion; | 1396 | // EXTERN_C BAAPI UserExperienceOnElevateBegin( |
| 1425 | args.wzTitle = wzTitle; | 1397 | // __in BURN_USER_EXPERIENCE* pUserExperience |
| 1426 | args.wzSummary = wzSummary; | 1398 | // ) |
| 1427 | args.wzContentType = wzContentType; | 1399 | // { |
| 1428 | args.wzContent = wzContent; | 1400 | // HRESULT hr = S_OK; |
| 1429 | 1401 | // BA_ONELEVATEBEGIN_ARGS args = { }; | |
| 1430 | results.cbSize = sizeof(results); | 1402 | // BA_ONELEVATEBEGIN_RESULTS results = { }; |
| 1431 | results.fStopProcessingUpdates = *pfStopProcessingUpdates; | 1403 | // PIPE_RPC_RESULT result = { }; |
| 1432 | 1404 | ||
| 1433 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, &results); | 1405 | // args.cbSize = sizeof(args); |
| 1434 | ExitOnFailure(hr, "BA OnDetectUpdate failed."); | 1406 | |
| 1435 | 1407 | // results.cbSize = sizeof(results); | |
| 1436 | if (results.fCancel) | 1408 | |
| 1437 | { | 1409 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, args.cbSize, &result); |
| 1438 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1410 | // ExitOnFailure(hr, "BA OnElevateBegin failed."); |
| 1439 | } | 1411 | |
| 1440 | 1412 | // if (results.fCancel) | |
| 1441 | *pfStopProcessingUpdates = results.fStopProcessingUpdates; | 1413 | // { |
| 1442 | 1414 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 1443 | LExit: | 1415 | // } |
| 1444 | return hr; | 1416 | |
| 1445 | } | 1417 | // LExit: |
| 1446 | 1418 | // return hr; | |
| 1447 | EXTERN_C BAAPI UserExperienceOnDetectUpdateBegin( | 1419 | // } |
| 1448 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1420 | |
| 1449 | __in_z LPCWSTR wzUpdateLocation, | 1421 | // EXTERN_C BAAPI UserExperienceOnElevateComplete( |
| 1450 | __inout BOOL* pfSkip | 1422 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1451 | ) | 1423 | // __in HRESULT hrStatus |
| 1452 | { | 1424 | // ) |
| 1453 | HRESULT hr = S_OK; | 1425 | // { |
| 1454 | BA_ONDETECTUPDATEBEGIN_ARGS args = { }; | 1426 | // HRESULT hr = S_OK; |
| 1455 | BA_ONDETECTUPDATEBEGIN_RESULTS results = { }; | 1427 | // BA_ONELEVATECOMPLETE_ARGS args = { }; |
| 1456 | 1428 | // BA_ONELEVATECOMPLETE_RESULTS results = { }; | |
| 1457 | args.cbSize = sizeof(args); | 1429 | // PIPE_RPC_RESULT result = { }; |
| 1458 | args.wzUpdateLocation = wzUpdateLocation; | 1430 | |
| 1459 | 1431 | // args.cbSize = sizeof(args); | |
| 1460 | results.cbSize = sizeof(results); | 1432 | // args.hrStatus = hrStatus; |
| 1461 | results.fSkip = *pfSkip; | 1433 | |
| 1462 | 1434 | // results.cbSize = sizeof(results); | |
| 1463 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, &results); | 1435 | |
| 1464 | ExitOnFailure(hr, "BA OnDetectUpdateBegin failed."); | 1436 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, args.cbSize, &result); |
| 1465 | 1437 | // ExitOnFailure(hr, "BA OnElevateComplete failed."); | |
| 1466 | if (results.fCancel) | 1438 | |
| 1467 | { | 1439 | // LExit: |
| 1468 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1440 | // return hr; |
| 1469 | } | 1441 | // } |
| 1470 | *pfSkip = results.fSkip; | 1442 | |
| 1471 | 1443 | // EXTERN_C BAAPI UserExperienceOnError( | |
| 1472 | LExit: | 1444 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1473 | return hr; | 1445 | // __in BOOTSTRAPPER_ERROR_TYPE errorType, |
| 1474 | } | 1446 | // __in_z_opt LPCWSTR wzPackageId, |
| 1475 | 1447 | // __in DWORD dwCode, | |
| 1476 | EXTERN_C BAAPI UserExperienceOnDetectUpdateComplete( | 1448 | // __in_z_opt LPCWSTR wzError, |
| 1477 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1449 | // __in DWORD dwUIHint, |
| 1478 | __in HRESULT hrStatus, | 1450 | // __in DWORD cData, |
| 1479 | __inout BOOL* pfIgnoreError | 1451 | // __in_ecount_z_opt(cData) LPCWSTR* rgwzData, |
| 1480 | ) | 1452 | // __inout int* pnResult |
| 1481 | { | 1453 | // ) |
| 1482 | HRESULT hr = S_OK; | 1454 | // { |
| 1483 | BA_ONDETECTUPDATECOMPLETE_ARGS args = { }; | 1455 | // HRESULT hr = S_OK; |
| 1484 | BA_ONDETECTUPDATECOMPLETE_RESULTS results = { }; | 1456 | // BA_ONERROR_ARGS args = { }; |
| 1485 | 1457 | // BA_ONERROR_RESULTS results = { }; | |
| 1486 | args.cbSize = sizeof(args); | 1458 | // PIPE_RPC_RESULT result = { }; |
| 1487 | args.hrStatus = hrStatus; | 1459 | |
| 1488 | 1460 | // args.cbSize = sizeof(args); | |
| 1489 | results.cbSize = sizeof(results); | 1461 | // args.errorType = errorType; |
| 1490 | results.fIgnoreError = *pfIgnoreError; | 1462 | // args.wzPackageId = wzPackageId; |
| 1491 | 1463 | // args.dwCode = dwCode; | |
| 1492 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, &results); | 1464 | // args.wzError = wzError; |
| 1493 | ExitOnFailure(hr, "BA OnDetectUpdateComplete failed."); | 1465 | // args.dwUIHint = dwUIHint; |
| 1494 | 1466 | // args.cData = cData; | |
| 1495 | if (FAILED(hrStatus)) | 1467 | // args.rgwzData = rgwzData; |
| 1496 | { | 1468 | // args.nRecommendation = *pnResult; |
| 1497 | *pfIgnoreError = results.fIgnoreError; | 1469 | |
| 1498 | } | 1470 | // results.cbSize = sizeof(results); |
| 1499 | 1471 | // results.nResult = *pnResult; | |
| 1500 | LExit: | 1472 | |
| 1501 | return hr; | 1473 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, args.cbSize, &result); |
| 1502 | } | 1474 | // ExitOnFailure(hr, "BA OnError failed."); |
| 1503 | 1475 | ||
| 1504 | EXTERN_C BAAPI UserExperienceOnElevateBegin( | 1476 | // *pnResult = results.nResult; |
| 1505 | __in BURN_USER_EXPERIENCE* pUserExperience | 1477 | |
| 1506 | ) | 1478 | // LExit: |
| 1507 | { | 1479 | // return hr; |
| 1508 | HRESULT hr = S_OK; | 1480 | // } |
| 1509 | BA_ONELEVATEBEGIN_ARGS args = { }; | 1481 | |
| 1510 | BA_ONELEVATEBEGIN_RESULTS results = { }; | 1482 | // EXTERN_C BAAPI UserExperienceOnExecuteBegin( |
| 1511 | 1483 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1512 | args.cbSize = sizeof(args); | 1484 | // __in DWORD cExecutingPackages |
| 1513 | 1485 | // ) | |
| 1514 | results.cbSize = sizeof(results); | 1486 | // { |
| 1515 | 1487 | // HRESULT hr = S_OK; | |
| 1516 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, &results); | 1488 | // BA_ONEXECUTEBEGIN_ARGS args = { }; |
| 1517 | ExitOnFailure(hr, "BA OnElevateBegin failed."); | 1489 | // BA_ONEXECUTEBEGIN_RESULTS results = { }; |
| 1518 | 1490 | // PIPE_RPC_RESULT result = { }; | |
| 1519 | if (results.fCancel) | 1491 | |
| 1520 | { | 1492 | // args.cbSize = sizeof(args); |
| 1521 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1493 | // args.cExecutingPackages = cExecutingPackages; |
| 1522 | } | 1494 | |
| 1523 | 1495 | // results.cbSize = sizeof(results); | |
| 1524 | LExit: | 1496 | |
| 1525 | return hr; | 1497 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, args.cbSize, &result); |
| 1526 | } | 1498 | // ExitOnFailure(hr, "BA OnExecuteBegin failed."); |
| 1527 | 1499 | ||
| 1528 | EXTERN_C BAAPI UserExperienceOnElevateComplete( | 1500 | // if (results.fCancel) |
| 1529 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1501 | // { |
| 1530 | __in HRESULT hrStatus | 1502 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1531 | ) | 1503 | // } |
| 1532 | { | 1504 | |
| 1533 | HRESULT hr = S_OK; | 1505 | // LExit: |
| 1534 | BA_ONELEVATECOMPLETE_ARGS args = { }; | 1506 | // return hr; |
| 1535 | BA_ONELEVATECOMPLETE_RESULTS results = { }; | 1507 | // } |
| 1536 | 1508 | ||
| 1537 | args.cbSize = sizeof(args); | 1509 | // EXTERN_C BAAPI UserExperienceOnExecuteComplete( |
| 1538 | args.hrStatus = hrStatus; | 1510 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1539 | 1511 | // __in HRESULT hrStatus | |
| 1540 | results.cbSize = sizeof(results); | 1512 | // ) |
| 1541 | 1513 | // { | |
| 1542 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, &results); | 1514 | // HRESULT hr = S_OK; |
| 1543 | ExitOnFailure(hr, "BA OnElevateComplete failed."); | 1515 | // BA_ONEXECUTECOMPLETE_ARGS args = { }; |
| 1544 | 1516 | // BA_ONEXECUTECOMPLETE_RESULTS results = { }; | |
| 1545 | LExit: | 1517 | // PIPE_RPC_RESULT result = { }; |
| 1546 | return hr; | 1518 | |
| 1547 | } | 1519 | // args.cbSize = sizeof(args); |
| 1548 | 1520 | // args.hrStatus = hrStatus; | |
| 1549 | EXTERN_C BAAPI UserExperienceOnError( | 1521 | |
| 1550 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1522 | // results.cbSize = sizeof(results); |
| 1551 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | 1523 | |
| 1552 | __in_z_opt LPCWSTR wzPackageId, | 1524 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, args.cbSize, &result); |
| 1553 | __in DWORD dwCode, | 1525 | // ExitOnFailure(hr, "BA OnExecuteComplete failed."); |
| 1554 | __in_z_opt LPCWSTR wzError, | 1526 | |
| 1555 | __in DWORD dwUIHint, | 1527 | // LExit: |
| 1556 | __in DWORD cData, | 1528 | // return hr; |
| 1557 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | 1529 | // } |
| 1558 | __inout int* pnResult | 1530 | |
| 1559 | ) | 1531 | // EXTERN_C BAAPI UserExperienceOnExecuteFilesInUse( |
| 1560 | { | 1532 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1561 | HRESULT hr = S_OK; | 1533 | // __in_z LPCWSTR wzPackageId, |
| 1562 | BA_ONERROR_ARGS args = { }; | 1534 | // __in DWORD cFiles, |
| 1563 | BA_ONERROR_RESULTS results = { }; | 1535 | // __in_ecount_z_opt(cFiles) LPCWSTR* rgwzFiles, |
| 1564 | 1536 | // __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, | |
| 1565 | args.cbSize = sizeof(args); | 1537 | // __inout int* pnResult |
| 1566 | args.errorType = errorType; | 1538 | // ) |
| 1567 | args.wzPackageId = wzPackageId; | 1539 | // { |
| 1568 | args.dwCode = dwCode; | 1540 | // HRESULT hr = S_OK; |
| 1569 | args.wzError = wzError; | 1541 | // BA_ONEXECUTEFILESINUSE_ARGS args = { }; |
| 1570 | args.dwUIHint = dwUIHint; | 1542 | // BA_ONEXECUTEFILESINUSE_RESULTS results = { }; |
| 1571 | args.cData = cData; | 1543 | // PIPE_RPC_RESULT result = { }; |
| 1572 | args.rgwzData = rgwzData; | 1544 | |
| 1573 | args.nRecommendation = *pnResult; | 1545 | // args.cbSize = sizeof(args); |
| 1574 | 1546 | // args.wzPackageId = wzPackageId; | |
| 1575 | results.cbSize = sizeof(results); | 1547 | // args.cFiles = cFiles; |
| 1576 | results.nResult = *pnResult; | 1548 | // args.rgwzFiles = rgwzFiles; |
| 1577 | 1549 | // args.nRecommendation = *pnResult; | |
| 1578 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, &results); | 1550 | // args.source = source; |
| 1579 | ExitOnFailure(hr, "BA OnError failed."); | 1551 | |
| 1580 | 1552 | // results.cbSize = sizeof(results); | |
| 1581 | *pnResult = results.nResult; | 1553 | // results.nResult = *pnResult; |
| 1582 | 1554 | ||
| 1583 | LExit: | 1555 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, args.cbSize, &result); |
| 1584 | return hr; | 1556 | // ExitOnFailure(hr, "BA OnExecuteFilesInUse failed."); |
| 1585 | } | 1557 | |
| 1586 | 1558 | // *pnResult = results.nResult; | |
| 1587 | EXTERN_C BAAPI UserExperienceOnExecuteBegin( | 1559 | |
| 1588 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1560 | // LExit: |
| 1589 | __in DWORD cExecutingPackages | 1561 | // return hr; |
| 1590 | ) | 1562 | // } |
| 1591 | { | 1563 | |
| 1592 | HRESULT hr = S_OK; | 1564 | // EXTERN_C BAAPI UserExperienceOnExecuteMsiMessage( |
| 1593 | BA_ONEXECUTEBEGIN_ARGS args = { }; | 1565 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1594 | BA_ONEXECUTEBEGIN_RESULTS results = { }; | 1566 | // __in_z LPCWSTR wzPackageId, |
| 1595 | 1567 | // __in INSTALLMESSAGE messageType, | |
| 1596 | args.cbSize = sizeof(args); | 1568 | // __in DWORD dwUIHint, |
| 1597 | args.cExecutingPackages = cExecutingPackages; | 1569 | // __in_z LPCWSTR wzMessage, |
| 1598 | 1570 | // __in DWORD cData, | |
| 1599 | results.cbSize = sizeof(results); | 1571 | // __in_ecount_z_opt(cData) LPCWSTR* rgwzData, |
| 1600 | 1572 | // __inout int* pnResult | |
| 1601 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, &results); | 1573 | // ) |
| 1602 | ExitOnFailure(hr, "BA OnExecuteBegin failed."); | 1574 | // { |
| 1603 | 1575 | // HRESULT hr = S_OK; | |
| 1604 | if (results.fCancel) | 1576 | // BA_ONEXECUTEMSIMESSAGE_ARGS args = { }; |
| 1605 | { | 1577 | // BA_ONEXECUTEMSIMESSAGE_RESULTS results = { }; |
| 1606 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1578 | // PIPE_RPC_RESULT result = { }; |
| 1607 | } | 1579 | |
| 1608 | 1580 | // args.cbSize = sizeof(args); | |
| 1609 | LExit: | 1581 | // args.wzPackageId = wzPackageId; |
| 1610 | return hr; | 1582 | // args.messageType = messageType; |
| 1611 | } | 1583 | // args.dwUIHint = dwUIHint; |
| 1612 | 1584 | // args.wzMessage = wzMessage; | |
| 1613 | EXTERN_C BAAPI UserExperienceOnExecuteComplete( | 1585 | // args.cData = cData; |
| 1614 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1586 | // args.rgwzData = rgwzData; |
| 1615 | __in HRESULT hrStatus | 1587 | // args.nRecommendation = *pnResult; |
| 1616 | ) | 1588 | |
| 1617 | { | 1589 | // results.cbSize = sizeof(results); |
| 1618 | HRESULT hr = S_OK; | 1590 | // results.nResult = *pnResult; |
| 1619 | BA_ONEXECUTECOMPLETE_ARGS args = { }; | 1591 | |
| 1620 | BA_ONEXECUTECOMPLETE_RESULTS results = { }; | 1592 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, args.cbSize, &result); |
| 1621 | 1593 | // ExitOnFailure(hr, "BA OnExecuteMsiMessage failed."); | |
| 1622 | args.cbSize = sizeof(args); | 1594 | |
| 1623 | args.hrStatus = hrStatus; | 1595 | // *pnResult = results.nResult; |
| 1624 | 1596 | ||
| 1625 | results.cbSize = sizeof(results); | 1597 | // LExit: |
| 1626 | 1598 | // return hr; | |
| 1627 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, &results); | 1599 | // } |
| 1628 | ExitOnFailure(hr, "BA OnExecuteComplete failed."); | 1600 | |
| 1629 | 1601 | // EXTERN_C BAAPI UserExperienceOnExecutePackageBegin( | |
| 1630 | LExit: | 1602 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1631 | return hr; | 1603 | // __in_z LPCWSTR wzPackageId, |
| 1632 | } | 1604 | // __in BOOL fExecute, |
| 1633 | 1605 | // __in BOOTSTRAPPER_ACTION_STATE action, | |
| 1634 | EXTERN_C BAAPI UserExperienceOnExecuteFilesInUse( | 1606 | // __in INSTALLUILEVEL uiLevel, |
| 1635 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1607 | // __in BOOL fDisableExternalUiHandler |
| 1636 | __in_z LPCWSTR wzPackageId, | 1608 | // ) |
| 1637 | __in DWORD cFiles, | 1609 | // { |
| 1638 | __in_ecount_z_opt(cFiles) LPCWSTR* rgwzFiles, | 1610 | // HRESULT hr = S_OK; |
| 1639 | __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, | 1611 | // BA_ONEXECUTEPACKAGEBEGIN_ARGS args = { }; |
| 1640 | __inout int* pnResult | 1612 | // BA_ONEXECUTEPACKAGEBEGIN_RESULTS results = { }; |
| 1641 | ) | 1613 | // PIPE_RPC_RESULT result = { }; |
| 1642 | { | 1614 | |
| 1643 | HRESULT hr = S_OK; | 1615 | // args.cbSize = sizeof(args); |
| 1644 | BA_ONEXECUTEFILESINUSE_ARGS args = { }; | 1616 | // args.wzPackageId = wzPackageId; |
| 1645 | BA_ONEXECUTEFILESINUSE_RESULTS results = { }; | 1617 | // args.fExecute = fExecute; |
| 1646 | 1618 | // args.action = action; | |
| 1647 | args.cbSize = sizeof(args); | 1619 | // args.uiLevel = uiLevel; |
| 1648 | args.wzPackageId = wzPackageId; | 1620 | // args.fDisableExternalUiHandler = fDisableExternalUiHandler; |
| 1649 | args.cFiles = cFiles; | 1621 | |
| 1650 | args.rgwzFiles = rgwzFiles; | 1622 | // results.cbSize = sizeof(results); |
| 1651 | args.nRecommendation = *pnResult; | 1623 | |
| 1652 | args.source = source; | 1624 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, args.cbSize, &result); |
| 1653 | 1625 | // ExitOnFailure(hr, "BA OnExecutePackageBegin failed."); | |
| 1654 | results.cbSize = sizeof(results); | 1626 | |
| 1655 | results.nResult = *pnResult; | 1627 | // if (results.fCancel) |
| 1656 | 1628 | // { | |
| 1657 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, &results); | 1629 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1658 | ExitOnFailure(hr, "BA OnExecuteFilesInUse failed."); | 1630 | // } |
| 1659 | 1631 | ||
| 1660 | *pnResult = results.nResult; | 1632 | // LExit: |
| 1661 | 1633 | // return hr; | |
| 1662 | LExit: | 1634 | // } |
| 1663 | return hr; | 1635 | |
| 1664 | } | 1636 | // EXTERN_C BAAPI UserExperienceOnExecutePackageComplete( |
| 1665 | 1637 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1666 | EXTERN_C BAAPI UserExperienceOnExecuteMsiMessage( | 1638 | // __in_z LPCWSTR wzPackageId, |
| 1667 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1639 | // __in HRESULT hrStatus, |
| 1668 | __in_z LPCWSTR wzPackageId, | 1640 | // __in BOOTSTRAPPER_APPLY_RESTART restart, |
| 1669 | __in INSTALLMESSAGE messageType, | 1641 | // __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction |
| 1670 | __in DWORD dwUIHint, | 1642 | // ) |
| 1671 | __in_z LPCWSTR wzMessage, | 1643 | // { |
| 1672 | __in DWORD cData, | 1644 | // HRESULT hr = S_OK; |
| 1673 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | 1645 | // BA_ONEXECUTEPACKAGECOMPLETE_ARGS args = { }; |
| 1674 | __inout int* pnResult | 1646 | // BA_ONEXECUTEPACKAGECOMPLETE_RESULTS results = { }; |
| 1675 | ) | 1647 | // PIPE_RPC_RESULT result = { }; |
| 1676 | { | 1648 | |
| 1677 | HRESULT hr = S_OK; | 1649 | // args.cbSize = sizeof(args); |
| 1678 | BA_ONEXECUTEMSIMESSAGE_ARGS args = { }; | 1650 | // args.wzPackageId = wzPackageId; |
| 1679 | BA_ONEXECUTEMSIMESSAGE_RESULTS results = { }; | 1651 | // args.hrStatus = hrStatus; |
| 1680 | 1652 | // args.restart = restart; | |
| 1681 | args.cbSize = sizeof(args); | 1653 | // args.recommendation = *pAction; |
| 1682 | args.wzPackageId = wzPackageId; | 1654 | |
| 1683 | args.messageType = messageType; | 1655 | // results.cbSize = sizeof(results); |
| 1684 | args.dwUIHint = dwUIHint; | 1656 | // results.action = *pAction; |
| 1685 | args.wzMessage = wzMessage; | 1657 | |
| 1686 | args.cData = cData; | 1658 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, args.cbSize, &result); |
| 1687 | args.rgwzData = rgwzData; | 1659 | // ExitOnFailure(hr, "BA OnExecutePackageComplete failed."); |
| 1688 | args.nRecommendation = *pnResult; | 1660 | |
| 1689 | 1661 | // *pAction = results.action; | |
| 1690 | results.cbSize = sizeof(results); | 1662 | |
| 1691 | results.nResult = *pnResult; | 1663 | // LExit: |
| 1692 | 1664 | // return hr; | |
| 1693 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, &results); | 1665 | // } |
| 1694 | ExitOnFailure(hr, "BA OnExecuteMsiMessage failed."); | 1666 | |
| 1695 | 1667 | // EXTERN_C BAAPI UserExperienceOnExecutePatchTarget( | |
| 1696 | *pnResult = results.nResult; | 1668 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1697 | 1669 | // __in_z LPCWSTR wzPackageId, | |
| 1698 | LExit: | 1670 | // __in_z LPCWSTR wzTargetProductCode |
| 1699 | return hr; | 1671 | // ) |
| 1700 | } | 1672 | // { |
| 1701 | 1673 | // HRESULT hr = S_OK; | |
| 1702 | EXTERN_C BAAPI UserExperienceOnExecutePackageBegin( | 1674 | // BA_ONEXECUTEPATCHTARGET_ARGS args = { }; |
| 1703 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1675 | // BA_ONEXECUTEPATCHTARGET_RESULTS results = { }; |
| 1704 | __in_z LPCWSTR wzPackageId, | 1676 | // PIPE_RPC_RESULT result = { }; |
| 1705 | __in BOOL fExecute, | 1677 | |
| 1706 | __in BOOTSTRAPPER_ACTION_STATE action, | 1678 | // args.cbSize = sizeof(args); |
| 1707 | __in INSTALLUILEVEL uiLevel, | 1679 | // args.wzPackageId = wzPackageId; |
| 1708 | __in BOOL fDisableExternalUiHandler | 1680 | // args.wzTargetProductCode = wzTargetProductCode; |
| 1709 | ) | 1681 | |
| 1710 | { | 1682 | // results.cbSize = sizeof(results); |
| 1711 | HRESULT hr = S_OK; | 1683 | |
| 1712 | BA_ONEXECUTEPACKAGEBEGIN_ARGS args = { }; | 1684 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, args.cbSize, &result); |
| 1713 | BA_ONEXECUTEPACKAGEBEGIN_RESULTS results = { }; | 1685 | // ExitOnFailure(hr, "BA OnExecutePatchTarget failed."); |
| 1714 | 1686 | ||
| 1715 | args.cbSize = sizeof(args); | 1687 | // if (results.fCancel) |
| 1716 | args.wzPackageId = wzPackageId; | 1688 | // { |
| 1717 | args.fExecute = fExecute; | 1689 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1718 | args.action = action; | 1690 | // } |
| 1719 | args.uiLevel = uiLevel; | 1691 | |
| 1720 | args.fDisableExternalUiHandler = fDisableExternalUiHandler; | 1692 | // LExit: |
| 1721 | 1693 | // return hr; | |
| 1722 | results.cbSize = sizeof(results); | 1694 | // } |
| 1723 | 1695 | ||
| 1724 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, &results); | 1696 | // BAAPI UserExperienceOnExecuteProcessCancel( |
| 1725 | ExitOnFailure(hr, "BA OnExecutePackageBegin failed."); | 1697 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1726 | 1698 | // __in_z LPCWSTR wzPackageId, | |
| 1727 | if (results.fCancel) | 1699 | // __in DWORD dwProcessId, |
| 1728 | { | 1700 | // __inout BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION* pAction |
| 1729 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1701 | // ) |
| 1730 | } | 1702 | // { |
| 1731 | 1703 | // HRESULT hr = S_OK; | |
| 1732 | LExit: | 1704 | // BA_ONEXECUTEPROCESSCANCEL_ARGS args = { }; |
| 1733 | return hr; | 1705 | // BA_ONEXECUTEPROCESSCANCEL_RESULTS results = { }; |
| 1734 | } | 1706 | // PIPE_RPC_RESULT result = { }; |
| 1735 | 1707 | ||
| 1736 | EXTERN_C BAAPI UserExperienceOnExecutePackageComplete( | 1708 | // args.cbSize = sizeof(args); |
| 1737 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1709 | // args.wzPackageId = wzPackageId; |
| 1738 | __in_z LPCWSTR wzPackageId, | 1710 | // args.dwProcessId = dwProcessId; |
| 1739 | __in HRESULT hrStatus, | 1711 | // args.recommendation = *pAction; |
| 1740 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 1712 | |
| 1741 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction | 1713 | // results.cbSize = sizeof(results); |
| 1742 | ) | 1714 | // results.action = *pAction; |
| 1743 | { | 1715 | |
| 1744 | HRESULT hr = S_OK; | 1716 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL, &args, args.cbSize, &result); |
| 1745 | BA_ONEXECUTEPACKAGECOMPLETE_ARGS args = { }; | 1717 | // ExitOnFailure(hr, "BA OnExecuteProcessCancel failed."); |
| 1746 | BA_ONEXECUTEPACKAGECOMPLETE_RESULTS results = { }; | 1718 | |
| 1747 | 1719 | // *pAction = results.action; | |
| 1748 | args.cbSize = sizeof(args); | 1720 | |
| 1749 | args.wzPackageId = wzPackageId; | 1721 | // LExit: |
| 1750 | args.hrStatus = hrStatus; | 1722 | // return hr; |
| 1751 | args.restart = restart; | 1723 | // } |
| 1752 | args.recommendation = *pAction; | 1724 | |
| 1753 | 1725 | // EXTERN_C BAAPI UserExperienceOnExecuteProgress( | |
| 1754 | results.cbSize = sizeof(results); | 1726 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1755 | results.action = *pAction; | 1727 | // __in_z LPCWSTR wzPackageId, |
| 1756 | 1728 | // __in DWORD dwProgressPercentage, | |
| 1757 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, &results); | 1729 | // __in DWORD dwOverallPercentage, |
| 1758 | ExitOnFailure(hr, "BA OnExecutePackageComplete failed."); | 1730 | // __out int* pnResult |
| 1759 | 1731 | // ) | |
| 1760 | *pAction = results.action; | 1732 | // { |
| 1761 | 1733 | // HRESULT hr = S_OK; | |
| 1762 | LExit: | 1734 | // BA_ONEXECUTEPROGRESS_ARGS args = { }; |
| 1763 | return hr; | 1735 | // BA_ONEXECUTEPROGRESS_RESULTS results = { }; |
| 1764 | } | 1736 | // PIPE_RPC_RESULT result = { }; |
| 1765 | 1737 | ||
| 1766 | EXTERN_C BAAPI UserExperienceOnExecutePatchTarget( | 1738 | // args.cbSize = sizeof(args); |
| 1767 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1739 | // args.wzPackageId = wzPackageId; |
| 1768 | __in_z LPCWSTR wzPackageId, | 1740 | // args.dwProgressPercentage = dwProgressPercentage; |
| 1769 | __in_z LPCWSTR wzTargetProductCode | 1741 | // args.dwOverallPercentage = dwOverallPercentage; |
| 1770 | ) | 1742 | |
| 1771 | { | 1743 | // results.cbSize = sizeof(results); |
| 1772 | HRESULT hr = S_OK; | 1744 | |
| 1773 | BA_ONEXECUTEPATCHTARGET_ARGS args = { }; | 1745 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, args.cbSize, &result); |
| 1774 | BA_ONEXECUTEPATCHTARGET_RESULTS results = { }; | 1746 | // ExitOnFailure(hr, "BA OnExecuteProgress failed."); |
| 1775 | 1747 | ||
| 1776 | args.cbSize = sizeof(args); | 1748 | // LExit: |
| 1777 | args.wzPackageId = wzPackageId; | 1749 | // if (FAILED(hr)) |
| 1778 | args.wzTargetProductCode = wzTargetProductCode; | 1750 | // { |
| 1779 | 1751 | // *pnResult = IDERROR; | |
| 1780 | results.cbSize = sizeof(results); | 1752 | // } |
| 1781 | 1753 | // else if (results.fCancel) | |
| 1782 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, &results); | 1754 | // { |
| 1783 | ExitOnFailure(hr, "BA OnExecutePatchTarget failed."); | 1755 | // *pnResult = IDCANCEL; |
| 1784 | 1756 | // } | |
| 1785 | if (results.fCancel) | 1757 | // else |
| 1786 | { | 1758 | // { |
| 1787 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1759 | // *pnResult = IDNOACTION; |
| 1788 | } | 1760 | // } |
| 1789 | 1761 | // return hr; | |
| 1790 | LExit: | 1762 | // } |
| 1791 | return hr; | 1763 | |
| 1792 | } | 1764 | // EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeBegin( |
| 1793 | 1765 | // __in BURN_USER_EXPERIENCE* pUserExperience | |
| 1794 | BAAPI UserExperienceOnExecuteProcessCancel( | 1766 | // ) |
| 1795 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1767 | // { |
| 1796 | __in_z LPCWSTR wzPackageId, | 1768 | // HRESULT hr = S_OK; |
| 1797 | __in DWORD dwProcessId, | 1769 | // BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS args = { }; |
| 1798 | __inout BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION* pAction | 1770 | // BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS results = { }; |
| 1799 | ) | 1771 | // PIPE_RPC_RESULT result = { }; |
| 1800 | { | 1772 | |
| 1801 | HRESULT hr = S_OK; | 1773 | // args.cbSize = sizeof(args); |
| 1802 | BA_ONEXECUTEPROCESSCANCEL_ARGS args = { }; | 1774 | |
| 1803 | BA_ONEXECUTEPROCESSCANCEL_RESULTS results = { }; | 1775 | // results.cbSize = sizeof(results); |
| 1804 | 1776 | ||
| 1805 | args.cbSize = sizeof(args); | 1777 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, args.cbSize, &result); |
| 1806 | args.wzPackageId = wzPackageId; | 1778 | // ExitOnFailure(hr, "BA OnLaunchApprovedExeBegin failed."); |
| 1807 | args.dwProcessId = dwProcessId; | 1779 | |
| 1808 | args.recommendation = *pAction; | 1780 | // if (results.fCancel) |
| 1809 | 1781 | // { | |
| 1810 | results.cbSize = sizeof(results); | 1782 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1811 | results.action = *pAction; | 1783 | // } |
| 1812 | 1784 | ||
| 1813 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL, &args, &results); | 1785 | // LExit: |
| 1814 | ExitOnFailure(hr, "BA OnExecuteProcessCancel failed."); | 1786 | // return hr; |
| 1815 | 1787 | // } | |
| 1816 | *pAction = results.action; | 1788 | |
| 1817 | 1789 | // EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeComplete( | |
| 1818 | LExit: | 1790 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1819 | return hr; | 1791 | // __in HRESULT hrStatus, |
| 1820 | } | 1792 | // __in DWORD dwProcessId |
| 1821 | 1793 | // ) | |
| 1822 | EXTERN_C BAAPI UserExperienceOnExecuteProgress( | 1794 | // { |
| 1823 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1795 | // HRESULT hr = S_OK; |
| 1824 | __in_z LPCWSTR wzPackageId, | 1796 | // BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS args = { }; |
| 1825 | __in DWORD dwProgressPercentage, | 1797 | // BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS results = { }; |
| 1826 | __in DWORD dwOverallPercentage, | 1798 | // PIPE_RPC_RESULT result = { }; |
| 1827 | __out int* pnResult | 1799 | |
| 1828 | ) | 1800 | // args.cbSize = sizeof(args); |
| 1829 | { | 1801 | // args.hrStatus = hrStatus; |
| 1830 | HRESULT hr = S_OK; | 1802 | // args.dwProcessId = dwProcessId; |
| 1831 | BA_ONEXECUTEPROGRESS_ARGS args = { }; | 1803 | |
| 1832 | BA_ONEXECUTEPROGRESS_RESULTS results = { }; | 1804 | // results.cbSize = sizeof(results); |
| 1833 | 1805 | ||
| 1834 | args.cbSize = sizeof(args); | 1806 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, args.cbSize, &result); |
| 1835 | args.wzPackageId = wzPackageId; | 1807 | // ExitOnFailure(hr, "BA OnLaunchApprovedExeComplete failed."); |
| 1836 | args.dwProgressPercentage = dwProgressPercentage; | 1808 | |
| 1837 | args.dwOverallPercentage = dwOverallPercentage; | 1809 | // LExit: |
| 1838 | 1810 | // return hr; | |
| 1839 | results.cbSize = sizeof(results); | 1811 | // } |
| 1840 | 1812 | ||
| 1841 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, &results); | 1813 | // EXTERN_C BAAPI UserExperienceOnPauseAUBegin( |
| 1842 | ExitOnFailure(hr, "BA OnExecuteProgress failed."); | 1814 | // __in BURN_USER_EXPERIENCE* pUserExperience |
| 1843 | 1815 | // ) | |
| 1844 | LExit: | 1816 | // { |
| 1845 | if (FAILED(hr)) | 1817 | // HRESULT hr = S_OK; |
| 1846 | { | 1818 | // BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS args = { }; |
| 1847 | *pnResult = IDERROR; | 1819 | // BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS results = { }; |
| 1848 | } | 1820 | // PIPE_RPC_RESULT result = { }; |
| 1849 | else if (results.fCancel) | 1821 | |
| 1850 | { | 1822 | // args.cbSize = sizeof(args); |
| 1851 | *pnResult = IDCANCEL; | 1823 | |
| 1852 | } | 1824 | // results.cbSize = sizeof(results); |
| 1853 | else | 1825 | |
| 1854 | { | 1826 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, args.cbSize, &result); |
| 1855 | *pnResult = IDNOACTION; | 1827 | // ExitOnFailure(hr, "BA OnPauseAUBegin failed."); |
| 1856 | } | 1828 | |
| 1857 | return hr; | 1829 | // LExit: |
| 1858 | } | 1830 | // return hr; |
| 1859 | 1831 | // } | |
| 1860 | EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeBegin( | 1832 | |
| 1861 | __in BURN_USER_EXPERIENCE* pUserExperience | 1833 | // EXTERN_C BAAPI UserExperienceOnPauseAUComplete( |
| 1862 | ) | 1834 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1863 | { | 1835 | // __in HRESULT hrStatus |
| 1864 | HRESULT hr = S_OK; | 1836 | // ) |
| 1865 | BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS args = { }; | 1837 | // { |
| 1866 | BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS results = { }; | 1838 | // HRESULT hr = S_OK; |
| 1867 | 1839 | // BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS args = { }; | |
| 1868 | args.cbSize = sizeof(args); | 1840 | // BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS results = { }; |
| 1869 | 1841 | // PIPE_RPC_RESULT result = { }; | |
| 1870 | results.cbSize = sizeof(results); | 1842 | |
| 1871 | 1843 | // args.cbSize = sizeof(args); | |
| 1872 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, &results); | 1844 | // args.hrStatus = hrStatus; |
| 1873 | ExitOnFailure(hr, "BA OnLaunchApprovedExeBegin failed."); | 1845 | |
| 1874 | 1846 | // results.cbSize = sizeof(results); | |
| 1875 | if (results.fCancel) | 1847 | |
| 1876 | { | 1848 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, args.cbSize, &result); |
| 1877 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1849 | // ExitOnFailure(hr, "BA OnPauseAUComplete failed."); |
| 1878 | } | 1850 | |
| 1879 | 1851 | // LExit: | |
| 1880 | LExit: | 1852 | // return hr; |
| 1881 | return hr; | 1853 | // } |
| 1882 | } | 1854 | |
| 1883 | 1855 | // EXTERN_C BAAPI UserExperienceOnPlanBegin( | |
| 1884 | EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeComplete( | 1856 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1885 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1857 | // __in DWORD cPackages |
| 1886 | __in HRESULT hrStatus, | 1858 | // ) |
| 1887 | __in DWORD dwProcessId | 1859 | // { |
| 1888 | ) | 1860 | // HRESULT hr = S_OK; |
| 1889 | { | 1861 | // BA_ONPLANBEGIN_ARGS args = { }; |
| 1890 | HRESULT hr = S_OK; | 1862 | // BA_ONPLANBEGIN_RESULTS results = { }; |
| 1891 | BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS args = { }; | 1863 | // PIPE_RPC_RESULT result = { }; |
| 1892 | BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS results = { }; | 1864 | |
| 1893 | 1865 | // args.cbSize = sizeof(args); | |
| 1894 | args.cbSize = sizeof(args); | 1866 | // args.cPackages = cPackages; |
| 1895 | args.hrStatus = hrStatus; | 1867 | |
| 1896 | args.dwProcessId = dwProcessId; | 1868 | // results.cbSize = sizeof(results); |
| 1897 | 1869 | ||
| 1898 | results.cbSize = sizeof(results); | 1870 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, args.cbSize, &result); |
| 1899 | 1871 | // ExitOnFailure(hr, "BA OnPlanBegin failed."); | |
| 1900 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, &results); | 1872 | |
| 1901 | ExitOnFailure(hr, "BA OnLaunchApprovedExeComplete failed."); | 1873 | // if (results.fCancel) |
| 1902 | 1874 | // { | |
| 1903 | LExit: | 1875 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1904 | return hr; | 1876 | // } |
| 1905 | } | 1877 | |
| 1906 | 1878 | // LExit: | |
| 1907 | EXTERN_C BAAPI UserExperienceOnPauseAUBegin( | 1879 | // return hr; |
| 1908 | __in BURN_USER_EXPERIENCE* pUserExperience | 1880 | // } |
| 1909 | ) | 1881 | |
| 1910 | { | 1882 | // EXTERN_C BAAPI UserExperienceOnPlanCompatibleMsiPackageBegin( |
| 1911 | HRESULT hr = S_OK; | 1883 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1912 | BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS args = { }; | 1884 | // __in_z LPCWSTR wzPackageId, |
| 1913 | BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS results = { }; | 1885 | // __in_z LPCWSTR wzCompatiblePackageId, |
| 1914 | 1886 | // __in VERUTIL_VERSION* pCompatiblePackageVersion, | |
| 1915 | args.cbSize = sizeof(args); | 1887 | // __inout BOOL* pfRequested |
| 1916 | 1888 | // ) | |
| 1917 | results.cbSize = sizeof(results); | 1889 | // { |
| 1918 | 1890 | // HRESULT hr = S_OK; | |
| 1919 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, &results); | 1891 | // BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS args = { }; |
| 1920 | ExitOnFailure(hr, "BA OnPauseAUBegin failed."); | 1892 | // BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS results = { }; |
| 1921 | 1893 | // PIPE_RPC_RESULT result = { }; | |
| 1922 | LExit: | 1894 | |
| 1923 | return hr; | 1895 | // args.cbSize = sizeof(args); |
| 1924 | } | 1896 | // args.wzPackageId = wzPackageId; |
| 1925 | 1897 | // args.wzCompatiblePackageId = wzCompatiblePackageId; | |
| 1926 | EXTERN_C BAAPI UserExperienceOnPauseAUComplete( | 1898 | // args.wzCompatiblePackageVersion = pCompatiblePackageVersion->sczVersion; |
| 1927 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1899 | // args.fRecommendedRemove = *pfRequested; |
| 1928 | __in HRESULT hrStatus | 1900 | |
| 1929 | ) | 1901 | // results.cbSize = sizeof(results); |
| 1930 | { | 1902 | // results.fRequestRemove = *pfRequested; |
| 1931 | HRESULT hr = S_OK; | 1903 | |
| 1932 | BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS args = { }; | 1904 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &args, args.cbSize, &result); |
| 1933 | BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS results = { }; | 1905 | // ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageBegin failed."); |
| 1934 | 1906 | ||
| 1935 | args.cbSize = sizeof(args); | 1907 | // if (results.fCancel) |
| 1936 | args.hrStatus = hrStatus; | 1908 | // { |
| 1937 | 1909 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 1938 | results.cbSize = sizeof(results); | 1910 | // } |
| 1939 | 1911 | // *pfRequested = results.fRequestRemove; | |
| 1940 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, &results); | 1912 | |
| 1941 | ExitOnFailure(hr, "BA OnPauseAUComplete failed."); | 1913 | // LExit: |
| 1942 | 1914 | // return hr; | |
| 1943 | LExit: | 1915 | // } |
| 1944 | return hr; | 1916 | |
| 1945 | } | 1917 | // EXTERN_C BAAPI UserExperienceOnPlanCompatibleMsiPackageComplete( |
| 1946 | 1918 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 1947 | EXTERN_C BAAPI UserExperienceOnPlanBegin( | 1919 | // __in_z LPCWSTR wzPackageId, |
| 1948 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1920 | // __in_z LPCWSTR wzCompatiblePackageId, |
| 1949 | __in DWORD cPackages | 1921 | // __in HRESULT hrStatus, |
| 1950 | ) | 1922 | // __in BOOL fRequested |
| 1951 | { | 1923 | // ) |
| 1952 | HRESULT hr = S_OK; | 1924 | // { |
| 1953 | BA_ONPLANBEGIN_ARGS args = { }; | 1925 | // HRESULT hr = S_OK; |
| 1954 | BA_ONPLANBEGIN_RESULTS results = { }; | 1926 | // BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS args = { }; |
| 1955 | 1927 | // BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS results = { }; | |
| 1956 | args.cbSize = sizeof(args); | 1928 | // PIPE_RPC_RESULT result = { }; |
| 1957 | args.cPackages = cPackages; | 1929 | |
| 1958 | 1930 | // args.cbSize = sizeof(args); | |
| 1959 | results.cbSize = sizeof(results); | 1931 | // args.wzPackageId = wzPackageId; |
| 1960 | 1932 | // args.wzCompatiblePackageId = wzCompatiblePackageId; | |
| 1961 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, &results); | 1933 | // args.hrStatus = hrStatus; |
| 1962 | ExitOnFailure(hr, "BA OnPlanBegin failed."); | 1934 | // args.fRequestedRemove = fRequested; |
| 1963 | 1935 | ||
| 1964 | if (results.fCancel) | 1936 | // results.cbSize = sizeof(results); |
| 1965 | { | 1937 | |
| 1966 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1938 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &args, args.cbSize, &result); |
| 1967 | } | 1939 | // ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageComplete failed."); |
| 1968 | 1940 | ||
| 1969 | LExit: | 1941 | // LExit: |
| 1970 | return hr; | 1942 | // return hr; |
| 1971 | } | 1943 | // } |
| 1972 | 1944 | ||
| 1973 | EXTERN_C BAAPI UserExperienceOnPlanCompatibleMsiPackageBegin( | 1945 | // EXTERN_C BAAPI UserExperienceOnPlanMsiFeature( |
| 1974 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1946 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 1975 | __in_z LPCWSTR wzPackageId, | 1947 | // __in_z LPCWSTR wzPackageId, |
| 1976 | __in_z LPCWSTR wzCompatiblePackageId, | 1948 | // __in_z LPCWSTR wzFeatureId, |
| 1977 | __in VERUTIL_VERSION* pCompatiblePackageVersion, | 1949 | // __inout BOOTSTRAPPER_FEATURE_STATE* pRequestedState |
| 1978 | __inout BOOL* pfRequested | 1950 | // ) |
| 1979 | ) | 1951 | // { |
| 1980 | { | 1952 | // HRESULT hr = S_OK; |
| 1981 | HRESULT hr = S_OK; | 1953 | // BA_ONPLANMSIFEATURE_ARGS args = { }; |
| 1982 | BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS args = { }; | 1954 | // BA_ONPLANMSIFEATURE_RESULTS results = { }; |
| 1983 | BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS results = { }; | 1955 | // PIPE_RPC_RESULT result = { }; |
| 1984 | 1956 | ||
| 1985 | args.cbSize = sizeof(args); | 1957 | // args.cbSize = sizeof(args); |
| 1986 | args.wzPackageId = wzPackageId; | 1958 | // args.wzPackageId = wzPackageId; |
| 1987 | args.wzCompatiblePackageId = wzCompatiblePackageId; | 1959 | // args.wzFeatureId = wzFeatureId; |
| 1988 | args.wzCompatiblePackageVersion = pCompatiblePackageVersion->sczVersion; | 1960 | // args.recommendedState = *pRequestedState; |
| 1989 | args.fRecommendedRemove = *pfRequested; | 1961 | |
| 1990 | 1962 | // results.cbSize = sizeof(results); | |
| 1991 | results.cbSize = sizeof(results); | 1963 | // results.requestedState = *pRequestedState; |
| 1992 | results.fRequestRemove = *pfRequested; | 1964 | |
| 1993 | 1965 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, args.cbSize, &result); | |
| 1994 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &args, &results); | 1966 | // ExitOnFailure(hr, "BA OnPlanMsiFeature failed."); |
| 1995 | ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageBegin failed."); | 1967 | |
| 1996 | 1968 | // if (results.fCancel) | |
| 1997 | if (results.fCancel) | 1969 | // { |
| 1998 | { | 1970 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 1999 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 1971 | // } |
| 2000 | } | 1972 | // *pRequestedState = results.requestedState; |
| 2001 | *pfRequested = results.fRequestRemove; | 1973 | |
| 2002 | 1974 | // LExit: | |
| 2003 | LExit: | 1975 | // return hr; |
| 2004 | return hr; | 1976 | // } |
| 2005 | } | 1977 | |
| 2006 | 1978 | // EXTERN_C BAAPI UserExperienceOnPlanComplete( | |
| 2007 | EXTERN_C BAAPI UserExperienceOnPlanCompatibleMsiPackageComplete( | 1979 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2008 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1980 | // __in HRESULT hrStatus |
| 2009 | __in_z LPCWSTR wzPackageId, | 1981 | // ) |
| 2010 | __in_z LPCWSTR wzCompatiblePackageId, | 1982 | // { |
| 2011 | __in HRESULT hrStatus, | 1983 | // HRESULT hr = S_OK; |
| 2012 | __in BOOL fRequested | 1984 | // BA_ONPLANCOMPLETE_ARGS args = { }; |
| 2013 | ) | 1985 | // BA_ONPLANCOMPLETE_RESULTS results = { }; |
| 2014 | { | 1986 | // PIPE_RPC_RESULT result = { }; |
| 2015 | HRESULT hr = S_OK; | 1987 | |
| 2016 | BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS args = { }; | 1988 | // args.cbSize = sizeof(args); |
| 2017 | BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS results = { }; | 1989 | // args.hrStatus = hrStatus; |
| 2018 | 1990 | ||
| 2019 | args.cbSize = sizeof(args); | 1991 | // results.cbSize = sizeof(results); |
| 2020 | args.wzPackageId = wzPackageId; | 1992 | |
| 2021 | args.wzCompatiblePackageId = wzCompatiblePackageId; | 1993 | // hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, args.cbSize, &result); |
| 2022 | args.hrStatus = hrStatus; | 1994 | // ExitOnFailure(hr, "BA OnPlanComplete failed."); |
| 2023 | args.fRequestedRemove = fRequested; | 1995 | |
| 2024 | 1996 | // LExit: | |
| 2025 | results.cbSize = sizeof(results); | 1997 | // return hr; |
| 2026 | 1998 | // } | |
| 2027 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &args, &results); | 1999 | |
| 2028 | ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageComplete failed."); | 2000 | // EXTERN_C BAAPI UserExperienceOnPlanForwardCompatibleBundle( |
| 2029 | 2001 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 2030 | LExit: | 2002 | // __in_z LPCWSTR wzBundleId, |
| 2031 | return hr; | 2003 | // __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 2032 | } | 2004 | // __in_z LPCWSTR wzBundleTag, |
| 2033 | 2005 | // __in BOOL fPerMachine, | |
| 2034 | EXTERN_C BAAPI UserExperienceOnPlanMsiFeature( | 2006 | // __in VERUTIL_VERSION* pVersion, |
| 2035 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2007 | // __inout BOOL* pfIgnoreBundle |
| 2036 | __in_z LPCWSTR wzPackageId, | 2008 | // ) |
| 2037 | __in_z LPCWSTR wzFeatureId, | 2009 | // { |
| 2038 | __inout BOOTSTRAPPER_FEATURE_STATE* pRequestedState | 2010 | // HRESULT hr = S_OK; |
| 2039 | ) | 2011 | // BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; |
| 2040 | { | 2012 | // BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; |
| 2041 | HRESULT hr = S_OK; | 2013 | // PIPE_RPC_RESULT result = { }; |
| 2042 | BA_ONPLANMSIFEATURE_ARGS args = { }; | 2014 | |
| 2043 | BA_ONPLANMSIFEATURE_RESULTS results = { }; | 2015 | // args.cbSize = sizeof(args); |
| 2044 | 2016 | // args.wzBundleId = wzBundleId; | |
| 2045 | args.cbSize = sizeof(args); | 2017 | // args.relationType = relationType; |
| 2046 | args.wzPackageId = wzPackageId; | 2018 | // args.wzBundleTag = wzBundleTag; |
| 2047 | args.wzFeatureId = wzFeatureId; | 2019 | // args.fPerMachine = fPerMachine; |
| 2048 | args.recommendedState = *pRequestedState; | 2020 | // args.wzVersion = pVersion->sczVersion; |
| 2049 | 2021 | // args.fRecommendedIgnoreBundle = *pfIgnoreBundle; | |
| 2050 | results.cbSize = sizeof(results); | 2022 | |
| 2051 | results.requestedState = *pRequestedState; | 2023 | // results.cbSize = sizeof(results); |
| 2052 | 2024 | // results.fIgnoreBundle = *pfIgnoreBundle; | |
| 2053 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, &results); | 2025 | |
| 2054 | ExitOnFailure(hr, "BA OnPlanMsiFeature failed."); | 2026 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &args, args.cbSize, &result); |
| 2055 | 2027 | // ExitOnFailure(hr, "BA OnPlanForwardCompatibleBundle failed."); | |
| 2056 | if (results.fCancel) | 2028 | |
| 2057 | { | 2029 | // if (results.fCancel) |
| 2058 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2030 | // { |
| 2059 | } | 2031 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2060 | *pRequestedState = results.requestedState; | 2032 | // } |
| 2061 | 2033 | // *pfIgnoreBundle = results.fIgnoreBundle; | |
| 2062 | LExit: | 2034 | |
| 2063 | return hr; | 2035 | // LExit: |
| 2064 | } | 2036 | // return hr; |
| 2065 | 2037 | // } | |
| 2066 | EXTERN_C BAAPI UserExperienceOnPlanComplete( | 2038 | |
| 2067 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2039 | // EXTERN_C BAAPI UserExperienceOnPlanMsiPackage( |
| 2068 | __in HRESULT hrStatus | 2040 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2069 | ) | 2041 | // __in_z LPCWSTR wzPackageId, |
| 2070 | { | 2042 | // __in BOOL fExecute, |
| 2071 | HRESULT hr = S_OK; | 2043 | // __in BOOTSTRAPPER_ACTION_STATE action, |
| 2072 | BA_ONPLANCOMPLETE_ARGS args = { }; | 2044 | // __inout BURN_MSI_PROPERTY* pActionMsiProperty, |
| 2073 | BA_ONPLANCOMPLETE_RESULTS results = { }; | 2045 | // __inout INSTALLUILEVEL* pUiLevel, |
| 2074 | 2046 | // __inout BOOL* pfDisableExternalUiHandler, | |
| 2075 | args.cbSize = sizeof(args); | 2047 | // __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning |
| 2076 | args.hrStatus = hrStatus; | 2048 | // ) |
| 2077 | 2049 | // { | |
| 2078 | results.cbSize = sizeof(results); | 2050 | // HRESULT hr = S_OK; |
| 2079 | 2051 | // BA_ONPLANMSIPACKAGE_ARGS args = { }; | |
| 2080 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, &results); | 2052 | // BA_ONPLANMSIPACKAGE_RESULTS results = { }; |
| 2081 | ExitOnFailure(hr, "BA OnPlanComplete failed."); | 2053 | // PIPE_RPC_RESULT result = { }; |
| 2082 | 2054 | ||
| 2083 | LExit: | 2055 | // args.cbSize = sizeof(args); |
| 2084 | return hr; | 2056 | // args.wzPackageId = wzPackageId; |
| 2085 | } | 2057 | // args.fExecute = fExecute; |
| 2086 | 2058 | // args.action = action; | |
| 2087 | EXTERN_C BAAPI UserExperienceOnPlanForwardCompatibleBundle( | 2059 | // args.recommendedFileVersioning = *pFileVersioning; |
| 2088 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2060 | |
| 2089 | __in_z LPCWSTR wzBundleId, | 2061 | // results.cbSize = sizeof(results); |
| 2090 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 2062 | // results.actionMsiProperty = *pActionMsiProperty; |
| 2091 | __in_z LPCWSTR wzBundleTag, | 2063 | // results.uiLevel = *pUiLevel; |
| 2092 | __in BOOL fPerMachine, | 2064 | // results.fDisableExternalUiHandler = *pfDisableExternalUiHandler; |
| 2093 | __in VERUTIL_VERSION* pVersion, | 2065 | // results.fileVersioning = args.recommendedFileVersioning; |
| 2094 | __inout BOOL* pfIgnoreBundle | 2066 | |
| 2095 | ) | 2067 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, args.cbSize, &result); |
| 2096 | { | 2068 | // ExitOnFailure(hr, "BA OnPlanMsiPackage failed."); |
| 2097 | HRESULT hr = S_OK; | 2069 | |
| 2098 | BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; | 2070 | // if (results.fCancel) |
| 2099 | BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; | 2071 | // { |
| 2100 | 2072 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 2101 | args.cbSize = sizeof(args); | 2073 | // } |
| 2102 | args.wzBundleId = wzBundleId; | 2074 | // *pActionMsiProperty = results.actionMsiProperty; |
| 2103 | args.relationType = relationType; | 2075 | // *pUiLevel = results.uiLevel; |
| 2104 | args.wzBundleTag = wzBundleTag; | 2076 | // *pfDisableExternalUiHandler = results.fDisableExternalUiHandler; |
| 2105 | args.fPerMachine = fPerMachine; | 2077 | // *pFileVersioning = results.fileVersioning; |
| 2106 | args.wzVersion = pVersion->sczVersion; | 2078 | |
| 2107 | args.fRecommendedIgnoreBundle = *pfIgnoreBundle; | 2079 | // LExit: |
| 2108 | 2080 | // return hr; | |
| 2109 | results.cbSize = sizeof(results); | 2081 | // } |
| 2110 | results.fIgnoreBundle = *pfIgnoreBundle; | 2082 | |
| 2111 | 2083 | // EXTERN_C BAAPI UserExperienceOnPlannedCompatiblePackage( | |
| 2112 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &args, &results); | 2084 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2113 | ExitOnFailure(hr, "BA OnPlanForwardCompatibleBundle failed."); | 2085 | // __in_z LPCWSTR wzPackageId, |
| 2114 | 2086 | // __in_z LPCWSTR wzCompatiblePackageId, | |
| 2115 | if (results.fCancel) | 2087 | // __in BOOL fRemove |
| 2116 | { | 2088 | // ) |
| 2117 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2089 | // { |
| 2118 | } | 2090 | // HRESULT hr = S_OK; |
| 2119 | *pfIgnoreBundle = results.fIgnoreBundle; | 2091 | // BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS args = { }; |
| 2120 | 2092 | // BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS results = { }; | |
| 2121 | LExit: | 2093 | // PIPE_RPC_RESULT result = { }; |
| 2122 | return hr; | 2094 | |
| 2123 | } | 2095 | // args.cbSize = sizeof(args); |
| 2124 | 2096 | // args.wzPackageId = wzPackageId; | |
| 2125 | EXTERN_C BAAPI UserExperienceOnPlanMsiPackage( | 2097 | // args.wzCompatiblePackageId = wzCompatiblePackageId; |
| 2126 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2098 | // args.fRemove = fRemove; |
| 2127 | __in_z LPCWSTR wzPackageId, | 2099 | |
| 2128 | __in BOOL fExecute, | 2100 | // results.cbSize = sizeof(results); |
| 2129 | __in BOOTSTRAPPER_ACTION_STATE action, | 2101 | |
| 2130 | __inout BURN_MSI_PROPERTY* pActionMsiProperty, | 2102 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, &args, args.cbSize, &result); |
| 2131 | __inout INSTALLUILEVEL* pUiLevel, | 2103 | // ExitOnFailure(hr, "BA OnPlannedCompatiblePackage failed."); |
| 2132 | __inout BOOL* pfDisableExternalUiHandler, | 2104 | |
| 2133 | __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning | 2105 | // LExit: |
| 2134 | ) | 2106 | // return hr; |
| 2135 | { | 2107 | // } |
| 2136 | HRESULT hr = S_OK; | 2108 | |
| 2137 | BA_ONPLANMSIPACKAGE_ARGS args = { }; | 2109 | // EXTERN_C BAAPI UserExperienceOnPlannedPackage( |
| 2138 | BA_ONPLANMSIPACKAGE_RESULTS results = { }; | 2110 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2139 | 2111 | // __in_z LPCWSTR wzPackageId, | |
| 2140 | args.cbSize = sizeof(args); | 2112 | // __in BOOTSTRAPPER_ACTION_STATE execute, |
| 2141 | args.wzPackageId = wzPackageId; | 2113 | // __in BOOTSTRAPPER_ACTION_STATE rollback, |
| 2142 | args.fExecute = fExecute; | 2114 | // __in BOOL fPlannedCache, |
| 2143 | args.action = action; | 2115 | // __in BOOL fPlannedUncache |
| 2144 | args.recommendedFileVersioning = *pFileVersioning; | 2116 | // ) |
| 2145 | 2117 | // { | |
| 2146 | results.cbSize = sizeof(results); | 2118 | // HRESULT hr = S_OK; |
| 2147 | results.actionMsiProperty = *pActionMsiProperty; | 2119 | // BA_ONPLANNEDPACKAGE_ARGS args = { }; |
| 2148 | results.uiLevel = *pUiLevel; | 2120 | // BA_ONPLANNEDPACKAGE_RESULTS results = { }; |
| 2149 | results.fDisableExternalUiHandler = *pfDisableExternalUiHandler; | 2121 | // PIPE_RPC_RESULT result = { }; |
| 2150 | results.fileVersioning = args.recommendedFileVersioning; | 2122 | |
| 2151 | 2123 | // args.cbSize = sizeof(args); | |
| 2152 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, &results); | 2124 | // args.wzPackageId = wzPackageId; |
| 2153 | ExitOnFailure(hr, "BA OnPlanMsiPackage failed."); | 2125 | // args.execute = execute; |
| 2154 | 2126 | // args.rollback = rollback; | |
| 2155 | if (results.fCancel) | 2127 | // args.fPlannedCache = fPlannedCache; |
| 2156 | { | 2128 | // args.fPlannedUncache = fPlannedUncache; |
| 2157 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2129 | |
| 2158 | } | 2130 | // results.cbSize = sizeof(results); |
| 2159 | *pActionMsiProperty = results.actionMsiProperty; | 2131 | |
| 2160 | *pUiLevel = results.uiLevel; | 2132 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, &args, args.cbSize, &result); |
| 2161 | *pfDisableExternalUiHandler = results.fDisableExternalUiHandler; | 2133 | // ExitOnFailure(hr, "BA OnPlannedPackage failed."); |
| 2162 | *pFileVersioning = results.fileVersioning; | 2134 | |
| 2163 | 2135 | // LExit: | |
| 2164 | LExit: | 2136 | // return hr; |
| 2165 | return hr; | 2137 | // } |
| 2166 | } | 2138 | |
| 2167 | 2139 | // EXTERN_C BAAPI UserExperienceOnPlanPackageBegin( | |
| 2168 | EXTERN_C BAAPI UserExperienceOnPlannedCompatiblePackage( | 2140 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2169 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2141 | // __in_z LPCWSTR wzPackageId, |
| 2170 | __in_z LPCWSTR wzPackageId, | 2142 | // __in BOOTSTRAPPER_PACKAGE_STATE state, |
| 2171 | __in_z LPCWSTR wzCompatiblePackageId, | 2143 | // __in BOOL fCached, |
| 2172 | __in BOOL fRemove | 2144 | // __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, |
| 2173 | ) | 2145 | // __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, |
| 2174 | { | 2146 | // __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, |
| 2175 | HRESULT hr = S_OK; | 2147 | // __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType |
| 2176 | BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS args = { }; | 2148 | // ) |
| 2177 | BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS results = { }; | 2149 | // { |
| 2178 | 2150 | // HRESULT hr = S_OK; | |
| 2179 | args.cbSize = sizeof(args); | 2151 | // BA_ONPLANPACKAGEBEGIN_ARGS args = { }; |
| 2180 | args.wzPackageId = wzPackageId; | 2152 | // BA_ONPLANPACKAGEBEGIN_RESULTS results = { }; |
| 2181 | args.wzCompatiblePackageId = wzCompatiblePackageId; | 2153 | // PIPE_RPC_RESULT result = { }; |
| 2182 | args.fRemove = fRemove; | 2154 | |
| 2183 | 2155 | // args.cbSize = sizeof(args); | |
| 2184 | results.cbSize = sizeof(results); | 2156 | // args.wzPackageId = wzPackageId; |
| 2185 | 2157 | // args.state = state; | |
| 2186 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, &args, &results); | 2158 | // args.fCached = fCached; |
| 2187 | ExitOnFailure(hr, "BA OnPlannedCompatiblePackage failed."); | 2159 | // args.installCondition = installCondition; |
| 2188 | 2160 | // args.repairCondition = repairCondition; | |
| 2189 | LExit: | 2161 | // args.recommendedState = *pRequestedState; |
| 2190 | return hr; | 2162 | // args.recommendedCacheType = *pRequestedCacheType; |
| 2191 | } | 2163 | |
| 2192 | 2164 | // results.cbSize = sizeof(results); | |
| 2193 | EXTERN_C BAAPI UserExperienceOnPlannedPackage( | 2165 | // results.requestedState = *pRequestedState; |
| 2194 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2166 | // results.requestedCacheType = *pRequestedCacheType; |
| 2195 | __in_z LPCWSTR wzPackageId, | 2167 | |
| 2196 | __in BOOTSTRAPPER_ACTION_STATE execute, | 2168 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, args.cbSize, &result); |
| 2197 | __in BOOTSTRAPPER_ACTION_STATE rollback, | 2169 | // ExitOnFailure(hr, "BA OnPlanPackageBegin failed."); |
| 2198 | __in BOOL fPlannedCache, | 2170 | |
| 2199 | __in BOOL fPlannedUncache | 2171 | // if (results.fCancel) |
| 2200 | ) | 2172 | // { |
| 2201 | { | 2173 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2202 | HRESULT hr = S_OK; | 2174 | // } |
| 2203 | BA_ONPLANNEDPACKAGE_ARGS args = { }; | 2175 | // *pRequestedState = results.requestedState; |
| 2204 | BA_ONPLANNEDPACKAGE_RESULTS results = { }; | 2176 | |
| 2205 | 2177 | // if (BOOTSTRAPPER_CACHE_TYPE_REMOVE <= results.requestedCacheType && BOOTSTRAPPER_CACHE_TYPE_FORCE >= results.requestedCacheType) | |
| 2206 | args.cbSize = sizeof(args); | 2178 | // { |
| 2207 | args.wzPackageId = wzPackageId; | 2179 | // *pRequestedCacheType = results.requestedCacheType; |
| 2208 | args.execute = execute; | 2180 | // } |
| 2209 | args.rollback = rollback; | 2181 | |
| 2210 | args.fPlannedCache = fPlannedCache; | 2182 | // LExit: |
| 2211 | args.fPlannedUncache = fPlannedUncache; | 2183 | // return hr; |
| 2212 | 2184 | // } | |
| 2213 | results.cbSize = sizeof(results); | 2185 | |
| 2214 | 2186 | // EXTERN_C BAAPI UserExperienceOnPlanPackageComplete( | |
| 2215 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, &args, &results); | 2187 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2216 | ExitOnFailure(hr, "BA OnPlannedPackage failed."); | 2188 | // __in_z LPCWSTR wzPackageId, |
| 2217 | 2189 | // __in HRESULT hrStatus, | |
| 2218 | LExit: | 2190 | // __in BOOTSTRAPPER_REQUEST_STATE requested |
| 2219 | return hr; | 2191 | // ) |
| 2220 | } | 2192 | // { |
| 2221 | 2193 | // HRESULT hr = S_OK; | |
| 2222 | EXTERN_C BAAPI UserExperienceOnPlanPackageBegin( | 2194 | // BA_ONPLANPACKAGECOMPLETE_ARGS args = { }; |
| 2223 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2195 | // BA_ONPLANPACKAGECOMPLETE_RESULTS results = { }; |
| 2224 | __in_z LPCWSTR wzPackageId, | 2196 | // PIPE_RPC_RESULT result = { }; |
| 2225 | __in BOOTSTRAPPER_PACKAGE_STATE state, | 2197 | |
| 2226 | __in BOOL fCached, | 2198 | // args.cbSize = sizeof(args); |
| 2227 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | 2199 | // args.wzPackageId = wzPackageId; |
| 2228 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | 2200 | // args.hrStatus = hrStatus; |
| 2229 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | 2201 | // args.requested = requested; |
| 2230 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType | 2202 | |
| 2231 | ) | 2203 | // results.cbSize = sizeof(results); |
| 2232 | { | 2204 | |
| 2233 | HRESULT hr = S_OK; | 2205 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, args.cbSize, &result); |
| 2234 | BA_ONPLANPACKAGEBEGIN_ARGS args = { }; | 2206 | // ExitOnFailure(hr, "BA OnPlanPackageComplete failed."); |
| 2235 | BA_ONPLANPACKAGEBEGIN_RESULTS results = { }; | 2207 | |
| 2236 | 2208 | // LExit: | |
| 2237 | args.cbSize = sizeof(args); | 2209 | // return hr; |
| 2238 | args.wzPackageId = wzPackageId; | 2210 | // } |
| 2239 | args.state = state; | 2211 | |
| 2240 | args.fCached = fCached; | 2212 | // EXTERN_C BAAPI UserExperienceOnPlanRelatedBundle( |
| 2241 | args.installCondition = installCondition; | 2213 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2242 | args.repairCondition = repairCondition; | 2214 | // __in_z LPCWSTR wzBundleId, |
| 2243 | args.recommendedState = *pRequestedState; | 2215 | // __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState |
| 2244 | args.recommendedCacheType = *pRequestedCacheType; | 2216 | // ) |
| 2245 | 2217 | // { | |
| 2246 | results.cbSize = sizeof(results); | 2218 | // HRESULT hr = S_OK; |
| 2247 | results.requestedState = *pRequestedState; | 2219 | // BA_ONPLANRELATEDBUNDLE_ARGS args = { }; |
| 2248 | results.requestedCacheType = *pRequestedCacheType; | 2220 | // BA_ONPLANRELATEDBUNDLE_RESULTS results = { }; |
| 2249 | 2221 | // PIPE_RPC_RESULT result = { }; | |
| 2250 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, &results); | 2222 | |
| 2251 | ExitOnFailure(hr, "BA OnPlanPackageBegin failed."); | 2223 | // args.cbSize = sizeof(args); |
| 2252 | 2224 | // args.wzBundleId = wzBundleId; | |
| 2253 | if (results.fCancel) | 2225 | // args.recommendedState = *pRequestedState; |
| 2254 | { | 2226 | |
| 2255 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2227 | // results.cbSize = sizeof(results); |
| 2256 | } | 2228 | // results.requestedState = *pRequestedState; |
| 2257 | *pRequestedState = results.requestedState; | 2229 | |
| 2258 | 2230 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, args.cbSize, &result); | |
| 2259 | if (BOOTSTRAPPER_CACHE_TYPE_REMOVE <= results.requestedCacheType && BOOTSTRAPPER_CACHE_TYPE_FORCE >= results.requestedCacheType) | 2231 | // ExitOnFailure(hr, "BA OnPlanRelatedBundle failed."); |
| 2260 | { | 2232 | |
| 2261 | *pRequestedCacheType = results.requestedCacheType; | 2233 | // if (results.fCancel) |
| 2262 | } | 2234 | // { |
| 2263 | 2235 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | |
| 2264 | LExit: | 2236 | // } |
| 2265 | return hr; | 2237 | // *pRequestedState = results.requestedState; |
| 2266 | } | 2238 | |
| 2267 | 2239 | // LExit: | |
| 2268 | EXTERN_C BAAPI UserExperienceOnPlanPackageComplete( | 2240 | // return hr; |
| 2269 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2241 | // } |
| 2270 | __in_z LPCWSTR wzPackageId, | 2242 | |
| 2271 | __in HRESULT hrStatus, | 2243 | // EXTERN_C BAAPI UserExperienceOnPlanRelatedBundleType( |
| 2272 | __in BOOTSTRAPPER_REQUEST_STATE requested | 2244 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2273 | ) | 2245 | // __in_z LPCWSTR wzBundleId, |
| 2274 | { | 2246 | // __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType |
| 2275 | HRESULT hr = S_OK; | 2247 | // ) |
| 2276 | BA_ONPLANPACKAGECOMPLETE_ARGS args = { }; | 2248 | // { |
| 2277 | BA_ONPLANPACKAGECOMPLETE_RESULTS results = { }; | 2249 | // HRESULT hr = S_OK; |
| 2278 | 2250 | // BA_ONPLANRELATEDBUNDLETYPE_ARGS args = { }; | |
| 2279 | args.cbSize = sizeof(args); | 2251 | // BA_ONPLANRELATEDBUNDLETYPE_RESULTS results = { }; |
| 2280 | args.wzPackageId = wzPackageId; | 2252 | // PIPE_RPC_RESULT result = { }; |
| 2281 | args.hrStatus = hrStatus; | 2253 | |
| 2282 | args.requested = requested; | 2254 | // args.cbSize = sizeof(args); |
| 2283 | 2255 | // args.wzBundleId = wzBundleId; | |
| 2284 | results.cbSize = sizeof(results); | 2256 | // args.recommendedType = *pRequestedType; |
| 2285 | 2257 | ||
| 2286 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, &results); | 2258 | // results.cbSize = sizeof(results); |
| 2287 | ExitOnFailure(hr, "BA OnPlanPackageComplete failed."); | 2259 | // results.requestedType = *pRequestedType; |
| 2288 | 2260 | ||
| 2289 | LExit: | 2261 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, &args, args.cbSize, &result); |
| 2290 | return hr; | 2262 | // ExitOnFailure(hr, "BA OnPlanRelatedBundleType failed."); |
| 2291 | } | 2263 | |
| 2292 | 2264 | // if (results.fCancel) | |
| 2293 | EXTERN_C BAAPI UserExperienceOnPlanRelatedBundle( | 2265 | // { |
| 2294 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2266 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2295 | __in_z LPCWSTR wzBundleId, | 2267 | // } |
| 2296 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | 2268 | // *pRequestedType = results.requestedType; |
| 2297 | ) | 2269 | |
| 2298 | { | 2270 | // LExit: |
| 2299 | HRESULT hr = S_OK; | 2271 | // return hr; |
| 2300 | BA_ONPLANRELATEDBUNDLE_ARGS args = { }; | 2272 | // } |
| 2301 | BA_ONPLANRELATEDBUNDLE_RESULTS results = { }; | 2273 | |
| 2302 | 2274 | // EXTERN_C BAAPI UserExperienceOnPlanRestoreRelatedBundle( | |
| 2303 | args.cbSize = sizeof(args); | 2275 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2304 | args.wzBundleId = wzBundleId; | 2276 | // __in_z LPCWSTR wzBundleId, |
| 2305 | args.recommendedState = *pRequestedState; | 2277 | // __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState |
| 2306 | 2278 | // ) | |
| 2307 | results.cbSize = sizeof(results); | 2279 | // { |
| 2308 | results.requestedState = *pRequestedState; | 2280 | // HRESULT hr = S_OK; |
| 2309 | 2281 | // BA_ONPLANRESTORERELATEDBUNDLE_ARGS args = { }; | |
| 2310 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, &results); | 2282 | // BA_ONPLANRESTORERELATEDBUNDLE_RESULTS results = { }; |
| 2311 | ExitOnFailure(hr, "BA OnPlanRelatedBundle failed."); | 2283 | // PIPE_RPC_RESULT result = { }; |
| 2312 | 2284 | ||
| 2313 | if (results.fCancel) | 2285 | // args.cbSize = sizeof(args); |
| 2314 | { | 2286 | // args.wzBundleId = wzBundleId; |
| 2315 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2287 | // args.recommendedState = *pRequestedState; |
| 2316 | } | 2288 | |
| 2317 | *pRequestedState = results.requestedState; | 2289 | // results.cbSize = sizeof(results); |
| 2318 | 2290 | // results.requestedState = *pRequestedState; | |
| 2319 | LExit: | 2291 | |
| 2320 | return hr; | 2292 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, &args, args.cbSize, &result); |
| 2321 | } | 2293 | // ExitOnFailure(hr, "BA OnPlanRestoreRelatedBundle failed."); |
| 2322 | 2294 | ||
| 2323 | EXTERN_C BAAPI UserExperienceOnPlanRelatedBundleType( | 2295 | // if (results.fCancel) |
| 2324 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2296 | // { |
| 2325 | __in_z LPCWSTR wzBundleId, | 2297 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2326 | __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType | 2298 | // } |
| 2327 | ) | 2299 | // *pRequestedState = results.requestedState; |
| 2328 | { | 2300 | |
| 2329 | HRESULT hr = S_OK; | 2301 | // LExit: |
| 2330 | BA_ONPLANRELATEDBUNDLETYPE_ARGS args = { }; | 2302 | // return hr; |
| 2331 | BA_ONPLANRELATEDBUNDLETYPE_RESULTS results = { }; | 2303 | // } |
| 2332 | 2304 | ||
| 2333 | args.cbSize = sizeof(args); | 2305 | // EXTERN_C BAAPI UserExperienceOnPlanRollbackBoundary( |
| 2334 | args.wzBundleId = wzBundleId; | 2306 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2335 | args.recommendedType = *pRequestedType; | 2307 | // __in_z LPCWSTR wzRollbackBoundaryId, |
| 2336 | 2308 | // __inout BOOL* pfTransaction | |
| 2337 | results.cbSize = sizeof(results); | 2309 | // ) |
| 2338 | results.requestedType = *pRequestedType; | 2310 | // { |
| 2339 | 2311 | // HRESULT hr = S_OK; | |
| 2340 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, &args, &results); | 2312 | // BA_ONPLANROLLBACKBOUNDARY_ARGS args = { }; |
| 2341 | ExitOnFailure(hr, "BA OnPlanRelatedBundleType failed."); | 2313 | // BA_ONPLANROLLBACKBOUNDARY_RESULTS results = { }; |
| 2342 | 2314 | // PIPE_RPC_RESULT result = { }; | |
| 2343 | if (results.fCancel) | 2315 | |
| 2344 | { | 2316 | // args.cbSize = sizeof(args); |
| 2345 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2317 | // args.wzRollbackBoundaryId = wzRollbackBoundaryId; |
| 2346 | } | 2318 | // args.fRecommendedTransaction = *pfTransaction; |
| 2347 | *pRequestedType = results.requestedType; | 2319 | |
| 2348 | 2320 | // results.cbSize = sizeof(results); | |
| 2349 | LExit: | 2321 | // results.fTransaction = *pfTransaction; |
| 2350 | return hr; | 2322 | |
| 2351 | } | 2323 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, &args, args.cbSize, &result); |
| 2352 | 2324 | // ExitOnFailure(hr, "BA OnPlanRollbackBoundary failed."); | |
| 2353 | EXTERN_C BAAPI UserExperienceOnPlanRestoreRelatedBundle( | 2325 | |
| 2354 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2326 | // if (results.fCancel) |
| 2355 | __in_z LPCWSTR wzBundleId, | 2327 | // { |
| 2356 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | 2328 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2357 | ) | 2329 | // } |
| 2358 | { | 2330 | // *pfTransaction = results.fTransaction; |
| 2359 | HRESULT hr = S_OK; | 2331 | |
| 2360 | BA_ONPLANRESTORERELATEDBUNDLE_ARGS args = { }; | 2332 | // LExit: |
| 2361 | BA_ONPLANRESTORERELATEDBUNDLE_RESULTS results = { }; | 2333 | // return hr; |
| 2362 | 2334 | // } | |
| 2363 | args.cbSize = sizeof(args); | 2335 | |
| 2364 | args.wzBundleId = wzBundleId; | 2336 | // EXTERN_C BAAPI UserExperienceOnPlanPatchTarget( |
| 2365 | args.recommendedState = *pRequestedState; | 2337 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2366 | 2338 | // __in_z LPCWSTR wzPackageId, | |
| 2367 | results.cbSize = sizeof(results); | 2339 | // __in_z LPCWSTR wzProductCode, |
| 2368 | results.requestedState = *pRequestedState; | 2340 | // __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState |
| 2369 | 2341 | // ) | |
| 2370 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, &args, &results); | 2342 | // { |
| 2371 | ExitOnFailure(hr, "BA OnPlanRestoreRelatedBundle failed."); | 2343 | // HRESULT hr = S_OK; |
| 2372 | 2344 | // BA_ONPLANPATCHTARGET_ARGS args = { }; | |
| 2373 | if (results.fCancel) | 2345 | // BA_ONPLANPATCHTARGET_RESULTS results = { }; |
| 2374 | { | 2346 | // PIPE_RPC_RESULT result = { }; |
| 2375 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2347 | |
| 2376 | } | 2348 | // args.cbSize = sizeof(args); |
| 2377 | *pRequestedState = results.requestedState; | 2349 | // args.wzPackageId = wzPackageId; |
| 2378 | 2350 | // args.wzProductCode = wzProductCode; | |
| 2379 | LExit: | 2351 | // args.recommendedState = *pRequestedState; |
| 2380 | return hr; | 2352 | |
| 2381 | } | 2353 | // results.cbSize = sizeof(results); |
| 2382 | 2354 | // results.requestedState = *pRequestedState; | |
| 2383 | EXTERN_C BAAPI UserExperienceOnPlanRollbackBoundary( | 2355 | |
| 2384 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2356 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, &args, args.cbSize, &result); |
| 2385 | __in_z LPCWSTR wzRollbackBoundaryId, | 2357 | // ExitOnFailure(hr, "BA OnPlanPatchTarget failed."); |
| 2386 | __inout BOOL* pfTransaction | 2358 | |
| 2387 | ) | 2359 | // if (results.fCancel) |
| 2388 | { | 2360 | // { |
| 2389 | HRESULT hr = S_OK; | 2361 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2390 | BA_ONPLANROLLBACKBOUNDARY_ARGS args = { }; | 2362 | // } |
| 2391 | BA_ONPLANROLLBACKBOUNDARY_RESULTS results = { }; | 2363 | // *pRequestedState = results.requestedState; |
| 2392 | 2364 | ||
| 2393 | args.cbSize = sizeof(args); | 2365 | // LExit: |
| 2394 | args.wzRollbackBoundaryId = wzRollbackBoundaryId; | 2366 | // return hr; |
| 2395 | args.fRecommendedTransaction = *pfTransaction; | 2367 | // } |
| 2396 | 2368 | ||
| 2397 | results.cbSize = sizeof(results); | 2369 | // EXTERN_C BAAPI UserExperienceOnProgress( |
| 2398 | results.fTransaction = *pfTransaction; | 2370 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2399 | 2371 | // __in BOOL fRollback, | |
| 2400 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, &args, &results); | 2372 | // __in DWORD dwProgressPercentage, |
| 2401 | ExitOnFailure(hr, "BA OnPlanRollbackBoundary failed."); | 2373 | // __in DWORD dwOverallPercentage |
| 2402 | 2374 | // ) | |
| 2403 | if (results.fCancel) | 2375 | // { |
| 2404 | { | 2376 | // HRESULT hr = S_OK; |
| 2405 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2377 | // BA_ONPROGRESS_ARGS args = { }; |
| 2406 | } | 2378 | // BA_ONPROGRESS_RESULTS results = { }; |
| 2407 | *pfTransaction = results.fTransaction; | 2379 | // PIPE_RPC_RESULT result = { }; |
| 2408 | 2380 | ||
| 2409 | LExit: | 2381 | // args.cbSize = sizeof(args); |
| 2410 | return hr; | 2382 | // args.dwProgressPercentage = dwProgressPercentage; |
| 2411 | } | 2383 | // args.dwOverallPercentage = dwOverallPercentage; |
| 2412 | 2384 | ||
| 2413 | EXTERN_C BAAPI UserExperienceOnPlanPatchTarget( | 2385 | // results.cbSize = sizeof(results); |
| 2414 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2386 | |
| 2415 | __in_z LPCWSTR wzPackageId, | 2387 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, args.cbSize, &result); |
| 2416 | __in_z LPCWSTR wzProductCode, | 2388 | // hr = FilterExecuteResult(pUserExperience, hr, fRollback, results.fCancel, L"OnProgress"); |
| 2417 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | 2389 | |
| 2418 | ) | 2390 | // return hr; |
| 2419 | { | 2391 | // } |
| 2420 | HRESULT hr = S_OK; | 2392 | |
| 2421 | BA_ONPLANPATCHTARGET_ARGS args = { }; | 2393 | // EXTERN_C BAAPI UserExperienceOnRegisterBegin( |
| 2422 | BA_ONPLANPATCHTARGET_RESULTS results = { }; | 2394 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2423 | 2395 | // __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | |
| 2424 | args.cbSize = sizeof(args); | 2396 | // ) |
| 2425 | args.wzPackageId = wzPackageId; | 2397 | // { |
| 2426 | args.wzProductCode = wzProductCode; | 2398 | // HRESULT hr = S_OK; |
| 2427 | args.recommendedState = *pRequestedState; | 2399 | // BA_ONREGISTERBEGIN_ARGS args = { }; |
| 2428 | 2400 | // BA_ONREGISTERBEGIN_RESULTS results = { }; | |
| 2429 | results.cbSize = sizeof(results); | 2401 | // PIPE_RPC_RESULT result = { }; |
| 2430 | results.requestedState = *pRequestedState; | 2402 | |
| 2431 | 2403 | // args.cbSize = sizeof(args); | |
| 2432 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, &args, &results); | 2404 | // args.recommendedRegistrationType = *pRegistrationType; |
| 2433 | ExitOnFailure(hr, "BA OnPlanPatchTarget failed."); | 2405 | |
| 2434 | 2406 | // results.cbSize = sizeof(results); | |
| 2435 | if (results.fCancel) | 2407 | // results.registrationType = *pRegistrationType; |
| 2436 | { | 2408 | |
| 2437 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2409 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, args.cbSize, &result); |
| 2438 | } | 2410 | // ExitOnFailure(hr, "BA OnRegisterBegin failed."); |
| 2439 | *pRequestedState = results.requestedState; | 2411 | |
| 2440 | 2412 | // if (results.fCancel) | |
| 2441 | LExit: | 2413 | // { |
| 2442 | return hr; | 2414 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2443 | } | 2415 | // } |
| 2444 | 2416 | // else if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE < results.registrationType && BOOTSTRAPPER_REGISTRATION_TYPE_FULL >= results.registrationType) | |
| 2445 | EXTERN_C BAAPI UserExperienceOnProgress( | 2417 | // { |
| 2446 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2418 | // *pRegistrationType = results.registrationType; |
| 2447 | __in BOOL fRollback, | 2419 | // } |
| 2448 | __in DWORD dwProgressPercentage, | 2420 | |
| 2449 | __in DWORD dwOverallPercentage | 2421 | // LExit: |
| 2450 | ) | 2422 | // return hr; |
| 2451 | { | 2423 | // } |
| 2452 | HRESULT hr = S_OK; | 2424 | |
| 2453 | BA_ONPROGRESS_ARGS args = { }; | 2425 | // EXTERN_C BAAPI UserExperienceOnRegisterComplete( |
| 2454 | BA_ONPROGRESS_RESULTS results = { }; | 2426 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2455 | 2427 | // __in HRESULT hrStatus | |
| 2456 | args.cbSize = sizeof(args); | 2428 | // ) |
| 2457 | args.dwProgressPercentage = dwProgressPercentage; | 2429 | // { |
| 2458 | args.dwOverallPercentage = dwOverallPercentage; | 2430 | // HRESULT hr = S_OK; |
| 2459 | 2431 | // BA_ONREGISTERCOMPLETE_ARGS args = { }; | |
| 2460 | results.cbSize = sizeof(results); | 2432 | // BA_ONREGISTERCOMPLETE_RESULTS results = { }; |
| 2461 | 2433 | // PIPE_RPC_RESULT result = { }; | |
| 2462 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, &results); | 2434 | |
| 2463 | hr = FilterExecuteResult(pUserExperience, hr, fRollback, results.fCancel, L"OnProgress"); | 2435 | // args.cbSize = sizeof(args); |
| 2464 | 2436 | // args.hrStatus = hrStatus; | |
| 2465 | return hr; | 2437 | |
| 2466 | } | 2438 | // results.cbSize = sizeof(results); |
| 2467 | 2439 | ||
| 2468 | EXTERN_C BAAPI UserExperienceOnRegisterBegin( | 2440 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, args.cbSize, &result); |
| 2469 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2441 | // ExitOnFailure(hr, "BA OnRegisterComplete failed."); |
| 2470 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | 2442 | |
| 2471 | ) | 2443 | // LExit: |
| 2472 | { | 2444 | // return hr; |
| 2473 | HRESULT hr = S_OK; | 2445 | // } |
| 2474 | BA_ONREGISTERBEGIN_ARGS args = { }; | 2446 | |
| 2475 | BA_ONREGISTERBEGIN_RESULTS results = { }; | 2447 | // EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionBegin( |
| 2476 | 2448 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 2477 | args.cbSize = sizeof(args); | 2449 | // __in LPCWSTR wzTransactionId |
| 2478 | args.recommendedRegistrationType = *pRegistrationType; | 2450 | // ) |
| 2479 | 2451 | // { | |
| 2480 | results.cbSize = sizeof(results); | 2452 | // HRESULT hr = S_OK; |
| 2481 | results.registrationType = *pRegistrationType; | 2453 | // BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS args = { }; |
| 2482 | 2454 | // BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS results = { }; | |
| 2483 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, &results); | 2455 | // PIPE_RPC_RESULT result = { }; |
| 2484 | ExitOnFailure(hr, "BA OnRegisterBegin failed."); | 2456 | |
| 2485 | 2457 | // args.cbSize = sizeof(args); | |
| 2486 | if (results.fCancel) | 2458 | // args.wzTransactionId = wzTransactionId; |
| 2487 | { | 2459 | |
| 2488 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2460 | // results.cbSize = sizeof(results); |
| 2489 | } | 2461 | |
| 2490 | else if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE < results.registrationType && BOOTSTRAPPER_REGISTRATION_TYPE_FULL >= results.registrationType) | 2462 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, args.cbSize, &result); |
| 2491 | { | 2463 | // ExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed."); |
| 2492 | *pRegistrationType = results.registrationType; | 2464 | |
| 2493 | } | 2465 | // LExit: |
| 2494 | 2466 | // return hr; | |
| 2495 | LExit: | 2467 | // } |
| 2496 | return hr; | 2468 | |
| 2497 | } | 2469 | // EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionComplete( |
| 2498 | 2470 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 2499 | EXTERN_C BAAPI UserExperienceOnRegisterComplete( | 2471 | // __in LPCWSTR wzTransactionId, |
| 2500 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2472 | // __in HRESULT hrStatus, |
| 2501 | __in HRESULT hrStatus | 2473 | // __in BOOTSTRAPPER_APPLY_RESTART restart, |
| 2502 | ) | 2474 | // __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION *pAction |
| 2503 | { | 2475 | // ) |
| 2504 | HRESULT hr = S_OK; | 2476 | // { |
| 2505 | BA_ONREGISTERCOMPLETE_ARGS args = { }; | 2477 | // HRESULT hr = S_OK; |
| 2506 | BA_ONREGISTERCOMPLETE_RESULTS results = { }; | 2478 | // BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS args = { }; |
| 2507 | 2479 | // BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS results = { }; | |
| 2508 | args.cbSize = sizeof(args); | 2480 | // PIPE_RPC_RESULT result = { }; |
| 2509 | args.hrStatus = hrStatus; | 2481 | |
| 2510 | 2482 | // args.cbSize = sizeof(args); | |
| 2511 | results.cbSize = sizeof(results); | 2483 | // args.wzTransactionId = wzTransactionId; |
| 2512 | 2484 | // args.hrStatus = hrStatus; | |
| 2513 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, &results); | 2485 | // args.restart = restart; |
| 2514 | ExitOnFailure(hr, "BA OnRegisterComplete failed."); | 2486 | // args.recommendation = *pAction; |
| 2515 | 2487 | ||
| 2516 | LExit: | 2488 | // results.cbSize = sizeof(results); |
| 2517 | return hr; | 2489 | // results.action = *pAction; |
| 2518 | } | 2490 | |
| 2519 | 2491 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, args.cbSize, &result); | |
| 2520 | EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionBegin( | 2492 | // ExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed."); |
| 2521 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2493 | |
| 2522 | __in LPCWSTR wzTransactionId | 2494 | // *pAction = results.action; |
| 2523 | ) | 2495 | |
| 2524 | { | 2496 | // LExit: |
| 2525 | HRESULT hr = S_OK; | 2497 | // return hr; |
| 2526 | BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS args = { }; | 2498 | // } |
| 2527 | BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS results = { }; | 2499 | |
| 2528 | 2500 | // EXTERN_C BAAPI UserExperienceOnSetUpdateBegin( | |
| 2529 | args.cbSize = sizeof(args); | 2501 | // __in BURN_USER_EXPERIENCE* pUserExperience |
| 2530 | args.wzTransactionId = wzTransactionId; | 2502 | // ) |
| 2531 | 2503 | // { | |
| 2532 | results.cbSize = sizeof(results); | 2504 | // HRESULT hr = S_OK; |
| 2533 | 2505 | // BA_ONSETUPDATEBEGIN_ARGS args = { }; | |
| 2534 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results); | 2506 | // BA_ONSETUPDATEBEGIN_RESULTS results = { }; |
| 2535 | ExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed."); | 2507 | // PIPE_RPC_RESULT result = { }; |
| 2536 | 2508 | ||
| 2537 | LExit: | 2509 | // args.cbSize = sizeof(args); |
| 2538 | return hr; | 2510 | |
| 2539 | } | 2511 | // results.cbSize = sizeof(results); |
| 2540 | 2512 | ||
| 2541 | EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionComplete( | 2513 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATEBEGIN, &args, args.cbSize, &result); |
| 2542 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2514 | // ExitOnFailure(hr, "BA OnSetUpdateBegin failed."); |
| 2543 | __in LPCWSTR wzTransactionId, | 2515 | |
| 2544 | __in HRESULT hrStatus, | 2516 | // LExit: |
| 2545 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 2517 | // return hr; |
| 2546 | __inout BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION *pAction | 2518 | // } |
| 2547 | ) | 2519 | |
| 2548 | { | 2520 | // EXTERN_C BAAPI UserExperienceOnSetUpdateComplete( |
| 2549 | HRESULT hr = S_OK; | 2521 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2550 | BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS args = { }; | 2522 | // __in HRESULT hrStatus, |
| 2551 | BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS results = { }; | 2523 | // __in_z_opt LPCWSTR wzPreviousPackageId, |
| 2552 | 2524 | // __in_z_opt LPCWSTR wzNewPackageId | |
| 2553 | args.cbSize = sizeof(args); | 2525 | // ) |
| 2554 | args.wzTransactionId = wzTransactionId; | 2526 | // { |
| 2555 | args.hrStatus = hrStatus; | 2527 | // HRESULT hr = S_OK; |
| 2556 | args.restart = restart; | 2528 | // BA_ONSETUPDATECOMPLETE_ARGS args = { }; |
| 2557 | args.recommendation = *pAction; | 2529 | // BA_ONSETUPDATECOMPLETE_RESULTS results = { }; |
| 2558 | 2530 | // PIPE_RPC_RESULT result = { }; | |
| 2559 | results.cbSize = sizeof(results); | 2531 | |
| 2560 | results.action = *pAction; | 2532 | // args.cbSize = sizeof(args); |
| 2561 | 2533 | // args.hrStatus = hrStatus; | |
| 2562 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results); | 2534 | // args.wzPreviousPackageId = wzPreviousPackageId; |
| 2563 | ExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed."); | 2535 | // args.wzNewPackageId = wzNewPackageId; |
| 2564 | 2536 | ||
| 2565 | *pAction = results.action; | 2537 | // results.cbSize = sizeof(results); |
| 2566 | 2538 | ||
| 2567 | LExit: | 2539 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATECOMPLETE, &args, args.cbSize, &result); |
| 2568 | return hr; | 2540 | // ExitOnFailure(hr, "BA OnSetUpdateComplete failed."); |
| 2569 | } | 2541 | |
| 2570 | 2542 | // LExit: | |
| 2571 | EXTERN_C BAAPI UserExperienceOnSetUpdateBegin( | 2543 | // return hr; |
| 2572 | __in BURN_USER_EXPERIENCE* pUserExperience | 2544 | // } |
| 2573 | ) | 2545 | |
| 2574 | { | 2546 | // EXTERN_C BAAPI UserExperienceOnSystemRestorePointBegin( |
| 2575 | HRESULT hr = S_OK; | 2547 | // __in BURN_USER_EXPERIENCE* pUserExperience |
| 2576 | BA_ONSETUPDATEBEGIN_ARGS args = { }; | 2548 | // ) |
| 2577 | BA_ONSETUPDATEBEGIN_RESULTS results = { }; | 2549 | // { |
| 2578 | 2550 | // HRESULT hr = S_OK; | |
| 2579 | args.cbSize = sizeof(args); | 2551 | // BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS args = { }; |
| 2580 | 2552 | // BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS results = { }; | |
| 2581 | results.cbSize = sizeof(results); | 2553 | // PIPE_RPC_RESULT result = { }; |
| 2582 | 2554 | ||
| 2583 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATEBEGIN, &args, &results); | 2555 | // args.cbSize = sizeof(args); |
| 2584 | ExitOnFailure(hr, "BA OnSetUpdateBegin failed."); | 2556 | |
| 2585 | 2557 | // results.cbSize = sizeof(results); | |
| 2586 | LExit: | 2558 | |
| 2587 | return hr; | 2559 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, args.cbSize, &result); |
| 2588 | } | 2560 | // ExitOnFailure(hr, "BA OnSystemRestorePointBegin failed."); |
| 2589 | 2561 | ||
| 2590 | EXTERN_C BAAPI UserExperienceOnSetUpdateComplete( | 2562 | // LExit: |
| 2591 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2563 | // return hr; |
| 2592 | __in HRESULT hrStatus, | 2564 | // } |
| 2593 | __in_z_opt LPCWSTR wzPreviousPackageId, | 2565 | |
| 2594 | __in_z_opt LPCWSTR wzNewPackageId | 2566 | // EXTERN_C BAAPI UserExperienceOnSystemRestorePointComplete( |
| 2595 | ) | 2567 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2596 | { | 2568 | // __in HRESULT hrStatus |
| 2597 | HRESULT hr = S_OK; | 2569 | // ) |
| 2598 | BA_ONSETUPDATECOMPLETE_ARGS args = { }; | 2570 | // { |
| 2599 | BA_ONSETUPDATECOMPLETE_RESULTS results = { }; | 2571 | // HRESULT hr = S_OK; |
| 2600 | 2572 | // BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS args = { }; | |
| 2601 | args.cbSize = sizeof(args); | 2573 | // BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS results = { }; |
| 2602 | args.hrStatus = hrStatus; | 2574 | // PIPE_RPC_RESULT result = { }; |
| 2603 | args.wzPreviousPackageId = wzPreviousPackageId; | 2575 | |
| 2604 | args.wzNewPackageId = wzNewPackageId; | 2576 | // args.cbSize = sizeof(args); |
| 2605 | 2577 | // args.hrStatus = hrStatus; | |
| 2606 | results.cbSize = sizeof(results); | 2578 | |
| 2607 | 2579 | // results.cbSize = sizeof(results); | |
| 2608 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATECOMPLETE, &args, &results); | 2580 | |
| 2609 | ExitOnFailure(hr, "BA OnSetUpdateComplete failed."); | 2581 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, args.cbSize, &result); |
| 2610 | 2582 | // ExitOnFailure(hr, "BA OnSystemRestorePointComplete failed."); | |
| 2611 | LExit: | 2583 | |
| 2612 | return hr; | 2584 | // LExit: |
| 2613 | } | 2585 | // return hr; |
| 2614 | 2586 | // } | |
| 2615 | EXTERN_C BAAPI UserExperienceOnShutdown( | 2587 | |
| 2616 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2588 | // EXTERN_C BAAPI UserExperienceOnUnregisterBegin( |
| 2617 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction | 2589 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2618 | ) | 2590 | // __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType |
| 2619 | { | 2591 | // ) |
| 2620 | HRESULT hr = S_OK; | 2592 | // { |
| 2621 | BA_ONSHUTDOWN_ARGS args = { }; | 2593 | // HRESULT hr = S_OK; |
| 2622 | BA_ONSHUTDOWN_RESULTS results = { }; | 2594 | // BA_ONUNREGISTERBEGIN_ARGS args = { }; |
| 2623 | 2595 | // BA_ONUNREGISTERBEGIN_RESULTS results = { }; | |
| 2624 | args.cbSize = sizeof(args); | 2596 | // PIPE_RPC_RESULT result = { }; |
| 2625 | 2597 | ||
| 2626 | results.cbSize = sizeof(results); | 2598 | // args.cbSize = sizeof(args); |
| 2627 | results.action = *pAction; | 2599 | // args.recommendedRegistrationType = *pRegistrationType; |
| 2628 | 2600 | ||
| 2629 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &args, &results); | 2601 | // results.cbSize = sizeof(results); |
| 2630 | ExitOnFailure(hr, "BA OnShutdown failed."); | 2602 | // results.registrationType = *pRegistrationType; |
| 2631 | 2603 | ||
| 2632 | *pAction = results.action; | 2604 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, args.cbSize, &result); |
| 2633 | 2605 | // ExitOnFailure(hr, "BA OnUnregisterBegin failed."); | |
| 2634 | LExit: | 2606 | |
| 2635 | return hr; | 2607 | // if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE < results.registrationType && BOOTSTRAPPER_REGISTRATION_TYPE_FULL >= results.registrationType) |
| 2636 | } | 2608 | // { |
| 2637 | 2609 | // *pRegistrationType = results.registrationType; | |
| 2638 | EXTERN_C BAAPI UserExperienceOnStartup( | 2610 | // } |
| 2639 | __in BURN_USER_EXPERIENCE* pUserExperience | 2611 | |
| 2640 | ) | 2612 | // LExit: |
| 2641 | { | 2613 | // return hr; |
| 2642 | HRESULT hr = S_OK; | 2614 | // } |
| 2643 | BA_ONSTARTUP_ARGS args = { }; | 2615 | |
| 2644 | BA_ONSTARTUP_RESULTS results = { }; | 2616 | // EXTERN_C BAAPI UserExperienceOnUnregisterComplete( |
| 2645 | 2617 | // __in BURN_USER_EXPERIENCE* pUserExperience, | |
| 2646 | args.cbSize = sizeof(args); | 2618 | // __in HRESULT hrStatus |
| 2647 | 2619 | // ) | |
| 2648 | results.cbSize = sizeof(results); | 2620 | // { |
| 2649 | 2621 | // HRESULT hr = S_OK; | |
| 2650 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &args, &results); | 2622 | // BA_ONUNREGISTERCOMPLETE_ARGS args = { }; |
| 2651 | ExitOnFailure(hr, "BA OnStartup failed."); | 2623 | // BA_ONUNREGISTERCOMPLETE_RESULTS results = { }; |
| 2652 | 2624 | // PIPE_RPC_RESULT result = { }; | |
| 2653 | LExit: | 2625 | |
| 2654 | return hr; | 2626 | // args.cbSize = sizeof(args); |
| 2655 | } | 2627 | // args.hrStatus = hrStatus; |
| 2656 | 2628 | ||
| 2657 | EXTERN_C BAAPI UserExperienceOnSystemRestorePointBegin( | 2629 | // results.cbSize = sizeof(results); |
| 2658 | __in BURN_USER_EXPERIENCE* pUserExperience | 2630 | |
| 2659 | ) | 2631 | // hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, args.cbSize, &result); |
| 2660 | { | 2632 | // ExitOnFailure(hr, "BA OnUnregisterComplete failed."); |
| 2661 | HRESULT hr = S_OK; | 2633 | |
| 2662 | BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS args = { }; | 2634 | // LExit: |
| 2663 | BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS results = { }; | 2635 | // return hr; |
| 2664 | 2636 | // } | |
| 2665 | args.cbSize = sizeof(args); | 2637 | |
| 2666 | 2638 | // extern "C" int UserExperienceCheckExecuteResult( | |
| 2667 | results.cbSize = sizeof(results); | 2639 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2668 | 2640 | // __in BOOL fRollback, | |
| 2669 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, &results); | 2641 | // __in DWORD dwAllowedResults, |
| 2670 | ExitOnFailure(hr, "BA OnSystemRestorePointBegin failed."); | 2642 | // __in int nResult |
| 2671 | 2643 | // ) | |
| 2672 | LExit: | 2644 | // { |
| 2673 | return hr; | 2645 | // // Do not allow canceling while rolling back. |
| 2674 | } | 2646 | // if (fRollback && (IDCANCEL == nResult || IDABORT == nResult)) |
| 2675 | 2647 | // { | |
| 2676 | EXTERN_C BAAPI UserExperienceOnSystemRestorePointComplete( | 2648 | // nResult = IDNOACTION; |
| 2677 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2649 | // } |
| 2678 | __in HRESULT hrStatus | 2650 | // else if (FAILED(pUserExperience->hrApplyError) && !fRollback) // if we failed cancel except not during rollback. |
| 2679 | ) | 2651 | // { |
| 2680 | { | 2652 | // nResult = IDCANCEL; |
| 2681 | HRESULT hr = S_OK; | 2653 | // } |
| 2682 | BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS args = { }; | 2654 | |
| 2683 | BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS results = { }; | 2655 | // nResult = FilterResult(dwAllowedResults, nResult); |
| 2684 | 2656 | // return nResult; | |
| 2685 | args.cbSize = sizeof(args); | 2657 | // } |
| 2686 | args.hrStatus = hrStatus; | 2658 | |
| 2687 | 2659 | // extern "C" HRESULT UserExperienceInterpretExecuteResult( | |
| 2688 | results.cbSize = sizeof(results); | 2660 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2689 | 2661 | // __in BOOL fRollback, | |
| 2690 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, &results); | 2662 | // __in DWORD dwAllowedResults, |
| 2691 | ExitOnFailure(hr, "BA OnSystemRestorePointComplete failed."); | 2663 | // __in int nResult |
| 2692 | 2664 | // ) | |
| 2693 | LExit: | 2665 | // { |
| 2694 | return hr; | 2666 | // HRESULT hr = S_OK; |
| 2695 | } | 2667 | |
| 2696 | 2668 | // // If we failed return that error unless this is rollback which should roll on. | |
| 2697 | EXTERN_C BAAPI UserExperienceOnUnregisterBegin( | 2669 | // if (FAILED(pUserExperience->hrApplyError) && !fRollback) |
| 2698 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2670 | // { |
| 2699 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | 2671 | // hr = pUserExperience->hrApplyError; |
| 2700 | ) | 2672 | // } |
| 2701 | { | 2673 | // else |
| 2702 | HRESULT hr = S_OK; | 2674 | // { |
| 2703 | BA_ONUNREGISTERBEGIN_ARGS args = { }; | 2675 | // int nCheckedResult = UserExperienceCheckExecuteResult(pUserExperience, fRollback, dwAllowedResults, nResult); |
| 2704 | BA_ONUNREGISTERBEGIN_RESULTS results = { }; | 2676 | // hr = IDOK == nCheckedResult || IDNOACTION == nCheckedResult ? S_OK : IDCANCEL == nCheckedResult || IDABORT == nCheckedResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE); |
| 2705 | 2677 | // } | |
| 2706 | args.cbSize = sizeof(args); | 2678 | |
| 2707 | args.recommendedRegistrationType = *pRegistrationType; | 2679 | // return hr; |
| 2708 | 2680 | // } | |
| 2709 | results.cbSize = sizeof(results); | 2681 | |
| 2710 | results.registrationType = *pRegistrationType; | 2682 | |
| 2711 | 2683 | // // internal functions | |
| 2712 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results); | 2684 | |
| 2713 | ExitOnFailure(hr, "BA OnUnregisterBegin failed."); | 2685 | // static int FilterResult( |
| 2714 | 2686 | // __in DWORD dwAllowedResults, | |
| 2715 | if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE < results.registrationType && BOOTSTRAPPER_REGISTRATION_TYPE_FULL >= results.registrationType) | 2687 | // __in int nResult |
| 2716 | { | 2688 | // ) |
| 2717 | *pRegistrationType = results.registrationType; | 2689 | // { |
| 2718 | } | 2690 | // if (IDNOACTION == nResult || IDERROR == nResult) // do nothing and errors pass through. |
| 2719 | 2691 | // { | |
| 2720 | LExit: | 2692 | // } |
| 2721 | return hr; | 2693 | // else |
| 2722 | } | 2694 | // { |
| 2723 | 2695 | // switch (dwAllowedResults) | |
| 2724 | EXTERN_C BAAPI UserExperienceOnUnregisterComplete( | 2696 | // { |
| 2725 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2697 | // case MB_OK: |
| 2726 | __in HRESULT hrStatus | 2698 | // nResult = IDOK; |
| 2727 | ) | 2699 | // break; |
| 2728 | { | 2700 | |
| 2729 | HRESULT hr = S_OK; | 2701 | // case MB_OKCANCEL: |
| 2730 | BA_ONUNREGISTERCOMPLETE_ARGS args = { }; | 2702 | // if (IDOK == nResult || IDYES == nResult) |
| 2731 | BA_ONUNREGISTERCOMPLETE_RESULTS results = { }; | 2703 | // { |
| 2732 | 2704 | // nResult = IDOK; | |
| 2733 | args.cbSize = sizeof(args); | 2705 | // } |
| 2734 | args.hrStatus = hrStatus; | 2706 | // else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) |
| 2735 | 2707 | // { | |
| 2736 | results.cbSize = sizeof(results); | 2708 | // nResult = IDCANCEL; |
| 2737 | 2709 | // } | |
| 2738 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, &results); | 2710 | // else |
| 2739 | ExitOnFailure(hr, "BA OnUnregisterComplete failed."); | 2711 | // { |
| 2740 | 2712 | // nResult = IDNOACTION; | |
| 2741 | LExit: | 2713 | // } |
| 2742 | return hr; | 2714 | // break; |
| 2743 | } | 2715 | |
| 2744 | 2716 | // case MB_ABORTRETRYIGNORE: | |
| 2745 | extern "C" int UserExperienceCheckExecuteResult( | 2717 | // if (IDCANCEL == nResult || IDABORT == nResult) |
| 2746 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2718 | // { |
| 2747 | __in BOOL fRollback, | 2719 | // nResult = IDABORT; |
| 2748 | __in DWORD dwAllowedResults, | 2720 | // } |
| 2749 | __in int nResult | 2721 | // else if (IDRETRY == nResult || IDTRYAGAIN == nResult) |
| 2750 | ) | 2722 | // { |
| 2751 | { | 2723 | // nResult = IDRETRY; |
| 2752 | // Do not allow canceling while rolling back. | 2724 | // } |
| 2753 | if (fRollback && (IDCANCEL == nResult || IDABORT == nResult)) | 2725 | // else if (IDIGNORE == nResult) |
| 2754 | { | 2726 | // { |
| 2755 | nResult = IDNOACTION; | 2727 | // nResult = IDIGNORE; |
| 2756 | } | 2728 | // } |
| 2757 | else if (FAILED(pUserExperience->hrApplyError) && !fRollback) // if we failed cancel except not during rollback. | 2729 | // else |
| 2758 | { | 2730 | // { |
| 2759 | nResult = IDCANCEL; | 2731 | // nResult = IDNOACTION; |
| 2760 | } | 2732 | // } |
| 2761 | 2733 | // break; | |
| 2762 | nResult = FilterResult(dwAllowedResults, nResult); | 2734 | |
| 2763 | return nResult; | 2735 | // case MB_YESNO: |
| 2764 | } | 2736 | // if (IDOK == nResult || IDYES == nResult) |
| 2765 | 2737 | // { | |
| 2766 | extern "C" HRESULT UserExperienceInterpretExecuteResult( | 2738 | // nResult = IDYES; |
| 2767 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2739 | // } |
| 2768 | __in BOOL fRollback, | 2740 | // else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) |
| 2769 | __in DWORD dwAllowedResults, | 2741 | // { |
| 2770 | __in int nResult | 2742 | // nResult = IDNO; |
| 2771 | ) | 2743 | // } |
| 2772 | { | 2744 | // else |
| 2773 | HRESULT hr = S_OK; | 2745 | // { |
| 2774 | 2746 | // nResult = IDNOACTION; | |
| 2775 | // If we failed return that error unless this is rollback which should roll on. | 2747 | // } |
| 2776 | if (FAILED(pUserExperience->hrApplyError) && !fRollback) | 2748 | // break; |
| 2777 | { | 2749 | |
| 2778 | hr = pUserExperience->hrApplyError; | 2750 | // case MB_YESNOCANCEL: |
| 2779 | } | 2751 | // if (IDOK == nResult || IDYES == nResult) |
| 2780 | else | 2752 | // { |
| 2781 | { | 2753 | // nResult = IDYES; |
| 2782 | int nCheckedResult = UserExperienceCheckExecuteResult(pUserExperience, fRollback, dwAllowedResults, nResult); | 2754 | // } |
| 2783 | hr = IDOK == nCheckedResult || IDNOACTION == nCheckedResult ? S_OK : IDCANCEL == nCheckedResult || IDABORT == nCheckedResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE); | 2755 | // else if (IDNO == nResult) |
| 2784 | } | 2756 | // { |
| 2785 | 2757 | // nResult = IDNO; | |
| 2786 | return hr; | 2758 | // } |
| 2787 | } | 2759 | // else if (IDCANCEL == nResult || IDABORT == nResult) |
| 2788 | 2760 | // { | |
| 2789 | 2761 | // nResult = IDCANCEL; | |
| 2790 | // internal functions | 2762 | // } |
| 2791 | 2763 | // else | |
| 2792 | static int FilterResult( | 2764 | // { |
| 2793 | __in DWORD dwAllowedResults, | 2765 | // nResult = IDNOACTION; |
| 2794 | __in int nResult | 2766 | // } |
| 2795 | ) | 2767 | // break; |
| 2796 | { | 2768 | |
| 2797 | if (IDNOACTION == nResult || IDERROR == nResult) // do nothing and errors pass through. | 2769 | // case MB_RETRYCANCEL: |
| 2798 | { | 2770 | // if (IDRETRY == nResult || IDTRYAGAIN == nResult) |
| 2799 | } | 2771 | // { |
| 2800 | else | 2772 | // nResult = IDRETRY; |
| 2801 | { | 2773 | // } |
| 2802 | switch (dwAllowedResults) | 2774 | // else if (IDCANCEL == nResult || IDABORT == nResult) |
| 2803 | { | 2775 | // { |
| 2804 | case MB_OK: | 2776 | // nResult = IDABORT; |
| 2805 | nResult = IDOK; | 2777 | // } |
| 2806 | break; | 2778 | // else |
| 2807 | 2779 | // { | |
| 2808 | case MB_OKCANCEL: | 2780 | // nResult = IDNOACTION; |
| 2809 | if (IDOK == nResult || IDYES == nResult) | 2781 | // } |
| 2810 | { | 2782 | // break; |
| 2811 | nResult = IDOK; | 2783 | |
| 2812 | } | 2784 | // case MB_CANCELTRYCONTINUE: |
| 2813 | else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) | 2785 | // if (IDCANCEL == nResult || IDABORT == nResult) |
| 2814 | { | 2786 | // { |
| 2815 | nResult = IDCANCEL; | 2787 | // nResult = IDABORT; |
| 2816 | } | 2788 | // } |
| 2817 | else | 2789 | // else if (IDRETRY == nResult || IDTRYAGAIN == nResult) |
| 2818 | { | 2790 | // { |
| 2819 | nResult = IDNOACTION; | 2791 | // nResult = IDRETRY; |
| 2820 | } | 2792 | // } |
| 2821 | break; | 2793 | // else if (IDCONTINUE == nResult || IDIGNORE == nResult) |
| 2822 | 2794 | // { | |
| 2823 | case MB_ABORTRETRYIGNORE: | 2795 | // nResult = IDCONTINUE; |
| 2824 | if (IDCANCEL == nResult || IDABORT == nResult) | 2796 | // } |
| 2825 | { | 2797 | // else |
| 2826 | nResult = IDABORT; | 2798 | // { |
| 2827 | } | 2799 | // nResult = IDNOACTION; |
| 2828 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult) | 2800 | // } |
| 2829 | { | 2801 | // break; |
| 2830 | nResult = IDRETRY; | 2802 | |
| 2831 | } | 2803 | // case BURN_MB_RETRYTRYAGAIN: // custom return code. |
| 2832 | else if (IDIGNORE == nResult) | 2804 | // if (IDRETRY != nResult && IDTRYAGAIN != nResult) |
| 2833 | { | 2805 | // { |
| 2834 | nResult = IDIGNORE; | 2806 | // nResult = IDNOACTION; |
| 2835 | } | 2807 | // } |
| 2836 | else | 2808 | // break; |
| 2837 | { | 2809 | |
| 2838 | nResult = IDNOACTION; | 2810 | // default: |
| 2839 | } | 2811 | // AssertSz(FALSE, "Unknown allowed results."); |
| 2840 | break; | 2812 | // break; |
| 2841 | 2813 | // } | |
| 2842 | case MB_YESNO: | 2814 | // } |
| 2843 | if (IDOK == nResult || IDYES == nResult) | 2815 | |
| 2844 | { | 2816 | // return nResult; |
| 2845 | nResult = IDYES; | 2817 | // } |
| 2846 | } | 2818 | |
| 2847 | else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) | 2819 | // // This filters the BA's responses to events during apply. |
| 2848 | { | 2820 | // // If an apply thread failed, then return its error so this thread will bail out. |
| 2849 | nResult = IDNO; | 2821 | // // During rollback, the BA can't cancel. |
| 2850 | } | 2822 | // static HRESULT FilterExecuteResult( |
| 2851 | else | 2823 | // __in BURN_USER_EXPERIENCE* pUserExperience, |
| 2852 | { | 2824 | // __in HRESULT hrStatus, |
| 2853 | nResult = IDNOACTION; | 2825 | // __in BOOL fRollback, |
| 2854 | } | 2826 | // __in BOOL fCancel, |
| 2855 | break; | 2827 | // __in LPCWSTR sczEventName |
| 2856 | 2828 | // ) | |
| 2857 | case MB_YESNOCANCEL: | 2829 | // { |
| 2858 | if (IDOK == nResult || IDYES == nResult) | 2830 | // HRESULT hr = hrStatus; |
| 2859 | { | 2831 | // HRESULT hrApplyError = pUserExperience->hrApplyError; // make sure to use the same value for the whole method, since it can be changed in other threads. |
| 2860 | nResult = IDYES; | 2832 | |
| 2861 | } | 2833 | // // If we failed return that error unless this is rollback which should roll on. |
| 2862 | else if (IDNO == nResult) | 2834 | // if (FAILED(hrApplyError) && !fRollback) |
| 2863 | { | 2835 | // { |
| 2864 | nResult = IDNO; | 2836 | // hr = hrApplyError; |
| 2865 | } | 2837 | // } |
| 2866 | else if (IDCANCEL == nResult || IDABORT == nResult) | 2838 | // else if (fRollback) |
| 2867 | { | 2839 | // { |
| 2868 | nResult = IDCANCEL; | 2840 | // if (fCancel) |
| 2869 | } | 2841 | // { |
| 2870 | else | 2842 | // LogId(REPORT_STANDARD, MSG_APPLY_CANCEL_IGNORED_DURING_ROLLBACK, sczEventName); |
| 2871 | { | 2843 | // } |
| 2872 | nResult = IDNOACTION; | 2844 | // // TODO: since cancel isn't allowed, should the BA's HRESULT be ignored as well? |
| 2873 | } | 2845 | // // In the previous code, they could still alter rollback by returning IDERROR. |
| 2874 | break; | 2846 | // } |
| 2875 | 2847 | // else | |
| 2876 | case MB_RETRYCANCEL: | 2848 | // { |
| 2877 | if (IDRETRY == nResult || IDTRYAGAIN == nResult) | 2849 | // ExitOnFailure(hr, "BA %ls failed.", sczEventName); |
| 2878 | { | 2850 | |
| 2879 | nResult = IDRETRY; | 2851 | // if (fCancel) |
| 2880 | } | 2852 | // { |
| 2881 | else if (IDCANCEL == nResult || IDABORT == nResult) | 2853 | // hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); |
| 2882 | { | 2854 | // } |
| 2883 | nResult = IDABORT; | 2855 | // } |
| 2884 | } | 2856 | |
| 2885 | else | 2857 | // LExit: |
| 2886 | { | 2858 | // return hr; |
| 2887 | nResult = IDNOACTION; | 2859 | // } |
| 2888 | } | 2860 | |
| 2889 | break; | 2861 | // static HRESULT SendBAMessage( |
| 2890 | 2862 | // __in BURN_USER_EXPERIENCE* /*pUserExperience*/, | |
| 2891 | case MB_CANCELTRYCONTINUE: | 2863 | // __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, |
| 2892 | if (IDCANCEL == nResult || IDABORT == nResult) | 2864 | // __in_bcount(cbArgs) const LPVOID /*pvArgs*/, |
| 2893 | { | 2865 | // __in DWORD /*cbArgs*/, |
| 2894 | nResult = IDABORT; | 2866 | // __in PIPE_RPC_RESULT* /*pResult*/ |
| 2895 | } | 2867 | // ) |
| 2896 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult) | 2868 | // { |
| 2897 | { | 2869 | // // // HRESULT hr = S_OK; |
| 2898 | nResult = IDRETRY; | 2870 | // // // // DWORD rgResultAndSize[2] = { }; |
| 2899 | } | 2871 | // // // // DWORD cbSize = 0; |
| 2900 | else if (IDCONTINUE == nResult || IDIGNORE == nResult) | 2872 | // // // // LPVOID pvData = NULL; |
| 2901 | { | 2873 | // // // // DWORD cbData = 0; |
| 2902 | nResult = IDCONTINUE; | 2874 | |
| 2903 | } | 2875 | // // // //if (!pUserExperience->hUXModule) |
| 2904 | else | 2876 | // // // if (!PipeRpcInitialized(&pUserExperience->hBARpcPipe)) |
| 2905 | { | 2877 | // // // { |
| 2906 | nResult = IDNOACTION; | 2878 | // // // ExitFunction(); |
| 2907 | } | 2879 | // // // } |
| 2908 | break; | 2880 | |
| 2909 | 2881 | // // // //hr = pUserExperience->pfnBAProc(message, pvArgs, pvResults, pUserExperience->pvBAProcContext); | |
| 2910 | case BURN_MB_RETRYTRYAGAIN: // custom return code. | 2882 | // // // //if (hr == E_NOTIMPL) |
| 2911 | if (IDRETRY != nResult && IDTRYAGAIN != nResult) | 2883 | // // // //{ |
| 2912 | { | 2884 | // // // // hr = S_OK; |
| 2913 | nResult = IDNOACTION; | 2885 | // // // //} |
| 2914 | } | 2886 | |
| 2915 | break; | 2887 | // // // // Send the message. |
| 2916 | 2888 | // // // // hr = PipeWriteMessage(hPipe, message, pvArgs, cbArgs); | |
| 2917 | default: | 2889 | // // // hr = PipeRpcRequest(&pUserExperience->hBARpcPipe, message, pvArgs, cbArgs, pResult); |
| 2918 | AssertSz(FALSE, "Unknown allowed results."); | 2890 | // // // ExitOnFailure(hr, "Failed to write message to BA."); |
| 2919 | break; | 2891 | |
| 2920 | } | 2892 | // // // #if TODO_DELETE |
| 2921 | } | 2893 | // // // // Read the result and size of response. |
| 2922 | 2894 | // // // hr = FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(rgResultAndSize), sizeof(rgResultAndSize)); | |
| 2923 | return nResult; | 2895 | // // // ExitOnFailure(hr, "Failed to read result and size of message."); |
| 2924 | } | 2896 | |
| 2925 | 2897 | // // // pResult->hr = rgResultAndSize[0]; | |
| 2926 | // This filters the BA's responses to events during apply. | 2898 | // // // cbSize = rgResultAndSize[1]; |
| 2927 | // If an apply thread failed, then return its error so this thread will bail out. | 2899 | |
| 2928 | // During rollback, the BA can't cancel. | 2900 | // // // // Ensure the message size isn't "too big". |
| 2929 | static HRESULT FilterExecuteResult( | 2901 | // // // if (cbSize > MAX_SIZE_BA_RESPONSE) |
| 2930 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2902 | // // // { |
| 2931 | __in HRESULT hrStatus, | 2903 | // // // hr = E_INVALIDDATA; |
| 2932 | __in BOOL fRollback, | 2904 | // // // ExitOnRootFailure(hr, "BA sent too much data in response."); |
| 2933 | __in BOOL fCancel, | 2905 | // // // } |
| 2934 | __in LPCWSTR sczEventName | 2906 | // // // else if (cbSize > sizeof(DWORD)) // if there is data beyond the size of the response struct, read it. |
| 2935 | ) | 2907 | // // // { |
| 2936 | { | 2908 | // // // cbData = cbSize - sizeof(DWORD); |
| 2937 | HRESULT hr = hrStatus; | 2909 | |
| 2938 | HRESULT hrApplyError = pUserExperience->hrApplyError; // make sure to use the same value for the whole method, since it can be changed in other threads. | 2910 | // // // pvData = MemAlloc(cbData, TRUE); |
| 2939 | 2911 | // // // ExitOnNull(pvData, hr, E_OUTOFMEMORY, "Failed to allocate memory for BA results."); | |
| 2940 | // If we failed return that error unless this is rollback which should roll on. | 2912 | |
| 2941 | if (FAILED(hrApplyError) && !fRollback) | 2913 | // // // hr = FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(pvData), cbData); |
| 2942 | { | 2914 | // // // ExitOnFailure(hr, "Failed to read result and size of message."); |
| 2943 | hr = hrApplyError; | 2915 | // // // } |
| 2944 | } | 2916 | |
| 2945 | else if (fRollback) | 2917 | // // // pResult->cbSize = cbSize; |
| 2946 | { | 2918 | // // // pResult->cbData = cbData; |
| 2947 | if (fCancel) | 2919 | // // // pResult->pvData = pvData; |
| 2948 | { | 2920 | // // // pvData = NULL; |
| 2949 | LogId(REPORT_STANDARD, MSG_APPLY_CANCEL_IGNORED_DURING_ROLLBACK, sczEventName); | 2921 | // // // #endif |
| 2950 | } | 2922 | |
| 2951 | // TODO: since cancel isn't allowed, should the BA's HRESULT be ignored as well? | 2923 | // // // hr = pResult->hr; |
| 2952 | // In the previous code, they could still alter rollback by returning IDERROR. | 2924 | // // // ExitOnFailure(hr, "BA reported failure."); |
| 2953 | } | 2925 | |
| 2954 | else | 2926 | // // // LExit: |
| 2955 | { | 2927 | // // // // ReleaseMem(pvData); |
| 2956 | ExitOnFailure(hr, "BA %ls failed.", sczEventName); | 2928 | |
| 2957 | 2929 | // // // return hr; | |
| 2958 | if (fCancel) | 2930 | // return E_NOTIMPL; |
| 2959 | { | 2931 | // } |
| 2960 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | 2932 | |
| 2961 | } | 2933 | // static HRESULT SendBAMessageFromInactiveEngine( |
| 2962 | } | 2934 | // __in BURN_USER_EXPERIENCE* /*pUserExperience*/, |
| 2963 | 2935 | // __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, | |
| 2964 | LExit: | 2936 | // __in_bcount(cbArgs) const LPVOID /*pvArgs*/, |
| 2965 | return hr; | 2937 | // __in DWORD /*cbArgs*/, |
| 2966 | } | 2938 | // __in PIPE_RPC_RESULT* /*pResult*/ |
| 2967 | 2939 | // ) | |
| 2968 | static HRESULT SendBAMessage( | 2940 | // { |
| 2969 | __in BURN_USER_EXPERIENCE* pUserExperience, | 2941 | // // // HRESULT hr = S_OK; |
| 2970 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | 2942 | |
| 2971 | __in const LPVOID pvArgs, | 2943 | // // // //if (!pUserExperience->hUXModule) |
| 2972 | __inout LPVOID pvResults | 2944 | // // // if (!PipeRpcInitialized(&pUserExperience->hBARpcPipe)) |
| 2973 | ) | 2945 | // // // { |
| 2974 | { | 2946 | // // // ExitFunction(); |
| 2975 | HRESULT hr = S_OK; | 2947 | // // // } |
| 2976 | 2948 | ||
| 2977 | if (!pUserExperience->hUXModule) | 2949 | // // // UserExperienceDeactivateEngine(pUserExperience); |
| 2978 | { | 2950 | |
| 2979 | ExitFunction(); | 2951 | // // // hr = SendBAMessage(pUserExperience, message, pvArgs, cbArgs, pResult); |
| 2980 | } | 2952 | |
| 2981 | 2953 | // // // UserExperienceActivateEngine(pUserExperience); | |
| 2982 | hr = pUserExperience->pfnBAProc(message, pvArgs, pvResults, pUserExperience->pvBAProcContext); | 2954 | |
| 2983 | if (hr == E_NOTIMPL) | 2955 | // // // LExit: |
| 2984 | { | 2956 | // // // return hr; |
| 2985 | hr = S_OK; | 2957 | // return E_NOTIMPL; |
| 2986 | } | 2958 | // } |
| 2987 | |||
| 2988 | LExit: | ||
| 2989 | return hr; | ||
| 2990 | } | ||
| 2991 | |||
| 2992 | static HRESULT SendBAMessageFromInactiveEngine( | ||
| 2993 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 2994 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
| 2995 | __in const LPVOID pvArgs, | ||
| 2996 | __inout LPVOID pvResults | ||
| 2997 | ) | ||
| 2998 | { | ||
| 2999 | HRESULT hr = S_OK; | ||
| 3000 | |||
| 3001 | if (!pUserExperience->hUXModule) | ||
| 3002 | { | ||
| 3003 | ExitFunction(); | ||
| 3004 | } | ||
| 3005 | |||
| 3006 | UserExperienceDeactivateEngine(pUserExperience); | ||
| 3007 | |||
| 3008 | hr = SendBAMessage(pUserExperience, message, pvArgs, pvResults); | ||
| 3009 | |||
| 3010 | UserExperienceActivateEngine(pUserExperience); | ||
| 3011 | |||
| 3012 | LExit: | ||
| 3013 | return hr; | ||
| 3014 | } | ||
diff --git a/src/burn/engine/userexperience.h b/src/burn/engine/userexperience.h index 4f15c5d7..23068e3e 100644 --- a/src/burn/engine/userexperience.h +++ b/src/burn/engine/userexperience.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 3 | 3 | ||
| 4 | #define BAAPI HRESULT __stdcall | ||
| 5 | |||
| 6 | #if defined(__cplusplus) | 4 | #if defined(__cplusplus) |
| 7 | extern "C" { | 5 | extern "C" { |
| 8 | #endif | 6 | #endif |
| @@ -10,47 +8,13 @@ extern "C" { | |||
| 10 | 8 | ||
| 11 | // constants | 9 | // constants |
| 12 | 10 | ||
| 13 | const DWORD BURN_MB_RETRYTRYAGAIN = 0x10; | ||
| 14 | |||
| 15 | 11 | ||
| 16 | // structs | 12 | // structs |
| 17 | 13 | ||
| 18 | typedef struct _BURN_USER_EXPERIENCE | ||
| 19 | { | ||
| 20 | BURN_PAYLOADS payloads; | ||
| 21 | |||
| 22 | HMODULE hUXModule; | ||
| 23 | PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBAProc; | ||
| 24 | LPVOID pvBAProcContext; | ||
| 25 | LPWSTR sczTempDirectory; | ||
| 26 | |||
| 27 | CRITICAL_SECTION csEngineActive; // Changing the engine active state in the user experience must be | ||
| 28 | // syncronized through this critical section. | ||
| 29 | // Note: The engine must never do a UX callback while in this critical section. | ||
| 30 | |||
| 31 | BOOL fEngineActive; // Indicates that the engine is currently active with one of the execution | ||
| 32 | // steps (detect, plan, apply), and cannot accept requests from the UX. | ||
| 33 | // This flag should be cleared by the engine prior to UX callbacks that | ||
| 34 | // allows altering of the engine state. | ||
| 35 | |||
| 36 | HRESULT hrApplyError; // Tracks is an error occurs during apply that requires the cache or | ||
| 37 | // execute threads to bail. | ||
| 38 | |||
| 39 | HWND hwndApply; // The window handle provided at the beginning of Apply(). Only valid | ||
| 40 | // during apply. | ||
| 41 | |||
| 42 | HWND hwndDetect; // The window handle provided at the beginning of Detect(). Only valid | ||
| 43 | // during Detect. | ||
| 44 | |||
| 45 | DWORD dwExitCode; // Exit code returned by the user experience for the engine overall. | ||
| 46 | } BURN_USER_EXPERIENCE; | ||
| 47 | 14 | ||
| 48 | // functions | 15 | // functions |
| 49 | 16 | ||
| 50 | HRESULT UserExperienceParseFromXml( | 17 | #ifdef TODO_DELETE |
| 51 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 52 | __in IXMLDOMNode* pixnBundle | ||
| 53 | ); | ||
| 54 | void UserExperienceUninitialize( | 18 | void UserExperienceUninitialize( |
| 55 | __in BURN_USER_EXPERIENCE* pUserExperience | 19 | __in BURN_USER_EXPERIENCE* pUserExperience |
| 56 | ); | 20 | ); |
| @@ -63,43 +27,7 @@ HRESULT UserExperienceUnload( | |||
| 63 | __in BURN_USER_EXPERIENCE* pUserExperience, | 27 | __in BURN_USER_EXPERIENCE* pUserExperience, |
| 64 | __in BOOL fReload | 28 | __in BOOL fReload |
| 65 | ); | 29 | ); |
| 66 | HRESULT UserExperienceEnsureWorkingFolder( | ||
| 67 | __in BURN_CACHE* pCache, | ||
| 68 | __deref_out_z LPWSTR* psczUserExperienceWorkingFolder | ||
| 69 | ); | ||
| 70 | HRESULT UserExperienceRemove( | ||
| 71 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 72 | ); | ||
| 73 | int UserExperienceSendError( | ||
| 74 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 75 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
| 76 | __in_z_opt LPCWSTR wzPackageId, | ||
| 77 | __in HRESULT hrCode, | ||
| 78 | __in_z_opt LPCWSTR wzError, | ||
| 79 | __in DWORD uiFlags, | ||
| 80 | __in int nRecommendation | ||
| 81 | ); | ||
| 82 | void UserExperienceActivateEngine( | ||
| 83 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 84 | ); | ||
| 85 | void UserExperienceDeactivateEngine( | ||
| 86 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 87 | ); | ||
| 88 | /******************************************************************** | ||
| 89 | UserExperienceEnsureEngineInactive - Verifies the engine is inactive. | ||
| 90 | The caller MUST enter the csActive critical section before calling. | ||
| 91 | 30 | ||
| 92 | *********************************************************************/ | ||
| 93 | HRESULT UserExperienceEnsureEngineInactive( | ||
| 94 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 95 | ); | ||
| 96 | void UserExperienceExecuteReset( | ||
| 97 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 98 | ); | ||
| 99 | void UserExperienceExecutePhaseComplete( | ||
| 100 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 101 | __in HRESULT hrResult | ||
| 102 | ); | ||
| 103 | BAAPI UserExperienceOnApplyBegin( | 31 | BAAPI UserExperienceOnApplyBegin( |
| 104 | __in BURN_USER_EXPERIENCE* pUserExperience, | 32 | __in BURN_USER_EXPERIENCE* pUserExperience, |
| 105 | __in DWORD dwPhaseCount | 33 | __in DWORD dwPhaseCount |
| @@ -604,18 +532,8 @@ BAAPI UserExperienceOnUnregisterComplete( | |||
| 604 | __in BURN_USER_EXPERIENCE* pUserExperience, | 532 | __in BURN_USER_EXPERIENCE* pUserExperience, |
| 605 | __in HRESULT hrStatus | 533 | __in HRESULT hrStatus |
| 606 | ); | 534 | ); |
| 607 | int UserExperienceCheckExecuteResult( | 535 | #endif |
| 608 | __in BURN_USER_EXPERIENCE* pUserExperience, | 536 | |
| 609 | __in BOOL fRollback, | ||
| 610 | __in DWORD dwAllowedResults, | ||
| 611 | __in int nResult | ||
| 612 | ); | ||
| 613 | HRESULT UserExperienceInterpretExecuteResult( | ||
| 614 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 615 | __in BOOL fRollback, | ||
| 616 | __in DWORD dwAllowedResults, | ||
| 617 | __in int nResult | ||
| 618 | ); | ||
| 619 | #if defined(__cplusplus) | 537 | #if defined(__cplusplus) |
| 620 | } | 538 | } |
| 621 | #endif | 539 | #endif |
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index 36dc92e0..9d0aec52 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
| @@ -302,8 +302,6 @@ extern "C" HRESULT VariableInitialize( | |||
| 302 | {BURN_BUNDLE_ELEVATED, InitializeVariableNumeric, 0, FALSE, TRUE}, | 302 | {BURN_BUNDLE_ELEVATED, InitializeVariableNumeric, 0, FALSE, TRUE}, |
| 303 | {BURN_BUNDLE_ACTIVE_PARENT, InitializeVariableString, NULL, FALSE, TRUE}, | 303 | {BURN_BUNDLE_ACTIVE_PARENT, InitializeVariableString, NULL, FALSE, TRUE}, |
| 304 | {BURN_BUNDLE_PROVIDER_KEY, InitializeVariableString, (DWORD_PTR)L"", FALSE, TRUE}, | 304 | {BURN_BUNDLE_PROVIDER_KEY, InitializeVariableString, (DWORD_PTR)L"", FALSE, TRUE}, |
| 305 | {BURN_BUNDLE_SOURCE_PROCESS_PATH, InitializeVariableString, NULL, FALSE, TRUE}, | ||
| 306 | {BURN_BUNDLE_SOURCE_PROCESS_FOLDER, InitializeVariableString, NULL, FALSE, TRUE}, | ||
| 307 | {BURN_BUNDLE_TAG, InitializeVariableString, (DWORD_PTR)L"", FALSE, TRUE}, | 305 | {BURN_BUNDLE_TAG, InitializeVariableString, (DWORD_PTR)L"", FALSE, TRUE}, |
| 308 | {BURN_BUNDLE_UILEVEL, InitializeVariableNumeric, 0, FALSE, TRUE}, | 306 | {BURN_BUNDLE_UILEVEL, InitializeVariableNumeric, 0, FALSE, TRUE}, |
| 309 | {BURN_BUNDLE_VERSION, InitializeVariableVersion, (DWORD_PTR)L"0", FALSE, TRUE}, | 307 | {BURN_BUNDLE_VERSION, InitializeVariableVersion, (DWORD_PTR)L"0", FALSE, TRUE}, |
| @@ -1950,13 +1948,13 @@ static HRESULT InitializeVariableNativeMachine( | |||
| 1950 | ) | 1948 | ) |
| 1951 | { | 1949 | { |
| 1952 | UNREFERENCED_PARAMETER(dwpData); | 1950 | UNREFERENCED_PARAMETER(dwpData); |
| 1953 | 1951 | ||
| 1954 | HRESULT hr = S_OK; | 1952 | HRESULT hr = S_OK; |
| 1955 | USHORT usNativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; | 1953 | USHORT usNativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; |
| 1956 | 1954 | ||
| 1957 | hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); | 1955 | hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); |
| 1958 | ExitOnFailure(hr, "Failed to get native machine value."); | 1956 | ExitOnFailure(hr, "Failed to get native machine value."); |
| 1959 | 1957 | ||
| 1960 | if (S_FALSE != hr) | 1958 | if (S_FALSE != hr) |
| 1961 | { | 1959 | { |
| 1962 | hr = BVariantSetNumeric(pValue, usNativeMachine); | 1960 | hr = BVariantSetNumeric(pValue, usNativeMachine); |
