ReactOS  0.4.12-dev-18-gf469aca
propsheet_general.c File Reference
#include "precomp.h"
Include dependency graph for propsheet_general.c:

Go to the source code of this file.

Classes

struct  _PAGEDATA
 

Typedefs

typedef struct _PAGEDATA PAGEDATA
 
typedef struct _PAGEDATAPPAGEDATA
 

Functions

static VOID SetButtonStates (PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
 
static VOID SetServiceStatusText (PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
 
static VOID SetStartupType (LPWSTR lpServiceName, HWND hwndDlg)
 
static VOID InitGeneralPage (PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
 
VOID SaveDlgInfo (PPAGEDATA pPageData, HWND hwndDlg)
 
INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Typedef Documentation

◆ PAGEDATA

◆ PPAGEDATA

Function Documentation

◆ GeneralPageProc()

INT_PTR CALLBACK GeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 327 of file propsheet_general.c.

331 {
332  PPAGEDATA pPageData;
333 
334  /* Get the window context */
335  pPageData = (PPAGEDATA)GetWindowLongPtr(hwndDlg,
336  GWLP_USERDATA);
337  if (pPageData == NULL && uMsg != WM_INITDIALOG)
338  {
339  return FALSE;
340  }
341 
342  switch (uMsg)
343  {
344  case WM_INITDIALOG:
345  pPageData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PAGEDATA));
346  if (pPageData != NULL)
347  {
348  SetWindowLongPtr(hwndDlg,
350  (LONG_PTR)pPageData);
351 
352  pPageData->dlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
353  if (pPageData->dlgInfo != NULL)
354  {
355  InitGeneralPage(pPageData->dlgInfo, hwndDlg);
356  SetButtonStates(pPageData->dlgInfo, hwndDlg);
357  }
358  }
359  break;
360 
361  case WM_DESTROY:
362  HeapFree(GetProcessHeap(), 0, pPageData);
363  break;
364 
365  case WM_COMMAND:
366  switch(LOWORD(wParam))
367  {
368  case IDC_START_TYPE:
369  if (HIWORD(wParam) == CBN_SELCHANGE)
370  {
371  pPageData->bStartTypeChanged = TRUE;
372  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
373  }
374  break;
375 
376  case IDC_DISP_NAME:
377  if (HIWORD(wParam) == EN_CHANGE)
378  {
379  pPageData->bDisplayNameChanged = TRUE;
380  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
381  }
382  break;
383 
384  case IDC_DESCRIPTION:
385  if (HIWORD(wParam) == EN_CHANGE)
386  {
387  pPageData->bDescriptionChanged = TRUE;
388  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
389  }
390  break;
391 
392  case IDC_EXEPATH:
393  if (HIWORD(wParam) == EN_CHANGE)
394  {
395  pPageData->bBinaryPathChanged = TRUE;
396  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
397  }
398  break;
399 
400  case IDC_START:
401  {
402  WCHAR szStartParams[256];
403  LPWSTR lpStartParams = NULL;
404 
405  if (GetDlgItemText(hwndDlg, IDC_START_PARAM, szStartParams, 256) > 0)
406  lpStartParams = szStartParams;
407 
409 
410  RunActionWithProgress(hwndDlg,
411  pPageData->dlgInfo->pService->lpServiceName,
412  pPageData->dlgInfo->pService->lpDisplayName,
413  ACTION_START,
414  lpStartParams);
415 
416  UpdateServiceStatus(pPageData->dlgInfo->pService);
417  ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
418  SetButtonStates(pPageData->dlgInfo, hwndDlg);
419  SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
420  break;
421  }
422 
423  case IDC_STOP:
424  RunActionWithProgress(hwndDlg,
425  pPageData->dlgInfo->pService->lpServiceName,
426  pPageData->dlgInfo->pService->lpDisplayName,
427  ACTION_STOP,
428  NULL);
429 
430  UpdateServiceStatus(pPageData->dlgInfo->pService);
431  ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
432  SetButtonStates(pPageData->dlgInfo, hwndDlg);
433  SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
434  break;
435 
436  case IDC_PAUSE:
437  RunActionWithProgress(hwndDlg,
438  pPageData->dlgInfo->pService->lpServiceName,
439  pPageData->dlgInfo->pService->lpDisplayName,
440  ACTION_PAUSE,
441  NULL);
442 
443  UpdateServiceStatus(pPageData->dlgInfo->pService);
444  ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
445  SetButtonStates(pPageData->dlgInfo, hwndDlg);
446  SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
447  break;
448 
449  case IDC_RESUME:
450  RunActionWithProgress(hwndDlg,
451  pPageData->dlgInfo->pService->lpServiceName,
452  pPageData->dlgInfo->pService->lpDisplayName,
454  NULL);
455 
456  UpdateServiceStatus(pPageData->dlgInfo->pService);
457  ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
458  SetButtonStates(pPageData->dlgInfo, hwndDlg);
459  SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
460  break;
461 
462  case IDC_EDIT:
467  break;
468  }
469  break;
470 
471  case WM_NOTIFY:
472  switch (((LPNMHDR)lParam)->code)
473  {
474  case PSN_APPLY:
475  if (pPageData->bDisplayNameChanged ||
476  pPageData->bDescriptionChanged ||
477  pPageData->bBinaryPathChanged ||
478  pPageData->bStartTypeChanged)
479  {
480  SaveDlgInfo(pPageData, hwndDlg);
481  SetButtonStates(pPageData->dlgInfo, hwndDlg);
482  pPageData->bDisplayNameChanged = FALSE;
483  pPageData->bDescriptionChanged = FALSE;
484  pPageData->bBinaryPathChanged = FALSE;
485  pPageData->bStartTypeChanged = FALSE;
486  }
487  break;
488  }
489  break;
490  }
491 
492  return FALSE;
493 }
#define IDC_START_TYPE
Definition: resource.h:133
struct _PAGEDATA * PPAGEDATA
#define TRUE
Definition: types.h:120
#define ACTION_START
Definition: precomp.h:37
#define EM_SETREADONLY
Definition: winuser.h:1976
__wchar_t WCHAR
Definition: xmlstorage.h:180
static VOID SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
#define ACTION_STOP
Definition: precomp.h:38
BOOL bDescriptionChanged
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
Definition: progress.c:322
PSERVICEPROPSHEET dlgInfo
#define SendDlgItemMessage
Definition: winuser.h:5708
#define PSN_APPLY
Definition: prsht.h:117
BOOL bDisplayNameChanged
#define IDC_PAUSE
Definition: resource.h:75
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define IDC_START
Definition: resource.h:137
#define LVSTATUS
Definition: precomp.h:29
#define IDC_STOP
Definition: resource.h:69
#define GWLP_USERDATA
Definition: treelist.c:63
BOOL bBinaryPathChanged
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define ACTION_RESUME
Definition: precomp.h:40
#define WM_DESTROY
Definition: winuser.h:1591
#define GetDlgItemText
Definition: winuser.h:5651
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_DISP_NAME
Definition: resource.h:130
#define IDC_DESCRIPTION
Definition: resource.h:131
static VOID SetButtonStates(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
BOOL bStartTypeChanged
#define WM_COMMAND
Definition: winuser.h:1716
#define IDC_START_PARAM
Definition: resource.h:135
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ACTION_PAUSE
Definition: precomp.h:39
HWND WINAPI GetParent(_In_ HWND)
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS *pService)
Definition: query.c:373
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
#define IDC_RESUME
Definition: resource.h:140
#define IDC_EDIT
Definition: resource.h:136
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CBN_SELCHANGE
Definition: winuser.h:1940
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_EXEPATH
Definition: resource.h:132
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define WM_INITDIALOG
Definition: winuser.h:1715
static VOID InitGeneralPage(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
PMAIN_WND_INFO Info
Definition: precomp.h:129
#define HeapFree(x, y, z)
Definition: compat.h:394
VOID SaveDlgInfo(PPAGEDATA pPageData, HWND hwndDlg)
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:1983

◆ InitGeneralPage()

static VOID InitGeneralPage ( PSERVICEPROPSHEET  dlgInfo,
HWND  hwndDlg 
)
static

Definition at line 155 of file propsheet_general.c.

Referenced by GeneralPageProc().

157 {
158  LPQUERY_SERVICE_CONFIG pServiceConfig;
159  LPWSTR lpDescription;
160 
161  /* set the service name */
162  SendDlgItemMessageW(hwndDlg,
164  WM_SETTEXT,
165  0,
166  (LPARAM)dlgInfo->pService->lpServiceName);
167 
168  /* set the display name */
169  SendDlgItemMessageW(hwndDlg,
171  WM_SETTEXT,
172  0,
173  (LPARAM)dlgInfo->pService->lpDisplayName);
174 
175  /* set the description */
176  if ((lpDescription = GetServiceDescription(dlgInfo->pService->lpServiceName)))
177  {
178  SendDlgItemMessageW(hwndDlg,
180  WM_SETTEXT,
181  0,
182  (LPARAM)lpDescription);
183 
185  0,
186  lpDescription);
187  }
188 
189  pServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName);
190  if (pServiceConfig)
191  {
192  SendDlgItemMessageW(hwndDlg,
193  IDC_EXEPATH,
194  WM_SETTEXT,
195  0,
196  (LPARAM)pServiceConfig->lpBinaryPathName);
198  0,
199  pServiceConfig);
200  }
201 
202 
203  /* set startup type */
204  SetStartupType(dlgInfo->pService->lpServiceName, hwndDlg);
205 
206  SetServiceStatusText(dlgInfo,
207  hwndDlg);
208 
209  if (dlgInfo->Info->bIsUserAnAdmin)
210  {
211  EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), TRUE);
212  }
213 }
#define TRUE
Definition: types.h:120
LPWSTR GetServiceDescription(LPWSTR lpServiceName)
Definition: query.c:135
#define IDC_SERV_NAME
Definition: resource.h:129
static VOID SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_DISP_NAME
Definition: resource.h:130
#define IDC_DESCRIPTION
Definition: resource.h:131
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL bIsUserAnAdmin
Definition: precomp.h:66
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
#define IDC_EDIT
Definition: resource.h:136
#define IDC_EXEPATH
Definition: resource.h:132
WCHAR * LPWSTR
Definition: xmlstorage.h:184
PMAIN_WND_INFO Info
Definition: precomp.h:129
#define HeapFree(x, y, z)
Definition: compat.h:394
static VOID SetStartupType(LPWSTR lpServiceName, HWND hwndDlg)

◆ SaveDlgInfo()

VOID SaveDlgInfo ( PPAGEDATA  pPageData,
HWND  hwndDlg 
)

Definition at line 216 of file propsheet_general.c.

Referenced by GeneralPageProc().

218 {
219  LPQUERY_SERVICE_CONFIG pServiceConfig = NULL;
220  PWSTR pDisplayName = NULL;
221  PWSTR pDescription;
222  INT nLength;
223  DWORD StartUp;
224 
225  pServiceConfig = HeapAlloc(ProcessHeap,
227  sizeof(*pServiceConfig));
228  if (pServiceConfig)
229  {
230  pServiceConfig->dwServiceType = SERVICE_NO_CHANGE;
231  pServiceConfig->dwErrorControl = SERVICE_NO_CHANGE;
232  pServiceConfig->dwStartType = SERVICE_NO_CHANGE;
233 
234  if (pPageData->bStartTypeChanged)
235  {
236  StartUp = SendDlgItemMessageW(hwndDlg, IDC_START_TYPE, CB_GETCURSEL, 0, 0);
237  switch (StartUp)
238  {
239  case 0:
240  pServiceConfig->dwStartType = SERVICE_AUTO_START;
241  break;
242 
243  case 1:
244  pServiceConfig->dwStartType = SERVICE_DEMAND_START;
245  break;
246  case 2:
247  pServiceConfig->dwStartType = SERVICE_DISABLED;
248  break;
249  }
250  }
251 
252  if (pPageData->bBinaryPathChanged)
253  {
254  nLength = SendDlgItemMessageW(hwndDlg, IDC_EXEPATH, WM_GETTEXTLENGTH, 0, 0);
255  pServiceConfig->lpBinaryPathName = HeapAlloc(ProcessHeap,
257  (nLength + 1) * sizeof(WCHAR));
258  if (pServiceConfig->lpBinaryPathName != NULL)
259  SendDlgItemMessageW(hwndDlg, IDC_EXEPATH, WM_GETTEXT, nLength + 1, (LPARAM)pServiceConfig->lpBinaryPathName);
260  }
261 
262  if (pPageData->bDisplayNameChanged)
263  {
264  nLength = SendDlgItemMessageW(hwndDlg, IDC_DISP_NAME, WM_GETTEXTLENGTH, 0, 0);
265  pDisplayName = HeapAlloc(ProcessHeap,
267  (nLength + 1) * sizeof(WCHAR));
268  if (pDisplayName != NULL)
269  {
270  SendDlgItemMessageW(hwndDlg, IDC_DISP_NAME, WM_GETTEXT, nLength + 1, (LPARAM)pDisplayName);
271 
272  if (pPageData->dlgInfo->pService->lpDisplayName)
274 
275  pPageData->dlgInfo->pService->lpDisplayName = pDisplayName;
276  pServiceConfig->lpDisplayName = pDisplayName;
277  }
278  }
279 
280  if (SetServiceConfig(pServiceConfig,
281  pPageData->dlgInfo->pService->lpServiceName,
282  NULL))
283  {
284  if (pPageData->bDisplayNameChanged)
285  ChangeListViewText(pPageData->dlgInfo->Info,
286  pPageData->dlgInfo->pService,
287  LVNAME);
288 
289  if (pPageData->bStartTypeChanged)
290  ChangeListViewText(pPageData->dlgInfo->Info,
291  pPageData->dlgInfo->pService,
292  LVSTARTUP);
293  }
294 
295  if (pServiceConfig->lpBinaryPathName != NULL)
296  HeapFree(ProcessHeap, 0, pServiceConfig->lpBinaryPathName);
297 
298  HeapFree(ProcessHeap, 0, pServiceConfig);
299  }
300 
301  if (pPageData->bDescriptionChanged)
302  {
303  nLength = SendDlgItemMessageW(hwndDlg, IDC_DESCRIPTION, WM_GETTEXTLENGTH, 0, 0);
304  pDescription = HeapAlloc(ProcessHeap, HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
305  if (pDescription != NULL)
306  {
307  SendDlgItemMessageW(hwndDlg, IDC_DESCRIPTION, WM_GETTEXT, nLength + 1, (LPARAM)pDescription);
308 
310  pDescription))
311  {
312  ChangeListViewText(pPageData->dlgInfo->Info,
313  pPageData->dlgInfo->pService,
314  LVDESC);
315  }
316 
317  HeapFree(ProcessHeap, 0, pDescription);
318  }
319  }
320 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define IDC_START_TYPE
Definition: resource.h:133
#define LVSTARTUP
Definition: precomp.h:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint16_t * PWSTR
Definition: typedefs.h:54
#define WM_GETTEXT
Definition: winuser.h:1600
BOOL bDescriptionChanged
_In_ DWORD nLength
Definition: wincon.h:461
PSERVICEPROPSHEET dlgInfo
BOOL SetServiceDescription(LPWSTR lpServiceName, LPWSTR lpDescription)
Definition: query.c:210
BOOL bDisplayNameChanged
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1904
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define SERVICE_DISABLED
Definition: cmtypes.h:977
LONG_PTR LPARAM
Definition: windef.h:208
BOOL bBinaryPathChanged
smooth NULL
Definition: ftsmooth.c:416
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IDC_DISP_NAME
Definition: resource.h:130
#define IDC_DESCRIPTION
Definition: resource.h:131
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL bStartTypeChanged
HANDLE ProcessHeap
Definition: servman.c:15
BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, LPWSTR lpServiceName, LPWSTR lpPassword)
Definition: query.c:82
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
#define LVDESC
Definition: precomp.h:28
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SERVICE_AUTO_START
Definition: cmtypes.h:975
#define IDC_EXEPATH
Definition: resource.h:132
#define SERVICE_DEMAND_START
Definition: cmtypes.h:976
PMAIN_WND_INFO Info
Definition: precomp.h:129
#define LVNAME
Definition: precomp.h:27
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SetButtonStates()

