ReactOS  0.4.15-dev-1374-g8d3e80e
precomp.h File Reference
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
#include <wingdi.h>
#include <winsvc.h>
#include <wincon.h>
#include <shlobj.h>
#include <commdlg.h>
#include <strsafe.h>
#include <process.h>
#include "resource.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MAIN_WND_INFO
 
struct  _MENU_HINT
 
struct  _SERVICEPROPSHEET
 
struct  _DEPENDDATA
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NO_ITEM_SELECTED   -1
 
#define MAX_KEY_LENGTH   256
 
#define LVNAME   0
 
#define LVDESC   1
 
#define LVSTATUS   2
 
#define LVSTARTUP   3
 
#define LVLOGONAS   4
 
#define IMAGE_UNKNOWN   0
 
#define IMAGE_SERVICE   1
 
#define IMAGE_DRIVER   2
 
#define ACTION_START   1
 
#define ACTION_STOP   2
 
#define ACTION_PAUSE   3
 
#define ACTION_RESUME   4
 
#define ACTION_RESTART   5
 
#define ORD_ASCENDING   1
 
#define ORD_DESCENDING   -1
 
#define DEFAULT_STEP   0
 

Typedefs

typedef struct _MAIN_WND_INFO MAIN_WND_INFO
 
typedef struct _MAIN_WND_INFOPMAIN_WND_INFO
 
typedef struct _MENU_HINT MENU_HINT
 
typedef struct _MENU_HINTPMENU_HINT
 
typedef struct _SERVICEPROPSHEET SERVICEPROPSHEET
 
typedef struct _SERVICEPROPSHEETPSERVICEPROPSHEET
 
typedef struct _DEPENDDATA DEPENDDATA
 
typedef struct _DEPENDDATAPDEPENDDATA
 

Functions

INT_PTR CALLBACK AboutDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK CreateDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK DeleteDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK ProgressDialogProc (HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
 
VOID SetMenuAndButtonStates (PMAIN_WND_INFO Info)
 
VOID UpdateServiceCount (PMAIN_WND_INFO Info)
 
VOID ChangeListViewText (PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
 
BOOL InitMainWindowImpl (VOID)
 
VOID UninitMainWindowImpl (VOID)
 
HWND CreateMainWindow (LPCTSTR lpCaption, int nCmdShow)
 
VOID SetListViewStyle (HWND hListView, DWORD View)
 
VOID ListViewSelectionChanged (PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv)
 
BOOL CreateListView (PMAIN_WND_INFO Info)
 
DWORD DoStartService (LPWSTR ServiceName, HANDLE hProgress, LPWSTR lpStartParams)
 
DWORD DoStopService (LPWSTR ServiceName, HANDLE hProgress)
 
DWORD DoControlService (LPWSTR ServiceName, HWND hProgress, DWORD Control)
 
BOOL RunActionWithProgress (HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
 
VOID IncrementProgressBar (HANDLE hProgress, UINT NewPos)
 
VOID CompleteProgressBar (HANDLE hProgress)
 
ENUM_SERVICE_STATUS_PROCESSGetSelectedService (PMAIN_WND_INFO Info)
 
LPQUERY_SERVICE_CONFIG GetServiceConfig (LPWSTR lpServiceName)
 
BOOL SetServiceConfig (LPQUERY_SERVICE_CONFIG pServiceConfig, LPWSTR lpServiceName, LPWSTR lpPassword)
 
LPWSTR GetServiceDescription (LPWSTR lpServiceName)
 
BOOL SetServiceDescription (LPWSTR lpServiceName, LPWSTR lpDescription)
 
LPWSTR GetExecutablePath (LPWSTR lpServiceName)
 
VOID FreeServiceList (PMAIN_WND_INFO Info)
 
BOOL RefreshServiceList (PMAIN_WND_INFO Info)
 
BOOL UpdateServiceStatus (ENUM_SERVICE_STATUS_PROCESS *pService)
 
BOOL GetServiceList (PMAIN_WND_INFO Info)
 
HTREEITEM AddItemToTreeView (HWND hTreeView, HTREEITEM hRoot, LPWSTR lpDisplayName, LPWSTR lpServiceName, ULONG serviceType, BOOL bHasChildren)
 
INT_PTR CALLBACK StopDependsDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
LPWSTR GetListOfServicesToStop (LPWSTR lpServiceName)
 
BOOL CreateStopDependsDialog (HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, LPWSTR ServiceList)
 
BOOL TV1_Initialize (PDEPENDDATA pDependData, LPWSTR lpServiceName)
 
VOID TV1_AddDependantsToTree (PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
 
BOOL TV2_Initialize (PDEPENDDATA pDependData, LPWSTR lpServiceName)
 
VOID TV2_AddDependantsToTree (PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
 
BOOL TV2_HasDependantServices (LPWSTR lpServiceName)
 
LPENUM_SERVICE_STATUS TV2_GetDependants (LPWSTR lpServiceName, LPDWORD lpdwCount)
 
VOID OpenPropSheet (PMAIN_WND_INFO Info)
 
INT_PTR CALLBACK DependenciesPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK LogonPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK RecoveryPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID ExportFile (PMAIN_WND_INFO Info)
 
INT AllocAndLoadString (OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
 
DWORD LoadAndFormatString (IN HINSTANCE hInstance, IN UINT uID, OUT LPWSTR *lpTarget,...)
 
BOOL StatusBarLoadAndFormatString (IN HWND hStatusBar, IN INT PartId, IN HINSTANCE hInstance, IN UINT uID,...)
 
BOOL StatusBarLoadString (IN HWND hStatusBar, IN INT PartId, IN HINSTANCE hInstance, IN UINT uID)
 
INT GetTextFromEdit (OUT LPWSTR lpString, IN HWND hDlg, IN UINT Res)
 
VOID GetError (VOID)
 
VOID DisplayString (PWCHAR)
 
HIMAGELIST InitImageList (UINT StartResource, UINT EndResource, UINT Width, UINT Height, ULONG type)
 
VOID ResourceMessageBox (HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
 

Variables

HINSTANCE hInstance
 
HANDLE ProcessHeap
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 5 of file precomp.h.

◆ ACTION_PAUSE

#define ACTION_PAUSE   3

Definition at line 41 of file precomp.h.

◆ ACTION_RESTART

#define ACTION_RESTART   5

Definition at line 43 of file precomp.h.

◆ ACTION_RESUME

#define ACTION_RESUME   4

Definition at line 42 of file precomp.h.

◆ ACTION_START

#define ACTION_START   1

Definition at line 39 of file precomp.h.

◆ ACTION_STOP

#define ACTION_STOP   2

Definition at line 40 of file precomp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 6 of file precomp.h.

◆ DEFAULT_STEP

#define DEFAULT_STEP   0

Definition at line 110 of file precomp.h.

◆ IMAGE_DRIVER

#define IMAGE_DRIVER   2

Definition at line 37 of file precomp.h.

◆ IMAGE_SERVICE

#define IMAGE_SERVICE   1

Definition at line 36 of file precomp.h.

◆ IMAGE_UNKNOWN

#define IMAGE_UNKNOWN   0

Definition at line 35 of file precomp.h.

◆ LVDESC

#define LVDESC   1

Definition at line 30 of file precomp.h.

◆ LVLOGONAS

#define LVLOGONAS   4

Definition at line 33 of file precomp.h.

◆ LVNAME

#define LVNAME   0

Definition at line 29 of file precomp.h.

◆ LVSTARTUP

#define LVSTARTUP   3

Definition at line 32 of file precomp.h.

◆ LVSTATUS

#define LVSTATUS   2

Definition at line 31 of file precomp.h.

◆ MAX_KEY_LENGTH

#define MAX_KEY_LENGTH   256

Definition at line 27 of file precomp.h.

◆ NO_ITEM_SELECTED

#define NO_ITEM_SELECTED   -1

Definition at line 26 of file precomp.h.

◆ ORD_ASCENDING

#define ORD_ASCENDING   1

Definition at line 45 of file precomp.h.

◆ ORD_DESCENDING

#define ORD_DESCENDING   -1

Definition at line 46 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 4 of file precomp.h.

Typedef Documentation

◆ DEPENDDATA

◆ MAIN_WND_INFO

◆ MENU_HINT

◆ PDEPENDDATA

◆ PMAIN_WND_INFO

◆ PMENU_HINT

◆ PSERVICEPROPSHEET

◆ SERVICEPROPSHEET

Function Documentation

◆ AboutDialogProc()

INT_PTR CALLBACK AboutDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 4 of file about.c.

8 {
9  HWND hLicenseEditWnd;
10  HICON hIcon = NULL;
11  TCHAR strLicense[700];
12 
13  switch (message)
14  {
15  case WM_INITDIALOG:
16 
19  IMAGE_ICON,
20  16,
21  16,
22  0);
23 
24  SendMessage(hDlg,
25  WM_SETICON,
26  ICON_SMALL,
27  (LPARAM)hIcon);
28 
29  hLicenseEditWnd = GetDlgItem(hDlg,
31 
34  strLicense,
35  sizeof(strLicense) / sizeof(TCHAR));
36 
37  SetWindowText(hLicenseEditWnd,
38  strLicense);
39  return TRUE;
40 
41  case WM_COMMAND:
42  if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
43  {
45  EndDialog(hDlg,
46  LOWORD(wParam));
47  return TRUE;
48  }
49 
50  break;
51  }
52 
53  return FALSE;
54 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define IDOK
Definition: winuser.h:824
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define ICON_SMALL
Definition: tnclass.cpp:48
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
#define IDI_IMAGESOFTICON
Definition: resource.h:13
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1722
#define IDS_LICENSE
Definition: resource.h:28
HICON hIcon
Definition: msconfig.c:44
#define SetWindowText
Definition: winuser.h:5832
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5818
#define LoadImage
Definition: winuser.h:5790
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
#define LoadString
Definition: winuser.h:5794
#define IDC_LICENSE_EDIT
Definition: resource.h:20

◆ AddItemToTreeView()

HTREEITEM AddItemToTreeView ( HWND  hTreeView,
HTREEITEM  hRoot,
LPWSTR  lpDisplayName,
LPWSTR  lpServiceName,
ULONG  serviceType,
BOOL  bHasChildren 
)

Definition at line 13 of file propsheet_depends.c.

19 {
20  TV_ITEM tvi;
21  TV_INSERTSTRUCT tvins;
22  LPWSTR lpName;
23  DWORD dwSize;
24 
25  ZeroMemory(&tvi, sizeof(tvi));
26  ZeroMemory(&tvins, sizeof(tvins));
27 
29  tvi.pszText = lpDisplayName;
30  tvi.cchTextMax = wcslen(lpDisplayName);
31  tvi.cChildren = bHasChildren;
32 
33  /* Select the image for this service */
34  switch (ServiceType)
35  {
38  tvi.iImage = IMAGE_SERVICE;
39  tvi.iSelectedImage = IMAGE_SERVICE;
40  break;
41 
44  tvi.iImage = IMAGE_DRIVER;
45  tvi.iSelectedImage = IMAGE_DRIVER;
46  break;
47 
48  default:
49  tvi.iImage = IMAGE_UNKNOWN;
50  tvi.iSelectedImage = IMAGE_UNKNOWN;
51  break;
52  }
53 
54  if (lpServiceName)
55  {
56  dwSize = wcslen(lpServiceName) + 1;
57  /* Attach the service name */
59  0,
60  dwSize * sizeof(WCHAR));
61  if (lpName)
62  {
63  StringCchCopyW(lpName, dwSize, lpServiceName);
64  tvi.lParam = (LPARAM)lpName;
65  }
66  }
67 
68  tvins.item = tvi;
69  tvins.hParent = hParent;
70 
71  return TreeView_InsertItem(hTreeView, &tvins);
72 }
_In_ LPCSTR lpName
Definition: winbase.h:2752
#define ZeroMemory
Definition: winbase.h:1648
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
#define IMAGE_SERVICE
Definition: precomp.h:36
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TVIF_CHILDREN
Definition: commctrl.h:3268
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
LONG_PTR LPARAM
Definition: windef.h:208
#define SERVICE_FILE_SYSTEM_DRIVER
Definition: cmtypes.h:954
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SERVICE_WIN32_SHARE_PROCESS
Definition: cmtypes.h:963
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define IMAGE_UNKNOWN
Definition: precomp.h:35
#define TV_ITEM
Definition: commctrl.h:3296
#define TVIF_TEXT
Definition: commctrl.h:3262
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define IMAGE_DRIVER
Definition: precomp.h:37
#define TVIF_PARAM
Definition: commctrl.h:3264
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define TV_INSERTSTRUCT
Definition: commctrl.h:3373
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2753
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define SERVICE_KERNEL_DRIVER
Definition: cmtypes.h:953

Referenced by TV1_AddDependantsToTree(), and TV2_AddDependantsToTree().

◆ AllocAndLoadString()

INT AllocAndLoadString ( OUT LPWSTR lpTarget,
IN HINSTANCE  hInst,
IN UINT  uID 
)

Definition at line 50 of file misc.c.

53 {
54  INT ln;
55 
57  uID);
58  if (ln++ > 0)
59  {
60  (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED,
61  ln * sizeof(WCHAR));
62  if ((*lpTarget) != NULL)
63  {
64  INT Ret;
65  if (!(Ret = LoadStringW(hInst, uID, *lpTarget, ln)))
66  {
67  LocalFree((HLOCAL)(*lpTarget));
68  }
69  return Ret;
70  }
71  }
72  return 0;
73 }
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define LMEM_FIXED
Definition: winbase.h:349
__wchar_t WCHAR
Definition: xmlstorage.h:180
HINSTANCE hInst
Definition: dxdiag.c:13
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
static LPWSTR
Definition: misc.c:35
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
INT LengthOfStrResource(IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:23

◆ ChangeListViewText()

VOID ChangeListViewText ( PMAIN_WND_INFO  Info,
ENUM_SERVICE_STATUS_PROCESS pService,
UINT  Column 
)

Definition at line 105 of file listview.c.

108 {
109  LVFINDINFO lvfi;
110  LVITEM lvItem;
111  INT index;
112 
113  lvfi.flags = LVFI_PARAM;
114  lvfi.lParam = (LPARAM)pService;
115  index = ListView_FindItem(Info->hListView,
116  -1,
117  &lvfi);
118  if (index != -1)
119  {
120  lvItem.iItem = index;
121  lvItem.iSubItem = Column;
122 
123  switch (Column)
124  {
125  case LVNAME:
126  {
127  LPQUERY_SERVICE_CONFIG lpServiceConfig;
128 
129  lpServiceConfig = GetServiceConfig(pService->lpServiceName);
130  if (lpServiceConfig)
131  {
132  lvItem.pszText = lpServiceConfig->lpDisplayName;
133  SendMessage(Info->hListView,
135  lvItem.iItem,
136  (LPARAM)&lvItem);
137 
139  0,
140  lpServiceConfig);
141  }
142  }
143  break;
144 
145  case LVDESC:
146  {
147  LPWSTR lpDescription;
148 
149  lpDescription = GetServiceDescription(pService->lpServiceName);
150 
151  lvItem.pszText = lpDescription;
152  SendMessage(Info->hListView,
154  lvItem.iItem,
155  (LPARAM) &lvItem);
156 
158  0,
159  lpDescription);
160  }
161  break;
162 
163  case LVSTATUS:
164  {
165  WCHAR szStatus[64];
166 
168  {
171  szStatus,
172  sizeof(szStatus) / sizeof(WCHAR));
173  }
174  else
175  {
176  szStatus[0] = 0;
177  }
178 
179  lvItem.pszText = szStatus;
180  SendMessageW(Info->hListView,
182  lvItem.iItem,
183  (LPARAM) &lvItem);
184  }
185  break;
186 
187  case LVSTARTUP:
188  {
189  LPQUERY_SERVICE_CONFIGW lpServiceConfig;
190  LPWSTR lpStartup = NULL;
191  DWORD StringId = 0;
192 
193  lpServiceConfig = GetServiceConfig(pService->lpServiceName);
194 
195  if (lpServiceConfig)
196  {
197  switch (lpServiceConfig->dwStartType)
198  {
199  case 2: StringId = IDS_SERVICES_AUTO; break;
200  case 3: StringId = IDS_SERVICES_MAN; break;
201  case 4: StringId = IDS_SERVICES_DIS; break;
202  }
203  }
204 
205  if (StringId)
206  AllocAndLoadString(&lpStartup,
207  hInstance,
208  StringId);
209 
210  lvItem.pszText = lpStartup;
211  SendMessageW(Info->hListView,
213  lvItem.iItem,
214  (LPARAM)&lvItem);
215 
216  LocalFree(lpStartup);
218  0,
219  lpServiceConfig);
220  }
221  break;
222 
223  case LVLOGONAS:
224  {
225  LPQUERY_SERVICE_CONFIG lpServiceConfig;
226 
227  lpServiceConfig = GetServiceConfig(pService->lpServiceName);
228  if (lpServiceConfig)
229  {
230  lvItem.pszText = lpServiceConfig->lpServiceStartName;
231  SendMessageW(Info->hListView,
233  lvItem.iItem,
234  (LPARAM)&lvItem);
235 
237  0,
238  lpServiceConfig);
239  }
240  }
241  break;
242  }
243  }
244 }
#define LVSTARTUP
Definition: precomp.h:32
LPWSTR GetServiceDescription(LPWSTR lpServiceName)
Definition: query.c:135
LPSTR lpServiceStartName
Definition: winsvc.h:152
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define LVM_SETITEMTEXT
Definition: commctrl.h:2685
#define LVFI_PARAM
Definition: commctrl.h:2432
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
HINSTANCE hInstance
Definition: charmap.c:20
#define LVSTATUS
Definition: precomp.h:31
#define SERVICE_RUNNING
Definition: winsvc.h:24
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define IDS_SERVICES_DIS
Definition: resource.h:61
#define IDS_SERVICES_STARTED
Definition: resource.h:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR szStatus[]
Definition: http.c:74
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVLOGONAS
Definition: precomp.h:33
#define index(s, c)
Definition: various.h:29
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
HANDLE ProcessHeap
Definition: servman.c:15
#define LVDESC
Definition: precomp.h:30
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2683
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define LVFINDINFO
Definition: commctrl.h:2459
#define IDS_SERVICES_MAN
Definition: resource.h:60
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2466
#define SendMessage
Definition: winuser.h:5818
#define LVITEM
Definition: commctrl.h:2371
WCHAR * LPWSTR
Definition: xmlstorage.h:184
SERVICE_STATUS_PROCESS ServiceStatusProcess
Definition: winsvc.h:137
#define IDS_SERVICES_AUTO
Definition: resource.h:59
#define LVNAME
Definition: precomp.h:29
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by GeneralPageProc(), MainWndCommand(), RefreshServiceList(), and SaveDlgInfo().

◆ CompleteProgressBar()

VOID CompleteProgressBar ( HANDLE  hProgress)

Definition at line 311 of file progress.c.

312 {
313  HWND hProgBar = (HWND)hProgress;
314  UINT Pos = 0;
315 
316  /* Get the current position */
317  Pos = SendMessageW(hProgBar,
318  PBM_GETPOS,
319  0,
320  0);
321 
322  /* Loop until we hit the max */
323  while (Pos <= PROGRESS_RANGE)
324  {
325  /* Increment the progress bar */
326  SendMessageW(hProgBar,
327  PBM_DELTAPOS,
328  Pos,
329  0);
330 
331  /* Wait for 15ms to give it a smooth feel */
332  Sleep(15);
333  Pos++;
334  }
335 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
ush Pos
Definition: deflate.h:92
HANDLE HWND
Definition: compat.h:19
#define PBM_DELTAPOS
Definition: commctrl.h:2181
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PROGRESS_RANGE
Definition: progress.c:14
unsigned int UINT
Definition: ndis.h:50
#define PBM_GETPOS
Definition: commctrl.h:2190

Referenced by ActionThread().

◆ CreateDialogProc()

INT_PTR CALLBACK CreateDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 218 of file create.c.

222 {
223  HICON hIcon = NULL;
224 
225  switch (message)
226  {
227  case WM_INITDIALOG:
228  {
231  IMAGE_ICON,
232  16,
233  16,
234  0);
235  if (hIcon)
236  {
237  SendMessage(hDlg,
238  WM_SETICON,
239  ICON_SMALL,
240  (LPARAM)hIcon);
242  }
243 
244  return TRUE;
245  }
246 
247  case WM_COMMAND:
248  {
249  switch (LOWORD(wParam))
250  {
251  case IDOK:
252  {
254 
257  sizeof(CREATE_DATA));
258  if (Data)
259  {
260  Data->hSelf = hDlg;
261 
262  if (GetDataFromDialog(Data))
263  {
264  DoCreate(Data);
265  }
266  else
267  {
268  /* Something went wrong, leave the dialog
269  * open so they can try again */
270  FreeMemory(Data);
271  break;
272  }
273 
274  FreeMemory(Data);
275  }
276 
277  EndDialog(hDlg,
278  LOWORD(wParam));
279  return TRUE;
280  }
281 
282  case IDCANCEL:
283  {
284  EndDialog(hDlg,
285  LOWORD(wParam));
286  return TRUE;
287  }
288 
289  case ID_CREATE_HELP:
290  {
291  HWND hHelp;
292 
293  if (! bHelpOpen)
294  {
295  hHelp = CreateDialog(hInstance,
297  hDlg,
299  if(hHelp != NULL)
300  {
301  bHelpOpen = TRUE;
302  }
303  }
304  }
305  break;
306  }
307  }
308  }
309 
310  return FALSE;
311 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define IDOK
Definition: winuser.h:824
#define IMAGE_ICON
Definition: winuser.h:212
struct _CREATE_DATA * PCREATE_DATA
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
#define ID_CREATE_HELP
Definition: resource.h:187
#define IDD_DLG_HELP_OPTIONS
Definition: resource.h:188
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define ICON_SMALL
Definition: tnclass.cpp:48
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
LONG_PTR LPARAM
Definition: windef.h:208
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static BOOL GetDataFromDialog(PCREATE_DATA Data)
Definition: create.c:112
#define WM_COMMAND
Definition: winuser.h:1722
HANDLE ProcessHeap
Definition: servman.c:15
static BOOL DoCreate(PCREATE_DATA Data)
Definition: create.c:26
HICON hIcon
Definition: msconfig.c:44
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
INT_PTR CALLBACK CreateHelpDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: create.c:163
#define IDI_SM_ICON
Definition: resource.h:64
#define SendMessage
Definition: winuser.h:5818
#define LoadImage
Definition: winuser.h:5790
#define IDCANCEL
Definition: winuser.h:825
static BOOL bHelpOpen
Definition: create.c:23
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
#define CreateDialog
Definition: winuser.h:5724

Referenced by MainWndCommand().

◆ CreateListView()

BOOL CreateListView ( PMAIN_WND_INFO  Info)

Definition at line 355 of file listview.c.

356 {
357  LVCOLUMNW lvc = { 0 };
358  WCHAR szTemp[256];
359  HDITEM hdi;
360  int i, n;
361 
363  WC_LISTVIEWW,
364  NULL,
367  0, 0, 0, 0,
368  Info->hMainWnd,
370  hInstance,
371  NULL);
372  if (Info->hListView == NULL)
373  {
374  MessageBoxW(Info->hMainWnd,
375  L"Could not create List View.",
376  L"Error",
377  MB_OK | MB_ICONERROR);
378  return FALSE;
379  }
380 
381  Info->hHeader = ListView_GetHeader(Info->hListView);
382 
384  LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);/*LVS_EX_GRIDLINES |*/
385 
387  lvc.fmt = LVCFMT_LEFT;
388  lvc.pszText = szTemp;
389 
390  /* Add columns to the list-view */
391  for (n = 0; n < sizeof(Columns) / sizeof(Columns[0]); n++)
392  {
393  lvc.iSubItem = Columns[n].iSubItem;
394  lvc.cx = Columns[n].cx;
395 
397  Columns[n].idsText,
398  szTemp,
399  sizeof(szTemp) / sizeof(szTemp[0]));
400 
401  i = ListView_InsertColumn(Info->hListView, Columns[n].iSubItem, &lvc);
402 
403  hdi.mask = HDI_LPARAM;
404  hdi.lParam = ORD_ASCENDING;
405  (void)Header_SetItem(Info->hHeader, i, &hdi);
406  }
407 
409 
410  /* check the details view menu item */
411  CheckMenuRadioItem(GetMenu(Info->hMainWnd),
415  MF_BYCOMMAND);
416 
417  return TRUE;
418 }
#define ID_VIEW_DETAILS
Definition: resource.h:36
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDC_SERVLIST
Definition: resource.h:11
#define LVCF_TEXT
Definition: commctrl.h:2584
#define TRUE
Definition: types.h:120
#define LVS_REPORT
Definition: commctrl.h:2258
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2647
#define WC_LISTVIEWW
Definition: commctrl.h:2253
GLdouble n
Definition: glext.h:7729
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2730
#define LVCFMT_LEFT
Definition: commctrl.h:2594
#define WS_CHILD
Definition: pedump.c:617
#define HDITEM
Definition: commctrl.h:693
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LBS_NOREDRAW
Definition: pedump.c:680
#define LVCF_SUBITEM
Definition: commctrl.h:2585
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
HINSTANCE hInstance
Definition: charmap.c:20
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
#define FALSE
Definition: types.h:117
int iSubItem
Definition: listview.c:14
#define LVS_SORTASCENDING
Definition: commctrl.h:2264
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2729
#define ORD_ASCENDING
Definition: precomp.h:45
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2563
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2721
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MB_ICONERROR
Definition: winuser.h:781
static VOID InitListViewImage(PMAIN_WND_INFO Info)
Definition: listview.c:299
#define LVCF_FMT
Definition: commctrl.h:2582
static const COLUMN_LIST Columns[]
Definition: listview.c:19
#define WS_BORDER
Definition: pedump.c:625
#define LBS_NOTIFY
Definition: pedump.c:678
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define HDI_LPARAM
Definition: commctrl.h:702
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:754
#define WS_VISIBLE
Definition: pedump.c:620
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ID_VIEW_LARGE
Definition: resource.h:33

