xref: /titanic_50/usr/src/uts/common/smbsrv/ndl/svcctl.ndl (revision ff3124eff995e6cd8ebd8c6543648e0670920034)
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 2008 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#pragma ident	"%Z%%M%	%I%	%E% SMI"
30
31/*
32 * NT Service Control Services (SVCCTL) RPC interface definition.
33 * This interface provides remote access to add, remove, start and
34 * stop services.
35 */
36
37#include "ndrtypes.ndl"
38
39/* Windows NT */
40#define SVCCTL_OPNUM_Close			0x00
41#define	SVCCTL_OPNUM_ControlService		0x01
42#define	SVCCTL_OPNUM_DeleteService		0x02
43#define	SVCCTL_OPNUM_LockServiceDatabase	0x03
44#define	SVCCTL_OPNUM_QueryServiceSecurity	0x04
45#define	SVCCTL_OPNUM_SetServiceSecurity		0x05
46#define SVCCTL_OPNUM_QueryServiceStatus		0x06
47#define	SVCCTL_OPNUM_SetServiceStatus		0x07
48#define	SVCCTL_OPNUM_UnlockServiceDatabase	0x08
49#define	SVCCTL_OPNUM_NotifyBootConfigStatus	0x09
50#define	SVCCTL_OPNUM_SetServiceBits		0x0a
51#define	SVCCTL_OPNUM_ChangeServiceConfig	0x0b
52#define	SVCCTL_OPNUM_CreateService		0x0c
53#define	SVCCTL_OPNUM_EnumDependentServices	0x0d
54#define SVCCTL_OPNUM_EnumServicesStatus		0x0E
55#define SVCCTL_OPNUM_OpenManager		0x0F
56#define SVCCTL_OPNUM_OpenService		0x10
57#define SVCCTL_OPNUM_QueryServiceConfig		0x11
58#define	SVCCTL_OPNUM_QueryServiceLockStatus	0x12
59#define	SVCCTL_OPNUM_StartService		0x13
60#define	SVCCTL_OPNUM_GetServiceDisplayNameW	0x14
61#define	SVCCTL_OPNUM_GetServiceKeyNameW		0x15
62#define	SVCCTL_OPNUM_SetServiceBitsA		0x16
63#define	SVCCTL_OPNUM_ChangeServiceConfigA	0x17
64#define	SVCCTL_OPNUM_CreateServiceA		0x18
65#define	SVCCTL_OPNUM_EnumDependentServicesA	0x19
66#define	SVCCTL_OPNUM_EnumServiceStatusA		0x1a
67#define	SVCCTL_OPNUM_OpenSCManagerA		0x1b
68#define	SVCCTL_OPNUM_OpenServiceA		0x1c
69#define	SVCCTL_OPNUM_QueryServiceConfigA	0x1d
70#define	SVCCTL_OPNUM_QueryServiceLockStatusA	0x1e
71#define	SVCCTL_OPNUM_StartServiceA		0x1f
72#define	SVCCTL_OPNUM_GetServiceDisplayNameA	0x20
73#define	SVCCTL_OPNUM_GetServiceKeyNameA		0x21
74#define	SVCCTL_OPNUM_GetCurrentGroupStateW	0x22
75#define	SVCCTL_OPNUM_EnumServiceGroupW		0x23
76#define	SVCCTL_OPNUM_ChangeServiceConfig2A	0x24
77#define	SVCCTL_OPNUM_ChangeServiceConfig2W	0x25
78#define	SVCCTL_OPNUM_QueryServiceConfig2A	0x26
79
80/* Windows 2000 */
81#define	SVCCTL_OPNUM_QueryServiceConfig2W	0x27
82#define	SVCCTL_OPNUM_QueryServiceStatusEx	0x28
83#define	SVCCTL_OPNUM_EnumServiceStatusExA	0x29
84#define	SVCCTL_OPNUM_EnumServiceStatusExW	0x2a
85
86/* Windows XP and Windows Server 2003 */
87#define	SVCCTL_OPNUM_SendTSMessage		0x2b
88
89/* Windows Vista */
90#define	SVCCTL_OPNUM_CreateServiceWOW64A	0x2c
91#define	SVCCTL_OPNUM_CreateServiceWOW64W	0x2d
92#define	SVCCTL_OPNUM_QueryServiceTagInfo	0x2e
93#define	SVCCTL_OPNUM_NotifyServiceStatusChange	0x2f
94#define	SVCCTL_OPNUM_GetNotifyResult		0x30
95#define	SVCCTL_OPNUM_CloseNotifyHandle		0x31
96#define	SVCCTL_OPNUM_ControlServiceExA		0x32
97#define	SVCCTL_OPNUM_ControlServiceExW		0x33
98#define	SVCCTL_OPNUM_SendPnPMessage		0x34
99#define	SVCCTL_OPNUM_ValidatePnPService		0x35
100#define	SVCCTL_OPNUM_OpenServiceStatusHandle	0x36
101
102/*
103 * Standard opaque 20 byte RPC handle.
104 */
105struct svcctl_handle {
106	DWORD hand1;
107	DWORD hand2;
108	WORD  hand3[2];
109	BYTE  hand4[8];
110};
111
112typedef struct svcctl_handle svcctl_handle_t;
113
114/*
115 * The svc_status (SERVICE_STATUS) structure contains information about a
116 * service. The ControlService, EnumDependentServices, EnumServicesStatus,
117 * and QueryServiceStatus functions use this structure to return information
118 * about a service. A service uses this structure in the SetServiceStatus
119 * function to report its current status to the service control manager.
120 *
121 * service_type
122 *	The type of service. This member can be one of the following values.
123 *
124 *      SERVICE_FILE_SYSTEM_DRIVER
125 *      SERVICE_KERNEL_DRIVER
126 *      SERVICE_WIN32_OWN_PROCESS
127 *      SERVICE_WIN32_SHARE_PROCESS
128 *
129 * If the service type is either SERVICE_WIN32_OWN_PROCESS or
130 * SERVICE_WIN32_SHARE_PROCESS, and the service is running in
131 * the context of the LocalSystem account, the following type
132 * may also be specified to indicate that the service can
133 * interact with the desktop.
134 *
135 *      SERVICE_INTERACTIVE_PROCESS
136 *
137 * cur_state
138 *	The current state of the service. This member can be one of the
139 *	following values.
140 *
141 *      SERVICE_CONTINUE_PENDING
142 *      SERVICE_PAUSE_PENDING
143 *      SERVICE_PAUSED
144 *      SERVICE_RUNNING
145 *      SERVICE_START_PENDING
146 *      SERVICE_STOP_PENDING
147 *      SERVICE_STOPPED
148 *
149 * ctrl_accepted
150 *	The control codes that the service will accept and process in its
151 *	handler function (see Handler and HandlerEx). A user interface
152 *	process can control a service by specifying a control command in
153 *	the ControlService function. By default, all services accept the
154 *	SERVICE_CONTROL_INTERROGATE value. The following are the control
155 *	codes.
156 *
157 *      SERVICE_ACCEPT_STOP
158 *      SERVICE_ACCEPT_PAUSE_CONTINUE
159 *      SERVICE_ACCEPT_SHUTDOWN
160 *      SERVICE_ACCEPT_PARAMCHANGE
161 *      SERVICE_ACCEPT_NETBINDCHANGE
162 *
163 * w32_exitcode
164 *  An error code that the service uses to report an error that occurs when
165 *  it is starting or stopping. To return an error code specific to the
166 *  service, the service must set this value to ERROR_SERVICE_SPECIFIC_ERROR
167 *  to indicate that the dwServiceSpecificExitCode member contains the error
168 *  code. The service should set this value to NO_ERROR when it is running
169 *  and on normal termination.
170 *
171 * svc_specified_exitcode
172 *  A service-specific error code that the service returns when an error
173 *  occurs while the service is starting or stopping. This value is ignored
174 *  unless the w32_exitcode member is set to ERROR_SERVICE_SPECIFIC_ERROR.
175 *
176 * check_point
177 *  A value that the service increments periodically to report its progress
178 *  during a lengthy start, stop, pause, or continue operation. For example,
179 *  the service should increment this value as it completes each step of its
180 *  initialization when it is starting up. The user interface program that
181 *  invoked the operation on the service uses this value to track the progress
182 *  of the service during a lengthy operation. This value is not valid and
183 *  should be zero when the service does not have a start, stop, pause, or
184 *  continue operation pending.
185 *
186 * wait_hint
187 *  An estimate of the amount of time, in milliseconds, that the service
188 *  expects a pending start, stop, pause, or continue operation to take
189 *  before the service makes its next call to the SetServiceStatus
190 *  function with either an incremented check_point value or a change in
191 *  dwCurrentState. If the amount of time specified by wait_hint passes,
192 *  and check_point has not been incremented, or cur_state has not changed,
193 *  the service control manager or service control program can assume that
194 *  an error has occurred and the service should be stopped.
195 */
196struct svc_status {
197	DWORD service_type;
198	DWORD cur_state;
199	DWORD ctrl_accepted;
200	DWORD w32_exitcode;
201	DWORD svc_specified_exitcode;
202	DWORD check_point;
203	DWORD wait_hint;
204};
205typedef struct svc_status svc_status_t;
206
207struct svc_enum_status {
208	DWORD svc_name;		/* offset within response buffer */
209	DWORD display_name;	/* offset within response buffer */
210	svc_status_t svc_status;
211};
212typedef struct svc_enum_status svc_enum_status_t;
213
214struct svc_config {
215	DWORD  service_type;
216	DWORD  start_type;
217	DWORD  error_control;
218	LPTSTR binary_pathname;
219	LPTSTR loadorder_group;
220	DWORD  tag_id;
221	LPTSTR dependencies;
222	LPTSTR service_startname;
223	LPTSTR display_name;
224};
225typedef struct svc_config svc_config_t;
226
227
228/*
229 ***********************************************************************
230 * Close
231 ***********************************************************************
232 */
233OPERATION(SVCCTL_OPNUM_Close)
234struct svcctl_Close {
235	IN		svcctl_handle_t handle;
236	OUT		svcctl_handle_t result_handle;
237	OUT		DWORD status;
238};
239
240
241/*
242 ***********************************************************************
243 * OpenManager
244 ***********************************************************************
245 */
246OPERATION(SVCCTL_OPNUM_OpenManager)
247struct svcctl_OpenManager {
248	IN		LPTSTR machine_name;
249	IN		LPTSTR database_name;
250	IN		DWORD desired_access;
251	OUT		svcctl_handle_t handle;
252	OUT		DWORD status;
253};
254
255
256/*
257 ***********************************************************************
258 * OpenService
259 ***********************************************************************
260 */
261OPERATION(SVCCTL_OPNUM_OpenService)
262struct svcctl_OpenService {
263	IN		svcctl_handle_t manager_handle;
264	IN REFERENCE	LPTSTR service_name;
265	IN		DWORD desired_access;
266	OUT		svcctl_handle_t service_handle;
267	OUT		DWORD status;
268};
269
270
271/*
272 ***********************************************************************
273 * QueryServiceStatus
274 ***********************************************************************
275 */
276OPERATION(SVCCTL_OPNUM_QueryServiceStatus)
277struct svcctl_QueryServiceStatus {
278	IN		svcctl_handle_t service_handle;
279	OUT		svc_status_t service_status;
280	OUT		DWORD status;
281};
282
283/*
284 ***********************************************************************
285 * EnumServicesStatus
286 *
287 * This should probably be:
288 *	...
289 *	INOUT	DWORD buf_size;
290 *    SIZE_IS(buf_size)
291 *	OUT	BYTE *services;
292 *	OUT	DWORD bytes_needed;
293 *	OUT	DWORD svc_num;
294 *	INOUT	DWORD *resume_handle;
295 *	...
296 ***********************************************************************
297 */
298OPERATION(SVCCTL_OPNUM_EnumServicesStatus)
299struct svcctl_EnumServicesStatus {
300	IN		svcctl_handle_t manager_handle;
301	IN		DWORD svc_type;
302	IN		DWORD svc_state;
303	INOUT		DWORD buf_size;
304	IN		DWORD address;
305	OUT		BYTE services[1024];
306	OUT		DWORD bytes_needed;
307	OUT		DWORD svc_num;
308	OUT		DWORD resume_handle;
309	OUT		DWORD status;
310};
311
312/*
313 ***********************************************************************
314 * QueryServiceConfig
315 ***********************************************************************
316 */
317OPERATION(SVCCTL_OPNUM_QueryServiceConfig)
318struct svcctl_QueryServiceConfig {
319	IN		svcctl_handle_t service_handle;
320	IN		DWORD buf_size;
321	OUT		svc_config_t service_cfg;
322	OUT		DWORD cfg_bytes;
323	OUT		DWORD status;
324};
325
326/*
327 ***********************************************************************
328 * GetServiceDisplayNameW
329 ***********************************************************************
330 */
331OPERATION(SVCCTL_OPNUM_GetServiceDisplayNameW)
332struct svcctl_GetServiceDisplayNameW {
333	IN		svcctl_handle_t service_handle;
334	IN		LPTSTR service_name;
335	OUT		LPTSTR display_name;
336	INOUT		DWORD buf_size;
337	OUT		DWORD status;
338};
339
340/*
341 ***********************************************************************
342 * GetServiceKeyNameW
343 ***********************************************************************
344 */
345OPERATION(SVCCTL_OPNUM_GetServiceKeyNameW)
346struct svcctl_GetServiceKeyNameW {
347	IN		svcctl_handle_t service_handle;
348	IN		LPTSTR service_name;
349	OUT		LPTSTR key_name;
350	INOUT		DWORD buf_size;
351	OUT		DWORD status;
352};
353
354/*
355 ***********************************************************************
356 * The SVCCTL interface definition.
357 ***********************************************************************
358 */
359INTERFACE(0)
360union svcctl_interface {
361	CASE(SVCCTL_OPNUM_Close)
362		struct svcctl_Close			SvcClose;
363	CASE(SVCCTL_OPNUM_OpenManager)
364		struct svcctl_OpenManager		SvcOpenManager;
365	CASE(SVCCTL_OPNUM_OpenService)
366		struct svcctl_OpenService		SvcOpenService;
367	CASE(SVCCTL_OPNUM_QueryServiceStatus)
368		struct svcctl_QueryServiceStatus	SvcQueryServiceStatus;
369	CASE(SVCCTL_OPNUM_EnumServicesStatus)
370		struct svcctl_EnumServicesStatus	SvcEnumServicesStatus;
371	CASE(SVCCTL_OPNUM_QueryServiceConfig)
372		struct svcctl_QueryServiceConfig	SvcQueryServiceConfig;
373	CASE(SVCCTL_OPNUM_GetServiceDisplayNameW)
374		struct svcctl_GetServiceDisplayNameW SvcGetServiceDisplayNameW;
375	CASE(SVCCTL_OPNUM_GetServiceKeyNameW)
376		struct svcctl_GetServiceKeyNameW	SvcGetServiceKeyNameW;
377};
378
379typedef union svcctl_interface	svcctl_interface_t;
380EXTERNTYPEINFO(svcctl_interface)
381
382
383#endif /* _MLSVC_SVCCTL_NDL_ */
384