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

Go to the source code of this file.

Classes

struct  _MAIN_WND_INFO
 
struct  _MENU_HINT
 
struct  _SERVICEPROPSHEET
 
struct  _DEPENDDATA
 

Macros

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

Typedefs

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

Functions

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

Variables

HINSTANCE hInstance
 
HANDLE ProcessHeap
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 5 of file precomp.h.

◆ ACTION_PAUSE

#define ACTION_PAUSE   3

Definition at line 42 of file precomp.h.

◆ ACTION_RESTART

#define ACTION_RESTART   5

Definition at line 44 of file precomp.h.

◆ ACTION_RESUME

#define ACTION_RESUME   4

Definition at line 43 of file precomp.h.

◆ ACTION_START

#define ACTION_START   1

Definition at line 40 of file precomp.h.

◆ ACTION_STOP

#define ACTION_STOP   2

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

◆ IMAGE_DRIVER

#define IMAGE_DRIVER   2

Definition at line 38 of file precomp.h.

◆ IMAGE_SERVICE

#define IMAGE_SERVICE   1

Definition at line 37 of file precomp.h.

◆ IMAGE_UNKNOWN

#define IMAGE_UNKNOWN   0

Definition at line 36 of file precomp.h.

◆ LVDESC

#define LVDESC   1

Definition at line 30 of file precomp.h.

◆ LVLOGONAS

#define LVLOGONAS   4

Definition at line 33 of file precomp.h.

◆ LVMAX

#define LVMAX   5

Definition at line 34 of file precomp.h.

◆ LVNAME

#define LVNAME   0

Definition at line 29 of file precomp.h.

◆ LVSTARTUP

#define LVSTARTUP   3

Definition at line 32 of file precomp.h.

◆ LVSTATUS

#define LVSTATUS   2

Definition at line 31 of file precomp.h.

◆ MAX_KEY_LENGTH

#define MAX_KEY_LENGTH   256

Definition at line 27 of file precomp.h.

◆ NO_ITEM_SELECTED

#define NO_ITEM_SELECTED   -1

Definition at line 26 of file precomp.h.

◆ ORD_ASCENDING

#define ORD_ASCENDING   1

Definition at line 46 of file precomp.h.

◆ ORD_DESCENDING

#define ORD_DESCENDING   -1

Definition at line 47 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 4 of file precomp.h.

Typedef Documentation

◆ DEPENDDATA

◆ MAIN_WND_INFO

◆ MENU_HINT

◆ PDEPENDDATA

◆ PMAIN_WND_INFO

◆ PMENU_HINT

◆ PSERVICEPROPSHEET

◆ SERVICEPROPSHEET

Function Documentation

◆ AboutDialogProc()

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

Definition at line 4 of file about.c.

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

◆ 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;
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}
#define IMAGE_SERVICE
Definition: precomp.h:37
#define IMAGE_DRIVER
Definition: precomp.h:38
#define IMAGE_UNKNOWN
Definition: precomp.h:36
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define TVIF_TEXT
Definition: commctrl.h:3271
#define TVIF_IMAGE
Definition: commctrl.h:3272
#define TV_INSERTSTRUCT
Definition: commctrl.h:3382
#define TV_ITEM
Definition: commctrl.h:3305
#define TVIF_PARAM
Definition: commctrl.h:3273
#define TVIF_CHILDREN
Definition: commctrl.h:3277
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3417
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3276
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define ZeroMemory
Definition: winbase.h:1712
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2790
_In_ LPCSTR lpName
Definition: winbase.h:2789
#define SERVICE_KERNEL_DRIVER
Definition: cmtypes.h:953
#define SERVICE_WIN32_SHARE_PROCESS
Definition: cmtypes.h:963
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962
#define SERVICE_FILE_SYSTEM_DRIVER
Definition: cmtypes.h:954
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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 LengthOfStrResource(IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:23
HINSTANCE hInst
Definition: dxdiag.c:13
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
int32_t INT
Definition: typedefs.h:58
#define LMEM_FIXED
Definition: winbase.h:368
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

◆ 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}
INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:59
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define LVLOGONAS
Definition: precomp.h:33
#define LVDESC
Definition: precomp.h:30
HANDLE ProcessHeap
Definition: servman.c:15
#define LVSTATUS
Definition: precomp.h:31
#define LVSTARTUP
Definition: precomp.h:32
LPWSTR GetServiceDescription(LPWSTR lpServiceName)
Definition: query.c:135
#define LVNAME
Definition: precomp.h:29
#define IDS_SERVICES_AUTO
Definition: resource.h:59
#define IDS_SERVICES_MAN
Definition: resource.h:60
#define IDS_SERVICES_STARTED
Definition: resource.h:57
#define IDS_SERVICES_DIS
Definition: resource.h:61
#define index(s, c)
Definition: various.h:29
#define HeapFree(x, y, z)
Definition: compat.h:735
GLuint index
Definition: glext.h:6031
#define LVM_SETITEMTEXT
Definition: commctrl.h:2694
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2692
#define LVFINDINFO
Definition: commctrl.h:2468
#define LVFI_PARAM
Definition: commctrl.h:2441
#define LVITEM
Definition: commctrl.h:2380
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2475
SERVICE_STATUS_PROCESS ServiceStatusProcess
Definition: winsvc.h:137
LPSTR lpServiceStartName
Definition: winsvc.h:152
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
#define SERVICE_RUNNING
Definition: winsvc.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

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

◆ CompleteProgressBar()

VOID CompleteProgressBar ( HANDLE  hProgress)

