Specify the PATH variable in uppercase to avoid getting two flavors of
[wine/multimedia.git] / include / winsvc.h
blob572a9582c0b0e803955a5ab3768e13c3d0478cac
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 /* Controls */
27 #define SERVICE_CONTROL_STOP 0x00000001
28 #define SERVICE_CONTROL_PAUSE 0x00000002
29 #define SERVICE_CONTROL_CONTINUE 0x00000003
30 #define SERVICE_CONTROL_INTERROGATE 0x00000004
31 #define SERVICE_CONTROL_SHUTDOWN 0x00000005
32 #define SERVICE_CONTROL_PARAMCHANGE 0x00000006
33 #define SERVICE_CONTROL_NETBINDADD 0x00000007
34 #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
35 #define SERVICE_CONTROL_NETBINDENABLE 0x00000009
36 #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
37 #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
38 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
39 #define SERVICE_CONTROL_POWEREVENT 0x0000000D
41 /* Service State */
42 #define SERVICE_STOPPED 0x00000001
43 #define SERVICE_START_PENDING 0x00000002
44 #define SERVICE_STOP_PENDING 0x00000003
45 #define SERVICE_RUNNING 0x00000004
46 #define SERVICE_CONTINUE_PENDING 0x00000005
47 #define SERVICE_PAUSE_PENDING 0x00000006
48 #define SERVICE_PAUSED 0x00000007
50 /* Controls Accepted */
51 #define SERVICE_ACCEPT_STOP 0x00000001
52 #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
53 #define SERVICE_ACCEPT_SHUTDOWN 0x00000004
54 #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
55 #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
56 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
57 #define SERVICE_ACCEPT_POWEREVENT 0x00000040
59 /* Service Control Manager Object access types */
60 #define SC_MANAGER_CONNECT 0x0001
61 #define SC_MANAGER_CREATE_SERVICE 0x0002
62 #define SC_MANAGER_ENUMERATE_SERVICE 0x0004
63 #define SC_MANAGER_LOCK 0x0008
64 #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
65 #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
66 #define SC_MANAGER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
67 SC_MANAGER_CONNECT | \
68 SC_MANAGER_CREATE_SERVICE | \
69 SC_MANAGER_ENUMERATE_SERVICE | \
70 SC_MANAGER_LOCK | \
71 SC_MANAGER_QUERY_LOCK_STATUS | \
72 SC_MANAGER_MODIFY_BOOT_CONFIG )
74 #define SERVICE_QUERY_CONFIG 0x0001
75 #define SERVICE_CHANGE_CONFIG 0x0002
76 #define SERVICE_QUERY_STATUS 0x0004
77 #define SERVICE_ENUMERATE_DEPENDENTS 0x0008
78 #define SERVICE_START 0x0010
79 #define SERVICE_STOP 0x0020
80 #define SERVICE_PAUSE_CONTINUE 0x0040
81 #define SERVICE_INTERROGATE 0x0080
82 #define SERVICE_USER_DEFINED_CONTROL 0x0100
84 #define SERVICE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
85 SERVICE_QUERY_CONFIG | \
86 SERVICE_CHANGE_CONFIG | \
87 SERVICE_QUERY_STATUS | \
88 SERVICE_ENUMERATE_DEPENDENTS | \
89 SERVICE_START | \
90 SERVICE_STOP | \
91 SERVICE_PAUSE_CONTINUE | \
92 SERVICE_INTERROGATE | \
93 SERVICE_USER_DEFINED_CONTROL )
97 /* Handle types */
99 typedef HANDLE SC_HANDLE, *LPSC_HANDLE;
100 typedef DWORD SERVICE_STATUS_HANDLE;
103 /* Service status structure */
105 typedef struct _SERVICE_STATUS {
106 DWORD dwServiceType;
107 DWORD dwCurrentState;
108 DWORD dwControlsAccepted;
109 DWORD dwWin32ExitCode;
110 DWORD dwServiceSpecificExitCode;
111 DWORD dwCheckPoint;
112 DWORD dwWaitHint;
113 } SERVICE_STATUS, *LPSERVICE_STATUS;
115 typedef enum _SC_STATUS_TYPE {
116 SC_STATUS_PROCESS_INFO = 0
117 } SC_STATUS_TYPE;
119 /* Service main function prototype */
121 typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONA)(DWORD,LPSTR*);
122 typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONW)(DWORD,LPWSTR*);
123 DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION)
125 /* Service start table */
127 typedef struct _SERVICE_TABLE_ENTRYA {
128 LPSTR lpServiceName;
129 LPSERVICE_MAIN_FUNCTIONA lpServiceProc;
130 } SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA;
132 typedef struct _SERVICE_TABLE_ENTRYW {
133 LPWSTR lpServiceName;
134 LPSERVICE_MAIN_FUNCTIONW lpServiceProc;
135 } SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW;
137 DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY)
138 DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY)
140 /* Service status enumeration structure */
142 typedef struct _ENUM_SERVICE_STATUSA {
143 LPSTR lpServiceName;
144 LPSTR lpDisplayName;
145 SERVICE_STATUS ServiceStatus;
146 } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA;
148 typedef struct _ENUM_SERVICE_STATUSW {
149 LPWSTR lpServiceName;
150 LPWSTR lpDisplayName;
151 SERVICE_STATUS ServiceStatus;
152 } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW;
154 DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS)
155 DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS)
157 typedef struct _QUERY_SERVICE_CONFIGA {
158 DWORD dwServiceType;
159 DWORD dwStartType;
160 DWORD dwErrorControl;
161 LPSTR lpBinaryPathName;
162 LPSTR lpLoadOrderGroup;
163 DWORD dwTagId;
164 LPSTR lpDependencies;
165 LPSTR lpServiceStartName;
166 LPSTR lpDisplayName;
167 } QUERY_SERVICE_CONFIGA, *LPQUERY_SERVICE_CONFIGA;
169 typedef struct _QUERY_SERVICE_CONFIGW {
170 DWORD dwServiceType;
171 DWORD dwStartType;
172 DWORD dwErrorControl;
173 LPWSTR lpBinaryPathName;
174 LPWSTR lpLoadOrderGroup;
175 DWORD dwTagId;
176 LPWSTR lpDependencies;
177 LPWSTR lpServiceStartName;
178 LPWSTR lpDisplayName;
179 } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW;
181 /* defines and structures for ChangeServiceConfig2 */
182 #define SERVICE_CONFIG_DESCRIPTION 1
183 #define SERVICE_CONFIG_FAILURE_ACTIONS 2
185 typedef struct _SERVICE_DESCRIPTIONA {
186 LPSTR lpDescription;
187 } SERVICE_DESCRIPTIONA,*LPSERVICE_DESCRIPTIONA;
189 typedef struct _SERVICE_DESCRIPTIONW {
190 LPWSTR lpDescription;
191 } SERVICE_DESCRIPTIONW,*LPSERVICE_DESCRIPTIONW;
193 DECL_WINELIB_TYPE_AW(SERVICE_DESCRIPTION)
194 DECL_WINELIB_TYPE_AW(LPSERVICE_DESCRIPTION)
196 typedef enum _SC_ACTION_TYPE {
197 SC_ACTION_NONE = 0,
198 SC_ACTION_RESTART = 1,
199 SC_ACTION_REBOOT = 2,
200 SC_ACTION_RUN_COMMAND = 3
201 } SC_ACTION_TYPE;
203 typedef struct _SC_ACTION {
204 SC_ACTION_TYPE Type;
205 DWORD Delay;
206 } SC_ACTION,*LPSC_ACTION;
208 typedef struct _SERVICE_FAILURE_ACTIONSA {
209 DWORD dwResetPeriod;
210 LPSTR lpRebootMsg;
211 LPSTR lpCommand;
212 DWORD cActions;
213 SC_ACTION * lpsaActions;
214 } SERVICE_FAILURE_ACTIONSA,*LPSERVICE_FAILURE_ACTIONSA;
216 typedef struct _SERVICE_FAILURE_ACTIONSW {
217 DWORD dwResetPeriod;
218 LPWSTR lpRebootMsg;
219 LPWSTR lpCommand;
220 DWORD cActions;
221 SC_ACTION * lpsaActions;
222 } SERVICE_FAILURE_ACTIONSW,*LPSERVICE_FAILURE_ACTIONSW;
224 DECL_WINELIB_TYPE_AW(SERVICE_FAILURE_ACTIONS)
225 DECL_WINELIB_TYPE_AW(LPSERVICE_FAILURE_ACTIONS)
227 /* Service control handler function prototype */
229 typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD);
231 /* API function prototypes */
233 BOOL WINAPI ChangeServiceConfigA(SC_HANDLE,DWORD,DWORD,DWORD,LPCSTR,LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR);
234 BOOL WINAPI ChangeServiceConfigW(SC_HANDLE,DWORD,DWORD,DWORD,LPCWSTR,LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
235 #define ChangeServiceConfig WINELIB_NAME_AW(ChangeServiceConfig)
236 BOOL WINAPI ChangeServiceConfig2A(SC_HANDLE,DWORD,LPVOID);
237 BOOL WINAPI ChangeServiceConfig2W(SC_HANDLE,DWORD,LPVOID);
238 #define ChangeServiceConfig2 WINELIB_NAME_AW(ChangeServiceConfig2)
239 BOOL WINAPI CloseServiceHandle(SC_HANDLE);
240 BOOL WINAPI ControlService(SC_HANDLE,DWORD,LPSERVICE_STATUS);
241 SC_HANDLE WINAPI CreateServiceA(SC_HANDLE,LPCSTR,LPCSTR,DWORD,DWORD,DWORD,DWORD,LPCSTR,
242 LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR);
243 SC_HANDLE WINAPI CreateServiceW(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,
244 LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR);
245 #define CreateService WINELIB_NAME_AW(CreateService)
246 BOOL WINAPI DeleteService(SC_HANDLE);
247 BOOL WINAPI EnumServicesStatusA(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSA,
248 DWORD,LPDWORD,LPDWORD,LPDWORD);
249 BOOL WINAPI EnumServicesStatusW(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSW,
250 DWORD,LPDWORD,LPDWORD,LPDWORD);
251 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
252 SC_HANDLE WINAPI OpenSCManagerA(LPCSTR,LPCSTR,DWORD);
253 SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR,LPCWSTR,DWORD);
254 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
255 SC_HANDLE WINAPI OpenServiceA(SC_HANDLE,LPCSTR,DWORD);
256 SC_HANDLE WINAPI OpenServiceW(SC_HANDLE,LPCWSTR,DWORD);
257 #define OpenService WINELIB_NAME_AW(OpenService)
258 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR,LPHANDLER_FUNCTION);
259 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR,LPHANDLER_FUNCTION);
260 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
261 BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS);
262 BOOL WINAPI StartServiceA(SC_HANDLE,DWORD,LPCSTR*);
263 BOOL WINAPI StartServiceW(SC_HANDLE,DWORD,LPCWSTR*);
264 #define StartService WINELIB_NAME_AW(StartService)
265 BOOL WINAPI StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA);
266 BOOL WINAPI StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW);
267 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
268 BOOL WINAPI QueryServiceStatus(SC_HANDLE,LPSERVICE_STATUS);
269 BOOL WINAPI QueryServiceStatusEx(SC_HANDLE,SC_STATUS_TYPE,LPBYTE,DWORD,LPDWORD);
270 BOOL WINAPI QueryServiceConfigA(SC_HANDLE,LPQUERY_SERVICE_CONFIGA,DWORD,LPDWORD);
271 BOOL WINAPI QueryServiceConfigW(SC_HANDLE,LPQUERY_SERVICE_CONFIGW,DWORD,LPDWORD);
272 #define QueryServiceConfig WINELIB_NAME_AW(QueryServiceConfig)
274 #ifdef __cplusplus
275 } /* extern "C" */
276 #endif /* defined(__cplusplus) */
278 #endif /* !defined(__WINE_WINSVC_H) */