Platform SDK: Performance Monitoring

PdhLookupPerfNameByIndex

The PdhLookupPerfNameByIndex function returns the performance object name corresponding to the specified index.

PDH_STATUS PdhLookupPerfNameByIndex(
  LPCTSTR *szMachineName,  
  DWORD dwNameIndex,      
  LPTSTR szNameBuffer,     
  LPDWORD pcchNameBufferSize
);

Parameters

szMachineName
[in] A pointer to a null-terminated string containing the name of a buffer that contains the name of the machine where the specified performance object is located. The machine name can be specified by the DNS name or the IP address.
dwNameIndex
[in] The index of the performance object.
szNameBuffer
[out] A pointer to a null-terminated string containing the name of the buffer that receives the name of the performance object.
pcchNameBufferSize
[in] A pointer to a DWORD containing the size, in bytes, of the szNameBuffer buffer.

Return Values

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a PDH error status defined in PDHMsg.h. The following are possible error values.

Error value Description
PDH_INSUFFICIENT_BUFFER The buffer is not large enough to contain any data.
PDH_INVALID_ARGUMENT An argument is not correct or is incorrectly formatted.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Pdh.h.
  Library: Use Pdh.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

PdhLookupPerfIndexByName