The svcctl interface is used to manage Windows services via the SCM (Service Control Manager).
IDL (Interface Definition Language) for the svcctl interface is available in Samba 4 [60].
Table 4.24. svcctl operations
| Interface | Operation number | Operation name | Windows API |
|---|---|---|---|
| 367aeb81-9844-35f1-ad32-98f038001003 v2.0: svcctl | |||
| 0x00 | CloseServiceHandle | CloseServiceHandle | |
| 0x01 | ControlService | ControlService | |
| 0x02 | DeleteService | DeleteService | |
| 0x03 | LockServiceDatabase | LockServiceDatabase | |
| 0x04 | QueryServiceObjectSecurity | QueryServiceObjectSecurity | |
| 0x05 | SetServiceObjectSecurity | SetServiceObjectSecurity | |
| 0x06 | QueryServiceStatus | QueryServiceStatus | |
| 0x07 | SetServiceStatus | SetServiceStatus | |
| 0x08 | UnlockServiceDatabase | UnlockServiceDatabase | |
| 0x09 | NotifyBootConfigStatus | NotifyBootConfigStatus | |
| 0x0a | ScSetServiceBitsW | SetServiceBits | |
| 0x0b | ChangeServiceConfigW | ChangeServiceConfig | |
| 0x0c | CreateServiceW | CreateService | |
| 0x0d | EnumDependentServicesW | EnumDependentServices | |
| 0x0e | EnumServicesStatusW | EnumServicesStatus | |
| 0x0f | OpenSCManagerW | OpenSCManager | |
| 0x10 | OpenServiceW | OpenService | |
| 0x11 | QueryServiceConfigW | QueryServiceConfig | |
| 0x12 | QueryServiceLockStatusW | QueryServiceLockStatus | |
| 0x13 | StartServiceW | StartService | |
| 0x14 | GetServiceDisplayNameW | GetServiceDisplayName | |
| 0x15 | GetServiceKeyNameW | GetServiceKeyName | |
| 0x16 | ScSetServiceBitsA | SetServiceBits | |
| 0x17 | ChangeServiceConfigA | ChangeServiceConfig | |
| 0x18 | CreateServiceA | CreateService | |
| 0x19 | EnumDependentServicesA | EnumDependentServices | |
| 0x1a | EnumServicesStatusA | EnumServicesStatus | |
| 0x1b | OpenSCManagerA | OpenSCManager | |
| 0x1c | OpenServiceA | OpenService | |
| 0x1d | QueryServiceConfigA | QueryServiceConfig | |
| 0x1e | QueryServiceLockStatusA | QueryServiceLockStatus | |
| 0x1f | StartServiceA | StartService | |
| 0x20 | GetServiceDisplayNameA | GetServiceDisplayName | |
| 0x21 | GetServiceKeyNameA | GetServiceKeyName | |
| 0x22 | ScGetCurrentGroupStateW | ||
| 0x23 | EnumServiceGroupW | ||
| 0x24 | ChangeServiceConfig2A | ChangeServiceConfig2 | |
| 0x25 | ChangeServiceConfig2W | ChangeServiceConfig2 | |
| 0x26 | QueryServiceConfig2A | QueryServiceConfig2 | |
| > Windows 2000 | 0x27 | QueryServiceConfig2W | QueryServiceConfig2 |
| - | 0x28 | QueryServiceStatusEx | QueryServiceStatusEx |
| - | 0x29 | EnumServicesStatusExA | EnumServicesStatusEx |
| - | 0x2a | EnumServicesStatusExW | EnumServicesStatusEx |
| > Windows XP and Windows Server 2003 | 0x2b | ScSendTSMessage | |
| > Windows Vista | 0x2c | CreateServiceWOW64A | |
| 0x2d | CreateServiceWOW64W | ||
| 0x2e | ScQueryServiceTagInfo | ||
| 0x2f | NotifyServiceStatusChange | NotifyServiceStatusChange | |
| 0x30 | GetNotifyResult | NotifyServiceStatusChange | |
| 0x31 | CloseNotifyHandle | NotifyServiceStatusChange | |
| 0x32 | ControlServiceExA | ControlServiceExA | |
| 0x33 | ControlServiceExW | ControlServiceExW | |
| 0x34 | ScSendPnPMessage | ||
| 0x35 | ScValidatePnPService | ||
| 0x36 | ScOpenServiceStatusHandle | NotifyServiceStatusChange |
The svcctl interface contains so-called Unicode operations (with names ending with W) and ASCII operations (with names ending with A).
Connecting to the SCM (Service Control Manager):
Locking and unlocking the SCM database:
Enumerating services:
Obtaining a handle to a service:
Starting a service:
Obtaining the current status of a service:
Setting the current status of a service:
Sending a control order to a service:
Obtaining the detailed configuration of a service:
Obtaining the current lock status of a service:
Obtaining the display name of a service:
Obtaning the internal name of a service:
Modifying the configuration of a service:
Examining and setting the security descriptor of a service:
Adding a new service:
Removing a service:
Enumerating service dependencies:
Enumerating services that belong to a group:
Closing a service or SCM handle: