Fixed winebuild operation in Darwin.
[wine/multimedia.git] / include / winsvc.h
blob4540e03daec4c6fe9f020f5304b21ca2d4347dee
1 /*
2 * Copyright (C) the Wine project
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __WINE_WINSVC_H
20 #define __WINE_WINSVC_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* defined(__cplusplus) */
26 /* Service database names */
27 #define SERVICES_ACTIVE_DATABASEA "ServicesActive"
28 #define SERVICES_FAILED_DATABASEA "ServicesFailed"
30 #if defined(__GNUC__)
31 # define SERVICES_ACTIVE_DATABASEW (const WCHAR []){ 'S','e','r','v','i','c','e','s','A','c','t','i','v','e',0 }
32 # define SERVICES_FAILED_DATABASEW (const WCHAR []){ 'S','e','r','v','i','c','e','s','F','a','i','l','e','d',0 }
33 #elif defined(_MSC_VER)
34 # define SERVICES_ACTIVE_DATABASEW L"ServicesActive"
35 # define SERVICES_FAILED_DATABASEW L"ServicesFailed"
36 #endif
38 #define SERVICES_ACTIVE_DATABASE WINELIB_NAME_AW( SERVICES_ACTIVE_DATABASE )
39 #define SERVICES_FAILED_DATABASE WINELIB_NAME_AW( SERVICES_FAILED_DATABASE )
41 /* Controls */
42 #define SERVICE_CONTROL_STOP 0x00000001
43 #define SERVICE_CONTROL_PAUSE 0x00000002
44 #define SERVICE_CONTROL_CONTINUE 0x00000003
45 #define SERVICE_CONTROL_INTERROGATE 0x00000004
46 #define SERVICE_CONTROL_SHUTDOWN 0x00000005
47 #define SERVICE_CONTROL_PARAMCHANGE 0x00000006
48 #define SERVICE_CONTROL_NETBINDADD 0x00000007
49 #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
50 #define SERVICE_CONTROL_NETBINDENABLE 0x00000009
51 #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
52 #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
53 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
54 #define SERVICE_CONTROL_POWEREVENT 0x0000000D
55 #define SERVICE_CONTROL_SESSIONCHANGE 0x0000000E
57 /* Service State */
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
66 /* Controls Accepted */
67 #define SERVICE_ACCEPT_STOP 0x00000001
68 #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
69 #define SERVICE_ACCEPT_SHUTDOWN 0x00000004
70 #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
71 #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
72 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
73 #define SERVICE_ACCEPT_POWEREVENT 0x00000040
74 #define SERVICE_ACCEPT_SESSIONCHANGE 0x00000080
76 /* Service Control Manager Object access types */
77 #define SC_MANAGER_CONNECT 0x0001
78 #define SC_MANAGER_CREATE_SERVICE 0x0002
79 #define SC_MANAGER_ENUMERATE_SERVICE 0x0004
80 #define SC_MANAGER_LOCK 0x0008
81 #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
82 #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
83 #define SC_MANAGER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
84 SC_MANAGER_CONNECT | \
85 SC_MANAGER_CREATE_SERVICE | \
86 SC_MANAGER_ENUMERATE_SERVICE | \
87 SC_MANAGER_LOCK | \
88 SC_MANAGER_QUERY_LOCK_STATUS | \
89 SC_MANAGER_MODIFY_BOOT_CONFIG )
91 #define SERVICE_QUERY_CONFIG 0x0001
92 #define SERVICE_CHANGE_CONFIG 0x0002
93 #define SERVICE_QUERY_STATUS 0x0004
94 #define SERVICE_ENUMERATE_DEPENDENTS 0x0008
95 #define SERVICE_START 0x0010
96 #define SERVICE_STOP 0x0020
97 #define SERVICE_PAUSE_CONTINUE 0x0040
98 #define SERVICE_INTERROGATE 0x0080
99 #define SERVICE_USER_DEFINED_CONTROL 0x0100
101 #define SERVICE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
102 SERVICE_QUERY_CONFIG | \
103 SERVICE_CHANGE_CONFIG | \
104 SERVICE_QUERY_STATUS | \
105 SERVICE_ENUMERATE_DEPENDENTS | \
106 SERVICE_START | \
107 SERVICE_STOP | \
108 SERVICE_PAUSE_CONTINUE | \
109 SERVICE_INTERROGATE | \
110 SERVICE_USER_DEFINED_CONTROL )
112 #define SERVICE_NO_CHANGE 0xffffffff
115 /* Handle types */
117 typedef HANDLE SC_HANDLE, *LPSC_HANDLE;
118 typedef DWORD SERVICE_STATUS_HANDLE;
119 typedef LPVOID SC_LOCK;
121 /* Service status structure */
123 typedef struct _SERVICE_STATUS {
124 DWORD dwServiceType;
125 DWORD dwCurrentState;
126 DWORD dwControlsAccepted;
127 DWORD dwWin32ExitCode;
128 DWORD dwServiceSpecificExitCode;
129 DWORD dwCheckPoint;
130 DWORD dwWaitHint;
131 } SERVICE_STATUS, *LPSERVICE_STATUS;
133 typedef enum _SC_STATUS_TYPE {
134 SC_STATUS_PROCESS_INFO = 0
135 } SC_STATUS_TYPE;
137 /* Service main function prototype */
139 typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONA)(DWORD,LPSTR*);
140 typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONW)(DWORD,LPWSTR*);
141 DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION)
143 /* Service start table */
145 typedef struct _SERVICE_TABLE_ENTRYA {
146 LPSTR lpServiceName;
147 LPSERVICE_MAIN_FUNCTIONA lpServiceProc;
148 } 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;
155 DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY)
156 DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY)
158 /* Service status enumeration structure */
160 typedef struct _ENUM_SERVICE_STATUSA {
161 LPSTR lpServiceName;
162 LPSTR lpDisplayName;
163 SERVICE_STATUS ServiceStatus;
164 } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA;
166 typedef struct _ENUM_SERVICE_STATUSW {
167 LPWSTR lpServiceName;
168 LPWSTR lpDisplayName;
169 SERVICE_STATUS ServiceStatus;
170 } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW;
172 DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS)
173 DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS)
175 typedef struct _QUERY_SERVICE_CONFIGA {
176 DWORD dwServiceType;
177 DWORD dwStartType;
178 DWORD dwErrorControl;
179 LPSTR lpBinaryPathName;
180 LPSTR lpLoadOrderGroup;
181 DWORD dwTagId;
182 LPSTR lpDependencies;
183 LPSTR lpServiceStartName;
184 LPSTR lpDisplayName;
185 } QUERY_SERVICE_CONFIGA, *LPQUERY_SERVICE_CONFIGA;
187 typedef struct _QUERY_SERVICE_CONFIGW {
188 DWORD dwServiceType;
189 DWORD dwStartType;
190 DWORD dwErrorControl;
191 LPWSTR lpBinaryPathName;
192 LPWSTR lpLoadOrderGroup;
193 DWORD dwTagId;
194 LPWSTR lpDependencies;
195 LPWSTR lpServiceStartName;
196 LPWSTR lpDisplayName;
197 } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW;
199 /* defines and structures for ChangeServiceConfig2 */
200 #define SERVICE_CONFIG_DESCRIPTION 1
201 #define SERVICE_CONFIG_FAILURE_ACTIONS 2
203 typedef struct _SERVICE_DESCRIPTIONA {
204 LPSTR lpDescription;
205 } SERVICE_DESCRIPTIONA,*LPSERVICE_DESCRIPTIONA;
207 typedef struct _SERVICE_DESCRIPTIONW {
208 LPWSTR lpDescription;
209 } SERVICE_DESCRIPTIONW,*LPSERVICE_DESCRIPTIONW;
211 DECL_WINELIB_TYPE_AW(SERVICE_DESCRIPTION)
212 DECL_WINELIB_TYPE_AW(LPSERVICE_DESCRIPTION)
214 typedef enum _SC_ACTION_TYPE {
215 SC_ACTION_NONE = 0,
216 SC_ACTION_RESTART = 1,
217 SC_ACTION_REBOOT = 2,
218 SC_ACTION_RUN_COMMAND = 3
219 } SC_ACTION_TYPE;
221 typedef struct _SC_ACTION {
222 SC_ACTION_TYPE Type;
223 DWORD Delay;
224 } SC_ACTION,*LPSC_ACTION;
226 typedef struct _SERVICE_FAILURE_ACTIONSA {
227 DWORD dwResetPeriod;
228 LPSTR lpRebootMsg;
229 LPSTR lpCommand;
230 DWORD cActions;
231 SC_ACTION * lpsaActions;
232 } SERVICE_FAILURE_ACTIONSA,*LPSERVICE_FAILURE_ACTIONSA;
234 typedef struct _SERVICE_FAILURE_ACTIONSW {
235 DWORD dwResetPeriod;
236 LPWSTR lpRebootMsg;
237 LPWSTR lpCommand;
238 DWORD cActions;
239 SC_ACTION * lpsaActions;
240 } SERVICE_FAILURE_ACTIONSW,*LPSERVICE_FAILURE_ACTIONSW;
242 DECL_WINELIB_TYPE_AW(SERVICE_FAILURE_ACTIONS)
243 DECL_WINELIB_TYPE_AW(LPSERVICE_FAILURE_ACTIONS)
245 typedef struct _QUERY_SERVICE_LOCK_STATUSA
247 DWORD fIsLocked;
248 LPSTR lpLockOwner;
249 DWORD dwLockDuration;
250 } QUERY_SERVICE_LOCK_STATUSA, *LPQUERY_SERVICE_LOCK_STATUSA;
252 typedef struct _QUERY_SERVICE_LOCK_STATUSW
254 DWORD fIsLocked;
255 LPWSTR lpLockOwner;
256 DWORD dwLockDuration;
257 } QUERY_SERVICE_LOCK_STATUSW, *LPQUERY_SERVICE_LOCK_STATUSW;
259 DECL_WINELIB_TYPE_AW(QUERY_SERVICE_LOCK_STATUS)
261 /* Service control handler function prototype */
263 typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD);
264 typedef DWORD (WINAPI *LPHANDLER_FUNCTION_EX)(DWORD,DWORD,LPVOID,LPVOID);
266 /* API function prototypes */
268 BOOL WINAPI ChangeServiceConfigA(SC_HANDLE,DWORD,DWORD,DWORD,LPCSTR,LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR);
269 BOOL WINAPI ChangeServiceConfigW(SC_HANDLE,DWORD,DWORD,DWORD,LPCWSTR,LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
270 #define ChangeServiceConfig WINELIB_NAME_AW(ChangeServiceConfig)
271 BOOL WINAPI ChangeServiceConfig2A(SC_HANDLE,DWORD,LPVOID);
272 BOOL WINAPI ChangeServiceConfig2W(SC_HANDLE,DWORD,LPVOID);
273 #define ChangeServiceConfig2 WINELIB_NAME_AW(ChangeServiceConfig2)
274 BOOL WINAPI CloseServiceHandle(SC_HANDLE);
275 BOOL WINAPI ControlService(SC_HANDLE,DWORD,LPSERVICE_STATUS);
276 SC_HANDLE WINAPI CreateServiceA(SC_HANDLE,LPCSTR,LPCSTR,DWORD,DWORD,DWORD,DWORD,LPCSTR,
277 LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR);
278 SC_HANDLE WINAPI CreateServiceW(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,
279 LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR);
280 #define CreateService WINELIB_NAME_AW(CreateService)
281 BOOL WINAPI DeleteService(SC_HANDLE);
282 BOOL WINAPI EnumDependentServicesA(SC_HANDLE,DWORD,LPENUM_SERVICE_STATUSA,DWORD,LPDWORD,LPDWORD);
283 BOOL WINAPI EnumDependentServicesW(SC_HANDLE,DWORD,LPENUM_SERVICE_STATUSW,DWORD,LPDWORD,LPDWORD);
284 #define EnumDependentServices WINELIB_NAME_AW(EnumDependentServices)
285 BOOL WINAPI EnumServicesStatusA(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSA,
286 DWORD,LPDWORD,LPDWORD,LPDWORD);
287 BOOL WINAPI EnumServicesStatusW(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSW,
288 DWORD,LPDWORD,LPDWORD,LPDWORD);
289 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
290 BOOL WINAPI GetServiceDisplayNameA(SC_HANDLE,LPCSTR,LPSTR,LPDWORD);
291 BOOL WINAPI GetServiceDisplayNameW(SC_HANDLE,LPCWSTR,LPWSTR,LPDWORD);
292 #define GetServiceDisplayName WINELIB_NAME_AW(GetServiceDisplayName)
293 BOOL WINAPI GetServiceKeyNameA(SC_HANDLE,LPCSTR,LPSTR,LPDWORD);
294 BOOL WINAPI GetServiceKeyNameW(SC_HANDLE,LPCWSTR,LPWSTR,LPDWORD);
295 #define GetServiceKeyName WINELIB_NAME_AW(GetServiceKeyName)
296 SC_LOCK WINAPI LockServiceDatabase(SC_HANDLE);
297 SC_HANDLE WINAPI OpenSCManagerA(LPCSTR,LPCSTR,DWORD);
298 SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR,LPCWSTR,DWORD);
299 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
300 SC_HANDLE WINAPI OpenServiceA(SC_HANDLE,LPCSTR,DWORD);
301 SC_HANDLE WINAPI OpenServiceW(SC_HANDLE,LPCWSTR,DWORD);
302 #define OpenService WINELIB_NAME_AW(OpenService)
303 BOOL WINAPI QueryServiceStatus(SC_HANDLE,LPSERVICE_STATUS);
304 BOOL WINAPI QueryServiceStatusEx(SC_HANDLE,SC_STATUS_TYPE,LPBYTE,DWORD,LPDWORD);
305 BOOL WINAPI QueryServiceConfigA(SC_HANDLE,LPQUERY_SERVICE_CONFIGA,DWORD,LPDWORD);
306 BOOL WINAPI QueryServiceConfigW(SC_HANDLE,LPQUERY_SERVICE_CONFIGW,DWORD,LPDWORD);
307 #define QueryServiceConfig WINELIB_NAME_AW(QueryServiceConfig)
308 BOOL WINAPI QueryServiceLockStatusA(SC_HANDLE,LPQUERY_SERVICE_LOCK_STATUSA,DWORD,LPDWORD);
309 BOOL WINAPI QueryServiceLockStatusW(SC_HANDLE,LPQUERY_SERVICE_LOCK_STATUSW,DWORD,LPDWORD);
310 #define QueryServiceLockStatus WINELIB_NAME_AW(QueryServiceLockStatus)
311 BOOL WINAPI QueryServiceObjectSecurity(SC_HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
312 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR,LPHANDLER_FUNCTION);
313 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR,LPHANDLER_FUNCTION);
314 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
315 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExA(LPCSTR,LPHANDLER_FUNCTION_EX,LPVOID);
316 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR,LPHANDLER_FUNCTION_EX,LPVOID);
317 #define RegisterServiceCtrlHandlerEx WINELIB_NAME_AW(RegisterServiceCtrlHandlerEx)
318 BOOL WINAPI SetServiceObjectSecurity(SC_HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
319 BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS);
320 BOOL WINAPI StartServiceA(SC_HANDLE,DWORD,LPCSTR*);
321 BOOL WINAPI StartServiceW(SC_HANDLE,DWORD,LPCWSTR*);
322 #define StartService WINELIB_NAME_AW(StartService)
323 BOOL WINAPI StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA);
324 BOOL WINAPI StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW);
325 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
326 BOOL WINAPI UnlockServiceDatabase(SC_LOCK);
328 #ifdef __cplusplus
329 } /* extern "C" */
330 #endif /* defined(__cplusplus) */
332 #endif /* !defined(__WINE_WINSVC_H) */