1 | /*
|
---|
2 | * svcctl interface definitions - exported by services.exe to access the
|
---|
3 | * services database
|
---|
4 | *
|
---|
5 | * Copyright 2007 Google (Mikolaj Zalewski)
|
---|
6 | *
|
---|
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.
|
---|
11 | *
|
---|
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.
|
---|
16 | *
|
---|
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
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
24 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
25 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
26 | * a choice of LGPL license versions is made available with the language indicating
|
---|
27 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
28 | * of the LGPL is applied is otherwise unspecified.
|
---|
29 | */
|
---|
30 |
|
---|
31 | import "wtypes.idl";
|
---|
32 |
|
---|
33 | /*
|
---|
34 | * some defined for the C code
|
---|
35 | */
|
---|
36 | cpp_quote("#include \"winsvc.h\"")
|
---|
37 | cpp_quote("#define SVCCTL_TRANSPORT {'n','c','a','c','n','_','n','p',0}")
|
---|
38 | cpp_quote("#define SVCCTL_ENDPOINT {'\\\\','p','i','p','e','\\\\','s','v','c','c','t','l',0}")
|
---|
39 |
|
---|
40 | /* Not the Windows event name - if needed the true one can be found in Inside Windows */
|
---|
41 | cpp_quote("#define SVCCTL_STARTED_EVENT {'_','_','w','i','n','e','_','S','v','c','c','t','l','S','t','a','r','t','e','d',0}")
|
---|
42 |
|
---|
43 | /* Service startup protocol over control pipe - not compatible with Windows */
|
---|
44 | enum service_pipe_command
|
---|
45 | {
|
---|
46 | WINESERV_STARTINFO = 1,
|
---|
47 | WINESERV_SENDCONTROL = 2
|
---|
48 | };
|
---|
49 |
|
---|
50 | typedef struct service_start_info_t
|
---|
51 | {
|
---|
52 | enum service_pipe_command cmd; /* request code */
|
---|
53 | DWORD total_size; /* total request size */
|
---|
54 | DWORD name_size; /* size of name in data buffer */
|
---|
55 | DWORD control; /* control code */
|
---|
56 | WCHAR data[1];
|
---|
57 | } service_start_info;
|
---|
58 |
|
---|
59 | [
|
---|
60 | uuid(367abb81-9844-35f1-ad32-98f038001003),
|
---|
61 | version(2.0),
|
---|
62 | pointer_default(unique),
|
---|
63 | endpoint("ncacn_np:[\\pipe\\svcctl]")
|
---|
64 | ]
|
---|
65 | interface svcctl
|
---|
66 | {
|
---|
67 | /* handle types */
|
---|
68 | typedef [handle] LPCWSTR MACHINE_HANDLEW;
|
---|
69 | typedef [context_handle] void *SC_RPC_HANDLE;
|
---|
70 | typedef [context_handle] void *SC_RPC_LOCK;
|
---|
71 |
|
---|
72 | /* undocumented access rights */
|
---|
73 | cpp_quote("#define SERVICE_SET_STATUS 0x8000")
|
---|
74 |
|
---|
75 | cpp_quote("#if 0 /* already defined in winsvc.h */")
|
---|
76 | typedef struct _QUERY_SERVICE_CONFIGW {
|
---|
77 | DWORD dwServiceType;
|
---|
78 | DWORD dwStartType;
|
---|
79 | DWORD dwErrorControl;
|
---|
80 | [unique] LPWSTR lpBinaryPathName;
|
---|
81 | [unique] LPWSTR lpLoadOrderGroup;
|
---|
82 | DWORD dwTagId;
|
---|
83 | [unique] LPWSTR lpDependencies;
|
---|
84 | [unique] LPWSTR lpServiceStartName;
|
---|
85 | [unique] LPWSTR lpDisplayName;
|
---|
86 | } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW;
|
---|
87 |
|
---|
88 | typedef struct _SERVICE_STATUS {
|
---|
89 | DWORD dwServiceType;
|
---|
90 | DWORD dwCurrentState;
|
---|
91 | DWORD dwControlsAccepted;
|
---|
92 | DWORD dwWin32ExitCode;
|
---|
93 | DWORD dwServiceSpecificExitCode;
|
---|
94 | DWORD dwCheckPoint;
|
---|
95 | DWORD dwWaitHint;
|
---|
96 | } SERVICE_STATUS, *LPSERVICE_STATUS;
|
---|
97 |
|
---|
98 | typedef enum _SC_STATUS_TYPE {
|
---|
99 | SC_STATUS_PROCESS_INFO = 0
|
---|
100 | } SC_STATUS_TYPE;
|
---|
101 |
|
---|
102 | typedef struct _SERVICE_DESCRIPTIONW {
|
---|
103 | LPWSTR lpDescription;
|
---|
104 | } SERVICE_DESCRIPTIONW,*LPSERVICE_DESCRIPTIONW;
|
---|
105 |
|
---|
106 | typedef enum _SC_ACTION_TYPE {
|
---|
107 | SC_ACTION_NONE = 0,
|
---|
108 | SC_ACTION_RESTART = 1,
|
---|
109 | SC_ACTION_REBOOT = 2,
|
---|
110 | SC_ACTION_RUN_COMMAND = 3
|
---|
111 | } SC_ACTION_TYPE;
|
---|
112 |
|
---|
113 | typedef struct _SC_ACTION {
|
---|
114 | SC_ACTION_TYPE Type;
|
---|
115 | DWORD Delay;
|
---|
116 | } SC_ACTION,*LPSC_ACTION;
|
---|
117 |
|
---|
118 | typedef struct _SERVICE_FAILURE_ACTIONSW {
|
---|
119 | DWORD dwResetPeriod;
|
---|
120 | [unique] LPWSTR lpRebootMsg;
|
---|
121 | [unique] LPWSTR lpCommand;
|
---|
122 | DWORD cActions;
|
---|
123 | [size_is(cActions)] SC_ACTION *lpsaActions;
|
---|
124 | } SERVICE_FAILURE_ACTIONSW,*LPSERVICE_FAILURE_ACTIONSW;
|
---|
125 |
|
---|
126 | #define SERVICE_CONFIG_DESCRIPTION 1
|
---|
127 | #define SERVICE_CONFIG_FAILURE_ACTIONS 2
|
---|
128 | #define SERVICE_CONFIG_DELAYED_AUTO_START_INFO 3
|
---|
129 | #define SERVICE_CONFIG_FAILURE_ACTIONS_FLAG 4
|
---|
130 | #define SERVICE_CONFIG_SERVICE_SID_INFO 5
|
---|
131 | #define SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO 6
|
---|
132 | #define SERVICE_CONFIG_PRESHUTDOWN_INFO 7
|
---|
133 |
|
---|
134 | cpp_quote("#endif")
|
---|
135 |
|
---|
136 | typedef [switch_type(DWORD)] union
|
---|
137 | {
|
---|
138 | [case (SERVICE_CONFIG_DESCRIPTION)] SERVICE_DESCRIPTIONW descr;
|
---|
139 | [case (SERVICE_CONFIG_FAILURE_ACTIONS)] SERVICE_FAILURE_ACTIONSW actions;
|
---|
140 | } SERVICE_CONFIG2W;
|
---|
141 |
|
---|
142 | /* Compatible with Windows function 0x00 */
|
---|
143 | DWORD svcctl_CloseServiceHandle(
|
---|
144 | [in,out] SC_RPC_HANDLE *handle
|
---|
145 | );
|
---|
146 |
|
---|
147 | /* Compatible with Windows function 0x01 */
|
---|
148 | DWORD svcctl_ControlService(
|
---|
149 | [in] SC_RPC_HANDLE hService,
|
---|
150 | [in] DWORD dwControl,
|
---|
151 | [out] SERVICE_STATUS *lpServiceStatus
|
---|
152 | );
|
---|
153 |
|
---|
154 | /* Compatible with Windows function 0x02 */
|
---|
155 | DWORD svcctl_DeleteService(
|
---|
156 | [in] SC_RPC_HANDLE hService
|
---|
157 | );
|
---|
158 |
|
---|
159 | /* Compatible with Windows function 0x03 */
|
---|
160 | DWORD svcctl_LockServiceDatabase(
|
---|
161 | [in] SC_RPC_HANDLE hSCManager,
|
---|
162 | [out] SC_RPC_LOCK *phLock
|
---|
163 | );
|
---|
164 |
|
---|
165 | /* Not compatible with Windows function 0x04 */
|
---|
166 | DWORD svcctl_QueryServiceObjectSecurity(/* FIXME */);
|
---|
167 |
|
---|
168 | /* Not compatible with Windows function 0x05 */
|
---|
169 | DWORD svcctl_SetServiceObjectSecurity(/* FIXME */);
|
---|
170 |
|
---|
171 | /* Not compatible with Windows function 0x06 */
|
---|
172 | DWORD svcctl_QueryServiceStatus(/* FIXME */);
|
---|
173 |
|
---|
174 | /* Compatible with Windows function 0x07 */
|
---|
175 | DWORD svcctl_SetServiceStatus(
|
---|
176 | [in] SC_RPC_HANDLE hServiceStatus,
|
---|
177 | [in] LPSERVICE_STATUS lpServiceStatus
|
---|
178 | );
|
---|
179 |
|
---|
180 | /* Compatible with Windows function 0x08 */
|
---|
181 | DWORD svcctl_UnlockServiceDatabase(
|
---|
182 | [in,out] SC_RPC_LOCK *phLock
|
---|
183 | );
|
---|
184 |
|
---|
185 | /* Not compatible with Windows function 0x09 */
|
---|
186 | DWORD svcctl_NotifyBootConfigStatus(/* FIXME */);
|
---|
187 |
|
---|
188 | /* Not compatible with Windows function 0x0a */
|
---|
189 | DWORD svcctl_SCSetServiceBitsW(/* FIXME */);
|
---|
190 |
|
---|
191 | /* Compatible with Windows function 0x0b */
|
---|
192 | DWORD svcctl_ChangeServiceConfigW(
|
---|
193 | [in] SC_RPC_HANDLE hService,
|
---|
194 | [in] DWORD dwServiceType,
|
---|
195 | [in] DWORD dwStartType,
|
---|
196 | [in] DWORD dwErrorControl,
|
---|
197 | [in,unique] LPCWSTR lpBinaryPathName,
|
---|
198 | [in,unique] LPCWSTR lpLoadOrderGroupKey,
|
---|
199 | [in,out,unique] DWORD *lpdwTagId,
|
---|
200 | [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
|
---|
201 | [in] DWORD dwDependenciesSize,
|
---|
202 | [in,unique] LPCWSTR lpServiceStartName,
|
---|
203 | [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
|
---|
204 | [in] DWORD dwPasswordSize,
|
---|
205 | [in,unique] LPCWSTR lpDisplayName
|
---|
206 | );
|
---|
207 |
|
---|
208 | /* Compatible with Windows function 0x0c */
|
---|
209 | DWORD svcctl_CreateServiceW(
|
---|
210 | [in] SC_RPC_HANDLE hSCManager,
|
---|
211 | [in] LPCWSTR lpServiceName,
|
---|
212 | [in,unique] LPCWSTR lpDisplayName,
|
---|
213 | [in] DWORD dwDesiredAccess,
|
---|
214 | [in] DWORD dwServiceType,
|
---|
215 | [in] DWORD dwStartType,
|
---|
216 | [in] DWORD dwErrorControl,
|
---|
217 | [in] LPCWSTR lpBinaryPathName,
|
---|
218 | [in,unique] LPCWSTR lpLoadOrderGroup,
|
---|
219 | [in,out,unique] DWORD *lpdwTagId,
|
---|
220 | [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
|
---|
221 | [in] DWORD dwDependenciesSize,
|
---|
222 | [in,unique] LPCWSTR lpServiceStartName,
|
---|
223 | [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
|
---|
224 | [in] DWORD dwPasswordSize,
|
---|
225 | [out] SC_RPC_HANDLE *phService
|
---|
226 | );
|
---|
227 |
|
---|
228 | /* Not compatible with Windows function 0x0d */
|
---|
229 | DWORD svcctl_EnumDependentServicesW(/* FIXME */);
|
---|
230 |
|
---|
231 | /* Not compatible with Windows function 0x0e */
|
---|
232 | DWORD svcctl_EnumServicesStatusW(/* FIXME */);
|
---|
233 |
|
---|
234 | /* Compatible with Windows function 0x0f */
|
---|
235 | DWORD svcctl_OpenSCManagerW(
|
---|
236 | [in,unique] MACHINE_HANDLEW MachineName,
|
---|
237 | [in,unique] LPCWSTR DatabaseName,
|
---|
238 | [in] DWORD dwAccessMask,
|
---|
239 | [out] SC_RPC_HANDLE *handle
|
---|
240 | );
|
---|
241 |
|
---|
242 | /* Compatible with Windows function 0x10 */
|
---|
243 | DWORD svcctl_OpenServiceW(
|
---|
244 | [in] SC_RPC_HANDLE hSCManager,
|
---|
245 | [in] LPCWSTR lpServiceName,
|
---|
246 | [in] DWORD dwDesiredAccess,
|
---|
247 | [out] SC_RPC_HANDLE *phService
|
---|
248 | );
|
---|
249 |
|
---|
250 | /* Windows function 0x11 must be using a different prototype - not compatible */
|
---|
251 | DWORD svcctl_QueryServiceConfigW(
|
---|
252 | [in] SC_RPC_HANDLE hService,
|
---|
253 | [out] QUERY_SERVICE_CONFIGW *config);
|
---|
254 |
|
---|
255 | /* Not compatible with Windows function 0x12 */
|
---|
256 | DWORD svcctl_QueryServiceLockStatusW(/* FIXME */);
|
---|
257 |
|
---|
258 | /* Untested with Windows function 0x13 */
|
---|
259 | DWORD svcctl_StartServiceW(
|
---|
260 | [in] SC_RPC_HANDLE hService,
|
---|
261 | [in] DWORD dwNumServiceArgs,
|
---|
262 | [in,unique,size_is(dwNumServiceArgs)] LPCWSTR *lpServiceArgVectors
|
---|
263 | );
|
---|
264 |
|
---|
265 | /* Compatible with Windows function 0x14 */
|
---|
266 | DWORD svcctl_GetServiceDisplayNameW(
|
---|
267 | [in] SC_RPC_HANDLE hSCManager,
|
---|
268 | [in] LPCWSTR lpServiceName,
|
---|
269 | [out,string,size_is(*cchBufSize+1)] WCHAR lpBuffer[],
|
---|
270 | [in,out] DWORD *cchBufSize);
|
---|
271 |
|
---|
272 | /* Compatible with Windows function 0x15 */
|
---|
273 | DWORD svcctl_GetServiceKeyNameW(
|
---|
274 | [in] SC_RPC_HANDLE hSCManager,
|
---|
275 | [in] LPCWSTR lpServiceDisplayName,
|
---|
276 | [out,string,size_is(*cchBufSize+1)] WCHAR lpBuffer[],
|
---|
277 | [in,out] DWORD *cchBufSize);
|
---|
278 |
|
---|
279 | /* Not compatible with Windows function 0x16 */
|
---|
280 | DWORD svcctl_SCSetServiceBitsA(/* FIXME */);
|
---|
281 |
|
---|
282 | /* Not compatible with Windows function 0x17 */
|
---|
283 | DWORD svcctl_ChangeServiceConfigA(/* FIXME */);
|
---|
284 |
|
---|
285 | /* Not compatible with Windows function 0x18 */
|
---|
286 | DWORD svcctl_CreateServiceA(/* FIXME */);
|
---|
287 |
|
---|
288 | /* Not compatible with Windows function 0x19 */
|
---|
289 | DWORD svcctl_EnumDependentServicesA(/* FIXME */);
|
---|
290 |
|
---|
291 | /* Not compatible with Windows function 0x1a */
|
---|
292 | DWORD svcctl_EnumServicesStatusA(/* FIXME */);
|
---|
293 |
|
---|
294 | /* Not compatible with Windows function 0x1b */
|
---|
295 | DWORD svcctl_OpenSCManagerA(/* FIXME */);
|
---|
296 |
|
---|
297 | /* Not compatible with Windows function 0x1c */
|
---|
298 | DWORD svcctl_OpenServiceA(/* FIXME */);
|
---|
299 |
|
---|
300 | /* Not compatible with Windows function 0x1d */
|
---|
301 | DWORD svcctl_QueryServiceConfigA(/* FIXME */);
|
---|
302 |
|
---|
303 | /* Not compatible with Windows function 0x1e */
|
---|
304 | DWORD svcctl_QueryServiceLockStatusA(/* FIXME */);
|
---|
305 |
|
---|
306 | /* Not compatible with Windows function 0x1f */
|
---|
307 | DWORD svcctl_StartServiceA(/* FIXME */);
|
---|
308 |
|
---|
309 | /* Not compatible with Windows function 0x20 */
|
---|
310 | DWORD svcctl_GetServiceDisplayNameA(/* FIXME */);
|
---|
311 |
|
---|
312 | /* Not compatible with Windows function 0x21 */
|
---|
313 | DWORD svcctl_GetServiceKeyNameA(/* FIXME */);
|
---|
314 |
|
---|
315 | /* Not compatible with Windows function 0x22 */
|
---|
316 | DWORD svcctl_GetCurrentGroupStateW(/* FIXME */);
|
---|
317 |
|
---|
318 | /* Not compatible with Windows function 0x23 */
|
---|
319 | DWORD svcctl_EnumServiceGroupW(/* FIXME */);
|
---|
320 |
|
---|
321 | /* Not compatible with Windows function 0x24 */
|
---|
322 | DWORD svcctl_ChangeServiceConfig2A(/* FIXME */);
|
---|
323 |
|
---|
324 | /* Untested with Windows function 0x25 */
|
---|
325 | DWORD svcctl_ChangeServiceConfig2W(
|
---|
326 | [in] SC_RPC_HANDLE hService,
|
---|
327 | [in] DWORD InfoLevel,
|
---|
328 | [in,switch_is(InfoLevel)] SERVICE_CONFIG2W *config );
|
---|
329 |
|
---|
330 | /* Not compatible with Windows function 0x26 */
|
---|
331 | DWORD svcctl_QueryServiceConfig2A(/* FIXME */);
|
---|
332 |
|
---|
333 | /* Untested with Windows function 0x27 */
|
---|
334 | DWORD svcctl_QueryServiceConfig2W(
|
---|
335 | [in] SC_RPC_HANDLE hService,
|
---|
336 | [in] DWORD InfoLevel,
|
---|
337 | [out,size_is(cbBufSize)] BYTE lpBuffer[],
|
---|
338 | [in] DWORD cbBufSize,
|
---|
339 | [out] LPDWORD pcbBytesNeeded
|
---|
340 | );
|
---|
341 |
|
---|
342 | /* Untested with Windows function 0x28 */
|
---|
343 | DWORD svcctl_QueryServiceStatusEx(
|
---|
344 | [in] SC_RPC_HANDLE hService,
|
---|
345 | [in] SC_STATUS_TYPE InfoLevel,
|
---|
346 | [out,size_is(cbBufSize)] BYTE *lpBuffer,
|
---|
347 | [in] DWORD cbBufSize,
|
---|
348 | [out] LPDWORD pcbBytesNeeded
|
---|
349 | );
|
---|
350 | }
|
---|