Definition at line 311 of file progress.c.

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

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 {
232 16,
233 16,
234 0);
235 if (hIcon)
236 {
237 SendMessage(hDlg,
238 WM_SETICON,
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
263 {
264 DoCreate(Data);
265 }
266 else
267 {
268 /* Something went wrong, leave the dialog
269 * open so they can try again */
271 break;
272 }
273
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}
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
static BOOL GetDataFromDialog(PCREATE_DATA Data)
Definition: create.c:112
struct _CREATE_DATA * PCREATE_DATA
static BOOL DoCreate(PCREATE_DATA Data)
Definition: create.c:26
INT_PTR CALLBACK CreateHelpDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: create.c:163
static BOOL bHelpOpen
Definition: create.c:23
#define ID_CREATE_HELP
Definition: resource.h:187
#define IDD_DLG_HELP_OPTIONS
Definition: resource.h:188
#define IDI_SM_ICON
Definition: resource.h:64
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CreateDialog
Definition: winuser.h:5761

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
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",
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 */
416
417 return TRUE;
418}
static VOID InitListViewImage(PMAIN_WND_INFO Info)
Definition: listview.c:299
static const COLUMN_LIST Columns[]
Definition: listview.c:19
#define ORD_ASCENDING
Definition: precomp.h:46
#define ID_VIEW_LARGE
Definition: resource.h:33
#define IDC_SERVLIST
Definition: resource.h:11
#define ID_VIEW_DETAILS
Definition: resource.h:36
GLdouble n
Definition: glext.h:7729
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
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_VISIBLE
Definition: pedump.c:620
#define LBS_NOTIFY
Definition: pedump.c:678
#define LBS_NOREDRAW
Definition: pedump.c:680
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define WC_LISTVIEWW
Definition: commctrl.h:2262
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:758
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2656
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2738
#define LVS_REPORT
Definition: commctrl.h:2267
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2739
#define LVS_SORTASCENDING
Definition: commctrl.h:2273
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2730
#define LVCF_FMT
Definition: commctrl.h:2591
#define HDI_LPARAM
Definition: commctrl.h:706
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define LVCF_TEXT
Definition: commctrl.h:2593
#define HDITEM
Definition: commctrl.h:697
int iSubItem
Definition: listview.c:14
LPWSTR pszText
Definition: commctrl.h:2572
#define MF_BYCOMMAND
Definition: winuser.h:202
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:790
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_OK
Definition: winuser.h:793
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
HMENU WINAPI GetMenu(_In_ HWND)

Referenced by ChildWndProc(), and InitMainWnd().

◆ CreateMainWindow()

HWND CreateMainWindow ( LPCTSTR  lpCaption,
int  nCmdShow 
)

Definition at line 923 of file mainwnd.c.

925{
928
931 sizeof(MAIN_WND_INFO));
932
933 if (Info != NULL)
934 {
935 Info->nCmdShow = nCmdShow;
936
939 lpCaption,
943 680,
944 450,
945 NULL,
946 NULL,
947 hInstance,
948 Info);
949 if (hMainWnd == NULL)
950 {
951 //int ret;
952 //ret = GetLastError();
953 GetError();
955 0,
956 Info);
957 }
958 }
959
960 return hMainWnd;
961}
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:15
VOID GetError(VOID)
Definition: misc.c:192
HWND hMainWnd
Definition: magnifier.c:32
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define CreateWindowEx
Definition: winuser.h:5767
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define CW_USEDEFAULT
Definition: winuser.h:225

◆ 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;
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}
#define IDD_DLG_DEPEND_STOP
Definition: resource.h:213
static WCHAR ServiceName[]
Definition: browser.c:19
INT_PTR CALLBACK StopDependsDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
LPWSTR ServiceName
LPWSTR DisplayName
LPWSTR ServiceList
int32_t INT_PTR
Definition: typedefs.h:64
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
_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:409

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{
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 {
84 (LONG_PTR)Info);
85
89 16,
90 16,
91 0);
92 if (hIcon)
93 {
94 SendMessageW(hDlg,
95 WM_SETICON,
97 (LPARAM)hIcon);
99 }
100
104 0,
105 (LPARAM)Info->pCurrentService->lpDisplayName);
106
107 lpDescription = GetServiceDescription(Info->pCurrentService->lpServiceName);
108 if (lpDescription)
109 {
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}
static BOOL DoDeleteService(PMAIN_WND_INFO Info, HWND hDlg)
Definition: delete.c:13
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:125
struct _MAIN_WND_INFO * PMAIN_WND_INFO
#define IDC_DEL_NAME
Definition: resource.h:197
#define IDC_DEL_DESC
Definition: resource.h:198
LPARAM lParam
Definition: combotst.c:139
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
#define GetWindowLongPtr
Definition: treelist.c:73
#define GWLP_USERDATA
Definition: treelist.c:63
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2247
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1620
#define SetWindowLongPtrW
Definition: winuser.h:5358

Referenced by MainWndCommand().

◆ DependenciesPageProc()

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

Definition at line 183 of file propsheet_depends.c.

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

Referenced by PropSheetThread().

◆ DisplayString()

VOID DisplayString ( PWCHAR  )

◆ DoControlService()

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

Definition at line 18 of file control.c.

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

Referenced by ActionThread().

◆ DoStartService()

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

Definition at line 18 of file start.c.

