4 svcctl interface definitions
7 import
"misc.idl", "security.idl";
8 [ uuid("367abb81-9844-35f1-ad32-98f038001003"),
10 pointer_default(unique),
11 endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
12 helper
("../librpc/ndr/ndr_svcctl.h"),
13 helpstring("Service Control")
16 const int MAX_SERVICE_NAME_LENGTH
= 256;
17 const short SC_MAX_DEPEND_SIZE
= 4 * 1024;
18 const short SC_MAX_NAME_LENGTH
= MAX_SERVICE_NAME_LENGTH
+ 1;
19 const short SC_MAX_PATH_LENGTH
= 32 * 1024;
20 const short SC_MAX_PWD_SIZE
= 514;
21 const short SC_MAX_COMPUTER_NAME_LENGTH
= 1024;
22 const short SC_MAX_ACCOUNT_NAME_LENGTH
= 2 * 1024;
23 const short SC_MAX_COMMENT_LENGTH
= 128;
24 const short SC_MAX_ARGUMENT_LENGTH
= 1024;
25 const short SC_MAX_ARGUMENTS
= 1024;
29 [string,charset
(UTF16
)] uint16
*lock_owner
;
31 } SERVICE_LOCK_STATUS
;
33 typedef [v1_enum] enum {
34 SVCCTL_STATE_UNKNOWN
= 0x00000000, /* only used internally to smbd */
35 SVCCTL_STOPPED
= 0x00000001,
36 SVCCTL_START_PENDING
= 0x00000002,
37 SVCCTL_STOP_PENDING
= 0x00000003,
38 SVCCTL_RUNNING
= 0x00000004,
39 SVCCTL_CONTINUE_PENDING
= 0x00000005,
40 SVCCTL_PAUSE_PENDING
= 0x00000006,
41 SVCCTL_PAUSED
= 0x00000007
42 } svcctl_ServiceStatus
;
44 const int SVCCTL_ACCEPT_NONE
= 0x00000000;
46 typedef [bitmap32bit
] bitmap
{
47 SVCCTL_ACCEPT_STOP
= 0x00000001,
48 SVCCTL_ACCEPT_PAUSE_CONTINUE
= 0x00000002,
49 SVCCTL_ACCEPT_SHUTDOWN
= 0x00000004,
50 SVCCTL_ACCEPT_PARAMCHANGE
= 0x00000008,
51 SVCCTL_ACCEPT_NETBINDCHANGE
= 0x00000010,
52 SVCCTL_ACCEPT_HARDWAREPROFILECHANGE
= 0x00000020,
53 SVCCTL_ACCEPT_POWEREVENT
= 0x00000040
54 } svcctl_ControlsAccepted
;
58 svcctl_ServiceStatus state
;
59 svcctl_ControlsAccepted controls_accepted
;
60 WERROR win32_exit_code
;
61 uint32 service_exit_code
;
66 typedef [public] struct {
67 SERVICE_STATUS status
;
70 } SERVICE_STATUS_PROCESS
;
72 typedef [public,gensize
] struct {
73 [relative
] nstring
*service_name
;
74 [relative
] nstring
*display_name
;
75 SERVICE_STATUS status
;
76 } ENUM_SERVICE_STATUSW
;
78 typedef [public,gensize
] struct {
79 [relative
] astring
*service_name
;
80 [relative
] astring
*display_name
;
81 SERVICE_STATUS status
;
82 } ENUM_SERVICE_STATUSA
;
84 const int SERVICE_TYPE_KERNEL_DRIVER
= 0x01;
85 const int SERVICE_TYPE_FS_DRIVER
= 0x02;
86 const int SERVICE_TYPE_ADAPTER
= 0x04;
87 const int SERVICE_TYPE_RECOGNIZER_DRIVER
= 0x08;
88 const int SERVICE_TYPE_DRIVER
=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER
;
89 const int SERVICE_TYPE_WIN32_OWN_PROCESS
= 0x10;
90 const int SERVICE_TYPE_WIN32_SHARE_PROCESS
= 0x20;
91 const int SERVICE_TYPE_WIN32
=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS
;
92 const int SERVICE_TYPE_INTERACTIVE_PROCESS
= 0x100;
96 WERROR svcctl_CloseServiceHandle
(
97 [in,out,ref] policy_handle
*handle
103 /* Service Controls */
105 typedef [v1_enum] enum {
106 SVCCTL_CONTROL_STOP
= 0x00000001,
107 SVCCTL_CONTROL_PAUSE
= 0x00000002,
108 SVCCTL_CONTROL_CONTINUE
= 0x00000003,
109 SVCCTL_CONTROL_INTERROGATE
= 0x00000004,
110 SVCCTL_CONTROL_SHUTDOWN
= 0x00000005
113 WERROR svcctl_ControlService
(
114 [in,ref] policy_handle
*handle,
115 [in] SERVICE_CONTROL
control,
116 [out,ref] SERVICE_STATUS
*service_status
121 WERROR svcctl_DeleteService
(
122 [in,ref] policy_handle
*handle
128 WERROR svcctl_LockServiceDatabase
(
129 [in,ref] policy_handle
*handle,
130 [out,ref] policy_handle
*lock
135 WERROR svcctl_QueryServiceObjectSecurity
(
136 [in] policy_handle
*handle,
137 [in] security_secinfo security_flags
,
138 [out,ref,size_is(offered
)] uint8
*buffer
,
139 [in,range(0,0x40000)] uint32 offered
,
140 [out,ref,range(0,0x40000)] uint32
*needed
145 WERROR svcctl_SetServiceObjectSecurity
(
146 [in] policy_handle
*handle,
147 [in] security_secinfo security_flags
,
148 [in,ref,size_is(offered
)] uint8
*buffer
,
154 WERROR svcctl_QueryServiceStatus
(
155 [in,ref] policy_handle
*handle,
156 [out,ref] SERVICE_STATUS
*service_status
161 [todo
] WERROR svcctl_SetServiceStatus
(
166 WERROR svcctl_UnlockServiceDatabase
(
167 [in,out,ref] policy_handle
*lock
172 [todo
] WERROR svcctl_NotifyBootConfigStatus
(
177 WERROR svcctl_SCSetServiceBitsW
(
178 [in,ref] policy_handle
*handle,
180 [in] boolean32 bitson
,
181 [in] boolean32 immediate
187 typedef [v1_enum] enum {
188 SVCCTL_SVC_ERROR_IGNORE
= 0x00000000,
189 SVCCTL_SVC_ERROR_NORMAL
= 0x00000001,
190 SVCCTL_SVC_ERROR_CRITICAL
= 0x00000002,
191 SVCCTL_SVC_ERROR_SEVERE
= 0x00000003
192 } svcctl_ErrorControl
;
194 typedef [v1_enum] enum {
195 SVCCTL_BOOT_START
= 0x00000000,
196 SVCCTL_SYSTEM_START
= 0x00000001,
197 SVCCTL_AUTO_START
= 0x00000002,
198 SVCCTL_DEMAND_START
= 0x00000003,
199 SVCCTL_DISABLED
= 0x00000004
202 [public] WERROR svcctl_ChangeServiceConfigW
(
203 [in,ref] policy_handle
*handle,
205 [in] svcctl_StartType start_type
,
206 [in] svcctl_ErrorControl error_control
,
207 [in,unique] [string,charset
(UTF16
)] uint16
*binary_path
,
208 [in,unique] [string,charset
(UTF16
)] uint16
*load_order_group
,
209 [in,out,unique] uint32
*tag_id
,
210 [in,unique,size_is(dwDependSize
)] [string,charset
(UTF16
)] uint16
*dependencies
,
211 [in,range(0, SC_MAX_DEPEND_SIZE
)] uint32 dwDependSize
,
212 [in,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH
)] [string,charset
(UTF16
)] uint16
*service_start_name
,
213 [in,unique,size_is(dwPwSize
)] [string,charset
(UTF16
)] uint16
*password
,
214 [in,range(0, SC_MAX_PWD_SIZE
)] uint32 dwPwSize
,
215 [in,unique,range(0, SC_MAX_NAME_LENGTH
)] [string,charset
(UTF16
)] uint16
*display_name
220 WERROR svcctl_CreateServiceW
(
221 [in,ref] policy_handle
*scmanager_handle
,
222 [in] [string,charset
(UTF16
)] uint16 ServiceName
[],
223 [in,unique] [string,charset
(UTF16
)] uint16
*DisplayName
,
224 [in] uint32 desired_access
,
226 [in] svcctl_StartType start_type
,
227 [in] svcctl_ErrorControl error_control
,
228 [in] [string,charset
(UTF16
)] uint16 binary_path
[],
229 [in,unique] [string,charset
(UTF16
)] uint16
*LoadOrderGroupKey
,
230 [in,out,unique] uint32
*TagId
,
231 [in,unique,size_is(dependencies_size
)] uint8
*dependencies
,
232 [in] uint32 dependencies_size
,
233 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
234 [in,unique,size_is(password_size
)] uint8
*password
,
235 [in] uint32 password_size
,
236 [out,ref] policy_handle
*handle
241 WERROR svcctl_EnumDependentServicesW
(
242 [in,ref] policy_handle
*service
,
243 [in] svcctl_ServiceState state
,
244 [out,ref,size_is(offered
)] uint8
*service_status
,
245 [in,range(0,0x40000)] uint32 offered
,
246 [out,ref,range(0,0x40000)] uint32
*needed
,
247 [out,ref,range(0,0x40000)] uint32
*services_returned
253 typedef [v1_enum] enum {
254 SERVICE_STATE_ACTIVE
= 0x00000001,
255 SERVICE_STATE_INACTIVE
= 0x00000002,
256 SERVICE_STATE_ALL
= ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE
)
257 } svcctl_ServiceState
;
259 WERROR svcctl_EnumServicesStatusW
(
260 [in,ref] policy_handle
*handle,
262 [in] svcctl_ServiceState state
,
263 [out,ref,size_is(offered
)] uint8
*service
,
264 [in] [range(0,0x40000)] uint32 offered
,
265 [out,ref] [range(0,0x40000)] uint32
*needed
,
266 [out,ref] [range(0,0x40000)] uint32
*services_returned
,
267 [in,out,unique] uint32
*resume_handle
273 /* Service Control Manager Bits */
275 typedef [bitmap32bit
] bitmap
{
276 SC_RIGHT_MGR_CONNECT
= 0x0001,
277 SC_RIGHT_MGR_CREATE_SERVICE
= 0x0002,
278 SC_RIGHT_MGR_ENUMERATE_SERVICE
= 0x0004,
279 SC_RIGHT_MGR_LOCK
= 0x0008,
280 SC_RIGHT_MGR_QUERY_LOCK_STATUS
= 0x0010,
281 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG
= 0x0020
282 } svcctl_MgrAccessMask
;
284 const int SC_MANAGER_READ_ACCESS
=
285 (SEC_STD_READ_CONTROL |
286 SC_RIGHT_MGR_CONNECT |
287 SC_RIGHT_MGR_ENUMERATE_SERVICE |
288 SC_RIGHT_MGR_QUERY_LOCK_STATUS
);
290 const int SC_MANAGER_EXECUTE_ACCESS
= SC_MANAGER_READ_ACCESS
;
292 const int SC_MANAGER_WRITE_ACCESS
=
294 SC_MANAGER_READ_ACCESS |
295 SC_RIGHT_MGR_CREATE_SERVICE |
297 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG
);
299 const int SC_MANAGER_ALL_ACCESS
= SC_MANAGER_WRITE_ACCESS
;
301 WERROR svcctl_OpenSCManagerW
(
302 [in,unique] [string,charset
(UTF16
)] uint16
*MachineName
,
303 [in,unique] [string,charset
(UTF16
)] uint16
*DatabaseName
,
304 [in] svcctl_MgrAccessMask access_mask
,
305 [out,ref] policy_handle
*handle
311 /* Service Object Bits */
313 typedef [bitmap32bit
] bitmap
{
314 SC_RIGHT_SVC_QUERY_CONFIG
= 0x0001,
315 SC_RIGHT_SVC_CHANGE_CONFIG
= 0x0002,
316 SC_RIGHT_SVC_QUERY_STATUS
= 0x0004,
317 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS
= 0x0008,
318 SC_RIGHT_SVC_START
= 0x0010,
319 SC_RIGHT_SVC_STOP
= 0x0020,
320 SC_RIGHT_SVC_PAUSE_CONTINUE
= 0x0040,
321 SC_RIGHT_SVC_INTERROGATE
= 0x0080,
322 SC_RIGHT_SVC_USER_DEFINED_CONTROL
= 0x0100
323 } svcctl_ServiceAccessMask
;
325 const int SERVICE_READ_ACCESS
=
326 (SEC_STD_READ_CONTROL |
327 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
328 SC_RIGHT_SVC_INTERROGATE |
329 SC_RIGHT_SVC_QUERY_CONFIG |
330 SC_RIGHT_SVC_QUERY_STATUS |
331 SC_RIGHT_SVC_USER_DEFINED_CONTROL
);
333 const int SERVICE_EXECUTE_ACCESS
=
334 (SERVICE_READ_ACCESS |
337 SC_RIGHT_SVC_PAUSE_CONTINUE
);
339 const int SERVICE_WRITE_ACCESS
=
341 SERVICE_READ_ACCESS |
342 SERVICE_EXECUTE_ACCESS |
343 SC_RIGHT_SVC_CHANGE_CONFIG
);
345 const int SERVICE_ALL_ACCESS
= SERVICE_WRITE_ACCESS
;
347 WERROR svcctl_OpenServiceW
(
348 [in,ref] policy_handle
*scmanager_handle
,
349 [in] [string,charset
(UTF16
)] uint16 ServiceName
[],
350 [in] svcctl_ServiceAccessMask access_mask
,
351 [out,ref] policy_handle
*handle
357 typedef [public,gensize
] struct {
359 svcctl_StartType start_type
;
360 svcctl_ErrorControl error_control
;
361 [string,charset
(UTF16
)] [range(0,8192)] uint16
*executablepath
;
362 [string,charset
(UTF16
)] [range(0,8192)] uint16
*loadordergroup
;
364 [string,charset
(UTF16
)] [range(0,8192)] uint16
*dependencies
;
365 [string,charset
(UTF16
)] [range(0,8192)] uint16
*startname
;
366 [string,charset
(UTF16
)] [range(0,8192)] uint16
*displayname
;
367 } QUERY_SERVICE_CONFIG
;
369 WERROR svcctl_QueryServiceConfigW
(
370 [in,ref] policy_handle
*handle,
371 [out] QUERY_SERVICE_CONFIG
*query
,
372 [in] [range(0,8192)] uint32 offered
,
373 [out,ref] [range(0,8192)] uint32
*needed
378 WERROR svcctl_QueryServiceLockStatusW
(
379 [in,ref] policy_handle
*handle,
381 [out,ref] SERVICE_LOCK_STATUS
*lock_status
,
382 [out,ref] uint32
*needed
388 const int SC_MAX_ARGUMENT_LENGTH
= 1024;
389 const int SC_MAX_ARGUMENTS
= 1024;
392 [string,charset
(UTF16
),range(0,SC_MAX_ARGUMENT_LENGTH
)] uint16
*string;
393 } svcctl_ArgumentString
;
395 WERROR svcctl_StartServiceW
(
396 [in,ref] policy_handle
*handle,
397 [in,range(0,SC_MAX_ARGUMENTS
)] uint32 NumArgs
,
398 [in,unique,size_is(NumArgs
)] svcctl_ArgumentString
*Arguments
403 WERROR svcctl_GetServiceDisplayNameW
(
404 [in,ref] policy_handle
*handle,
405 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
406 [out,ref] [string,charset
(UTF16
)] uint16
**display_name
,
407 [in,out,unique] uint32
*display_name_length
412 WERROR svcctl_GetServiceKeyNameW
(
413 [in,ref] policy_handle
*handle,
414 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
415 [out,ref] [string,charset
(UTF16
)] uint16
**key_name
,
416 [in,out,unique] uint32
*display_name_length
421 WERROR svcctl_SCSetServiceBitsA
(
422 [in,ref] policy_handle
*handle,
424 [in] boolean32 bitson
,
425 [in] boolean32 immediate
430 WERROR svcctl_ChangeServiceConfigA
(
431 [in,ref] policy_handle
*handle,
433 [in] svcctl_StartType start_type
,
434 [in] svcctl_ErrorControl error_control
,
435 [in,unique] [string,charset
(UTF16
)] uint16
*binary_path
,
436 [in,unique] [string,charset
(UTF16
)] uint16
*load_order_group
,
437 [out,ref] uint32
*tag_id
,
438 [in,unique] [string,charset
(UTF16
)] uint16
*dependencies
,
439 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
440 [in,unique] [string,charset
(UTF16
)] uint16
*password
,
441 [in,unique] [string,charset
(UTF16
)] uint16
*display_name
446 WERROR svcctl_CreateServiceA
(
447 [in,ref] policy_handle
*handle,
448 [in,unique] [string,charset
(UTF16
)] uint16
*ServiceName
,
449 [in,unique] [string,charset
(UTF16
)] uint16
*DisplayName
,
450 [in] uint32 desired_access
,
452 [in] svcctl_StartType start_type
,
453 [in] svcctl_ErrorControl error_control
,
454 [in,unique] [string,charset
(UTF16
)] uint16
*binary_path
,
455 [in,unique] [string,charset
(UTF16
)] uint16
*LoadOrderGroupKey
,
456 [out,unique] uint32
*TagId
,
457 [in,unique] [string,charset
(UTF16
)] uint16
*dependencies
,
458 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
459 [in,unique] [string,charset
(UTF16
)] uint16
*password
464 WERROR svcctl_EnumDependentServicesA
(
465 [in,ref] policy_handle
*service
,
466 [in] svcctl_ServiceState state
,
467 [out,unique] ENUM_SERVICE_STATUSA
*service_status
,
469 [out,ref] uint32
*needed
,
470 [out,ref] uint32
*services_returned
475 WERROR svcctl_EnumServicesStatusA
(
476 [in,ref] policy_handle
*handle,
478 [in] svcctl_ServiceState state
,
480 [out,size_is(offered
)] uint8 service
[*],
481 [out,ref] uint32
*needed
,
482 [out,ref] uint32
*services_returned
,
483 [in,out,unique] uint32
*resume_handle
488 WERROR svcctl_OpenSCManagerA
(
489 [in,unique] [string,charset
(UTF16
)] uint16
*MachineName
,
490 [in,unique] [string,charset
(UTF16
)] uint16
*DatabaseName
,
491 [in] uint32 access_mask
,
492 [out,ref] policy_handle
*handle
497 WERROR svcctl_OpenServiceA
(
498 [in,ref] policy_handle
*scmanager_handle
,
499 [in,unique] [string,charset
(UTF16
)] uint16
*ServiceName
,
500 [in] uint32 access_mask
,
501 [out,ref] policy_handle
*handle
506 WERROR svcctl_QueryServiceConfigA
(
507 [in,ref] policy_handle
*handle,
508 [out] uint8 query
[offered
], /*QUERYU_SERVICE_CONFIG */
510 [out,ref] uint32
*needed
515 WERROR svcctl_QueryServiceLockStatusA
(
516 [in,ref] policy_handle
*handle,
518 [out,ref] SERVICE_LOCK_STATUS
*lock_status
,
519 [out,ref] uint32
*needed
524 WERROR svcctl_StartServiceA
(
525 [in,ref] policy_handle
*handle,
527 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset
(UTF16
)] uint16
*Arguments
532 WERROR svcctl_GetServiceDisplayNameA
(
533 [in,ref] policy_handle
*handle,
534 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
535 [out,ref] [string,charset
(UTF16
)] uint16
**display_name
,
536 [in,out,unique] uint32
*display_name_length
541 WERROR svcctl_GetServiceKeyNameA
(
542 [in,ref] policy_handle
*handle,
543 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
544 [out,ref] [string,charset
(UTF16
)] uint16
**key_name
,
545 [in,out,unique] uint32
*display_name_length
550 [todo
] WERROR svcctl_GetCurrentGroupeStateW
(
555 [todo
] WERROR svcctl_EnumServiceGroupW
(
560 WERROR svcctl_ChangeServiceConfig2A
(
561 [in,ref] policy_handle
*handle,
562 [in] uint32 info_level
,
563 [in,unique] uint8
*info
568 WERROR svcctl_ChangeServiceConfig2W
(
569 [in,ref] policy_handle
*handle,
570 [in] uint32 info_level
,
571 [in,unique] uint8
*info
577 typedef [v1_enum] enum {
578 SERVICE_CONFIG_DESCRIPTION
= 0x00000001,
579 SERVICE_CONFIG_FAILURE_ACTIONS
= 0x00000002
580 } svcctl_ConfigLevel
;
582 typedef [gensize
,public] struct {
583 [relative
] nstring
*description
;
584 } SERVICE_DESCRIPTION
;
586 typedef [v1_enum] enum {
588 SC_ACTION_RESTART
= 1,
589 SC_ACTION_REBOOT
= 2,
590 SC_ACTION_RUN_COMMAND
= 3
598 typedef [public,gensize
] struct {
600 [relative
] nstring
*rebootmsg
;
601 [relative
] nstring
*command
;
602 [range(0,1024)] uint32 num_actions
;
603 [relative
] [size_is(num_actions
)] SC_ACTION
*actions
;
604 } SERVICE_FAILURE_ACTIONS
;
606 WERROR svcctl_QueryServiceConfig2A
(
607 [in,ref] policy_handle
*handle,
608 [in] svcctl_ConfigLevel info_level
,
609 [out] uint8 buffer
[offered
],
611 [out,ref] uint32
*needed
616 WERROR svcctl_QueryServiceConfig2W
(
617 [in,ref] policy_handle
*handle,
618 [in] svcctl_ConfigLevel info_level
,
619 [out,ref,size_is(offered
)] uint8
*buffer
,
620 [in] [range(0,8192)] uint32 offered
,
621 [out,ref] [range(0,8192)] uint32
*needed
627 typedef [v1_enum] enum {
628 SVC_STATUS_PROCESS_INFO
= 0x00000000
629 } svcctl_StatusLevel
;
631 WERROR svcctl_QueryServiceStatusEx
(
632 [in,ref] policy_handle
*handle,
633 [in] svcctl_StatusLevel info_level
,
634 [out,ref,size_is(offered
)] uint8
*buffer
,
635 [in] [range(0,8192)] uint32 offered
,
636 [out,ref] [range(0,8192)] uint32
*needed
641 WERROR EnumServicesStatusExA
(
642 [in,ref] policy_handle
*scmanager
,
643 [in] uint32 info_level
,
645 [in] svcctl_ServiceState state
,
646 [out] uint8 services
[offered
],
648 [out,ref] uint32
*needed
,
649 [out,ref] uint32
*service_returned
,
650 [in,out,unique] uint32
*resume_handle
,
651 [out,ref] [string,charset
(UTF16
)] uint16
**group_name
656 WERROR EnumServicesStatusExW
(
657 [in,ref] policy_handle
*scmanager
,
658 [in] uint32 info_level
,
660 [in] svcctl_ServiceState state
,
661 [out,ref,size_is(offered
)] uint8
*services
,
662 [in] [range(0,0x40000)] uint32 offered
,
663 [out,ref] [range(0,0x40000)] uint32
*needed
,
664 [out,ref] [range(0,0x40000)] uint32
*service_returned
,
665 [in,out,unique] [range(0,0x40000)] uint32
*resume_handle
,
666 [in,unique] [string,charset
(UTF16
)] uint16
*group_name
671 [todo
] WERROR svcctl_SCSendTSMessage
(