source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/winsvc.h@ 1170

Last change on this file since 1170 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 26.2 KB
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _WINSVC_
7#define _WINSVC_
8
9#include <_mingw.h>
10#include <_mingw_unicode.h>
11#include <apisetcconv.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#define SERVICES_ACTIVE_DATABASEW L"ServicesActive"
18#define SERVICES_FAILED_DATABASEW L"ServicesFailed"
19
20#define SERVICES_ACTIVE_DATABASEA "ServicesActive"
21#define SERVICES_FAILED_DATABASEA "ServicesFailed"
22
23#define SC_GROUP_IDENTIFIERW L'+'
24#define SC_GROUP_IDENTIFIERA '+'
25
26#define SERVICES_ACTIVE_DATABASE __MINGW_NAME_AW(SERVICES_ACTIVE_DATABASE)
27#define SERVICES_FAILED_DATABASE __MINGW_NAME_AW(SERVICES_FAILED_DATABASE)
28
29#define SC_GROUP_IDENTIFIER __MINGW_NAME_AW(SC_GROUP_IDENTIFIER)
30
31#define SERVICE_NO_CHANGE 0xffffffff
32
33#define SERVICE_ACTIVE 0x00000001
34#define SERVICE_INACTIVE 0x00000002
35#define SERVICE_STATE_ALL (SERVICE_ACTIVE | SERVICE_INACTIVE)
36
37#define SERVICE_CONTROL_STOP 0x00000001
38#define SERVICE_CONTROL_PAUSE 0x00000002
39#define SERVICE_CONTROL_CONTINUE 0x00000003
40#define SERVICE_CONTROL_INTERROGATE 0x00000004
41#define SERVICE_CONTROL_SHUTDOWN 0x00000005
42#define SERVICE_CONTROL_PARAMCHANGE 0x00000006
43#define SERVICE_CONTROL_NETBINDADD 0x00000007
44#define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
45#define SERVICE_CONTROL_NETBINDENABLE 0x00000009
46#define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
47#define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
48#define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
49#define SERVICE_CONTROL_POWEREVENT 0x0000000D
50#define SERVICE_CONTROL_SESSIONCHANGE 0x0000000E
51#define SERVICE_CONTROL_PRESHUTDOWN 0x0000000F
52#define SERVICE_CONTROL_TIMECHANGE 0x00000010
53#define SERVICE_CONTROL_USER_LOGOFF 0x00000011
54#define SERVICE_CONTROL_TRIGGEREVENT 0x00000020
55#define SERVICE_CONTROL_LOWRESOURCES 0x00000060
56#define SERVICE_CONTROL_SYSTEMLOWRESOURCES 0x00000061
57
58#define SERVICE_STOPPED 0x00000001
59#define SERVICE_START_PENDING 0x00000002
60#define SERVICE_STOP_PENDING 0x00000003
61#define SERVICE_RUNNING 0x00000004
62#define SERVICE_CONTINUE_PENDING 0x00000005
63#define SERVICE_PAUSE_PENDING 0x00000006
64#define SERVICE_PAUSED 0x00000007
65
66#define SERVICE_ACCEPT_STOP 0x00000001
67#define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
68#define SERVICE_ACCEPT_SHUTDOWN 0x00000004
69#define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
70#define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
71#define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
72#define SERVICE_ACCEPT_POWEREVENT 0x00000040
73#define SERVICE_ACCEPT_SESSIONCHANGE 0x00000080
74#define SERVICE_ACCEPT_PRESHUTDOWN 0x00000100
75#define SERVICE_ACCEPT_TIMECHANGE 0x00000200
76#define SERVICE_ACCEPT_TRIGGEREVENT 0x00000400
77#define SERVICE_ACCEPT_USER_LOGOFF 0x00000800
78#define SERVICE_ACCEPT_LOWRESOURCES 0x00002000
79#define SERVICE_ACCEPT_SYSTEMLOWRESOURCES 0x00004000
80
81#define SC_MANAGER_CONNECT 0x0001
82#define SC_MANAGER_CREATE_SERVICE 0x0002
83#define SC_MANAGER_ENUMERATE_SERVICE 0x0004
84#define SC_MANAGER_LOCK 0x0008
85#define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
86#define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
87
88#define SC_MANAGER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG)
89
90#define SERVICE_QUERY_CONFIG 0x0001
91#define SERVICE_CHANGE_CONFIG 0x0002
92#define SERVICE_QUERY_STATUS 0x0004
93#define SERVICE_ENUMERATE_DEPENDENTS 0x0008
94#define SERVICE_START 0x0010
95#define SERVICE_STOP 0x0020
96#define SERVICE_PAUSE_CONTINUE 0x0040
97#define SERVICE_INTERROGATE 0x0080
98#define SERVICE_USER_DEFINED_CONTROL 0x0100
99
100#define SERVICE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL)
101
102#define SERVICE_RUNS_IN_SYSTEM_PROCESS 0x00000001
103
104#define SERVICE_CONFIG_DESCRIPTION 1
105#define SERVICE_CONFIG_FAILURE_ACTIONS 2
106#define SERVICE_CONFIG_DELAYED_AUTO_START_INFO 3
107#define SERVICE_CONFIG_FAILURE_ACTIONS_FLAG 4
108#define SERVICE_CONFIG_SERVICE_SID_INFO 5
109#define SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO 6
110#define SERVICE_CONFIG_PRESHUTDOWN_INFO 7
111#define SERVICE_CONFIG_TRIGGER_INFO 8
112#define SERVICE_CONFIG_PREFERRED_NODE 9
113#define SERVICE_CONFIG_LAUNCH_PROTECTED 12
114
115#define SERVICE_NOTIFY_STATUS_CHANGE_1 1
116#define SERVICE_NOTIFY_STATUS_CHANGE_2 2
117
118#define SERVICE_NOTIFY_STATUS_CHANGE SERVICE_NOTIFY_STATUS_CHANGE_2
119
120#define SERVICE_NOTIFY_STOPPED 0x00000001
121#define SERVICE_NOTIFY_START_PENDING 0x00000002
122#define SERVICE_NOTIFY_STOP_PENDING 0x00000004
123#define SERVICE_NOTIFY_RUNNING 0x00000008
124#define SERVICE_NOTIFY_CONTINUE_PENDING 0x00000010
125#define SERVICE_NOTIFY_PAUSE_PENDING 0x00000020
126#define SERVICE_NOTIFY_PAUSED 0x00000040
127#define SERVICE_NOTIFY_CREATED 0x00000080
128#define SERVICE_NOTIFY_DELETED 0x00000100
129#define SERVICE_NOTIFY_DELETE_PENDING 0x00000200
130
131#define SERVICE_STOP_REASON_FLAG_MIN 0x00000000
132#define SERVICE_STOP_REASON_FLAG_UNPLANNED 0x10000000
133#define SERVICE_STOP_REASON_FLAG_CUSTOM 0x20000000
134#define SERVICE_STOP_REASON_FLAG_PLANNED 0x40000000
135#define SERVICE_STOP_REASON_FLAG_MAX 0x80000000
136
137#define SERVICE_STOP_REASON_MAJOR_MIN 0x00000000
138#define SERVICE_STOP_REASON_MAJOR_OTHER 0x00010000
139#define SERVICE_STOP_REASON_MAJOR_HARDWARE 0x00020000
140#define SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM 0x00030000
141#define SERVICE_STOP_REASON_MAJOR_SOFTWARE 0x00040000
142#define SERVICE_STOP_REASON_MAJOR_APPLICATION 0x00050000
143#define SERVICE_STOP_REASON_MAJOR_NONE 0x00060000
144#define SERVICE_STOP_REASON_MAJOR_MAX 0x00070000
145#define SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM 0x00400000
146#define SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM 0x00ff0000
147
148#define SERVICE_STOP_REASON_MINOR_MIN 0x00000000
149#define SERVICE_STOP_REASON_MINOR_OTHER 0x00000001
150#define SERVICE_STOP_REASON_MINOR_MAINTENANCE 0x00000002
151#define SERVICE_STOP_REASON_MINOR_INSTALLATION 0x00000003
152#define SERVICE_STOP_REASON_MINOR_UPGRADE 0x00000004
153#define SERVICE_STOP_REASON_MINOR_RECONFIG 0x00000005
154#define SERVICE_STOP_REASON_MINOR_HUNG 0x00000006
155#define SERVICE_STOP_REASON_MINOR_UNSTABLE 0x00000007
156#define SERVICE_STOP_REASON_MINOR_DISK 0x00000008
157#define SERVICE_STOP_REASON_MINOR_NETWORKCARD 0x00000009
158#define SERVICE_STOP_REASON_MINOR_ENVIRONMENT 0x0000000a
159#define SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER 0x0000000b
160#define SERVICE_STOP_REASON_MINOR_OTHERDRIVER 0x0000000c
161#define SERVICE_STOP_REASON_MINOR_SERVICEPACK 0x0000000d
162#define SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE 0x0000000e
163#define SERVICE_STOP_REASON_MINOR_SECURITYFIX 0x0000000f
164#define SERVICE_STOP_REASON_MINOR_SECURITY 0x00000010
165#define SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY 0x00000011
166#define SERVICE_STOP_REASON_MINOR_WMI 0x00000012
167#define SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL 0x00000013
168#define SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL 0x00000014
169#define SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL 0x00000015
170#define SERVICE_STOP_REASON_MINOR_MMC 0x00000016
171#define SERVICE_STOP_REASON_MINOR_NONE 0x00000017
172#define SERVICE_STOP_REASON_MINOR_MEMOTYLIMIT 0x00000018
173#define SERVICE_STOP_REASON_MINOR_MAX 0x00000019
174#define SERVICE_STOP_REASON_MINOR_MIN_CUSTOM 0x00000100
175#define SERVICE_STOP_REASON_MINOR_MAX_CUSTOM 0x0000FFFF
176
177#define SERVICE_CONTROL_STATUS_REASON_INFO 1
178
179#define SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL 1
180#define SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY 2
181#define SERVICE_TRIGGER_TYPE_DOMAIN_JOIN 3
182#define SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT 4
183#define SERVICE_TRIGGER_TYPE_GROUP_POLICY 5
184#define SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT 6
185#define SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE 7
186#define SERVICE_TRIGGER_TYPE_CUSTOM 20
187#define SERVICE_TRIGGER_TYPE_AGGREGATE 30
188
189#define SERVICE_TRIGGER_DATA_TYPE_BINARY 1
190#define SERVICE_TRIGGER_DATA_TYPE_STRING 2
191#define SERVICE_TRIGGER_DATA_TYPE_LEVEL 3
192#define SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY 4
193#define SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL 5
194
195#define SERVICE_START_REASON_DEMAND 0x00000001
196#define SERVICE_START_REASON_AUTO 0x00000002
197#define SERVICE_START_REASON_TRIGGER 0x00000004
198#define SERVICE_START_REASON_RESTART_ON_FAILURE 0x00000008
199#define SERVICE_START_REASON_DELAYEDAUTO 0x00000010
200
201#define SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON 1
202
203#define SERVICE_LAUNCH_PROTECTED_NONE 0
204#define SERVICE_LAUNCH_PROTECTED_WINDOWS 1
205#define SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT 2
206#define SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT 3
207
208 typedef struct _SERVICE_DESCRIPTIONA {
209 LPSTR lpDescription;
210 } SERVICE_DESCRIPTIONA,*LPSERVICE_DESCRIPTIONA;
211
212 typedef struct _SERVICE_DESCRIPTIONW {
213 LPWSTR lpDescription;
214 } SERVICE_DESCRIPTIONW,*LPSERVICE_DESCRIPTIONW;
215
216 __MINGW_TYPEDEF_AW(SERVICE_DESCRIPTION)
217 __MINGW_TYPEDEF_AW(LPSERVICE_DESCRIPTION)
218
219 typedef enum _SC_ACTION_TYPE {
220 SC_ACTION_NONE = 0,SC_ACTION_RESTART = 1,SC_ACTION_REBOOT = 2,SC_ACTION_RUN_COMMAND = 3
221 } SC_ACTION_TYPE;
222
223 typedef struct _SC_ACTION {
224 SC_ACTION_TYPE Type;
225 DWORD Delay;
226 } SC_ACTION,*LPSC_ACTION;
227
228 typedef struct _SERVICE_FAILURE_ACTIONSA {
229 DWORD dwResetPeriod;
230 LPSTR lpRebootMsg;
231 LPSTR lpCommand;
232 DWORD cActions;
233 SC_ACTION *lpsaActions;
234 } SERVICE_FAILURE_ACTIONSA,*LPSERVICE_FAILURE_ACTIONSA;
235
236 typedef struct _SERVICE_FAILURE_ACTIONSW {
237 DWORD dwResetPeriod;
238 LPWSTR lpRebootMsg;
239 LPWSTR lpCommand;
240 DWORD cActions;
241 SC_ACTION *lpsaActions;
242 } SERVICE_FAILURE_ACTIONSW,*LPSERVICE_FAILURE_ACTIONSW;
243
244 __MINGW_TYPEDEF_AW(SERVICE_FAILURE_ACTIONS)
245 __MINGW_TYPEDEF_AW(LPSERVICE_FAILURE_ACTIONS)
246
247 DECLARE_HANDLE(SC_HANDLE);
248 typedef SC_HANDLE *LPSC_HANDLE;
249
250 DECLARE_HANDLE(SERVICE_STATUS_HANDLE);
251
252 typedef enum _SC_STATUS_TYPE {
253 SC_STATUS_PROCESS_INFO = 0
254 } SC_STATUS_TYPE;
255
256 typedef enum _SC_ENUM_TYPE {
257 SC_ENUM_PROCESS_INFO = 0
258 } SC_ENUM_TYPE;
259
260 typedef struct _SERVICE_STATUS {
261 DWORD dwServiceType;
262 DWORD dwCurrentState;
263 DWORD dwControlsAccepted;
264 DWORD dwWin32ExitCode;
265 DWORD dwServiceSpecificExitCode;
266 DWORD dwCheckPoint;
267 DWORD dwWaitHint;
268 } SERVICE_STATUS,*LPSERVICE_STATUS;
269
270 typedef struct _SERVICE_STATUS_PROCESS {
271 DWORD dwServiceType;
272 DWORD dwCurrentState;
273 DWORD dwControlsAccepted;
274 DWORD dwWin32ExitCode;
275 DWORD dwServiceSpecificExitCode;
276 DWORD dwCheckPoint;
277 DWORD dwWaitHint;
278 DWORD dwProcessId;
279 DWORD dwServiceFlags;
280 } SERVICE_STATUS_PROCESS,*LPSERVICE_STATUS_PROCESS;
281
282 typedef struct _ENUM_SERVICE_STATUSA {
283 LPSTR lpServiceName;
284 LPSTR lpDisplayName;
285 SERVICE_STATUS ServiceStatus;
286 } ENUM_SERVICE_STATUSA,*LPENUM_SERVICE_STATUSA;
287
288 typedef struct _ENUM_SERVICE_STATUSW {
289 LPWSTR lpServiceName;
290 LPWSTR lpDisplayName;
291 SERVICE_STATUS ServiceStatus;
292 } ENUM_SERVICE_STATUSW,*LPENUM_SERVICE_STATUSW;
293
294 __MINGW_TYPEDEF_AW(ENUM_SERVICE_STATUS)
295 __MINGW_TYPEDEF_AW(LPENUM_SERVICE_STATUS)
296
297 typedef struct _ENUM_SERVICE_STATUS_PROCESSA {
298 LPSTR lpServiceName;
299 LPSTR lpDisplayName;
300 SERVICE_STATUS_PROCESS ServiceStatusProcess;
301 } ENUM_SERVICE_STATUS_PROCESSA,*LPENUM_SERVICE_STATUS_PROCESSA;
302
303 typedef struct _ENUM_SERVICE_STATUS_PROCESSW {
304 LPWSTR lpServiceName;
305 LPWSTR lpDisplayName;
306 SERVICE_STATUS_PROCESS ServiceStatusProcess;
307 } ENUM_SERVICE_STATUS_PROCESSW,*LPENUM_SERVICE_STATUS_PROCESSW;
308
309 __MINGW_TYPEDEF_AW(ENUM_SERVICE_STATUS_PROCESS)
310 __MINGW_TYPEDEF_AW(LPENUM_SERVICE_STATUS_PROCESS)
311
312 typedef LPVOID SC_LOCK;
313
314 typedef struct _QUERY_SERVICE_LOCK_STATUSA {
315 DWORD fIsLocked;
316 LPSTR lpLockOwner;
317 DWORD dwLockDuration;
318 } QUERY_SERVICE_LOCK_STATUSA,*LPQUERY_SERVICE_LOCK_STATUSA;
319
320 typedef struct _QUERY_SERVICE_LOCK_STATUSW {
321 DWORD fIsLocked;
322 LPWSTR lpLockOwner;
323 DWORD dwLockDuration;
324 } QUERY_SERVICE_LOCK_STATUSW,*LPQUERY_SERVICE_LOCK_STATUSW;
325
326 __MINGW_TYPEDEF_AW(QUERY_SERVICE_LOCK_STATUS)
327 __MINGW_TYPEDEF_AW(LPQUERY_SERVICE_LOCK_STATUS)
328
329 typedef struct _QUERY_SERVICE_CONFIGA {
330 DWORD dwServiceType;
331 DWORD dwStartType;
332 DWORD dwErrorControl;
333 LPSTR lpBinaryPathName;
334 LPSTR lpLoadOrderGroup;
335 DWORD dwTagId;
336 LPSTR lpDependencies;
337 LPSTR lpServiceStartName;
338 LPSTR lpDisplayName;
339 } QUERY_SERVICE_CONFIGA,*LPQUERY_SERVICE_CONFIGA;
340
341 typedef struct _QUERY_SERVICE_CONFIGW {
342 DWORD dwServiceType;
343 DWORD dwStartType;
344 DWORD dwErrorControl;
345 LPWSTR lpBinaryPathName;
346 LPWSTR lpLoadOrderGroup;
347 DWORD dwTagId;
348 LPWSTR lpDependencies;
349 LPWSTR lpServiceStartName;
350 LPWSTR lpDisplayName;
351 } QUERY_SERVICE_CONFIGW,*LPQUERY_SERVICE_CONFIGW;
352
353 __MINGW_TYPEDEF_AW(QUERY_SERVICE_CONFIG)
354 __MINGW_TYPEDEF_AW(LPQUERY_SERVICE_CONFIG)
355
356 typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONW)(DWORD dwNumServicesArgs,LPWSTR *lpServiceArgVectors);
357 typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONA)(DWORD dwNumServicesArgs,LPSTR *lpServiceArgVectors);
358
359#define LPSERVICE_MAIN_FUNCTION __MINGW_NAME_AW(LPSERVICE_MAIN_FUNCTION)
360
361 typedef struct _SERVICE_TABLE_ENTRYA {
362 LPSTR lpServiceName;
363 LPSERVICE_MAIN_FUNCTIONA lpServiceProc;
364 } SERVICE_TABLE_ENTRYA,*LPSERVICE_TABLE_ENTRYA;
365
366 typedef struct _SERVICE_TABLE_ENTRYW {
367 LPWSTR lpServiceName;
368 LPSERVICE_MAIN_FUNCTIONW lpServiceProc;
369 } SERVICE_TABLE_ENTRYW,*LPSERVICE_TABLE_ENTRYW;
370
371 __MINGW_TYPEDEF_AW(SERVICE_TABLE_ENTRY)
372 __MINGW_TYPEDEF_AW(LPSERVICE_TABLE_ENTRY)
373
374 typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD dwControl);
375 typedef DWORD (WINAPI *LPHANDLER_FUNCTION_EX)(DWORD dwControl,DWORD dwEventType,LPVOID lpEventData,LPVOID lpContext);
376
377#define ChangeServiceConfig __MINGW_NAME_AW(ChangeServiceConfig)
378#define ChangeServiceConfig2 __MINGW_NAME_AW(ChangeServiceConfig2)
379#define CreateService __MINGW_NAME_AW(CreateService)
380#define EnumDependentServices __MINGW_NAME_AW(EnumDependentServices)
381#define EnumServicesStatus __MINGW_NAME_AW(EnumServicesStatus)
382#define EnumServicesStatusEx __MINGW_NAME_AW(EnumServicesStatusEx)
383#define GetServiceKeyName __MINGW_NAME_AW(GetServiceKeyName)
384#define GetServiceDisplayName __MINGW_NAME_AW(GetServiceDisplayName)
385#define OpenSCManager __MINGW_NAME_AW(OpenSCManager)
386#define OpenService __MINGW_NAME_AW(OpenService)
387#define QueryServiceConfig __MINGW_NAME_AW(QueryServiceConfig)
388#define QueryServiceConfig2 __MINGW_NAME_AW(QueryServiceConfig2)
389#define QueryServiceLockStatus __MINGW_NAME_AW(QueryServiceLockStatus)
390#define RegisterServiceCtrlHandler __MINGW_NAME_AW(RegisterServiceCtrlHandler)
391#define RegisterServiceCtrlHandlerEx __MINGW_NAME_AW(RegisterServiceCtrlHandlerEx)
392#define StartServiceCtrlDispatcher __MINGW_NAME_AW(StartServiceCtrlDispatcher)
393#define StartService __MINGW_NAME_AW(StartService)
394
395 WINADVAPI WINBOOL WINAPI ChangeServiceConfigA(SC_HANDLE hService,DWORD dwServiceType,DWORD dwStartType,DWORD dwErrorControl,LPCSTR lpBinaryPathName,LPCSTR lpLoadOrderGroup,LPDWORD lpdwTagId,LPCSTR lpDependencies,LPCSTR lpServiceStartName,LPCSTR lpPassword,LPCSTR lpDisplayName);
396 WINADVAPI WINBOOL 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);
397 WINADVAPI WINBOOL WINAPI ChangeServiceConfig2A(SC_HANDLE hService,DWORD dwInfoLevel,LPVOID lpInfo);
398 WINADVAPI WINBOOL WINAPI ChangeServiceConfig2W(SC_HANDLE hService,DWORD dwInfoLevel,LPVOID lpInfo);
399 WINADVAPI WINBOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject);
400 WINADVAPI WINBOOL WINAPI ControlService(SC_HANDLE hService,DWORD dwControl,LPSERVICE_STATUS lpServiceStatus);
401 WINADVAPI SC_HANDLE WINAPI CreateServiceA(SC_HANDLE hSCManager,LPCSTR lpServiceName,LPCSTR lpDisplayName,DWORD dwDesiredAccess,DWORD dwServiceType,DWORD dwStartType,DWORD dwErrorControl,LPCSTR lpBinaryPathName,LPCSTR lpLoadOrderGroup,LPDWORD lpdwTagId,LPCSTR lpDependencies,LPCSTR lpServiceStartName,LPCSTR lpPassword);
402 WINADVAPI SC_HANDLE WINAPI CreateServiceW(SC_HANDLE hSCManager,LPCWSTR lpServiceName,LPCWSTR lpDisplayName,DWORD dwDesiredAccess,DWORD dwServiceType,DWORD dwStartType,DWORD dwErrorControl,LPCWSTR lpBinaryPathName,LPCWSTR lpLoadOrderGroup,LPDWORD lpdwTagId,LPCWSTR lpDependencies,LPCWSTR lpServiceStartName,LPCWSTR lpPassword);
403 WINADVAPI WINBOOL WINAPI DeleteService(SC_HANDLE hService);
404 WINADVAPI WINBOOL WINAPI EnumDependentServicesA(SC_HANDLE hService,DWORD dwServiceState,LPENUM_SERVICE_STATUSA lpServices,DWORD cbBufSize,LPDWORD pcbBytesNeeded,LPDWORD lpServicesReturned);
405 WINADVAPI WINBOOL WINAPI EnumDependentServicesW(SC_HANDLE hService,DWORD dwServiceState,LPENUM_SERVICE_STATUSW lpServices,DWORD cbBufSize,LPDWORD pcbBytesNeeded,LPDWORD lpServicesReturned);
406 WINADVAPI WINBOOL WINAPI EnumServicesStatusA(SC_HANDLE hSCManager,DWORD dwServiceType,DWORD dwServiceState,LPENUM_SERVICE_STATUSA lpServices,DWORD cbBufSize,LPDWORD pcbBytesNeeded,LPDWORD lpServicesReturned,LPDWORD lpResumeHandle);
407 WINADVAPI WINBOOL WINAPI EnumServicesStatusW(SC_HANDLE hSCManager,DWORD dwServiceType,DWORD dwServiceState,LPENUM_SERVICE_STATUSW lpServices,DWORD cbBufSize,LPDWORD pcbBytesNeeded,LPDWORD lpServicesReturned,LPDWORD lpResumeHandle);
408 WINADVAPI WINBOOL WINAPI EnumServicesStatusExA(SC_HANDLE hSCManager,SC_ENUM_TYPE InfoLevel,DWORD dwServiceType,DWORD dwServiceState,LPBYTE lpServices,DWORD cbBufSize,LPDWORD pcbBytesNeeded,LPDWORD lpServicesReturned,LPDWORD lpResumeHandle,LPCSTR pszGroupName);
409 WINADVAPI WINBOOL WINAPI EnumServicesStatusExW(SC_HANDLE hSCManager,SC_ENUM_TYPE InfoLevel,DWORD dwServiceType,DWORD dwServiceState,LPBYTE lpServices,DWORD cbBufSize,LPDWORD pcbBytesNeeded,LPDWORD lpServicesReturned,LPDWORD lpResumeHandle,LPCWSTR pszGroupName);
410 WINADVAPI WINBOOL WINAPI GetServiceKeyNameA(SC_HANDLE hSCManager,LPCSTR lpDisplayName,LPSTR lpServiceName,LPDWORD lpcchBuffer);
411 WINADVAPI WINBOOL WINAPI GetServiceKeyNameW(SC_HANDLE hSCManager,LPCWSTR lpDisplayName,LPWSTR lpServiceName,LPDWORD lpcchBuffer);
412 WINADVAPI WINBOOL WINAPI GetServiceDisplayNameA(SC_HANDLE hSCManager,LPCSTR lpServiceName,LPSTR lpDisplayName,LPDWORD lpcchBuffer);
413 WINADVAPI WINBOOL WINAPI GetServiceDisplayNameW(SC_HANDLE hSCManager,LPCWSTR lpServiceName,LPWSTR lpDisplayName,LPDWORD lpcchBuffer);
414 WINADVAPI SC_LOCK WINAPI LockServiceDatabase(SC_HANDLE hSCManager);
415 WINADVAPI WINBOOL WINAPI NotifyBootConfigStatus(WINBOOL BootAcceptable);
416 WINADVAPI SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName,LPCSTR lpDatabaseName,DWORD dwDesiredAccess);
417 WINADVAPI SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName,LPCWSTR lpDatabaseName,DWORD dwDesiredAccess);
418 WINADVAPI SC_HANDLE WINAPI OpenServiceA(SC_HANDLE hSCManager,LPCSTR lpServiceName,DWORD dwDesiredAccess);
419 WINADVAPI SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager,LPCWSTR lpServiceName,DWORD dwDesiredAccess);
420 WINADVAPI WINBOOL WINAPI QueryServiceConfigA(SC_HANDLE hService,LPQUERY_SERVICE_CONFIGA lpServiceConfig,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
421 WINADVAPI WINBOOL WINAPI QueryServiceConfigW(SC_HANDLE hService,LPQUERY_SERVICE_CONFIGW lpServiceConfig,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
422 WINADVAPI WINBOOL WINAPI QueryServiceConfig2A(SC_HANDLE hService,DWORD dwInfoLevel,LPBYTE lpBuffer,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
423 WINADVAPI WINBOOL WINAPI QueryServiceConfig2W(SC_HANDLE hService,DWORD dwInfoLevel,LPBYTE lpBuffer,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
424 WINADVAPI WINBOOL WINAPI QueryServiceLockStatusA(SC_HANDLE hSCManager,LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
425 WINADVAPI WINBOOL WINAPI QueryServiceLockStatusW(SC_HANDLE hSCManager,LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
426 WINADVAPI WINBOOL WINAPI QueryServiceObjectSecurity(SC_HANDLE hService,SECURITY_INFORMATION dwSecurityInformation,PSECURITY_DESCRIPTOR lpSecurityDescriptor,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
427 WINADVAPI WINBOOL WINAPI QueryServiceStatus(SC_HANDLE hService,LPSERVICE_STATUS lpServiceStatus);
428 WINADVAPI WINBOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService,SC_STATUS_TYPE InfoLevel,LPBYTE lpBuffer,DWORD cbBufSize,LPDWORD pcbBytesNeeded);
429 WINADVAPI SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR lpServiceName,LPHANDLER_FUNCTION lpHandlerProc);
430 WINADVAPI SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName,LPHANDLER_FUNCTION lpHandlerProc);
431 WINADVAPI SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExA(LPCSTR lpServiceName,LPHANDLER_FUNCTION_EX lpHandlerProc,LPVOID lpContext);
432 WINADVAPI SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName,LPHANDLER_FUNCTION_EX lpHandlerProc,LPVOID lpContext);
433 WINADVAPI WINBOOL WINAPI SetServiceObjectSecurity(SC_HANDLE hService,SECURITY_INFORMATION dwSecurityInformation,PSECURITY_DESCRIPTOR lpSecurityDescriptor);
434 WINADVAPI WINBOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,LPSERVICE_STATUS lpServiceStatus);
435 WINADVAPI WINBOOL WINAPI StartServiceCtrlDispatcherA(CONST SERVICE_TABLE_ENTRYA *lpServiceStartTable);
436 WINADVAPI WINBOOL WINAPI StartServiceCtrlDispatcherW(CONST SERVICE_TABLE_ENTRYW *lpServiceStartTable);
437 WINADVAPI WINBOOL WINAPI StartServiceA(SC_HANDLE hService,DWORD dwNumServiceArgs,LPCSTR *lpServiceArgVectors);
438 WINADVAPI WINBOOL WINAPI StartServiceW(SC_HANDLE hService,DWORD dwNumServiceArgs,LPCWSTR *lpServiceArgVectors);
439 WINADVAPI WINBOOL WINAPI UnlockServiceDatabase(SC_LOCK ScLock);
440
441#if (_WIN32_WINNT >= 0x0600)
442
443typedef VOID( CALLBACK * PFN_SC_NOTIFY_CALLBACK ) (
444 PVOID pParameter
445);
446
447typedef struct _SERVICE_CONTROL_STATUS_REASON_PARAMSA {
448 DWORD dwReason;
449 LPSTR pszComment;
450 SERVICE_STATUS_PROCESS ServiceStatus;
451} SERVICE_CONTROL_STATUS_REASON_PARAMSA, *PSERVICE_CONTROL_STATUS_REASON_PARAMSA;
452
453typedef struct _SERVICE_CONTROL_STATUS_REASON_PARAMSW {
454 DWORD dwReason;
455 LPWSTR pszComment;
456 SERVICE_STATUS_PROCESS ServiceStatus;
457} SERVICE_CONTROL_STATUS_REASON_PARAMSW, *PSERVICE_CONTROL_STATUS_REASON_PARAMSW;
458
459__MINGW_TYPEDEF_AW(SERVICE_CONTROL_STATUS_REASON_PARAMS)
460__MINGW_TYPEDEF_AW(PSERVICE_CONTROL_STATUS_REASON_PARAMS)
461
462#define SERVICE_STOP_REASON_FLAG_CUSTOM 0x20000000
463#define SERVICE_STOP_REASON_FLAG_PLANNED 0x40000000
464#define SERVICE_STOP_REASON_FLAG_UNPLANNED 0x10000000
465
466#define SERVICE_STOP_REASON_MAJOR_APPLICATION 0x00050000
467#define SERVICE_STOP_REASON_MAJOR_HARDWARE 0x00020000
468#define SERVICE_STOP_REASON_MAJOR_NONE 0x00060000
469#define SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM 0x00030000
470#define SERVICE_STOP_REASON_MAJOR_OTHER 0x00010000
471#define SERVICE_STOP_REASON_MAJOR_SOFTWARE 0x00040000
472
473#define SERVICE_STOP_REASON_MINOR_DISK 0x00000008
474#define SERVICE_STOP_REASON_MINOR_ENVIRONMENT 0x0000000a
475#define SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER 0x0000000b
476#define SERVICE_STOP_REASON_MINOR_HUNG 0x00000006
477#define SERVICE_STOP_REASON_MINOR_INSTALLATION 0x00000003
478#define SERVICE_STOP_REASON_MINOR_MAINTENANCE 0x00000002
479#define SERVICE_STOP_REASON_MINOR_MMC 0x00000016
480#define SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY 0x00000011
481#define SERVICE_STOP_REASON_MINOR_NETWORKCARD 0x00000009
482#define SERVICE_STOP_REASON_MINOR_OTHER 0x00000001
483#define SERVICE_STOP_REASON_MINOR_OTHERDRIVER 0x0000000c
484#define SERVICE_STOP_REASON_MINOR_RECONFIG 0x00000005
485#define SERVICE_STOP_REASON_MINOR_SECURITY 0x00000010
486#define SERVICE_STOP_REASON_MINOR_SECURITYFIX 0x0000000f
487#define SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL 0x00000015
488#define SERVICE_STOP_REASON_MINOR_SERVICEPACK 0x0000000d
489#define SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL 0x00000013
490#define SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE 0x0000000e
491#define SERVICE_STOP_REASON_MINOR_UNSTABLE 0x00000007
492#define SERVICE_STOP_REASON_MINOR_UPGRADE 0x00000004
493#define SERVICE_STOP_REASON_MINOR_WMI 0x00000012
494
495typedef struct _SERVICE_NOTIFYA {
496 DWORD dwVersion;
497 PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback;
498 PVOID pContext;
499 DWORD dwNotificationStatus;
500 SERVICE_STATUS_PROCESS ServiceStatus;
501 DWORD dwNotificationTriggered;
502 LPSTR pszServiceNames;
503} SERVICE_NOTIFYA, *PSERVICE_NOTIFYA;
504
505typedef struct _SERVICE_NOTIFYW {
506 DWORD dwVersion;
507 PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback;
508 PVOID pContext;
509 DWORD dwNotificationStatus;
510 SERVICE_STATUS_PROCESS ServiceStatus;
511 DWORD dwNotificationTriggered;
512 LPWSTR pszServiceNames;
513} SERVICE_NOTIFYW, *PSERVICE_NOTIFYW;
514
515__MINGW_TYPEDEF_AW(SERVICE_NOTIFY)
516__MINGW_TYPEDEF_AW(PSERVICE_NOTIFY)
517
518#define SERVICE_CONFIG_DELAYED_AUTO_START_INFO 3
519#define SERVICE_CONFIG_FAILURE_ACTIONS_FLAG 4
520#define SERVICE_CONFIG_SERVICE_SID_INFO 5
521#define SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO 6
522#define SERVICE_CONFIG_PRESHUTDOWN_INFO 7
523
524typedef struct _SERVICE_DELAYED_AUTO_START_INFO {
525 WINBOOL fDelayedAutostart;
526} SERVICE_DELAYED_AUTO_START_INFO, *LPSERVICE_DELAYED_AUTO_START_INFO;
527
528typedef struct _SERVICE_FAILURE_ACTIONS_FLAG {
529 WINBOOL fFailureActionsOnNonCrashFailures;
530} SERVICE_FAILURE_ACTIONS_FLAG, *LPSERVICE_FAILURE_ACTIONS_FLAG;
531
532typedef struct _SERVICE_PRESHUTDOWN_INFO {
533 DWORD dwPreshutdownTimeout;
534} SERVICE_PRESHUTDOWN_INFO, *LPSERVICE_PRESHUTDOWN_INFO;
535
536typedef struct _SERVICE_REQUIRED_PRIVILEGES_INFOA {
537 LPSTR pmszRequiredPrivileges;
538} SERVICE_REQUIRED_PRIVILEGES_INFOA, *LPSERVICE_REQUIRED_PRIVILEGES_INFOA;
539
540typedef struct _SERVICE_REQUIRED_PRIVILEGES_INFOW {
541 LPWSTR pmszRequiredPrivileges;
542} SERVICE_REQUIRED_PRIVILEGES_INFOW, *LPSERVICE_REQUIRED_PRIVILEGES_INFOW;
543
544__MINGW_TYPEDEF_AW(SERVICE_REQUIRED_PRIVILEGES_INFO)
545
546#define SERVICE_SID_TYPE_NONE 0x00000000
547#define SERVICE_SID_TYPE_RESTRICTED 0x00000003
548#define SERVICE_SID_TYPE_UNRESTRICTED 0x00000001
549
550typedef struct _SERVICE_SID_INFO {
551 DWORD dwServiceSidType;
552} SERVICE_SID_INFO, *LPSERVICE_SID_INFO;
553
554WINADVAPI WINBOOL WINAPI ControlServiceExA(
555 SC_HANDLE hService,
556 DWORD dwControl,
557 DWORD dwInfoLevel,
558 PVOID pControlParams
559);
560
561WINADVAPI WINBOOL WINAPI ControlServiceExW(
562 SC_HANDLE hService,
563 DWORD dwControl,
564 DWORD dwInfoLevel,
565 PVOID pControlParams
566);
567
568#define ControlServiceEx __MINGW_NAME_AW(ControlServiceEx)
569
570#define NotifyServiceStatusChange __MINGW_NAME_AW(NotifyServiceStatusChange)
571
572DWORD WINAPI NotifyServiceStatusChangeA(
573 SC_HANDLE hService,
574 DWORD dwNotifyMask,
575 PSERVICE_NOTIFYA pNotifyBuffer
576);
577
578DWORD WINAPI NotifyServiceStatusChangeW(
579 SC_HANDLE hService,
580 DWORD dwNotifyMask,
581 PSERVICE_NOTIFYW pNotifyBuffer
582);
583
584#endif /*(_WIN32_WINNT >= 0x0600)*/
585
586#ifdef __cplusplus
587}
588#endif
589
590#endif /* _WINSVC_ */
Note: See TracBrowser for help on using the repository browser.