Add Fonts key for NT versions of Windows.
[wine.git] / include / winsvc.h
blobfe37ead5354a3fc38f3ae70ba3deb66b7d3b8311
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 /* Service control handler function prototype */
183 typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD);
185 /* API function prototypes */
187 BOOL WINAPI CloseServiceHandle(SC_HANDLE);
188 BOOL WINAPI ControlService(SC_HANDLE,DWORD,LPSERVICE_STATUS);
189 SC_HANDLE WINAPI CreateServiceA(SC_HANDLE,LPCSTR,LPCSTR,DWORD,DWORD,DWORD,DWORD,LPCSTR,
190 LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR);
191 SC_HANDLE WINAPI CreateServiceW(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,
192 LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR);
193 #define CreateService WINELIB_NAME_AW(CreateService)
194 BOOL WINAPI DeleteService(SC_HANDLE);
195 BOOL WINAPI EnumServicesStatusA(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSA,
196 DWORD,LPDWORD,LPDWORD,LPDWORD);
197 BOOL WINAPI EnumServicesStatusW(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSW,
198 DWORD,LPDWORD,LPDWORD,LPDWORD);
199 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
200 SC_HANDLE WINAPI OpenSCManagerA(LPCSTR,LPCSTR,DWORD);
201 SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR,LPCWSTR,DWORD);
202 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
203 SC_HANDLE WINAPI OpenServiceA(SC_HANDLE,LPCSTR,DWORD);
204 SC_HANDLE WINAPI OpenServiceW(SC_HANDLE,LPCWSTR,DWORD);
205 #define OpenService WINELIB_NAME_AW(OpenService)
206 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR,LPHANDLER_FUNCTION);
207 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR,LPHANDLER_FUNCTION);
208 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
209 BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS);
210 BOOL WINAPI StartServiceA(SC_HANDLE,DWORD,LPCSTR*);
211 BOOL WINAPI StartServiceW(SC_HANDLE,DWORD,LPCWSTR*);
212 #define StartService WINELIB_NAME_AW(StartService)
213 BOOL WINAPI StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA);
214 BOOL WINAPI StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW);
215 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
216 BOOL WINAPI QueryServiceStatus(SC_HANDLE,LPSERVICE_STATUS);
217 BOOL WINAPI QueryServiceStatusEx(SC_HANDLE,SC_STATUS_TYPE,LPBYTE,DWORD,LPDWORD);
218 BOOL WINAPI QueryServiceConfigA(SC_HANDLE,LPQUERY_SERVICE_CONFIGA,DWORD,LPDWORD);
219 BOOL WINAPI QueryServiceConfigW(SC_HANDLE,LPQUERY_SERVICE_CONFIGW,DWORD,LPDWORD);
220 #define QueryServiceConfig WINELIB_NAME_AW(QueryServiceConfig)
222 #ifdef __cplusplus
223 } /* extern "C" */
224 #endif /* defined(__cplusplus) */
226 #endif /* !defined(__WINE_WINSVC_H) */