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;
60 [relative] astring *service_name;
61 [relative] astring *display_name;
62 SERVICE_STATUS status;
63 } ENUM_SERVICE_STATUS;
65 const int SERVICE_TYPE_KERNEL_DRIVER = 0x01;
66 const int SERVICE_TYPE_FS_DRIVER = 0x02;
67 const int SERVICE_TYPE_ADAPTER = 0x04;
68 const int SERVICE_TYPE_RECOGNIZER_DRIVER = 0x08;
69 const int SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER;
70 const int SERVICE_TYPE_WIN32_OWN_PROCESS = 0x10;
71 const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20;
72 const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS;
74 const int SERVICE_STATE_ACTIVE = 0x01;
75 const int SERVICE_STATE_INACTIVE = 0x02;
76 const int SERVICE_STATE_ALL = 0x03;
78 typedef [public,bitmap32bit] bitmap {
79 SV_TYPE_WORKSTATION = 0x00000001,
80 SV_TYPE_SERVER = 0x00000002,
81 SV_TYPE_SQLSERVER = 0x00000004,
82 SV_TYPE_DOMAIN_CTRL = 0x00000008,
83 SV_TYPE_DOMAIN_BAKCTRL = 0x00000010,
84 SV_TYPE_TIME_SOURCE = 0x00000020,
85 SV_TYPE_AFP = 0x00000040,
86 SV_TYPE_NOVELL = 0x00000080,
88 SV_TYPE_DOMAIN_MEMBER = 0x00000100,
89 SV_TYPE_PRINTQ_SERVER = 0x00000200,
90 SV_TYPE_DIALIN_SERVER = 0x00000400,
91 SV_TYPE_SERVER_UNIX = 0x00000800,
92 SV_TYPE_NT = 0x00001000,
93 SV_TYPE_WFW = 0x00002000,
94 SV_TYPE_SERVER_MFPN = 0x00004000,
95 SV_TYPE_SERVER_NT = 0x00008000,
96 SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
97 SV_TYPE_BACKUP_BROWSER = 0x00020000,
98 SV_TYPE_MASTER_BROWSER = 0x00040000,
99 SV_TYPE_DOMAIN_MASTER = 0x00080000,
100 SV_TYPE_SERVER_OSF = 0x00100000,
101 SV_TYPE_SERVER_VMS = 0x00200000,
102 SV_TYPE_WIN95_PLUS = 0x00400000,
103 SV_TYPE_DFS_SERVER = 0x00800000,
104 SV_TYPE_ALTERNATE_XPORT = 0x20000000,
105 SV_TYPE_LOCAL_LIST_ONLY = 0x40000000,
106 SV_TYPE_DOMAIN_ENUM = 0x80000000
109 const uint32 SV_TYPE_ALL = 0xFFFFFFFF;
113 WERROR svcctl_CloseServiceHandle(
114 [in,out,ref] policy_handle *handle
120 /* Service Controls */
122 typedef [v1_enum] enum {
123 SVCCTL_CONTROL_STOP = 0x00000001,
124 SVCCTL_CONTROL_PAUSE = 0x00000002,
125 SVCCTL_CONTROL_CONTINUE = 0x00000003,
126 SVCCTL_CONTROL_INTERROGATE = 0x00000004,
127 SVCCTL_CONTROL_SHUTDOWN = 0x00000005
130 WERROR svcctl_ControlService(
131 [in,ref] policy_handle *handle,
132 [in] SERVICE_CONTROL control,
133 [out,ref] SERVICE_STATUS *service_status
138 WERROR svcctl_DeleteService(
139 [in,ref] policy_handle *handle
145 WERROR svcctl_LockServiceDatabase(
146 [in,ref] policy_handle *handle,
147 [out,ref] policy_handle *lock
152 WERROR svcctl_QueryServiceObjectSecurity(
153 [in] policy_handle *handle,
154 [in] uint32 security_flags,
155 [out,ref,size_is(buffer_size)] uint8 *buffer,
156 [in,range(0,0x40000)] uint32 buffer_size,
157 [out,ref,range(0,0x40000)] uint32 *needed
162 WERROR svcctl_SetServiceObjectSecurity(
163 [in] policy_handle *handle,
164 [in] uint32 security_flags,
165 [in,ref,size_is(buffer_size)] uint8 *buffer,
166 [in] uint32 buffer_size
171 WERROR svcctl_QueryServiceStatus(
172 [in,ref] policy_handle *handle,
173 [out,ref] SERVICE_STATUS *service_status
178 [todo] WERROR svcctl_SetServiceStatus(
183 WERROR svcctl_UnlockServiceDatabase(
184 [in,out,ref] policy_handle *lock
189 [todo] WERROR svcctl_NotifyBootConfigStatus(
194 WERROR svcctl_SCSetServiceBitsW(
195 [in,ref] policy_handle *handle,
197 [in] boolean32 bitson,
198 [in] boolean32 immediate
204 typedef [v1_enum] enum {
205 SVCCTL_SVC_ERROR_IGNORE = 0x00000000,
206 SVCCTL_SVC_ERROR_NORMAL = 0x00000001,
207 SVCCTL_SVC_ERROR_CRITICAL = 0x00000002,
208 SVCCTL_SVC_ERROR_SEVERE = 0x00000003
209 } svcctl_ErrorControl;
211 typedef [v1_enum] enum {
212 SVCCTL_BOOT_START = 0x00000000,
213 SVCCTL_SYSTEM_START = 0x00000001,
214 SVCCTL_AUTO_START = 0x00000002,
215 SVCCTL_DEMAND_START = 0x00000003,
216 SVCCTL_DISABLED = 0x00000004
219 WERROR svcctl_ChangeServiceConfigW(
220 [in,ref] policy_handle *handle,
222 [in] svcctl_StartType start_type,
223 [in] svcctl_ErrorControl error_control,
224 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
225 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
226 [out,ref] uint32 *tag_id,
227 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
228 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
229 [in,unique] [string,charset(UTF16)] uint16 *password,
230 [in,unique] [string,charset(UTF16)] uint16 *display_name
235 WERROR svcctl_CreateServiceW(
236 [in,ref] policy_handle *scmanager_handle,
237 [in] [string,charset(UTF16)] uint16 ServiceName[],
238 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
239 [in] uint32 desired_access,
241 [in] svcctl_StartType start_type,
242 [in] svcctl_ErrorControl error_control,
243 [in] [string,charset(UTF16)] uint16 binary_path[],
244 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
245 [in,out,unique] uint32 *TagId,
246 [in,unique,size_is(dependencies_size)] uint8 *dependencies,
247 [in] uint32 dependencies_size,
248 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
249 [in,unique,size_is(password_size)] uint8 *password,
250 [in] uint32 password_size,
251 [out,ref] policy_handle *handle
256 WERROR svcctl_EnumDependentServicesW(
257 [in,ref] policy_handle *service,
259 [out,ref,size_is(buf_size)] uint8 *service_status,
260 [in,range(0,0x40000)] uint32 buf_size,
261 [out,ref,range(0,0x40000)] uint32 *bytes_needed,
262 [out,ref,range(0,0x40000)] uint32 *services_returned
268 typedef [v1_enum] enum {
269 SVCCTL_STATE_ACTIVE = 0x00000001,
270 SVCCTL_STATE_INACTIVE = 0x00000002,
271 SVCCTL_STATE_ALL = ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
272 } svcctl_ServiceState;
274 WERROR svcctl_EnumServicesStatusW(
275 [in,ref] policy_handle *handle,
277 [in] svcctl_ServiceState state,
278 [out,ref,size_is(buf_size)] uint8 *service,
279 [in] [range(0,262144)] uint32 buf_size,
280 [out,ref] [range(0,262144)] uint32 *bytes_needed,
281 [out,ref] [range(0,262144)] uint32 *services_returned,
282 [in,out,unique] uint32 *resume_handle
288 /* Service Control Manager Bits */
290 typedef [bitmap32bit] bitmap {
291 SC_RIGHT_MGR_CONNECT = 0x0001,
292 SC_RIGHT_MGR_CREATE_SERVICE = 0x0002,
293 SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004,
294 SC_RIGHT_MGR_LOCK = 0x0008,
295 SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010,
296 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020
297 } svcctl_MgrAccessMask;
299 const int SC_MANAGER_READ_ACCESS =
300 (SEC_STD_READ_CONTROL |
301 SC_RIGHT_MGR_CONNECT |
302 SC_RIGHT_MGR_ENUMERATE_SERVICE |
303 SC_RIGHT_MGR_QUERY_LOCK_STATUS);
305 const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS;
307 const int SC_MANAGER_WRITE_ACCESS =
309 SC_MANAGER_READ_ACCESS |
310 SC_RIGHT_MGR_CREATE_SERVICE |
312 SC_RIGHT_MGR_MODIFY_BOOT_CONFIG);
314 const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS;
316 WERROR svcctl_OpenSCManagerW(
317 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
318 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
319 [in] svcctl_MgrAccessMask access_mask,
320 [out,ref] policy_handle *handle
326 /* Service Object Bits */
328 typedef [bitmap32bit] bitmap {
329 SC_RIGHT_SVC_QUERY_CONFIG = 0x0001,
330 SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002,
331 SC_RIGHT_SVC_QUERY_STATUS = 0x0004,
332 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008,
333 SC_RIGHT_SVC_START = 0x0010,
334 SC_RIGHT_SVC_STOP = 0x0020,
335 SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040,
336 SC_RIGHT_SVC_INTERROGATE = 0x0080,
337 SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100
338 } svcctl_ServiceAccessMask;
340 const int SERVICE_READ_ACCESS =
341 (SEC_STD_READ_CONTROL |
342 SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
343 SC_RIGHT_SVC_INTERROGATE |
344 SC_RIGHT_SVC_QUERY_CONFIG |
345 SC_RIGHT_SVC_QUERY_STATUS |
346 SC_RIGHT_SVC_USER_DEFINED_CONTROL);
348 const int SERVICE_EXECUTE_ACCESS =
349 (SERVICE_READ_ACCESS |
352 SC_RIGHT_SVC_PAUSE_CONTINUE);
354 const int SERVICE_WRITE_ACCESS =
356 SERVICE_READ_ACCESS |
357 SERVICE_EXECUTE_ACCESS |
358 SC_RIGHT_SVC_CHANGE_CONFIG);
360 const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS;
362 WERROR svcctl_OpenServiceW(
363 [in,ref] policy_handle *scmanager_handle,
364 [in] [string,charset(UTF16)] uint16 ServiceName[],
365 [in] svcctl_ServiceAccessMask access_mask,
366 [out,ref] policy_handle *handle
372 typedef [public,gensize] struct {
374 svcctl_StartType start_type;
375 svcctl_ErrorControl error_control;
376 [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath;
377 [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup;
379 [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies;
380 [string,charset(UTF16)] [range(0,8192)] uint16 *startname;
381 [string,charset(UTF16)] [range(0,8192)] uint16 *displayname;
382 } QUERY_SERVICE_CONFIG;
384 WERROR svcctl_QueryServiceConfigW(
385 [in,ref] policy_handle *handle,
386 [out] QUERY_SERVICE_CONFIG *query,
387 [in] [range(0,8192)] uint32 buf_size,
388 [out,ref] [range(0,8192)] uint32 *bytes_needed
393 WERROR svcctl_QueryServiceLockStatusW(
394 [in,ref] policy_handle *handle,
395 [in] uint32 buf_size,
396 [out,ref] SERVICE_LOCK_STATUS *lock_status,
397 [out,ref] uint32 *required_buf_size
402 WERROR svcctl_StartServiceW(
403 [in,ref] policy_handle *handle,
405 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
410 WERROR svcctl_GetServiceDisplayNameW(
411 [in,ref] policy_handle *handle,
412 [in,unique] [string,charset(UTF16)] uint16 *service_name,
413 [out,ref] [string,charset(UTF16)] uint16 **display_name,
414 [in,out,unique] uint32 *display_name_length
419 WERROR svcctl_GetServiceKeyNameW(
420 [in,ref] policy_handle *handle,
421 [in,unique] [string,charset(UTF16)] uint16 *service_name,
422 [out,ref] [string,charset(UTF16)] uint16 **key_name,
423 [in,out,unique] uint32 *display_name_length
428 WERROR svcctl_SCSetServiceBitsA(
429 [in,ref] policy_handle *handle,
431 [in] boolean32 bitson,
432 [in] boolean32 immediate
437 WERROR svcctl_ChangeServiceConfigA(
438 [in,ref] policy_handle *handle,
440 [in] svcctl_StartType start_type,
441 [in] svcctl_ErrorControl error_control,
442 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
443 [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
444 [out,ref] uint32 *tag_id,
445 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
446 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
447 [in,unique] [string,charset(UTF16)] uint16 *password,
448 [in,unique] [string,charset(UTF16)] uint16 *display_name
453 WERROR svcctl_CreateServiceA(
454 [in,ref] policy_handle *handle,
455 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
456 [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
457 [in] uint32 desired_access,
459 [in] svcctl_StartType start_type,
460 [in] svcctl_ErrorControl error_control,
461 [in,unique] [string,charset(UTF16)] uint16 *binary_path,
462 [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
463 [out,unique] uint32 *TagId,
464 [in,unique] [string,charset(UTF16)] uint16 *dependencies,
465 [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
466 [in,unique] [string,charset(UTF16)] uint16 *password
471 WERROR svcctl_EnumDependentServicesA(
472 [in,ref] policy_handle *service,
474 [out,unique] ENUM_SERVICE_STATUS *service_status,
475 [in] uint32 buf_size,
476 [out,ref] uint32 *bytes_needed,
477 [out,ref] uint32 *services_returned
482 WERROR svcctl_EnumServicesStatusA(
483 [in,ref] policy_handle *handle,
486 [in] uint32 buf_size,
487 [out,size_is(buf_size)] uint8 service[*],
488 [out,ref] uint32 *bytes_needed,
489 [out,ref] uint32 *services_returned,
490 [in,out,unique] uint32 *resume_handle
495 WERROR svcctl_OpenSCManagerA(
496 [in,unique] [string,charset(UTF16)] uint16 *MachineName,
497 [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
498 [in] uint32 access_mask,
499 [out,ref] policy_handle *handle
504 WERROR svcctl_OpenServiceA(
505 [in,ref] policy_handle *scmanager_handle,
506 [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
507 [in] uint32 access_mask
512 WERROR svcctl_QueryServiceConfigA(
513 [in,ref] policy_handle *handle,
514 [out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
515 [in] uint32 buf_size,
516 [out,ref] uint32 *bytes_needed
521 WERROR svcctl_QueryServiceLockStatusA(
522 [in,ref] policy_handle *handle,
523 [in] uint32 buf_size,
524 [out,ref] SERVICE_LOCK_STATUS *lock_status,
525 [out,ref] uint32 *required_buf_size
530 WERROR svcctl_StartServiceA(
531 [in,ref] policy_handle *handle,
533 [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
538 WERROR svcctl_GetServiceDisplayNameA(
539 [in,ref] policy_handle *handle,
540 [in,unique] [string,charset(UTF16)] uint16 *service_name,
541 [out,ref] [string,charset(UTF16)] uint16 **display_name,
542 [in,out,unique] uint32 *display_name_length
547 WERROR svcctl_GetServiceKeyNameA(
548 [in,ref] policy_handle *handle,
549 [in,unique] [string,charset(UTF16)] uint16 *service_name,
550 [out,ref] [string,charset(UTF16)] uint16 **key_name,
551 [in,out,unique] uint32 *display_name_length
556 [todo] WERROR svcctl_GetCurrentGroupeStateW(
561 [todo] WERROR svcctl_EnumServiceGroupW(
566 WERROR svcctl_ChangeServiceConfig2A(
567 [in,ref] policy_handle *handle,
568 [in] uint32 info_level,
569 [in,unique] uint8 *info
574 WERROR svcctl_ChangeServiceConfig2W(
575 [in,ref] policy_handle *handle,
576 [in] uint32 info_level,
577 [in,unique] uint8 *info
583 typedef [v1_enum] enum {
584 SERVICE_CONFIG_DESCRIPTION = 0x00000001,
585 SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002
586 } svcctl_ConfigLevel;
588 typedef [gensize,public] struct {
589 [relative] nstring *description;
590 } SERVICE_DESCRIPTION;
592 typedef [v1_enum] enum {
594 SC_ACTION_RESTART = 1,
595 SC_ACTION_REBOOT = 2,
596 SC_ACTION_RUN_COMMAND = 3
604 typedef [public,gensize] struct {
606 [relative] nstring *rebootmsg;
607 [relative] nstring *command;
608 [range(0,1024)] uint32 num_actions;
609 [relative] [size_is(num_actions)] SC_ACTION *actions;
610 } SERVICE_FAILURE_ACTIONS;
612 WERROR svcctl_QueryServiceConfig2A(
613 [in,ref] policy_handle *handle,
614 [in] svcctl_ConfigLevel info_level,
615 [out] uint8 buffer[buf_size],
616 [in] uint32 buf_size,
617 [out,ref] uint32 *bytes_needed
622 WERROR svcctl_QueryServiceConfig2W(
623 [in,ref] policy_handle *handle,
624 [in] svcctl_ConfigLevel info_level,
625 [out,ref,size_is(buf_size)] uint8 *buffer,
626 [in] [range(0,8192)] uint32 buf_size,
627 [out,ref] [range(0,8192)] uint32 *bytes_needed
633 typedef [v1_enum] enum {
634 SVC_STATUS_PROCESS_INFO = 0x00000000
635 } svcctl_StatusLevel;
637 WERROR svcctl_QueryServiceStatusEx(
638 [in,ref] policy_handle *handle,
639 [in] svcctl_StatusLevel info_level,
640 [out,ref,size_is(buf_size)] uint8 *buffer,
641 [in] [range(0,8192)] uint32 buf_size,
642 [out,ref] [range(0,8192)] uint32 *bytes_needed
647 WERROR EnumServicesStatusExA(
648 [in,ref] policy_handle *scmanager,
649 [in] uint32 info_level,
652 [out] uint8 services[buf_size],
653 [in] uint32 buf_size,
654 [out,ref] uint32 *bytes_needed,
655 [out,ref] uint32 *service_returned,
656 [in,out,unique] uint32 *resume_handle,
657 [out,ref] [string,charset(UTF16)] uint16 **group_name
662 WERROR EnumServicesStatusExW(
663 [in,ref] policy_handle *scmanager,
664 [in] uint32 info_level,
667 [out,ref,size_is(buf_size)] uint8 *services,
668 [in] [range(0,262144)] uint32 buf_size,
669 [out,ref] [range(0,262144)] uint32 *bytes_needed,
670 [out,ref] [range(0,262144)] uint32 *service_returned,
671 [in,out,unique] [range(0,262144)] uint32 *resume_handle,
672 [in,unique] [string,charset(UTF16)] uint16 *group_name
677 [todo] WERROR svcctl_SCSendTSMessage(