PdhParseCounterPathW function (pdh.h)
Parses the elements of the counter path and stores the results in the PDH_COUNTER_PATH_ELEMENTS structure.
PDH_FUNCTION PdhParseCounterPathW( [in] LPCWSTR szFullPathBuffer, [out] PPDH_COUNTER_PATH_ELEMENTS_W pCounterPathElements, [in, out] LPDWORD pdwBufferSize, DWORD dwFlags );
Null-terminated string that contains the counter path to parse. The maximum length of a counter path is PDH_MAX_COUNTER_PATH.
Caller-allocated buffer that receives a PDH_COUNTER_PATH_ELEMENTS structure. The structure contains pointers to the individual string elements of the path referenced by the szFullPathBuffer parameter. The function appends the strings to the end of the PDH_COUNTER_PATH_ELEMENTS structure. The allocated buffer should be large enough for the structure and the strings. Set to NULL if pdwBufferSize is zero.
[in, out] pdwBufferSize
Size of the pCounterPathElements 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.
Reserved. Must be zero.
If the function succeeds, it returns ERROR_SUCCESS.
||A parameter is not valid.|
||The pCounterPathElements buffer is too small to contain the path elements. This return value is expected if pdwBufferSize 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.|
||The path is not formatted correctly and cannot be parsed. 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.|
||Unable to allocate memory in order to complete the function.|
You should call this function twice, the first time to get the required buffer size (set pCounterPathElements to NULL and pdwBufferSize to 0), and the second time to get the data.
The pdh.h header defines PdhParseCounterPath as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|