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 typedef enum _SC_ACTION_TYPE {
99 SC_ACTION_RESTART = 1,
100 SC_ACTION_REBOOT = 2,
101 SC_ACTION_RUN_COMMAND = 3
104 typedef struct _SC_ACTION {
107 } SC_ACTION,*LPSC_ACTION;
109 typedef struct _SERVICE_FAILURE_ACTIONSW {
111 [unique] LPWSTR lpRebootMsg;
112 [unique] LPWSTR lpCommand;
114 [size_is(cActions)] SC_ACTION *lpsaActions;
115 } SERVICE_FAILURE_ACTIONSW,*LPSERVICE_FAILURE_ACTIONSW;
117 #define SERVICE_CONFIG_DESCRIPTION 1
118 #define SERVICE_CONFIG_FAILURE_ACTIONS 2
119 #define SERVICE_CONFIG_DELAYED_AUTO_START_INFO 3
120 #define SERVICE_CONFIG_FAILURE_ACTIONS_FLAG 4
121 #define SERVICE_CONFIG_SERVICE_SID_INFO 5
122 #define SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO 6
123 #define SERVICE_CONFIG_PRESHUTDOWN_INFO 7
125 typedef struct _ENUM_SERVICE_STATUSW {
126 LPWSTR lpServiceName;
127 LPWSTR lpDisplayName;
128 SERVICE_STATUS ServiceStatus;
129 } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW;
133 typedef [switch_type(DWORD)] union
135 [case (SERVICE_CONFIG_DESCRIPTION)] SERVICE_DESCRIPTIONW descr;
136 [case (SERVICE_CONFIG_FAILURE_ACTIONS)] SERVICE_FAILURE_ACTIONSW actions;
139 /* Compatible with Windows function 0x00 */
140 DWORD svcctl_CloseServiceHandle(
141 [in,out] SC_RPC_HANDLE *handle
144 /* Compatible with Windows function 0x01 */
145 DWORD svcctl_ControlService(
146 [in] SC_RPC_HANDLE hService,
147 [in] DWORD dwControl,
148 [out] SERVICE_STATUS *lpServiceStatus
151 /* Compatible with Windows function 0x02 */
152 DWORD svcctl_DeleteService(
153 [in] SC_RPC_HANDLE hService
156 /* Compatible with Windows function 0x03 */
157 DWORD svcctl_LockServiceDatabase(
158 [in] SC_RPC_HANDLE hSCManager,
159 [out] SC_RPC_LOCK *phLock
162 /* Not compatible with Windows function 0x04 */
163 DWORD svcctl_QueryServiceObjectSecurity(/* FIXME */);
165 /* Not compatible with Windows function 0x05 */
166 DWORD svcctl_SetServiceObjectSecurity(/* FIXME */);
168 /* Not compatible with Windows function 0x06 */
169 DWORD svcctl_QueryServiceStatus(/* FIXME */);
171 /* Compatible with Windows function 0x07 */
172 DWORD svcctl_SetServiceStatus(
173 [in] SC_RPC_HANDLE hServiceStatus,
174 [in] LPSERVICE_STATUS lpServiceStatus
177 /* Compatible with Windows function 0x08 */
178 DWORD svcctl_UnlockServiceDatabase(
179 [in,out] SC_RPC_LOCK *phLock
182 /* Not compatible with Windows function 0x09 */
183 DWORD svcctl_NotifyBootConfigStatus(/* FIXME */);
185 /* Not compatible with Windows function 0x0a */
186 DWORD svcctl_SCSetServiceBitsW(/* FIXME */);
188 /* Compatible with Windows function 0x0b */
189 DWORD svcctl_ChangeServiceConfigW(
190 [in] SC_RPC_HANDLE hService,
191 [in] DWORD dwServiceType,
192 [in] DWORD dwStartType,
193 [in] DWORD dwErrorControl,
194 [in,unique] LPCWSTR lpBinaryPathName,
195 [in,unique] LPCWSTR lpLoadOrderGroupKey,
196 [in,out,unique] DWORD *lpdwTagId,
197 [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
198 [in] DWORD dwDependenciesSize,
199 [in,unique] LPCWSTR lpServiceStartName,
200 [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
201 [in] DWORD dwPasswordSize,
202 [in,unique] LPCWSTR lpDisplayName
205 /* Compatible with Windows function 0x0c */
206 DWORD svcctl_CreateServiceW(
207 [in] SC_RPC_HANDLE hSCManager,
208 [in] LPCWSTR lpServiceName,
209 [in,unique] LPCWSTR lpDisplayName,
210 [in] DWORD dwDesiredAccess,
211 [in] DWORD dwServiceType,
212 [in] DWORD dwStartType,
213 [in] DWORD dwErrorControl,
214 [in] LPCWSTR lpBinaryPathName,
215 [in,unique] LPCWSTR lpLoadOrderGroup,
216 [in,out,unique] DWORD *lpdwTagId,
217 [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
218 [in] DWORD dwDependenciesSize,
219 [in,unique] LPCWSTR lpServiceStartName,
220 [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
221 [in] DWORD dwPasswordSize,
222 [out] SC_RPC_HANDLE *phService
225 /* Not compatible with Windows function 0x0d */
226 DWORD svcctl_EnumDependentServicesW(/* FIXME */);
228 /* Not compatible with Windows function 0x0e */
229 DWORD svcctl_EnumServicesStatusW(
230 [in] SC_RPC_HANDLE hmngr,
233 [out,size_is(size)] BYTE *buffer,
235 [out] LPDWORD needed,
236 [out] LPDWORD returned
239 /* Compatible with Windows function 0x0f */
240 DWORD svcctl_OpenSCManagerW(
241 [in,unique] MACHINE_HANDLEW MachineName,
242 [in,unique] LPCWSTR DatabaseName,
243 [in] DWORD dwAccessMask,
244 [out] SC_RPC_HANDLE *handle
247 /* Compatible with Windows function 0x10 */
248 DWORD svcctl_OpenServiceW(
249 [in] SC_RPC_HANDLE hSCManager,
250 [in] LPCWSTR lpServiceName,
251 [in] DWORD dwDesiredAccess,
252 [out] SC_RPC_HANDLE *phService
255 /* Windows function 0x11 must be using a different prototype - not compatible */
256 DWORD svcctl_QueryServiceConfigW(
257 [in] SC_RPC_HANDLE hService,
258 [out] QUERY_SERVICE_CONFIGW *config);
260 /* Not compatible with Windows function 0x12 */
261 DWORD svcctl_QueryServiceLockStatusW(/* FIXME */);
263 /* Untested with Windows function 0x13 */
264 DWORD svcctl_StartServiceW(
265 [in] SC_RPC_HANDLE hService,
266 [in] DWORD dwNumServiceArgs,
267 [in,unique,size_is(dwNumServiceArgs)] LPCWSTR *lpServiceArgVectors
270 /* Compatible with Windows function 0x14 */
271 DWORD svcctl_GetServiceDisplayNameW(
272 [in] SC_RPC_HANDLE hSCManager,
273 [in] LPCWSTR lpServiceName,
274 [out,string,size_is(*cchBufSize+1)] WCHAR lpBuffer[],
275 [in,out] DWORD *cchBufSize);
277 /* Compatible with Windows function 0x15 */
278 DWORD svcctl_GetServiceKeyNameW(
279 [in] SC_RPC_HANDLE hSCManager,
280 [in] LPCWSTR lpServiceDisplayName,
281 [out,string,size_is(*cchBufSize+1)] WCHAR lpBuffer[],
282 [in,out] DWORD *cchBufSize);
284 /* Not compatible with Windows function 0x16 */
285 DWORD svcctl_SCSetServiceBitsA(/* FIXME */);
287 /* Not compatible with Windows function 0x17 */
288 DWORD svcctl_ChangeServiceConfigA(/* FIXME */);
290 /* Not compatible with Windows function 0x18 */
291 DWORD svcctl_CreateServiceA(/* FIXME */);
293 /* Not compatible with Windows function 0x19 */
294 DWORD svcctl_EnumDependentServicesA(/* FIXME */);
296 /* Not compatible with Windows function 0x1a */
297 DWORD svcctl_EnumServicesStatusA(/* FIXME */);
299 /* Not compatible with Windows function 0x1b */
300 DWORD svcctl_OpenSCManagerA(/* FIXME */);
302 /* Not compatible with Windows function 0x1c */
303 DWORD svcctl_OpenServiceA(/* FIXME */);
305 /* Not compatible with Windows function 0x1d */
306 DWORD svcctl_QueryServiceConfigA(/* FIXME */);
308 /* Not compatible with Windows function 0x1e */
309 DWORD svcctl_QueryServiceLockStatusA(/* FIXME */);
311 /* Not compatible with Windows function 0x1f */
312 DWORD svcctl_StartServiceA(/* FIXME */);
314 /* Not compatible with Windows function 0x20 */
315 DWORD svcctl_GetServiceDisplayNameA(/* FIXME */);
317 /* Not compatible with Windows function 0x21 */
318 DWORD svcctl_GetServiceKeyNameA(/* FIXME */);
320 /* Not compatible with Windows function 0x22 */
321 DWORD svcctl_GetCurrentGroupStateW(/* FIXME */);
323 /* Not compatible with Windows function 0x23 */
324 DWORD svcctl_EnumServiceGroupW(/* FIXME */);
326 /* Not compatible with Windows function 0x24 */
327 DWORD svcctl_ChangeServiceConfig2A(/* FIXME */);
329 /* Untested with Windows function 0x25 */
330 DWORD svcctl_ChangeServiceConfig2W(
331 [in] SC_RPC_HANDLE hService,
332 [in] DWORD InfoLevel,
333 [in,switch_is(InfoLevel)] SERVICE_CONFIG2W *config );
335 /* Not compatible with Windows function 0x26 */
336 DWORD svcctl_QueryServiceConfig2A(/* FIXME */);
338 /* Untested with Windows function 0x27 */
339 DWORD svcctl_QueryServiceConfig2W(
340 [in] SC_RPC_HANDLE hService,
341 [in] DWORD InfoLevel,
342 [out,size_is(cbBufSize)] BYTE lpBuffer[],
343 [in] DWORD cbBufSize,
344 [out] LPDWORD pcbBytesNeeded
347 /* Untested with Windows function 0x28 */
348 DWORD svcctl_QueryServiceStatusEx(
349 [in] SC_RPC_HANDLE hService,
350 [in] SC_STATUS_TYPE InfoLevel,
351 [out,size_is(cbBufSize)] BYTE *lpBuffer,
352 [in] DWORD cbBufSize,
353 [out] LPDWORD pcbBytesNeeded
356 DWORD svcctl_EnumServicesStatusExW(
357 [in] SC_RPC_HANDLE hmngr,
360 [out,size_is(size)] BYTE *buffer,
362 [out] LPDWORD needed,
363 [out] LPDWORD returned,
364 [in,unique] LPCWSTR group