网站首页  词典首页

请输入您要查询的函数:

 

术语 enumdependentservices
释义 EnumDependentServices
语法:
C++
BOOL WINAPI EnumDependentServices(
__in SC_HANDLE hService,
__in DWORD dwServiceState,
__out_opt LPENUM_SERVICE_STATUS lpServices,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded,
__out LPDWORD lpServicesReturned
);
EnumDependentServices功能
检索名称及服务,在指定的服务依赖的地位,也就是说,指定的服务必须先运行相关服务可以运行。
参数
hService [in]
句柄的服务。这种处理是由OpenService或CreateService函数返回,它必须有SERVICE_ENUMERATE_DEPENDENTS访问权限。有关更多信息,请参阅服务安全和访问权限。
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接收结构的数组中的每个数据库相关服务的名称和服务状态信息的指针。该缓冲区必须大到足以容纳结构,加上字符串是其成员点。
该数组中的服务秩序是对服务的启动顺序相反。换句话说,数组中的第一个服务是一个会于去年,在数组中的最后一个服务是一个将首先启动。
这个数组的最大大小为64,000字节。要确定所需的大小,指定此参数和cbBufSize参数0空。该函数将失败,而且GetLastError将返回ERROR_MORE_DATA。该pcbBytesNeeded参数将获得所需的大小。
cbBufSize [in]
缓冲区的大小指向的lpServices参数,以字节为单位。
pcbBytesNeeded [out]
一个变量,它接收所需的存储服务项目种类繁多,字节数的指针。该变量只接收这个值如果缓冲区指向lpServices太小,按功能衰竭和ERROR_MORE_DATA错误表示,否则,pcbBytesNeeded是不确定的内容。
lpServicesReturned [out]
一个变量,它接收的服务项目数的指针返回。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
下面的错误代码可能被设置由服务控制管理器。其他的错误代码可能被设置的注册表由服务控制管理器调用的函数。
返回codeDescription
ERROR_ACCESS_DENIEDThe处理不具备SERVICE_ENUMERATE_DEPENDENTS访问权限。
ERROR_INVALID_HANDLEThe指定的句柄无效。
ERROR_INVALID_PARAMETERA参数被指定无效。
ERROR_MORE_DATAThe缓冲区指向lpServices不够大。该函数设置变量所指向的lpServicesReturned对服务项目的实际人数存储到缓冲区。该函数设置变量指向pcbBytesNeeded到所需要的存储服务的所有条目的字节数。
备注
返回的服务项命令在启动顺序相反的顺序,以考虑到集团的订单。如果您需要停止相关服务,您可以使用写入lpServices缓冲停止正确的顺序的相关服务项秩序。
实例
有关示例,请停止服务。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinsvc.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesEnumDependentServicesW(Unicode)和EnumDependentServicesA(ANSI)的
参见
CreateService
ENUM_SERVICE_STATUS
EnumServicesStatusEx
OpenService
服务函数
服务的安装,删除和枚举
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==EnumDependentServices Function
Retrieves the name and status of each service that depends on the specified service; that is, the specified service must be running before the dependent services can run.
Syntax
C++
BOOL WINAPI EnumDependentServices(
__in SC_HANDLE hService,
__in DWORD dwServiceState,
__out_opt LPENUM_SERVICE_STATUS lpServices,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded,
__out LPDWORD lpServicesReturned
);
Parameters
hService [in]
A handle to the service. This handle is returned by the OpenService or CreateService function, and it must have the SERVICE_ENUMERATE_DEPENDENTS access right. For more information, see Service Security and Access Rights .
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 an array of ENUM_SERVICE_STATUS structures that receives the name and service status information for each dependent service in the database. The buffer must be large enough to hold the structures, plus the strings to which their members point.
The order of the services in this array is the reverse of the start order of the services. In other words, the first service in the array is the one that would be started last, and the last service in the array is the one that would be started first.
The maximum size of this array is 64,000 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.
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 store the array of service entries. The variable only receives this value if the buffer pointed to by lpServices is too small, indicated by function failure and the ERROR_MORE_DATA error; otherwise, the contents of pcbBytesNeeded are undefined.
lpServicesReturned [out]
A pointer to a variable that receives the number of service entries returned.
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 may be set by the service control manager. Other error codes may be set by the registry functions that are called by the service control manager.
Return codeDescription
ERROR_ACCESS_DENIEDThe handle does not have the SERVICE_ENUMERATE_DEPENDENTS access right.
ERROR_INVALID_HANDLEThe specified handle is invalid.
ERROR_INVALID_PARAMETERA parameter that was specified is invalid.
ERROR_MORE_DATAThe buffer pointed to by lpServices is not large enough. The function sets the variable pointed to by lpServicesReturned to the actual number of service entries stored into the buffer. The function sets the variable pointed to by pcbBytesNeeded to the number of bytes required to store all of the service entries.

Remarks
The returned services entries are ordered in the reverse order of the start order, with group order taken into account. If you need to stop the dependent services, you can use the order of entries written to the lpServices buffer to stop the dependent services in the proper order.
Examples
For an example, see Stopping a Service .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinsvc.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesEnumDependentServicesW (Unicode) and EnumDependentServicesA (ANSI)
See Also
CreateService
ENUM_SERVICE_STATUS
EnumServicesStatusEx
OpenService
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/ms682610(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 11:29:56