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] uint32 security_flags,
160 [out,ref,size_is(buffer_size)] uint8 *buffer,
161 [in,range(0,0x40000)] uint32 buffer_size,
162 [out,ref,range(0,0x40000)] uint32 *needed
167 WERROR svcctl_SetServiceObjectSecurity(
168 [in] policy_handle *handle,
169 [in] uint32 security_flags,
170 [in,ref,size_is(buffer_size)] uint8 *buffer,
171 [in] uint32 buffer_size
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,
264 [out,ref,size_is(buf_size)] uint8 *service_status,
265 [in,range(0,0x40000)] uint32 buf_size,
266 [out,ref,range(0,0x40000)] uint32 *bytes_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(buf_size)] uint8 *service,
284 [in] [range(0,0x40000)] uint32 buf_size,
285 [out,ref] [range(0,0x40000)] uint32 *bytes_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 buf_size,
393 [out,ref] [range(0,8192)] uint32 *bytes_needed
398 WERROR svcctl_QueryServiceLockStatusW(
399 [in,ref] policy_handle *handle,
400 [in] uint32 buf_size,
401 [out,ref] SERVICE_LOCK_STATUS *lock_status,
402 [out,ref] uint32 *required_buf_size
407 WERROR svcctl_StartServiceW(
408 [in,ref] policy_handle *handle,
410 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
415 WERROR svcctl_GetServiceDisplayNameW(
416 [in,ref] policy_handle *handle,
417 [in,unique] [string,charset(UTF16)] uint16 *service_name,
418 [out,ref] [string,charset(UTF16)] uint16 **display_name,
419 [in,out,unique] uint32 *display_name_length
424 WERROR svcctl_GetServiceKeyNameW(
425 [in,ref] policy_handle *handle,
426 [in,unique] [string,charset(UTF16)] uint16 *service_name,
427 [out,ref] [string,charset(UTF16)] uint16 **key_name,
428 [in,out,unique] uint32 *display_name_length
433 WERROR svcctl_SCSetServiceBitsA(
434 [in,ref] policy_handle *handle,
436 [in] boolean32 bitson,
437 [in] boolean32 immediate
442 WERROR svcctl_ChangeServiceConfigA(
443 [in,ref] policy_handle *handle,
445 [in] svcctl_StartType start_type,
446 [in] svcctl_ErrorControl error_control,
447 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
448 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
449 [out,ref] uint32 *tag_id,
450 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
451 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
452 [in,unique] [string,charset(UTF16)] uint16 *password,
453 [in,unique] [string,charset(UTF16)] uint16 *display_name
458 WERROR svcctl_CreateServiceA(
459 [in,ref] policy_handle *handle,
460 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
461 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
462 [in] uint32 desired_access,
464 [in] svcctl_StartType start_type,
465 [in] svcctl_ErrorControl error_control,
466 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
467 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
468 [out,unique] uint32 *TagId,
469 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
470 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
471 [in,unique] [string,charset(UTF16)] uint16 *password
476 WERROR svcctl_EnumDependentServicesA(
477 [in,ref] policy_handle *service,
479 [out,unique] ENUM_SERVICE_STATUSA *service_status,
480 [in] uint32 buf_size,
481 [out,ref] uint32 *bytes_needed,
482 [out,ref] uint32 *services_returned
487 WERROR svcctl_EnumServicesStatusA(
488 [in,ref] policy_handle *handle,
490 [in] svcctl_ServiceState state,
491 [in] uint32 buf_size,
492 [out,size_is(buf_size)] uint8 service[*],
493 [out,ref] uint32 *bytes_needed,
494 [out,ref] uint32 *services_returned,
495 [in,out,unique] uint32 *resume_handle
500 WERROR svcctl_OpenSCManagerA(
501 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
502 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
503 [in] uint32 access_mask,
504 [out,ref] policy_handle *handle
509 WERROR svcctl_OpenServiceA(
510 [in,ref] policy_handle *scmanager_handle,
511 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
512 [in] uint32 access_mask
517 WERROR svcctl_QueryServiceConfigA(
518 [in,ref] policy_handle *handle,
519 [out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
520 [in] uint32 buf_size,
521 [out,ref] uint32 *bytes_needed
526 WERROR svcctl_QueryServiceLockStatusA(
527 [in,ref] policy_handle *handle,
528 [in] uint32 buf_size,
529 [out,ref] SERVICE_LOCK_STATUS *lock_status,
530 [out,ref] uint32 *required_buf_size
535 WERROR svcctl_StartServiceA(
536 [in,ref] policy_handle *handle,
538 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
543 WERROR svcctl_GetServiceDisplayNameA(
544 [in,ref] policy_handle *handle,
545 [in,unique] [string,charset(UTF16)] uint16 *service_name,
546 [out,ref] [string,charset(UTF16)] uint16 **display_name,
547 [in,out,unique] uint32 *display_name_length
552 WERROR svcctl_GetServiceKeyNameA(
553 [in,ref] policy_handle *handle,
554 [in,unique] [string,charset(UTF16)] uint16 *service_name,
555 [out,ref] [string,charset(UTF16)] uint16 **key_name,
556 [in,out,unique] uint32 *display_name_length
561 [todo] WERROR svcctl_GetCurrentGroupeStateW(
566 [todo] WERROR svcctl_EnumServiceGroupW(
571 WERROR svcctl_ChangeServiceConfig2A(
572 [in,ref] policy_handle *handle,
573 [in] uint32 info_level,
574 [in,unique] uint8 *info
579 WERROR svcctl_ChangeServiceConfig2W(
580 [in,ref] policy_handle *handle,
581 [in] uint32 info_level,
582 [in,unique] uint8 *info
588 typedef [v1_enum] enum {
589 SERVICE_CONFIG_DESCRIPTION = 0x00000001,
590 SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002
591 } svcctl_ConfigLevel;
593 typedef [gensize,public] struct {
594 [relative] nstring *description;
595 } SERVICE_DESCRIPTION;
597 typedef [v1_enum] enum {
599 SC_ACTION_RESTART = 1,
600 SC_ACTION_REBOOT = 2,
601 SC_ACTION_RUN_COMMAND = 3
609 typedef [public,gensize] struct {
611 [relative] nstring *rebootmsg;
612 [relative] nstring *command;
613 [range(0,1024)] uint32 num_actions;
614 [relative] [size_is(num_actions)] SC_ACTION *actions;
615 } SERVICE_FAILURE_ACTIONS;
617 WERROR svcctl_QueryServiceConfig2A(
618 [in,ref] policy_handle *handle,
619 [in] svcctl_ConfigLevel info_level,
620 [out] uint8 buffer[buf_size],
621 [in] uint32 buf_size,
622 [out,ref] uint32 *bytes_needed
627 WERROR svcctl_QueryServiceConfig2W(
628 [in,ref] policy_handle *handle,
629 [in] svcctl_ConfigLevel info_level,
630 [out,ref,size_is(buf_size)] uint8 *buffer,
631 [in] [range(0,8192)] uint32 buf_size,
632 [out,ref] [range(0,8192)] uint32 *bytes_needed
638 typedef [v1_enum] enum {
639 SVC_STATUS_PROCESS_INFO = 0x00000000
640 } svcctl_StatusLevel;
642 WERROR svcctl_QueryServiceStatusEx(
643 [in,ref] policy_handle *handle,
644 [in] svcctl_StatusLevel info_level,
645 [out,ref,size_is(buf_size)] uint8 *buffer,
646 [in] [range(0,8192)] uint32 buf_size,
647 [out,ref] [range(0,8192)] uint32 *bytes_needed
652 WERROR EnumServicesStatusExA(
653 [in,ref] policy_handle *scmanager,
654 [in] uint32 info_level,
656 [in] svcctl_ServiceState state,
657 [out] uint8 services[buf_size],
658 [in] uint32 buf_size,
659 [out,ref] uint32 *bytes_needed,
660 [out,ref] uint32 *service_returned,
661 [in,out,unique] uint32 *resume_handle,
662 [out,ref] [string,charset(UTF16)] uint16 **group_name
667 WERROR EnumServicesStatusExW(
668 [in,ref] policy_handle *scmanager,
669 [in] uint32 info_level,
671 [in] svcctl_ServiceState state,
672 [out,ref,size_is(buf_size)] uint8 *services,
673 [in] [range(0,0x40000)] uint32 buf_size,
674 [out,ref] [range(0,0x40000)] uint32 *bytes_needed,
675 [out,ref] [range(0,0x40000)] uint32 *service_returned,
676 [in,out,unique] [range(0,0x40000)] uint32 *resume_handle,
677 [in,unique] [string,charset(UTF16)] uint16 *group_name
682 [todo] WERROR svcctl_SCSendTSMessage(