Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

PdhEnumMachinesH function

Returns a list of the computer names associated with counters in a log file. The computer names were either specified when adding counters to the query or when calling the PdhConnectMachine function. The computers listed include those that are currently connected and online, in addition to those that are offline or not returning performance data.

This function is identical to the PdhEnumMachines function, except that it supports the use of handles to data sources.

Syntax


PDH_STATUS PdhEnumMachinesH(
  _In_     PDH_HLOG hDataSource,
  _Out_    LPTSTR mszMachineNameList,
  _Inout_  LPDWORD pcchBufferLength
);

Parameters

hDataSource [in]

Handle to a data source returned by the PdhBindInputDataSource function.

mszMachineNameList [out]

Caller-allocated buffer to receive the list of null-terminated strings that contain the computer names. The list is terminated with two null-terminator characters. Set to NULL if pcchBufferLength is zero.

pcchBufferLength [in, out]

Size of the mszMachineNameList 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_DATA

The mszMachineNameList buffer is too small to contain all the data. This return value is expected if pcchBufferLength 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_ARGUMENT

A 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.

 

Remarks

You should call this function twice, the first time to get the required buffer size (set mszMachineNameList to NULL and pcchBufferLength to 0), and the second time to get the data.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Pdh.h

Library

Pdh.lib

DLL

Pdh.dll

Unicode and ANSI names

PdhEnumMachinesHW (Unicode) and PdhEnumMachinesHA (ANSI)

See also

PdhBindInputDataSource
PdhConnectMachine

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.