Referenced by ChildWndProc(), and InitMainWnd().

◆ CreateMainWindow()

HWND CreateMainWindow ( LPCTSTR  lpCaption,
int  nCmdShow 
)

Definition at line 925 of file mainwnd.c.

927 {
929  HWND hMainWnd = NULL;
930 
933  sizeof(MAIN_WND_INFO));
934 
935  if (Info != NULL)
936  {
937  Info->nCmdShow = nCmdShow;
938 
941  lpCaption,
945  680,
946  450,
947  NULL,
948  NULL,
949  hInstance,
950  Info);
951  if (hMainWnd == NULL)
952  {
953  //int ret;
954  //ret = GetLastError();
955  GetError();
957  0,
958  Info);
959  }
960  }
961 
962  return hMainWnd;
963 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:15
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WS_CLIPCHILDREN
Definition: pedump.c:619
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
VOID GetError(VOID)
Definition: misc.c:192
#define CreateWindowEx
Definition: winuser.h:5730
#define CW_USEDEFAULT
Definition: winuser.h:225
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND hMainWnd
Definition: magnifier.c:32
HANDLE ProcessHeap
Definition: servman.c:15
HINSTANCE hInstance
Definition: mainwnd.c:15
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ CreateStopDependsDialog()

BOOL CreateStopDependsDialog ( HWND  hParent,
LPWSTR  ServiceName,
LPWSTR  DisplayName,
LPWSTR  ServiceList 
)

Definition at line 293 of file stop_dependencies.c.

297 {
298  STOP_DATA StopData;
299  INT_PTR Result;
300 
301  StopData.ServiceName = ServiceName;
302  StopData.DisplayName = DisplayName;
303  StopData.ServiceList = ServiceList;
304 
307  hParent,
309  (LPARAM)&StopData);
310  if (Result == IDOK)
311  return TRUE;
312 
313  return FALSE;
314 }
LPWSTR DisplayName
#define IDOK
Definition: winuser.h:824
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define TRUE
Definition: types.h:120
#define IDD_DLG_DEPEND_STOP
Definition: resource.h:213
int32_t INT_PTR
Definition: typedefs.h:64
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG_PTR LPARAM
Definition: windef.h:208
LPTSTR ServiceName
Definition: ServiceMain.c:15
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
INT_PTR CALLBACK StopDependsDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
LPWSTR ServiceName
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPWSTR ServiceList

Referenced by RunActionWithProgress().

◆ DeleteDialogProc()

INT_PTR CALLBACK DeleteDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 57 of file delete.c.

61 {
63  HICON hIcon = NULL;
64 
65  /* Get the window context */
68  if (Info == NULL && message != WM_INITDIALOG)
69  {
70  return FALSE;
71  }
72 
73  switch (message)
74  {
75  case WM_INITDIALOG:
76  {
77  LPWSTR lpDescription;
78 
80  if (Info != NULL)
81  {
82  SetWindowLongPtrW(hDlg,
84  (LONG_PTR)Info);
85 
88  IMAGE_ICON,
89  16,
90  16,
91  0);
92  if (hIcon)
93  {
94  SendMessageW(hDlg,
95  WM_SETICON,
96  ICON_SMALL,
97  (LPARAM)hIcon);
99  }
100 
101  SendDlgItemMessageW(hDlg,
102  IDC_DEL_NAME,
103  WM_SETTEXT,
104  0,
105  (LPARAM)Info->pCurrentService->lpDisplayName);
106 
107  lpDescription = GetServiceDescription(Info->pCurrentService->lpServiceName);
108  if (lpDescription)
109  {
110  SendDlgItemMessageW(hDlg,
111  IDC_DEL_DESC,
112  WM_SETTEXT,
113  0,
114  (LPARAM)lpDescription);
116  0,
117  lpDescription);
118  }
119 
120  return TRUE;
121  }
122 
123  return FALSE;
124  }
125 
126  case WM_COMMAND:
127  {
128  switch (LOWORD(wParam))
129  {
130  case IDOK:
131  {
132  if (DoDeleteService(Info, hDlg))
133  {
134  (void)ListView_DeleteItem(Info->hListView,
135  Info->SelectedItem);
137  }
138  EndDialog(hDlg,
139  LOWORD(wParam));
140  return TRUE;
141  }
142 
143  case IDCANCEL:
144  {
145  EndDialog(hDlg,
146  LOWORD(wParam));
147  return TRUE;
148  }
149  }
150  }
151  }
152 
153  return FALSE;
154 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define IDOK
Definition: winuser.h:824
#define IMAGE_ICON
Definition: winuser.h:212
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
LPWSTR GetServiceDescription(LPWSTR lpServiceName)
Definition: query.c:135
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:125
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define ICON_SMALL
Definition: tnclass.cpp:48
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2407
#define WM_SETTEXT
Definition: winuser.h:1599
struct _MAIN_WND_INFO * PMAIN_WND_INFO
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_DEL_DESC
Definition: resource.h:198
#define IDC_DEL_NAME
Definition: resource.h:197
#define WM_COMMAND
Definition: winuser.h:1722
HANDLE ProcessHeap
Definition: servman.c:15
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define IDI_SM_ICON
Definition: resource.h:64
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
static BOOL DoDeleteService(PMAIN_WND_INFO Info, HWND hDlg)
Definition: delete.c:13

Referenced by MainWndCommand().

◆ DependenciesPageProc()

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

Definition at line 183 of file propsheet_depends.c.

187 {
188  PDEPENDDATA pDependData;
189 
190  /* Get the window context */
191  pDependData = (PDEPENDDATA)GetWindowLongPtr(hwndDlg,
192  GWLP_USERDATA);
193  if (pDependData == NULL && uMsg != WM_INITDIALOG)
194  {
195  return FALSE;
196  }
197 
198  switch (uMsg)
199  {
200  case WM_INITDIALOG:
201  {
202  pDependData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DEPENDDATA));
203  if (pDependData != NULL)
204  {
205  SetWindowLongPtr(hwndDlg,
207  (LONG_PTR)pDependData);
208 
209  pDependData->pDlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
210  pDependData->hDependsWnd = hwndDlg;
211 
212  InitDependPage(pDependData);
213  }
214  }
215  break;
216 
217  case WM_NOTIFY:
218  {
219  switch (((LPNMHDR)lParam)->code)
220  {
221  case TVN_ITEMEXPANDING:
222  {
223  LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam;
224 
225  if (lpnmtv->action == TVE_EXPAND)
226  {
227  if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE1)
228  {
229  /* Has this node been expanded before */
230  if (!TreeView_GetChild(pDependData->hDependsTreeView1, lpnmtv->itemNew.hItem))
231  {
232  /* It's not, add the children */
233  TV1_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
234  }
235  }
236  else if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE2)
237  {
238  /* Has this node been expanded before */
239  if (!TreeView_GetChild(pDependData->hDependsTreeView2, lpnmtv->itemNew.hItem))
240  {
241  /* It's not, add the children */
242  TV2_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
243  }
244  }
245  }
246  break;
247  }
248  }
249  break;
250  }
251 
252  case WM_COMMAND:
253  switch(LOWORD(wParam))
254  {
255 
256  }
257  break;
258 
259  case WM_DESTROY:
260  DestroyTreeView(pDependData->hDependsTreeView1);
261  DestroyTreeView(pDependData->hDependsTreeView2);
262 
263  if (pDependData->hDependsImageList)
264  ImageList_Destroy(pDependData->hDependsImageList);
265 
266  HeapFree(GetProcessHeap(), 0, pDependData);
267  }
268 
269  return FALSE;
270 }
VOID TV2_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3462
#define LPNMTREEVIEW
Definition: commctrl.h:3639
#define IDC_DEPEND_TREE1
Definition: resource.h:175
HIMAGELIST hDependsImageList
Definition: precomp.h:138
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define FALSE
Definition: types.h:117
PSERVICEPROPSHEET pDlgInfo
Definition: precomp.h:137
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:390
HWND hDependsTreeView2
Definition: precomp.h:141
#define WM_DESTROY
Definition: winuser.h:1591
static VOID DestroyTreeView(HWND hTreeView)
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IDC_DEPEND_TREE2
Definition: resource.h:176
#define TVE_EXPAND
Definition: commctrl.h:3419
HWND hDependsTreeView1
Definition: precomp.h:140
#define WM_COMMAND
Definition: winuser.h:1722
VOID TV1_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
Definition: inflate.c:139
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3734
struct _DEPENDDATA * PDEPENDDATA
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
HWND hDependsWnd
Definition: precomp.h:139
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static VOID InitDependPage(PDEPENDDATA pDependData)
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by PropSheetThread().