static VOID SetButtonStates ( PSERVICEPROPSHEET  dlgInfo,
HWND  hwndDlg 
)
static

Definition at line 24 of file propsheet_general.c.

Referenced by GeneralPageProc().

26 {
27  HWND hButton;
28  LPQUERY_SERVICE_CONFIG lpServiceConfig;
29  DWORD Flags, State;
30  UINT i;
31 
34 
35  for (i = IDC_START; i <= IDC_RESUME; i++)
36  {
37  hButton = GetDlgItem(hwndDlg, i);
38  EnableWindow (hButton, FALSE);
39  }
40 
41  lpServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName);
42  if (State == SERVICE_STOPPED &&
43  lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
44  {
45  hButton = GetDlgItem(hwndDlg, IDC_START);
46  EnableWindow (hButton, TRUE);
47  }
48  else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
49  {
50  hButton = GetDlgItem(hwndDlg, IDC_STOP);
51  EnableWindow (hButton, TRUE);
52  }
53  else if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
54  {
55  hButton = GetDlgItem(hwndDlg, IDC_PAUSE);
56  EnableWindow (hButton, TRUE);
57  }
58 
59  hButton = GetDlgItem(hwndDlg, IDC_START_PARAM);
60  EnableWindow(hButton, (State == SERVICE_STOPPED && lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED));
61 
62  if (lpServiceConfig)
63  HeapFree(GetProcessHeap(), 0, lpServiceConfig);
64 
65  /* set the main toolbar */
66  SetMenuAndButtonStates(dlgInfo->Info);
67 }
#define TRUE
Definition: types.h:120
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define IDC_PAUSE
Definition: resource.h:75
#define IDC_START
Definition: resource.h:137
#define SERVICE_DISABLED
Definition: cmtypes.h:977
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define IDC_STOP
Definition: resource.h:69
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define GetProcessHeap()
Definition: compat.h:395
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned int UINT
Definition: ndis.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define IDC_START_PARAM
Definition: resource.h:135
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
enum State_ State
Definition: pofuncs.h:54
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
#define IDC_RESUME
Definition: resource.h:140
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
Definition: mainwnd.c:151
SERVICE_STATUS_PROCESS ServiceStatusProcess
Definition: winsvc.h:137
PMAIN_WND_INFO Info
Definition: precomp.h:129
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SetServiceStatusText()

static VOID SetServiceStatusText ( PSERVICEPROPSHEET  dlgInfo,
HWND  hwndDlg 
)
static

Definition at line 70 of file propsheet_general.c.

Referenced by GeneralPageProc(), and InitGeneralPage().

72 {
73  LPWSTR lpStatus;
74  UINT id;
75 
77  {
79  }
80  else
81  {
83  }
84 
85  if (AllocAndLoadString(&lpStatus,
86  hInstance,
87  id))
88  {
89  SendDlgItemMessageW(hwndDlg,
91  WM_SETTEXT,
92  0,
93  (LPARAM)lpStatus);
94  LocalFree(lpStatus);
95  }
96 }
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
HINSTANCE hInstance
Definition: charmap.c:20
LONG_PTR LPARAM
Definition: windef.h:208
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define WM_SETTEXT
Definition: winuser.h:1599
#define IDS_SERVICES_STARTED
Definition: resource.h:59
unsigned int UINT
Definition: ndis.h:50
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define IDC_SERV_STATUS
Definition: resource.h:134
GLenum GLuint id
Definition: glext.h:5579
WCHAR * LPWSTR
Definition: xmlstorage.h:184
SERVICE_STATUS_PROCESS ServiceStatusProcess
Definition: winsvc.h:137
#define IDS_SERVICES_STOPPED
Definition: resource.h:60

◆ SetStartupType()

static VOID SetStartupType ( LPWSTR  lpServiceName,
HWND  hwndDlg 
)
static

Definition at line 103 of file propsheet_general.c.

Referenced by InitGeneralPage().

105 {
106  HWND hList;
107  LPQUERY_SERVICE_CONFIG pServiceConfig;
108  LPWSTR lpBuf;
109  DWORD StartUp = 0;
110  UINT i;
111 
112  hList = GetDlgItem(hwndDlg, IDC_START_TYPE);
113 
114  for (i = IDS_SERVICES_AUTO; i <= IDS_SERVICES_DIS; i++)
115  {
116  if (AllocAndLoadString(&lpBuf,
117  hInstance,
118  i))
119  {
120  SendMessageW(hList,
121  CB_ADDSTRING,
122  0,
123  (LPARAM)lpBuf);
124  LocalFree(lpBuf);
125  }
126  }
127 
128  pServiceConfig = GetServiceConfig(lpServiceName);
129 
130  if (pServiceConfig)
131  {
132  switch (pServiceConfig->dwStartType)
133  {
134  case SERVICE_AUTO_START: StartUp = 0; break;
135  case SERVICE_DEMAND_START: StartUp = 1; break;
136  case SERVICE_DISABLED: StartUp = 2; break;
137  }
138 
139  SendMessageW(hList,
140  CB_SETCURSEL,
141  StartUp,
142  0);
143 
145  0,
146  pServiceConfig);
147  }
148 }
#define IDC_START_TYPE
Definition: resource.h:133
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
#define SERVICE_DISABLED
Definition: cmtypes.h:977
GLenum GLclampf GLint i
Definition: glfuncs.h:14
HINSTANCE hInstance
Definition: charmap.c:20
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ADDSTRING
Definition: winuser.h:1897
#define IDS_SERVICES_DIS
Definition: resource.h:63
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned int UINT
Definition: ndis.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define CB_SETCURSEL
Definition: winuser.h:1922
HANDLE ProcessHeap
Definition: servman.c:15
HWND hList
Definition: livecd.c:10
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SERVICE_AUTO_START
Definition: cmtypes.h:975
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define SERVICE_DEMAND_START
Definition: cmtypes.h:976
#define IDS_SERVICES_AUTO
Definition: resource.h:61
#define HeapFree(x, y, z)
Definition: compat.h:394