4.9.9. svcctl interface

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

InterfaceOperation numberOperation nameWindows API
367aeb81-9844-35f1-ad32-98f038001003 v2.0: svcctl   
 0x00CloseServiceHandleCloseServiceHandle
 0x01ControlServiceControlService
 0x02DeleteServiceDeleteService
 0x03LockServiceDatabaseLockServiceDatabase
 0x04QueryServiceObjectSecurityQueryServiceObjectSecurity
 0x05SetServiceObjectSecuritySetServiceObjectSecurity
 0x06QueryServiceStatusQueryServiceStatus
 0x07SetServiceStatusSetServiceStatus
 0x08UnlockServiceDatabaseUnlockServiceDatabase
 0x09NotifyBootConfigStatusNotifyBootConfigStatus
 0x0aScSetServiceBitsWSetServiceBits
 0x0bChangeServiceConfigWChangeServiceConfig
 0x0cCreateServiceWCreateService
 0x0dEnumDependentServicesWEnumDependentServices
 0x0eEnumServicesStatusWEnumServicesStatus
 0x0fOpenSCManagerWOpenSCManager
 0x10OpenServiceWOpenService
 0x11QueryServiceConfigWQueryServiceConfig
 0x12QueryServiceLockStatusWQueryServiceLockStatus
 0x13StartServiceWStartService
 0x14GetServiceDisplayNameWGetServiceDisplayName
 0x15GetServiceKeyNameWGetServiceKeyName
 0x16ScSetServiceBitsASetServiceBits
 0x17ChangeServiceConfigAChangeServiceConfig
 0x18CreateServiceACreateService
 0x19EnumDependentServicesAEnumDependentServices
 0x1aEnumServicesStatusAEnumServicesStatus
 0x1bOpenSCManagerAOpenSCManager
 0x1cOpenServiceAOpenService
 0x1dQueryServiceConfigAQueryServiceConfig
 0x1eQueryServiceLockStatusAQueryServiceLockStatus
 0x1fStartServiceAStartService
 0x20GetServiceDisplayNameAGetServiceDisplayName
 0x21GetServiceKeyNameAGetServiceKeyName
 0x22ScGetCurrentGroupStateW 
 0x23EnumServiceGroupW 
 0x24ChangeServiceConfig2AChangeServiceConfig2
 0x25ChangeServiceConfig2WChangeServiceConfig2
 0x26QueryServiceConfig2AQueryServiceConfig2
> Windows 20000x27QueryServiceConfig2WQueryServiceConfig2
-0x28QueryServiceStatusExQueryServiceStatusEx
-0x29EnumServicesStatusExAEnumServicesStatusEx
-0x2aEnumServicesStatusExWEnumServicesStatusEx
> Windows XP and Windows Server 20030x2bScSendTSMessage 
> Windows Vista0x2cCreateServiceWOW64A 
 0x2dCreateServiceWOW64W 
 0x2eScQueryServiceTagInfo 
 0x2fNotifyServiceStatusChangeNotifyServiceStatusChange
 0x30GetNotifyResultNotifyServiceStatusChange
 0x31CloseNotifyHandleNotifyServiceStatusChange
 0x32ControlServiceExAControlServiceExA
 0x33ControlServiceExWControlServiceExW
 0x34ScSendPnPMessage 
 0x35ScValidatePnPService 
 0x36ScOpenServiceStatusHandleNotifyServiceStatusChange

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: