Platform SDK: Performance Monitoring

PdhGetRawCounterArray

The PdhGetRawCounterArray function returns an array of raw values from the specified counter.

PDH_STATUS PdhGetRawCounterArray(
  HCOUNTER hCounter,       
  LPDWORD lpdwBufferSize,  
  LPDWORD lpdwItemCount,   
  PPDH_RAW_COUNTER_ITEM ItemBuffer  
);

Parameters

hCounter
[in] A handle to the counter from which to retrieve the current raw values.
lpdwBufferSize
[in/out] A pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by ItemBuffer.
lpdwItemCount
[out] A pointer to a DWORD that contains the number of values in the buffer pointed to by ItemBuffer.
ItemBuffer
[out] A pointer to an array of PDH_RAW_COUNTER_ITEM structures that receives the counter values.

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_INVALID_ARGUMENT An argument is not correct or is incorrectly formatted.
PDH_MORE_DATA The buffer was not large enough to contain the counter data.
PDH_INVALID_HANDLE The counter handle is not valid.

Remarks

The data for the counter is locked for the duration of the call to PdhGetRawCounterArray to prevent any changes during processing of the call.

The value of hCounter can be obtained by a call to PdhAddCounter, with a wildcard specified for the instance name.

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

PdhGetFormattedCounterValue, PdhGetFormattedCounterArray, PdhCalculateCounterFromRawValue, PDH_RAW_COUNTER_ITEM, PdhAddCounter