ReactOS  0.4.13-dev-563-g0561610
precomp.h File Reference
#include <windef.h>
#include <winbase.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)
 
BOOL DoStartService (LPWSTR ServiceName, HANDLE hProgress, LPWSTR lpStartParams)
 
BOOL DoStopService (LPWSTR ServiceName, HANDLE hProgress)
 
BOOL 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 39 of file precomp.h.

◆ ACTION_RESTART

#define ACTION_RESTART   5

Definition at line 41 of file precomp.h.

◆ ACTION_RESUME

#define ACTION_RESUME   4

Definition at line 40 of file precomp.h.

◆ ACTION_START

#define ACTION_START   1

Definition at line 37 of file precomp.h.

◆ ACTION_STOP

#define ACTION_STOP   2

Definition at line 38 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 108 of file precomp.h.

◆ IMAGE_DRIVER

#define IMAGE_DRIVER   2

Definition at line 35 of file precomp.h.

◆ IMAGE_SERVICE

#define IMAGE_SERVICE   1

Definition at line 34 of file precomp.h.

◆ IMAGE_UNKNOWN

#define IMAGE_UNKNOWN   0

Definition at line 33 of file precomp.h.

◆ LVDESC

#define LVDESC   1

Definition at line 28 of file precomp.h.

◆ LVLOGONAS

#define LVLOGONAS   4

Definition at line 31 of file precomp.h.

◆ LVNAME

#define LVNAME   0

Definition at line 27 of file precomp.h.

◆ LVSTARTUP

#define LVSTARTUP   3

Definition at line 30 of file precomp.h.

◆ LVSTATUS

#define LVSTATUS   2

Definition at line 29 of file precomp.h.

◆ MAX_KEY_LENGTH

#define MAX_KEY_LENGTH   256

Definition at line 25 of file precomp.h.

◆ NO_ITEM_SELECTED

#define NO_ITEM_SELECTED   -1

Definition at line 24 of file precomp.h.

◆ ORD_ASCENDING

#define ORD_ASCENDING   1

Definition at line 43 of file precomp.h.

◆ ORD_DESCENDING

#define ORD_DESCENDING   -1

Definition at line 44 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 13 of file about.c.

