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")
18 [string,charset
(UTF16
)] uint16
*lock_owner
;
20 } SERVICE_LOCK_STATUS
;
22 typedef [v1_enum] enum {
23 SVCCTL_STATE_UNKNOWN
= 0x00000000, /* only used internally to smbd */
24 SVCCTL_STOPPED
= 0x00000001,
25 SVCCTL_START_PENDING
= 0x00000002,
26 SVCCTL_STOP_PENDING
= 0x00000003,
27 SVCCTL_RUNNING
= 0x00000004,
28 SVCCTL_CONTINUE_PENDING
= 0x00000005,
29 SVCCTL_PAUSE_PENDING
= 0x00000006,
30 SVCCTL_PAUSED
= 0x00000007
31 } svcctl_ServiceStatus
;
33 const int SVCCTL_ACCEPT_NONE
= 0x00000000;
35 typedef [bitmap32bit
] bitmap
{
36 SVCCTL_ACCEPT_STOP
= 0x00000001,
37 SVCCTL_ACCEPT_PAUSE_CONTINUE
= 0x00000002,
38 SVCCTL_ACCEPT_SHUTDOWN
= 0x00000004,
39 SVCCTL_ACCEPT_PARAMCHANGE
= 0x00000008,
40 SVCCTL_ACCEPT_NETBINDCHANGE
= 0x00000010,
41 SVCCTL_ACCEPT_HARDWAREPROFILECHANGE
= 0x00000020,
42 SVCCTL_ACCEPT_POWEREVENT
= 0x00000040
43 } svcctl_ControlsAccepted
;
47 svcctl_ServiceStatus state
;
48 svcctl_ControlsAccepted controls_accepted
;
49 WERROR win32_exit_code
;
50 uint32 service_exit_code
;
55 typedef [public] struct {
56 SERVICE_STATUS status
;
59 } SERVICE_STATUS_PROCESS
;
61 typedef [public,gensize
] struct {
62 [relative
] nstring
*service_name
;
63 [relative
] nstring
*display_name
;
64 SERVICE_STATUS status
;
65 } ENUM_SERVICE_STATUSW
;
67 typedef [public,gensize
] struct {
68 [relative
] astring
*service_name
;
69 [relative
] astring
*display_name
;
70 SERVICE_STATUS status
;
71 } ENUM_SERVICE_STATUSA
;
73 const int SERVICE_TYPE_KERNEL_DRIVER
= 0x01;
74 const int SERVICE_TYPE_FS_DRIVER
= 0x02;
75 const int SERVICE_TYPE_ADAPTER
= 0x04;
76 const int SERVICE_TYPE_RECOGNIZER_DRIVER
= 0x08;
77 const int SERVICE_TYPE_DRIVER
=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER
;
78 const int SERVICE_TYPE_WIN32_OWN_PROCESS
= 0x10;
79 const int SERVICE_TYPE_WIN32_SHARE_PROCESS
= 0x20;
80 const int SERVICE_TYPE_WIN32
=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS
;
81 const int SERVICE_TYPE_INTERACTIVE_PROCESS
= 0x100;
85 WERROR svcctl_CloseServiceHandle
(
86 [in,out,ref] policy_handle
*handle
92 /* Service Controls */
94 typedef [v1_enum] enum {
95 SVCCTL_CONTROL_STOP
= 0x00000001,
96 SVCCTL_CONTROL_PAUSE
= 0x00000002,
97 SVCCTL_CONTROL_CONTINUE
= 0x00000003,
98 SVCCTL_CONTROL_INTERROGATE
= 0x00000004,
99 SVCCTL_CONTROL_SHUTDOWN
= 0x00000005
102 WERROR svcctl_ControlService
(
103 [in,ref] policy_handle
*handle,
104 [in] SERVICE_CONTROL
control,
105 [out,ref] SERVICE_STATUS
*service_status
110 WERROR svcctl_DeleteService
(
111 [in,ref] policy_handle
*handle
117 WERROR svcctl_LockServiceDatabase
(
118 [in,ref] policy_handle
*handle,
119 [out,ref] policy_handle
*lock
124 WERROR svcctl_QueryServiceObjectSecurity
(
125 [in] policy_handle
*handle,
126 [in] security_secinfo security_flags
,
127 [out,ref,size_is(offered
)] uint8
*buffer
,
128 [in,range(0,0x40000)] uint32 offered
,
129 [out,ref,range(0,0x40000)] uint32
*needed
134 WERROR svcctl_SetServiceObjectSecurity
(
135 [in] policy_handle
*handle,
136 [in] security_secinfo security_flags
,
137 [in,ref,size_is(offered
)] uint8
*buffer
,
143 WERROR svcctl_QueryServiceStatus
(
144 [in,ref] policy_handle
*handle,
145 [out,ref] SERVICE_STATUS
*service_status
150 [todo
] WERROR svcctl_SetServiceStatus
(
155 WERROR svcctl_UnlockServiceDatabase
(
156 [in,out,ref] policy_handle
*lock
161 [todo
] WERROR svcctl_NotifyBootConfigStatus
(
166 WERROR svcctl_SCSetServiceBitsW
(
167 [in,ref] policy_handle
*handle,
169 [in] boolean32 bitson
,
170 [in] boolean32 immediate
176 typedef [v1_enum] enum {
177 SVCCTL_SVC_ERROR_IGNORE
= 0x00000000,
178 SVCCTL_SVC_ERROR_NORMAL
= 0x00000001,
179 SVCCTL_SVC_ERROR_CRITICAL
= 0x00000002,
180 SVCCTL_SVC_ERROR_SEVERE
= 0x00000003
181 } svcctl_ErrorControl
;
183 typedef [v1_enum] enum {
184 SVCCTL_BOOT_START
= 0x00000000,
185 SVCCTL_SYSTEM_START
= 0x00000001,
186 SVCCTL_AUTO_START
= 0x00000002,
187 SVCCTL_DEMAND_START
= 0x00000003,
188 SVCCTL_DISABLED
= 0x00000004
191 WERROR svcctl_ChangeServiceConfigW
(
192 [in,ref] policy_handle
*handle,
194 [in] svcctl_StartType start_type
,
195 [in] svcctl_ErrorControl error_control
,
196 [in,unique] [string,charset
(UTF16
)] uint16
*binary_path
,
197 [in,unique] [string,charset
(UTF16
)] uint16
*load_order_group
,
198 [out,ref] uint32
*tag_id
,
199 [in,unique] [string,charset
(UTF16
)] uint16
*dependencies
,
200 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
201 [in,unique] [string,charset
(UTF16
)] uint16
*password
,
202 [in,unique] [string,charset
(UTF16
)] uint16
*display_name
207 WERROR svcctl_CreateServiceW
(
208 [in,ref] policy_handle
*scmanager_handle
,
209 [in] [string,charset
(UTF16
)] uint16 ServiceName
[],
210 [in,unique] [string,charset
(UTF16
)] uint16
*DisplayName
,
211 [in] uint32 desired_access
,
213 [in] svcctl_StartType start_type
,
214 [in] svcctl_ErrorControl error_control
,
215 [in] [string,charset
(UTF16
)] uint16 binary_path
[],
216 [in,unique] [string,charset
(UTF16
)] uint16
*LoadOrderGroupKey
,
217 [in,out,unique] uint32
*TagId
,
218 [in,unique,size_is(dependencies_size
)] uint8
*dependencies
,
219 [in] uint32 dependencies_size
,
220 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
221 [in,unique,size_is(password_size
)] uint8
*password
,
222 [in] uint32 password_size
,
223 [out,ref] policy_handle
*handle
228 WERROR svcctl_EnumDependentServicesW
(
229 [in,ref] policy_handle
*service
,
230 [in] svcctl_ServiceState state
,
231 [out,ref,size_is(offered
)] uint8
*service_status
,
232 [in,range(0,0x40000)] uint32 offered
,
233 [out,ref,range(0,0x40000)] uint32
*needed
,
234 [out,ref,range(0,0x40000)] uint32
*services_returned
240 typedef [v1_enum] enum {
241 SERVICE_STATE_ACTIVE
= 0x00000001,
242 SERVICE_STATE_INACTIVE
= 0x00000002,
243 SERVICE_STATE_ALL
= ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE
)
244 } svcctl_ServiceState
;
246 WERROR svcctl_EnumServicesStatusW
(
247 [in,ref] policy_handle
*handle,
249 [in] svcctl_ServiceState state
,
250 [out,ref,size_is(offered
)] uint8
*service
,
251 [in] [range(0,0x40000)] uint32 offered
,
252 [out,ref] [range(0,0x40000)] uint32
*needed
,
253 [out,ref] [range(0,0x40000)] uint32
*services_returned
,
254 [in,out,unique] uint32
*resume_handle
260 /* Service Control Manager Bits */
262 typedef [bitmap32bit
] bitmap
{
263 SC_RIGHT_MGR_CONNECT
= 0x0001,
264 SC_RIGHT_MGR_CREATE_SERVICE
= 0x0002,
265 SC_RIGHT_MGR_ENUMERATE_SERVICE
= 0x0004,
266 SC_RIGHT_MGR_LOCK
= 0x0008,
267 SC_RIGHT_MGR_QUERY_LOCK_STATUS
= 0x0010,
268 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG
= 0x0020
269 } svcctl_MgrAccessMask
;
271 const int SC_MANAGER_READ_ACCESS
=
272 (SEC_STD_READ_CONTROL |
273 SC_RIGHT_MGR_CONNECT |
274 SC_RIGHT_MGR_ENUMERATE_SERVICE |
275 SC_RIGHT_MGR_QUERY_LOCK_STATUS
);
277 const int SC_MANAGER_EXECUTE_ACCESS
= SC_MANAGER_READ_ACCESS
;
279 const int SC_MANAGER_WRITE_ACCESS
=
281 SC_MANAGER_READ_ACCESS |
282 SC_RIGHT_MGR_CREATE_SERVICE |
284 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG
);
286 const int SC_MANAGER_ALL_ACCESS
= SC_MANAGER_WRITE_ACCESS
;
288 WERROR svcctl_OpenSCManagerW
(
289 [in,unique] [string,charset
(UTF16
)] uint16
*MachineName
,
290 [in,unique] [string,charset
(UTF16
)] uint16
*DatabaseName
,
291 [in] svcctl_MgrAccessMask access_mask
,
292 [out,ref] policy_handle
*handle
298 /* Service Object Bits */
300 typedef [bitmap32bit
] bitmap
{
301 SC_RIGHT_SVC_QUERY_CONFIG
= 0x0001,
302 SC_RIGHT_SVC_CHANGE_CONFIG
= 0x0002,
303 SC_RIGHT_SVC_QUERY_STATUS
= 0x0004,
304 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS
= 0x0008,
305 SC_RIGHT_SVC_START
= 0x0010,
306 SC_RIGHT_SVC_STOP
= 0x0020,
307 SC_RIGHT_SVC_PAUSE_CONTINUE
= 0x0040,
308 SC_RIGHT_SVC_INTERROGATE
= 0x0080,
309 SC_RIGHT_SVC_USER_DEFINED_CONTROL
= 0x0100
310 } svcctl_ServiceAccessMask
;
312 const int SERVICE_READ_ACCESS
=
313 (SEC_STD_READ_CONTROL |
314 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
315 SC_RIGHT_SVC_INTERROGATE |
316 SC_RIGHT_SVC_QUERY_CONFIG |
317 SC_RIGHT_SVC_QUERY_STATUS |
318 SC_RIGHT_SVC_USER_DEFINED_CONTROL
);
320 const int SERVICE_EXECUTE_ACCESS
=
321 (SERVICE_READ_ACCESS |
324 SC_RIGHT_SVC_PAUSE_CONTINUE
);
326 const int SERVICE_WRITE_ACCESS
=
328 SERVICE_READ_ACCESS |
329 SERVICE_EXECUTE_ACCESS |
330 SC_RIGHT_SVC_CHANGE_CONFIG
);
332 const int SERVICE_ALL_ACCESS
= SERVICE_WRITE_ACCESS
;
334 WERROR svcctl_OpenServiceW
(
335 [in,ref] policy_handle
*scmanager_handle
,
336 [in] [string,charset
(UTF16
)] uint16 ServiceName
[],
337 [in] svcctl_ServiceAccessMask access_mask
,
338 [out,ref] policy_handle
*handle
344 typedef [public,gensize
] struct {
346 svcctl_StartType start_type
;
347 svcctl_ErrorControl error_control
;
348 [string,charset
(UTF16
)] [range(0,8192)] uint16
*executablepath
;
349 [string,charset
(UTF16
)] [range(0,8192)] uint16
*loadordergroup
;
351 [string,charset
(UTF16
)] [range(0,8192)] uint16
*dependencies
;
352 [string,charset
(UTF16
)] [range(0,8192)] uint16
*startname
;
353 [string,charset
(UTF16
)] [range(0,8192)] uint16
*displayname
;
354 } QUERY_SERVICE_CONFIG
;
356 WERROR svcctl_QueryServiceConfigW
(
357 [in,ref] policy_handle
*handle,
358 [out] QUERY_SERVICE_CONFIG
*query
,
359 [in] [range(0,8192)] uint32 offered
,
360 [out,ref] [range(0,8192)] uint32
*needed
365 WERROR svcctl_QueryServiceLockStatusW
(
366 [in,ref] policy_handle
*handle,
368 [out,ref] SERVICE_LOCK_STATUS
*lock_status
,
369 [out,ref] uint32
*needed
375 const int SC_MAX_ARGUMENT_LENGTH
= 1024;
376 const int SC_MAX_ARGUMENTS
= 1024;
379 [string,charset
(UTF16
),range(0,SC_MAX_ARGUMENT_LENGTH
)] uint16
*string;
380 } svcctl_ArgumentString
;
382 WERROR svcctl_StartServiceW
(
383 [in,ref] policy_handle
*handle,
384 [in,range(0,SC_MAX_ARGUMENTS
)] uint32 NumArgs
,
385 [in,unique,size_is(NumArgs
)] svcctl_ArgumentString
*Arguments
390 WERROR svcctl_GetServiceDisplayNameW
(
391 [in,ref] policy_handle
*handle,
392 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
393 [out,ref] [string,charset
(UTF16
)] uint16
**display_name
,
394 [in,out,unique] uint32
*display_name_length
399 WERROR svcctl_GetServiceKeyNameW
(
400 [in,ref] policy_handle
*handle,
401 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
402 [out,ref] [string,charset
(UTF16
)] uint16
**key_name
,
403 [in,out,unique] uint32
*display_name_length
408 WERROR svcctl_SCSetServiceBitsA
(
409 [in,ref] policy_handle
*handle,
411 [in] boolean32 bitson
,
412 [in] boolean32 immediate
417 WERROR svcctl_ChangeServiceConfigA
(
418 [in,ref] policy_handle
*handle,
420 [in] svcctl_StartType start_type
,
421 [in] svcctl_ErrorControl error_control
,
422 [in,unique] [string,charset
(UTF16
)] uint16
*binary_path
,
423 [in,unique] [string,charset
(UTF16
)] uint16
*load_order_group
,
424 [out,ref] uint32
*tag_id
,
425 [in,unique] [string,charset
(UTF16
)] uint16
*dependencies
,
426 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
427 [in,unique] [string,charset
(UTF16
)] uint16
*password
,
428 [in,unique] [string,charset
(UTF16
)] uint16
*display_name
433 WERROR svcctl_CreateServiceA
(
434 [in,ref] policy_handle
*handle,
435 [in,unique] [string,charset
(UTF16
)] uint16
*ServiceName
,
436 [in,unique] [string,charset
(UTF16
)] uint16
*DisplayName
,
437 [in] uint32 desired_access
,
439 [in] svcctl_StartType start_type
,
440 [in] svcctl_ErrorControl error_control
,
441 [in,unique] [string,charset
(UTF16
)] uint16
*binary_path
,
442 [in,unique] [string,charset
(UTF16
)] uint16
*LoadOrderGroupKey
,
443 [out,unique] uint32
*TagId
,
444 [in,unique] [string,charset
(UTF16
)] uint16
*dependencies
,
445 [in,unique] [string,charset
(UTF16
)] uint16
*service_start_name
,
446 [in,unique] [string,charset
(UTF16
)] uint16
*password
451 WERROR svcctl_EnumDependentServicesA
(
452 [in,ref] policy_handle
*service
,
453 [in] svcctl_ServiceState state
,
454 [out,unique] ENUM_SERVICE_STATUSA
*service_status
,
456 [out,ref] uint32
*needed
,
457 [out,ref] uint32
*services_returned
462 WERROR svcctl_EnumServicesStatusA
(
463 [in,ref] policy_handle
*handle,
465 [in] svcctl_ServiceState state
,
467 [out,size_is(offered
)] uint8 service
[*],
468 [out,ref] uint32
*needed
,
469 [out,ref] uint32
*services_returned
,
470 [in,out,unique] uint32
*resume_handle
475 WERROR svcctl_OpenSCManagerA
(
476 [in,unique] [string,charset
(UTF16
)] uint16
*MachineName
,
477 [in,unique] [string,charset
(UTF16
)] uint16
*DatabaseName
,
478 [in] uint32 access_mask
,
479 [out,ref] policy_handle
*handle
484 WERROR svcctl_OpenServiceA
(
485 [in,ref] policy_handle
*scmanager_handle
,
486 [in,unique] [string,charset
(UTF16
)] uint16
*ServiceName
,
487 [in] uint32 access_mask
492 WERROR svcctl_QueryServiceConfigA
(
493 [in,ref] policy_handle
*handle,
494 [out] uint8 query
[offered
], /*QUERYU_SERVICE_CONFIG */
496 [out,ref] uint32
*needed
501 WERROR svcctl_QueryServiceLockStatusA
(
502 [in,ref] policy_handle
*handle,
504 [out,ref] SERVICE_LOCK_STATUS
*lock_status
,
505 [out,ref] uint32
*needed
510 WERROR svcctl_StartServiceA
(
511 [in,ref] policy_handle
*handle,
513 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset
(UTF16
)] uint16
*Arguments
518 WERROR svcctl_GetServiceDisplayNameA
(
519 [in,ref] policy_handle
*handle,
520 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
521 [out,ref] [string,charset
(UTF16
)] uint16
**display_name
,
522 [in,out,unique] uint32
*display_name_length
527 WERROR svcctl_GetServiceKeyNameA
(
528 [in,ref] policy_handle
*handle,
529 [in,unique] [string,charset
(UTF16
)] uint16
*service_name
,
530 [out,ref] [string,charset
(UTF16
)] uint16
**key_name
,
531 [in,out,unique] uint32
*display_name_length
536 [todo
] WERROR svcctl_GetCurrentGroupeStateW
(
541 [todo
] WERROR svcctl_EnumServiceGroupW
(
546 WERROR svcctl_ChangeServiceConfig2A
(
547 [in,ref] policy_handle
*handle,
548 [in] uint32 info_level
,
549 [in,unique] uint8
*info
554 WERROR svcctl_ChangeServiceConfig2W
(
555 [in,ref] policy_handle
*handle,
556 [in] uint32 info_level
,
557 [in,unique] uint8
*info
563 typedef [v1_enum] enum {
564 SERVICE_CONFIG_DESCRIPTION
= 0x00000001,
565 SERVICE_CONFIG_FAILURE_ACTIONS
= 0x00000002
566 } svcctl_ConfigLevel
;
568 typedef [gensize
,public] struct {
569 [relative
] nstring
*description
;
570 } SERVICE_DESCRIPTION
;
572 typedef [v1_enum] enum {
574 SC_ACTION_RESTART
= 1,
575 SC_ACTION_REBOOT
= 2,
576 SC_ACTION_RUN_COMMAND
= 3
584 typedef [public,gensize
] struct {
586 [relative
] nstring
*rebootmsg
;
587 [relative
] nstring
*command
;
588 [range(0,1024)] uint32 num_actions
;
589 [relative
] [size_is(num_actions
)] SC_ACTION
*actions
;
590 } SERVICE_FAILURE_ACTIONS
;
592 WERROR svcctl_QueryServiceConfig2A
(
593 [in,ref] policy_handle
*handle,
594 [in] svcctl_ConfigLevel info_level
,
595 [out] uint8 buffer
[offered
],
597 [out,ref] uint32
*needed
602 WERROR svcctl_QueryServiceConfig2W
(
603 [in,ref] policy_handle
*handle,
604 [in] svcctl_ConfigLevel info_level
,
605 [out,ref,size_is(offered
)] uint8
*buffer
,
606 [in] [range(0,8192)] uint32 offered
,
607 [out,ref] [range(0,8192)] uint32
*needed
613 typedef [v1_enum] enum {
614 SVC_STATUS_PROCESS_INFO
= 0x00000000
615 } svcctl_StatusLevel
;
617 WERROR svcctl_QueryServiceStatusEx
(
618 [in,ref] policy_handle
*handle,
619 [in] svcctl_StatusLevel info_level
,
620 [out,ref,size_is(offered
)] uint8
*buffer
,
621 [in] [range(0,8192)] uint32 offered
,
622 [out,ref] [range(0,8192)] uint32
*needed
627 WERROR EnumServicesStatusExA
(
628 [in,ref] policy_handle
*scmanager
,
629 [in] uint32 info_level
,
631 [in] svcctl_ServiceState state
,
632 [out] uint8 services
[offered
],
634 [out,ref] uint32
*needed
,
635 [out,ref] uint32
*service_returned
,
636 [in,out,unique] uint32
*resume_handle
,
637 [out,ref] [string,charset
(UTF16
)] uint16
**group_name
642 WERROR EnumServicesStatusExW
(
643 [in,ref] policy_handle
*scmanager
,
644 [in] uint32 info_level
,
646 [in] svcctl_ServiceState state
,
647 [out,ref,size_is(offered
)] uint8
*services
,
648 [in] [range(0,0x40000)] uint32 offered
,
649 [out,ref] [range(0,0x40000)] uint32
*needed
,
650 [out,ref] [range(0,0x40000)] uint32
*service_returned
,
651 [in,out,unique] [range(0,0x40000)] uint32
*resume_handle
,
652 [in,unique] [string,charset
(UTF16
)] uint16
*group_name
657 [todo
] WERROR svcctl_SCSendTSMessage
(