6 #define SERVICES_ACTIVE_DATABASEA "ServicesActive"
7 #define SERVICES_ACTIVE_DATABASEW L"ServicesActive"
8 #define SERVICES_FAILED_DATABASEA "ServicesFailed"
9 #define SERVICES_FAILED_DATABASEW L"ServicesFailed"
10 #define SC_GROUP_IDENTIFIERA '+'
11 #define SC_GROUP_IDENTIFIERW L'+'
12 #define SC_MANAGER_ALL_ACCESS 0xf003f
13 #define SC_MANAGER_CONNECT 1
14 #define SC_MANAGER_CREATE_SERVICE 2
15 #define SC_MANAGER_ENUMERATE_SERVICE 4
16 #define SC_MANAGER_LOCK 8
17 #define SC_MANAGER_QUERY_LOCK_STATUS 16
18 #define SC_MANAGER_MODIFY_BOOT_CONFIG 32
19 #define SERVICE_NO_CHANGE (-1)
20 #define SERVICE_STOPPED 1
21 #define SERVICE_START_PENDING 2
22 #define SERVICE_STOP_PENDING 3
23 #define SERVICE_RUNNING 4
24 #define SERVICE_CONTINUE_PENDING 5
25 #define SERVICE_PAUSE_PENDING 6
26 #define SERVICE_PAUSED 7
27 #define SERVICE_ACCEPT_STOP 1
28 #define SERVICE_ACCEPT_PAUSE_CONTINUE 2
29 #define SERVICE_ACCEPT_SHUTDOWN 4
30 #define SERVICE_ACCEPT_PARAMCHANGE 8
31 #define SERVICE_ACCEPT_NETBINDCHANGE 16
32 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 32
33 #define SERVICE_ACCEPT_POWEREVENT 64
34 #define SERVICE_ACCEPT_SESSIONCHANGE 128
35 #define SERVICE_CONTROL_STOP 1
36 #define SERVICE_CONTROL_PAUSE 2
37 #define SERVICE_CONTROL_CONTINUE 3
38 #define SERVICE_CONTROL_INTERROGATE 4
39 #define SERVICE_CONTROL_SHUTDOWN 5
40 #define SERVICE_CONTROL_PARAMCHANGE 6
41 #define SERVICE_CONTROL_NETBINDADD 7
42 #define SERVICE_CONTROL_NETBINDREMOVE 8
43 #define SERVICE_CONTROL_NETBINDENABLE 9
44 #define SERVICE_CONTROL_NETBINDDISABLE 10
45 #define SERVICE_CONTROL_DEVICEEVENT 11
46 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 12
47 #define SERVICE_CONTROL_POWEREVENT 13
48 #define SERVICE_CONTROL_SESSIONCHANGE 14
49 #define SERVICE_ACTIVE 1
50 #define SERVICE_INACTIVE 2
51 #define SERVICE_STATE_ALL 3
52 #define SERVICE_QUERY_CONFIG 1
53 #define SERVICE_CHANGE_CONFIG 2
54 #define SERVICE_QUERY_STATUS 4
55 #define SERVICE_ENUMERATE_DEPENDENTS 8
56 #define SERVICE_START 16
57 #define SERVICE_STOP 32
58 #define SERVICE_PAUSE_CONTINUE 64
59 #define SERVICE_INTERROGATE 128
60 #define SERVICE_USER_DEFINED_CONTROL 256
61 #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)
62 #define SERVICE_RUNS_IN_SYSTEM_PROCESS 1
63 #define SERVICE_CONFIG_DESCRIPTION 1
64 #define SERVICE_CONFIG_FAILURE_ACTIONS 2
66 typedef struct _SERVICE_STATUS
{
69 DWORD dwControlsAccepted
;
70 DWORD dwWin32ExitCode
;
71 DWORD dwServiceSpecificExitCode
;
74 } SERVICE_STATUS
,*LPSERVICE_STATUS
;
75 typedef struct _SERVICE_STATUS_PROCESS
{
78 DWORD dwControlsAccepted
;
79 DWORD dwWin32ExitCode
;
80 DWORD dwServiceSpecificExitCode
;
85 } SERVICE_STATUS_PROCESS
, *LPSERVICE_STATUS_PROCESS
;
86 typedef enum _SC_STATUS_TYPE
{
87 SC_STATUS_PROCESS_INFO
= 0
89 typedef enum _SC_ENUM_TYPE
{
90 SC_ENUM_PROCESS_INFO
= 0
92 typedef struct _ENUM_SERVICE_STATUSA
{
95 SERVICE_STATUS ServiceStatus
;
96 } ENUM_SERVICE_STATUSA
,*LPENUM_SERVICE_STATUSA
;
97 typedef struct _ENUM_SERVICE_STATUSW
{
100 SERVICE_STATUS ServiceStatus
;
101 } ENUM_SERVICE_STATUSW
,*LPENUM_SERVICE_STATUSW
;
102 typedef struct _ENUM_SERVICE_STATUS_PROCESSA
{
105 SERVICE_STATUS_PROCESS ServiceStatusProcess
;
106 } ENUM_SERVICE_STATUS_PROCESSA
,*LPENUM_SERVICE_STATUS_PROCESSA
;
107 typedef struct _ENUM_SERVICE_STATUS_PROCESSW
{
108 LPWSTR lpServiceName
;
109 LPWSTR lpDisplayName
;
110 SERVICE_STATUS_PROCESS ServiceStatusProcess
;
111 } ENUM_SERVICE_STATUS_PROCESSW
,*LPENUM_SERVICE_STATUS_PROCESSW
;
112 typedef struct _QUERY_SERVICE_CONFIGA
{
115 DWORD dwErrorControl
;
116 LPSTR lpBinaryPathName
;
117 LPSTR lpLoadOrderGroup
;
119 LPSTR lpDependencies
;
120 LPSTR lpServiceStartName
;
122 } QUERY_SERVICE_CONFIGA
,*LPQUERY_SERVICE_CONFIGA
;
123 typedef struct _QUERY_SERVICE_CONFIGW
{
126 DWORD dwErrorControl
;
127 LPWSTR lpBinaryPathName
;
128 LPWSTR lpLoadOrderGroup
;
130 LPWSTR lpDependencies
;
131 LPWSTR lpServiceStartName
;
132 LPWSTR lpDisplayName
;
133 } QUERY_SERVICE_CONFIGW
,*LPQUERY_SERVICE_CONFIGW
;
134 typedef struct _QUERY_SERVICE_LOCK_STATUSA
{
137 DWORD dwLockDuration
;
138 } QUERY_SERVICE_LOCK_STATUSA
,*LPQUERY_SERVICE_LOCK_STATUSA
;
139 typedef struct _QUERY_SERVICE_LOCK_STATUSW
{
142 DWORD dwLockDuration
;
143 } QUERY_SERVICE_LOCK_STATUSW
,*LPQUERY_SERVICE_LOCK_STATUSW
;
144 typedef void (WINAPI
*LPSERVICE_MAIN_FUNCTIONA
)(DWORD
,LPSTR
*);
145 typedef void (WINAPI
*LPSERVICE_MAIN_FUNCTIONW
)(DWORD
,LPWSTR
*);
146 typedef struct _SERVICE_TABLE_ENTRYA
{
148 LPSERVICE_MAIN_FUNCTIONA lpServiceProc
;
149 } SERVICE_TABLE_ENTRYA
,*LPSERVICE_TABLE_ENTRYA
;
150 typedef struct _SERVICE_TABLE_ENTRYW
{
151 LPWSTR lpServiceName
;
152 LPSERVICE_MAIN_FUNCTIONW lpServiceProc
;
153 } SERVICE_TABLE_ENTRYW
,*LPSERVICE_TABLE_ENTRYW
;
154 DECLARE_HANDLE(SC_HANDLE
);
155 typedef SC_HANDLE
*LPSC_HANDLE
;
156 typedef PVOID SC_LOCK
;
157 typedef DWORD SERVICE_STATUS_HANDLE
;
158 typedef VOID(WINAPI
*LPHANDLER_FUNCTION
)(DWORD
);
159 typedef DWORD (WINAPI
*LPHANDLER_FUNCTION_EX
)(DWORD
,DWORD
,LPVOID
,LPVOID
);
160 typedef struct _SERVICE_DESCRIPTIONA
{
162 } SERVICE_DESCRIPTIONA
,*LPSERVICE_DESCRIPTIONA
;
163 typedef struct _SERVICE_DESCRIPTIONW
{
164 LPWSTR lpDescription
;
165 } SERVICE_DESCRIPTIONW
,*LPSERVICE_DESCRIPTIONW
;
166 typedef enum _SC_ACTION_TYPE
{
168 SC_ACTION_RESTART
= 1,
169 SC_ACTION_REBOOT
= 2,
170 SC_ACTION_RUN_COMMAND
= 3
172 typedef struct _SC_ACTION
{
175 } SC_ACTION
,*LPSC_ACTION
;
176 typedef struct _SERVICE_FAILURE_ACTIONSA
{
181 SC_ACTION
* lpsaActions
;
182 } SERVICE_FAILURE_ACTIONSA
,*LPSERVICE_FAILURE_ACTIONSA
;
183 typedef struct _SERVICE_FAILURE_ACTIONSW
{
188 SC_ACTION
* lpsaActions
;
189 } SERVICE_FAILURE_ACTIONSW
,*LPSERVICE_FAILURE_ACTIONSW
;
191 BOOL WINAPI
ChangeServiceConfigA(SC_HANDLE
,DWORD
,DWORD
,DWORD
,LPCSTR
,LPCSTR
,LPDWORD
,LPCSTR
,LPCSTR
,LPCSTR
,LPCSTR
);
192 BOOL WINAPI
ChangeServiceConfigW(SC_HANDLE
,DWORD
,DWORD
,DWORD
,LPCWSTR
,LPCWSTR
,LPDWORD
,LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
193 BOOL WINAPI
ChangeServiceConfig2A(SC_HANDLE
,DWORD
,LPVOID
);
194 BOOL WINAPI
ChangeServiceConfig2W(SC_HANDLE
,DWORD
,LPVOID
);
195 BOOL WINAPI
CloseServiceHandle(SC_HANDLE
);
196 BOOL WINAPI
ControlService(SC_HANDLE
,DWORD
,LPSERVICE_STATUS
);
197 SC_HANDLE WINAPI
CreateServiceA(SC_HANDLE
,LPCSTR
,LPCSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCSTR
,LPCSTR
,PDWORD
,LPCSTR
,LPCSTR
,LPCSTR
);
198 SC_HANDLE WINAPI
CreateServiceW(SC_HANDLE
,LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCWSTR
,LPCWSTR
,PDWORD
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
199 BOOL WINAPI
DeleteService(SC_HANDLE
);
200 BOOL WINAPI
EnumDependentServicesA(SC_HANDLE
,DWORD
,LPENUM_SERVICE_STATUSA
,DWORD
,PDWORD
,PDWORD
);
201 BOOL WINAPI
EnumDependentServicesW(SC_HANDLE
,DWORD
,LPENUM_SERVICE_STATUSW
,DWORD
,PDWORD
,PDWORD
);
202 BOOL WINAPI
EnumServicesStatusA(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSA
,DWORD
,PDWORD
,PDWORD
,PDWORD
);
203 BOOL WINAPI
EnumServicesStatusW(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSW
,DWORD
,PDWORD
,PDWORD
,PDWORD
);
204 BOOL WINAPI
EnumServicesStatusExA(SC_HANDLE
,SC_ENUM_TYPE
,DWORD
,DWORD
,LPBYTE
,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
,LPCSTR
);
205 BOOL WINAPI
EnumServicesStatusExW(SC_HANDLE
,SC_ENUM_TYPE
,DWORD
,DWORD
,LPBYTE
,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
,LPCWSTR
);
206 BOOL WINAPI
GetServiceDisplayNameA(SC_HANDLE
,LPCSTR
,LPSTR
,PDWORD
);
207 BOOL WINAPI
GetServiceDisplayNameW(SC_HANDLE
,LPCWSTR
,LPWSTR
,PDWORD
);
208 BOOL WINAPI
GetServiceKeyNameA(SC_HANDLE
,LPCSTR
,LPSTR
,PDWORD
);
209 BOOL WINAPI
GetServiceKeyNameW(SC_HANDLE
,LPCWSTR
,LPWSTR
,PDWORD
);
210 SC_LOCK WINAPI
LockServiceDatabase(SC_HANDLE
);
211 BOOL WINAPI
NotifyBootConfigStatus(BOOL
);
212 SC_HANDLE WINAPI
OpenSCManagerA(LPCSTR
,LPCSTR
,DWORD
);
213 SC_HANDLE WINAPI
OpenSCManagerW(LPCWSTR
,LPCWSTR
,DWORD
);
214 SC_HANDLE WINAPI
OpenServiceA(SC_HANDLE
,LPCSTR
,DWORD
);
215 SC_HANDLE WINAPI
OpenServiceW(SC_HANDLE
,LPCWSTR
,DWORD
);
216 BOOL WINAPI
QueryServiceConfigA(SC_HANDLE
,LPQUERY_SERVICE_CONFIGA
,DWORD
,PDWORD
);
217 BOOL WINAPI
QueryServiceConfigW(SC_HANDLE
,LPQUERY_SERVICE_CONFIGW
,DWORD
,PDWORD
);
218 BOOL WINAPI
QueryServiceConfig2A(SC_HANDLE
,DWORD
,LPBYTE
,DWORD
,LPDWORD
);
219 BOOL WINAPI
QueryServiceConfig2W(SC_HANDLE
,DWORD
,LPBYTE
,DWORD
,LPDWORD
);
220 BOOL WINAPI
QueryServiceLockStatusA(SC_HANDLE
,LPQUERY_SERVICE_LOCK_STATUSA
,DWORD
,PDWORD
);
221 BOOL WINAPI
QueryServiceLockStatusW(SC_HANDLE
,LPQUERY_SERVICE_LOCK_STATUSW
,DWORD
,PDWORD
);
222 BOOL WINAPI
QueryServiceObjectSecurity(SC_HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
,DWORD
,LPDWORD
);
223 BOOL WINAPI
QueryServiceStatus(SC_HANDLE
,LPSERVICE_STATUS
);
224 BOOL WINAPI
QueryServiceStatusEx(SC_HANDLE
,SC_STATUS_TYPE
,LPBYTE
,DWORD
,LPDWORD
);
225 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA(LPCSTR
,LPHANDLER_FUNCTION
);
226 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerW(LPCWSTR
,LPHANDLER_FUNCTION
);
227 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerExA(LPCSTR
,LPHANDLER_FUNCTION_EX
,LPVOID
);
228 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerExW(LPCWSTR
,LPHANDLER_FUNCTION_EX
,LPVOID
);
229 BOOL WINAPI
SetServiceObjectSecurity(SC_HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
);
230 BOOL WINAPI
SetServiceStatus(SERVICE_STATUS_HANDLE
,LPSERVICE_STATUS
);
231 BOOL WINAPI
StartServiceA(SC_HANDLE
,DWORD
,LPCSTR
*);
232 BOOL WINAPI
StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA
);
233 BOOL WINAPI
StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW
);
234 BOOL WINAPI
StartServiceW(SC_HANDLE
,DWORD
,LPCWSTR
);
235 BOOL WINAPI
UnlockServiceDatabase(SC_LOCK
);
238 typedef ENUM_SERVICE_STATUSW ENUM_SERVICE_STATUS
,*LPENUM_SERVICE_STATUS
;
239 typedef ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESS
;
240 typedef LPENUM_SERVICE_STATUS_PROCESSW LPENUM_SERVICE_STATUS_PROCESS
;
241 typedef QUERY_SERVICE_CONFIGW QUERY_SERVICE_CONFIG
,*LPQUERY_SERVICE_CONFIG
;
242 typedef QUERY_SERVICE_LOCK_STATUSW QUERY_SERVICE_LOCK_STATUS
,*LPQUERY_SERVICE_LOCK_STATUS
;
243 typedef SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY
,*LPSERVICE_TABLE_ENTRY
;
244 typedef LPSERVICE_MAIN_FUNCTIONW LPSERVICE_MAIN_FUNCTION
;
245 typedef SERVICE_DESCRIPTIONW SERVICE_DESCRIPTION
;
246 typedef LPSERVICE_DESCRIPTIONW LPSERVICE_DESCRIPTION
;
247 typedef SERVICE_FAILURE_ACTIONSW SERVICE_FAILURE_ACTIONS
;
248 typedef LPSERVICE_FAILURE_ACTIONSW LPSERVICE_FAILURE_ACTIONS
;
249 #define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEW
250 #define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEW
251 #define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERW
252 #define ChangeServiceConfig ChangeServiceConfigW
253 #define ChangeServiceConfig2 ChangeServiceConfig2W
254 #define CreateService CreateServiceW
255 #define EnumDependentServices EnumDependentServicesW
256 #define EnumServicesStatus EnumServicesStatusW
257 #define EnumServicesStatusEx EnumServicesStatusExW
258 #define GetServiceDisplayName GetServiceDisplayNameW
259 #define GetServiceKeyName GetServiceKeyNameW
260 #define OpenSCManager OpenSCManagerW
261 #define OpenService OpenServiceW
262 #define QueryServiceConfig QueryServiceConfigW
263 #define QueryServiceConfig2 QueryServiceConfig2W
264 #define QueryServiceLockStatus QueryServiceLockStatusW
265 #define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerW
266 #define RegisterServiceCtrlHandlerEx RegisterServiceCtrlHandlerExW
267 #define StartService StartServiceW
268 #define StartServiceCtrlDispatcher StartServiceCtrlDispatcherW
270 typedef ENUM_SERVICE_STATUSA ENUM_SERVICE_STATUS
,*LPENUM_SERVICE_STATUS
;
271 typedef ENUM_SERVICE_STATUS_PROCESSA ENUM_SERVICE_STATUS_PROCESS
;
272 typedef LPENUM_SERVICE_STATUS_PROCESSA LPENUM_SERVICE_STATUS_PROCESS
;
273 typedef QUERY_SERVICE_CONFIGA QUERY_SERVICE_CONFIG
,*LPQUERY_SERVICE_CONFIG
;
274 typedef QUERY_SERVICE_LOCK_STATUSA QUERY_SERVICE_LOCK_STATUS
,*LPQUERY_SERVICE_LOCK_STATUS
;
275 typedef SERVICE_TABLE_ENTRYA SERVICE_TABLE_ENTRY
,*LPSERVICE_TABLE_ENTRY
;
276 typedef LPSERVICE_MAIN_FUNCTIONA LPSERVICE_MAIN_FUNCTION
;
277 typedef SERVICE_DESCRIPTIONA SERVICE_DESCRIPTION
;
278 typedef LPSERVICE_DESCRIPTIONA LPSERVICE_DESCRIPTION
;
279 typedef SERVICE_FAILURE_ACTIONSA SERVICE_FAILURE_ACTIONS
;
280 typedef LPSERVICE_FAILURE_ACTIONSA LPSERVICE_FAILURE_ACTIONS
;
281 #define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEA
282 #define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEA
283 #define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERA
284 #define ChangeServiceConfig ChangeServiceConfigA
285 #define ChangeServiceConfig2 ChangeServiceConfig2A
286 #define CreateService CreateServiceA
287 #define EnumDependentServices EnumDependentServicesA
288 #define EnumServicesStatus EnumServicesStatusA
289 #define EnumServicesStatusEx EnumServicesStatusExA
290 #define GetServiceDisplayName GetServiceDisplayNameA
291 #define GetServiceKeyName GetServiceKeyNameA
292 #define OpenSCManager OpenSCManagerA
293 #define OpenService OpenServiceA
294 #define QueryServiceConfig QueryServiceConfigA
295 #define QueryServiceConfig2 QueryServiceConfig2A
296 #define QueryServiceLockStatus QueryServiceLockStatusA
297 #define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerA
298 #define RegisterServiceCtrlHandlerEx RegisterServiceCtrlHandlerExA
299 #define StartService StartServiceA
300 #define StartServiceCtrlDispatcher StartServiceCtrlDispatcherA
305 #endif /* _WINSVC_H */