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;
83 typedef [public,bitmap32bit] bitmap {
84 SV_TYPE_WORKSTATION = 0x00000001,
85 SV_TYPE_SERVER = 0x00000002,
86 SV_TYPE_SQLSERVER = 0x00000004,
87 SV_TYPE_DOMAIN_CTRL = 0x00000008,
88 SV_TYPE_DOMAIN_BAKCTRL = 0x00000010,
89 SV_TYPE_TIME_SOURCE = 0x00000020,
90 SV_TYPE_AFP = 0x00000040,
91 SV_TYPE_NOVELL = 0x00000080,
93 SV_TYPE_DOMAIN_MEMBER = 0x00000100,
94 SV_TYPE_PRINTQ_SERVER = 0x00000200,
95 SV_TYPE_DIALIN_SERVER = 0x00000400,
96 SV_TYPE_SERVER_UNIX = 0x00000800,
97 SV_TYPE_NT = 0x00001000,
98 SV_TYPE_WFW = 0x00002000,
99 SV_TYPE_SERVER_MFPN = 0x00004000,
100 SV_TYPE_SERVER_NT = 0x00008000,
101 SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
102 SV_TYPE_BACKUP_BROWSER = 0x00020000,
103 SV_TYPE_MASTER_BROWSER = 0x00040000,
104 SV_TYPE_DOMAIN_MASTER = 0x00080000,
105 SV_TYPE_SERVER_OSF = 0x00100000,
106 SV_TYPE_SERVER_VMS = 0x00200000,
107 SV_TYPE_WIN95_PLUS = 0x00400000,
108 SV_TYPE_DFS_SERVER = 0x00800000,
109 SV_TYPE_ALTERNATE_XPORT = 0x20000000,
110 SV_TYPE_LOCAL_LIST_ONLY = 0x40000000,
111 SV_TYPE_DOMAIN_ENUM = 0x80000000
114 const uint32 SV_TYPE_ALL = 0xFFFFFFFF;
118 WERROR svcctl_CloseServiceHandle(
119 [in,out,ref] policy_handle *handle
125 /* Service Controls */
127 typedef [v1_enum] enum {
128 SVCCTL_CONTROL_STOP = 0x00000001,
129 SVCCTL_CONTROL_PAUSE = 0x00000002,
130 SVCCTL_CONTROL_CONTINUE = 0x00000003,
131 SVCCTL_CONTROL_INTERROGATE = 0x00000004,
132 SVCCTL_CONTROL_SHUTDOWN = 0x00000005
135 WERROR svcctl_ControlService(
136 [in,ref] policy_handle *handle,
137 [in] SERVICE_CONTROL control,
138 [out,ref] SERVICE_STATUS *service_status
143 WERROR svcctl_DeleteService(
144 [in,ref] policy_handle *handle
150 WERROR svcctl_LockServiceDatabase(
151 [in,ref] policy_handle *handle,
152 [out,ref] policy_handle *lock
157 WERROR svcctl_QueryServiceObjectSecurity(
158 [in] policy_handle *handle,
159 [in] security_secinfo security_flags,
160 [out,ref,size_is(offered)] uint8 *buffer,
161 [in,range(0,0x40000)] uint32 offered,
162 [out,ref,range(0,0x40000)] uint32 *needed
167 WERROR svcctl_SetServiceObjectSecurity(
168 [in] policy_handle *handle,
169 [in] security_secinfo security_flags,
170 [in,ref,size_is(offered)] uint8 *buffer,
176 WERROR svcctl_QueryServiceStatus(
177 [in,ref] policy_handle *handle,
178 [out,ref] SERVICE_STATUS *service_status
183 [todo] WERROR svcctl_SetServiceStatus(
188 WERROR svcctl_UnlockServiceDatabase(
189 [in,out,ref] policy_handle *lock
194 [todo] WERROR svcctl_NotifyBootConfigStatus(
199 WERROR svcctl_SCSetServiceBitsW(
200 [in,ref] policy_handle *handle,
202 [in] boolean32 bitson,
203 [in] boolean32 immediate
209 typedef [v1_enum] enum {
210 SVCCTL_SVC_ERROR_IGNORE = 0x00000000,
211 SVCCTL_SVC_ERROR_NORMAL = 0x00000001,
212 SVCCTL_SVC_ERROR_CRITICAL = 0x00000002,
213 SVCCTL_SVC_ERROR_SEVERE = 0x00000003
214 } svcctl_ErrorControl;
216 typedef [v1_enum] enum {
217 SVCCTL_BOOT_START = 0x00000000,
218 SVCCTL_SYSTEM_START = 0x00000001,
219 SVCCTL_AUTO_START = 0x00000002,
220 SVCCTL_DEMAND_START = 0x00000003,
221 SVCCTL_DISABLED = 0x00000004
224 WERROR svcctl_ChangeServiceConfigW(
225 [in,ref] policy_handle *handle,
227 [in] svcctl_StartType start_type,
228 [in] svcctl_ErrorControl error_control,
229 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
230 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
231 [out,ref] uint32 *tag_id,
232 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
233 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
234 [in,unique] [string,charset(UTF16)] uint16 *password,
235 [in,unique] [string,charset(UTF16)] uint16 *display_name
240 WERROR svcctl_CreateServiceW(
241 [in,ref] policy_handle *scmanager_handle,
242 [in] [string,charset(UTF16)] uint16 ServiceName[],
243 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
244 [in] uint32 desired_access,
246 [in] svcctl_StartType start_type,
247 [in] svcctl_ErrorControl error_control,
248 [in] [string,charset(UTF16)] uint16 binary_path[],
249 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
250 [in,out,unique] uint32 *TagId,
251 [in,unique,size_is(dependencies_size)] uint8 *dependencies,
252 [in] uint32 dependencies_size,
253 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
254 [in,unique,size_is(password_size)] uint8 *password,
255 [in] uint32 password_size,
256 [out,ref] policy_handle *handle
261 WERROR svcctl_EnumDependentServicesW(
262 [in,ref] policy_handle *service,
263 [in] svcctl_ServiceState state,
264 [out,ref,size_is(offered)] uint8 *service_status,
265 [in,range(0,0x40000)] uint32 offered,
266 [out,ref,range(0,0x40000)] uint32 *needed,
267 [out,ref,range(0,0x40000)] uint32 *services_returned
273 typedef [v1_enum] enum {
274 SERVICE_STATE_ACTIVE = 0x00000001,
275 SERVICE_STATE_INACTIVE = 0x00000002,
276 SERVICE_STATE_ALL = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE )
277 } svcctl_ServiceState;
279 WERROR svcctl_EnumServicesStatusW(
280 [in,ref] policy_handle *handle,
282 [in] svcctl_ServiceState state,
283 [out,ref,size_is(offered)] uint8 *service,
284 [in] [range(0,0x40000)] uint32 offered,
285 [out,ref] [range(0,0x40000)] uint32 *needed,
286 [out,ref] [range(0,0x40000)] uint32 *services_returned,
287 [in,out,unique] uint32 *resume_handle
293 /* Service Control Manager Bits */
295 typedef [bitmap32bit] bitmap {
296 SC_RIGHT_MGR_CONNECT = 0x0001,
297 SC_RIGHT_MGR_CREATE_SERVICE = 0x0002,
298 SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004,
299 SC_RIGHT_MGR_LOCK = 0x0008,
300 SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010,
301 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020
302 } svcctl_MgrAccessMask;
304 const int SC_MANAGER_READ_ACCESS =
305 (SEC_STD_READ_CONTROL |
306 SC_RIGHT_MGR_CONNECT |
307 SC_RIGHT_MGR_ENUMERATE_SERVICE |
308 SC_RIGHT_MGR_QUERY_LOCK_STATUS);
310 const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS;
312 const int SC_MANAGER_WRITE_ACCESS =
314 SC_MANAGER_READ_ACCESS |
315 SC_RIGHT_MGR_CREATE_SERVICE |
317 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG);
319 const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS;
321 WERROR svcctl_OpenSCManagerW(
322 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
323 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
324 [in] svcctl_MgrAccessMask access_mask,
325 [out,ref] policy_handle *handle
331 /* Service Object Bits */
333 typedef [bitmap32bit] bitmap {
334 SC_RIGHT_SVC_QUERY_CONFIG = 0x0001,
335 SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002,
336 SC_RIGHT_SVC_QUERY_STATUS = 0x0004,
337 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008,
338 SC_RIGHT_SVC_START = 0x0010,
339 SC_RIGHT_SVC_STOP = 0x0020,
340 SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040,
341 SC_RIGHT_SVC_INTERROGATE = 0x0080,
342 SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100
343 } svcctl_ServiceAccessMask;
345 const int SERVICE_READ_ACCESS =
346 (SEC_STD_READ_CONTROL |
347 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
348 SC_RIGHT_SVC_INTERROGATE |
349 SC_RIGHT_SVC_QUERY_CONFIG |
350 SC_RIGHT_SVC_QUERY_STATUS |
351 SC_RIGHT_SVC_USER_DEFINED_CONTROL);
353 const int SERVICE_EXECUTE_ACCESS =
354 (SERVICE_READ_ACCESS |
357 SC_RIGHT_SVC_PAUSE_CONTINUE);
359 const int SERVICE_WRITE_ACCESS =
361 SERVICE_READ_ACCESS |
362 SERVICE_EXECUTE_ACCESS |
363 SC_RIGHT_SVC_CHANGE_CONFIG);
365 const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS;
367 WERROR svcctl_OpenServiceW(
368 [in,ref] policy_handle *scmanager_handle,
369 [in] [string,charset(UTF16)] uint16 ServiceName[],
370 [in] svcctl_ServiceAccessMask access_mask,
371 [out,ref] policy_handle *handle
377 typedef [public,gensize] struct {
379 svcctl_StartType start_type;
380 svcctl_ErrorControl error_control;
381 [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath;
382 [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup;
384 [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies;
385 [string,charset(UTF16)] [range(0,8192)] uint16 *startname;
386 [string,charset(UTF16)] [range(0,8192)] uint16 *displayname;
387 } QUERY_SERVICE_CONFIG;
389 WERROR svcctl_QueryServiceConfigW(
390 [in,ref] policy_handle *handle,
391 [out] QUERY_SERVICE_CONFIG *query,
392 [in] [range(0,8192)] uint32 offered,
393 [out,ref] [range(0,8192)] uint32 *needed
398 WERROR svcctl_QueryServiceLockStatusW(
399 [in,ref] policy_handle *handle,
401 [out,ref] SERVICE_LOCK_STATUS *lock_status,
402 [out,ref] uint32 *needed
408 const int SC_MAX_ARGUMENT_LENGTH = 1024;
409 const int SC_MAX_ARGUMENTS = 1024;
412 [string,charset(UTF16),range(0,SC_MAX_ARGUMENT_LENGTH)] uint16 *string;
413 } svcctl_ArgumentString;
415 WERROR svcctl_StartServiceW(
416 [in,ref] policy_handle *handle,
417 [in,range(0,SC_MAX_ARGUMENTS)] uint32 NumArgs,
418 [in,unique,size_is(NumArgs)] svcctl_ArgumentString *Arguments
423 WERROR svcctl_GetServiceDisplayNameW(
424 [in,ref] policy_handle *handle,
425 [in,unique] [string,charset(UTF16)] uint16 *service_name,
426 [out,ref] [string,charset(UTF16)] uint16 **display_name,
427 [in,out,unique] uint32 *display_name_length
432 WERROR svcctl_GetServiceKeyNameW(
433 [in,ref] policy_handle *handle,
434 [in,unique] [string,charset(UTF16)] uint16 *service_name,
435 [out,ref] [string,charset(UTF16)] uint16 **key_name,
436 [in,out,unique] uint32 *display_name_length
441 WERROR svcctl_SCSetServiceBitsA(
442 [in,ref] policy_handle *handle,
444 [in] boolean32 bitson,
445 [in] boolean32 immediate
450 WERROR svcctl_ChangeServiceConfigA(
451 [in,ref] policy_handle *handle,
453 [in] svcctl_StartType start_type,
454 [in] svcctl_ErrorControl error_control,
455 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
456 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
457 [out,ref] uint32 *tag_id,
458 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
459 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
460 [in,unique] [string,charset(UTF16)] uint16 *password,
461 [in,unique] [string,charset(UTF16)] uint16 *display_name
466 WERROR svcctl_CreateServiceA(
467 [in,ref] policy_handle *handle,
468 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
469 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
470 [in] uint32 desired_access,
472 [in] svcctl_StartType start_type,
473 [in] svcctl_ErrorControl error_control,
474 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
475 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
476 [out,unique] uint32 *TagId,
477 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
478 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
479 [in,unique] [string,charset(UTF16)] uint16 *password
484 WERROR svcctl_EnumDependentServicesA(
485 [in,ref] policy_handle *service,
486 [in] svcctl_ServiceState state,
487 [out,unique] ENUM_SERVICE_STATUSA *service_status,
489 [out,ref] uint32 *needed,
490 [out,ref] uint32 *services_returned
495 WERROR svcctl_EnumServicesStatusA(
496 [in,ref] policy_handle *handle,
498 [in] svcctl_ServiceState state,
500 [out,size_is(offered)] uint8 service[*],
501 [out,ref] uint32 *needed,
502 [out,ref] uint32 *services_returned,
503 [in,out,unique] uint32 *resume_handle
508 WERROR svcctl_OpenSCManagerA(
509 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
510 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
511 [in] uint32 access_mask,
512 [out,ref] policy_handle *handle
517 WERROR svcctl_OpenServiceA(
518 [in,ref] policy_handle *scmanager_handle,
519 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
520 [in] uint32 access_mask
525 WERROR svcctl_QueryServiceConfigA(
526 [in,ref] policy_handle *handle,
527 [out] uint8 query[offered], /*QUERYU_SERVICE_CONFIG */
529 [out,ref] uint32 *needed
534 WERROR svcctl_QueryServiceLockStatusA(
535 [in,ref] policy_handle *handle,
537 [out,ref] SERVICE_LOCK_STATUS *lock_status,
538 [out,ref] uint32 *needed
543 WERROR svcctl_StartServiceA(
544 [in,ref] policy_handle *handle,
546 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
551 WERROR svcctl_GetServiceDisplayNameA(
552 [in,ref] policy_handle *handle,
553 [in,unique] [string,charset(UTF16)] uint16 *service_name,
554 [out,ref] [string,charset(UTF16)] uint16 **display_name,
555 [in,out,unique] uint32 *display_name_length
560 WERROR svcctl_GetServiceKeyNameA(
561 [in,ref] policy_handle *handle,
562 [in,unique] [string,charset(UTF16)] uint16 *service_name,
563 [out,ref] [string,charset(UTF16)] uint16 **key_name,
564 [in,out,unique] uint32 *display_name_length
569 [todo] WERROR svcctl_GetCurrentGroupeStateW(
574 [todo] WERROR svcctl_EnumServiceGroupW(
579 WERROR svcctl_ChangeServiceConfig2A(
580 [in,ref] policy_handle *handle,
581 [in] uint32 info_level,
582 [in,unique] uint8 *info
587 WERROR svcctl_ChangeServiceConfig2W(
588 [in,ref] policy_handle *handle,
589 [in] uint32 info_level,
590 [in,unique] uint8 *info
596 typedef [v1_enum] enum {
597 SERVICE_CONFIG_DESCRIPTION = 0x00000001,
598 SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002
599 } svcctl_ConfigLevel;
601 typedef [gensize,public] struct {
602 [relative] nstring *description;
603 } SERVICE_DESCRIPTION;
605 typedef [v1_enum] enum {
607 SC_ACTION_RESTART = 1,
608 SC_ACTION_REBOOT = 2,
609 SC_ACTION_RUN_COMMAND = 3
617 typedef [public,gensize] struct {
619 [relative] nstring *rebootmsg;
620 [relative] nstring *command;
621 [range(0,1024)] uint32 num_actions;
622 [relative] [size_is(num_actions)] SC_ACTION *actions;
623 } SERVICE_FAILURE_ACTIONS;
625 WERROR svcctl_QueryServiceConfig2A(
626 [in,ref] policy_handle *handle,
627 [in] svcctl_ConfigLevel info_level,
628 [out] uint8 buffer[offered],
630 [out,ref] uint32 *needed
635 WERROR svcctl_QueryServiceConfig2W(
636 [in,ref] policy_handle *handle,
637 [in] svcctl_ConfigLevel info_level,
638 [out,ref,size_is(offered)] uint8 *buffer,
639 [in] [range(0,8192)] uint32 offered,
640 [out,ref] [range(0,8192)] uint32 *needed
646 typedef [v1_enum] enum {
647 SVC_STATUS_PROCESS_INFO = 0x00000000
648 } svcctl_StatusLevel;
650 WERROR svcctl_QueryServiceStatusEx(
651 [in,ref] policy_handle *handle,
652 [in] svcctl_StatusLevel info_level,
653 [out,ref,size_is(offered)] uint8 *buffer,
654 [in] [range(0,8192)] uint32 offered,
655 [out,ref] [range(0,8192)] uint32 *needed
660 WERROR EnumServicesStatusExA(
661 [in,ref] policy_handle *scmanager,
662 [in] uint32 info_level,
664 [in] svcctl_ServiceState state,
665 [out] uint8 services[offered],
667 [out,ref] uint32 *needed,
668 [out,ref] uint32 *service_returned,
669 [in,out,unique] uint32 *resume_handle,
670 [out,ref] [string,charset(UTF16)] uint16 **group_name
675 WERROR EnumServicesStatusExW(
676 [in,ref] policy_handle *scmanager,
677 [in] uint32 info_level,
679 [in] svcctl_ServiceState state,
680 [out,ref,size_is(offered)] uint8 *services,
681 [in] [range(0,0x40000)] uint32 offered,
682 [out,ref] [range(0,0x40000)] uint32 *needed,
683 [out,ref] [range(0,0x40000)] uint32 *service_returned,
684 [in,out,unique] [range(0,0x40000)] uint32 *resume_handle,
685 [in,unique] [string,charset(UTF16)] uint16 *group_name
690 [todo] WERROR svcctl_SCSendTSMessage(