21{
22 SC_HANDLE hSCManager;
23 SC_HANDLE hService;
25 DWORD BytesNeeded = 0;
26 DWORD StartTickCount;
27 DWORD OldCheckPoint;
28 DWORD WaitTime;
29 DWORD MaxWait;
31
32 BOOL bWhiteSpace = TRUE;
33 LPWSTR lpChar;
34 DWORD dwArgsCount = 0;
35 DWORD dwResult = ERROR_SUCCESS;
36 LPCWSTR *lpArgsVector = NULL;
37
38 if (lpStartParams != NULL)
39 {
40 /* Count the number of arguments */
41 lpChar = lpStartParams;
42 while (*lpChar != 0)
43 {
44 if (iswspace(*lpChar))
45 {
46 bWhiteSpace = TRUE;
47 }
48 else
49 {
50 if (bWhiteSpace != FALSE)
51 {
52 dwArgsCount++;
53 bWhiteSpace = FALSE;
54 }
55 }
56
57 lpChar++;
58 }
59
60 /*
61 * Allocate the arguments vector.
62 * Do not add the service name here because services.exe does it for us!
63 */
64 lpArgsVector = LocalAlloc(LMEM_FIXED, dwArgsCount * sizeof(LPCWSTR));
65 if (!lpArgsVector)
66 return GetLastError();
67
68 /* Fill the arguments vector */
69 dwArgsCount = 0;
70 bWhiteSpace = TRUE;
71 lpChar = lpStartParams;
72 while (*lpChar != 0)
73 {
74 if (iswspace(*lpChar))
75 {
76 *lpChar = 0;
77 bWhiteSpace = TRUE;
78 }
79 else
80 {
81 if (bWhiteSpace != FALSE)
82 {
83 lpArgsVector[dwArgsCount] = lpChar;
84 dwArgsCount++;
85 bWhiteSpace = FALSE;
86 }
87 }
88
89 lpChar++;
90 }
91 }
92
94 NULL,
96 if (!hSCManager)
97 {
98 dwResult = GetLastError();
99 if (lpArgsVector)
100 LocalFree((LPVOID)lpArgsVector);
101 return dwResult;
102 }
103
104 hService = OpenServiceW(hSCManager,
107 if (!hService)
108 {
109 dwResult = GetLastError();
111 if (lpArgsVector)
112 LocalFree((LPVOID)lpArgsVector);
113 return dwResult;
114 }
115
116 /* Start the service */
117 Result = StartServiceW(hService,
118 dwArgsCount,
119 lpArgsVector);
121 {
122 /* If it's already running, just return TRUE */
123 Result = TRUE;
124 }
125 else if (Result)
126 {
127 if (hProgress)
128 {
129 /* Increment the progress bar */
131 }
132
133 /* Get the service status to check if it's running */
134 Result = QueryServiceStatusEx(hService,
138 &BytesNeeded);
139 if (Result)
140 {
141 Result = FALSE;
142 MaxWait = MAX_WAIT_TIME;
143 OldCheckPoint = ServiceStatus.dwCheckPoint;
144 StartTickCount = GetTickCount();
145
146 /* Loop until it's running */
148 {
149 int i;
150 /* Fixup the wait time */
151 WaitTime = ServiceStatus.dwWaitHint / 10;
152
153 if (WaitTime < 1000) WaitTime = 1000;
154 else if (WaitTime > 10000) WaitTime = 10000;
155
156 /* We don't wanna wait for up to 10 secs without incrementing */
157 for (i = WaitTime / 1000; i > 0; i--)
158 {
159 Sleep(1000);
160 if (hProgress)
161 {
162 /* Increment the progress bar */
164 }
165 }
166
167
168 /* Get the latest status info */
169 if (!QueryServiceStatusEx(hService,
173 &BytesNeeded))
174 {
175 /* Something went wrong... */
176 dwResult = GetLastError();
177 DPRINT1("QueryServiceStatusEx failed: %d\n", dwResult);
178 break;
179 }
180
181 /* Is the service making progress? */
182 if (ServiceStatus.dwCheckPoint > OldCheckPoint)
183 {
184 /* It is, get the latest tickcount to reset the max wait time */
185 StartTickCount = GetTickCount();
186 OldCheckPoint = ServiceStatus.dwCheckPoint;
187 }
188 else
189 {
190 /* It's not, make sure we haven't exceeded our wait time */
191 if (GetTickCount() >= StartTickCount + MaxWait)
192 {
193 /* We have, give up */
194 DPRINT1("Timeout\n");
196 break;
197 }
198 }
199 }
200 }
201 else
202 {
203 dwResult = GetLastError();
204 }
205
207 {
208 dwResult = ERROR_SUCCESS;
209 }
210 }
211
212 CloseServiceHandle(hService);
214
215 if (lpArgsVector)
216 LocalFree((LPVOID)lpArgsVector);
217
218 return dwResult;
219}
#define MAX_WAIT_TIME
Definition: start.c:15
#define iswspace(_c)
Definition: ctype.h:669
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2980
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607
#define SERVICE_START
Definition: winsvc.h:57
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by ActionThread().

◆ DoStopService()

DWORD DoStopService ( LPWSTR  ServiceName,
HANDLE  hProgress 
)

Referenced by ActionThread().

◆ ExportFile()

VOID ExportFile ( PMAIN_WND_INFO  Info)

Definition at line 108 of file export.c.

109{
111 WCHAR szFileName[MAX_PATH];
112
113 ZeroMemory(&ofn, sizeof(ofn));
114 szFileName[0] = UNICODE_NULL;
115
116 ofn.lStructSize = sizeof(OPENFILENAME);
117 ofn.hwndOwner = Info->hMainWnd;
118 ofn.lpstrFilter = L"Text (Tab Delimited)(*.txt)\0*.txt\0Text (Comma Delimited)(*.csv)\0*.csv\0";
119 ofn.lpstrFile = szFileName;
121 ofn.lpstrDefExt = L"txt";
123
124 if(GetSaveFileName(&ofn))
125 {
126 if (SaveServicesToFile(Info, szFileName, ofn.nFilterIndex))
127 return;
128 }
129
131 MessageBoxW(NULL, L"Export to file failed", NULL, 0);
132}
static BOOL SaveServicesToFile(PMAIN_WND_INFO Info, LPCWSTR pszFileName, DWORD nFormat)
Definition: export.c:36
#define CDERR_GENERALCODES
Definition: cderr.h:5
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:148
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define GetSaveFileName
Definition: commdlg.h:666
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define MAX_PATH
Definition: compat.h:34
#define UNICODE_NULL
OPENFILENAME ofn
Definition: sndrec32.cpp:56
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nFilterIndex
Definition: commdlg.h:335
HWND hwndOwner
Definition: commdlg.h:330
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337

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}

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,
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:
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,
414 lpStartParams);
415
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,
428 NULL);
429
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,
441 NULL);
442
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
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_PAUSE
Definition: resource.h:75
#define IDC_STOP
Definition: resource.h:69
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
#define ACTION_START
Definition: precomp.h:40
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
Definition: progress.c:372
#define ACTION_PAUSE
Definition: precomp.h:42
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS *pService)
Definition: query.c:373
#define ACTION_STOP
Definition: precomp.h:41
#define ACTION_RESUME
Definition: precomp.h:43
#define IDC_DESCRIPTION
Definition: resource.h:129
#define IDC_START
Definition: resource.h:135
#define IDC_EXEPATH
Definition: resource.h:130
#define IDC_EDIT
Definition: resource.h:134
#define IDC_RESUME
Definition: resource.h:138
#define IDC_START_TYPE
Definition: resource.h:131
#define IDC_START_PARAM
Definition: resource.h:133
#define IDC_DISP_NAME
Definition: resource.h:128
static VOID InitGeneralPage(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
static VOID SetButtonStates(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
struct _PAGEDATA * PPAGEDATA
VOID SaveDlgInfo(PPAGEDATA pPageData, HWND hwndDlg)
static VOID SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
PSERVICEPROPSHEET dlgInfo
BOOL bDescriptionChanged
BOOL bDisplayNameChanged
BOOL bStartTypeChanged
BOOL bBinaryPathChanged
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:132
PMAIN_WND_INFO Info
Definition: precomp.h:131
#define HIWORD(l)
Definition: typedefs.h:247
#define EM_SETREADONLY
Definition: winuser.h:2018
#define GetDlgItemText
Definition: winuser.h:5797
#define CBN_SELCHANGE
Definition: winuser.h:1982
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define SendDlgItemMessage
Definition: winuser.h:5854
#define EN_CHANGE
Definition: winuser.h:2025

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}
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 LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:420
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419

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

◆ GetExecutablePath()

LPWSTR GetExecutablePath ( LPWSTR  lpServiceName)

◆ GetListOfServicesToStop()

LPWSTR GetListOfServicesToStop ( LPWSTR  lpServiceName)

Definition at line 126 of file stop_dependencies.c.

127{
128 LPWSTR lpServiceList = NULL;
129
130 /* Call recursive function to get our list */
131 if (BuildListOfServicesToStop(&lpServiceList, lpServiceName))
132 return lpServiceList;
133 else
134 return NULL;
135}
static BOOL BuildListOfServicesToStop(LPWSTR *lpServiceList, LPWSTR lpServiceName)

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}
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LVM_GETITEM
Definition: commctrl.h:2397

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 {
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}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
BOOL WINAPI QueryServiceConfigW(SC_HANDLE hService, LPQUERY_SERVICE_CONFIGW lpServiceConfig, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2291
QUERY_SERVICE_CONFIGA * LPQUERY_SERVICE_CONFIG
Definition: winsvc.h:550
#define SERVICE_QUERY_CONFIG
Definition: winsvc.h:53

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;
143
145 NULL,
147 if (hSCManager == NULL)
148 {
149 GetError();
150 return NULL;
151 }
152
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
196cleanup:
197 if (pServiceDescription)
199 0,
200 pServiceDescription);
201 if (hSCManager != NULL)
203 if (hSc != NULL)
205
206 return lpDescription;
207}
static void cleanup(void)
Definition: main.c:1335
BOOL WINAPI QueryServiceConfig2W(SC_HANDLE hService, DWORD dwInfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2491
#define SERVICE_CONFIG_DESCRIPTION
Definition: winsvc.h:65
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16

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

◆ GetServiceList()

BOOL GetServiceList ( PMAIN_WND_INFO  Info)

Definition at line 279 of file query.c.

280{
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 */
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}
VOID FreeServiceList(PMAIN_WND_INFO Info)
Definition: query.c:257
#define ERROR_MORE_DATA
Definition: dderror.h:13
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define CopyMemory
Definition: winbase.h:1710
#define SERVICE_STATE_ALL
Definition: winsvc.h:52
#define EnumServicesStatusEx
Definition: winsvc.h:572
@ SC_ENUM_PROCESS_INFO
Definition: winsvc.h:122
#define SERVICE_WIN32
Definition: cmtypes.h:964

Referenced by RefreshServiceList().

◆ GetTextFromEdit()

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

Definition at line 174 of file misc.c.

177{
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}
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
int WINAPI GetWindowTextLengthW(_In_ HWND)

◆ IncrementProgressBar()

VOID IncrementProgressBar ( HANDLE  hProgress,
UINT  NewPos 
)

Definition at line 338 of file progress.c.

340{
341 HWND hProgBar = (HWND)hProgress;
343
344 /* Don't allow the progress to reach to complete*/
345 Position = SendMessageW(hProgBar,
347 0,
348 0);
350 {
351 /* Do we want to increment the default amount? */
352 if (Step == DEFAULT_STEP)
353 {
354 /* Use the step value we set on create */
355 SendMessageW(hProgBar,
357 0,
358 0);
359 }
360 else
361 {
362 /* Use the value passed */
363 SendMessageW(hProgBar,
365 Step,
366 0);
367 }
368 }
369}
#define PROGRESS_STEP_MAX
Definition: progress.c:15
#define PBM_SETPOS
Definition: commctrl.h:2189
#define PBM_STEPIT
Definition: commctrl.h:2192
static COORD Position
Definition: mouse.c:34

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 */
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 {
250 ret = -1;
251 break;
252 }
253
254 if (type == IMAGE_BITMAP)
255 {
257 hImage,
258 RGB(255, 0, 128));
259 }
260 else if (type == IMAGE_ICON)
261 {
263 hImage);
264 }
265
266 DeleteObject(hImage);
267 }
268
269 if (ret == -1)
270 {
272 himl = NULL;
273 }
274
275 return himl;
276}
HIMAGELIST himl
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ILC_COLOR32
Definition: commctrl.h:358
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define ILC_MASK
Definition: commctrl.h:351
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
int ret
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_LOADTRANSPARENT
Definition: winuser.h:1096

Referenced by InitDependPage(), pCreateToolbar(), PopulateTreeView(), and SoundsDlgProc().

◆ InitMainWindowImpl()

BOOL InitMainWindowImpl ( VOID  )

Definition at line 964 of file mainwnd.c.

965{
966 WNDCLASSEX wc = {0};
967
968 wc.cbSize = sizeof(WNDCLASSEX);
970 wc.hInstance = hInstance;
974 IDC_ARROW);
975 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
981 16,
982 16,
983 LR_SHARED);
984
985 return RegisterClassEx(&wc) != (ATOM)0;
986}
#define IDR_MAINMENU
Definition: resource.h:40
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:639
WORD ATOM
Definition: dimm.idl:113
HINSTANCE hInstance
Definition: winuser.h:3209
HCURSOR hCursor
Definition: winuser.h:3211
LPCSTR lpszMenuName
Definition: winuser.h:3213
HICON hIconSm
Definition: winuser.h:3215
UINT cbSize
Definition: winuser.h:3204
WNDPROC lpfnWndProc
Definition: winuser.h:3206
LPCSTR lpszClassName
Definition: winuser.h:3214
HICON hIcon
Definition: winuser.h:3210
HBRUSH hbrBackground
Definition: winuser.h:3212
#define IDC_ARROW
Definition: winuser.h:687
#define RegisterClassEx
Definition: winuser.h:5849
#define LoadIcon
Definition: winuser.h:5825
#define LoadCursor
Definition: winuser.h:5824
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5731
#define LR_SHARED
Definition: winuser.h:1103
#define COLOR_BTNFACE
Definition: winuser.h:931

◆ 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,
64 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0),
65 ID_PROP,
67 SetMenuDefaultItem(GetSubMenu(Info->hShortcutMenu, 0),
68 ID_PROP,
70 }
71
72 /* activate delete menu item, if not already */
76 {
80 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0),
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,
94 1,
95 (LPARAM)Info->pCurrentService->lpDisplayName);
96
97 /* show the properties button */
98 SendMessage(Info->hTool,
100 ID_PROP,
102}
ENUM_SERVICE_STATUS_PROCESS * GetSelectedService(PMAIN_WND_INFO Info)
Definition: query.c:13
#define ID_DELETE
Definition: resource.h:25
#define ID_PROP
Definition: resource.h:15
HMENU hMainMenu
Definition: mplay32.c:25
#define TB_SETSTATE
Definition: commctrl.h:1054
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define SB_SETTEXT
Definition: commctrl.h:1954
#define MAKELONG(a, b)
Definition: typedefs.h:249
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)

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
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 */
94 0,
95 0,
96 (LPWSTR)lpTarget,
97 0,
98 &lArgs);
99 va_end(lArgs);
100
102 }
103
104 return Ret;
105}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
LPCWSTR lpFormat
Definition: trayclock.cpp:32
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:421

