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;
80 typedef [public,bitmap32bit] bitmap {
81 SV_TYPE_WORKSTATION = 0x00000001,
82 SV_TYPE_SERVER = 0x00000002,
83 SV_TYPE_SQLSERVER = 0x00000004,
84 SV_TYPE_DOMAIN_CTRL = 0x00000008,
85 SV_TYPE_DOMAIN_BAKCTRL = 0x00000010,
86 SV_TYPE_TIME_SOURCE = 0x00000020,
87 SV_TYPE_AFP = 0x00000040,
88 SV_TYPE_NOVELL = 0x00000080,
90 SV_TYPE_DOMAIN_MEMBER = 0x00000100,
91 SV_TYPE_PRINTQ_SERVER = 0x00000200,
92 SV_TYPE_DIALIN_SERVER = 0x00000400,
93 SV_TYPE_SERVER_UNIX = 0x00000800,
94 SV_TYPE_NT = 0x00001000,
95 SV_TYPE_WFW = 0x00002000,
96 SV_TYPE_SERVER_MFPN = 0x00004000,
97 SV_TYPE_SERVER_NT = 0x00008000,
98 SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
99 SV_TYPE_BACKUP_BROWSER = 0x00020000,
100 SV_TYPE_MASTER_BROWSER = 0x00040000,
101 SV_TYPE_DOMAIN_MASTER = 0x00080000,
102 SV_TYPE_SERVER_OSF = 0x00100000,
103 SV_TYPE_SERVER_VMS = 0x00200000,
104 SV_TYPE_WIN95_PLUS = 0x00400000,
105 SV_TYPE_DFS_SERVER = 0x00800000,
106 SV_TYPE_ALTERNATE_XPORT = 0x20000000,
107 SV_TYPE_LOCAL_LIST_ONLY = 0x40000000,
108 SV_TYPE_DOMAIN_ENUM = 0x80000000
111 const uint32 SV_TYPE_ALL = 0xFFFFFFFF;
115 WERROR svcctl_CloseServiceHandle(
116 [in,out,ref] policy_handle *handle
122 /* Service Controls */
124 typedef [v1_enum] enum {
125 SVCCTL_CONTROL_STOP = 0x00000001,
126 SVCCTL_CONTROL_PAUSE = 0x00000002,
127 SVCCTL_CONTROL_CONTINUE = 0x00000003,
128 SVCCTL_CONTROL_INTERROGATE = 0x00000004,
129 SVCCTL_CONTROL_SHUTDOWN = 0x00000005
132 WERROR svcctl_ControlService(
133 [in,ref] policy_handle *handle,
134 [in] SERVICE_CONTROL control,
135 [out,ref] SERVICE_STATUS *service_status
140 WERROR svcctl_DeleteService(
141 [in,ref] policy_handle *handle
147 WERROR svcctl_LockServiceDatabase(
148 [in,ref] policy_handle *handle,
149 [out,ref] policy_handle *lock
154 WERROR svcctl_QueryServiceObjectSecurity(
155 [in] policy_handle *handle,
156 [in] uint32 security_flags,
157 [out,ref,size_is(buffer_size)] uint8 *buffer,
158 [in,range(0,0x40000)] uint32 buffer_size,
159 [out,ref,range(0,0x40000)] uint32 *needed
164 WERROR svcctl_SetServiceObjectSecurity(
165 [in] policy_handle *handle,
166 [in] uint32 security_flags,
167 [in,ref,size_is(buffer_size)] uint8 *buffer,
168 [in] uint32 buffer_size
173 WERROR svcctl_QueryServiceStatus(
174 [in,ref] policy_handle *handle,
175 [out,ref] SERVICE_STATUS *service_status
180 [todo] WERROR svcctl_SetServiceStatus(
185 WERROR svcctl_UnlockServiceDatabase(
186 [in,out,ref] policy_handle *lock
191 [todo] WERROR svcctl_NotifyBootConfigStatus(
196 WERROR svcctl_SCSetServiceBitsW(
197 [in,ref] policy_handle *handle,
199 [in] boolean32 bitson,
200 [in] boolean32 immediate
206 typedef [v1_enum] enum {
207 SVCCTL_SVC_ERROR_IGNORE = 0x00000000,
208 SVCCTL_SVC_ERROR_NORMAL = 0x00000001,
209 SVCCTL_SVC_ERROR_CRITICAL = 0x00000002,
210 SVCCTL_SVC_ERROR_SEVERE = 0x00000003
211 } svcctl_ErrorControl;
213 typedef [v1_enum] enum {
214 SVCCTL_BOOT_START = 0x00000000,
215 SVCCTL_SYSTEM_START = 0x00000001,
216 SVCCTL_AUTO_START = 0x00000002,
217 SVCCTL_DEMAND_START = 0x00000003,
218 SVCCTL_DISABLED = 0x00000004
221 WERROR svcctl_ChangeServiceConfigW(
222 [in,ref] policy_handle *handle,
224 [in] svcctl_StartType start_type,
225 [in] svcctl_ErrorControl error_control,
226 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
227 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
228 [out,ref] uint32 *tag_id,
229 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
230 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
231 [in,unique] [string,charset(UTF16)] uint16 *password,
232 [in,unique] [string,charset(UTF16)] uint16 *display_name
237 WERROR svcctl_CreateServiceW(
238 [in,ref] policy_handle *scmanager_handle,
239 [in] [string,charset(UTF16)] uint16 ServiceName[],
240 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
241 [in] uint32 desired_access,
243 [in] svcctl_StartType start_type,
244 [in] svcctl_ErrorControl error_control,
245 [in] [string,charset(UTF16)] uint16 binary_path[],
246 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
247 [in,out,unique] uint32 *TagId,
248 [in,unique,size_is(dependencies_size)] uint8 *dependencies,
249 [in] uint32 dependencies_size,
250 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
251 [in,unique,size_is(password_size)] uint8 *password,
252 [in] uint32 password_size,
253 [out,ref] policy_handle *handle
258 WERROR svcctl_EnumDependentServicesW(
259 [in,ref] policy_handle *service,
261 [out,ref,size_is(buf_size)] uint8 *service_status,
262 [in,range(0,0x40000)] uint32 buf_size,
263 [out,ref,range(0,0x40000)] uint32 *bytes_needed,
264 [out,ref,range(0,0x40000)] uint32 *services_returned
270 typedef [v1_enum] enum {
271 SERVICE_STATE_ACTIVE = 0x00000001,
272 SERVICE_STATE_INACTIVE = 0x00000002,
273 SERVICE_STATE_ALL = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE )
274 } svcctl_ServiceState;
276 WERROR svcctl_EnumServicesStatusW(
277 [in,ref] policy_handle *handle,
279 [in] svcctl_ServiceState state,
280 [out,ref,size_is(buf_size)] uint8 *service,
281 [in] [range(0,262144)] uint32 buf_size,
282 [out,ref] [range(0,262144)] uint32 *bytes_needed,
283 [out,ref] [range(0,262144)] uint32 *services_returned,
284 [in,out,unique] uint32 *resume_handle
290 /* Service Control Manager Bits */
292 typedef [bitmap32bit] bitmap {
293 SC_RIGHT_MGR_CONNECT = 0x0001,
294 SC_RIGHT_MGR_CREATE_SERVICE = 0x0002,
295 SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004,
296 SC_RIGHT_MGR_LOCK = 0x0008,
297 SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010,
298 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020
299 } svcctl_MgrAccessMask;
301 const int SC_MANAGER_READ_ACCESS =
302 (SEC_STD_READ_CONTROL |
303 SC_RIGHT_MGR_CONNECT |
304 SC_RIGHT_MGR_ENUMERATE_SERVICE |
305 SC_RIGHT_MGR_QUERY_LOCK_STATUS);
307 const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS;
309 const int SC_MANAGER_WRITE_ACCESS =
311 SC_MANAGER_READ_ACCESS |
312 SC_RIGHT_MGR_CREATE_SERVICE |
314 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG);
316 const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS;
318 WERROR svcctl_OpenSCManagerW(
319 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
320 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
321 [in] svcctl_MgrAccessMask access_mask,
322 [out,ref] policy_handle *handle
328 /* Service Object Bits */
330 typedef [bitmap32bit] bitmap {
331 SC_RIGHT_SVC_QUERY_CONFIG = 0x0001,
332 SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002,
333 SC_RIGHT_SVC_QUERY_STATUS = 0x0004,
334 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008,
335 SC_RIGHT_SVC_START = 0x0010,
336 SC_RIGHT_SVC_STOP = 0x0020,
337 SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040,
338 SC_RIGHT_SVC_INTERROGATE = 0x0080,
339 SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100
340 } svcctl_ServiceAccessMask;
342 const int SERVICE_READ_ACCESS =
343 (SEC_STD_READ_CONTROL |
344 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
345 SC_RIGHT_SVC_INTERROGATE |
346 SC_RIGHT_SVC_QUERY_CONFIG |
347 SC_RIGHT_SVC_QUERY_STATUS |
348 SC_RIGHT_SVC_USER_DEFINED_CONTROL);
350 const int SERVICE_EXECUTE_ACCESS =
351 (SERVICE_READ_ACCESS |
354 SC_RIGHT_SVC_PAUSE_CONTINUE);
356 const int SERVICE_WRITE_ACCESS =
358 SERVICE_READ_ACCESS |
359 SERVICE_EXECUTE_ACCESS |
360 SC_RIGHT_SVC_CHANGE_CONFIG);
362 const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS;
364 WERROR svcctl_OpenServiceW(
365 [in,ref] policy_handle *scmanager_handle,
366 [in] [string,charset(UTF16)] uint16 ServiceName[],
367 [in] svcctl_ServiceAccessMask access_mask,
368 [out,ref] policy_handle *handle
374 typedef [public,gensize] struct {
376 svcctl_StartType start_type;
377 svcctl_ErrorControl error_control;
378 [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath;
379 [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup;
381 [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies;
382 [string,charset(UTF16)] [range(0,8192)] uint16 *startname;
383 [string,charset(UTF16)] [range(0,8192)] uint16 *displayname;
384 } QUERY_SERVICE_CONFIG;
386 WERROR svcctl_QueryServiceConfigW(
387 [in,ref] policy_handle *handle,
388 [out] QUERY_SERVICE_CONFIG *query,
389 [in] [range(0,8192)] uint32 buf_size,
390 [out,ref] [range(0,8192)] uint32 *bytes_needed
395 WERROR svcctl_QueryServiceLockStatusW(
396 [in,ref] policy_handle *handle,
397 [in] uint32 buf_size,
398 [out,ref] SERVICE_LOCK_STATUS *lock_status,
399 [out,ref] uint32 *required_buf_size
404 WERROR svcctl_StartServiceW(
405 [in,ref] policy_handle *handle,
407 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
412 WERROR svcctl_GetServiceDisplayNameW(
413 [in,ref] policy_handle *handle,
414 [in,unique] [string,charset(UTF16)] uint16 *service_name,
415 [out,ref] [string,charset(UTF16)] uint16 **display_name,
416 [in,out,unique] uint32 *display_name_length
421 WERROR svcctl_GetServiceKeyNameW(
422 [in,ref] policy_handle *handle,
423 [in,unique] [string,charset(UTF16)] uint16 *service_name,
424 [out,ref] [string,charset(UTF16)] uint16 **key_name,
425 [in,out,unique] uint32 *display_name_length
430 WERROR svcctl_SCSetServiceBitsA(
431 [in,ref] policy_handle *handle,
433 [in] boolean32 bitson,
434 [in] boolean32 immediate
439 WERROR svcctl_ChangeServiceConfigA(
440 [in,ref] policy_handle *handle,
442 [in] svcctl_StartType start_type,
443 [in] svcctl_ErrorControl error_control,
444 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
445 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
446 [out,ref] uint32 *tag_id,
447 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
448 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
449 [in,unique] [string,charset(UTF16)] uint16 *password,
450 [in,unique] [string,charset(UTF16)] uint16 *display_name
455 WERROR svcctl_CreateServiceA(
456 [in,ref] policy_handle *handle,
457 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
458 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
459 [in] uint32 desired_access,
461 [in] svcctl_StartType start_type,
462 [in] svcctl_ErrorControl error_control,
463 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
464 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
465 [out,unique] uint32 *TagId,
466 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
467 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
468 [in,unique] [string,charset(UTF16)] uint16 *password
473 WERROR svcctl_EnumDependentServicesA(
474 [in,ref] policy_handle *service,
476 [out,unique] ENUM_SERVICE_STATUSA *service_status,
477 [in] uint32 buf_size,
478 [out,ref] uint32 *bytes_needed,
479 [out,ref] uint32 *services_returned
484 WERROR svcctl_EnumServicesStatusA(
485 [in,ref] policy_handle *handle,
488 [in] uint32 buf_size,
489 [out,size_is(buf_size)] uint8 service[*],
490 [out,ref] uint32 *bytes_needed,
491 [out,ref] uint32 *services_returned,
492 [in,out,unique] uint32 *resume_handle
497 WERROR svcctl_OpenSCManagerA(
498 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
499 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
500 [in] uint32 access_mask,
501 [out,ref] policy_handle *handle
506 WERROR svcctl_OpenServiceA(
507 [in,ref] policy_handle *scmanager_handle,
508 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
509 [in] uint32 access_mask
514 WERROR svcctl_QueryServiceConfigA(
515 [in,ref] policy_handle *handle,
516 [out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
517 [in] uint32 buf_size,
518 [out,ref] uint32 *bytes_needed
523 WERROR svcctl_QueryServiceLockStatusA(
524 [in,ref] policy_handle *handle,
525 [in] uint32 buf_size,
526 [out,ref] SERVICE_LOCK_STATUS *lock_status,
527 [out,ref] uint32 *required_buf_size
532 WERROR svcctl_StartServiceA(
533 [in,ref] policy_handle *handle,
535 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
540 WERROR svcctl_GetServiceDisplayNameA(
541 [in,ref] policy_handle *handle,
542 [in,unique] [string,charset(UTF16)] uint16 *service_name,
543 [out,ref] [string,charset(UTF16)] uint16 **display_name,
544 [in,out,unique] uint32 *display_name_length
549 WERROR svcctl_GetServiceKeyNameA(
550 [in,ref] policy_handle *handle,
551 [in,unique] [string,charset(UTF16)] uint16 *service_name,
552 [out,ref] [string,charset(UTF16)] uint16 **key_name,
553 [in,out,unique] uint32 *display_name_length
558 [todo] WERROR svcctl_GetCurrentGroupeStateW(
563 [todo] WERROR svcctl_EnumServiceGroupW(
568 WERROR svcctl_ChangeServiceConfig2A(
569 [in,ref] policy_handle *handle,
570 [in] uint32 info_level,
571 [in,unique] uint8 *info
576 WERROR svcctl_ChangeServiceConfig2W(
577 [in,ref] policy_handle *handle,
578 [in] uint32 info_level,
579 [in,unique] uint8 *info
585 typedef [v1_enum] enum {
586 SERVICE_CONFIG_DESCRIPTION = 0x00000001,
587 SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002
588 } svcctl_ConfigLevel;
590 typedef [gensize,public] struct {
591 [relative] nstring *description;
592 } SERVICE_DESCRIPTION;
594 typedef [v1_enum] enum {
596 SC_ACTION_RESTART = 1,
597 SC_ACTION_REBOOT = 2,
598 SC_ACTION_RUN_COMMAND = 3
606 typedef [public,gensize] struct {
608 [relative] nstring *rebootmsg;
609 [relative] nstring *command;
610 [range(0,1024)] uint32 num_actions;
611 [relative] [size_is(num_actions)] SC_ACTION *actions;
612 } SERVICE_FAILURE_ACTIONS;
614 WERROR svcctl_QueryServiceConfig2A(
615 [in,ref] policy_handle *handle,
616 [in] svcctl_ConfigLevel info_level,
617 [out] uint8 buffer[buf_size],
618 [in] uint32 buf_size,
619 [out,ref] uint32 *bytes_needed
624 WERROR svcctl_QueryServiceConfig2W(
625 [in,ref] policy_handle *handle,
626 [in] svcctl_ConfigLevel info_level,
627 [out,ref,size_is(buf_size)] uint8 *buffer,
628 [in] [range(0,8192)] uint32 buf_size,
629 [out,ref] [range(0,8192)] uint32 *bytes_needed
635 typedef [v1_enum] enum {
636 SVC_STATUS_PROCESS_INFO = 0x00000000
637 } svcctl_StatusLevel;
639 WERROR svcctl_QueryServiceStatusEx(
640 [in,ref] policy_handle *handle,
641 [in] svcctl_StatusLevel info_level,
642 [out,ref,size_is(buf_size)] uint8 *buffer,
643 [in] [range(0,8192)] uint32 buf_size,
644 [out,ref] [range(0,8192)] uint32 *bytes_needed
649 WERROR EnumServicesStatusExA(
650 [in,ref] policy_handle *scmanager,
651 [in] uint32 info_level,
654 [out] uint8 services[buf_size],
655 [in] uint32 buf_size,
656 [out,ref] uint32 *bytes_needed,
657 [out,ref] uint32 *service_returned,
658 [in,out,unique] uint32 *resume_handle,
659 [out,ref] [string,charset(UTF16)] uint16 **group_name
664 WERROR EnumServicesStatusExW(
665 [in,ref] policy_handle *scmanager,
666 [in] uint32 info_level,
669 [out,ref,size_is(buf_size)] uint8 *services,
670 [in] [range(0,262144)] uint32 buf_size,
671 [out,ref] [range(0,262144)] uint32 *bytes_needed,
672 [out,ref] [range(0,262144)] uint32 *service_returned,
673 [in,out,unique] [range(0,262144)] uint32 *resume_handle,
674 [in,unique] [string,charset(UTF16)] uint16 *group_name
679 [todo] WERROR svcctl_SCSendTSMessage(