14 {
15  switch (message)
16  {
17  case WM_INITDIALOG:
18  {
19  HWND hLicenseEditWnd;
20 
21  hLicenseEditWnd = GetDlgItem(hDlg,
23  if (hLicenseEditWnd)
24  {
25  LPWSTR lpString;
26 
27  if (AllocAndLoadString(&lpString,
28  hInstance,
29  IDS_LICENSE))
30  {
31  SetWindowTextW(hLicenseEditWnd,
32  lpString);
33 
34  LocalFree(lpString);
35  }
36  }
37 
38  return TRUE;
39  }
40 
41  case WM_COMMAND:
42 
43  if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
44  {
45  EndDialog(hDlg,
46  LOWORD(wParam));
47  return TRUE;
48  }
49 
50  break;
51  }
52 
53  return FALSE;
54 }
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
HINSTANCE hInstance
Definition: charmap.c:20
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
#define IDS_LICENSE
Definition: resource.h:28
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
#define LOWORD(l)
Definition: pedump.c:82
#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:2729
#define ZeroMemory
Definition: winbase.h:1635
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3243
#define IMAGE_SERVICE
Definition: precomp.h:34
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3384
#define TVIF_CHILDREN
Definition: commctrl.h:3244
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:952
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
#define GetProcessHeap()
Definition: compat.h:395
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:961
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define IMAGE_UNKNOWN
Definition: precomp.h:33
#define TV_ITEM
Definition: commctrl.h:3272
#define TVIF_TEXT
Definition: commctrl.h:3238
#define TVIF_IMAGE
Definition: commctrl.h:3239
#define IMAGE_DRIVER
Definition: precomp.h:35
#define TVIF_PARAM
Definition: commctrl.h:3240
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define TV_INSERTSTRUCT
Definition: commctrl.h:3349
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2730
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:951

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:56
smooth NULL
Definition: ftsmooth.c:416
#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
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:30
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:56
struct TraceInfo Info
#define LVM_SETITEMTEXT
Definition: commctrl.h:2661
#define LVFI_PARAM
Definition: commctrl.h:2408
HINSTANCE hInstance
Definition: charmap.c:20
#define LVSTATUS
Definition: precomp.h:29
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define IDS_SERVICES_DIS
Definition: resource.h:63
#define IDS_SERVICES_STARTED
Definition: resource.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR szStatus[]
Definition: http.c:73
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVLOGONAS
Definition: precomp.h:31
#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:28
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2659
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVFINDINFO
Definition: commctrl.h:2435
#define IDS_SERVICES_MAN
Definition: resource.h:62
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2442
#define SendMessage
Definition: winuser.h:5709
#define LVITEM
Definition: commctrl.h:2347
WCHAR * LPWSTR
Definition: xmlstorage.h:184
SERVICE_STATUS_PROCESS ServiceStatusProcess
Definition: winsvc.h:137
#define IDS_SERVICES_AUTO
Definition: resource.h:61
#define LVNAME
Definition: precomp.h:27
#define HeapFree(x, y, z)
Definition: compat.h:394

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

◆ CompleteProgressBar()

VOID CompleteProgressBar ( HANDLE  hProgress)

Definition at line 261 of file progress.c.

262 {
263  HWND hProgBar = (HWND)hProgress;
264  UINT Pos = 0;
265 
266  /* Get the current position */
267  Pos = SendMessageW(hProgBar,
268  PBM_GETPOS,
269  0,
270  0);
271 
272  /* Loop until we hit the max */
273  while (Pos <= PROGRESS_RANGE)
274  {
275  /* Increment the progress bar */
276  SendMessageW(hProgBar,
277  PBM_DELTAPOS,
278  Pos,
279  0);
280 
281  /* Wait for 15ms to give it a smooth feel */
282  Sleep(15);
283  Pos++;
284  }
285 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
ush Pos
Definition: deflate.h:92
HANDLE HWND
Definition: compat.h:13
#define PBM_DELTAPOS
Definition: commctrl.h:2157
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:2166

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 TRUE
Definition: types.h:120
#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 ID_CREATE_HELP
Definition: resource.h:189
#define IDD_DLG_HELP_OPTIONS
Definition: resource.h:190
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
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
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:1716
HANDLE ProcessHeap
Definition: servman.c:15
static BOOL DoCreate(PCREATE_DATA Data)
Definition: create.c:26
HICON hIcon
Definition: msconfig.c:44
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
INT_PTR CALLBACK CreateHelpDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: create.c:163
#define IDI_SM_ICON
Definition: resource.h:66
#define SendMessage
Definition: winuser.h:5709
#define LoadImage
Definition: winuser.h:5681
#define IDCANCEL
Definition: winuser.h:825
static BOOL bHelpOpen
Definition: create.c:23
#define WM_INITDIALOG
Definition: winuser.h:1715
#define LOWORD(l)
Definition: pedump.c:82
#define CreateDialog
Definition: winuser.h:5615

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:38
#define TRUE
Definition: types.h:120
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:2559
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDC_SERVLIST
Definition: resource.h:13
#define LVCF_TEXT
Definition: commctrl.h:2560
#define LVS_REPORT
Definition: commctrl.h:2234
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2623
#define WC_LISTVIEWW
Definition: commctrl.h:2229
GLdouble n
Definition: glext.h:7729
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2706
#define LVCFMT_LEFT
Definition: commctrl.h:2570
#define WS_CHILD
Definition: pedump.c:617
#define HDITEM
Definition: commctrl.h:682
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
struct TraceInfo Info
#define LBS_NOREDRAW
Definition: pedump.c:680
#define LVCF_SUBITEM
Definition: commctrl.h:2561
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
HINSTANCE hInstance
Definition: charmap.c:20
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2608
int iSubItem
Definition: listview.c:14
#define LVS_SORTASCENDING
Definition: commctrl.h:2240
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2705
smooth NULL
Definition: ftsmooth.c:416
#define ORD_ASCENDING
Definition: precomp.h:43
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:2539
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2697
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:2558
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
#define MB_OK
Definition: winuser.h:784
#define HDI_LPARAM
Definition: commctrl.h:691
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:743
#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:35

Referenced by ChildWndProc(), and InitMainWnd().

◆ CreateMainWindow()

HWND CreateMainWindow ( LPCTSTR  lpCaption,
int  nCmdShow 
)

Definition at line 920 of file mainwnd.c.

922 {
924  HWND hMainWnd = NULL;
925 
928  sizeof(MAIN_WND_INFO));
929 
930  if (Info != NULL)
931  {
932  Info->nCmdShow = nCmdShow;
933 
936  lpCaption,
940  680,
941  450,
942  NULL,
943  NULL,
944  hInstance,
945  Info);
946  if (hMainWnd == NULL)
947  {
948  //int ret;
949  //ret = GetLastError();
950  GetError();
952  0,
953  Info);
954  }
955  }
956 
957  return hMainWnd;
958 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:14
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WS_CLIPCHILDREN
Definition: pedump.c:619
struct TraceInfo Info
VOID GetError(VOID)
Definition: misc.c:192
#define CreateWindowEx
Definition: winuser.h:5621
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
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 HEAP_ZERO_MEMORY
Definition: compat.h:123
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ 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 TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_DLG_DEPEND_STOP
Definition: resource.h:215
int32_t INT_PTR
Definition: typedefs.h:62
HINSTANCE hInstance
Definition: charmap.c:20
_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 TRUE
Definition: types.h:120
#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
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:124
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
#define ICON_SMALL
Definition: tnclass.cpp:48
HINSTANCE hInstance
Definition: charmap.c:20
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
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2383
#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:200
#define IDC_DEL_NAME
Definition: resource.h:199
#define WM_COMMAND
Definition: winuser.h:1716
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 IDI_SM_ICON
Definition: resource.h:66
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
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 
189  PDEPENDDATA pDependData;
190 
191  /* Get the window context */
192  pDependData = (PDEPENDDATA)GetWindowLongPtr(hwndDlg,
193  GWLP_USERDATA);
194  if (pDependData == NULL && uMsg != WM_INITDIALOG)
195  {
196  return FALSE;
197  }
198 
199  switch (uMsg)
200  {
201  case WM_INITDIALOG:
202  {
203  pDependData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DEPENDDATA));
204  if (pDependData != NULL)
205  {
206  SetWindowLongPtr(hwndDlg,
208  (LONG_PTR)pDependData);
209 
210  pDependData->pDlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
211  pDependData->hDependsWnd = hwndDlg;
212 
213  InitDependPage(pDependData);
214  }
215  }
216  break;
217 
218  case WM_NOTIFY:
219  {
220  switch (((LPNMHDR)lParam)->code)
221  {
222  case TVN_ITEMEXPANDING:
223  {
224  LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam;
225 
226  if (lpnmtv->action == TVE_EXPAND)
227  {
228  if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE1)
229  {
230  /* Has this node been expanded before */
231  if (!TreeView_GetChild(pDependData->hDependsTreeView1, lpnmtv->itemNew.hItem))
232  {
233  /* It's not, add the children */
234  TV1_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
235  }
236  }
237  else if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE2)
238  {
239  /* Has this node been expanded before */
240  if (!TreeView_GetChild(pDependData->hDependsTreeView2, lpnmtv->itemNew.hItem))
241  {
242  /* It's not, add the children */
243  TV2_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
244  }
245  }
246  }
247  break;
248  }
249  }
250  break;
251  }
252 
253  case WM_COMMAND:
254  switch(LOWORD(wParam))
255  {
256 
257  }
258  break;
259 
260  case WM_DESTROY:
261  DestroyTreeView(pDependData->hDependsTreeView1);
262  DestroyTreeView(pDependData->hDependsTreeView2);
263 
264  if (pDependData->hDependsImageList)
265  ImageList_Destroy(pDependData->hDependsImageList);
266 
267  HeapFree(GetProcessHeap(), 0, pDependData);
268  }
269 
270  return FALSE;
271 }
VOID TV2_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3438
#define LPNMTREEVIEW
Definition: commctrl.h:3615
#define IDC_DEPEND_TREE1
Definition: resource.h:177
HIMAGELIST hDependsImageList
Definition: precomp.h:137
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:925
PSERVICEPROPSHEET pDlgInfo
Definition: precomp.h:136
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
HWND hDependsTreeView2
Definition: precomp.h:140
#define WM_DESTROY
Definition: winuser.h:1591
static VOID DestroyTreeView(HWND hTreeView)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IDC_DEPEND_TREE2
Definition: resource.h:178
#define TVE_EXPAND
Definition: commctrl.h:3395
HWND hDependsTreeView1
Definition: precomp.h:139
#define WM_COMMAND
Definition: winuser.h:1716
VOID TV1_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3710
struct _DEPENDDATA * PDEPENDDATA
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HWND hDependsWnd
Definition: precomp.h:138
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#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:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by PropSheetThread().

◆ DisplayString()

VOID DisplayString ( PWCHAR  )

◆ DoControlService()

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

Definition at line 15 of file control.c.

18 {
19  SC_HANDLE hSCManager;
20  SC_HANDLE hService;
23  DWORD BytesNeeded = 0;
24  DWORD StartTickCount;
25  DWORD OldCheckPoint;
26  DWORD WaitTime;
27  DWORD MaxWait;
28  DWORD ReqState, i;
29  BOOL Result;
30 
31  /* Set the state we're interested in */
32  switch (Control)
33  {
35  ReqState = SERVICE_PAUSED;
36  break;
38  ReqState = SERVICE_RUNNING;
39  break;
40  default:
41  /* Unhandled control code */
42  return FALSE;
43  }
44 
46  NULL,
48  if (!hSCManager) return FALSE;
49 
50  hService = OpenServiceW(hSCManager,
53  if (!hService)
54  {
56  return FALSE;
57  }
58 
59  /* Send the control message to the service */
60  Result = ControlService(hService,
61  Control,
62  &Status);
63  if (Result)
64  {
65  if (hProgress)
66  {
67  /* Increment the progress bar */
69  }
70 
71  /* Get the service status */
72  Result = QueryServiceStatusEx(hService,
75  sizeof(SERVICE_STATUS_PROCESS),
76  &BytesNeeded);
77  if (Result)
78  {
79  Result = FALSE;
80  MaxWait = MAX_WAIT_TIME;
81  OldCheckPoint = ServiceStatus.dwCheckPoint;
82  StartTickCount = GetTickCount();
83 
84  /* Loop until it's at the correct state */
85  while (ServiceStatus.dwCurrentState != ReqState)
86  {
87  /* Fixup the wait time */
88  WaitTime = ServiceStatus.dwWaitHint / 10;
89 
90  if (WaitTime < 1000) WaitTime = 1000;
91  else if (WaitTime > 10000) WaitTime = 10000;
92 
93  /* We don't wanna wait for up to 10 secs without incrementing */
94  for (i = WaitTime / 1000; i > 0; i--)
95  {
96  Sleep(1000);
97  if (hProgress)
98  {
99  /* Increment the progress bar */
101  }
102  }
103 
104  /* Get the latest status info */
105  if (!QueryServiceStatusEx(hService,
108  sizeof(SERVICE_STATUS_PROCESS),
109  &BytesNeeded))
110  {
111  /* Something went wrong... */
112  break;
113  }
114 
115  /* Is the service making progress? */
116  if (ServiceStatus.dwCheckPoint > OldCheckPoint)
117  {
118  /* It is, get the latest tickcount to reset the max wait time */
119  StartTickCount = GetTickCount();
120  OldCheckPoint = ServiceStatus.dwCheckPoint;
122  }
123  else
124  {
125  /* It's not, make sure we haven't exceeded our wait time */
126  if(GetTickCount() >= StartTickCount + MaxWait)
127  {
128  /* We have, give up */
129  break;
130  }
131  }
132  }
133  }
134 
135  if (ServiceStatus.dwCurrentState == ReqState)
136  {
137  Result = TRUE;
138  }
139  }
140 
141  CloseServiceHandle(hService);
143 
144  return Result;
145 }
#define TRUE
Definition: types.h:120
#define MAX_WAIT_TIME
Definition: control.c:12
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
DWORD dwCurrentState
Definition: winsvc.h:100
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define SERVICE_PAUSED
Definition: winsvc.h:27
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
#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
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
DWORD dwCheckPoint
Definition: winsvc.h:104
unsigned char * LPBYTE
Definition: typedefs.h:52
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
smooth NULL
Definition: ftsmooth.c:416
BOOL Control(DWORD Control, LPCTSTR ServiceName, LPCTSTR *Args, INT ArgCount)
Definition: control.c:13
_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
LPTSTR ServiceName
Definition: ServiceMain.c:15
DWORD dwWaitHint
Definition: winsvc.h:105
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
Status
Definition: gdiplustypes.h:24
VOID IncrementProgressBar(HANDLE hProgress, UINT NewPos)
Definition: progress.c:288
#define DEFAULT_STEP
Definition: precomp.h:108
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:59

Referenced by ActionThread().

◆ DoStartService()

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

Definition at line 15 of file start.c.

18 {
19  SC_HANDLE hSCManager;
20  SC_HANDLE hService;
22  DWORD BytesNeeded = 0;
23  DWORD StartTickCount;
24  DWORD OldCheckPoint;
25  DWORD WaitTime;
26  DWORD MaxWait;
27  BOOL Result = FALSE;
28 
29  BOOL bWhiteSpace = TRUE;
30  LPWSTR lpChar;
31  DWORD dwArgsCount = 0;
32  LPCWSTR *lpArgsVector = NULL;
33 
34  if (lpStartParams != NULL)
35  {
36  /* Count the number of arguments */
37  lpChar = lpStartParams;
38  while (*lpChar != 0)
39  {
40  if (iswspace(*lpChar))
41  {
42  bWhiteSpace = TRUE;
43  }
44  else
45  {
46  if (bWhiteSpace != FALSE)
47  {
48  dwArgsCount++;
49  bWhiteSpace = FALSE;
50  }
51  }
52 
53  lpChar++;
54  }
55 
56  /*
57  * Allocate the arguments vector.
58  * Do not add the service name here because services.exe does it for us!
59  */
60  lpArgsVector = LocalAlloc(LMEM_FIXED, dwArgsCount * sizeof(LPCWSTR));
61  if (!lpArgsVector)
62  return FALSE;
63 
64  /* Fill the arguments vector */
65  dwArgsCount = 0;
66  bWhiteSpace = TRUE;
67  lpChar = lpStartParams;
68  while (*lpChar != 0)
69  {
70  if (iswspace(*lpChar))
71  {
72  *lpChar = 0;
73  bWhiteSpace = TRUE;
74  }
75  else
76  {
77  if (bWhiteSpace != FALSE)
78  {
79  lpArgsVector[dwArgsCount] = lpChar;
80  dwArgsCount++;
81  bWhiteSpace = FALSE;
82  }
83  }
84 
85  lpChar++;
86  }
87  }
88 
90  NULL,
92  if (!hSCManager)
93  {
94  if (lpArgsVector)
95  LocalFree((LPVOID)lpArgsVector);
96  return FALSE;
97  }
98 
99  hService = OpenServiceW(hSCManager,
100  ServiceName,
102  if (!hService)
103  {
105  if (lpArgsVector)
106  LocalFree((LPVOID)lpArgsVector);
107  return FALSE;
108  }
109 
110  /* Start the service */
111  Result = StartServiceW(hService,
112  dwArgsCount,
113  lpArgsVector);
115  {
116  /* If it's already running, just return TRUE */
117  Result = TRUE;
118  }
119  else if (Result)
120  {
121  if (hProgress)
122  {
123  /* Increment the progress bar */
125  }
126 
127  /* Get the service status to check if it's running */
128  Result = QueryServiceStatusEx(hService,
131  sizeof(SERVICE_STATUS_PROCESS),
132  &BytesNeeded);
133  if (Result)
134  {
135  Result = FALSE;
136  MaxWait = MAX_WAIT_TIME;
137  OldCheckPoint = ServiceStatus.dwCheckPoint;
138  StartTickCount = GetTickCount();
139 
140  /* Loop until it's running */
142  {
143  int i;
144  /* Fixup the wait time */
145  WaitTime = ServiceStatus.dwWaitHint / 10;
146 
147  if (WaitTime < 1000) WaitTime = 1000;
148  else if (WaitTime > 10000) WaitTime = 10000;
149 
150  /* We don't wanna wait for up to 10 secs without incrementing */
151  for (i = WaitTime / 1000; i > 0; i--)
152  {
153  Sleep(1000);
154  if (hProgress)
155  {
156  /* Increment the progress bar */
158  }
159  }
160 
161 
162  /* Get the latest status info */
163  if (!QueryServiceStatusEx(hService,
166  sizeof(SERVICE_STATUS_PROCESS),
167  &BytesNeeded))
168  {
169  /* Something went wrong... */
170  break;
171  }
172 
173  /* Is the service making progress? */
174  if (ServiceStatus.dwCheckPoint > OldCheckPoint)
175  {
176  /* It is, get the latest tickcount to reset the max wait time */
177  StartTickCount = GetTickCount();
178  OldCheckPoint = ServiceStatus.dwCheckPoint;
179  }
180  else
181  {
182  /* It's not, make sure we haven't exceeded our wait time */
183  if (GetTickCount() >= StartTickCount + MaxWait)
184  {
185  /* We have, give up */
186  break;
187  }
188  }
189  }
190  }
191 
193  {
194  Result = TRUE;
195  }
196  }
197 
198  CloseServiceHandle(hService);
199 
201 
202  if (lpArgsVector)
203  LocalFree((LPVOID)lpArgsVector);
204 
205  return Result;
206 }
#define TRUE
Definition: types.h:120
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
DWORD dwCurrentState
Definition: winsvc.h:100
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2830
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
DWORD dwCheckPoint
Definition: winsvc.h:104
unsigned char * LPBYTE
Definition: typedefs.h:52
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
smooth NULL
Definition: ftsmooth.c:416
_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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MAX_WAIT_TIME
Definition: start.c:12
#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:288
#define DEFAULT_STEP
Definition: precomp.h:108
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
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()

BOOL 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:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
struct TraceInfo Info
DWORD nMaxFile
Definition: commdlg.h:337
#define GetSaveFileName
Definition: commdlg.h:666
#define UNICODE_NULL
smooth NULL
Definition: ftsmooth.c:416
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:26
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
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
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 }
struct TraceInfo Info
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
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE ProcessHeap
Definition: servman.c:15
#define HeapFree(x, y, z)
Definition: compat.h:394

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:133
struct _PAGEDATA * PPAGEDATA
#define TRUE
Definition: types.h:120
#define ACTION_START
Definition: precomp.h:37
#define EM_SETREADONLY
Definition: winuser.h:1976
static VOID SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
#define ACTION_STOP
Definition: precomp.h:38
BOOL bDescriptionChanged
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
Definition: progress.c:322
PSERVICEPROPSHEET dlgInfo
#define SendDlgItemMessage
Definition: winuser.h:5708
#define PSN_APPLY
Definition: prsht.h:117
BOOL bDisplayNameChanged
#define IDC_PAUSE
Definition: resource.h:75
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define IDC_START
Definition: resource.h:137
#define LVSTATUS
Definition: precomp.h:29
#define IDC_STOP
Definition: resource.h:69
#define GWLP_USERDATA
Definition: treelist.c:63
BOOL bBinaryPathChanged
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define ACTION_RESUME
Definition: precomp.h:40
#define WM_DESTROY
Definition: winuser.h:1591
#define GetDlgItemText
Definition: winuser.h:5651
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_DISP_NAME
Definition: resource.h:130
#define IDC_DESCRIPTION
Definition: resource.h:131
static VOID SetButtonStates(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
BOOL bStartTypeChanged
#define WM_COMMAND
Definition: winuser.h:1716
#define IDC_START_PARAM
Definition: resource.h:135
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ACTION_PAUSE
Definition: precomp.h:39
HWND WINAPI GetParent(_In_ HWND)
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS *pService)
Definition: query.c:373
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
#define IDC_RESUME
Definition: resource.h:140
#define IDC_EDIT
Definition: resource.h:136
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CBN_SELCHANGE
Definition: winuser.h:1940
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_EXEPATH
Definition: resource.h:132
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define WM_INITDIALOG
Definition: winuser.h:1715
static VOID InitGeneralPage(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
PMAIN_WND_INFO Info
Definition: precomp.h:129
#define HeapFree(x, y, z)
Definition: compat.h:394
VOID SaveDlgInfo(PPAGEDATA pPageData, HWND hwndDlg)
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:1983

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:1059
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
smooth NULL
Definition: ftsmooth.c:416
#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 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 }
smooth NULL
Definition: ftsmooth.c:416
static BOOL BuildListOfServicesToStop(LPWSTR *lpServiceList, LPWSTR lpServiceName)
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 }
struct TraceInfo Info
LONG_PTR LPARAM
Definition: windef.h:208
#define LVM_GETITEM
Definition: commctrl.h:2364
#define SendMessage
Definition: winuser.h:5709
#define LVIF_PARAM
Definition: commctrl.h:2283
#define LVITEM
Definition: commctrl.h:2347

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:1059
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
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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 SERVICE_QUERY_CONFIG
Definition: winsvc.h:53
#define HeapFree(x, y, z)
Definition: compat.h:394
#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:1059
#define SERVICE_CONFIG_DESCRIPTION
Definition: winsvc.h:65
VOID GetError(VOID)
Definition: misc.c:192
unsigned char * LPBYTE
Definition: typedefs.h:52
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
smooth NULL
Definition: ftsmooth.c:416
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
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:394
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:1059
#define SERVICE_STATE_ALL
Definition: winsvc.h:52
struct TraceInfo Info
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 char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1633
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
#define SERVICE_WIN32
Definition: cmtypes.h:962
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define EnumServicesStatusEx
Definition: winsvc.h:572
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2730
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
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:2195
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetWindowTextLengthW(_In_ HWND)
GLenum GLsizei len
Definition: glext.h:6722

◆ IncrementProgressBar()

VOID IncrementProgressBar ( HANDLE  hProgress,
UINT  NewPos 
)

Definition at line 288 of file progress.c.

290 {
291  HWND hProgBar = (HWND)hProgress;
292  UINT Position;
293 
294  /* Don't allow the progress to reach to complete*/
295  Position = SendMessageW(hProgBar,
296  PBM_GETPOS,
297  0,
298  0);
300  {
301  /* Do we want to increment the default amount? */
302  if (Step == DEFAULT_STEP)
303  {
304  /* Use the step value we set on create */
305  SendMessageW(hProgBar,
306  PBM_STEPIT,
307  0,
308  0);
309  }
310  else
311  {
312  /* Use the value passed */
313  SendMessageW(hProgBar,
314  PBM_SETPOS,
315  Step,
316  0);
317  }
318  }
319 }
static COORD Position
Definition: mouse.c:34
HANDLE HWND
Definition: compat.h:13
#define PBM_SETPOS
Definition: commctrl.h:2156
#define PBM_STEPIT
Definition: commctrl.h:2159
#define PROGRESS_STEP_MAX
Definition: progress.c:15
#define DEFAULT_STEP
Definition: precomp.h:108
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define PBM_GETPOS
Definition: commctrl.h:2166

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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:925
#define ILC_COLOR32
Definition: commctrl.h:343
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
HINSTANCE hInstance
Definition: charmap.c:20
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:801
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
smooth NULL
Definition: ftsmooth.c:416
#define RGB(r, g, b)
Definition: wingdi.h:2918
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:537
int ret
#define LR_LOADTRANSPARENT
Definition: winuser.h:1083
#define ILC_MASK
Definition: commctrl.h:336
unsigned int UINT
Definition: ndis.h:50
#define IMAGE_BITMAP
Definition: winuser.h:211
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:560
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

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

◆ InitMainWindowImpl()

BOOL InitMainWindowImpl ( VOID  )

Definition at line 961 of file mainwnd.c.

962 {
963  WNDCLASSEX wc = {0};
964 
965  wc.cbSize = sizeof(WNDCLASSEX);
967  wc.hInstance = hInstance;
968  wc.hIcon = LoadIcon(hInstance,
970  wc.hCursor = LoadCursor(NULL,
971  IDC_ARROW);
972  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
977  IMAGE_ICON,
978  16,
979  16,
980  LR_SHARED);
981 
982  return RegisterClassEx(&wc) != (ATOM)0;
983 }
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:14
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDR_MAINMENU
Definition: resource.h:40
static HICON
Definition: imagelist.c:84
LPCSTR lpszMenuName
Definition: winuser.h:3163
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define RegisterClassEx
Definition: winuser.h:5703
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
LPCSTR lpszClassName
Definition: winuser.h:3164
WORD ATOM
Definition: dimm.idl:113
HICON hIconSm
Definition: winuser.h:3165
HINSTANCE hInstance
Definition: winuser.h:3159
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3154
HBRUSH hbrBackground
Definition: winuser.h:3162
HICON hIcon
Definition: winuser.h:3160
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:636
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LoadCursor
Definition: winuser.h:5678
HINSTANCE hInstance
Definition: mainwnd.c:15
#define IDI_SM_ICON
Definition: resource.h:66
#define IDC_ARROW
Definition: winuser.h:682
#define LoadImage
Definition: winuser.h:5681
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5585
#define LoadIcon
Definition: winuser.h:5679

◆ 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:1026
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
ENUM_SERVICE_STATUS_PROCESS * GetSelectedService(PMAIN_WND_INFO Info)
Definition: query.c:13
struct TraceInfo Info
HMENU hMainMenu
Definition: mplay32.c:25
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ID_DELETE
Definition: resource.h:27
#define MAKELONG(a, b)
Definition: typedefs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
#define MF_ENABLED
Definition: winuser.h:128
#define SB_SETTEXT
Definition: commctrl.h:1921
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define ID_PROP
Definition: resource.h:17
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SendMessage
Definition: winuser.h:5709
#define TBSTATE_ENABLED
Definition: commctrl.h:946
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
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
#define va_start(ap, A)
Definition: acmsvcex.h:91
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:152
static BOOL OnQueryInitialFocus(HWND hwndDlg, PLOGONDATA pLogonData)
static BOOL OnApply(HWND hwndDlg, PLOGONDATA pLogonData)
#define DEFAULT_PASSWORD
#define TRUE
Definition: types.h:120
LPSTR lpServiceStartName
Definition: winsvc.h:152
#define SERVICE_INTERACTIVE_PROCESS
Definition: cmtypes.h:965
#define IDC_LOGON_SYSTEMACCOUNT
Definition: resource.h:144
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
WCHAR szAccountName[64]
#define IDC_LOGON_THISACCOUNT
Definition: resource.h:145
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
#define BM_SETCHECK
Definition: winuser.h:1882
#define IDC_LOGON_HWPROFILE
Definition: resource.h:153
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define BN_CLICKED
Definition: winuser.h:1886
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:1716
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:147
#define IDC_LOGON_PASSWORD1
Definition: resource.h:150
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define BST_CHECKED
Definition: winuser.h:197
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_LOGON_INTERACTIVE
Definition: resource.h:146
#define GetWindowLongPtr
Definition: treelist.c:73
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define WM_INITDIALOG
Definition: winuser.h:1715
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:394
_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:1983

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:398
_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)
struct TraceInfo Info
smooth NULL
Definition: ftsmooth.c:416
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned int __stdcall PropSheetThread(void *Param)
Definition: propsheet.c:53
PVOID HANDLE
Definition: typedefs.h:71
HANDLE ProcessHeap
Definition: servman.c:15
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:130
HANDLE hThread
Definition: wizard.c:27
PMAIN_WND_INFO Info
Definition: precomp.h:129

