xref: /titanic_44/usr/src/uts/common/smbsrv/ndl/svcctl.ndl (revision f94275ce205810a201404c5f35f4cc96057022b1)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _MLSVC_SVCCTL_NDL_
27#define _MLSVC_SVCCTL_NDL_
28
29/*
30 * NT Service Control Services (SVCCTL) RPC interface definition.
31 * This interface provides remote access to add, remove, start and
32 * stop services.
33 */
34
35#include "ndrtypes.ndl"
36
37/* Windows NT */
38#define SVCCTL_OPNUM_Close			0x00
39#define	SVCCTL_OPNUM_ControlService		0x01
40#define	SVCCTL_OPNUM_DeleteService		0x02
41#define	SVCCTL_OPNUM_LockServiceDatabase	0x03
42#define	SVCCTL_OPNUM_QueryServiceSecurity	0x04
43#define	SVCCTL_OPNUM_SetServiceSecurity		0x05
44#define SVCCTL_OPNUM_QueryServiceStatus		0x06
45#define	SVCCTL_OPNUM_SetServiceStatus		0x07
46#define	SVCCTL_OPNUM_UnlockServiceDatabase	0x08
47#define	SVCCTL_OPNUM_NotifyBootConfigStatus	0x09
48#define	SVCCTL_OPNUM_SetServiceBits		0x0a
49#define	SVCCTL_OPNUM_ChangeServiceConfig	0x0b
50#define	SVCCTL_OPNUM_CreateService		0x0c
51#define	SVCCTL_OPNUM_EnumDependentServices	0x0d
52#define SVCCTL_OPNUM_EnumServicesStatus		0x0E
53#define SVCCTL_OPNUM_OpenManager		0x0F
54#define SVCCTL_OPNUM_OpenService		0x10
55#define SVCCTL_OPNUM_QueryServiceConfig		0x11
56#define	SVCCTL_OPNUM_QueryServiceLockStatus	0x12
57#define	SVCCTL_OPNUM_StartService		0x13
58#define	SVCCTL_OPNUM_GetServiceDisplayNameW	0x14
59#define	SVCCTL_OPNUM_GetServiceKeyNameW		0x15
60#define	SVCCTL_OPNUM_SetServiceBitsA		0x16
61#define	SVCCTL_OPNUM_ChangeServiceConfigA	0x17
62#define	SVCCTL_OPNUM_CreateServiceA		0x18
63#define	SVCCTL_OPNUM_EnumDependentServicesA	0x19
64#define	SVCCTL_OPNUM_EnumServicesStatusA	0x1a
65#define	SVCCTL_OPNUM_OpenSCManagerA		0x1b
66#define	SVCCTL_OPNUM_OpenServiceA		0x1c
67#define	SVCCTL_OPNUM_QueryServiceConfigA	0x1d
68#define	SVCCTL_OPNUM_QueryServiceLockStatusA	0x1e
69#define	SVCCTL_OPNUM_StartServiceA		0x1f
70#define	SVCCTL_OPNUM_GetServiceDisplayNameA	0x20
71#define	SVCCTL_OPNUM_GetServiceKeyNameA		0x21
72#define	SVCCTL_OPNUM_GetCurrentGroupStateW	0x22
73#define	SVCCTL_OPNUM_EnumServiceGroupW		0x23
74#define	SVCCTL_OPNUM_ChangeServiceConfig2A	0x24
75#define	SVCCTL_OPNUM_ChangeServiceConfig2W	0x25
76#define	SVCCTL_OPNUM_QueryServiceConfig2A	0x26
77
78/* Windows 2000 */
79#define	SVCCTL_OPNUM_QueryServiceConfig2W	0x27
80#define	SVCCTL_OPNUM_QueryServiceStatusEx	0x28
81#define	SVCCTL_OPNUM_EnumServicesStatusExA	0x29
82#define	SVCCTL_OPNUM_EnumServicesStatusExW	0x2a
83
84/* Windows XP and Windows Server 2003 */
85#define	SVCCTL_OPNUM_SendTSMessage		0x2b
86
87/* Windows Vista */
88#define	SVCCTL_OPNUM_CreateServiceWOW64A	0x2c
89#define	SVCCTL_OPNUM_CreateServiceWOW64W	0x2d
90#define	SVCCTL_OPNUM_QueryServiceTagInfo	0x2e
91#define	SVCCTL_OPNUM_NotifyServiceStatusChange	0x2f
92#define	SVCCTL_OPNUM_GetNotifyResult		0x30
93#define	SVCCTL_OPNUM_CloseNotifyHandle		0x31
94#define	SVCCTL_OPNUM_ControlServiceExA		0x32
95#define	SVCCTL_OPNUM_ControlServiceExW		0x33
96#define	SVCCTL_OPNUM_SendPnPMessage		0x34
97#define	SVCCTL_OPNUM_ValidatePnPService		0x35
98#define	SVCCTL_OPNUM_OpenServiceStatusHandle	0x36
99
100CONTEXT_HANDLE(svcctl_handle) svcctl_handle_t;
101
102/*
103 * String definition for the ASCII interface.
104 */
105struct svcctl_value {
106	DWORD	vc_first_is;	/* 0 */
107	DWORD	vc_length_is;
108    SIZE_IS(vc_length_is)
109	BYTE	value[ANY_SIZE_ARRAY];
110};
111
112/*
113 * The svc_status (SERVICE_STATUS) structure contains information about a
114 * service. The ControlService, EnumDependentServices, EnumServicesStatus,
115 * and QueryServiceStatus functions use this structure to return information
116 * about a service. A service uses this structure in the SetServiceStatus
117 * function to report its current status to the service control manager.
118 *
119 * service_type
120 *	The type of service. This member can be one of the following values.
121 *
122 *      SERVICE_FILE_SYSTEM_DRIVER
123 *      SERVICE_KERNEL_DRIVER
124 *      SERVICE_WIN32_OWN_PROCESS
125 *      SERVICE_WIN32_SHARE_PROCESS
126 *
127 * If the service type is either SERVICE_WIN32_OWN_PROCESS or
128 * SERVICE_WIN32_SHARE_PROCESS, and the service is running in
129 * the context of the LocalSystem account, the following type
130 * may also be specified to indicate that the service can
131 * interact with the desktop.
132 *
133 *      SERVICE_INTERACTIVE_PROCESS
134 *
135 * cur_state
136 *	The current state of the service. This member can be one of the
137 *	following values.
138 *
139 *      SERVICE_CONTINUE_PENDING
140 *      SERVICE_PAUSE_PENDING
141 *      SERVICE_PAUSED
142 *      SERVICE_RUNNING
143 *      SERVICE_START_PENDING
144 *      SERVICE_STOP_PENDING
145 *      SERVICE_STOPPED
146 *
147 * ctrl_accepted
148 *	The control codes that the service will accept and process in its
149 *	handler function (see Handler and HandlerEx). A user interface
150 *	process can control a service by specifying a control command in
151 *	the ControlService function. By default, all services accept the
152 *	SERVICE_CONTROL_INTERROGATE value. The following are the control
153 *	codes.
154 *
155 *      SERVICE_ACCEPT_STOP
156 *      SERVICE_ACCEPT_PAUSE_CONTINUE
157 *      SERVICE_ACCEPT_SHUTDOWN
158 *      SERVICE_ACCEPT_PARAMCHANGE
159 *      SERVICE_ACCEPT_NETBINDCHANGE
160 *
161 * w32_exitcode
162 *  An error code that the service uses to report an error that occurs when
163 *  it is starting or stopping. To return an error code specific to the
164 *  service, the service must set this value to ERROR_SERVICE_SPECIFIC_ERROR
165 *  to indicate that the dwServiceSpecificExitCode member contains the error
166 *  code. The service should set this value to NO_ERROR when it is running
167 *  and on normal termination.
168 *
169 * svc_specified_exitcode
170 *  A service-specific error code that the service returns when an error
171 *  occurs while the service is starting or stopping. This value is ignored
172 *  unless the w32_exitcode member is set to ERROR_SERVICE_SPECIFIC_ERROR.
173 *
174 * check_point
175 *  A value that the service increments periodically to report its progress
176 *  during a lengthy start, stop, pause, or continue operation. For example,
177 *  the service should increment this value as it completes each step of its
178 *  initialization when it is starting up. The user interface program that
179 *  invoked the operation on the service uses this value to track the progress
180 *  of the service during a lengthy operation. This value is not valid and
181 *  should be zero when the service does not have a start, stop, pause, or
182 *  continue operation pending.
183 *
184 * wait_hint
185 *  An estimate of the amount of time, in milliseconds, that the service
186 *  expects a pending start, stop, pause, or continue operation to take
187 *  before the service makes its next call to the SetServiceStatus
188 *  function with either an incremented check_point value or a change in
189 *  dwCurrentState. If the amount of time specified by wait_hint passes,
190 *  and check_point has not been incremented, or cur_state has not changed,
191 *  the service control manager or service control program can assume that
192 *  an error has occurred and the service should be stopped.
193 */
194struct svc_status {
195	DWORD service_type;
196	DWORD cur_state;
197	DWORD ctrl_accepted;
198	DWORD w32_exitcode;
199	DWORD svc_specified_exitcode;
200	DWORD check_point;
201	DWORD wait_hint;
202};
203typedef struct svc_status svc_status_t;
204
205struct svc_enum_status {
206	DWORD svc_name;		/* offset within response buffer */
207	DWORD display_name;	/* offset within response buffer */
208	svc_status_t svc_status;
209};
210typedef struct svc_enum_status svc_enum_status_t;
211
212struct svc_config {
213	DWORD  service_type;
214	DWORD  start_type;
215	DWORD  error_control;
216	LPTSTR binary_pathname;
217	LPTSTR loadorder_group;
218	DWORD  tag_id;
219	LPTSTR dependencies;
220	LPTSTR service_startname;
221	LPTSTR display_name;
222};
223typedef struct svc_config svc_config_t;
224
225struct svc_failure_actions {
226	DWORD reset_period;
227	DWORD rebootmsg_offset;
228	DWORD command_offset;
229	DWORD actions;
230	DWORD actions_offset;
231};
232typedef struct svc_failure_actions svc_failure_actions_t;
233
234struct svc_description {
235	DWORD desc;		/* offset of description string */
236};
237typedef struct svc_description svc_description_t;
238
239/*
240 ***********************************************************************
241 * Close
242 ***********************************************************************
243 */
244OPERATION(SVCCTL_OPNUM_Close)
245struct svcctl_Close {
246	IN		svcctl_handle_t handle;
247	OUT		svcctl_handle_t result_handle;
248	OUT		DWORD status;
249};
250
251/*
252 ***********************************************************************
253 * ControlService
254 ***********************************************************************
255 */
256OPERATION(SVCCTL_OPNUM_ControlService)
257struct svcctl_ControlService {
258	IN		svcctl_handle_t service_handle;
259	IN		DWORD control;
260	OUT		svc_status_t service_status;
261	OUT		DWORD status;
262};
263
264/*
265 ***********************************************************************
266 * DeleteService
267 ***********************************************************************
268 */
269OPERATION(SVCCTL_OPNUM_DeleteService)
270struct svcctl_DeleteService {
271	IN		svcctl_handle_t service_handle;
272	OUT		DWORD status;
273};
274
275/*
276 ***********************************************************************
277 * QueryServiceSecurity
278 ***********************************************************************
279 */
280OPERATION(SVCCTL_OPNUM_QueryServiceSecurity)
281struct svcctl_QueryServiceSecurity {
282	IN		svcctl_handle_t service_handle;
283	IN		DWORD security_info;
284	IN		DWORD buf_size;
285    SIZE_IS(buf_size)
286	OUT REFERENCE	LPBYTE buffer;
287	OUT		DWORD bytes_needed;
288	OUT		DWORD status;
289};
290
291/*
292 ***********************************************************************
293 * SetServiceSecurity
294 ***********************************************************************
295 */
296OPERATION(SVCCTL_OPNUM_SetServiceSecurity)
297struct svcctl_SetServiceSecurity {
298	IN		svcctl_handle_t service_handle;
299	IN		DWORD security_info;
300    SIZE_IS(buf_size)
301	IN REFERENCE	LPBYTE buffer;
302	IN		DWORD buf_size;
303	OUT		DWORD status;
304};
305
306/*
307 ***********************************************************************
308 * OpenManager
309 ***********************************************************************
310 */
311OPERATION(SVCCTL_OPNUM_OpenManager)
312struct svcctl_OpenManager {
313	IN		LPTSTR machine_name;
314	IN		LPTSTR database_name;
315	IN		DWORD desired_access;
316	OUT		svcctl_handle_t handle;
317	OUT		DWORD status;
318};
319
320
321/*
322 ***********************************************************************
323 * OpenService
324 ***********************************************************************
325 */
326OPERATION(SVCCTL_OPNUM_OpenService)
327struct svcctl_OpenService {
328	IN		svcctl_handle_t manager_handle;
329	IN REFERENCE	LPTSTR service_name;
330	IN		DWORD desired_access;
331	OUT		svcctl_handle_t service_handle;
332	OUT		DWORD status;
333};
334
335
336/*
337 ***********************************************************************
338 * QueryServiceStatus
339 ***********************************************************************
340 */
341OPERATION(SVCCTL_OPNUM_QueryServiceStatus)
342struct svcctl_QueryServiceStatus {
343	IN		svcctl_handle_t service_handle;
344	OUT		svc_status_t service_status;
345	OUT		DWORD status;
346};
347
348/*
349 ***********************************************************************
350 * EnumDependentServices
351 ***********************************************************************
352 */
353OPERATION(SVCCTL_OPNUM_EnumDependentServices)
354struct svcctl_EnumDependentServices {
355	IN		svcctl_handle_t service_handle;
356	IN		DWORD svc_state;
357	IN		DWORD buf_size;
358    SIZE_IS(buf_size)
359	OUT REFERENCE	LPBYTE services;
360	OUT		DWORD bytes_needed;
361	OUT		DWORD svc_num;
362	OUT		DWORD status;
363};
364
365/*
366 ***********************************************************************
367 * EnumServicesStatus
368 ***********************************************************************
369 */
370OPERATION(SVCCTL_OPNUM_EnumServicesStatus)
371struct svcctl_EnumServicesStatus {
372	IN		svcctl_handle_t manager_handle;
373	IN		DWORD svc_type;
374	IN		DWORD svc_state;
375	IN		DWORD buf_size;
376    SIZE_IS(buf_size)
377	OUT REFERENCE	LPBYTE services;
378	OUT		DWORD bytes_needed;
379	OUT		DWORD svc_num;
380	INOUT		DWORD *resume_handle;
381	OUT		DWORD status;
382};
383
384/*
385 ***********************************************************************
386 * QueryServiceConfig
387 ***********************************************************************
388 */
389OPERATION(SVCCTL_OPNUM_QueryServiceConfig)
390struct svcctl_QueryServiceConfig {
391	IN		svcctl_handle_t service_handle;
392	IN		DWORD buf_size;
393	OUT		svc_config_t service_cfg;
394	OUT		DWORD cfg_bytes;
395	OUT		DWORD status;
396};
397
398/*
399 ***********************************************************************
400 * StartService
401 *
402 * argc:	The number of strings in argv.  If argv is NULL,
403 *		argc may be 0.
404 * argv:	A pointer to a buffer containing an array of
405 *		null-terminated Unicode strings.
406 *
407 * For service management support, this should probably be:
408 *	IN		DWORD argc;
409 *    SIZE_IS(buf_size)
410 *	IN REFERENCE	LPBYTE argv;
411 ***********************************************************************
412 */
413OPERATION(SVCCTL_OPNUM_StartService)
414struct svcctl_StartService {
415	IN		svcctl_handle_t service_handle;
416	IN		DWORD argc;
417	IN		DWORD argv;
418	OUT		DWORD status;
419};
420
421/*
422 ***********************************************************************
423 * GetServiceDisplayNameW
424 ***********************************************************************
425 */
426OPERATION(SVCCTL_OPNUM_GetServiceDisplayNameW)
427struct svcctl_GetServiceDisplayNameW {
428	IN		svcctl_handle_t manager_handle;
429	IN REFERENCE	LPTSTR service_name;
430	OUT REFERENCE	LPTSTR display_name;
431	INOUT		DWORD buf_size;
432	OUT		DWORD status;
433};
434
435/*
436 ***********************************************************************
437 * GetServiceKeyNameW
438 ***********************************************************************
439 */
440OPERATION(SVCCTL_OPNUM_GetServiceKeyNameW)
441struct svcctl_GetServiceKeyNameW {
442	IN		svcctl_handle_t manager_handle;
443	IN REFERENCE	LPTSTR service_name;
444	OUT REFERENCE	LPTSTR key_name;
445	INOUT		DWORD buf_size;
446	OUT		DWORD status;
447};
448
449/*
450 ***********************************************************************
451 * OpenSCManagerA
452 ***********************************************************************
453 */
454OPERATION(SVCCTL_OPNUM_OpenSCManagerA)
455struct svcctl_OpenSCManagerA {
456	IN		struct svcctl_value *machine_name;
457	IN		struct svcctl_value *database_name;
458	IN		DWORD desired_access;
459	OUT		svcctl_handle_t handle;
460	OUT		DWORD status;
461};
462
463/*
464 ***********************************************************************
465 * OpenServiceA
466 ***********************************************************************
467 */
468OPERATION(SVCCTL_OPNUM_OpenServiceA)
469struct svcctl_OpenServiceA {
470	IN		svcctl_handle_t manager_handle;
471	IN REFERENCE	struct svcctl_value *service_name;
472	IN		DWORD desired_access;
473	OUT		svcctl_handle_t service_handle;
474	OUT		DWORD status;
475};
476
477/*
478 ***********************************************************************
479 * EnumServicesStatusA
480 ***********************************************************************
481 */
482OPERATION(SVCCTL_OPNUM_EnumServicesStatusA)
483struct svcctl_EnumServicesStatusA {
484	IN		svcctl_handle_t manager_handle;
485	IN		DWORD svc_type;
486	IN		DWORD svc_state;
487	IN		DWORD buf_size;
488    SIZE_IS(buf_size)
489	OUT REFERENCE	LPBYTE services;
490	OUT		DWORD bytes_needed;
491	OUT		DWORD svc_num;
492	INOUT		DWORD *resume_handle;
493	OUT		DWORD status;
494};
495
496/*
497 ***********************************************************************
498 * QueryServiceConfig2W
499 ***********************************************************************
500 */
501OPERATION(SVCCTL_OPNUM_QueryServiceConfig2W)
502struct svcctl_QueryServiceConfig2W {
503	IN		svcctl_handle_t service_handle;
504	IN		DWORD info_level;
505	IN		DWORD buf_size;
506    SIZE_IS(buf_size)
507	OUT REFERENCE	LPBYTE buffer;
508	OUT		DWORD bytes_needed;
509	OUT		DWORD status;
510};
511
512/*
513 ***********************************************************************
514 * QueryServiceStatusEx
515 ***********************************************************************
516 */
517struct svc_status_ex {
518	DWORD service_type;
519	DWORD cur_state;
520	DWORD ctrl_accepted;
521	DWORD w32_exitcode;
522	DWORD svc_specified_exitcode;
523	DWORD check_point;
524	DWORD wait_hint;
525	DWORD process_id;
526	DWORD service_flags;
527};
528typedef struct svc_status_ex svc_status_ex_t;
529
530OPERATION(SVCCTL_OPNUM_QueryServiceStatusEx)
531struct svcctl_QueryServiceStatusEx {
532	IN		svcctl_handle_t service_handle;
533	IN		DWORD info_level;
534	IN		DWORD buf_size;
535    SIZE_IS(buf_size)
536	OUT REFERENCE	LPBYTE buffer;
537	OUT		DWORD bytes_needed;
538	OUT		DWORD status;
539};
540
541/*
542 ***********************************************************************
543 * The SVCCTL interface definition.
544 ***********************************************************************
545 */
546INTERFACE(0)
547union svcctl_interface {
548	CASE(SVCCTL_OPNUM_Close)
549		struct svcctl_Close			SvcClose;
550	CASE(SVCCTL_OPNUM_ControlService)
551		struct svcctl_ControlService		SvcControlService;
552	CASE(SVCCTL_OPNUM_DeleteService)
553		struct svcctl_DeleteService		SvcDeleteService;
554	CASE(SVCCTL_OPNUM_QueryServiceSecurity)
555		struct svcctl_QueryServiceSecurity	SvcQueryServiceSecurity;
556	CASE(SVCCTL_OPNUM_SetServiceSecurity)
557		struct svcctl_SetServiceSecurity	SvcSetServiceSecurity;
558	CASE(SVCCTL_OPNUM_OpenManager)
559		struct svcctl_OpenManager		SvcOpenManager;
560	CASE(SVCCTL_OPNUM_OpenService)
561		struct svcctl_OpenService		SvcOpenService;
562	CASE(SVCCTL_OPNUM_QueryServiceStatus)
563		struct svcctl_QueryServiceStatus	SvcQueryServiceStatus;
564	CASE(SVCCTL_OPNUM_EnumDependentServices)
565		struct svcctl_EnumDependentServices Svc_EnumDependentServices;
566	CASE(SVCCTL_OPNUM_EnumServicesStatus)
567		struct svcctl_EnumServicesStatus	SvcEnumServicesStatus;
568	CASE(SVCCTL_OPNUM_QueryServiceConfig)
569		struct svcctl_QueryServiceConfig	SvcQueryServiceConfig;
570	CASE(SVCCTL_OPNUM_StartService)
571		struct svcctl_StartService		SvcStartService;
572	CASE(SVCCTL_OPNUM_GetServiceDisplayNameW)
573		struct svcctl_GetServiceDisplayNameW SvcGetServiceDisplayNameW;
574	CASE(SVCCTL_OPNUM_GetServiceKeyNameW)
575		struct svcctl_GetServiceKeyNameW	SvcGetServiceKeyNameW;
576	CASE(SVCCTL_OPNUM_OpenSCManagerA)
577		struct svcctl_OpenSCManagerA		SvcOpenSCManagerA;
578	CASE(SVCCTL_OPNUM_OpenServiceA)
579		struct svcctl_OpenServiceA		SvcOpenServiceA;
580	CASE(SVCCTL_OPNUM_EnumServicesStatusA)
581		struct svcctl_EnumServicesStatusA	SvcEnumServicesStatusA;
582	CASE(SVCCTL_OPNUM_QueryServiceConfig2W)
583		struct svcctl_QueryServiceConfig2W	SvcQueryServiceConfig2W;
584	CASE(SVCCTL_OPNUM_QueryServiceStatusEx)
585		struct svcctl_QueryServiceStatusEx	SvcQueryServiceStatusEx;
586};
587
588typedef union svcctl_interface	svcctl_interface_t;
589EXTERNTYPEINFO(svcctl_interface)
590
591
592#endif /* _MLSVC_SVCCTL_NDL_ */
593