MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / OnServicePause

Method OnServicePause

WinArk/ServiceTable.cpp:509–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509LRESULT 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
541LRESULT CServiceTable::OnServiceContinue(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
542 int selected = m_Table.data.selected;

Callers

nothing calls this directly

Calls 8

GetNameMethod · 0.80
ShowCancelButtonMethod · 0.80
SetMessageTextMethod · 0.80
SetProgressMarqueeMethod · 0.80
SetTimerCallbackMethod · 0.80
PauseMethod · 0.45
RefreshMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected