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
24 #endif /* defined(__cplusplus) */
29 #define SERVICE_CONTROL_STOP 0x00000001
30 #define SERVICE_CONTROL_PAUSE 0x00000002
31 #define SERVICE_CONTROL_CONTINUE 0x00000003
32 #define SERVICE_CONTROL_INTERROGATE 0x00000004
33 #define SERVICE_CONTROL_SHUTDOWN 0x00000005
34 #define SERVICE_CONTROL_PARAMCHANGE 0x00000006
35 #define SERVICE_CONTROL_NETBINDADD 0x00000007
36 #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
37 #define SERVICE_CONTROL_NETBINDENABLE 0x00000009
38 #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
39 #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
40 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
41 #define SERVICE_CONTROL_POWEREVENT 0x0000000D
44 #define SERVICE_STOPPED 0x00000001
45 #define SERVICE_START_PENDING 0x00000002
46 #define SERVICE_STOP_PENDING 0x00000003
47 #define SERVICE_RUNNING 0x00000004
48 #define SERVICE_CONTINUE_PENDING 0x00000005
49 #define SERVICE_PAUSE_PENDING 0x00000006
50 #define SERVICE_PAUSED 0x00000007
52 /* Controls Accepted */
53 #define SERVICE_ACCEPT_STOP 0x00000001
54 #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
55 #define SERVICE_ACCEPT_SHUTDOWN 0x00000004
56 #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
57 #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
58 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
59 #define SERVICE_ACCEPT_POWEREVENT 0x00000040
61 /* Service Control Manager Object access types */
62 #define SC_MANAGER_CONNECT 0x0001
63 #define SC_MANAGER_CREATE_SERVICE 0x0002
64 #define SC_MANAGER_ENUMERATE_SERVICE 0x0004
65 #define SC_MANAGER_LOCK 0x0008
66 #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
67 #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
68 #define SC_MANAGER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
69 SC_MANAGER_CONNECT | \
70 SC_MANAGER_CREATE_SERVICE | \
71 SC_MANAGER_ENUMERATE_SERVICE | \
73 SC_MANAGER_QUERY_LOCK_STATUS | \
74 SC_MANAGER_MODIFY_BOOT_CONFIG )
76 #define SERVICE_QUERY_CONFIG 0x0001
77 #define SERVICE_CHANGE_CONFIG 0x0002
78 #define SERVICE_QUERY_STATUS 0x0004
79 #define SERVICE_ENUMERATE_DEPENDENTS 0x0008
80 #define SERVICE_START 0x0010
81 #define SERVICE_STOP 0x0020
82 #define SERVICE_PAUSE_CONTINUE 0x0040
83 #define SERVICE_INTERROGATE 0x0080
84 #define SERVICE_USER_DEFINED_CONTROL 0x0100
86 #define SERVICE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
87 SERVICE_QUERY_CONFIG | \
88 SERVICE_CHANGE_CONFIG | \
89 SERVICE_QUERY_STATUS | \
90 SERVICE_ENUMERATE_DEPENDENTS | \
93 SERVICE_PAUSE_CONTINUE | \
94 SERVICE_INTERROGATE | \
95 SERVICE_USER_DEFINED_CONTROL )
101 typedef HANDLE SC_HANDLE
, *LPSC_HANDLE
;
102 typedef DWORD SERVICE_STATUS_HANDLE
;
105 /* Service status structure */
107 typedef struct _SERVICE_STATUS
{
109 DWORD dwCurrentState
;
110 DWORD dwControlsAccepted
;
111 DWORD dwWin32ExitCode
;
112 DWORD dwServiceSpecificExitCode
;
115 } SERVICE_STATUS
, *LPSERVICE_STATUS
;
117 typedef enum _SC_STATUS_TYPE
{
118 SC_STATUS_PROCESS_INFO
= 0
121 /* Service main function prototype */
123 typedef VOID (CALLBACK
*LPSERVICE_MAIN_FUNCTIONA
)(DWORD
,LPSTR
*);
124 typedef VOID (CALLBACK
*LPSERVICE_MAIN_FUNCTIONW
)(DWORD
,LPWSTR
*);
125 DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION
)
127 /* Service start table */
129 typedef struct _SERVICE_TABLE_ENTRYA
{
131 LPSERVICE_MAIN_FUNCTIONA lpServiceProc
;
132 } SERVICE_TABLE_ENTRYA
, *LPSERVICE_TABLE_ENTRYA
;
134 typedef struct _SERVICE_TABLE_ENTRYW
{
135 LPWSTR lpServiceName
;
136 LPSERVICE_MAIN_FUNCTIONW lpServiceProc
;
137 } SERVICE_TABLE_ENTRYW
, *LPSERVICE_TABLE_ENTRYW
;
139 DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY
)
140 DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY
)
142 /* Service status enumeration structure */
144 typedef struct _ENUM_SERVICE_STATUSA
{
147 SERVICE_STATUS ServiceStatus
;
148 } ENUM_SERVICE_STATUSA
, *LPENUM_SERVICE_STATUSA
;
150 typedef struct _ENUM_SERVICE_STATUSW
{
151 LPWSTR lpServiceName
;
152 LPWSTR lpDisplayName
;
153 SERVICE_STATUS ServiceStatus
;
154 } ENUM_SERVICE_STATUSW
, *LPENUM_SERVICE_STATUSW
;
156 DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS
)
157 DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS
)
159 /* Service control handler function prototype */
161 typedef VOID (WINAPI
*LPHANDLER_FUNCTION
)(DWORD
);
163 /* API function prototypes */
165 BOOL WINAPI
CloseServiceHandle(SC_HANDLE
);
166 BOOL WINAPI
ControlService(SC_HANDLE
,DWORD
,LPSERVICE_STATUS
);
167 SC_HANDLE WINAPI
CreateServiceA(SC_HANDLE
,LPCSTR
,LPCSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCSTR
,
168 LPCSTR
,LPDWORD
,LPCSTR
,LPCSTR
,LPCSTR
);
169 SC_HANDLE WINAPI
CreateServiceW(SC_HANDLE
,LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCWSTR
,
170 LPCWSTR
,LPDWORD
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
171 #define CreateService WINELIB_NAME_AW(CreateService)
172 BOOL WINAPI
DeleteService(SC_HANDLE
);
173 BOOL WINAPI
EnumServicesStatusA(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSA
,
174 DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
175 BOOL WINAPI
EnumServicesStatusW(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSW
,
176 DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
177 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
178 SC_HANDLE WINAPI
OpenSCManagerA(LPCSTR
,LPCSTR
,DWORD
);
179 SC_HANDLE WINAPI
OpenSCManagerW(LPCWSTR
,LPCWSTR
,DWORD
);
180 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
181 SC_HANDLE WINAPI
OpenServiceA(SC_HANDLE
,LPCSTR
,DWORD
);
182 SC_HANDLE WINAPI
OpenServiceW(SC_HANDLE
,LPCWSTR
,DWORD
);
183 #define OpenService WINELIB_NAME_AW(OpenService)
184 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA(LPCSTR
,LPHANDLER_FUNCTION
);
185 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerW(LPCWSTR
,LPHANDLER_FUNCTION
);
186 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
187 BOOL WINAPI
SetServiceStatus(SERVICE_STATUS_HANDLE
,LPSERVICE_STATUS
);
188 BOOL WINAPI
StartServiceA(SC_HANDLE
,DWORD
,LPCSTR
*);
189 BOOL WINAPI
StartServiceW(SC_HANDLE
,DWORD
,LPCWSTR
*);
190 #define StartService WINELIB_NAME_AW(StartService)
191 BOOL WINAPI
StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA
);
192 BOOL WINAPI
StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW
);
193 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
194 BOOL WINAPI
QueryServiceStatus(SC_HANDLE
,LPSERVICE_STATUS
);
195 BOOL WINAPI
QueryServiceStatusEx(SC_HANDLE
,SC_STATUS_TYPE
,LPBYTE
,DWORD
,LPDWORD
);
198 #endif /* defined(__cplusplus) */
200 #endif /* !defined(__WINE_WINSVC_H) */