网站首页  词典首页

请输入您要查询的函数:

 

术语 pdhlookupperfnamebyindex
释义 PdhLookupPerfNameByIndex
语法:
C++
PDH_STATUS PdhLookupPerfNameByIndex(
__in LPCTSTR szMachineName,
__in DWORD dwNameIndex,
__out LPTSTR szNameBuffer,
__in LPDWORD pcchNameBufferSize
);
PdhLookupPerfNameByIndex功能
返回性能对象名称或计数器名称相对应的指定索引。
参数
szMachineName [in]
NULL结尾的字符串,指定的计算机的名称指定的性能对象或计数器的位置。计算机的名称,可以指定的DNS名称或IP地址。如果为NULL,该函数使用本地计算机。
dwNameIndex [in]
指数的表现对象或计数器。
szNameBuffer [out]
来电分配的缓冲区,它接收NULL结尾的性能对象或计数器的名称。设置为NULL,如果pcchNameBufferSize是零。
pcchNameBufferSize [in]
的大小szNameBuffer缓冲区,在TCHARs。如果零输入,该函数返回PDH_MORE_DATA,并设置此参数所需的缓冲区大小。如果缓冲区比所需的大小,功能设置此参数的时候,往往有人使用的缓冲区的实际大小。如果在输入指定的大小是大于零,但比所需的大小少,您不应该依靠返回的大小重新分配缓冲区。
返回值
如果函数成功,它返回ERROR_SUCCESS。
如果函数失败,返回值是一个系统错误代码或一种PDH错误代码。以下是可能的值。
返回codeDescription
PDH_MORE_DATAThe szNameBuffer缓冲区不够大,无法包含计数器名称。这个返回值,预计如果pcchNameBufferSize是在输入为零。如果在输入指定的大小是大于零,但比所需的大小少,您不应该依靠返回的大小重新分配缓冲区。
PDH_INVALID_ARGUMENTA参数无效或格式不正确。例如,在某些版本中您可以收到此错误如果在输入指定的大小是大于零但小于所需的大小。
备注
您应该调用这个函数两次,第一次获得所需的缓冲区大小(设置szNameBuffer为NULL和pcchNameBufferSize为0),和第二次获取数据。
Windows XP中:您必须指定一个缓冲区,缓冲区大小。该函数设置pcchNameBufferSize要么所需的大小或使用的是缓冲区大小。如果缓冲区太小,则函数返回PDH_INSUFFICIENT_BUFFER,而不是PDH_MORE_DATA。在字节的最大字符串的大小是PDH_MAX_COUNTER_NAME * sizeof(TCHAR)。
该指数值,您必须符合指定的指标之一值与对象或在计算机上加载的计数器相关。该指数/名称值对存储在以下注册表位置计数器注册表值。
HKEY_LOCAL_MACHINE
\\软件
\\微软
\\视窗NT
\\ CurrentVersion
\\ Perflib
最后反=最高柜台指数
最后帮助=最高帮助索引
\\ 009
计数器= 2系统4内存...
帮助= 3的系统对象类型...
\\支持的语言,英语以外的
计数器= ...
帮助= ...需求
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode和ANSI namesPdhLookupPerfNameByIndexW(Unicode)和PdhLookupPerfNameByIndexA(ANSI)的
参见
PdhLookupPerfIndexByName
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月23日
==英文原文==PdhLookupPerfNameByIndex Function
Returns the performance object name or counter name corresponding to the specified index.
Syntax
C++
PDH_STATUS PdhLookupPerfNameByIndex(
__in LPCTSTR szMachineName,
__in DWORD dwNameIndex,
__out LPTSTR szNameBuffer,
__in LPDWORD pcchNameBufferSize
);
Parameters
szMachineName [in]
Null-terminated string that specifies the name of the computer where the specified performance object or counter is located. The computer name can be specified by the DNS name or the IP address. If NULL, the function uses the local computer.
dwNameIndex [in]
Index of the performance object or counter.
szNameBuffer [out]
Caller-allocated buffer that receives the null-terminated name of the performance object or counter. Set to NULL if pcchNameBufferSize is zero.
pcchNameBufferSize [in]
Size of the szNameBuffer 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 szNameBuffer buffer is not large enough to contain the counter name. This return value is expected if pcchNameBufferSize 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 parameter is not valid or is incorrectly formatted. 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.

Remarks
You should call this function twice, the first time to get the required buffer size (set szNameBuffer to NULL and pcchNameBufferSize to 0), and the second time to get the data.
Windows XP: You must specify a buffer and buffer size. The function sets pcchNameBufferSize to either the required size or the size of the buffer that was used. If the buffer is too small, the function returns PDH_INSUFFICIENT_BUFFER instead of PDH_MORE_DATA. The maximum string size in bytes is PDH_MAX_COUNTER_NAME * sizeof(TCHAR).
The index value that you specify must match one of the index values associated with the objects or counters that were loaded on the computer. The index/name value pairs are stored in the Counters registry value in the following registry location.
HKEY_LOCAL_MACHINE
\\SOFTWARE
\\Microsoft
\\Windows NT
\\CurrentVersion
\\Perflib
Last Counter = highest counter index
Last Help = highest help index
\\009
Counters = 2 System 4 Memory...
Help = 3 The System Object Type...
\\supported language, other than English
Counters = ...
Help = ...Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode and ANSI namesPdhLookupPerfNameByIndexW (Unicode) and PdhLookupPerfNameByIndexA (ANSI)
See Also
PdhLookupPerfIndexByName
Send comments about this topic to Microsoft
Build date: 7/23/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa372648(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:23:11