Commit 5c46ba1
authored
Improve MOTW error handling in download flow (#6127)
#### DownloadFlow.cpp
- Reorder workflow: RenameDownloadedInstaller now runs before
UpdateInstallerFileMotwIfApplicable, so AES always scans the
properly-named installer file.
#### Downloader.cpp — RemoveMotwIfApplicable
- Also handle ERROR_PATH_NOT_FOUND (in addition to ERROR_FILE_NOT_FOUND)
from IPersistFile::Load — different Windows builds return different
codes when no Zone.Identifier ADS is present.
- Restore missing THROW_IF_FAILED(hr) to correctly surface any other
Load failures rather than falling through to Remove()/Save() on an
unloaded object.
#### Downloader.cpp — ApplyMotwUsingIAttachmentExecuteIfApplicable
- Wrap RemoveMotwIfApplicable in a try/catch inside the updateMotw
lambda — log a warning but proceed to IAttachmentExecute::Save(). MOTW
removal is best-effort; a removal failure should not abort the
security scan.
- Wrap the entire AES thread body in try/catch and log exceptions via
AICLI_LOG, so unhandled errors are surfaced rather than silently leaving
hr in an indeterminate state. Use LOG_IF_FAILED for
CoInitializeEx so failures are captured through WIL.
- Fix the return value: previously aesSaveResult was always returned,
reporting S_OK when Save() was never reached (e.g. after CoInitializeEx
failure). Now returns the thread's hr when aesSaveResult was
never updated1 parent f90155a commit 5c46ba1
2 files changed
Lines changed: 36 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
342 | | - | |
| 341 | + | |
| 342 | + | |
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
| 484 | + | |
| 485 | + | |
485 | 486 | | |
486 | | - | |
| 487 | + | |
| 488 | + | |
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| 496 | + | |
| 497 | + | |
494 | 498 | | |
495 | 499 | | |
496 | 500 | | |
| |||
516 | 520 | | |
517 | 521 | | |
518 | 522 | | |
519 | | - | |
520 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
521 | 534 | | |
522 | 535 | | |
523 | 536 | | |
| |||
536 | 549 | | |
537 | 550 | | |
538 | 551 | | |
539 | | - | |
540 | | - | |
| 552 | + | |
541 | 553 | | |
542 | | - | |
543 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
544 | 559 | | |
545 | | - | |
546 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
547 | 568 | | |
548 | 569 | | |
549 | 570 | | |
550 | 571 | | |
551 | 572 | | |
552 | 573 | | |
553 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
554 | 577 | | |
555 | 578 | | |
556 | 579 | | |
| |||
0 commit comments