Stores information about windows services into an array.

AServices(cArrayName, [cServer [, cDatabase [, nServiceState [, nServiceType]]]])

Parameters

cArrayName

On return the array contains the following information from the ENUM_SERVICE_STATUS_PROCESS or ENUM_SERVICE_STATUS structure.

ColumnContent
1ServiceName
2DisplayName
3ServiceType
4CurrentState
5Win32ExitCode
6ServiceSpecificExitCode
7CheckPoint
8ControlsAccepted
9ServiceFlags
10ProcessId
cServer (optional)

The server name on which the service is running.
See MSDN help for OpenSCManager.

cDatabase (optional)

The database under which the service is registered.
See MSDN help for OpenSCManager.

nServiceState (optional)

default = SERVICE_STATE_ALL

One of the following values.
ServiceStateDescription
SERVICE_ACTIVEEnumerate only running servies.
SERVICE_INACTIVEEnumerate only stopped services.
SERVICE_STATE_ALLEnumerate all services.
nServiceType (optional, additive)

default = SERVICE_WIN32

One or a combination of the following values.
ServiceTypeDescription
SERVICE_DRIVEREnumerates services of type SERVICE_KERNEL_DRIVER and SERVICE_FILE_SYSTEM_DRIVER.
SERVICE_WIN32Enumerates services of type SERVICE_WIN32_OWN_PROCESS and SERVICE_WIN32_SHARE_PROCESS.

Return Value

The number of services.

See Also

Reference

ADependentServices
AServiceConfig
AServiceStatus
CloseServiceHandle
ContinueService
ControlService
CreateService
OpenService
PauseService
StartService
StopService
WaitForServiceStatus

Used WinApi functions

EnumServicesStatusEx if supported, otherwise
EnumServicesStatus
OpenSCManager
CloseServiceHandle