xref: /titanic_50/usr/src/uts/common/smbsrv/ndl/svcctl.ndl (revision b56bf881a9655cb27b53cba1468312f7c6dfb0a2)
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/* Boolean flag to control delayed start of service. Set 1=true, 0=false */
240struct svc_delayed_auto_start {
241	DWORD dstart;
242};
243typedef struct svc_delayed_auto_start svc_delayed_auto_start_t;
244
245/* Boolean flag to control configured failure action. Set 1=true, 0=false */
246struct svc_config_failure_action {
247	DWORD cfa;
248};
249typedef struct svc_config_failure_action svc_config_failure_action_t;
250
251/*
252 ***********************************************************************
253 * Close
254 ***********************************************************************
255 */
256OPERATION(SVCCTL_OPNUM_Close)
257struct svcctl_Close {
258	IN		svcctl_handle_t handle;
259	OUT		svcctl_handle_t result_handle;
260	OUT		DWORD status;
261};
262
263/*
264 ***********************************************************************
265 * ControlService
266 ***********************************************************************
267 */
268OPERATION(SVCCTL_OPNUM_ControlService)
269struct svcctl_ControlService {
270	IN		svcctl_handle_t service_handle;
271	IN		DWORD control;
272	OUT		svc_status_t service_status;
273	OUT		DWORD status;
274};
275
276/*
277 ***********************************************************************
278 * DeleteService
279 ***********************************************************************
280 */
281OPERATION(SVCCTL_OPNUM_DeleteService)
282struct svcctl_DeleteService {
283	IN		svcctl_handle_t service_handle;
284	OUT		DWORD status;
285};
286
287/*
288 ***********************************************************************
289 * QueryServiceSecurity
290 ***********************************************************************
291 */
292OPERATION(SVCCTL_OPNUM_QueryServiceSecurity)
293struct svcctl_QueryServiceSecurity {
294	IN		svcctl_handle_t service_handle;
295	IN		DWORD security_info;
296	IN		DWORD buf_size;
297    SIZE_IS(buf_size)
298	OUT REFERENCE	LPBYTE buffer;
299	OUT		DWORD bytes_needed;
300	OUT		DWORD status;
301};
302
303/*
304 ***********************************************************************
305 * SetServiceSecurity
306 ***********************************************************************
307 */
308OPERATION(SVCCTL_OPNUM_SetServiceSecurity)
309struct svcctl_SetServiceSecurity {
310	IN		svcctl_handle_t service_handle;
311	IN		DWORD security_info;
312    SIZE_IS(buf_size)
313	IN REFERENCE	LPBYTE buffer;
314	IN		DWORD buf_size;
315	OUT		DWORD status;
316};
317
318/*
319 ***********************************************************************
320 * OpenManager
321 ***********************************************************************
322 */
323OPERATION(SVCCTL_OPNUM_OpenManager)
324struct svcctl_OpenManager {
325	IN		LPTSTR machine_name;
326	IN		LPTSTR database_name;
327	IN		DWORD desired_access;
328	OUT		svcctl_handle_t handle;
329	OUT		DWORD status;
330};
331
332
333/*
334 ***********************************************************************
335 * OpenService
336 ***********************************************************************
337 */
338OPERATION(SVCCTL_OPNUM_OpenService)
339struct svcctl_OpenService {
340	IN		svcctl_handle_t manager_handle;
341	IN REFERENCE	LPTSTR service_name;
342	IN		DWORD desired_access;
343	OUT		svcctl_handle_t service_handle;
344	OUT		DWORD status;
345};
346
347
348/*
349 ***********************************************************************
350 * QueryServiceStatus
351 ***********************************************************************
352 */
353OPERATION(SVCCTL_OPNUM_QueryServiceStatus)
354struct svcctl_QueryServiceStatus {
355	IN		svcctl_handle_t service_handle;
356	OUT		svc_status_t service_status;
357	OUT		DWORD status;
358};
359
360/*
361 ***********************************************************************
362 * EnumDependentServices
363 ***********************************************************************
364 */
365OPERATION(SVCCTL_OPNUM_EnumDependentServices)
366struct svcctl_EnumDependentServices {
367	IN		svcctl_handle_t service_handle;
368	IN		DWORD svc_state;
369	IN		DWORD buf_size;
370    SIZE_IS(buf_size)
371	OUT REFERENCE	LPBYTE services;
372	OUT		DWORD bytes_needed;
373	OUT		DWORD svc_num;
374	OUT		DWORD status;
375};
376
377/*
378 ***********************************************************************
379 * EnumServicesStatus
380 ***********************************************************************
381 */
382OPERATION(SVCCTL_OPNUM_EnumServicesStatus)
383struct svcctl_EnumServicesStatus {
384	IN		svcctl_handle_t manager_handle;
385	IN		DWORD svc_type;
386	IN		DWORD svc_state;
387	IN		DWORD buf_size;
388    SIZE_IS(buf_size)
389	OUT REFERENCE	LPBYTE services;
390	OUT		DWORD bytes_needed;
391	OUT		DWORD svc_num;
392	INOUT		DWORD *resume_handle;
393	OUT		DWORD status;
394};
395
396/*
397 ***********************************************************************
398 * QueryServiceConfig
399 ***********************************************************************
400 */
401OPERATION(SVCCTL_OPNUM_QueryServiceConfig)
402struct svcctl_QueryServiceConfig {
403	IN		svcctl_handle_t service_handle;
404	IN		DWORD buf_size;
405	OUT		svc_config_t service_cfg;
406	OUT		DWORD cfg_bytes;
407	OUT		DWORD status;
408};
409
410/*
411 ***********************************************************************
412 * StartService
413 *
414 * argc:	The number of strings in argv.  If argv is NULL,
415 *		argc may be 0.
416 * argv:	A pointer to a buffer containing an array of
417 *		null-terminated Unicode strings.
418 *
419 * For service management support, this should probably be:
420 *	IN		DWORD argc;
421 *    SIZE_IS(buf_size)
422 *	IN REFERENCE	LPBYTE argv;
423 ***********************************************************************
424 */
425OPERATION(SVCCTL_OPNUM_StartService)
426struct svcctl_StartService {
427	IN		svcctl_handle_t service_handle;
428	IN		DWORD argc;
429	IN		DWORD argv;
430	OUT		DWORD status;
431};
432
433/*
434 ***********************************************************************
435 * GetServiceDisplayNameW
436 ***********************************************************************
437 */
438OPERATION(SVCCTL_OPNUM_GetServiceDisplayNameW)
439struct svcctl_GetServiceDisplayNameW {
440	IN		svcctl_handle_t manager_handle;
441	IN REFERENCE	LPTSTR service_name;
442	OUT REFERENCE	LPTSTR display_name;
443	INOUT		DWORD buf_size;
444	OUT		DWORD status;
445};
446
447/*
448 ***********************************************************************
449 * GetServiceKeyNameW
450 ***********************************************************************
451 */
452OPERATION(SVCCTL_OPNUM_GetServiceKeyNameW)
453struct svcctl_GetServiceKeyNameW {
454	IN		svcctl_handle_t manager_handle;
455	IN REFERENCE	LPTSTR service_name;
456	OUT REFERENCE	LPTSTR key_name;
457	INOUT		DWORD buf_size;
458	OUT		DWORD status;
459};
460
461/*
462 ***********************************************************************
463 * OpenSCManagerA
464 ***********************************************************************
465 */
466OPERATION(SVCCTL_OPNUM_OpenSCManagerA)
467struct svcctl_OpenSCManagerA {
468	IN		struct svcctl_value *machine_name;
469	IN		struct svcctl_value *database_name;
470	IN		DWORD desired_access;
471	OUT		svcctl_handle_t handle;
472	OUT		DWORD status;
473};
474
475/*
476 ***********************************************************************
477 * OpenServiceA
478 ***********************************************************************
479 */
480OPERATION(SVCCTL_OPNUM_OpenServiceA)
481struct svcctl_OpenServiceA {
482	IN		svcctl_handle_t manager_handle;
483	IN REFERENCE	struct svcctl_value *service_name;
484	IN		DWORD desired_access;
485	OUT		svcctl_handle_t service_handle;
486	OUT		DWORD status;
487};
488
489/*
490 ***********************************************************************
491 * EnumServicesStatusA
492 ***********************************************************************
493 */
494OPERATION(SVCCTL_OPNUM_EnumServicesStatusA)
495struct svcctl_EnumServicesStatusA {
496	IN		svcctl_handle_t manager_handle;
497	IN		DWORD svc_type;
498	IN		DWORD svc_state;
499	IN		DWORD buf_size;
500    SIZE_IS(buf_size)
501	OUT REFERENCE	LPBYTE services;
502	OUT		DWORD bytes_needed;
503	OUT		DWORD svc_num;
504	INOUT		DWORD *resume_handle;
505	OUT		DWORD status;
506};
507
508/*
509 ***********************************************************************
510 * QueryServiceConfig2W
511 ***********************************************************************
512 */
513OPERATION(SVCCTL_OPNUM_QueryServiceConfig2W)
514struct svcctl_QueryServiceConfig2W {
515	IN		svcctl_handle_t service_handle;
516	IN		DWORD info_level;
517	IN		DWORD buf_size;
518    SIZE_IS(buf_size)
519	OUT REFERENCE	LPBYTE buffer;
520	OUT		DWORD bytes_needed;
521	OUT		DWORD status;
522};
523
524/*
525 ***********************************************************************
526 * QueryServiceStatusEx
527 ***********************************************************************
528 */
529struct svc_status_ex {
530	DWORD service_type;
531	DWORD cur_state;
532	DWORD ctrl_accepted;
533	DWORD w32_exitcode;
534	DWORD svc_specified_exitcode;
535	DWORD check_point;
536	DWORD wait_hint;
537	DWORD process_id;
538	DWORD service_flags;
539};
540typedef struct svc_status_ex svc_status_ex_t;
541
542OPERATION(SVCCTL_OPNUM_QueryServiceStatusEx)
543struct svcctl_QueryServiceStatusEx {
544	IN		svcctl_handle_t service_handle;
545	IN		DWORD info_level;
546	IN		DWORD buf_size;
547    SIZE_IS(buf_size)
548	OUT REFERENCE	LPBYTE buffer;
549	OUT		DWORD bytes_needed;
550	OUT		DWORD status;
551};
552
553/*
554 ***********************************************************************
555 * The SVCCTL interface definition.
556 ***********************************************************************
557 */
558INTERFACE(0)
559union svcctl_interface {
560	CASE(SVCCTL_OPNUM_Close)
561		struct svcctl_Close			SvcClose;
562	CASE(SVCCTL_OPNUM_ControlService)
563		struct svcctl_ControlService		SvcControlService;
564	CASE(SVCCTL_OPNUM_DeleteService)
565		struct svcctl_DeleteService		SvcDeleteService;
566	CASE(SVCCTL_OPNUM_QueryServiceSecurity)
567		struct svcctl_QueryServiceSecurity	SvcQueryServiceSecurity;
568	CASE(SVCCTL_OPNUM_SetServiceSecurity)
569		struct svcctl_SetServiceSecurity	SvcSetServiceSecurity;
570	CASE(SVCCTL_OPNUM_OpenManager)
571		struct svcctl_OpenManager		SvcOpenManager;
572	CASE(SVCCTL_OPNUM_OpenService)
573		struct svcctl_OpenService		SvcOpenService;
574	CASE(SVCCTL_OPNUM_QueryServiceStatus)
575		struct svcctl_QueryServiceStatus	SvcQueryServiceStatus;
576	CASE(SVCCTL_OPNUM_EnumDependentServices)
577		struct svcctl_EnumDependentServices Svc_EnumDependentServices;
578	CASE(SVCCTL_OPNUM_EnumServicesStatus)
579		struct svcctl_EnumServicesStatus	SvcEnumServicesStatus;
580	CASE(SVCCTL_OPNUM_QueryServiceConfig)
581		struct svcctl_QueryServiceConfig	SvcQueryServiceConfig;
582	CASE(SVCCTL_OPNUM_StartService)
583		struct svcctl_StartService		SvcStartService;
584	CASE(SVCCTL_OPNUM_GetServiceDisplayNameW)
585		struct svcctl_GetServiceDisplayNameW SvcGetServiceDisplayNameW;
586	CASE(SVCCTL_OPNUM_GetServiceKeyNameW)
587		struct svcctl_GetServiceKeyNameW	SvcGetServiceKeyNameW;
588	CASE(SVCCTL_OPNUM_OpenSCManagerA)
589		struct svcctl_OpenSCManagerA		SvcOpenSCManagerA;
590	CASE(SVCCTL_OPNUM_OpenServiceA)
591		struct svcctl_OpenServiceA		SvcOpenServiceA;
592	CASE(SVCCTL_OPNUM_EnumServicesStatusA)
593		struct svcctl_EnumServicesStatusA	SvcEnumServicesStatusA;
594	CASE(SVCCTL_OPNUM_QueryServiceConfig2W)
595		struct svcctl_QueryServiceConfig2W	SvcQueryServiceConfig2W;
596	CASE(SVCCTL_OPNUM_QueryServiceStatusEx)
597		struct svcctl_QueryServiceStatusEx	SvcQueryServiceStatusEx;
598};
599
600typedef union svcctl_interface	svcctl_interface_t;
601EXTERNTYPEINFO(svcctl_interface)
602
603
604#endif /* _MLSVC_SVCCTL_NDL_ */
605