网站首页  词典首页

请输入您要查询的函数:

 

术语 pdhgetdefaultperfcounterh
释义 PdhGetDefaultPerfCounterH
语法:
C++
PDH_STATUS PdhGetDefaultPerfCounterH(
__in PDH_HLOG hDataSource,
__in LPCTSTR szMachineName,
__in LPCTSTR szObjectName,
__out LPTSTR szDefaultCounterName,
__inout LPDWORD pcchBufferSize
);
PdhGetDefaultPerfCounterH功能
检索对指定对象的默认计数器的名称。这个名字可以用来设置在浏览计数器对话框中选择的初步柜台。
此功能是相同的PdhGetDefaultPerfCounter,除了它支持使用句柄数据源。
参数
hDataSource [in]
应该为null。如果您指定一个日志文件句柄,szDefaultCounterName将是一个空字符串。
szMachineName [in]
零结尾的字符串,指定用于验证的对象名称计算机的名称。如果为NULL,本地计算机是用来验证名称。
szObjectName [in]
零结尾的字符串,指定对象的默认计数器名称要检索的名称。
szDefaultCounterName [out]
来电分配的缓冲区,它接收空终止预设计数器名称。设置为NULL,如果pcchBufferSize是零。
pcchBufferSize [ in , out ]
的大小szDefaultCounterName缓冲区,在TCHARs。如果零输入,该函数返回PDH_MORE_DATA,并设置此参数所需的缓冲区大小。如果缓冲区比所需的大小,功能设置此参数的时候,往往有人使用的缓冲区的实际大小。如果在输入指定的大小是大于零,但比所需的大小少,您不应该依靠返回的大小重新分配缓冲区。
返回值
如果函数成功,它返回ERROR_SUCCESS。
如果函数失败,返回值是一个系统错误代码或一种PDH错误代码。以下是可能的值。
返回codeDescription
PDH_MORE_DATAThe szDefaultCounterName缓冲区太小,无法包含计数器名称。这个返回值,预计如果pcchBufferSize是在输入为零。如果在输入指定的大小是大于零,但比所需的大小少,您不应该依靠返回的大小重新分配缓冲区。
PDH_INVALID_ARGUMENTA需要的参数是无效的。例如,在某些版本中您可以收到此错误如果在输入指定的大小是大于零但小于所需的大小。
PDH_MEMORY_ALLOCATION_FAILUREUnable分配内存才能完成的功能。
PDH_CSTATUS_NO_MACHINEThe指定的计算机脱机或不可用。
PDH_CSTATUS_NO_COUNTERNAMEThe默认的计数器名称不能读取或找到。
PDH_CSTATUS_NO_OBJECTThe指定的对象找不到。
PDH_CSTATUS_NO_COUNTERThe对象不指定默认的计数器。
备注
您应该调用这个函数两次,第一次获得所需的缓冲区大小(设置szDefaultCounterName为NULL和pcchBufferSize为0),和第二次获取数据。
要求:
最低支持client-Windows XP
最低支持serverWindows服务器2003
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode和ANSI namesPdhGetDefaultPerfCounterHW(Unicode)和PdhGetDefaultPerfCounterHA(ANSI)的
参见
PdhBindInputDataSource
PdhBrowseCountersH
PdhGetDefaultPerfObjectH
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月23日
==英文原文==PdhGetDefaultPerfCounterH Function
Retrieves the name of the default counter for the specified object. This name can be used to set the initial counter selection in the Browse Counter dialog box.
This function is identical to PdhGetDefaultPerfCounter , except that it supports the use of handles to data sources.
Syntax
C++
PDH_STATUS PdhGetDefaultPerfCounterH(
__in PDH_HLOG hDataSource,
__in LPCTSTR szMachineName,
__in LPCTSTR szObjectName,
__out LPTSTR szDefaultCounterName,
__inout LPDWORD pcchBufferSize
);
Parameters
hDataSource [in]
Should be NULL. If you specify a log file handle, szDefaultCounterName will be a null string.
szMachineName [in]
Null-terminated string that specifies the name of the computer used to verify the object name. If NULL, the local computer is used to verify the name.
szObjectName [in]
Null-terminated string that specifies the name of the object whose default counter name you want to retrieve.
szDefaultCounterName [out]
Caller-allocated buffer that receives the null-terminated default counter name. Set to NULL if pcchBufferSize is zero.
pcchBufferSize [in, out]
Size of the szDefaultCounterName buffer, in TCHARs. If zero on input, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.
Return Value
If the function succeeds, it returns ERROR_SUCCESS.
If the function fails, the return value is a system error code or a PDH error code . The following are possible values.
Return codeDescription
PDH_MORE_DATAThe szDefaultCounterName buffer is too small to contain the counter name. This return value is expected if pcchBufferSize is zero on input. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.
PDH_INVALID_ARGUMENTA required parameter is not valid. For example, on some releases you could receive this error if the specified size on input is greater than zero but less than the required size.
PDH_MEMORY_ALLOCATION_FAILUREUnable to allocate memory in order to complete the function.
PDH_CSTATUS_NO_MACHINEThe specified computer is offline or unavailable.
PDH_CSTATUS_NO_COUNTERNAMEThe default counter name cannot be read or found.
PDH_CSTATUS_NO_OBJECTThe specified object could not be found.
PDH_CSTATUS_NO_COUNTERThe object did not specify a default counter.

Remarks
You should call this function twice, the first time to get the required buffer size (set szDefaultCounterName to NULL and pcchBufferSize to 0), and the second time to get the data.
Requirements
Minimum supported clientWindows XP
Minimum supported serverWindows Server 2003
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode and ANSI namesPdhGetDefaultPerfCounterHW (Unicode) and PdhGetDefaultPerfCounterHA (ANSI)
See Also
PdhBindInputDataSource
PdhBrowseCountersH
PdhGetDefaultPerfObjectH
Send comments about this topic to Microsoft
Build date: 7/23/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa372622(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:32:02