◆ DisplayString()

VOID DisplayString ( PWCHAR  )

◆ DoControlService()

DWORD DoControlService ( LPWSTR  ServiceName,
HWND  hProgress,
DWORD  Control 
)

Definition at line 18 of file control.c.

21 {
22  SC_HANDLE hSCManager;
23  SC_HANDLE hService;
26  DWORD BytesNeeded = 0;
27  DWORD StartTickCount;
28  DWORD OldCheckPoint;
29  DWORD WaitTime;
30  DWORD MaxWait;
31  DWORD ReqState, i;
32  BOOL Result;
33  DWORD dwResult = ERROR_SUCCESS;
34 
35  /* Set the state we're interested in */
36  switch (Control)
37  {
39  ReqState = SERVICE_PAUSED;
40  break;
42  ReqState = SERVICE_RUNNING;
43  break;
44  default:
45  /* Unhandled control code */
46  DPRINT1("Unknown control command: 0x%X\n", Control);
48  }
49 
51  NULL,
53  if (!hSCManager) return GetLastError();
54 
55  hService = OpenServiceW(hSCManager,
58  if (!hService)
59  {
60  dwResult = GetLastError();
62  return dwResult;
63  }
64 
65  /* Send the control message to the service */
66  Result = ControlService(hService,
67  Control,
68  &Status);
69  if (Result)
70  {
71  if (hProgress)
72  {
73  /* Increment the progress bar */
75  }
76 
77  /* Get the service status */
78  Result = QueryServiceStatusEx(hService,
81  sizeof(SERVICE_STATUS_PROCESS),
82  &BytesNeeded);
83  if (Result)
84  {
85  Result = FALSE;
86  MaxWait = MAX_WAIT_TIME;
87  OldCheckPoint = ServiceStatus.dwCheckPoint;
88  StartTickCount = GetTickCount();
89 
90  /* Loop until it's at the correct state */
91  while (ServiceStatus.dwCurrentState != ReqState)
92  {
93  /* Fixup the wait time */
94  WaitTime = ServiceStatus.dwWaitHint / 10;
95 
96  if (WaitTime < 1000) WaitTime = 1000;
97  else if (WaitTime > 10000) WaitTime = 10000;
98 
99  /* We don't wanna wait for up to 10 secs without incrementing */
100  for (i = WaitTime / 1000; i > 0; i--)
101  {
102  Sleep(1000);
103  if (hProgress)
104  {
105  /* Increment the progress bar */
107  }
108  }
109 
110  /* Get the latest status info */
111  if (!QueryServiceStatusEx(hService,
114  sizeof(SERVICE_STATUS_PROCESS),
115  &BytesNeeded))
116  {
117  /* Something went wrong... */
118  dwResult = GetLastError();
119  DPRINT1("QueryServiceStatusEx failed: %d\n", dwResult);
120  break;
121  }
122 
123  /* Is the service making progress? */
124  if (ServiceStatus.dwCheckPoint > OldCheckPoint)
125  {
126  /* It is, get the latest tickcount to reset the max wait time */
127  StartTickCount = GetTickCount();
128  OldCheckPoint = ServiceStatus.dwCheckPoint;
130  }
131  else
132  {
133  /* It's not, make sure we haven't exceeded our wait time */
134  if (GetTickCount() >= StartTickCount + MaxWait)
135  {
136  /* We have, give up */
137  DPRINT1("Timeout\n");
139  break;
140  }
141  }
142  }
143  }
144  else
145  {
146  dwResult = GetLastError();
147  }
148 
149  if (ServiceStatus.dwCurrentState == ReqState)
150  {
151  dwResult = ERROR_SUCCESS;
152  }
153  }
154  else
155  {
156  dwResult = GetLastError();
157  }
158 
159  CloseServiceHandle(hService);
161 
162  return dwResult;
163 }
#define MAX_WAIT_TIME
Definition: control.c:15
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD dwCurrentState
Definition: winsvc.h:100
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define SERVICE_PAUSED
Definition: winsvc.h:27
#define ERROR_SERVICE_REQUEST_TIMEOUT
Definition: winerror.h:604
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define SERVICE_INTERROGATE
Definition: winsvc.h:60
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2830
DWORD dwCheckPoint
Definition: winsvc.h:104
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define ERROR_INVALID_SERVICE_CONTROL
Definition: winerror.h:603
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
Status
Definition: gdiplustypes.h:24
LPTSTR ServiceName
Definition: ServiceMain.c:15
DWORD dwWaitHint
Definition: winsvc.h:105
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
SC_HANDLE hSCManager
Definition: sc.c:12
VOID IncrementProgressBar(HANDLE hProgress, UINT NewPos)
Definition: progress.c:338
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DEFAULT_STEP
Definition: precomp.h:110
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:59

Referenced by ActionThread().

◆ DoStartService()

DWORD DoStartService ( LPWSTR  ServiceName,
HANDLE  hProgress,
LPWSTR  lpStartParams 
)

Definition at line 18 of file start.c.

21 {
22  SC_HANDLE hSCManager;
23  SC_HANDLE hService;
25  DWORD BytesNeeded = 0;
26  DWORD StartTickCount;
27  DWORD OldCheckPoint;
28  DWORD WaitTime;
29  DWORD MaxWait;
30  BOOL Result = FALSE;
31 
32  BOOL bWhiteSpace = TRUE;
33  LPWSTR lpChar;
34  DWORD dwArgsCount = 0;
35  DWORD dwResult = ERROR_SUCCESS;
36  LPCWSTR *lpArgsVector = NULL;
37 
38  if (lpStartParams != NULL)
39  {
40  /* Count the number of arguments */
41  lpChar = lpStartParams;
42  while (*lpChar != 0)
43  {
44  if (iswspace(*lpChar))
45  {
46  bWhiteSpace = TRUE;
47  }
48  else
49  {
50  if (bWhiteSpace != FALSE)
51  {
52  dwArgsCount++;
53  bWhiteSpace = FALSE;
54  }
55  }
56 
57  lpChar++;
58  }
59 
60  /*
61  * Allocate the arguments vector.
62  * Do not add the service name here because services.exe does it for us!
63  */
64  lpArgsVector = LocalAlloc(LMEM_FIXED, dwArgsCount * sizeof(LPCWSTR));
65  if (!lpArgsVector)
66  return GetLastError();
67 
68  /* Fill the arguments vector */
69  dwArgsCount = 0;
70  bWhiteSpace = TRUE;
71  lpChar = lpStartParams;
72  while (*lpChar != 0)
73  {
74  if (iswspace(*lpChar))
75  {
76  *lpChar = 0;
77  bWhiteSpace = TRUE;
78  }
79  else
80  {
81  if (bWhiteSpace != FALSE)
82  {
83  lpArgsVector[dwArgsCount] = lpChar;
84  dwArgsCount++;
85  bWhiteSpace = FALSE;
86  }
87  }
88 
89  lpChar++;
90  }
91  }
92 
94  NULL,
96  if (!hSCManager)
97  {
98  dwResult = GetLastError();
99  if (lpArgsVector)
100  LocalFree((LPVOID)lpArgsVector);
101  return dwResult;
102  }
103 
104  hService = OpenServiceW(hSCManager,
105  ServiceName,
107  if (!hService)
108  {
109  dwResult = GetLastError();
111  if (lpArgsVector)
112  LocalFree((LPVOID)lpArgsVector);
113  return dwResult;
114  }
115 
116  /* Start the service */
117  Result = StartServiceW(hService,
118  dwArgsCount,
119  lpArgsVector);
121  {
122  /* If it's already running, just return TRUE */
123  Result = TRUE;
124  }
125  else if (Result)
126  {
127  if (hProgress)
128  {
129  /* Increment the progress bar */
131  }
132 
133  /* Get the service status to check if it's running */
134  Result = QueryServiceStatusEx(hService,
137  sizeof(SERVICE_STATUS_PROCESS),
138  &BytesNeeded);
139  if (Result)
140  {
141  Result = FALSE;
142  MaxWait = MAX_WAIT_TIME;
143  OldCheckPoint = ServiceStatus.dwCheckPoint;
144  StartTickCount = GetTickCount();
145 
146  /* Loop until it's running */
148  {
149  int i;
150  /* Fixup the wait time */
151  WaitTime = ServiceStatus.dwWaitHint / 10;
152 
153  if (WaitTime < 1000) WaitTime = 1000;
154  else if (WaitTime > 10000) WaitTime = 10000;
155 
156  /* We don't wanna wait for up to 10 secs without incrementing */
157  for (i = WaitTime / 1000; i > 0; i--)
158  {
159  Sleep(1000);
160  if (hProgress)
161  {
162  /* Increment the progress bar */
164  }
165  }
166 
167 
168  /* Get the latest status info */
169  if (!QueryServiceStatusEx(hService,
172  sizeof(SERVICE_STATUS_PROCESS),
173  &BytesNeeded))
174  {
175  /* Something went wrong... */
176  dwResult = GetLastError();
177  DPRINT1("QueryServiceStatusEx failed: %d\n", dwResult);
178  break;
179  }
180 
181  /* Is the service making progress? */
182  if (ServiceStatus.dwCheckPoint > OldCheckPoint)
183  {
184  /* It is, get the latest tickcount to reset the max wait time */
185  StartTickCount = GetTickCount();
186  OldCheckPoint = ServiceStatus.dwCheckPoint;
187  }
188  else
189  {
190  /* It's not, make sure we haven't exceeded our wait time */
191  if (GetTickCount() >= StartTickCount + MaxWait)
192  {
193  /* We have, give up */
194  DPRINT1("Timeout\n");
196  break;
197  }
198  }
199  }
200  }
201  else
202  {
203  dwResult = GetLastError();
204  }
205 
207  {
208  dwResult = ERROR_SUCCESS;
209  }
210  }
211 
212  CloseServiceHandle(hService);
214 
215  if (lpArgsVector)
216  LocalFree((LPVOID)lpArgsVector);
217 
218  return dwResult;
219 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD dwCurrentState
Definition: winsvc.h:100
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define ERROR_SERVICE_REQUEST_TIMEOUT
Definition: winerror.h:604
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2830
DWORD dwCheckPoint
Definition: winsvc.h:104
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SERVICE_RUNNING
Definition: winsvc.h:24
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
#define LMEM_FIXED
Definition: winbase.h:349
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2923
LPTSTR ServiceName
Definition: ServiceMain.c:15
DWORD dwWaitHint
Definition: winsvc.h:105
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MAX_WAIT_TIME
Definition: start.c:15
#define iswspace(_c)
Definition: ctype.h:669
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
SC_HANDLE hSCManager
Definition: sc.c:12
#define SERVICE_START
Definition: winsvc.h:57
VOID IncrementProgressBar(HANDLE hProgress, UINT NewPos)
Definition: progress.c:338
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DEFAULT_STEP
Definition: precomp.h:110
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607

Referenced by ActionThread().

◆ DoStopService()

DWORD DoStopService ( LPWSTR  ServiceName,
HANDLE  hProgress 
)

Referenced by ActionThread().

◆ ExportFile()

VOID ExportFile ( PMAIN_WND_INFO  Info)

Definition at line 98 of file export.c.

99 {
101  WCHAR szFileName[MAX_PATH];
102 
103  ZeroMemory(&ofn, sizeof(ofn));
104  szFileName[0] = UNICODE_NULL;
105 
106  ofn.lStructSize = sizeof(OPENFILENAME);
107  ofn.hwndOwner = Info->hMainWnd;
108  ofn.lpstrFilter = L"Text (Tab Delimited)(*.txt)\0*.txt\0Text (Comma Delimited)(*.csv)\0*.csv\0";
109  ofn.lpstrFile = szFileName;
111  ofn.lpstrDefExt = L"txt";
113 
114  if(GetSaveFileName(&ofn))
115  {
116  if (SaveServicesToFile(Info, szFileName))
117  return;
118  }
119 
121  MessageBoxW(NULL, L"Export to file failed", NULL, 0);
122 }
#define CDERR_GENERALCODES
Definition: cderr.h:5
#define OFN_EXPLORER
Definition: commdlg.h:104
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1648
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nMaxFile
Definition: commdlg.h:337
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define GetSaveFileName
Definition: commdlg.h:666
#define UNICODE_NULL
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL SaveServicesToFile(PMAIN_WND_INFO Info, LPCWSTR pszFileName)
Definition: export.c:36
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
static const WCHAR L[]
Definition: oid.c:1250
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
LPSTR lpstrFile
Definition: commdlg.h:336
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define NULL
Definition: types.h:112
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:148
DWORD Flags
Definition: commdlg.h:342

Referenced by MainWndCommand().

◆ FreeServiceList()

VOID FreeServiceList ( PMAIN_WND_INFO  Info)

Definition at line 257 of file query.c.

258 {
259  DWORD i;
260 
261  if (Info->pAllServices != NULL)
262  {
263  for (i = 0; i < Info->NumServices; i++)
264  {
265  if (Info->pAllServices[i].lpServiceName)
266  HeapFree(ProcessHeap, 0, Info->pAllServices[i].lpServiceName);
267 
268  if (Info->pAllServices[i].lpDisplayName)
269  HeapFree(ProcessHeap, 0, Info->pAllServices[i].lpDisplayName);
270  }
271 
272  HeapFree(ProcessHeap, 0, Info->pAllServices);
273  Info->pAllServices = NULL;
274  Info->NumServices = 0;
275  }
276 }
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE ProcessHeap
Definition: servman.c:15
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by GetServiceList(), and MainWndProc().

◆ 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:131
struct _PAGEDATA * PPAGEDATA
#define ACTION_START
Definition: precomp.h:39
#define EM_SETREADONLY
Definition: winuser.h:1997
#define TRUE
Definition: types.h:120
static VOID SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
#define ACTION_STOP
Definition: precomp.h:40
BOOL bDescriptionChanged
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
Definition: progress.c:372
PSERVICEPROPSHEET dlgInfo
#define SendDlgItemMessage
Definition: winuser.h:5817
#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:135
#define FALSE
Definition: types.h:117
#define LVSTATUS
Definition: precomp.h:31
#define IDC_STOP
Definition: resource.h:69
#define GWLP_USERDATA
Definition: treelist.c:63
BOOL bBinaryPathChanged
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define ACTION_RESUME
Definition: precomp.h:42
#define WM_DESTROY
Definition: winuser.h:1591
#define GetDlgItemText
Definition: winuser.h:5760
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define IDC_DISP_NAME
Definition: resource.h:128
#define IDC_DESCRIPTION
Definition: resource.h:129
static VOID SetButtonStates(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
BOOL bStartTypeChanged
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
#define IDC_START_PARAM
Definition: resource.h:133
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ACTION_PAUSE
Definition: precomp.h:41
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:131
#define IDC_RESUME
Definition: resource.h:138
#define IDC_EDIT
Definition: resource.h:134
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define HIWORD(l)
Definition: typedefs.h:247
#define IDC_EXEPATH
Definition: resource.h:130
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define WM_INITDIALOG
Definition: winuser.h:1721
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:130
#define HeapFree(x, y, z)
Definition: compat.h:594
VOID SaveDlgInfo(PPAGEDATA pPageData, HWND hwndDlg)
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by Applet(), AppletInit(), PropSheetThread(), and SystemApplet().

◆ GetError()

VOID GetError ( VOID  )

Definition at line 192 of file misc.c.

193 {
194  LPWSTR lpMsgBuf = NULL;
195 
199  NULL,
200  GetLastError(),
202  (VOID*)&lpMsgBuf,
203  0,
204  NULL );
205 
206  MessageBoxW(NULL, lpMsgBuf, L"Error!", MB_OK | MB_ICONERROR);
207 
208  LocalFree(lpMsgBuf);
209 }
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define MAKELANGID(p, s)
Definition: nls.h:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CreateMainWindow(), GetServiceDescription(), InitEditWnd(), LoadDIBImage(), SetServiceAccount(), SetServiceConfig(), and SetServiceDescription().

◆ GetExecutablePath()

LPWSTR GetExecutablePath ( LPWSTR  lpServiceName)

◆ GetListOfServicesToStop()

LPWSTR GetListOfServicesToStop ( LPWSTR  lpServiceName)

Definition at line 126 of file stop_dependencies.c.

127 {
128  LPWSTR lpServiceList = NULL;
129 
130  /* Call recursive function to get our list */
131  if (BuildListOfServicesToStop(&lpServiceList, lpServiceName))
132  return lpServiceList;
133  else
134  return NULL;
135 }
static BOOL BuildListOfServicesToStop(LPWSTR *lpServiceList, LPWSTR lpServiceName)
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RunActionWithProgress().

◆ GetSelectedService()

ENUM_SERVICE_STATUS_PROCESS* GetSelectedService ( PMAIN_WND_INFO  Info)

Definition at line 13 of file query.c.

14 {
15  LVITEM lvItem;
16 
17  lvItem.mask = LVIF_PARAM;
18  lvItem.iItem = Info->SelectedItem;
19  SendMessage(Info->hListView,
21  0,
22  (LPARAM)&lvItem);
23 
24  /* return pointer to selected service */
25  return (ENUM_SERVICE_STATUS_PROCESS *)lvItem.lParam;
26 }
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
LONG_PTR LPARAM
Definition: windef.h:208
#define LVM_GETITEM
Definition: commctrl.h:2388
#define SendMessage
Definition: winuser.h:5818
#define LVIF_PARAM
Definition: commctrl.h:2307
#define LVITEM
Definition: commctrl.h:2371

Referenced by ListViewSelectionChanged().

◆ GetServiceConfig()

LPQUERY_SERVICE_CONFIG GetServiceConfig ( LPWSTR  lpServiceName)

Definition at line 29 of file query.c.

30 {
31  LPQUERY_SERVICE_CONFIGW lpServiceConfig = NULL;
32  SC_HANDLE hSCManager;
33  SC_HANDLE hService;
34  DWORD dwBytesNeeded;
35 
37  NULL,
39  if (hSCManager)
40  {
41  hService = OpenServiceW(hSCManager,
42  lpServiceName,
44  if (hService)
45  {
46  if (!QueryServiceConfigW(hService,
47  NULL,
48  0,
49  &dwBytesNeeded))
50  {
52  {
53  lpServiceConfig = (LPQUERY_SERVICE_CONFIG)HeapAlloc(GetProcessHeap(),
54  0,
55  dwBytesNeeded);
56  if (lpServiceConfig)
57  {
58  if (!QueryServiceConfigW(hService,
59  lpServiceConfig,
60  dwBytesNeeded,
61  &dwBytesNeeded))
62  {
64  0,
65  lpServiceConfig);
66  lpServiceConfig = NULL;
67  }
68  }
69  }
70  }
71 
72  CloseServiceHandle(hService);
73  }
74 
76  }
77 
78  return lpServiceConfig;
79 }
QUERY_SERVICE_CONFIGA * LPQUERY_SERVICE_CONFIG
Definition: winsvc.h:550
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
BOOL WINAPI QueryServiceConfigW(SC_HANDLE hService, LPQUERY_SERVICE_CONFIGW lpServiceConfig, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2234
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
SC_HANDLE hSCManager
Definition: sc.c:12
#define NULL
Definition: types.h:112
#define SERVICE_QUERY_CONFIG
Definition: winsvc.h:53
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by AddServiceNamesToStop(), ChangeListViewText(), InitGeneralPage(), LogonPageProc(), SetButtonStates(), SetMenuAndButtonStates(), SetStartupType(), and TV1_AddDependantsToTree().

◆ GetServiceDescription()

LPWSTR GetServiceDescription ( LPWSTR  lpServiceName)

Definition at line 135 of file query.c.

136 {
137  SC_HANDLE hSCManager = NULL;
138  SC_HANDLE hSc = NULL;
139  SERVICE_DESCRIPTIONW *pServiceDescription = NULL;
140  LPWSTR lpDescription = NULL;
141  DWORD BytesNeeded = 0;
142  DWORD dwSize;
143 
145  NULL,
147  if (hSCManager == NULL)
148  {
149  GetError();
150  return NULL;
151  }
152 
153  hSc = OpenServiceW(hSCManager,
154  lpServiceName,
156  if (hSc)
157  {
158  if (!QueryServiceConfig2W(hSc,
160  NULL,
161  0,
162  &BytesNeeded))
163  {
165  {
166  pServiceDescription = (SERVICE_DESCRIPTION *) HeapAlloc(ProcessHeap,
167  0,
168  BytesNeeded);
169  if (pServiceDescription == NULL)
170  goto cleanup;
171 
172  if (QueryServiceConfig2W(hSc,
174  (LPBYTE)pServiceDescription,
175  BytesNeeded,
176  &BytesNeeded))
177  {
178  if (pServiceDescription->lpDescription)
179  {
180  dwSize = wcslen(pServiceDescription->lpDescription) + 1;
181  lpDescription = HeapAlloc(ProcessHeap,
182  0,
183  dwSize * sizeof(WCHAR));
184  if (lpDescription)
185  {
186  StringCchCopyW(lpDescription,
187  dwSize,
188  pServiceDescription->lpDescription);
189  }
190  }
191  }
192  }
193  }
194  }
195 
196 cleanup:
197  if (pServiceDescription)
199  0,
200  pServiceDescription);
201  if (hSCManager != NULL)
203  if (hSc != NULL)
204  CloseServiceHandle(hSc);
205 
206  return lpDescription;
207 }
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define SERVICE_CONFIG_DESCRIPTION
Definition: winsvc.h:65
VOID GetError(VOID)
Definition: misc.c:192
unsigned char * LPBYTE
Definition: typedefs.h:53
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
BOOL WINAPI QueryServiceConfig2W(SC_HANDLE hService, DWORD dwInfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2434
SC_HANDLE hSCManager
Definition: sc.c:12
HANDLE ProcessHeap
Definition: servman.c:15
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
#define SERVICE_QUERY_CONFIG
Definition: winsvc.h:53
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:594
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by ChangeListViewText(), DeleteDialogProc(), and InitGeneralPage().

◆ GetServiceList()

BOOL GetServiceList ( PMAIN_WND_INFO  Info)

Definition at line 279 of file query.c.

280 {
281  ENUM_SERVICE_STATUS_PROCESS *pServices = NULL;
282  SC_HANDLE ScHandle;
283  BOOL bRet = FALSE;
284 
285  DWORD BytesNeeded = 0;
286  DWORD ResumeHandle = 0;
287  DWORD NumServices = 0;
288  DWORD i;
289 
291 
292  ScHandle = OpenSCManagerW(NULL,
293  NULL,
295  if (ScHandle != NULL)
296  {
297  if (!EnumServicesStatusEx(ScHandle,
301  NULL,
302  0,
303  &BytesNeeded,
304  &NumServices,
305  &ResumeHandle,
306  0))
307  {
308  /* Call function again if required size was returned */
309  if (GetLastError() == ERROR_MORE_DATA)
310  {
311  /* reserve memory for service info array */
313  0,
314  BytesNeeded);
315  if (pServices)
316  {
317  /* fill array with service info */
318  if (EnumServicesStatusEx(ScHandle,
322  (LPBYTE)pServices,
323  BytesNeeded,
324  &BytesNeeded,
325  &NumServices,
326  &ResumeHandle,
327  0))
328  {
329  bRet = TRUE;
330  }
331  }
332  }
333  }
334  }
335 
336  if (ScHandle)
337  CloseServiceHandle(ScHandle);
338 
341  NumServices * sizeof(ENUM_SERVICE_STATUS_PROCESS));
342  if (Info->pAllServices != NULL)
343  {
344  Info->NumServices = NumServices;
345 
346  for (i = 0; i < NumServices; i++)
347  {
348  Info->pAllServices[i].lpServiceName = HeapAlloc(ProcessHeap,
350  (wcslen(pServices[i].lpServiceName) + 1) * sizeof(WCHAR));
351  if (Info->pAllServices[i].lpServiceName)
352  wcscpy(Info->pAllServices[i].lpServiceName, pServices[i].lpServiceName);
353 
354  Info->pAllServices[i].lpDisplayName = HeapAlloc(ProcessHeap,
356  (wcslen(pServices[i].lpDisplayName) + 1) * sizeof(WCHAR));
357  if (Info->pAllServices[i].lpDisplayName)
358  wcscpy(Info->pAllServices[i].lpDisplayName, pServices[i].lpDisplayName);
359 
360  CopyMemory(&Info->pAllServices[i].ServiceStatusProcess,
361  &pServices[i].ServiceStatusProcess,
362  sizeof(SERVICE_STATUS_PROCESS));
363  }
364  }
365 
366  if (pServices)
367  HeapFree(ProcessHeap, 0, pServices);
368 
369  return bRet;
370 }
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define SERVICE_STATE_ALL
Definition: winsvc.h:52
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1646
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
#define ERROR_MORE_DATA
Definition: dderror.h:13
HANDLE ProcessHeap
Definition: servman.c:15
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SERVICE_WIN32
Definition: cmtypes.h:964
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define EnumServicesStatusEx
Definition: winsvc.h:572
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2753
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:594
VOID FreeServiceList(PMAIN_WND_INFO Info)
Definition: query.c:257

Referenced by RefreshServiceList().

◆ GetTextFromEdit()

INT GetTextFromEdit ( OUT LPWSTR  lpString,
IN HWND  hDlg,
IN UINT  Res 
)

Definition at line 174 of file misc.c.

177 {
178  INT len = GetWindowTextLengthW(GetDlgItem(hDlg, Res));
179  if(len > 0)
180  {
181  GetDlgItemTextW(hDlg,
182  Res,
183  lpString,
184  len + 1);
185  }
186  else
187  lpString = NULL;
188 
189  return len;
190 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
int32_t INT
Definition: typedefs.h:58
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetWindowTextLengthW(_In_ HWND)
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112

◆ IncrementProgressBar()

VOID IncrementProgressBar ( HANDLE  hProgress,
UINT  NewPos 
)

Definition at line 338 of file progress.c.

340 {
341  HWND hProgBar = (HWND)hProgress;
342  UINT Position;
343 
344  /* Don't allow the progress to reach to complete*/
345  Position = SendMessageW(hProgBar,
346  PBM_GETPOS,
347  0,
348  0);
350  {
351  /* Do we want to increment the default amount? */
352  if (Step == DEFAULT_STEP)
353  {
354  /* Use the step value we set on create */
355  SendMessageW(hProgBar,
356  PBM_STEPIT,
357  0,
358  0);
359  }
360  else
361  {
362  /* Use the value passed */
363  SendMessageW(hProgBar,
364  PBM_SETPOS,
365  Step,
366  0);
367  }
368  }
369 }
static COORD Position
Definition: mouse.c:34
HANDLE HWND
Definition: compat.h:19
#define PBM_SETPOS
Definition: commctrl.h:2180
#define PBM_STEPIT
Definition: commctrl.h:2183
#define PROGRESS_STEP_MAX
Definition: progress.c:15
#define DEFAULT_STEP
Definition: precomp.h:110
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define PBM_GETPOS
Definition: commctrl.h:2190

Referenced by DoControlService(), DoStartService(), and DoStopService().

◆ InitImageList()

HIMAGELIST InitImageList ( UINT  StartResource,
UINT  EndResource,
UINT  Width,
UINT  Height,
ULONG  type 
)

Definition at line 219 of file misc.c.

224 {
225  HANDLE hImage;
227  UINT i;
228  INT ret;
229 
230  /* Create the toolbar icon image list */
231  himl = ImageList_Create(Width,
232  Height,
234  EndResource - StartResource,
235  0);
236  if (himl == NULL)
237  return NULL;
238 
239  ret = 0;
240  for (i = StartResource; i <= EndResource && ret != -1; i++)
241  {
242  hImage = LoadImageW(hInstance,
244  type,
245  Width,
246  Height,
248  if (hImage == NULL)
249  {
251  himl = NULL;
252  break;
253  }
254 
255  if (type == IMAGE_BITMAP)
256  {
258  hImage,
259  RGB(255, 0, 128));
260  }
261  else if (type == IMAGE_ICON)
262  {
264  hImage);
265  }
266 
267  DeleteObject(hImage);
268  }
269 
270  if (ret == -1)
271  {
273  himl = NULL;
274  }
275 
276  return himl;
277 }
#define IMAGE_ICON
Definition: winuser.h:212
#define RGB(r, g, b)
Definition: precomp.h:62
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:354
HINSTANCE hInstance
Definition: charmap.c:20
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
int ret
#define LR_LOADTRANSPARENT
Definition: winuser.h:1083
#define ILC_MASK
Definition: commctrl.h:347
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define IMAGE_BITMAP
Definition: winuser.h:211
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by FloatToolbarCreateHistoryGui(), FloatToolbarCreateToolsGui(), InitDependPage(), MainWndCreateToolbarClient(), pCreateToolbar(), PopulateTreeView(), and SoundsDlgProc().

◆ InitMainWindowImpl()

BOOL InitMainWindowImpl ( VOID  )

Definition at line 966 of file mainwnd.c.

967 {
968  WNDCLASSEX wc = {0};
969 
970  wc.cbSize = sizeof(WNDCLASSEX);
972  wc.hInstance = hInstance;
973  wc.hIcon = LoadIcon(hInstance,
975  wc.hCursor = LoadCursor(NULL,
976  IDC_ARROW);
977  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
982  IMAGE_ICON,
983  16,
984  16,
985  LR_SHARED);
986 
987  return RegisterClassEx(&wc) != (ATOM)0;
988 }
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:15
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDR_MAINMENU
Definition: resource.h:40
static HICON
Definition: imagelist.c:84
LPCSTR lpszMenuName
Definition: winuser.h:3185
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define RegisterClassEx
Definition: winuser.h:5812
HCURSOR hCursor
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3178
LPCSTR lpszClassName
Definition: winuser.h:3186
WORD ATOM
Definition: dimm.idl:113
HICON hIconSm
Definition: winuser.h:3187
HINSTANCE hInstance
Definition: winuser.h:3181
UINT cbSize
Definition: winuser.h:3176
HBRUSH hbrBackground
Definition: winuser.h:3184
HICON hIcon
Definition: winuser.h:3182
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:641
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LoadCursor
Definition: winuser.h:5787
HINSTANCE hInstance
Definition: mainwnd.c:15
#define NULL
Definition: types.h:112
#define IDI_SM_ICON
Definition: resource.h:64
#define IDC_ARROW
Definition: winuser.h:682
#define LoadImage
Definition: winuser.h:5790
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694
#define LoadIcon
Definition: winuser.h:5788

◆ ListViewSelectionChanged()

VOID ListViewSelectionChanged ( PMAIN_WND_INFO  Info,
LPNMLISTVIEW  pnmv 
)

Definition at line 48 of file listview.c.

50 {
52 
53  /* get handle to menu */
54  hMainMenu = GetMenu(Info->hMainWnd);
55 
56  /* activate properties menu item, if not already */
58  ID_PROP,
60  {
62  ID_PROP,
63  MF_ENABLED);
64  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0),
65  ID_PROP,
66  MF_ENABLED);
67  SetMenuDefaultItem(GetSubMenu(Info->hShortcutMenu, 0),
68  ID_PROP,
69  MF_BYCOMMAND);
70  }
71 
72  /* activate delete menu item, if not already */
74  ID_DELETE,
76  {
78  ID_DELETE,
79  MF_ENABLED);
80  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0),
81  ID_DELETE,
82  MF_ENABLED);
83  }
84 
85  /* set selected service */
86  Info->SelectedItem = pnmv->iItem;
87 
88  /* get pointer to selected service */
89  Info->pCurrentService = GetSelectedService(Info);
90 
91  /* set current selected service in the status bar */
92  SendMessage(Info->hStatus,
93  SB_SETTEXT,
94  1,
95  (LPARAM)Info->pCurrentService->lpDisplayName);
96 
97  /* show the properties button */
98  SendMessage(Info->hTool,
100  ID_PROP,
102 }
#define MF_BYCOMMAND
Definition: winuser.h:202
#define TB_SETSTATE
Definition: commctrl.h:1050
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
ENUM_SERVICE_STATUS_PROCESS * GetSelectedService(PMAIN_WND_INFO Info)
Definition: query.c:13
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
HMENU hMainMenu
Definition: mplay32.c:25
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ID_DELETE
Definition: resource.h:25
#define MAKELONG(a, b)
Definition: typedefs.h:249
LONG_PTR LPARAM
Definition: windef.h:208
#define MF_ENABLED
Definition: winuser.h:128
#define SB_SETTEXT
Definition: commctrl.h:1945
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define ID_PROP
Definition: resource.h:15
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SendMessage
Definition: winuser.h:5818
#define TBSTATE_ENABLED
Definition: commctrl.h:970
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by MainWndProc().

◆ LoadAndFormatString()

DWORD LoadAndFormatString ( IN HINSTANCE  hInstance,
IN UINT  uID,
OUT LPWSTR lpTarget,
  ... 
)

Definition at line 76 of file misc.c.

80 {
81  DWORD Ret = 0;
83  va_list lArgs;
84 
86  hInstance,
87  uID) > 0)
88  {
89  va_start(lArgs, lpTarget);
90  /* let's use Format to format it because it has the ability to allocate
91  memory automatically */
93  lpFormat,
94  0,
95  0,
96  (LPWSTR)lpTarget,
97  0,
98  &lArgs);
99  va_end(lArgs);
100 
102  }
103 
104  return Ret;
105 }
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
HINSTANCE hInstance
Definition: charmap.c:20
#define va_end(ap)
Definition: acmsvcex.h:90
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
char * va_list
Definition: acmsvcex.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
va_start(ap, x)
LPCWSTR lpFormat
Definition: trayclock.cpp:32
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
INT AllocAndLoadString(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ LogonPageProc()

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

Definition at line 221 of file propsheet_logon.c.

226 {
227  PLOGONDATA pLogonData;
228 
229  /* Get the window context */
230  pLogonData = (PLOGONDATA)GetWindowLongPtr(hwndDlg,
231  GWLP_USERDATA);
232  if (pLogonData == NULL && uMsg != WM_INITDIALOG)
233  {
234  return FALSE;
235  }
236 
237  switch (uMsg)
238  {
239  case WM_INITDIALOG:
240  pLogonData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGONDATA));
241  if (pLogonData != NULL)
242  {
243  SetWindowLongPtr(hwndDlg,
245  (LONG_PTR)pLogonData);
246 
247  pLogonData->bInitialized = FALSE;
248  pLogonData->pService = ((PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam))->pService;
249 
250  pLogonData->pServiceConfig = GetServiceConfig(pLogonData->pService->lpServiceName);
251  if (pLogonData->pServiceConfig != NULL)
252  {
253  wcscpy(pLogonData->szPassword1, DEFAULT_PASSWORD);
254  wcscpy(pLogonData->szPassword2, DEFAULT_PASSWORD);
255 
256  if (pLogonData->pServiceConfig->lpServiceStartName == NULL ||
257  _wcsicmp(pLogonData->pServiceConfig->lpServiceStartName, L"LocalSystem") == 0)
258  {
261  pLogonData->nInteractive = BST_CHECKED;
263  }
264  SetControlStates(hwndDlg, pLogonData, TRUE);
265  }
266  else
267  {
268  wcscpy(pLogonData->szAccountName, pLogonData->pServiceConfig->lpServiceStartName);
270  SetControlStates(hwndDlg, pLogonData, FALSE);
271  }
272  }
273 
274  pLogonData->bInitialized = TRUE;
275  }
276 
278  break;
279 
280  case WM_DESTROY:
281  if (pLogonData->pServiceConfig)
282  HeapFree(GetProcessHeap(), 0, pLogonData->pServiceConfig);
283 
284  HeapFree(GetProcessHeap(), 0, pLogonData);
285  break;
286 
287  case WM_COMMAND:
288  switch(LOWORD(wParam))
289  {
291  if (HIWORD(wParam) == BN_CLICKED)
292  {
293  if (pLogonData->bInitialized)
294  {
295  pLogonData->bAccountChanged = TRUE;
296  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
297  }
298  SetControlStates(hwndDlg, pLogonData, TRUE);
299  }
300  break;
301 
303  if (HIWORD(wParam) == BN_CLICKED)
304  {
305  if (pLogonData->bInitialized)
306  {
307  pLogonData->bAccountChanged = TRUE;
308  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
309  }
310  SetControlStates(hwndDlg, pLogonData, FALSE);
311  }
312  break;
313 
315  if (HIWORD(wParam) == BN_CLICKED)
316  {
317  if (pLogonData->bInitialized)
318  {
319  pLogonData->bAccountChanged = TRUE;
320  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
321  }
322  }
323  break;
324 
326  case IDC_LOGON_PASSWORD1:
327  case IDC_LOGON_PASSWORD2:
328  if (HIWORD(wParam) == EN_CHANGE && pLogonData->bInitialized)
329  {
330  pLogonData->bAccountChanged = TRUE;
331  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
332  }
333  break;
334  }
335  break;
336 
337  case WM_NOTIFY:
338  switch (((LPNMHDR)lParam)->code)
339  {
341  return OnQueryInitialFocus(hwndDlg, pLogonData);
342 
343  case PSN_APPLY:
344  return OnApply(hwndDlg, pLogonData);
345  }
346  break;
347  }
348 
349  return FALSE;
350 }
WCHAR szPassword2[64]
#define IDC_LOGON_PASSWORD2
Definition: resource.h:150
static BOOL OnQueryInitialFocus(HWND hwndDlg, PLOGONDATA pLogonData)
static BOOL OnApply(HWND hwndDlg, PLOGONDATA pLogonData)
#define DEFAULT_PASSWORD
LPSTR lpServiceStartName
Definition: winsvc.h:152
#define TRUE
Definition: types.h:120
#define SERVICE_INTERACTIVE_PROCESS
Definition: cmtypes.h:967
#define IDC_LOGON_SYSTEMACCOUNT
Definition: resource.h:142
LPQUERY_SERVICE_CONFIG pServiceConfig
WCHAR szPassword1[64]
UINT_PTR WPARAM
Definition: windef.h:207
#define PSN_APPLY
Definition: prsht.h:117
ENUM_SERVICE_STATUS_PROCESS * pService
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
WCHAR szAccountName[64]
#define IDC_LOGON_THISACCOUNT
Definition: resource.h:143
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define WM_DESTROY
Definition: winuser.h:1591
#define BM_SETCHECK
Definition: winuser.h:1903
#define IDC_LOGON_HWPROFILE
Definition: resource.h:151
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define BN_CLICKED
Definition: winuser.h:1907
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
BOOL bAccountChanged
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static VOID SetControlStates(HWND hwndDlg, PLOGONDATA pLogonData, BOOL bLocalSystem)
HWND WINAPI GetParent(_In_ HWND)
#define IDC_LOGON_ACCOUNTNAME
Definition: resource.h:145
#define IDC_LOGON_PASSWORD1
Definition: resource.h:148
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define BST_CHECKED
Definition: winuser.h:197
#define HIWORD(l)
Definition: typedefs.h:247
#define IDC_LOGON_INTERACTIVE
Definition: resource.h:144
#define GetWindowLongPtr
Definition: treelist.c:73
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
#define HeapFree(x, y, z)
Definition: compat.h:594
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define WM_NOTIFY
Definition: richedit.h:61
struct _LOGONDATA * PLOGONDATA
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by PropSheetThread().

◆ OpenPropSheet()

VOID OpenPropSheet ( PMAIN_WND_INFO  Info)

Definition at line 30 of file propsheet.c.

31 {
32  PSERVICEPROPSHEET pServicePropSheet;
34 
35  pServicePropSheet = HeapAlloc(ProcessHeap,
36  0,
37  sizeof(*pServicePropSheet));
38  if (!pServicePropSheet) return;
39 
40  /* Set the current service in this calling thread to avoid
41  * it being updated before the thread is up */
42  pServicePropSheet->pService = Info->pCurrentService;
43  pServicePropSheet->Info = Info;
44 
45  hThread = (HANDLE)_beginthreadex(NULL, 0, &PropSheetThread, pServicePropSheet, 0, NULL);
46  if (hThread)
47  {
49  }
50 }
#define CloseHandle
Definition: compat.h:598
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned int __stdcall PropSheetThread(void *Param)
Definition: propsheet.c:53
PVOID HANDLE
Definition: typedefs.h:73
HANDLE ProcessHeap
Definition: servman.c:15
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:131
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:27
PMAIN_WND_INFO Info
Definition: precomp.h:130

Referenced by MainWndCommand().

◆ ProgressDialogProc()

INT_PTR CALLBACK ProgressDialogProc ( HWND  hDlg,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 281 of file progress.c.

285 {
286  switch(Message)
287  {
288  case WM_INITDIALOG:
289  {
290  return InitProgressDialog(hDlg, Message, wParam, lParam);
291  }
292 
293  case WM_COMMAND:
294  switch(LOWORD(wParam))
295  {
296  case IDOK:
297  EndDialog(hDlg, wParam);
298  break;
299 
300  }
301  break;
302 
303  default:
304  return FALSE;
305  }
306 
307  return TRUE;
308 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
static BOOL InitProgressDialog(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: progress.c:243
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
CHAR Message[80]
Definition: alive.c:5
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by RunActionWithProgress().

◆ RecoveryPageProc()

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

Definition at line 441 of file propsheet_recovery.c.

446 {
447  PRECOVERYDATA pRecoveryData;
448 
449  /* Get the window context */
450  pRecoveryData = (PRECOVERYDATA)GetWindowLongPtr(hwndDlg,
451  GWLP_USERDATA);
452  if (pRecoveryData == NULL && uMsg != WM_INITDIALOG)
453  return FALSE;
454 
455  switch (uMsg)
456  {
457  case WM_INITDIALOG:
458  pRecoveryData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RECOVERYDATA));
459  if (pRecoveryData != NULL)
460  {
461  SetWindowLongPtr(hwndDlg,
463  (LONG_PTR)pRecoveryData);
464 
465  pRecoveryData->pService = ((PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam))->pService;
466 
467  InitRecoveryPage(hwndDlg);
468 
469  if (GetServiceFailure(pRecoveryData))
470  {
471  ShowFailureActions(hwndDlg, pRecoveryData);
472  }
473  }
474  break;
475 
476  case WM_DESTROY:
477  if (pRecoveryData != NULL)
478  {
479  if (pRecoveryData->pServiceFailure != NULL)
480  HeapFree(GetProcessHeap(), 0, pRecoveryData->pServiceFailure);
481 
482  HeapFree(GetProcessHeap(), 0, pRecoveryData);
483  }
484  break;
485 
486  case WM_COMMAND:
487  switch(LOWORD(wParam))
488  {
489  case IDC_FIRST_FAILURE:
490  case IDC_SECOND_FAILURE:
492  if (HIWORD(wParam) == CBN_SELCHANGE)
493  {
494  UpdateFailureActions(hwndDlg, pRecoveryData);
495  pRecoveryData->bChanged = TRUE;
496  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
497  }
498  break;
499 
500  case IDC_RESET_TIME:
501  case IDC_RESTART_TIME:
502  case IDC_PROGRAM:
503  case IDC_PARAMETERS:
504  if (HIWORD(wParam) == EN_CHANGE)
505  {
506  pRecoveryData->bChanged = TRUE;
507  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
508  }
509  break;
510 
511  case IDC_ADD_FAILCOUNT:
512  if (HIWORD(wParam) == BN_CLICKED)
513  {
514  pRecoveryData->bChanged = TRUE;
515  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
516  }
517  break;
518 
519  case IDC_BROWSE_PROGRAM:
520  BrowseFile(hwndDlg);
521  break;
522 
523  case IDC_RESTART_OPTIONS:
524  break;
525  }
526  break;
527 
528  case WM_NOTIFY:
529  switch (((LPNMHDR)lParam)->code)
530  {
531  case PSN_APPLY:
532  if (pRecoveryData->bChanged)
533  {
534  SetFailureActions(hwndDlg);
535  pRecoveryData->bChanged = FALSE;
536  }
537  break;
538  }
539  break;
540  }
541 
542  return FALSE;
543 }
#define IDC_BROWSE_PROGRAM
Definition: resource.h:167
#define IDC_FIRST_FAILURE
Definition: resource.h:157
#define IDC_SUBSEQUENT_FAILURES
Definition: resource.h:159
#define TRUE
Definition: types.h:120
LPSERVICE_FAILURE_ACTIONS pServiceFailure
static BOOL GetServiceFailure(PRECOVERYDATA pRecoveryData)
struct _RECOVERYDATA * PRECOVERYDATA
static VOID UpdateFailureActions(HWND hwndDlg, PRECOVERYDATA pRecoveryData)
#define PSN_APPLY
Definition: prsht.h:117
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
static VOID SetFailureActions(HWND hwndDlg)
#define IDC_SECOND_FAILURE
Definition: resource.h:158
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define IDC_RESET_TIME
Definition: resource.h:160
#define WM_DESTROY
Definition: winuser.h:1591
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static VOID BrowseFile(HWND hwndDlg)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define BN_CLICKED
Definition: winuser.h:1907
#define IDC_RESTART_TIME
Definition: resource.h:162
static VOID InitRecoveryPage(HWND hwndDlg)
#define IDC_RESTART_OPTIONS
Definition: resource.h:171
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
#define IDC_PARAMETERS
Definition: resource.h:169
HWND WINAPI GetParent(_In_ HWND)
#define IDC_PROGRAM
Definition: resource.h:166
ENUM_SERVICE_STATUS_PROCESS * pService
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define IDC_ADD_FAILCOUNT
Definition: resource.h:170
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
static VOID ShowFailureActions(HWND hwndDlg, PRECOVERYDATA pRecoveryData)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by PropSheetThread().

◆ RefreshServiceList()

BOOL RefreshServiceList ( PMAIN_WND_INFO  Info)

Definition at line 247 of file listview.c.

248 {
249  ENUM_SERVICE_STATUS_PROCESS *pService;
250  LVITEMW lvItem;
251  DWORD Index;
252 
253  SendMessage (Info->hListView,
254  WM_SETREDRAW,
255  FALSE,
256  0);
257 
258  (void)ListView_DeleteAllItems(Info->hListView);
259 
260  if (GetServiceList(Info))
261  {
262  for (Index = 0; Index < Info->NumServices; Index++)
263  {
264  INT i;
265 
266  pService = &Info->pAllServices[Index];
267 
268  /* set the display name */
269  ZeroMemory(&lvItem, sizeof(LVITEMW));
270  lvItem.mask = LVIF_TEXT | LVIF_PARAM;
271  lvItem.pszText = pService->lpDisplayName;
272 
273  /* Add the service pointer */
274  lvItem.lParam = (LPARAM)pService;
275 
276  /* add it to the listview */
277  lvItem.iItem = ListView_InsertItem(Info->hListView, &lvItem);
278 
279  /* fill out all the column data */
280  for (i = LVDESC; i <= LVLOGONAS; i++)
281  {
282  ChangeListViewText(Info, pService, i);
283  }
284  }
285 
287  }
288 
289  /* turn redraw flag on. */
290  SendMessageW(Info->hListView,
291  WM_SETREDRAW,
292  TRUE,
293  0);
294 
295  return TRUE;
296 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TRUE
Definition: types.h:120
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:125
#define WM_SETREDRAW
Definition: winuser.h:1598
#define ZeroMemory
Definition: winbase.h:1648
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
int32_t INT
Definition: typedefs.h:58
#define LVIF_TEXT
Definition: commctrl.h:2305
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define FALSE
Definition: types.h:117
LPARAM lParam
Definition: commctrl.h:2364
LONG_PTR LPARAM
Definition: windef.h:208
BOOL GetServiceList(PMAIN_WND_INFO Info)
Definition: query.c:279
_In_ WDFCOLLECTION _In_ ULONG Index
LPWSTR pszText
Definition: commctrl.h:2361
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVLOGONAS
Definition: precomp.h:33
UINT mask
Definition: commctrl.h:2356
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
#define LVDESC
Definition: precomp.h:30
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5818
#define LVIF_PARAM
Definition: commctrl.h:2307
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2410

Referenced by MainWndCommand(), and MainWndProc().

◆ ResourceMessageBox()

VOID ResourceMessageBox ( HINSTANCE  hInstance,
HWND  hwnd,
UINT  uType,
UINT  uCaptionId,
UINT  uMessageId 
)

Definition at line 283 of file misc.c.

289 {
290  WCHAR szErrorText[BUFFERSIZE];
291  WCHAR szErrorCaption[BUFFERSIZE];
292 
293  LoadStringW(hInstance, uMessageId, szErrorText, sizeof(szErrorText) / sizeof(WCHAR));
294  LoadStringW(hInstance, uCaptionId, szErrorCaption, sizeof(szErrorCaption) / sizeof(WCHAR));
295 
296  MessageBoxW(hwnd, szErrorText, szErrorCaption, uType);
297 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: charmap.c:20
#define BUFFERSIZE
Definition: misc.c:280
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AdvancedPageProc(), CopyProfileDlgProc(), OnApply(), OnSet(), OnVirtMemDialogOk(), and RenameProfileDlgProc().

◆ RunActionWithProgress()

BOOL RunActionWithProgress ( HWND  hParent,
LPWSTR  ServiceName,
LPWSTR  DisplayName,
UINT  Action,
PVOID  Param 
)

Definition at line 372 of file progress.c.

377 {
378  PROGRESS_DATA ProgressData;
379  LPWSTR ServiceList;
380  BOOL StopDepends;
381  INT_PTR Result;
382 
383  StopDepends = FALSE;
384  ServiceList = NULL;
385 
386 
387  /* Check if we'll be stopping the service */
389  {
390  /* Does the service have any dependent services which need stopping first */
391  ServiceList = GetListOfServicesToStop(ServiceName);
392  if (ServiceList)
393  {
394  /* Ask the user if they want to stop the dependants */
395  StopDepends = CreateStopDependsDialog(hParent,
396  ServiceName,
397  DisplayName,
398  ServiceList);
399 
400  /* Exit early if the user decided not to stop the dependants */
401  if (StopDepends == FALSE)
402  {
403  HeapFree(GetProcessHeap(), 0, ServiceList);
404  return FALSE;
405  }
406  }
407  }
408 
409  ProgressData.hDlg = NULL;
410  ProgressData.ServiceName = ServiceName;
411  ProgressData.Action = Action;
412  ProgressData.StopDepends = StopDepends;
413  ProgressData.ServiceList = ServiceList;
414  ProgressData.Param = Param;
415 
418  hParent,
420  (LPARAM)&ProgressData);
421 
422  if (ServiceList)
423  HeapFree(GetProcessHeap(), 0, ServiceList);
424 
425  return (Result == IDOK);
426 }
BOOL CreateStopDependsDialog(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, LPWSTR ServiceList)
#define IDOK
Definition: winuser.h:824
#define IDD_DLG_PROGRESS
Definition: resource.h:203
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define ACTION_STOP
Definition: precomp.h:40
INT_PTR CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: progress.c:281
BOOL StopDepends
Definition: progress.c:23
LPWSTR ServiceList
Definition: progress.c:24
int32_t INT_PTR
Definition: typedefs.h:64
PVOID Param
Definition: progress.c:25
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR ServiceName
Definition: progress.c:21
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG_PTR LPARAM
Definition: windef.h:208
LPTSTR ServiceName
Definition: ServiceMain.c:15
#define GetProcessHeap()
Definition: compat.h:595
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
#define NULL
Definition: types.h:112
LPWSTR GetListOfServicesToStop(LPWSTR lpServiceName)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ULONG Action
Definition: progress.c:22
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ACTION_RESTART
Definition: precomp.h:43

Referenced by GeneralPageProc(), and MainWndCommand().

◆ SetListViewStyle()

VOID SetListViewStyle ( HWND  hListView,
DWORD  View 
)

Definition at line 34 of file listview.c.

36 {
37  DWORD Style = GetWindowLongPtr(hListView, GWL_STYLE);
38 
39  if ((Style & LVS_TYPEMASK) != View)
40  {
41  SetWindowLongPtr(hListView,
42  GWL_STYLE,
43  (Style & ~LVS_TYPEMASK) | View);
44  }
45 }
#define SetWindowLongPtr
Definition: treelist.c:70
const DWORD Style
Definition: appswitch.c:71
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
#define LVS_TYPEMASK
Definition: commctrl.h:2261
#define GetWindowLongPtr
Definition: treelist.c:73

Referenced by MainWndCommand().

◆ SetMenuAndButtonStates()

VOID SetMenuAndButtonStates ( PMAIN_WND_INFO  Info)

Definition at line 152 of file mainwnd.c.

153 {
155  UINT i;
156 
157  /* get handle to menu */
158  hMainMenu = GetMenu(Info->hMainWnd);
159 
160  /* set all to greyed */
161  for (i = ID_START; i <= ID_RESTART; i++)
162  {
164  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), i, MF_GRAYED);
165  SendMessage(Info->hTool, TB_SETSTATE, i,
167  }
168 
169  if (Info->SelectedItem != NO_ITEM_SELECTED)
170  {
171  LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL;
172  DWORD Flags, State;
173 
174  /* allow user to delete service */
175  if (Info->bIsUserAnAdmin)
176  {
180  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
181  }
182 
183  Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
184  State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
185 
186  lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
187 
188  if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
189  {
190  if (State == SERVICE_STOPPED)
191  {
193  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED);
196  }
197 
199  {
201  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_RESTART, MF_ENABLED);
204  }
205  }
206 
207  if(lpServiceConfig)
208  HeapFree(GetProcessHeap(), 0, lpServiceConfig);
209 
211  {
213  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED);
216  }
217 
219  {
221  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED);
224  }
225  }
226  else
227  {
228  /* disable tools which rely on a selected service */
231  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_GRAYED);
232  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_GRAYED);
237  }
238 
239 }
#define TBSTATE_INDETERMINATE
Definition: commctrl.h:972
#define TB_SETSTATE
Definition: commctrl.h:1050
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
_In_ ULONG _In_ ULONG State
Definition: potypes.h:516
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define SERVICE_DISABLED
Definition: cmtypes.h:979
HMENU hMainMenu
Definition: mplay32.c:25
#define SERVICE_STOPPED
Definition: winsvc.h:21
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ID_DELETE
Definition: resource.h:25
#define ID_PAUSE
Definition: resource.h:20
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define MAKELONG(a, b)
Definition: typedefs.h:249
LONG_PTR LPARAM
Definition: windef.h:208
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define GetProcessHeap()
Definition: compat.h:595
#define MF_ENABLED
Definition: winuser.h:128
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ID_START
Definition: resource.h:18
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define ID_RESTART
Definition: resource.h:22
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define NO_ITEM_SELECTED
Definition: precomp.h:26
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ID_PROP
Definition: resource.h:15
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5818
#define TBSTATE_ENABLED
Definition: commctrl.h:970
#define MF_GRAYED
Definition: winuser.h:129
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ID_STOP
Definition: resource.h:19

