网站首页  词典首页

请输入您要查询的函数:

 

术语 queryserviceconfig
释义 QueryServiceConfig
语法:
C++
BOOL WINAPI QueryServiceConfig(
__in SC_HANDLE hService,
__out_opt LPQUERY_SERVICE_CONFIG lpServiceConfig,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded
);
QueryServiceConfig功能
检索指定的服务配置参数。可选配置参数都可以使用的QueryServiceConfig2功能。
参数
hService [in]
句柄的服务。这种处理是由OpenService或CreateService函数返回,它必须有SERVICE_QUERY_CONFIG访问权限。有关更多信息,请参阅服务安全和访问权限。
lpServiceConfig [指出,可选]
阿一个缓冲区,它接收服务配置信息的指针。该数据格式是QUERY_SERVICE_CONFIG结构。
这个数组的最大大小为8K字节。要确定所需的大小,指定此参数和cbBufSize参数0空。该函数将失败,而且GetLastError将返回ERROR_INSUFFICIENT_BUFFER。该pcbBytesNeeded参数将获得所需的大小。
cbBufSize [in]
缓冲区的大小指向的lpServiceConfig参数,以字节为单位。
pcbBytesNeeded [out]
一个变量,它接收所需的存储所有配置信息的字节数,如果该函数指针与ERROR_INSUFFICIENT_BUFFER失败。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
下面的错误代码可以设置由服务控制管理器。其他可以设置的注册表由服务控制管理器调用的函数。
返回codeDescription
ERROR_ACCESS_DENIEDThe处理不具备SERVICE_QUERY_CONFIG访问权限。
ERROR_INSUFFICIENT_BUFFERThere是更多的服务配置信息比在放进lpServiceConfig缓冲区。所需的获得各种信息的字节数返回在pcbBytesNeeded参数。没有写入lpServiceConfig。
ERROR_INVALID_HANDLEThe指定的句柄无效。
备注
该QueryServiceConfig函数返回服务配置信息保存在注册表中特定的服务。此配置信息是第一套由服务控制使用CreateService函数程序。此信息可能已被更新服务配置使用ChangeServiceConfig函数程序。
如果该服务正在运行的配置信息时,最后改变,由QueryServiceConfig返回的信息将不会反映服务的当前配置。相反,它将反映服务的配置时,下次运行。 DisplayName项是一个例外。当DisplayName项的改变,立即生效,无论该服务正在运行。
实例
有关示例,请参阅查询服务的配置。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinsvc.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesQueryServiceConfigW(Unicode)和QueryServiceConfigA(ANSI)的
参见
ChangeServiceConfig
CreateService
OpenService
QueryServiceConfig2
QueryServiceObjectSecurity
服务配置
服务函数
QUERY_SERVICE_CONFIG
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==QueryServiceConfig Function
Retrieves the configuration parameters of the specified service. Optional configuration parameters are available using the QueryServiceConfig2 function.
Syntax
C++
BOOL WINAPI QueryServiceConfig(
__in SC_HANDLE hService,
__out_opt LPQUERY_SERVICE_CONFIG lpServiceConfig,
__in DWORD cbBufSize,
__out LPDWORD pcbBytesNeeded
);
Parameters
hService [in]
A handle to the service. This handle is returned by the OpenService or CreateService function, and it must have the SERVICE_QUERY_CONFIG access right. For more information, see Service Security and Access Rights .
lpServiceConfig [out, optional]
A pointer to a buffer that receives the service configuration information. The format of the data is a QUERY_SERVICE_CONFIG structure.
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]
The size of the buffer pointed to by the lpServiceConfig parameter, in bytes.
pcbBytesNeeded [out]
A pointer to a variable that receives the number of bytes needed to store all the configuration information, if the function fails with ERROR_INSUFFICIENT_BUFFER.
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. Others 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 SERVICE_QUERY_CONFIG access right.
ERROR_INSUFFICIENT_BUFFERThere is more service configuration information than would fit into the lpServiceConfig buffer. The number of bytes required to get all the information is returned in the pcbBytesNeeded parameter. Nothing is written to lpServiceConfig.
ERROR_INVALID_HANDLEThe specified handle is invalid.

Remarks
The QueryServiceConfig function returns the service configuration information kept in the registry for a particular service. This configuration information is first set by a service control program using the CreateService function. This information may have been updated by a service configuration program using the ChangeServiceConfig function.
If the service was running when the configuration information was last changed, the information returned by QueryServiceConfig will not reflect the current configuration of the service. Instead, it will reflect the configuration of the service when it is next run. The DisplayName key is an exception to this. When the DisplayName key is changed, it takes effect immediately, regardless of whether the service is running.
Examples
For an example, see Querying a Service's Configuration .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinsvc.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesQueryServiceConfigW (Unicode) and QueryServiceConfigA (ANSI)
See Also
ChangeServiceConfig
CreateService
OpenService
QueryServiceConfig2
QueryServiceObjectSecurity
Service Configuration
Service Functions
QUERY_SERVICE_CONFIG
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684932(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:28:05