网站首页  词典首页

请输入您要查询的函数:

 

术语 enumservicesstatusex
释义 EnumServicesStatusEx
语法:
C++
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
);
EnumServicesStatusEx功能
在指定的服务控制管理数据库枚举服务。的名称和地位的每项服务提供,以及在指定的信息Level的附加数据。
参数
hSCManager [in]
一个句柄,服务控制管理数据库。这种处理是由OpenSCManager函数返回,并必须有SC_MANAGER_ENUMERATE_SERVICE访问权限。有关更多信息,请参阅服务安全和访问权限。
InfoLevel [in]
该服务属性的产生办法。使用SC_ENUM_PROCESS_INFO以检索数据库中的每个服务的名称和服务的状态信息。该lpServices参数是一个缓冲区,它接收的ENUM_SERVICE_STATUS_PROCESS结构的数组指针。该缓冲区必须大到足以容纳的结构以及字符串是其成员点。
目前,没有任何其他信息Level的定义。
dwServiceType [in]
在服务类型枚举。此参数可以是一个或多个下列值。
ValueMeaning
SERVICE_DRIVER
类型0x0000000BEnumerates服务SERVICE_KERNEL_DRIVER和SERVICE_FILE_SYSTEM_DRIVER。
SERVICE_WIN32
类型SERVICE_WIN32_OWN_PROCESS和SERVICE_WIN32_SHARE_PROCESS 0x00000030Enumerates服务。
dwServiceState [in]
该服务的状态被枚举。此参数可以是下列值之一。
ValueMeaning
SERVICE_ACTIVE
0x00000001Enumerates服务,在以下状态:SERVICE_START_PENDING,SERVICE_STOP_PENDING,SERVICE_RUNNING,SERVICE_CONTINUE_PENDING,SERVICE_PAUSE_PENDING和SERVICE_PAUSED的。
SERVICE_INACTIVE
0x00000002Enumerates服务,在SERVICE_STOPPED状态。
SERVICE_STATE_ALL
0x00000003Combines的SERVICE_ACTIVE和SERVICE_INACTIVE状态。
lpServices [指出,可选]
一个缓冲区的接收状态信息的指针。这些数据的格式取决于该InfoLevel参数的值。
这个数组的最大大小为256K字节。要确定所需的大小,指定此参数和cbBufSize参数0空。该函数将失败,而且GetLastError将返回ERROR_MORE_DATA。该pcbBytesNeeded参数将获得所需的大小。
Windows Server 2003和Windows XP中:此数组的最大大小是64K字节。此限制增加作为Windows Server 2003 SP1和Windows XP SP2的。
cbBufSize [in]
缓冲区的大小指向的lpServices参数,以字节为单位。
pcbBytesNeeded [out]
一个变量,它接收返回所需的服务项目,其余的字节数,如果缓冲区太小指针。
lpServicesReturned [out]
一个变量,它接收的服务项目数的指针返回。
lpResumeHandle [中,指出,可选]
一个变量,在输入,指定枚举出发点的指针。您必须将此值设置为零首次EnumServicesStatusEx函数被调用。对产出,这个值是零,如果函数成功。但是,如果该函数返回零和GetLastError函数返回ERROR_MORE_DATA,此值表示在今后的服务项,以读时EnumServicesStatusEx函数调用来检索更多的数据。
pszGroupName [中,可选]
负载顺序组的名称。如果这个参数是一个字符串,唯一的服务所列举的那些属于该集团已经由字符串指定的名称。如果这个参数是一个空字符串,只服务不属于任何集团列举。如果该参数为NULL,组成员将被忽略并且列举所有的服务。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。下面的错误可能会返回。
返回codeDescription
ERROR_ACCESS_DENIEDThe处理不具备SC_MANAGER_ENUMERATE_SERVICE访问权限。
ERROR_MORE_DATAThe缓冲区太小。并非所有在活动数据库中的数据可以返回。该pcbBytesNeeded参数包含所需的接收剩余的条目的字节数。
ERROR_INVALID_PARAMETERAn非法参数值使用。
ERROR_INVALID_HANDLEThe句柄无效。
ERROR_INVALID_LEVELThe InfoLevel参数包含不支持的值。
ERROR_SHUTDOWN_IN_PROGRESSThe系统正在关闭,这个函数不能被调用。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinsvc.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesEnumServicesStatusExW(Unicode)和EnumServicesStatusExA(ANSI)的
参见
ENUM_SERVICE_STATUS_PROCESS
服务函数
服务的安装,删除和枚举
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==EnumServicesStatusEx Function
Enumerates services in the specified service control manager database. The name and status of each service are provided, along with additional data based on the specified information level.
Syntax
C++
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
);
Parameters
hSCManager [in]
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 .
InfoLevel [in]
The service attributes that are to be returned. Use SC_ENUM_PROCESS_INFO to retrieve the name and service status information for each service in the database. The lpServices parameter is a pointer to a buffer that receives an array of ENUM_SERVICE_STATUS_PROCESS structures. The buffer must be large enough to hold the structures as well as the strings to which their members point.
Currently, no other information levels are defined.
dwServiceType [in]
The type of services to be enumerated. This parameter can be one or more of the following values.
ValueMeaning
SERVICE_DRIVER
0x0000000BEnumerates services of type SERVICE_KERNEL_DRIVER and SERVICE_FILE_SYSTEM_DRIVER.
SERVICE_WIN32
0x00000030Enumerates services of type SERVICE_WIN32_OWN_PROCESS and SERVICE_WIN32_SHARE_PROCESS.

