PdhEnumMachines

The PdhEnumMachines function returns a list of the names of the machines that have been opened previously by the PDH DLL. The machines listed include those that are currently connected and online, as well as those that are offline or not returning performance data. For information about how to connect to a machine, see PdhConnectMachine.

PDH_STATUS PdhEnumMachines(
  IN LPCTSR szReserved,        // reserved
  IN LPTSTR mszMachineNameList,  // list of connected machines
  IN LPDWORD pcchBufferLength  // pointer to buffer length
);
 

Parameters

szReserved
Reserved. Must be NULL.
mszMachineNameList
The buffer, allocated by the calling function, to receive the list of MULTI_SZ strings of machines to which the PDH DLL is currently connected. This parameter may be NULL if the value in the DWORD referenced by pcchBufferLength is 0.
pcchBufferLength
A pointer to the DWORD containing the size, in characters, of the available buffer on entry and the size of the returned buffer on exit. If the buffer size on entry is zero, then no data is returned in the mszMachineNameList buffer (and the pointer may be NULL), and the size of the buffer required, in characters, is returned in the DWORD pointed to by pcchBufferLength. The size returned includes both terminating NULL characters of the MULTI_SZ string.

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:

PDH_MORE_DATA
More data is available then the current buffer can hold. Some entries may be returned in the mszMachinenameList buffer.
PDH_INSUFFICIENT_BUFFER
The buffer provided is not large enough to contain any data.
PDH_INVALID_ARGUMENT
A required argument is invalid or a reserved argument is not NULL.

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhConnectMachine