PdhGetDefaultPerfObject 

The PdhGetDefaultPerfObject function retrieves the name of the default performance object. The name can be used to select the default entry in the object browser list box.

PDH_STATUS PdhGetDefaultPerfObject(

    IN LPCTSTR szReserved,

// reserved

    IN LPCTSTR szMachineName,

// machine to query

    IN LPTSTR szDefaultObjectName,

// buffer to receive object

    IN LPDWORD pcchBufferSize

// size of object name

   );

 

 

Parameters

szReserved

Reserved. Must be NULL.

szMachineName

The name of the machine to query.

szDefaultObjectName

A pointer to the buffer to receive the default object name. This parameter can be NULL if the value of the DWORD referenced by pcchBufferSize is 0.

pcchBufferSize

The size of the szDefaultObjectName buffer, in characters, on entry and the size of the returned object name on exit. If the value in the DWORD referenced by this parameter is 0, then the required buffer size, in characters, for this object name will be returned in the DWORD and no data will be copied to the 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:

PDH_INSUFFICIENT_BUFFER

The buffer provided is not large enough for the available data.

PDH_INVALID_ARGUMENT

A required argument is invalid or a reserved argument is not NULL.

PDH_MEMORY_ALLOCATION_FAILURE

A required temporary buffer could not be allocated.

PDH_CSTATUS_NO_MACHINE

The specified machine is offline or unavailable.

PDH_CSTATUS_NO_COUNTERNAME

The default object name cannot be read or found.

 

See Also

PdhGetDefaultPerfCounter