Referenced by MainWndCommand().

◆ ProgressDialogProc()

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

Definition at line 231 of file progress.c.

235 {
236  switch(Message)
237  {
238  case WM_INITDIALOG:
239  {
240  return InitProgressDialog(hDlg, Message, wParam, lParam);
241  }
242 
243  case WM_COMMAND:
244  switch(LOWORD(wParam))
245  {
246  case IDOK:
247  EndDialog(hDlg, wParam);
248  break;
249 
250  }
251  break;
252 
253  default:
254  return FALSE;
255  }
256 
257  return TRUE;
258 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static BOOL InitProgressDialog(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: progress.c:193
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
CHAR Message[80]
Definition: alive.c:5
#define WM_COMMAND
Definition: winuser.h:1716
#define WM_INITDIALOG
Definition: winuser.h:1715
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:169
#define TRUE
Definition: types.h:120
#define IDC_FIRST_FAILURE
Definition: resource.h:159
#define IDC_SUBSEQUENT_FAILURES
Definition: resource.h:161
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:160
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define IDC_RESET_TIME
Definition: resource.h:162
#define WM_DESTROY
Definition: winuser.h:1591
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static VOID BrowseFile(HWND hwndDlg)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define BN_CLICKED
Definition: winuser.h:1886
#define IDC_RESTART_TIME
Definition: resource.h:164
static VOID InitRecoveryPage(HWND hwndDlg)
#define IDC_RESTART_OPTIONS
Definition: resource.h:173
#define WM_COMMAND
Definition: winuser.h:1716
#define IDC_PARAMETERS
Definition: resource.h:171
HWND WINAPI GetParent(_In_ HWND)
#define IDC_PROGRAM
Definition: resource.h:168
ENUM_SERVICE_STATUS_PROCESS * pService
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CBN_SELCHANGE
Definition: winuser.h:1940
#define IDC_ADD_FAILCOUNT
Definition: resource.h:172
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowLongPtr
Definition: treelist.c:73
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
static VOID ShowFailureActions(HWND hwndDlg, PRECOVERYDATA pRecoveryData)
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:1983

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 }
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:124
#define WM_SETREDRAW
Definition: winuser.h:1598
#define ZeroMemory
Definition: winbase.h:1635
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2380
int32_t INT
Definition: typedefs.h:56
struct TraceInfo Info
#define LVIF_TEXT
Definition: commctrl.h:2281
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
LPARAM lParam
Definition: commctrl.h:2340
LONG_PTR LPARAM
Definition: windef.h:208
BOOL GetServiceList(PMAIN_WND_INFO Info)
Definition: query.c:279
LPWSTR pszText
Definition: commctrl.h:2337
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVLOGONAS
Definition: precomp.h:31
UINT mask
Definition: commctrl.h:2332
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
#define LVDESC
Definition: precomp.h:28
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5709
#define LVIF_PARAM
Definition: commctrl.h:2283
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2386

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 322 of file progress.c.

327 {
328  PROGRESS_DATA ProgressData;
329  LPWSTR ServiceList;
330  BOOL StopDepends;
331  INT_PTR Result;
332 
333  StopDepends = FALSE;
334  ServiceList = NULL;
335 
336 
337  /* Check if we'll be stopping the service */
339  {
340  /* Does the service have any dependent services which need stopping first */
341  ServiceList = GetListOfServicesToStop(ServiceName);
342  if (ServiceList)
343  {
344  /* Ask the user if they want to stop the dependants */
345  StopDepends = CreateStopDependsDialog(hParent,
346  ServiceName,
347  DisplayName,
348  ServiceList);
349 
350  /* Exit early if the user decided not to stop the dependants */
351  if (StopDepends == FALSE)
352  {
353  HeapFree(GetProcessHeap(), 0, ServiceList);
354  return FALSE;
355  }
356  }
357  }
358 
359  ProgressData.hDlg = NULL;
360  ProgressData.ServiceName = ServiceName;
361  ProgressData.Action = Action;
362  ProgressData.StopDepends = StopDepends;
363  ProgressData.ServiceList = ServiceList;
364  ProgressData.Param = Param;
365 
368  hParent,
370  (LPARAM)&ProgressData);
371 
372  if (ServiceList)
373  HeapFree(GetProcessHeap(), 0, ServiceList);
374 
375  return (Result == IDOK);
376 }
BOOL CreateStopDependsDialog(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, LPWSTR ServiceList)
#define IDOK
Definition: winuser.h:824
#define IDD_DLG_PROGRESS
Definition: resource.h:205
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define ACTION_STOP
Definition: precomp.h:38
INT_PTR CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: progress.c:231
BOOL StopDepends
Definition: progress.c:23
LPWSTR ServiceList
Definition: progress.c:24
int32_t INT_PTR
Definition: typedefs.h:62
PVOID Param
Definition: progress.c:25
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR ServiceName
Definition: progress.c:21
smooth NULL
Definition: ftsmooth.c:416
_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:395
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
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:394
#define ACTION_RESTART
Definition: precomp.h:41

