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.
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.
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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _MLSVC_SVCCTL_NDL_
27 #define _MLSVC_SVCCTL_NDL_
30 * NT Service Control Services (SVCCTL) RPC interface definition.
31 * This interface provides remote access to add, remove, start and
35 #include "ndrtypes.ndl"
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
79 #define SVCCTL_OPNUM_QueryServiceConfig2W 0x27
80 #define SVCCTL_OPNUM_QueryServiceStatusEx 0x28
81 #define SVCCTL_OPNUM_EnumServicesStatusExA 0x29
82 #define SVCCTL_OPNUM_EnumServicesStatusExW 0x2a
84 /* Windows XP and Windows Server 2003 */
85 #define SVCCTL_OPNUM_SendTSMessage 0x2b
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
100 CONTEXT_HANDLE(svcctl_handle) svcctl_handle_t;
103 * String definition for the ASCII interface.
105 struct svcctl_value {
106 DWORD vc_first_is; /* 0 */
108 SIZE_IS(vc_length_is)
109 BYTE value[ANY_SIZE_ARRAY];
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.
120 * The type of service. This member can be one of the following values.
122 * SERVICE_FILE_SYSTEM_DRIVER
123 * SERVICE_KERNEL_DRIVER
124 * SERVICE_WIN32_OWN_PROCESS
125 * SERVICE_WIN32_SHARE_PROCESS
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.
133 * SERVICE_INTERACTIVE_PROCESS
136 * The current state of the service. This member can be one of the
139 * SERVICE_CONTINUE_PENDING
140 * SERVICE_PAUSE_PENDING
143 * SERVICE_START_PENDING
144 * SERVICE_STOP_PENDING
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
155 * SERVICE_ACCEPT_STOP
156 * SERVICE_ACCEPT_PAUSE_CONTINUE
157 * SERVICE_ACCEPT_SHUTDOWN
158 * SERVICE_ACCEPT_PARAMCHANGE
159 * SERVICE_ACCEPT_NETBINDCHANGE
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.
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.
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.
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.
199 DWORD svc_specified_exitcode;
203 typedef struct svc_status svc_status_t;
205 struct 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;
210 typedef struct svc_enum_status svc_enum_status_t;
216 LPTSTR binary_pathname;
217 LPTSTR loadorder_group;
220 LPTSTR service_startname;
223 typedef struct svc_config svc_config_t;
225 struct svc_failure_actions {
227 DWORD rebootmsg_offset;
228 DWORD command_offset;
230 DWORD actions_offset;
232 typedef struct svc_failure_actions svc_failure_actions_t;
234 struct svc_description {
235 DWORD desc; /* offset of description string */
237 typedef struct svc_description svc_description_t;
239 /* Boolean flag to control delayed start of service. Set 1=true, 0=false */
240 struct svc_delayed_auto_start {
243 typedef struct svc_delayed_auto_start svc_delayed_auto_start_t;
245 /* Boolean flag to control configured failure action. Set 1=true, 0=false */
246 struct svc_config_failure_action {
249 typedef struct svc_config_failure_action svc_config_failure_action_t;
252 ***********************************************************************
254 ***********************************************************************
256 OPERATION(SVCCTL_OPNUM_Close)
257 struct svcctl_Close {
258 IN svcctl_handle_t handle;
259 OUT svcctl_handle_t result_handle;
264 ***********************************************************************
266 ***********************************************************************
268 OPERATION(SVCCTL_OPNUM_ControlService)
269 struct svcctl_ControlService {
270 IN svcctl_handle_t service_handle;
272 OUT svc_status_t service_status;
277 ***********************************************************************
279 ***********************************************************************
281 OPERATION(SVCCTL_OPNUM_DeleteService)
282 struct svcctl_DeleteService {
283 IN svcctl_handle_t service_handle;
288 ***********************************************************************
289 * QueryServiceSecurity
290 ***********************************************************************
292 OPERATION(SVCCTL_OPNUM_QueryServiceSecurity)
293 struct svcctl_QueryServiceSecurity {
294 IN svcctl_handle_t service_handle;
295 IN DWORD security_info;
298 OUT REFERENCE LPBYTE buffer;
299 OUT DWORD bytes_needed;
304 ***********************************************************************
306 ***********************************************************************
308 OPERATION(SVCCTL_OPNUM_SetServiceSecurity)
309 struct svcctl_SetServiceSecurity {
310 IN svcctl_handle_t service_handle;
311 IN DWORD security_info;
313 IN REFERENCE LPBYTE buffer;
319 ***********************************************************************
321 ***********************************************************************
323 OPERATION(SVCCTL_OPNUM_OpenManager)
324 struct svcctl_OpenManager {
325 IN LPTSTR machine_name;
326 IN LPTSTR database_name;
327 IN DWORD desired_access;
328 OUT svcctl_handle_t handle;
334 ***********************************************************************
336 ***********************************************************************
338 OPERATION(SVCCTL_OPNUM_OpenService)
339 struct 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;
349 ***********************************************************************
351 ***********************************************************************
353 OPERATION(SVCCTL_OPNUM_QueryServiceStatus)
354 struct svcctl_QueryServiceStatus {
355 IN svcctl_handle_t service_handle;
356 OUT svc_status_t service_status;
361 ***********************************************************************
362 * EnumDependentServices
363 ***********************************************************************
365 OPERATION(SVCCTL_OPNUM_EnumDependentServices)
366 struct svcctl_EnumDependentServices {
367 IN svcctl_handle_t service_handle;
371 OUT REFERENCE LPBYTE services;
372 OUT DWORD bytes_needed;
378 ***********************************************************************
380 ***********************************************************************
382 OPERATION(SVCCTL_OPNUM_EnumServicesStatus)
383 struct svcctl_EnumServicesStatus {
384 IN svcctl_handle_t manager_handle;
389 OUT REFERENCE LPBYTE services;
390 OUT DWORD bytes_needed;
392 INOUT DWORD *resume_handle;
397 ***********************************************************************
399 ***********************************************************************
401 OPERATION(SVCCTL_OPNUM_QueryServiceConfig)
402 struct svcctl_QueryServiceConfig {
403 IN svcctl_handle_t service_handle;
405 OUT svc_config_t service_cfg;
411 ***********************************************************************
414 * argc: The number of strings in argv. If argv is NULL,
416 * argv: A pointer to a buffer containing an array of
417 * null-terminated Unicode strings.
419 * For service management support, this should probably be:
422 * IN REFERENCE LPBYTE argv;
423 ***********************************************************************
425 OPERATION(SVCCTL_OPNUM_StartService)
426 struct svcctl_StartService {
427 IN svcctl_handle_t service_handle;
434 ***********************************************************************
435 * GetServiceDisplayNameW
436 ***********************************************************************
438 OPERATION(SVCCTL_OPNUM_GetServiceDisplayNameW)
439 struct 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;
448 ***********************************************************************
450 ***********************************************************************
452 OPERATION(SVCCTL_OPNUM_GetServiceKeyNameW)
453 struct 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;
462 ***********************************************************************
464 ***********************************************************************
466 OPERATION(SVCCTL_OPNUM_OpenSCManagerA)
467 struct 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;
476 ***********************************************************************
478 ***********************************************************************
480 OPERATION(SVCCTL_OPNUM_OpenServiceA)
481 struct 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;
490 ***********************************************************************
491 * EnumServicesStatusA
492 ***********************************************************************
494 OPERATION(SVCCTL_OPNUM_EnumServicesStatusA)
495 struct svcctl_EnumServicesStatusA {
496 IN svcctl_handle_t manager_handle;
501 OUT REFERENCE LPBYTE services;
502 OUT DWORD bytes_needed;
504 INOUT DWORD *resume_handle;
509 ***********************************************************************
510 * QueryServiceConfig2W
511 ***********************************************************************
513 OPERATION(SVCCTL_OPNUM_QueryServiceConfig2W)
514 struct svcctl_QueryServiceConfig2W {
515 IN svcctl_handle_t service_handle;
519 OUT REFERENCE LPBYTE buffer;
520 OUT DWORD bytes_needed;
525 ***********************************************************************
526 * QueryServiceStatusEx
527 ***********************************************************************
529 struct svc_status_ex {
534 DWORD svc_specified_exitcode;
540 typedef struct svc_status_ex svc_status_ex_t;
542 OPERATION(SVCCTL_OPNUM_QueryServiceStatusEx)
543 struct svcctl_QueryServiceStatusEx {
544 IN svcctl_handle_t service_handle;
548 OUT REFERENCE LPBYTE buffer;
549 OUT DWORD bytes_needed;
554 ***********************************************************************
555 * The SVCCTL interface definition.
556 ***********************************************************************
559 union 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;
600 typedef union svcctl_interface svcctl_interface_t;
601 EXTERNTYPEINFO(svcctl_interface)
604 #endif /* _MLSVC_SVCCTL_NDL_ */