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 helpstring("Service Control")
17 [string,charset(UTF16)] uint16 *lock_owner;
19 } SERVICE_LOCK_STATUS;
21 typedef [v1_enum] enum {
22 SVCCTL_STATE_UNKNOWN = 0x00000000, /* only used internally to smbd */
23 SVCCTL_STOPPED = 0x00000001,
24 SVCCTL_START_PENDING = 0x00000002,
25 SVCCTL_STOP_PENDING = 0x00000003,
26 SVCCTL_RUNNING = 0x00000004,
27 SVCCTL_CONTINUE_PENDING = 0x00000005,
28 SVCCTL_PAUSE_PENDING = 0x00000006,
29 SVCCTL_PAUSED = 0x00000007
30 } svcctl_ServiceStatus;
32 typedef [bitmap32bit] bitmap {
33 SVCCTL_ACCEPT_NONE = 0x00000000,
34 SVCCTL_ACCEPT_STOP = 0x00000001,
35 SVCCTL_ACCEPT_PAUSE_CONTINUE = 0x00000002,
36 SVCCTL_ACCEPT_SHUTDOWN = 0x00000004,
37 SVCCTL_ACCEPT_PARAMCHANGE = 0x00000008,
38 SVCCTL_ACCEPT_NETBINDCHANGE = 0x00000010,
39 SVCCTL_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020,
40 SVCCTL_ACCEPT_POWEREVENT = 0x00000040
41 } svcctl_ControlsAccepted;
45 svcctl_ServiceStatus state;
46 svcctl_ControlsAccepted controls_accepted;
47 WERROR win32_exit_code;
48 uint32 service_exit_code;
53 typedef [public] struct {
54 SERVICE_STATUS status;
57 } SERVICE_STATUS_PROCESS;
59 typedef [public,gensize] struct {
60 [relative] nstring *service_name;
61 [relative] nstring *display_name;
62 SERVICE_STATUS status;
63 } ENUM_SERVICE_STATUSW;
65 typedef [public,gensize] struct {
66 [relative] astring *service_name;
67 [relative] astring *display_name;
68 SERVICE_STATUS status;
69 } ENUM_SERVICE_STATUSA;
71 const int SERVICE_TYPE_KERNEL_DRIVER = 0x01;
72 const int SERVICE_TYPE_FS_DRIVER = 0x02;
73 const int SERVICE_TYPE_ADAPTER = 0x04;
74 const int SERVICE_TYPE_RECOGNIZER_DRIVER = 0x08;
75 const int SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER;
76 const int SERVICE_TYPE_WIN32_OWN_PROCESS = 0x10;
77 const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20;
78 const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS;
79 const int SERVICE_TYPE_INTERACTIVE_PROCESS = 0x100;
81 typedef [public,bitmap32bit] bitmap {
82 SV_TYPE_WORKSTATION = 0x00000001,
83 SV_TYPE_SERVER = 0x00000002,
84 SV_TYPE_SQLSERVER = 0x00000004,
85 SV_TYPE_DOMAIN_CTRL = 0x00000008,
86 SV_TYPE_DOMAIN_BAKCTRL = 0x00000010,
87 SV_TYPE_TIME_SOURCE = 0x00000020,
88 SV_TYPE_AFP = 0x00000040,
89 SV_TYPE_NOVELL = 0x00000080,
91 SV_TYPE_DOMAIN_MEMBER = 0x00000100,
92 SV_TYPE_PRINTQ_SERVER = 0x00000200,
93 SV_TYPE_DIALIN_SERVER = 0x00000400,
94 SV_TYPE_SERVER_UNIX = 0x00000800,
95 SV_TYPE_NT = 0x00001000,
96 SV_TYPE_WFW = 0x00002000,
97 SV_TYPE_SERVER_MFPN = 0x00004000,
98 SV_TYPE_SERVER_NT = 0x00008000,
99 SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
100 SV_TYPE_BACKUP_BROWSER = 0x00020000,
101 SV_TYPE_MASTER_BROWSER = 0x00040000,
102 SV_TYPE_DOMAIN_MASTER = 0x00080000,
103 SV_TYPE_SERVER_OSF = 0x00100000,
104 SV_TYPE_SERVER_VMS = 0x00200000,
105 SV_TYPE_WIN95_PLUS = 0x00400000,
106 SV_TYPE_DFS_SERVER = 0x00800000,
107 SV_TYPE_ALTERNATE_XPORT = 0x20000000,
108 SV_TYPE_LOCAL_LIST_ONLY = 0x40000000,
109 SV_TYPE_DOMAIN_ENUM = 0x80000000
112 const uint32 SV_TYPE_ALL = 0xFFFFFFFF;
116 WERROR svcctl_CloseServiceHandle(
117 [in,out,ref] policy_handle *handle
123 /* Service Controls */
125 typedef [v1_enum] enum {
126 SVCCTL_CONTROL_STOP = 0x00000001,
127 SVCCTL_CONTROL_PAUSE = 0x00000002,
128 SVCCTL_CONTROL_CONTINUE = 0x00000003,
129 SVCCTL_CONTROL_INTERROGATE = 0x00000004,
130 SVCCTL_CONTROL_SHUTDOWN = 0x00000005
133 WERROR svcctl_ControlService(
134 [in,ref] policy_handle *handle,
135 [in] SERVICE_CONTROL control,
136 [out,ref] SERVICE_STATUS *service_status
141 WERROR svcctl_DeleteService(
142 [in,ref] policy_handle *handle
148 WERROR svcctl_LockServiceDatabase(
149 [in,ref] policy_handle *handle,
150 [out,ref] policy_handle *lock
155 WERROR svcctl_QueryServiceObjectSecurity(
156 [in] policy_handle *handle,
157 [in] uint32 security_flags,
158 [out,ref,size_is(buffer_size)] uint8 *buffer,
159 [in,range(0,0x40000)] uint32 buffer_size,
160 [out,ref,range(0,0x40000)] uint32 *needed
165 WERROR svcctl_SetServiceObjectSecurity(
166 [in] policy_handle *handle,
167 [in] uint32 security_flags,
168 [in,ref,size_is(buffer_size)] uint8 *buffer,
169 [in] uint32 buffer_size
174 WERROR svcctl_QueryServiceStatus(
175 [in,ref] policy_handle *handle,
176 [out,ref] SERVICE_STATUS *service_status
181 [todo] WERROR svcctl_SetServiceStatus(
186 WERROR svcctl_UnlockServiceDatabase(
187 [in,out,ref] policy_handle *lock
192 [todo] WERROR svcctl_NotifyBootConfigStatus(
197 WERROR svcctl_SCSetServiceBitsW(
198 [in,ref] policy_handle *handle,
200 [in] boolean32 bitson,
201 [in] boolean32 immediate
207 typedef [v1_enum] enum {
208 SVCCTL_SVC_ERROR_IGNORE = 0x00000000,
209 SVCCTL_SVC_ERROR_NORMAL = 0x00000001,
210 SVCCTL_SVC_ERROR_CRITICAL = 0x00000002,
211 SVCCTL_SVC_ERROR_SEVERE = 0x00000003
212 } svcctl_ErrorControl;
214 typedef [v1_enum] enum {
215 SVCCTL_BOOT_START = 0x00000000,
216 SVCCTL_SYSTEM_START = 0x00000001,
217 SVCCTL_AUTO_START = 0x00000002,
218 SVCCTL_DEMAND_START = 0x00000003,
219 SVCCTL_DISABLED = 0x00000004
222 WERROR svcctl_ChangeServiceConfigW(
223 [in,ref] policy_handle *handle,
225 [in] svcctl_StartType start_type,
226 [in] svcctl_ErrorControl error_control,
227 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
228 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
229 [out,ref] uint32 *tag_id,
230 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
231 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
232 [in,unique] [string,charset(UTF16)] uint16 *password,
233 [in,unique] [string,charset(UTF16)] uint16 *display_name
238 WERROR svcctl_CreateServiceW(
239 [in,ref] policy_handle *scmanager_handle,
240 [in] [string,charset(UTF16)] uint16 ServiceName[],
241 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
242 [in] uint32 desired_access,
244 [in] svcctl_StartType start_type,
245 [in] svcctl_ErrorControl error_control,
246 [in] [string,charset(UTF16)] uint16 binary_path[],
247 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
248 [in,out,unique] uint32 *TagId,
249 [in,unique,size_is(dependencies_size)] uint8 *dependencies,
250 [in] uint32 dependencies_size,
251 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
252 [in,unique,size_is(password_size)] uint8 *password,
253 [in] uint32 password_size,
254 [out,ref] policy_handle *handle
259 WERROR svcctl_EnumDependentServicesW(
260 [in,ref] policy_handle *service,
262 [out,ref,size_is(buf_size)] uint8 *service_status,
263 [in,range(0,0x40000)] uint32 buf_size,
264 [out,ref,range(0,0x40000)] uint32 *bytes_needed,
265 [out,ref,range(0,0x40000)] uint32 *services_returned
271 typedef [v1_enum] enum {
272 SERVICE_STATE_ACTIVE = 0x00000001,
273 SERVICE_STATE_INACTIVE = 0x00000002,
274 SERVICE_STATE_ALL = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE )
275 } svcctl_ServiceState;
277 WERROR svcctl_EnumServicesStatusW(
278 [in,ref] policy_handle *handle,
280 [in] svcctl_ServiceState state,
281 [out,ref,size_is(buf_size)] uint8 *service,
282 [in] [range(0,0x40000)] uint32 buf_size,
283 [out,ref] [range(0,0x40000)] uint32 *bytes_needed,
284 [out,ref] [range(0,0x40000)] uint32 *services_returned,
285 [in,out,unique] uint32 *resume_handle
291 /* Service Control Manager Bits */
293 typedef [bitmap32bit] bitmap {
294 SC_RIGHT_MGR_CONNECT = 0x0001,
295 SC_RIGHT_MGR_CREATE_SERVICE = 0x0002,
296 SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004,
297 SC_RIGHT_MGR_LOCK = 0x0008,
298 SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010,
299 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020
300 } svcctl_MgrAccessMask;
302 const int SC_MANAGER_READ_ACCESS =
303 (SEC_STD_READ_CONTROL |
304 SC_RIGHT_MGR_CONNECT |
305 SC_RIGHT_MGR_ENUMERATE_SERVICE |
306 SC_RIGHT_MGR_QUERY_LOCK_STATUS);
308 const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS;
310 const int SC_MANAGER_WRITE_ACCESS =
312 SC_MANAGER_READ_ACCESS |
313 SC_RIGHT_MGR_CREATE_SERVICE |
315 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG);
317 const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS;
319 WERROR svcctl_OpenSCManagerW(
320 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
321 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
322 [in] svcctl_MgrAccessMask access_mask,
323 [out,ref] policy_handle *handle
329 /* Service Object Bits */
331 typedef [bitmap32bit] bitmap {
332 SC_RIGHT_SVC_QUERY_CONFIG = 0x0001,
333 SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002,
334 SC_RIGHT_SVC_QUERY_STATUS = 0x0004,
335 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008,
336 SC_RIGHT_SVC_START = 0x0010,
337 SC_RIGHT_SVC_STOP = 0x0020,
338 SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040,
339 SC_RIGHT_SVC_INTERROGATE = 0x0080,
340 SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100
341 } svcctl_ServiceAccessMask;
343 const int SERVICE_READ_ACCESS =
344 (SEC_STD_READ_CONTROL |
345 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
346 SC_RIGHT_SVC_INTERROGATE |
347 SC_RIGHT_SVC_QUERY_CONFIG |
348 SC_RIGHT_SVC_QUERY_STATUS |
349 SC_RIGHT_SVC_USER_DEFINED_CONTROL);
351 const int SERVICE_EXECUTE_ACCESS =
352 (SERVICE_READ_ACCESS |
355 SC_RIGHT_SVC_PAUSE_CONTINUE);
357 const int SERVICE_WRITE_ACCESS =
359 SERVICE_READ_ACCESS |
360 SERVICE_EXECUTE_ACCESS |
361 SC_RIGHT_SVC_CHANGE_CONFIG);
363 const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS;
365 WERROR svcctl_OpenServiceW(
366 [in,ref] policy_handle *scmanager_handle,
367 [in] [string,charset(UTF16)] uint16 ServiceName[],
368 [in] svcctl_ServiceAccessMask access_mask,
369 [out,ref] policy_handle *handle
375 typedef [public,gensize] struct {
377 svcctl_StartType start_type;
378 svcctl_ErrorControl error_control;
379 [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath;
380 [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup;
382 [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies;
383 [string,charset(UTF16)] [range(0,8192)] uint16 *startname;
384 [string,charset(UTF16)] [range(0,8192)] uint16 *displayname;
385 } QUERY_SERVICE_CONFIG;
387 WERROR svcctl_QueryServiceConfigW(
388 [in,ref] policy_handle *handle,
389 [out] QUERY_SERVICE_CONFIG *query,
390 [in] [range(0,8192)] uint32 buf_size,
391 [out,ref] [range(0,8192)] uint32 *bytes_needed
396 WERROR svcctl_QueryServiceLockStatusW(
397 [in,ref] policy_handle *handle,
398 [in] uint32 buf_size,
399 [out,ref] SERVICE_LOCK_STATUS *lock_status,
400 [out,ref] uint32 *required_buf_size
405 WERROR svcctl_StartServiceW(
406 [in,ref] policy_handle *handle,
408 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
413 WERROR svcctl_GetServiceDisplayNameW(
414 [in,ref] policy_handle *handle,
415 [in,unique] [string,charset(UTF16)] uint16 *service_name,
416 [out,ref] [string,charset(UTF16)] uint16 **display_name,
417 [in,out,unique] uint32 *display_name_length
422 WERROR svcctl_GetServiceKeyNameW(
423 [in,ref] policy_handle *handle,
424 [in,unique] [string,charset(UTF16)] uint16 *service_name,
425 [out,ref] [string,charset(UTF16)] uint16 **key_name,
426 [in,out,unique] uint32 *display_name_length
431 WERROR svcctl_SCSetServiceBitsA(
432 [in,ref] policy_handle *handle,
434 [in] boolean32 bitson,
435 [in] boolean32 immediate
440 WERROR svcctl_ChangeServiceConfigA(
441 [in,ref] policy_handle *handle,
443 [in] svcctl_StartType start_type,
444 [in] svcctl_ErrorControl error_control,
445 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
446 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
447 [out,ref] uint32 *tag_id,
448 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
449 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
450 [in,unique] [string,charset(UTF16)] uint16 *password,
451 [in,unique] [string,charset(UTF16)] uint16 *display_name
456 WERROR svcctl_CreateServiceA(
457 [in,ref] policy_handle *handle,
458 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
459 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
460 [in] uint32 desired_access,
462 [in] svcctl_StartType start_type,
463 [in] svcctl_ErrorControl error_control,
464 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
465 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
466 [out,unique] uint32 *TagId,
467 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
468 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
469 [in,unique] [string,charset(UTF16)] uint16 *password
474 WERROR svcctl_EnumDependentServicesA(
475 [in,ref] policy_handle *service,
477 [out,unique] ENUM_SERVICE_STATUSA *service_status,
478 [in] uint32 buf_size,
479 [out,ref] uint32 *bytes_needed,
480 [out,ref] uint32 *services_returned
485 WERROR svcctl_EnumServicesStatusA(
486 [in,ref] policy_handle *handle,
488 [in] svcctl_ServiceState state,
489 [in] uint32 buf_size,
490 [out,size_is(buf_size)] uint8 service[*],
491 [out,ref] uint32 *bytes_needed,
492 [out,ref] uint32 *services_returned,
493 [in,out,unique] uint32 *resume_handle
498 WERROR svcctl_OpenSCManagerA(
499 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
500 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
501 [in] uint32 access_mask,
502 [out,ref] policy_handle *handle
507 WERROR svcctl_OpenServiceA(
508 [in,ref] policy_handle *scmanager_handle,
509 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
510 [in] uint32 access_mask
515 WERROR svcctl_QueryServiceConfigA(
516 [in,ref] policy_handle *handle,
517 [out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
518 [in] uint32 buf_size,
519 [out,ref] uint32 *bytes_needed
524 WERROR svcctl_QueryServiceLockStatusA(
525 [in,ref] policy_handle *handle,
526 [in] uint32 buf_size,
527 [out,ref] SERVICE_LOCK_STATUS *lock_status,
528 [out,ref] uint32 *required_buf_size
533 WERROR svcctl_StartServiceA(
534 [in,ref] policy_handle *handle,
536 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
541 WERROR svcctl_GetServiceDisplayNameA(
542 [in,ref] policy_handle *handle,
543 [in,unique] [string,charset(UTF16)] uint16 *service_name,
544 [out,ref] [string,charset(UTF16)] uint16 **display_name,
545 [in,out,unique] uint32 *display_name_length
550 WERROR svcctl_GetServiceKeyNameA(
551 [in,ref] policy_handle *handle,
552 [in,unique] [string,charset(UTF16)] uint16 *service_name,
553 [out,ref] [string,charset(UTF16)] uint16 **key_name,
554 [in,out,unique] uint32 *display_name_length
559 [todo] WERROR svcctl_GetCurrentGroupeStateW(
564 [todo] WERROR svcctl_EnumServiceGroupW(
569 WERROR svcctl_ChangeServiceConfig2A(
570 [in,ref] policy_handle *handle,
571 [in] uint32 info_level,
572 [in,unique] uint8 *info
577 WERROR svcctl_ChangeServiceConfig2W(
578 [in,ref] policy_handle *handle,
579 [in] uint32 info_level,
580 [in,unique] uint8 *info
586 typedef [v1_enum] enum {
587 SERVICE_CONFIG_DESCRIPTION = 0x00000001,
588 SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002
589 } svcctl_ConfigLevel;
591 typedef [gensize,public] struct {
592 [relative] nstring *description;
593 } SERVICE_DESCRIPTION;
595 typedef [v1_enum] enum {
597 SC_ACTION_RESTART = 1,
598 SC_ACTION_REBOOT = 2,
599 SC_ACTION_RUN_COMMAND = 3
607 typedef [public,gensize] struct {
609 [relative] nstring *rebootmsg;
610 [relative] nstring *command;
611 [range(0,1024)] uint32 num_actions;
612 [relative] [size_is(num_actions)] SC_ACTION *actions;
613 } SERVICE_FAILURE_ACTIONS;
615 WERROR svcctl_QueryServiceConfig2A(
616 [in,ref] policy_handle *handle,
617 [in] svcctl_ConfigLevel info_level,
618 [out] uint8 buffer[buf_size],
619 [in] uint32 buf_size,
620 [out,ref] uint32 *bytes_needed
625 WERROR svcctl_QueryServiceConfig2W(
626 [in,ref] policy_handle *handle,
627 [in] svcctl_ConfigLevel info_level,
628 [out,ref,size_is(buf_size)] uint8 *buffer,
629 [in] [range(0,8192)] uint32 buf_size,
630 [out,ref] [range(0,8192)] uint32 *bytes_needed
636 typedef [v1_enum] enum {
637 SVC_STATUS_PROCESS_INFO = 0x00000000
638 } svcctl_StatusLevel;
640 WERROR svcctl_QueryServiceStatusEx(
641 [in,ref] policy_handle *handle,
642 [in] svcctl_StatusLevel info_level,
643 [out,ref,size_is(buf_size)] uint8 *buffer,
644 [in] [range(0,8192)] uint32 buf_size,
645 [out,ref] [range(0,8192)] uint32 *bytes_needed
650 WERROR EnumServicesStatusExA(
651 [in,ref] policy_handle *scmanager,
652 [in] uint32 info_level,
654 [in] svcctl_ServiceState state,
655 [out] uint8 services[buf_size],
656 [in] uint32 buf_size,
657 [out,ref] uint32 *bytes_needed,
658 [out,ref] uint32 *service_returned,
659 [in,out,unique] uint32 *resume_handle,
660 [out,ref] [string,charset(UTF16)] uint16 **group_name
665 WERROR EnumServicesStatusExW(
666 [in,ref] policy_handle *scmanager,
667 [in] uint32 info_level,
669 [in] svcctl_ServiceState state,
670 [out,ref,size_is(buf_size)] uint8 *services,
671 [in] [range(0,0x40000)] uint32 buf_size,
672 [out,ref] [range(0,0x40000)] uint32 *bytes_needed,
673 [out,ref] [range(0,0x40000)] uint32 *service_returned,
674 [in,out,unique] [range(0,0x40000)] uint32 *resume_handle,
675 [in,unique] [string,charset(UTF16)] uint16 *group_name
680 [todo] WERROR svcctl_SCSendTSMessage(