PdhGetRawCounterArray function
Returns an array of raw values from the specified counter. Use this function when you want to retrieve the raw counter values of a counter that contains a wildcard character for the instance name.
Syntax
PDH_STATUS PdhGetRawCounterArray( _In_ PDH_HCOUNTER hCounter, _Inout_ LPDWORD lpdwBufferSize, _Out_ LPDWORD lpdwItemCount, _Out_ PPDH_RAW_COUNTER_ITEM ItemBuffer );
Parameters
- hCounter [in]
-
Handle of the counter for whose current raw instance values you want to retrieve. The PdhAddCounter function returns this handle.
- lpdwBufferSize [in, out]
-
Size of the ItemBuffer buffer, in bytes. If zero on input, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.
- lpdwItemCount [out]
-
Number of raw counter values in the ItemBuffer buffer.
- ItemBuffer [out]
-
Caller-allocated buffer that receives the array of PDH_RAW_COUNTER_ITEM structures; the structures contain the raw instance counter values. Set to NULL if lpdwBufferSize is zero.
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 |
|---|---|
|
The ItemBuffer buffer is not large enough to contain the object name. This return value is expected if lpdwBufferSize is zero on input. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer. |
|
A parameter is not valid or is incorrectly formatted. For example, on some releases you could receive this error if the specified size on input is greater than zero but less than the required size. |
|
The counter handle is not valid. |
Remarks
You should call this function twice, the first time to get the required buffer size (set ItemBuffer to NULL and lpdwBufferSize to 0), and the second time to get the data.
The data for the counter is locked for the duration of the call to PdhGetRawCounterArray to prevent any changes during processing of the call.
Requirements
|
Minimum supported client | Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | PdhGetRawCounterArrayW (Unicode) and PdhGetRawCounterArrayA (ANSI) |
See also
- PdhGetFormattedCounterValue
- PdhGetFormattedCounterArray
- PdhCalculateCounterFromRawValue
- PDH_RAW_COUNTER_ITEM
Send comments about this topic to Microsoft
Build date: 10/26/2012