◆ 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,
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
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}
#define IDC_LOGON_ACCOUNTNAME
Definition: resource.h:145
#define IDC_LOGON_PASSWORD1
Definition: resource.h:148
#define IDC_LOGON_PASSWORD2
Definition: resource.h:150
#define IDC_LOGON_HWPROFILE
Definition: resource.h:151
#define IDC_LOGON_THISACCOUNT
Definition: resource.h:143
#define IDC_LOGON_SYSTEMACCOUNT
Definition: resource.h:142
#define IDC_LOGON_INTERACTIVE
Definition: resource.h:144
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
static BOOL OnQueryInitialFocus(HWND hwndDlg, PLOGONDATA pLogonData)
struct _LOGONDATA * PLOGONDATA
static BOOL OnApply(HWND hwndDlg, PLOGONDATA pLogonData)
static VOID SetControlStates(HWND hwndDlg, PLOGONDATA pLogonData, BOOL bLocalSystem)
#define DEFAULT_PASSWORD
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPQUERY_SERVICE_CONFIG pServiceConfig
BOOL bAccountChanged
WCHAR szAccountName[64]
WCHAR szPassword1[64]
ENUM_SERVICE_STATUS_PROCESS * pService
WCHAR szPassword2[64]
UINT_PTR WPARAM
Definition: windef.h:207
#define BM_SETCHECK
Definition: winuser.h:1924
#define BN_CLICKED
Definition: winuser.h:1928
#define BST_CHECKED
Definition: winuser.h:197
#define SERVICE_INTERACTIVE_PROCESS
Definition: cmtypes.h:967

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}
unsigned int __stdcall PropSheetThread(void *Param)
Definition: propsheet.c:53
#define CloseHandle
Definition: compat.h:739
HANDLE hThread
Definition: wizard.c:28
_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)
PVOID HANDLE
Definition: typedefs.h:73

Referenced by MainWndCommand().

◆ ProgressDialogProc()

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

Definition at line 281 of file progress.c.

285{
286 switch(Message)
287 {
288 case WM_INITDIALOG:
289 {
290 return InitProgressDialog(hDlg, Message, wParam, lParam);
291 }
292
293 case WM_COMMAND:
294 switch(LOWORD(wParam))
295 {
296 case IDOK:
297 EndDialog(hDlg, wParam);
298 break;
299
300 }
301 break;
302
303 default:
304 return FALSE;
305 }
306
307 return TRUE;
308}
static BOOL InitProgressDialog(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: progress.c:243
static const WCHAR Message[]
Definition: register.c:74

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,
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 {
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
512 if (HIWORD(wParam) == BN_CLICKED)
513 {
514 pRecoveryData->bChanged = TRUE;
515 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
516 }
517 break;
518
520 BrowseFile(hwndDlg);
521 break;
522
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_SECOND_FAILURE
Definition: resource.h:158
#define IDC_SUBSEQUENT_FAILURES
Definition: resource.h:159
#define IDC_ADD_FAILCOUNT
Definition: resource.h:170
#define IDC_RESTART_TIME
Definition: resource.h:162
#define IDC_BROWSE_PROGRAM
Definition: resource.h:167
#define IDC_PROGRAM
Definition: resource.h:166
#define IDC_RESTART_OPTIONS
Definition: resource.h:171
#define IDC_FIRST_FAILURE
Definition: resource.h:157
#define IDC_PARAMETERS
Definition: resource.h:169
#define IDC_RESET_TIME
Definition: resource.h:160
static VOID SetFailureActions(HWND hwndDlg)
static VOID BrowseFile(HWND hwndDlg)
static VOID ShowFailureActions(HWND hwndDlg, PRECOVERYDATA pRecoveryData)
static VOID InitRecoveryPage(HWND hwndDlg)
static BOOL GetServiceFailure(PRECOVERYDATA pRecoveryData)
static VOID UpdateFailureActions(HWND hwndDlg, PRECOVERYDATA pRecoveryData)
struct _RECOVERYDATA * PRECOVERYDATA
LPSERVICE_FAILURE_ACTIONS pServiceFailure
ENUM_SERVICE_STATUS_PROCESS * pService

Referenced by PropSheetThread().

◆ RefreshServiceList()

BOOL RefreshServiceList ( PMAIN_WND_INFO  Info)

Definition at line 247 of file listview.c.

248{
250 LVITEMW lvItem;
251 DWORD Index;
252
253 SendMessage (Info->hListView,
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,
292 TRUE,
293 0);
294
295 return TRUE;
296}
BOOL GetServiceList(PMAIN_WND_INFO Info)
Definition: query.c:279
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2419
#define LVIF_TEXT
Definition: commctrl.h:2314
LPWSTR pszText
Definition: commctrl.h:2370
UINT mask
Definition: commctrl.h:2365
LPARAM lParam
Definition: commctrl.h:2373
_In_ WDFCOLLECTION _In_ ULONG Index
#define WM_SETREDRAW
Definition: winuser.h:1619

Referenced by MainWndCommand(), and MainWndProc().

◆ ResourceMessageBox()

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

Definition at line 282 of file misc.c.

288{
289 WCHAR szErrorText[BUFFERSIZE];
290 WCHAR szErrorCaption[BUFFERSIZE];
291
292 LoadStringW(hInstance, uMessageId, szErrorText, sizeof(szErrorText) / sizeof(WCHAR));
293 LoadStringW(hInstance, uCaptionId, szErrorCaption, sizeof(szErrorCaption) / sizeof(WCHAR));
294
295 MessageBoxW(hwnd, szErrorText, szErrorCaption, uType);
296}
#define BUFFERSIZE
Definition: misc.c:279
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

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

◆ RunActionWithProgress()

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

Definition at line 372 of file progress.c.

377{
378 PROGRESS_DATA ProgressData;
379 LPWSTR ServiceList;
380 BOOL StopDepends;
382
383 StopDepends = FALSE;
384 ServiceList = NULL;
385
386
387 /* Check if we'll be stopping the service */
389 {
390 /* Does the service have any dependent services which need stopping first */
392 if (ServiceList)
393 {
394 /* Ask the user if they want to stop the dependants */
395 StopDepends = CreateStopDependsDialog(hParent,
397 DisplayName,
398 ServiceList);
399
400 /* Exit early if the user decided not to stop the dependants */
401 if (StopDepends == FALSE)
402 {
403 HeapFree(GetProcessHeap(), 0, ServiceList);
404 return FALSE;
405 }
406 }
407 }
408
409 ProgressData.hDlg = NULL;
410 ProgressData.ServiceName = ServiceName;
411 ProgressData.Action = Action;
412 ProgressData.StopDepends = StopDepends;
413 ProgressData.ServiceList = ServiceList;
414 ProgressData.Param = Param;
415
418 hParent,
420 (LPARAM)&ProgressData);
421
422 if (ServiceList)
423 HeapFree(GetProcessHeap(), 0, ServiceList);
424
425 return (Result == IDOK);
426}
LPWSTR GetListOfServicesToStop(LPWSTR lpServiceName)
#define ACTION_RESTART
Definition: precomp.h:44
BOOL CreateStopDependsDialog(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, LPWSTR ServiceList)
INT_PTR CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: progress.c:281
#define IDD_DLG_PROGRESS
Definition: resource.h:203
LPWSTR ServiceList
Definition: progress.c:24
BOOL StopDepends
Definition: progress.c:23
ULONG Action
Definition: progress.c:22
PVOID Param
Definition: progress.c:25
LPWSTR ServiceName
Definition: progress.c:21
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

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 {
41 SetWindowLongPtr(hListView,
43 (Style & ~LVS_TYPEMASK) | View);
44 }
45}
const DWORD Style
Definition: appswitch.c:71
#define LVS_TYPEMASK
Definition: commctrl.h:2270
#define GWL_STYLE
Definition: winuser.h:855

