| 507 | } |
| 508 | |
| 509 | LRESULT CServiceTable::OnServicePause(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { |
| 510 | int selected = m_Table.data.selected; |
| 511 | ATLASSERT(selected >= 0); |
| 512 | auto& svc = m_Table.data.info[selected]; |
| 513 | |
| 514 | ATLASSERT(svc.GetStatusProcess().CurrentState == ServiceState::Running); |
| 515 | |
| 516 | auto service = Service::Open(svc.GetName(), ServiceAccessMask::PauseContinue | ServiceAccessMask::QueryStatus); |
| 517 | if (service == nullptr) { |
| 518 | AtlMessageBox(*this, L"Failed to open service", IDS_TITLE, MB_ICONERROR); |
| 519 | return 0; |
| 520 | } |
| 521 | |
| 522 | if (!service->Pause()) { |
| 523 | AtlMessageBox(*this, L"Failed to pause service", IDS_TITLE, MB_ICONERROR); |
| 524 | return 0; |
| 525 | } |
| 526 | |
| 527 | CProgressDlg dlg; |
| 528 | dlg.ShowCancelButton(false); |
| 529 | dlg.SetMessageText((L"Pausing service " + svc.GetName() + L"...").c_str()); |
| 530 | dlg.SetProgressMarquee(true); |
| 531 | dlg.SetTimerCallback([&]() { |
| 532 | service->Refresh(svc); |
| 533 | if (svc.GetStatusProcess().CurrentState == ServiceState::Paused) |
| 534 | dlg.Close(); |
| 535 | }, 500); |
| 536 | dlg.DoModal(); |
| 537 | |
| 538 | return 0; |
| 539 | } |
| 540 | |
| 541 | LRESULT CServiceTable::OnServiceContinue(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { |
| 542 | int selected = m_Table.data.selected; |
nothing calls this directly
no test coverage detected