PdhGetRawCounterValue function

Returns the current raw value of the counter.

Syntax

PDH_FUNCTION PdhGetRawCounterValue(
  PDH_HCOUNTER     hCounter,
  LPDWORD          lpdwType,
  PPDH_RAW_COUNTER pValue
);

Parameters

hCounter

Handle of the counter from which to retrieve the current raw value. The PdhAddCounter function returns this handle.

lpdwType

Receives the counter type. For a list of counter types, see the Counter Types section of the Windows Server 2003 Deployment Kit. This parameter is optional.

pValue

A PDH_RAW_COUNTER structure that receives the counter value.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code or a PDH error code. The following are possible values.

Return code Description
PDH_INVALID_ARGUMENT
A parameter is not valid 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.

If the specified counter instance does not exist, this function will return ERROR_SUCCESS and the CStatus member of the PDH_RAW_COUNTER structure will contain PDH_CSTATUS_NO_INSTANCE.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header pdh.h
Library Pdh.lib
DLL Pdh.dll

See also

PdhCalculateCounterFromRawValue

PdhCollectQueryData

PdhGetFormattedCounterValue