dwServiceState [in]
The state of the services to be enumerated. This parameter can be one of the following values.
ValueMeaning
SERVICE_ACTIVE
0x00000001Enumerates 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
0x00000002Enumerates services that are in the SERVICE_STOPPED state.
SERVICE_STATE_ALL
0x00000003Combines the SERVICE_ACTIVE and SERVICE_INACTIVE states.

lpServices [out, optional]
A 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 256K 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_MORE_DATA. The pcbBytesNeeded parameter will receive the required size.
Windows Server 2003 and Windows XP: The maximum size of this array is 64K bytes. This limit was increased as of Windows Server 2003 with SP1 and Windows XP with SP2.
cbBufSize [in]
The size of the buffer pointed to by the lpServices parameter, in bytes.
pcbBytesNeeded [out]
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 [out]
A pointer to a variable that receives the number of service entries returned.
lpResumeHandle [in, out, optional]
A pointer to a variable that, on input, specifies the starting point of enumeration. You must set this value to zero the first time the EnumServicesStatusEx 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 indicates the next service entry to be read when the EnumServicesStatusEx function is called to retrieve the additional data.
pszGroupName [in, optional]
The load-order group name. If this parameter is a string, the only services enumerated are those that belong to the group that has the name specified by the string. If this parameter is an empty string, only services that do not belong to any group are enumerated. If this parameter is NULL, group membership is ignored and all services are enumerated.
Return Value
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 may be returned.
Return codeDescription
ERROR_ACCESS_DENIEDThe handle does not have the SC_MANAGER_ENUMERATE_SERVICE access right.
ERROR_MORE_DATAThe 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.
ERROR_INVALID_PARAMETERAn illegal parameter value was used.
ERROR_INVALID_HANDLEThe handle is invalid.
ERROR_INVALID_LEVELThe InfoLevel parameter contains an unsupported value.
ERROR_SHUTDOWN_IN_PROGRESSThe system is shutting down; this function cannot be called.

Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinsvc.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesEnumServicesStatusExW (Unicode) and EnumServicesStatusExA (ANSI)
See Also
ENUM_SERVICE_STATUS_PROCESS
Service Functions
Service Installation, Removal, and Enumeration
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms682640(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:25:50