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
127 typedef [switch_type(DWORD)] union
129 [case (SERVICE_CONFIG_DESCRIPTION)] SERVICE_DESCRIPTIONW descr;
130 [case (SERVICE_CONFIG_FAILURE_ACTIONS)] SERVICE_FAILURE_ACTIONSW actions;
133 /* Compatible with Windows function 0x00 */
134 DWORD svcctl_CloseServiceHandle(
135 [in,out] SC_RPC_HANDLE *handle
138 /* Compatible with Windows function 0x01 */
139 DWORD svcctl_ControlService(
140 [in] SC_RPC_HANDLE hService,
141 [in] DWORD dwControl,
142 [out] SERVICE_STATUS *lpServiceStatus
145 /* Compatible with Windows function 0x02 */
146 DWORD svcctl_DeleteService(
147 [in] SC_RPC_HANDLE hService
150 /* Compatible with Windows function 0x03 */
151 DWORD svcctl_LockServiceDatabase(
152 [in] SC_RPC_HANDLE hSCManager,
153 [out] SC_RPC_LOCK *phLock
156 /* Not compatible with Windows function 0x04 */
157 DWORD svcctl_QueryServiceObjectSecurity(/* FIXME */);
159 /* Not compatible with Windows function 0x05 */
160 DWORD svcctl_SetServiceObjectSecurity(/* FIXME */);
162 /* Not compatible with Windows function 0x06 */
163 DWORD svcctl_QueryServiceStatus(/* FIXME */);
165 /* Compatible with Windows function 0x07 */
166 DWORD svcctl_SetServiceStatus(
167 [in] SC_RPC_HANDLE hServiceStatus,
168 [in] LPSERVICE_STATUS lpServiceStatus
171 /* Compatible with Windows function 0x08 */
172 DWORD svcctl_UnlockServiceDatabase(
173 [in,out] SC_RPC_LOCK *phLock
176 /* Not compatible with Windows function 0x09 */
177 DWORD svcctl_NotifyBootConfigStatus(/* FIXME */);
179 /* Not compatible with Windows function 0x0a */
180 DWORD svcctl_SCSetServiceBitsW(/* FIXME */);
182 /* Compatible with Windows function 0x0b */
183 DWORD svcctl_ChangeServiceConfigW(
184 [in] SC_RPC_HANDLE hService,
185 [in] DWORD dwServiceType,
186 [in] DWORD dwStartType,
187 [in] DWORD dwErrorControl,
188 [in,unique] LPCWSTR lpBinaryPathName,
189 [in,unique] LPCWSTR lpLoadOrderGroupKey,
190 [in,out,unique] DWORD *lpdwTagId,
191 [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
192 [in] DWORD dwDependenciesSize,
193 [in,unique] LPCWSTR lpServiceStartName,
194 [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
195 [in] DWORD dwPasswordSize,
196 [in,unique] LPCWSTR lpDisplayName
199 /* Compatible with Windows function 0x0c */
200 DWORD svcctl_CreateServiceW(
201 [in] SC_RPC_HANDLE hSCManager,
202 [in] LPCWSTR lpServiceName,
203 [in,unique] LPCWSTR lpDisplayName,
204 [in] DWORD dwDesiredAccess,
205 [in] DWORD dwServiceType,
206 [in] DWORD dwStartType,
207 [in] DWORD dwErrorControl,
208 [in] LPCWSTR lpBinaryPathName,
209 [in,unique] LPCWSTR lpLoadOrderGroup,
210 [in,out,unique] DWORD *lpdwTagId,
211 [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
212 [in] DWORD dwDependenciesSize,
213 [in,unique] LPCWSTR lpServiceStartName,
214 [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
215 [in] DWORD dwPasswordSize,
216 [out] SC_RPC_HANDLE *phService
219 /* Not compatible with Windows function 0x0d */
220 DWORD svcctl_EnumDependentServicesW(/* FIXME */);
222 /* Not compatible with Windows function 0x0e */
223 DWORD svcctl_EnumServicesStatusW(/* FIXME */);
225 /* Compatible with Windows function 0x0f */
226 DWORD svcctl_OpenSCManagerW(
227 [in,unique] MACHINE_HANDLEW MachineName,
228 [in,unique] LPCWSTR DatabaseName,
229 [in] DWORD dwAccessMask,
230 [out] SC_RPC_HANDLE *handle
233 /* Compatible with Windows function 0x10 */
234 DWORD svcctl_OpenServiceW(
235 [in] SC_RPC_HANDLE hSCManager,
236 [in] LPCWSTR lpServiceName,
237 [in] DWORD dwDesiredAccess,
238 [out] SC_RPC_HANDLE *phService
241 /* Windows function 0x11 must be using a different prototype - not compatible */
242 DWORD svcctl_QueryServiceConfigW(
243 [in] SC_RPC_HANDLE hService,
244 [out] QUERY_SERVICE_CONFIGW *config);
246 /* Not compatible with Windows function 0x12 */
247 DWORD svcctl_QueryServiceLockStatusW(/* FIXME */);
249 /* Untested with Windows function 0x13 */
250 DWORD svcctl_StartServiceW(
251 [in] SC_RPC_HANDLE hService,
252 [in] DWORD dwNumServiceArgs,
253 [in,unique,size_is(dwNumServiceArgs)] LPCWSTR *lpServiceArgVectors
256 /* Compatible with Windows function 0x14 */
257 DWORD svcctl_GetServiceDisplayNameW(
258 [in] SC_RPC_HANDLE hSCManager,
259 [in] LPCWSTR lpServiceName,
260 [out,string,size_is(*cchBufSize+1)] WCHAR lpBuffer[],
261 [in,out] DWORD *cchBufSize);
263 /* Compatible with Windows function 0x15 */
264 DWORD svcctl_GetServiceKeyNameW(
265 [in] SC_RPC_HANDLE hSCManager,
266 [in] LPCWSTR lpServiceDisplayName,
267 [out,string,size_is(*cchBufSize+1)] WCHAR lpBuffer[],
268 [in,out] DWORD *cchBufSize);
270 /* Not compatible with Windows function 0x16 */
271 DWORD svcctl_SCSetServiceBitsA(/* FIXME */);
273 /* Not compatible with Windows function 0x17 */
274 DWORD svcctl_ChangeServiceConfigA(/* FIXME */);
276 /* Not compatible with Windows function 0x18 */
277 DWORD svcctl_CreateServiceA(/* FIXME */);
279 /* Not compatible with Windows function 0x19 */
280 DWORD svcctl_EnumDependentServicesA(/* FIXME */);
282 /* Not compatible with Windows function 0x1a */
283 DWORD svcctl_EnumServicesStatusA(/* FIXME */);
285 /* Not compatible with Windows function 0x1b */
286 DWORD svcctl_OpenSCManagerA(/* FIXME */);
288 /* Not compatible with Windows function 0x1c */
289 DWORD svcctl_OpenServiceA(/* FIXME */);
291 /* Not compatible with Windows function 0x1d */
292 DWORD svcctl_QueryServiceConfigA(/* FIXME */);
294 /* Not compatible with Windows function 0x1e */
295 DWORD svcctl_QueryServiceLockStatusA(/* FIXME */);
297 /* Not compatible with Windows function 0x1f */
298 DWORD svcctl_StartServiceA(/* FIXME */);
300 /* Not compatible with Windows function 0x20 */
301 DWORD svcctl_GetServiceDisplayNameA(/* FIXME */);
303 /* Not compatible with Windows function 0x21 */
304 DWORD svcctl_GetServiceKeyNameA(/* FIXME */);
306 /* Not compatible with Windows function 0x22 */
307 DWORD svcctl_GetCurrentGroupStateW(/* FIXME */);
309 /* Not compatible with Windows function 0x23 */
310 DWORD svcctl_EnumServiceGroupW(/* FIXME */);
312 /* Not compatible with Windows function 0x24 */
313 DWORD svcctl_ChangeServiceConfig2A(/* FIXME */);
315 /* Untested with Windows function 0x25 */
316 DWORD svcctl_ChangeServiceConfig2W(
317 [in] SC_RPC_HANDLE hService,
318 [in] DWORD InfoLevel,
319 [in,switch_is(InfoLevel)] SERVICE_CONFIG2W *config );
321 /* Not compatible with Windows function 0x26 */
322 DWORD svcctl_QueryServiceConfig2A(/* FIXME */);
324 /* Untested with Windows function 0x27 */
325 DWORD svcctl_QueryServiceConfig2W(
326 [in] SC_RPC_HANDLE hService,
327 [in] DWORD InfoLevel,
328 [out,size_is(cbBufSize)] BYTE lpBuffer[],
329 [in] DWORD cbBufSize,
330 [out] LPDWORD pcbBytesNeeded
333 /* Untested with Windows function 0x28 */
334 DWORD svcctl_QueryServiceStatusEx(
335 [in] SC_RPC_HANDLE hService,
336 [in] SC_STATUS_TYPE InfoLevel,
337 [out,size_is(cbBufSize)] BYTE *lpBuffer,
338 [in] DWORD cbBufSize,
339 [out] LPDWORD pcbBytesNeeded