2 * svcctl interface definitions - exported by services.exe to access the
5 * Copyright 2007 Google (Mikolaj Zalewski)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 * some defined for the C code
27 cpp_quote
("#include \"winsvc.h\"")
28 cpp_quote
("#define SVCCTL_TRANSPORT {'n','c','a','c','n','_','n','p',0}")
29 cpp_quote
("#define SVCCTL_ENDPOINT {'\\\\','p','i','p','e','\\\\','s','v','c','c','t','l',0}")
31 /* Not the Windows event name - if needed the true one can be found in Inside Windows */
32 cpp_quote
("#define SVCCTL_STARTED_EVENT {'_','_','w','i','n','e','_','S','v','c','c','t','l','S','t','a','r','t','e','d',0}")
34 /* Service startup protocol over control pipe - not compatible with Windows */
35 enum service_pipe_command
37 WINESERV_STARTINFO
= 1,
38 WINESERV_SENDCONTROL
= 2
41 typedef struct service_start_info_t
43 enum service_pipe_command cmd
; /* request code */
44 DWORD total_size
; /* total request size */
45 DWORD name_size
; /* size of name in data buffer */
46 DWORD
control; /* control code */
51 uuid(367abb81
-9844-35f1
-ad32
-98f038001003
),
53 pointer_default(unique),
54 endpoint("ncacn_np:[\\pipe\\svcctl]")
59 typedef [handle] LPCWSTR MACHINE_HANDLEW
;
60 typedef [context_handle] void *SC_RPC_HANDLE
;
61 typedef [context_handle] void *SC_RPC_LOCK
;
63 /* undocumented access rights */
64 cpp_quote
("#define SERVICE_SET_STATUS 0x8000")
66 cpp_quote
("#if 0 /* already defined in winsvc.h */")
67 typedef struct _QUERY_SERVICE_CONFIGW
{
71 [unique] LPWSTR lpBinaryPathName
;
72 [unique] LPWSTR lpLoadOrderGroup
;
74 [unique] LPWSTR lpDependencies
;
75 [unique] LPWSTR lpServiceStartName
;
76 [unique] LPWSTR lpDisplayName
;
77 } QUERY_SERVICE_CONFIGW
, *LPQUERY_SERVICE_CONFIGW
;
79 typedef struct _SERVICE_STATUS
{
82 DWORD dwControlsAccepted
;
83 DWORD dwWin32ExitCode
;
84 DWORD dwServiceSpecificExitCode
;
87 } SERVICE_STATUS
, *LPSERVICE_STATUS
;
89 typedef enum _SC_STATUS_TYPE
{
90 SC_STATUS_PROCESS_INFO
= 0
93 typedef struct _SERVICE_DESCRIPTIONW
{
95 } SERVICE_DESCRIPTIONW
,*LPSERVICE_DESCRIPTIONW
;
97 #define SERVICE_CONFIG_DESCRIPTION
1
101 typedef [switch_type(DWORD
)] union
103 [case (SERVICE_CONFIG_DESCRIPTION
)] SERVICE_DESCRIPTIONW descr
;
106 /* Compatible with Windows function 0x00 */
107 DWORD svcctl_CloseServiceHandle
(
108 [in,out] SC_RPC_HANDLE
*handle
111 /* Compatible with Windows function 0x01 */
112 DWORD svcctl_ControlService
(
113 [in] SC_RPC_HANDLE hService
,
114 [in] DWORD dwControl
,
115 [out] SERVICE_STATUS
*lpServiceStatus
118 /* Compatible with Windows function 0x02 */
119 DWORD svcctl_DeleteService
(
120 [in] SC_RPC_HANDLE hService
123 /* Compatible with Windows function 0x03 */
124 DWORD svcctl_LockServiceDatabase
(
125 [in] SC_RPC_HANDLE hSCManager
,
126 [out] SC_RPC_LOCK
*phLock
129 /* Not compatible with Windows function 0x04 */
130 DWORD svcctl_QueryServiceObjectSecurity
(/* FIXME */);
132 /* Not compatible with Windows function 0x05 */
133 DWORD svcctl_SetServiceObjectSecurity
(/* FIXME */);
135 /* Not compatible with Windows function 0x06 */
136 DWORD svcctl_QueryServiceStatus
(/* FIXME */);
138 /* Compatible with Windows function 0x07 */
139 DWORD svcctl_SetServiceStatus
(
140 [in] SC_RPC_HANDLE hServiceStatus
,
141 [in] LPSERVICE_STATUS lpServiceStatus
144 /* Compatible with Windows function 0x08 */
145 DWORD svcctl_UnlockServiceDatabase
(
146 [in,out] SC_RPC_LOCK
*phLock
149 /* Not compatible with Windows function 0x09 */
150 DWORD svcctl_NotifyBootConfigStatus
(/* FIXME */);
152 /* Not compatible with Windows function 0x0a */
153 DWORD svcctl_SCSetServiceBitsW
(/* FIXME */);
155 /* Compatible with Windows function 0x0b */
156 DWORD svcctl_ChangeServiceConfigW
(
157 [in] SC_RPC_HANDLE hService
,
158 [in] DWORD dwServiceType
,
159 [in] DWORD dwStartType
,
160 [in] DWORD dwErrorControl
,
161 [in,unique] LPCWSTR lpBinaryPathName
,
162 [in,unique] LPCWSTR lpLoadOrderGroupKey
,
163 [in,out,unique] DWORD
*lpdwTagId
,
164 [in,unique,size_is(dwDependenciesSize
)] const BYTE *lpDependencies
,
165 [in] DWORD dwDependenciesSize
,
166 [in,unique] LPCWSTR lpServiceStartName
,
167 [in,unique,size_is(dwPasswordSize
)] const BYTE *lpPassword
,
168 [in] DWORD dwPasswordSize
,
169 [in,unique] LPCWSTR lpDisplayName
172 /* Compatible with Windows function 0x0c */
173 DWORD svcctl_CreateServiceW
(
174 [in] SC_RPC_HANDLE hSCManager
,
175 [in] LPCWSTR lpServiceName
,
176 [in,unique] LPCWSTR lpDisplayName
,
177 [in] DWORD dwDesiredAccess
,
178 [in] DWORD dwServiceType
,
179 [in] DWORD dwStartType
,
180 [in] DWORD dwErrorControl
,
181 [in] LPCWSTR lpBinaryPathName
,
182 [in,unique] LPCWSTR lpLoadOrderGroup
,
183 [in,out,unique] DWORD
*lpdwTagId
,
184 [in,unique,size_is(dwDependenciesSize
)] const BYTE *lpDependencies
,
185 [in] DWORD dwDependenciesSize
,
186 [in,unique] LPCWSTR lpServiceStartName
,
187 [in,unique,size_is(dwPasswordSize
)] const BYTE *lpPassword
,
188 [in] DWORD dwPasswordSize
,
189 [out] SC_RPC_HANDLE
*phService
192 /* Not compatible with Windows function 0x0d */
193 DWORD svcctl_EnumDependentServicesW
(/* FIXME */);
195 /* Not compatible with Windows function 0x0e */
196 DWORD svcctl_EnumServicesStatusW
(/* FIXME */);
198 /* Compatible with Windows function 0x0f */
199 DWORD svcctl_OpenSCManagerW
(
200 [in,unique] MACHINE_HANDLEW MachineName
,
201 [in,unique] LPCWSTR DatabaseName
,
202 [in] DWORD dwAccessMask
,
203 [out] SC_RPC_HANDLE
*handle
206 /* Compatible with Windows function 0x10 */
207 DWORD svcctl_OpenServiceW
(
208 [in] SC_RPC_HANDLE hSCManager
,
209 [in] LPCWSTR lpServiceName
,
210 [in] DWORD dwDesiredAccess
,
211 [out] SC_RPC_HANDLE
*phService
214 /* Windows function 0x11 must be using a different prototype - not compatible */
215 DWORD svcctl_QueryServiceConfigW
(
216 [in] SC_RPC_HANDLE hService
,
217 [out] QUERY_SERVICE_CONFIGW
*config
);
219 /* Not compatible with Windows function 0x12 */
220 DWORD svcctl_QueryServiceLockStatusW
(/* FIXME */);
222 /* Untested with Windows function 0x13 */
223 DWORD svcctl_StartServiceW
(
224 [in] SC_RPC_HANDLE hService
,
225 [in] DWORD dwNumServiceArgs
,
226 [in,unique,size_is(dwNumServiceArgs
)] LPCWSTR
*lpServiceArgVectors
229 /* Compatible with Windows function 0x14 */
230 DWORD svcctl_GetServiceDisplayNameW
(
231 [in] SC_RPC_HANDLE hSCManager
,
232 [in] LPCWSTR lpServiceName
,
233 [out,size_is(cchBufSize
)] WCHAR lpBuffer
[],
234 [in] DWORD cchBufSize
,
235 [in,out] DWORD
*cchLength
);
237 /* Compatible with Windows function 0x15 */
238 DWORD svcctl_GetServiceKeyNameW
(
239 [in] SC_RPC_HANDLE hSCManager
,
240 [in] LPCWSTR lpServiceDisplayName
,
241 [out,size_is(cchBufSize
)] WCHAR lpBuffer
[],
242 [in] DWORD cchBufSize
,
243 [in,out] DWORD
*cchLength
);
245 /* Not compatible with Windows function 0x16 */
246 DWORD svcctl_SCSetServiceBitsA
(/* FIXME */);
248 /* Not compatible with Windows function 0x17 */
249 DWORD svcctl_ChangeServiceConfigA
(/* FIXME */);
251 /* Not compatible with Windows function 0x18 */
252 DWORD svcctl_CreateServiceA
(/* FIXME */);
254 /* Not compatible with Windows function 0x19 */
255 DWORD svcctl_EnumDependentServicesA
(/* FIXME */);
257 /* Not compatible with Windows function 0x1a */
258 DWORD svcctl_EnumServicesStatusA
(/* FIXME */);
260 /* Not compatible with Windows function 0x1b */
261 DWORD svcctl_OpenSCManagerA
(/* FIXME */);
263 /* Not compatible with Windows function 0x1c */
264 DWORD svcctl_OpenServiceA
(/* FIXME */);
266 /* Not compatible with Windows function 0x1d */
267 DWORD svcctl_QueryServiceConfigA
(/* FIXME */);
269 /* Not compatible with Windows function 0x1e */
270 DWORD svcctl_QueryServiceLockStatusA
(/* FIXME */);
272 /* Not compatible with Windows function 0x1f */
273 DWORD svcctl_StartServiceA
(/* FIXME */);
275 /* Not compatible with Windows function 0x20 */
276 DWORD svcctl_GetServiceDisplayNameA
(/* FIXME */);
278 /* Not compatible with Windows function 0x21 */
279 DWORD svcctl_GetServiceKeyNameA
(/* FIXME */);
281 /* Not compatible with Windows function 0x22 */
282 DWORD svcctl_GetCurrentGroupStateW
(/* FIXME */);
284 /* Not compatible with Windows function 0x23 */
285 DWORD svcctl_EnumServiceGroupW
(/* FIXME */);
287 /* Not compatible with Windows function 0x24 */
288 DWORD svcctl_ChangeServiceConfig2A
(/* FIXME */);
290 /* Untested with Windows function 0x25 */
291 DWORD svcctl_ChangeServiceConfig2W
(
292 [in] SC_RPC_HANDLE hService
,
293 [in] DWORD InfoLevel
,
294 [in,switch_is(InfoLevel
)] SERVICE_CONFIG2W
*config
);
296 /* Not compatible with Windows function 0x26 */
297 DWORD svcctl_QueryServiceConfig2A
(/* FIXME */);
299 /* Untested with Windows function 0x27 */
300 DWORD svcctl_QueryServiceConfig2W
(
301 [in] SC_RPC_HANDLE hService
,
302 [in] DWORD InfoLevel
,
303 [out,size_is(cbBufSize
)] BYTE lpBuffer
[],
304 [in] DWORD cbBufSize
,
305 [out] LPDWORD pcbBytesNeeded
308 /* Untested with Windows function 0x28 */
309 DWORD svcctl_QueryServiceStatusEx
(
310 [in] SC_RPC_HANDLE hService
,
311 [in] SC_STATUS_TYPE InfoLevel
,
312 [out,size_is(cbBufSize
)] BYTE *lpBuffer
,
313 [in] DWORD cbBufSize
,
314 [out] LPDWORD pcbBytesNeeded