Referenced by MainWndCommand().

◆ SetMenuAndButtonStates()

VOID SetMenuAndButtonStates ( PMAIN_WND_INFO  Info)

Definition at line 152 of file mainwnd.c.

153{
155 UINT i;
156
157 /* get handle to menu */
158 hMainMenu = GetMenu(Info->hMainWnd);
159
160 /* set all to greyed */
161 for (i = ID_START; i <= ID_RESTART; i++)
162 {
164 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), i, MF_GRAYED);
165 SendMessage(Info->hTool, TB_SETSTATE, i,
167 }
168
169 if (Info->SelectedItem != NO_ITEM_SELECTED)
170 {
171 LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL;
173
174 /* allow user to delete service */
175 if (Info->bIsUserAnAdmin)
176 {
180 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
181 }
182
183 Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
184 State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
185
186 lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
187
188 if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
189 {
190 if (State == SERVICE_STOPPED)
191 {
193 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED);
196 }
197
199 {
201 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_RESTART, MF_ENABLED);
204 }
205 }
206
207 if(lpServiceConfig)
208 HeapFree(GetProcessHeap(), 0, lpServiceConfig);
209
211 {
213 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED);
216 }
217
219 {
221 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED);
224 }
225 }
226 else
227 {
228 /* disable tools which rely on a selected service */
231 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_GRAYED);
232 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_GRAYED);
237 }
238
239}
#define NO_ITEM_SELECTED
Definition: precomp.h:26
#define ID_START
Definition: resource.h:18
#define ID_STOP
Definition: resource.h:19
#define ID_PAUSE
Definition: resource.h:20
#define ID_RESTART
Definition: resource.h:22
#define TBSTATE_INDETERMINATE
Definition: commctrl.h:976
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define MF_GRAYED
Definition: winuser.h:129
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define SERVICE_DISABLED
Definition: cmtypes.h:979

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
120 }
121
122 UnlockServiceDatabase(scLock);
123 }
124
126 }
127
128 if (!bRet)
129 GetError();
130
131 return bRet;
132}
BOOL WINAPI UnlockServiceDatabase(SC_LOCK ScLock)
Definition: scm.c:3018
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:482
SC_LOCK WINAPI LockServiceDatabase(SC_HANDLE hSCManager)
Definition: scm.c:1958
#define SC_MANAGER_LOCK
Definition: winsvc.h:17
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54

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 {
228 lpServiceName,
230 if (hSc)
231 {
232 ServiceDescription.lpDescription = lpDescription;
233
234 if (ChangeServiceConfig2W(hSc,
236 &ServiceDescription))
237 {
238 bRet = TRUE;
239 }
240
242 }
243
244 UnlockServiceDatabase(scLock);
245 }
246
248 }
249
250 if (!bRet)
251 GetError();
252
253 return bRet;
254}
BOOL WINAPI ChangeServiceConfig2W(SC_HANDLE hService, DWORD dwInfoLevel, LPVOID lpInfo)
Definition: scm.c:305

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 {
138 (WPARAM)PartId,
139 (LPARAM)lpStr);
140 LocalFree((HLOCAL)lpStr);
141 }
142
144 }
145
146 return Ret;
147}
HWND hStatusBar
Definition: main.c:23
#define BOOL
Definition: nt_native.h:43

◆ StatusBarLoadString()

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

Definition at line 150 of file misc.c.

154{
155 BOOL Ret = FALSE;
156 LPWSTR lpStr;
157
158 if (AllocAndLoadString(&lpStr,
159 hInstance,
160 uID) > 0)
161 {
164 (WPARAM)PartId,
165 (LPARAM)lpStr);
166 LocalFree((HLOCAL)lpStr);
167 }
168
169 return Ret;
170}

◆ StopDependsDialogProc()

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

Definition at line 258 of file stop_dependencies.c.

262{
263
264 switch (Message)
265 {
266 case WM_INITDIALOG:
267 {
268 return InitDialog(hDlg,
269 Message,
270 wParam,
271 lParam);
272 }
273
274 case WM_COMMAND:
275 {
276 switch (LOWORD(wParam))
277 {
278 case IDOK:
279 case IDCANCEL:
280 {
281 EndDialog(hDlg,
282 LOWORD(wParam));
283 return TRUE;
284 }
285 }
286 }
287 }
288
289 return FALSE;
290}
static BOOL InitDialog(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)

Referenced by CreateStopDependsDialog().

◆ TV1_AddDependantsToTree()

VOID TV1_AddDependantsToTree ( PDEPENDDATA  pDependData,
HTREEITEM  hParent,
LPWSTR  lpServiceName 
)

Definition at line 82 of file dependencies_tv1.c.

85{
86 SC_HANDLE hSCManager;
87 SC_HANDLE hService;
88 LPQUERY_SERVICE_CONFIG lpServiceConfig;
89 LPWSTR lpDependants;
90 LPWSTR lpStr;
91 LPWSTR lpNoDepends;
92 BOOL bHasChildren;
93
95 NULL,
97 if (hSCManager)
98 {
99 hService = OpenServiceW(hSCManager,
100 lpServiceName,
102 if (hService)
103 {
104 /* Get a list of service dependents */
105 lpDependants = TV1_GetDependants(hService);
106 if (lpDependants)
107 {
108 lpStr = lpDependants;
109
110 /* Make sure this isn't the end of the list */
111 while (*lpStr)
112 {
113 /* Get the info for this service */
114 lpServiceConfig = GetServiceConfig(lpStr);
115 if (lpServiceConfig)
116 {
117 /* Does this item need a +/- box? */
118 if (lpServiceConfig->lpDependencies &&
119 *lpServiceConfig->lpDependencies != '\0')
120 {
121 bHasChildren = TRUE;
122 }
123 else
124 {
125 bHasChildren = FALSE;
126 }
127
128 /* Add it */
130 hParent,
131 lpServiceConfig->lpDisplayName,
132 lpStr,
133 lpServiceConfig->dwServiceType,
134 bHasChildren);
135
137 0,
138 lpServiceConfig);
139 }
140
141 /* Move to the end of the string */
142 while (*lpStr++)
143 ;
144 }
145
147 0,
148 lpDependants);
149 }
150 else
151 {
152 /* If there is no parent, set the tree to 'no dependencies' */
153 if (!hParent)
154 {
155 /* Load the 'No dependencies' string */
157
159 NULL,
160 lpNoDepends,
161 NULL,
162 0,
163 FALSE);
164
165 LocalFree(lpNoDepends);
166
167 /* Disable the window */
168 EnableWindow(pDependData->hDependsTreeView1, FALSE);
169 }
170 }
171
172 CloseServiceHandle(hService);
173 }
174
176 }
177}
HTREEITEM AddItemToTreeView(HWND hTreeView, HTREEITEM hRoot, LPWSTR lpDisplayName, LPWSTR lpServiceName, ULONG serviceType, BOOL bHasChildren)
#define IDS_NO_DEPENDS
Definition: resource.h:178
LPWSTR TV1_GetDependants(SC_HANDLE hService)
#define SERVICE_ENUMERATE_DEPENDENTS
Definition: winsvc.h:56
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13

Referenced by DependenciesPageProc(), and TV1_Initialize().

◆ TV1_Initialize()

BOOL TV1_Initialize ( PDEPENDDATA  pDependData,
LPWSTR  lpServiceName 
)

Definition at line 180 of file dependencies_tv1.c.

182{
183 BOOL bRet = FALSE;
184
185 /* Associate the imagelist with TV1 */
186 pDependData->hDependsTreeView1 = GetDlgItem(pDependData->hDependsWnd, IDC_DEPEND_TREE1);
187 if (!pDependData->hDependsTreeView1)
188 {
190 pDependData->hDependsImageList = NULL;
191 return FALSE;
192 }
194 pDependData->hDependsImageList,
196
197 /* Set the first items in the control */
198 TV1_AddDependantsToTree(pDependData, NULL, lpServiceName);
199
200 return bRet;
201}
#define TVSIL_NORMAL
Definition: commctrl.h:3448
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3452

Referenced by InitDependPage().

◆ TV2_AddDependantsToTree()

VOID TV2_AddDependantsToTree ( PDEPENDDATA  pDependData,
HTREEITEM  hParent,
LPWSTR  lpServiceName 
)

Definition at line 121 of file dependencies_tv2.c.

124{
125
126 LPENUM_SERVICE_STATUSW lpServiceStatus;
127 LPWSTR lpNoDepends;
128 DWORD count, i;
129 BOOL bHasChildren;
130
131 /* Get a list of service dependents */
132 lpServiceStatus = TV2_GetDependants(lpServiceName, &count);
133 if (lpServiceStatus)
134 {
135 for (i = 0; i < count; i++)
136 {
137 /* Does this item need a +/- box? */
138 bHasChildren = TV2_HasDependantServices(lpServiceStatus[i].lpServiceName);
139
140 /* Add it */
142 hParent,
143 lpServiceStatus[i].lpDisplayName,
144 lpServiceStatus[i].lpServiceName,
145 lpServiceStatus[i].ServiceStatus.dwServiceType,
146 bHasChildren);
147 }
148
150 0,
151 lpServiceStatus);
152 }
153 else
154 {
155 /* If there is no parent, set the tree to 'no dependencies' */
156 if (!hParent)
157 {
158 /* Load the 'No dependencies' string */
160
162 NULL,
163 lpNoDepends,
164 NULL,
165 0,
166 FALSE);
167
168 LocalFree(lpNoDepends);
169
170 /* Disable the window */
171 EnableWindow(pDependData->hDependsTreeView2, FALSE);
172 }
173 }
174}
BOOL TV2_HasDependantServices(LPWSTR lpServiceName)
LPENUM_SERVICE_STATUS TV2_GetDependants(LPWSTR lpServiceName, LPDWORD lpdwCount)
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by DependenciesPageProc(), and TV2_Initialize().

◆ TV2_GetDependants()

LPENUM_SERVICE_STATUS TV2_GetDependants ( LPWSTR  lpServiceName,
LPDWORD  lpdwCount 
)

Definition at line 55 of file dependencies_tv2.c.

57{
58 SC_HANDLE hSCManager;
59 SC_HANDLE hService;
60 LPENUM_SERVICE_STATUSW lpDependencies = NULL;
61 DWORD dwBytesNeeded;
62 DWORD dwCount;
63
64 /* Set the first items in each tree view */
66 NULL,
68 if (hSCManager)
69 {
70 hService = OpenServiceW(hSCManager,
71 lpServiceName,
73 if (hService)
74 {
75 /* Does this have any dependencies? */
76 if (!EnumDependentServicesW(hService,
78 NULL,
79 0,
80 &dwBytesNeeded,
81 &dwCount) &&
83 {
85 0,
86 dwBytesNeeded);
87 if (lpDependencies)
88 {
89 /* Get the list of dependents */
90 if (EnumDependentServicesW(hService,
92 lpDependencies,
93 dwBytesNeeded,
94 &dwBytesNeeded,
95 &dwCount))
96 {
97 /* Set the count */
98 *lpdwCount = dwCount;
99 }
100 else
101 {
103 0,
104 lpDependencies);
105
106 lpDependencies = NULL;
107 }
108 }
109 }
110
111 CloseServiceHandle(hService);
112 }
113
115 }
116
117 return lpDependencies;
118}
BOOL WINAPI EnumDependentServicesW(SC_HANDLE hService, DWORD dwServiceState, LPENUM_SERVICE_STATUSW lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned)
Definition: scm.c:1033
struct _ENUM_SERVICE_STATUSW * LPENUM_SERVICE_STATUSW

Referenced by BuildListOfServicesToStop(), and TV2_AddDependantsToTree().

◆ TV2_HasDependantServices()

BOOL TV2_HasDependantServices ( LPWSTR  lpServiceName)

Definition at line 13 of file dependencies_tv2.c.

14{
16 HANDLE hService;
17 DWORD dwBytesNeeded, dwCount;
18 BOOL bRet = FALSE;
19
21 NULL,
23 if (hSCManager)
24 {
25 hService = OpenServiceW(hSCManager,
26 lpServiceName,
28 if (hService)
29 {
30 /* Does this have any dependencies? */
31 if (!EnumDependentServices(hService,
33 NULL,
34 0,
35 &dwBytesNeeded,
36 &dwCount))
37 {
39 {
40 /* It does, return TRUE */
41 bRet = TRUE;
42 }
43 }
44
45 CloseServiceHandle(hService);
46 }
47
49 }
50
51 return bRet;
52}
#define EnumDependentServices
Definition: winsvc.h:570

Referenced by TV2_AddDependantsToTree().

◆ TV2_Initialize()

BOOL TV2_Initialize ( PDEPENDDATA  pDependData,
LPWSTR  lpServiceName 
)

Definition at line 177 of file dependencies_tv2.c.

179{
180 BOOL bRet = FALSE;
181
182 /* Associate the imagelist with TV2 */
183 pDependData->hDependsTreeView2 = GetDlgItem(pDependData->hDependsWnd, IDC_DEPEND_TREE2);
184 if (!pDependData->hDependsTreeView2)
185 {
187 pDependData->hDependsImageList = NULL;
188 return FALSE;
189 }
191 pDependData->hDependsImageList,
193
194 /* Set the first items in the control */
195 TV2_AddDependantsToTree(pDependData, NULL, lpServiceName);
196
197 return bRet;
198}

Referenced by InitDependPage().

◆ UninitMainWindowImpl()

VOID UninitMainWindowImpl ( VOID  )

Definition at line 990 of file mainwnd.c.

991{
993 hInstance);
994}
#define UnregisterClass
Definition: winuser.h:5873

◆ UpdateServiceCount()

VOID UpdateServiceCount ( PMAIN_WND_INFO  Info)

Definition at line 125 of file mainwnd.c.

126{
127 LPWSTR lpNumServices;
128
129 if (AllocAndLoadString(&lpNumServices,
130 hInstance,
132 {
133 WCHAR szNumServices[32];
134
135 INT NumListedServ = ListView_GetItemCount(Info->hListView);
136
137 _snwprintf(szNumServices,
138 31,
139 lpNumServices,
140 NumListedServ);
141
142 SendMessage(Info->hStatus,
144 0,
145 (LPARAM)szNumServices);
146
147 LocalFree(lpNumServices);
148 }
149}
#define IDS_NUM_SERVICES
Definition: resource.h:62
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312

Referenced by DeleteDialogProc(), and RefreshServiceList().

◆ UpdateServiceStatus()

BOOL UpdateServiceStatus ( ENUM_SERVICE_STATUS_PROCESS pService)

Definition at line 373 of file query.c.

374{
375 SC_HANDLE hScm;
376 BOOL bRet = FALSE;
377
378 hScm = OpenSCManagerW(NULL,
379 NULL,
381 if (hScm != NULL)
382 {
383 SC_HANDLE hService;
384
385 hService = OpenServiceW(hScm,
386 pService->lpServiceName,
388 if (hService)
389 {
390 DWORD size;
391
392 QueryServiceStatusEx(hService,
394 (LPBYTE)&pService->ServiceStatusProcess,
396 &size);
397
398 CloseServiceHandle(hService);
399 bRet = TRUE;
400 }
401
402 CloseServiceHandle(hScm);
403 }
404
405 return bRet;
406}
GLsizeiptr size
Definition: glext.h:5919

Referenced by GeneralPageProc(), and MainWndCommand().

Variable Documentation

◆ hInstance

HINSTANCE hInstance
extern

Definition at line 19 of file charmap.c.

◆ ProcessHeap

HANDLE ProcessHeap
extern

Definition at line 15 of file servman.c.

Referenced by add_entry(), AddBootStoreEntry(), AddDiskToList(), AddNTOSInstallation(), AddPartitionToDisk(), AddProvider(), AppendGenericListEntry(), calloc(), ChangeListViewText(), CloseIniBootLoaderStore(), CommandDumpSector(), CommandPartInfo(), ConsoleCreateFileHandler(), CreateDialogProc(), CreateEditWindow(), CreateFileSystemList(), CreateGenericList(), CreateInsertBlankRegion(), CreateMainWindow(), CreatePartitionList(), CreateProgressBarEx(), DefaultProcessEntry(), DeleteDialogProc(), DeletePartition(), DestroyFileSystemList(), DestroyGenericList(), DestroyPartitionList(), DestroyProgressBar(), DestroyRegion(), DeviceInstallThread(), DismountPartition(), do_reg_operation(), EnumerateBiosDiskEntries(), free(), FreeBootCode(), FreeLdrEnumerateBootEntries(), FreeMemory(), freep(), FreeServiceList(), GetServiceDescription(), GetServiceList(), GetStringFromDialog(), INF_FreeData(), INF_GetDataField(), IniCacheAddKeyAorW(), IniCacheAddSectionAorW(), IniCacheCreate(), IniCacheDestroy(), IniCacheFreeKey(), IniCacheFreeSection(), IniCacheLoadByHandle(), IniCacheSaveByHandle(), IniFindClose(), IniFindFirstValue(), InitDialog(), InitGeneralPage(), InitVolume(), InstallDevice(), MainWndProc(), malloc(), MSZipAlloc(), MSZipFree(), NtLdrEnumerateBootEntries(), OpenIniBootLoaderStore(), OpenPropSheet(), PnpEventThread(), ProcessLangEntry(), ReadBootCodeByHandle(), ReAllocateLayoutBuffer(), RtlDestroyHeap(), RtlpFreeDebugInfo(), SaveDlgInfo(), SetConsoleOutputCP(), SetStartupType(), SetupCloseFileQueue(), SetupDeleteQueueEntry(), SetupOpenFileQueue(), SetupQueueCopyWithCab(), SetupQueueDeleteW(), SetupQueueRenameW(), split(), SystemConfigurationDataQueryRoutine(), TV1_GetDependants(), TV2_GetDependants(), WriteConsoleOutputCharacterA(), and WriteConsoleOutputCharacterW().