Referenced by MainWndCommand(), MainWndProc(), and SetButtonStates().

◆ SetServiceConfig()

BOOL SetServiceConfig ( LPQUERY_SERVICE_CONFIG  pServiceConfig,
LPWSTR  lpServiceName,
LPWSTR  lpPassword 
)

Definition at line 82 of file query.c.

85 {
86  SC_HANDLE hSCManager;
87  SC_HANDLE hSc;
88  SC_LOCK scLock;
89  BOOL bRet = FALSE;
90 
92  NULL,
94  if (hSCManager)
95  {
97  if (scLock)
98  {
100  lpServiceName,
102  if (hSc)
103  {
104  if (ChangeServiceConfigW(hSc,
105  pServiceConfig->dwServiceType,
106  pServiceConfig->dwStartType,
107  pServiceConfig->dwErrorControl,
108  pServiceConfig->lpBinaryPathName,
109  pServiceConfig->lpLoadOrderGroup,
110  pServiceConfig->dwTagId ? &pServiceConfig->dwTagId : NULL,
111  pServiceConfig->lpDependencies,
112  pServiceConfig->lpServiceStartName,
113  lpPassword,
114  pServiceConfig->lpDisplayName))
115  {
116  bRet = TRUE;
117  }
118 
119  CloseServiceHandle(hSc);
120  }
121 
122  UnlockServiceDatabase(scLock);
123  }
124 
126  }
127 
128  if (!bRet)
129  GetError();
130 
131  return bRet;
132 }
LPSTR lpServiceStartName
Definition: winsvc.h:152
#define TRUE
Definition: types.h:120
BOOL WINAPI UnlockServiceDatabase(SC_LOCK ScLock)
Definition: scm.c:2961
VOID GetError(VOID)
Definition: misc.c:192
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI ChangeServiceConfigW(SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)
Definition: scm.c:480
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
#define SC_MANAGER_LOCK
Definition: winsvc.h:17
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
SC_HANDLE hSCManager
Definition: sc.c:12
#define NULL
Definition: types.h:112
SC_LOCK WINAPI LockServiceDatabase(SC_HANDLE hSCManager)
Definition: scm.c:1901

Referenced by SaveDlgInfo().

◆ SetServiceDescription()

BOOL SetServiceDescription ( LPWSTR  lpServiceName,
LPWSTR  lpDescription 
)

Definition at line 210 of file query.c.

212 {
213  SC_HANDLE hSCManager;
214  SC_HANDLE hSc;
215  SC_LOCK scLock;
216  SERVICE_DESCRIPTION ServiceDescription;
217  BOOL bRet = FALSE;
218 
220  NULL,
222  if (hSCManager)
223  {
225  if (scLock)
226  {
227  hSc = OpenServiceW(hSCManager,
228  lpServiceName,
230  if (hSc)
231  {
232  ServiceDescription.lpDescription = lpDescription;
233