网站首页  词典首页

请输入您要查询的函数:

 

术语 enumservicesstatus
释义 EnumServicesStatus
语法:
C++
BOOL WINAPI EnumServicesStatus(
__in SC_HANDLE hSCManager,
__in DWORD dwServiceType,
__in DWORD dwServiceState,
__out_opt LPENUM_SERVICE_STATUS lpServices,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded,
__out LPDWORD lpServicesReturned,
__inout_opt LPDWORD lpResumeHandle
);
EnumServicesStatus功能
在指定的服务控制管理数据库枚举服务。的名称及所提供服务的地位。
此功能已被取代的EnumServicesStatusEx功能。它返回相同的信息EnumServicesStatus的回报,加上进程标识符和服务的其他信息。此外,EnumServicesStatusEx使您列举的服务,属于指定的组。
参数
hSCManager [in]
一个句柄,服务控制管理数据库。这种处理是由OpenSCManager函数返回,并必须有SC_MANAGER_ENUMERATE_SERVICE访问权限。有关更多信息,请参阅服务安全和访问权限。
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 [指出,可选]
一个缓冲区,其中包含一个ENUM_SERVICE_STATUS结构的数组,获得数据库中的每个服务的名称和服务状态信息的指针。该缓冲区必须大到足以容纳结构,加上字符串是其成员点。
这个数组的最大大小为256K字节。要确定所需的大小,指定此参数和cbBufSize参数0空。该函数将失败,而且GetLastError将返回ERROR_INSUFFICIENT_BUFFER。该pcbBytesNeeded参数将获得所需的大小。
Windows Server 2003和Windows XP中:此数组的最大大小是64K字节。此限制增加作为Windows Server 2003 SP1和Windows XP SP2的。
cbBufSize [in]
缓冲区的大小指向的lpServices参数,以字节为单位。
pcbBytesNeeded [out]
一个变量,它接收返回所需的服务项目,其余的字节数,如果缓冲区太小指针。
lpServicesReturned [out]
一个变量,它接收的服务项目数的指针返回。
lpResumeHandle [中,指出,可选]
一个变量,在输入,指定枚举出发点的指针。您必须将此值设置为零首次函数被调用。对产出,这个值是零,如果函数成功。但是,如果该函数返回零和GetLastError函数返回ERROR_MORE_DATA,此值是用来表示服务项下被读取时调用函数来检索更多的数据。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
下面的错误代码可以设置由服务控制管理器。其他的错误代码可以设置的注册表由服务控制管理器调用的函数。
返回codeDescription
ERROR_ACCESS_DENIEDThe处理不具备SC_MANAGER_ENUMERATE_SERVICE访问权限。
ERROR_INVALID_HANDLEThe指定的句柄无效。
ERROR_INVALID_PARAMETERA参数被指定无效。
ERROR_MORE_DATAThere有更多的服务项目比在放进lpServices缓冲区。书面向lpServices服务项实际人数在lpServicesReturned返回参数。所需的获得剩下的字节数项中返回pcbBytesNeeded参数。其余服务可以列举了额外的要求与lpResumeHandle表明未来的服务改为参数EnumServicesStatus。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinsvc.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesEnumServicesStatusW(Unicode)和EnumServicesStatusA(ANSI)的
参见
ENUM_SERVICE_STATUS
EnumDependentServices
EnumServicesStatusEx
OpenSCManager
服务函数
服务的安装,删除和枚举
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==EnumServicesStatus Function
Enumerates services in the specified service control manager database. The name and status of each service are provided.
This function has been superseded by the EnumServicesStatusEx function. It returns the same information EnumServicesStatus returns, plus the process identifier and additional information for the service. In addition, EnumServicesStatusEx enables you to enumerate services that belong to a specified group.
Syntax
C++
BOOL WINAPI EnumServicesStatus(
__in SC_HANDLE hSCManager,
__in DWORD dwServiceType,
__in DWORD dwServiceState,
__out_opt LPENUM_SERVICE_STATUS lpServices,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded,
__out LPDWORD lpServicesReturned,
__inout_opt LPDWORD lpResumeHandle
);
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 .
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 following states: SERVICE_ACTIVE and SERVICE_INACTIVE.

lpServices [out, optional]
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.
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_INSUFFICIENT_BUFFER. 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 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.
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 error codes can be set by the service control manager. Other error codes can be set by the registry functions that are called by the service control manager.
Return codeDescription
ERROR_ACCESS_DENIEDThe handle does not have the SC_MANAGER_ENUMERATE_SERVICE access right.
ERROR_INVALID_HANDLEThe specified handle is invalid.
ERROR_INVALID_PARAMETERA parameter that was specified is invalid.
ERROR_MORE_DATAThere are more service entries than would fit into the lpServices buffer. The actual number of service entries written to lpServices is returned in the lpServicesReturned parameter. The number of bytes required to get the remaining entries is returned in the pcbBytesNeeded parameter. The remaining services can be enumerated by additional calls to EnumServicesStatus with the lpResumeHandle parameter indicating the next service to read.

Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinsvc.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesEnumServicesStatusW (Unicode) and EnumServicesStatusA (ANSI)
See Also
ENUM_SERVICE_STATUS
EnumDependentServices
EnumServicesStatusEx
OpenSCManager
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/ms682637(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:15:38