25 typedef struct _PH_SERVICES_CONTEXT
 
   28     ULONG NumberOfServices;
 
   31     PWSTR ListViewSettingName;
 
   38     _In_opt_ PVOID Parameter,
 
   39     _In_opt_ PVOID Context
 
   62     _In_ HWND ParentWindowHandle,
 
   64     _In_ ULONG NumberOfServices
 
   73     servicesContext->Services = Services;
 
   74     servicesContext->NumberOfServices = NumberOfServices;
 
   76     windowHandle = CreateDialogParam(
 
   81         (LPARAM)servicesContext
 
   94     _In_opt_ PVOID Parameter,
 
   95     _In_opt_ PVOID Context
 
  114     HWND descriptionLabel;
 
  116     startButton = GetDlgItem(hWnd, 
IDC_START);
 
  117     pauseButton = GetDlgItem(hWnd, 
IDC_PAUSE);
 
  122         SC_HANDLE serviceHandle;
 
  125         switch (ServiceItem->State)
 
  127         case SERVICE_RUNNING:
 
  129                 SetWindowText(startButton, L
"S&top");
 
  130                 SetWindowText(pauseButton, L
"&Pause");
 
  131                 EnableWindow(startButton, ServiceItem->ControlsAccepted & SERVICE_ACCEPT_STOP);
 
  132                 EnableWindow(pauseButton, ServiceItem->ControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE);
 
  137                 SetWindowText(startButton, L
"S&top");
 
  138                 SetWindowText(pauseButton, L
"C&ontinue");
 
  139                 EnableWindow(startButton, ServiceItem->ControlsAccepted & SERVICE_ACCEPT_STOP);
 
  140                 EnableWindow(pauseButton, ServiceItem->ControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE);
 
  143         case SERVICE_STOPPED:
 
  145                 SetWindowText(startButton, L
"&Start");
 
  146                 SetWindowText(pauseButton, L
"&Pause");
 
  147                 EnableWindow(startButton, 
TRUE);
 
  148                 EnableWindow(pauseButton, 
FALSE);
 
  151         case SERVICE_START_PENDING:
 
  152         case SERVICE_CONTINUE_PENDING:
 
  153         case SERVICE_PAUSE_PENDING:
 
  154         case SERVICE_STOP_PENDING:
 
  156                 SetWindowText(startButton, L
"&Start");
 
  157                 SetWindowText(pauseButton, L
"&Pause");
 
  158                 EnableWindow(startButton, 
FALSE);
 
  159                 EnableWindow(pauseButton, 
FALSE);
 
  165             ServiceItem->Name->Buffer,
 
  171                 SetWindowText(descriptionLabel, description->
Buffer);
 
  175             CloseServiceHandle(serviceHandle);
 
  180         SetWindowText(startButton, L
"&Start");
 
  181         SetWindowText(pauseButton, L
"&Pause");
 
  182         EnableWindow(startButton, 
FALSE);
 
  183         EnableWindow(pauseButton, 
FALSE);
 
  184         SetWindowText(descriptionLabel, L
"");
 
  198     if (uMsg == WM_INITDIALOG)
 
  207         if (uMsg == WM_DESTROY)
 
  213     if (!servicesContext)
 
  216     lvHandle = GetDlgItem(hwndDlg, 
IDC_LIST);
 
  228                 &servicesContext->ModifiedEventRegistration
 
  231             servicesContext->WindowHandle = hwndDlg;
 
  241             for (i = 0; i < servicesContext->NumberOfServices; i++)
 
  246                 serviceItem = servicesContext->Services[i];
 
  270             for (i = 0; i < servicesContext->NumberOfServices; i++)
 
  273             PhFree(servicesContext->Services);
 
  277                 &servicesContext->ModifiedEventRegistration
 
  280             if (servicesContext->ListViewSettingName)
 
  290             INT 
id = LOWORD(wParam);
 
  300                         switch (serviceItem->
State)
 
  302                         case SERVICE_RUNNING:
 
  308                         case SERVICE_STOPPED:
 
  321                         switch (serviceItem->
State)
 
  323                         case SERVICE_RUNNING:
 
  338             LPNMHDR header = (LPNMHDR)lParam;
 
  342             switch (header->code)
 
  346                     if (header->hwndFrom == lvHandle)
 
  357             case LVN_ITEMCHANGED:
 
  359                     if (header->hwndFrom == lvHandle)
 
  364                         if (ListView_GetSelectedCount(lvHandle) == 1)
 
  384             if (ListView_GetSelectedCount(lvHandle) == 1)
 
  387             if (serviceModifiedData->
Service == serviceItem)
 
  392             PhFree(serviceModifiedData);
 
  397             PWSTR settingName = (PWSTR)lParam;
 
  399             servicesContext->ListViewSettingName = settingName;