PdhEnumObjects 

The PdhEnumObjects function returns a list of objects available on the specified machine.

PDH_STATUS PdhEnumObjects(

    IN LPCTSTR szReserved,

// reserved

    IN LPCTSTR szMachineName,

// machine name

    IN LPTSTR mszObjectList,

// buffer for objects

    IN LPDWORD pcchBufferLength,

// size of buffer

    IN DWORD dwDetailLevel,

// detail level

    IN BOOL bRefresh

// refresh flag for connected machines

   );

 

 

Parameters

szReserved

Reserved. Must be NULL.

szMachineName

The name of the machine on which to list the objects. If the machine specified is not in the list of currently connected machines, the PDH will try to connect to the machine and add it to the list.

mszObjectList

The buffer allocated by the calling function that is to receive the multi-SZ list of objects available on the specified machine. This parameter may be NULL if the value of the DWORD pointed to 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 mszObjectList buffer, and that parameter may be NULL. However, 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.

dwDetailLevel

The detail level of the performance items to return. All items that are of the specified detail level or less will be returned.

bRefresh

Indicates that a new list of objects should be obtained from the specified machine. If the machine is not currently connected by the PDH, then this flag is ignored and the list is refreshed automatically.

 

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

There are more entries available to return than there is room in the buffer. Some entries might be returned in the buffer, however.

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.

 

Remarks

When you request a required buffer size, the bRefresh flag should be FALSE for all subsequent calls to this function. Otherwise, the size might not be valid.

See Also

PdhConnectMachine, PdhEnumMachines