xref: /titanic_41/usr/src/uts/common/smbsrv/ndl/svcctl.ndl (revision 16dd44c265271a75647fb0bb41109bb7c585a526)
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/*
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_EnumServiceStatusA		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_EnumServiceStatusExA	0x29
82#define	SVCCTL_OPNUM_EnumServiceStatusExW	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 * The svc_status (SERVICE_STATUS) structure contains information about a
104 * service. The ControlService, EnumDependentServices, EnumServicesStatus,
105 * and QueryServiceStatus functions use this structure to return information
106 * about a service. A service uses this structure in the SetServiceStatus
107 * function to report its current status to the service control manager.
108 *
109 * service_type
110 *	The type of service. This member can be one of the following values.
111 *
112 *      SERVICE_FILE_SYSTEM_DRIVER
113 *      SERVICE_KERNEL_DRIVER
114 *      SERVICE_WIN32_OWN_PROCESS
115 *      SERVICE_WIN32_SHARE_PROCESS
116 *
117 * If the service type is either SERVICE_WIN32_OWN_PROCESS or
118 * SERVICE_WIN32_SHARE_PROCESS, and the service is running in
119 * the context of the LocalSystem account, the following type
120 * may also be specified to indicate that the service can
121 * interact with the desktop.
122 *
123 *      SERVICE_INTERACTIVE_PROCESS
124 *
125 * cur_state
126 *	The current state of the service. This member can be one of the
127 *	following values.
128 *
129 *      SERVICE_CONTINUE_PENDING
130 *      SERVICE_PAUSE_PENDING
131 *      SERVICE_PAUSED
132 *      SERVICE_RUNNING
133 *      SERVICE_START_PENDING
134 *      SERVICE_STOP_PENDING
135 *      SERVICE_STOPPED
136 *
137 * ctrl_accepted
138 *	The control codes that the service will accept and process in its
139 *	handler function (see Handler and HandlerEx). A user interface
140 *	process can control a service by specifying a control command in
141 *	the ControlService function. By default, all services accept the
142 *	SERVICE_CONTROL_INTERROGATE value. The following are the control
143 *	codes.
144 *
145 *      SERVICE_ACCEPT_STOP
146 *      SERVICE_ACCEPT_PAUSE_CONTINUE
147 *      SERVICE_ACCEPT_SHUTDOWN
148 *      SERVICE_ACCEPT_PARAMCHANGE
149 *      SERVICE_ACCEPT_NETBINDCHANGE
150 *
151 * w32_exitcode
152 *  An error code that the service uses to report an error that occurs when
153 *  it is starting or stopping. To return an error code specific to the
154 *  service, the service must set this value to ERROR_SERVICE_SPECIFIC_ERROR
155 *  to indicate that the dwServiceSpecificExitCode member contains the error
156 *  code. The service should set this value to NO_ERROR when it is running
157 *  and on normal termination.
158 *
159 * svc_specified_exitcode
160 *  A service-specific error code that the service returns when an error
161 *  occurs while the service is starting or stopping. This value is ignored
162 *  unless the w32_exitcode member is set to ERROR_SERVICE_SPECIFIC_ERROR.
163 *
164 * check_point
165 *  A value that the service increments periodically to report its progress
166 *  during a lengthy start, stop, pause, or continue operation. For example,
167 *  the service should increment this value as it completes each step of its
168 *  initialization when it is starting up. The user interface program that
169 *  invoked the operation on the service uses this value to track the progress
170 *  of the service during a lengthy operation. This value is not valid and
171 *  should be zero when the service does not have a start, stop, pause, or
172 *  continue operation pending.
173 *
174 * wait_hint
175 *  An estimate of the amount of time, in milliseconds, that the service
176 *  expects a pending start, stop, pause, or continue operation to take
177 *  before the service makes its next call to the SetServiceStatus
178 *  function with either an incremented check_point value or a change in
179 *  dwCurrentState. If the amount of time specified by wait_hint passes,
180 *  and check_point has not been incremented, or cur_state has not changed,
181 *  the service control manager or service control program can assume that
182 *  an error has occurred and the service should be stopped.
183 */
184struct svc_status {
185	DWORD service_type;
186	DWORD cur_state;
187	DWORD ctrl_accepted;
188	DWORD w32_exitcode;
189	DWORD svc_specified_exitcode;
190	DWORD check_point;
191	DWORD wait_hint;
192};
193typedef struct svc_status svc_status_t;
194
195struct svc_enum_status {
196	DWORD svc_name;		/* offset within response buffer */
197	DWORD display_name;	/* offset within response buffer */
198	svc_status_t svc_status;
199};
200typedef struct svc_enum_status svc_enum_status_t;
201
202struct svc_config {
203	DWORD  service_type;
204	DWORD  start_type;
205	DWORD  error_control;
206	LPTSTR binary_pathname;
207	LPTSTR loadorder_group;
208	DWORD  tag_id;
209	LPTSTR dependencies;
210	LPTSTR service_startname;
211	LPTSTR display_name;
212};
213typedef struct svc_config svc_config_t;
214
215struct svc_failure_actions {
216	DWORD reset_period;
217	DWORD rebootmsg_offset;
218	DWORD command_offset;
219	DWORD actions;
220	DWORD actions_offset;
221};
222typedef struct svc_failure_actions svc_failure_actions_t;
223
224struct svc_description {
225	DWORD desc;		/* offset of description string */
226};
227typedef struct svc_description svc_description_t;
228
229/*
230 ***********************************************************************
231 * Close
232 ***********************************************************************
233 */
234OPERATION(SVCCTL_OPNUM_Close)
235struct svcctl_Close {
236	IN		svcctl_handle_t handle;
237	OUT		svcctl_handle_t result_handle;
238	OUT		DWORD status;
239};
240
241
242/*
243 ***********************************************************************
244 * OpenManager
245 ***********************************************************************
246 */
247OPERATION(SVCCTL_OPNUM_OpenManager)
248struct svcctl_OpenManager {
249	IN		LPTSTR machine_name;
250	IN		LPTSTR database_name;
251	IN		DWORD desired_access;
252	OUT		svcctl_handle_t handle;
253	OUT		DWORD status;
254};
255
256
257/*
258 ***********************************************************************
259 * OpenService
260 ***********************************************************************
261 */
262OPERATION(SVCCTL_OPNUM_OpenService)
263struct svcctl_OpenService {
264	IN		svcctl_handle_t manager_handle;
265	IN REFERENCE	LPTSTR service_name;
266	IN		DWORD desired_access;
267	OUT		svcctl_handle_t service_handle;
268	OUT		DWORD status;
269};
270
271
272/*
273 ***********************************************************************
274 * QueryServiceStatus
275 ***********************************************************************
276 */
277OPERATION(SVCCTL_OPNUM_QueryServiceStatus)
278struct svcctl_QueryServiceStatus {
279	IN		svcctl_handle_t service_handle;
280	OUT		svc_status_t service_status;
281	OUT		DWORD status;
282};
283
284/*
285 ***********************************************************************
286 * EnumServicesStatus
287 ***********************************************************************
288 */
289OPERATION(SVCCTL_OPNUM_EnumServicesStatus)
290struct svcctl_EnumServicesStatus {
291	IN		svcctl_handle_t manager_handle;
292	IN		DWORD svc_type;
293	IN		DWORD svc_state;
294	IN		DWORD buf_size;
295    SIZE_IS(buf_size)
296	OUT REFERENCE	LPBYTE services;
297	OUT		DWORD bytes_needed;
298	OUT		DWORD svc_num;
299	INOUT		DWORD *resume_handle;
300	OUT		DWORD status;
301};
302
303/*
304 ***********************************************************************
305 * QueryServiceConfig
306 ***********************************************************************
307 */
308OPERATION(SVCCTL_OPNUM_QueryServiceConfig)
309struct svcctl_QueryServiceConfig {
310	IN		svcctl_handle_t service_handle;
311	IN		DWORD buf_size;
312	OUT		svc_config_t service_cfg;
313	OUT		DWORD cfg_bytes;
314	OUT		DWORD status;
315};
316
317/*
318 ***********************************************************************
319 * GetServiceDisplayNameW
320 ***********************************************************************
321 */
322OPERATION(SVCCTL_OPNUM_GetServiceDisplayNameW)
323struct svcctl_GetServiceDisplayNameW {
324	IN		svcctl_handle_t manager_handle;
325	IN REFERENCE	LPTSTR service_name;
326	OUT REFERENCE	LPTSTR display_name;
327	INOUT		DWORD buf_size;
328	OUT		DWORD status;
329};
330
331/*
332 ***********************************************************************
333 * GetServiceKeyNameW
334 ***********************************************************************
335 */
336OPERATION(SVCCTL_OPNUM_GetServiceKeyNameW)
337struct svcctl_GetServiceKeyNameW {
338	IN		svcctl_handle_t manager_handle;
339	IN REFERENCE	LPTSTR service_name;
340	OUT REFERENCE	LPTSTR key_name;
341	INOUT		DWORD buf_size;
342	OUT		DWORD status;
343};
344
345/*
346 ***********************************************************************
347 * QueryServiceConfig2W
348 ***********************************************************************
349 */
350OPERATION(SVCCTL_OPNUM_QueryServiceConfig2W)
351struct svcctl_QueryServiceConfig2W {
352	IN		svcctl_handle_t service_handle;
353	IN		DWORD info_level;
354	IN		DWORD buf_size;
355    SIZE_IS(buf_size)
356	OUT REFERENCE	LPBYTE buffer;
357	OUT		DWORD bytes_needed;
358	OUT		DWORD status;
359};
360
361/*
362 ***********************************************************************
363 * The SVCCTL interface definition.
364 ***********************************************************************
365 */
366INTERFACE(0)
367union svcctl_interface {
368	CASE(SVCCTL_OPNUM_Close)
369		struct svcctl_Close			SvcClose;
370	CASE(SVCCTL_OPNUM_OpenManager)
371		struct svcctl_OpenManager		SvcOpenManager;
372	CASE(SVCCTL_OPNUM_OpenService)
373		struct svcctl_OpenService		SvcOpenService;
374	CASE(SVCCTL_OPNUM_QueryServiceStatus)
375		struct svcctl_QueryServiceStatus	SvcQueryServiceStatus;
376	CASE(SVCCTL_OPNUM_EnumServicesStatus)
377		struct svcctl_EnumServicesStatus	SvcEnumServicesStatus;
378	CASE(SVCCTL_OPNUM_QueryServiceConfig)
379		struct svcctl_QueryServiceConfig	SvcQueryServiceConfig;
380	CASE(SVCCTL_OPNUM_GetServiceDisplayNameW)
381		struct svcctl_GetServiceDisplayNameW SvcGetServiceDisplayNameW;
382	CASE(SVCCTL_OPNUM_GetServiceKeyNameW)
383		struct svcctl_GetServiceKeyNameW	SvcGetServiceKeyNameW;
384	CASE(SVCCTL_OPNUM_QueryServiceConfig2W)
385		struct svcctl_QueryServiceConfig2W	SvcQueryServiceConfig2W;
386};
387
388typedef union svcctl_interface	svcctl_interface_t;
389EXTERNTYPEINFO(svcctl_interface)
390
391
392#endif /* _MLSVC_SVCCTL_NDL_ */
393