PdhGetRawCounterValue

The PdhGetRawCounterValue function returns the current raw value of the counter.

PDH_STATUS PdhGetRawCounterValue(
  IN HCOUNTER hCounter,       // handle of the counter
  IN LPDWORD lpdwType,        // counter type
  IN PPDH_RAW_COUNTER pValue  // counter value
);
 

Parameters

hCounter
The handle of the counter from which to retrieve the current raw value.
lpdwType
A pointer to a DWORD buffer that will receive the counter type. The possible counter types are described in winperf.h. This parameter is optional. You can pass NULL if you don't want the type information.
pValue
A pointer to the data buffer that will receive the counter value.

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_INVALID_ARGUMENT
An argument is not correct or is incorrectly formatted.
PDH_INVALID_HANDLE
The counter handle is not valid.

Remarks

The data for the counter is locked (protected) for the duration of the call to PdhGetRawCounterValue to prevent any changes during processing of the call.

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhGetFormattedCounterValue, PdhCalculateCounterFromRawValue