Referenced by GeneralPageProc(), and MainWndCommand().

◆ SetListViewStyle()

VOID SetListViewStyle ( HWND  hListView,
DWORD  View 
)

Definition at line 34 of file listview.c.

36 {
38 
39  if ((Style & LVS_TYPEMASK) != View)
40  {
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
HWND hListView
Definition: gui.cpp:29
#define LVS_TYPEMASK
Definition: commctrl.h:2237
#define GetWindowLongPtr
Definition: treelist.c:73

Referenced by MainWndCommand().

◆ SetMenuAndButtonStates()

VOID SetMenuAndButtonStates ( PMAIN_WND_INFO  Info)

Definition at line 151 of file mainwnd.c.

152 {
154  UINT i;
155 
156  /* get handle to menu */
157  hMainMenu = GetMenu(Info->hMainWnd);
158 
159  /* set all to greyed */
160  for (i = ID_START; i <= ID_RESTART; i++)
161  {
163  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), i, MF_GRAYED);
164  SendMessage(Info->hTool, TB_SETSTATE, i,
166  }
167 
168  if (Info->SelectedItem != NO_ITEM_SELECTED)
169  {
170  LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL;
171  DWORD Flags, State;
172 
173  /* allow user to delete service */
174  if (Info->bIsUserAnAdmin)
175  {
179  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
180  }
181 
182  Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
183  State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
184 
185  lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
186 
187  if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
188  {
189  if (State == SERVICE_STOPPED)
190  {
192  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED);
195  }
196 
198  {
200  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_RESTART, MF_ENABLED);
203  }
204  }
205 
206  if(lpServiceConfig)
207  HeapFree(GetProcessHeap(), 0, lpServiceConfig);
208 
210  {
212  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED);
215  }
216 
218  {
220  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED);
223  }
224  }
225  else
226  {
227  /* disable tools which rely on a selected service */
230  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_GRAYED);
231  EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_GRAYED);
236  }
237 
238 }
#define TBSTATE_INDETERMINATE
Definition: commctrl.h:948
#define TB_SETSTATE
Definition: commctrl.h:1026
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
struct TraceInfo Info
#define SERVICE_DISABLED
Definition: cmtypes.h:977
HMENU hMainMenu
Definition: mplay32.c:25
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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_STOPPED
Definition: winsvc.h:21
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ID_DELETE
Definition: resource.h:27
#define ID_PAUSE
Definition: resource.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define GetProcessHeap()
Definition: compat.h:395
#define MF_ENABLED
Definition: winuser.h:128
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ID_START
Definition: resource.h:20
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define ID_RESTART
Definition: resource.h:24
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
enum State_ State
Definition: pofuncs.h:54
#define NO_ITEM_SELECTED
Definition: precomp.h:24
#define ID_PROP
Definition: resource.h:17
unsigned int UINT
Definition: ndis.h:50
#define SendMessage
Definition: winuser.h:5709
#define TBSTATE_ENABLED
Definition: commctrl.h:946
#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:394
#define ID_STOP
Definition: resource.h:21

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 }
#define TRUE
Definition: types.h:120
LPSTR lpServiceStartName
Definition: winsvc.h:152
BOOL WINAPI UnlockServiceDatabase(SC_LOCK ScLock)
Definition: scm.c:2961
VOID GetError(VOID)
Definition: misc.c:192
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
smooth NULL
Definition: ftsmooth.c:416
#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
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 
234  if (ChangeServiceConfig2W(hSc,
236  &ServiceDescription))
237  {
238  bRet = TRUE;
239  }
240 
241  CloseServiceHandle(hSc);
242  }
243 
244  UnlockServiceDatabase(scLock);
245  }
246 
248  }
249 
250  if (!bRet)
251  GetError();
252 
253  return bRet;
254 }
#define TRUE
Definition: types.h:120
BOOL WINAPI UnlockServiceDatabase(SC_LOCK ScLock)
Definition: scm.c:2961
#define SERVICE_CONFIG_DESCRIPTION
Definition: winsvc.h:65
VOID GetError(VOID)
Definition: misc.c:192
unsigned int BOOL
Definition: ntddk_ex.h:94
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
smooth NULL
Definition: ftsmooth.c:416
#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
SC_LOCK WINAPI LockServiceDatabase(SC_HANDLE hSCManager)
Definition: scm.c:1901
BOOL WINAPI ChangeServiceConfig2W(SC_HANDLE hService, DWORD dwInfoLevel, LPVOID lpInfo)
Definition: scm.c:304

Referenced by DoCreate(), and SaveDlgInfo().

◆ StatusBarLoadAndFormatString()

BOOL StatusBarLoadAndFormatString ( IN HWND  hStatusBar,
IN INT  PartId,
IN HINSTANCE  hInstance,
IN UINT  uID,
  ... 
)

Definition at line 108 of file misc.c.

113 {
114  BOOL Ret = FALSE;
115  LPWSTR lpFormat, lpStr;
116  va_list lArgs;
117 
119  hInstance,
120  uID) > 0)
121  {
122  va_start(lArgs, uID);
123  /* let's use FormatMessage to format it because it has the ability to allocate
124  memory automatically */
126  lpFormat,
127  0,
128  0,
129  (VOID*)&lpStr,
130  0,
131  &lArgs);
132  va_end(lArgs);
133 
134  if (lpStr != NULL)
135  {
137  SB_SETTEXT,
138  (WPARAM)PartId,
139  (LPARAM)lpStr);
140  LocalFree((HLOCAL)lpStr);
141  }
142 
144  }
145 
146  return Ret;
147 }
static BOOL
Definition: misc.c:82
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
UINT_PTR WPARAM
Definition: windef.h:207
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: