EnumServicesStatus是一个函数,主要功能:枚举当前
系统服务。
函数原型
BOOL WINAPI EnumServicesStatus
__in SC_HANDLE hSCManager,
__in DWORD dwServiceType,
__in DWORD dwServiceState,
__out LPENUM_SERVICE_STATUS lpServices,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded,
__out LPDWORD lpServicesReturned,
__in_out LPDWORD lpResumeHandle;
函数功能
参数介绍
hSCManager :
A handle to the service control manager database. This handle is returned by the
OpenSCManager function, and must have the SC_MANAGER_ENUMERATE_SERVICE access right. For more information, see Service Security and Access Rights.
dwServiceType :
The type of services to be enumerated. This parameter can be one or more of the following values.
dwServiceState:
The state of the services to be enumerated. This parameter can be one of the following values.
lpServices :
A pointer to a buffer that contains an array of ENUM_SERVICE_STATUS structures that receive the name and service status information for each service in the database. The buffer must be large enough to hold the structures, plus the strings to which their members point.
cbBufSize :
The size of the buffer pointed to by the lpServices parameter, in bytes.
pcbBytesNeeded :
A pointer to a variable that receives the number of bytes needed to return the remaining service entries, if the buffer is too small.
lpServicesReturned :
A pointer to a variable that receives the number of service entries returned.
lpResumeHandle :
A pointer to a variable that, on input, specifies the starting point of enumeration. You must set this value to zero the first time this function is called. On output, this value is zero if the function succeeds. However, if the function returns zero and the GetLastError function returns ERROR_MORE_DATA, this value is used to indicate the next service entry to be read when the function is called to retrieve the additional data.