QueryServiceStatusEx
来源:互联网 发布:商城源码怎么去后门 编辑:程序博客网 时间:2024/06/05 03:43
QueryServiceStatusEx
The QueryServiceStatusEx function retrieves the current status of the specified service based on the specified information level.
BOOL WINAPI QueryServiceStatusEx( _In_ SC_HANDLE hService, _In_ SC_STATUS_TYPE InfoLevel, _Out_opt_ LPBYTE lpBuffer, _In_ DWORD cbBufSize, _Out_ LPDWORD pcbBytesNeeded);
Parameters
- hService
- [in] Handle to the service. This handle is returned by the CreateService or OpenService function, and it must have the SERIVCE_QUERY_STATUS access right. For more information, see Service Security and Access Rights.
- InfoLevel
- [in] Service attributes to be returned. Use SC_STATUS_PROCESS_INFO to retrieve the service status information. The lpBuffer parameter is a pointer to a SERVICE_STATUS_PROCESS structure.
Currently, no other information levels are defined.
- lpBuffer
- [out] Pointer to the buffer that receives the status information. The format of this data depends on the value of the InfoLevel parameter.
The maximum size of this array is 8K bytes. To determine the required size, specify NULL for this parameter and 0 for the cbBufSize parameter. The function will fail and GetLastError will return ERROR_INSUFFICIENT_BUFFER. The pcbBytesNeeded parameter will receive the required size.
- cbBufSize
- [in] Size of the buffer pointed to by the lpBuffer parameter, in bytes.
- pcbBytesNeeded
- [out] Pointer to a variable that receives the number of bytes needed to store all status information, if the function fails with ERROR_INSUFFICIENT_BUFFER.
Return Values
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 errors can be returned.
Remarks
The QueryServiceStatusEx function returns the most recent service status information reported to the service control manager. If the service just changed its status, it may not have updated the service control manager yet. Applications can find the current service status by querying the service directly by using the ControlServicefunction with the SERVICE_CONTROL_INTERROGATE control code.
The process identifier returned in the SERVICE_STATUS_PROCESS structure is valid provided that the state of the service is one of SERVICE_RUNNING, SERVICE_PAUSE_PENDING, SERVICE_PAUSED, or SERVICE_CONTINUE_PENDING. If the service is in a SERVICE_START_PENDING or SERVICE_STOP_PENDING state, however, the process identifier may not be valid, and if the service is in the SERVICE_STOPPED state, it is never valid.
Requirements
Declared in Winsvc.h; include Windows.h.
Link to Advapi32.lib.
- QueryServiceStatusEx
- QueryServiceStatusEx
- 实验二: 线性表实验 第一部分 顺序表
- Automated SQL Injection Detection
- 《黄金时代》与《萧红评传》
- fragment嵌套fragment,切换后,子fragment内容不显示的问题
- List list = new ArrayList();和ArrayList list=new ArrayList();的区别
- QueryServiceStatusEx
- oc中NSRunLoop的使用以及提高定时器准确度
- Volatile和Transient
- uva 11997 K Smallest Sum(多路并归+优先队列)
- 反射机制在tomcat中的运用
- 说说推送
- 使用Myeclipse搭建S2SH框架
- 分析Redis架构设计
- HSSF,XSSF和SXSSF的区别