| 633 | } |
| 634 | |
| 635 | STDMETHODIMP CLegacyUpdateCtrl::BeforeUpdate(void) { |
| 636 | DoIsPermittedCheck(); |
| 637 | |
| 638 | IElevationHelper *elevatedHelper; |
| 639 | HRESULT hr = GetElevatedHelper(&elevatedHelper); |
| 640 | CHECK_HR_OR_RETURN(L"GetElevatedHelper"); |
| 641 | |
| 642 | // Allow IUpdateInstaller->RunWizard() dialog to come to foreground while this process is in foreground. |
| 643 | // Without this, Windows will see it as a disruption and ignore the request. |
| 644 | DWORD pid; |
| 645 | hr = elevatedHelper->GetProcessId(&pid); |
| 646 | if (SUCCEEDED(hr)) { |
| 647 | HWND hwnd = NULL; |
| 648 | GetIEWindowHWND(&hwnd); |
| 649 | |
| 650 | // Do some thread magic to execute in the thread context of the top-level IE process |
| 651 | BOOL attached = FALSE; |
| 652 | DWORD brokerThread = 0; |
| 653 | DWORD currentThread = GetCurrentThreadId(); |
| 654 | if (hwnd) { |
| 655 | brokerThread = GetWindowThreadProcessId(hwnd, NULL); |
| 656 | |
| 657 | if (brokerThread != 0 && brokerThread != currentThread) { |
| 658 | attached = AttachThreadInput(currentThread, brokerThread, TRUE); |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | AllowSetForegroundWindow(pid); |
| 663 | |
| 664 | if (attached) { |
| 665 | AttachThreadInput(currentThread, brokerThread, FALSE); |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | return elevatedHelper->BeforeUpdate(); |
| 670 | } |
| 671 | |
| 672 | STDMETHODIMP CLegacyUpdateCtrl::AfterUpdate(void) { |
| 673 | DoIsPermittedCheck(); |
nothing calls this directly
no test coverage detected