BOOL WINAPI EnumServicesStatusEx(
_In_ SC_HANDLE hSCManager,
_In_ SC_ENUM_TYPE InfoLevel,
_In_ DWORD dwServiceType,
_In_ DWORD dwServiceState,
_Out_opt_ LPBYTE lpServices,
_In_ DWORD cbBufSize,
_Out_ LPDWORD pcbBytesNeeded,
_Out_ LPDWORD lpServicesReturned,
_Inout_opt_ LPDWORD lpResumeHandle,
_In_opt_ LPCTSTR pszGroupName
);
Value | Meaning |
---|---|
|
Services of type SERVICE_KERNEL_DRIVER and SERVICE_FILE_SYSTEM_DRIVER. |
|
File system driver services. |
|
Driver services. |
|
Services of type SERVICE_WIN32_OWN_PROCESS and SERVICE_WIN32_SHARE_PROCESS. |
|
Services that run in their own processes. |
|
Services that share a process with one or more other services. For more information, see Service Programs. |
Value | Meaning |
---|---|
|
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. |
|
Combines the SERVICE_ACTIVE and SERVICE_INACTIVE states. |
5. lpServices[out, optional] :缓冲区指针,用于接收状态信息。数据的格式取决于第二个形参InfoLevel的值。
Return code | Description |
---|---|
|
The handle does not have the SC_MANAGER_ENUMERATE_SERVICE access right. |
|
The buffer is too small. Not all data in the active database could be returned. The pcbBytesNeeded parameter contains the number of bytes required to receive the remaining entries. |
|
An illegal parameter value was used. |
|
The handle is invalid. |
|
The InfoLevel parameter contains an unsupported value. |
|
The system is shutting down; this function cannot be called. |
说明:如果没有SERVICE_QUERY_STATUS权限,那么服务将会被静默忽略,不会返回任何信息。