function enumerates services in the specified service control manager
database. The name and status of each service are provided.
| SC_HANDLE hSCManager,
||// handle to service control manager database
| DWORD dwServiceType,
||// type of services to enumerate
| DWORD dwServiceState,
||// state of services to enumerate
| LPENUM_SERVICE_STATUS lpServices,
||// pointer to service status buffer
| DWORD cbBufSize,
||// size of service status buffer
| LPDWORD pcbBytesNeeded,
||// pointer to variable for bytes needed
| LPDWORD lpServicesReturned,
||// pointer to variable for number returned
| LPDWORD lpResumeHandle
||// pointer to variable for next entry
Identifies the service control manager database. The OpenSCManager
function returns this handle which must have SC_MANAGER_ENUMERATE_SERVICE
Specifies the type of services to enumerate. It must be one or both of the
||Enumerates services of type SERVICE_WIN32_OWN_PROCESS and
||Enumerates services of type SERVICE_KERNEL_DRIVER and
Specifies the services to enumerate based on their running state. It must be
one or both of the following values:
||Enumerates services that are in the following states: SERVICE_START_PENDING,
SERVICE_STOP_PENDING, SERVICE_RUNNING, SERVICE_CONTINUE_PENDING,
SERVICE_PAUSE_PENDING, and SERVICE_PAUSED.
||Enumerates services that are in the SERVICE_STOPPED state.
Points to an array of ENUM_SERVICE_STATUS
structures in which the name and service status information for each service
in the database is returned.
Specifies the size, in bytes, of the buffer pointed to by the lpServices
Points to a variable that receives the number of bytes needed to return the
remaining service entries.
Points to a variable that receives the number of service entries returned.
Points to a 32-bit variable that, on input, specifies the starting point of
enumeration. The first time this function is called, the variable's value is set
to zero. On output, the variable's value is zero if the function succeeds. If
the function returns FALSE and the GetLastError
function returns ERROR_MORE_DATA, the variable's value is used to indicate
the next unread service entry when the function is called again to retrieve the
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error
information, call GetLastError
The following error codes may be set by the service control manager. Other
error codes may be set by the registry functions that are called by the service
||The specified handle was not opened with SC_MANAGER_ENUMERATE_SERVICE access.
||The specified handle is invalid.
||A parameter that was specified is invalid.
||There are more service entries than would fit into the lpServices buffer. The actual number of service entries written to lpServices is returned in the lpServicesReturned parameter. The number of bytes required to get the remaining entries is
returned in the pcbBytesNeeded parameter. The remaining services can be enumerated by additional calls to EnumServicesStatus with the lpResumeHandle parameter indicating the next service to read.
- Software for developers
Software for Android Developers
- More information resources
Unix Manual Pages
- Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database