EnumServicesStatus是一個函式,主要功能:枚舉當前系統服務。
基本介紹
- 外文名: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.
Value | Meaning |
SERVICE_DRIVER 0x0000000B | Enumerates services of type SERVICE_KERNEL_DRIVER and SERVICE_FILE_SYSTEM_DRIVER. |
SERVICE_WIN32 0x00000030 | Enumerates services of type SERVICE_WIN32_OWN_PROCESS and SERVICE_WIN32_SHARE_PROCESS. |
dwServiceState:
The state of the services to be enumerated. This parameter can be one of the following values.
Value | Meaning |
SERVICE_ACTIVE 0x00000001 | 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. |
SERVICE_INACTIVE 0x00000002 | Enumerates services that are in the SERVICE_STOPPED state. |
SERVICE_STATE_ALL 0x00000003 | Combines the following states: SERVICE_ACTIVE and SERVICE_INACTIVE. |
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.