PdhParseCounterPath
The PdhParseCounterPath function parses the elements of the counter path and stores the results in the structure passed by the caller.
PDH_STATUS PdhParseCounterPath(
IN LPCTSTR szFullPathBuffer, // path string buffer
IN PDH_COUNTER_PATH_ELEMENTS *pCounterPathElements,
// counter path elements
IN LPDWORD pdwBufferSize, // size of buffer
IN DWORD dwFlags // reserved
);
Parameters
-
szFullPathBuffer
-
The buffer containing the counter path to parse into individual components.
-
pCounterPathElements
-
A pointer to a PDH_COUNTER_PATH_ELEMENTS structure that will receive the individual components of the path referenced by the szFullPathBuffer parameter. The buffer space allocated for this should be large enough for the structure and the strings that will be referenced by the members in this structure. As this function parses the elements in the path, they are stored in the buffer after the PDH_COUNTER_PATH_ELEMENTS structure. This allows the calling function to allocate, and eventually free, only a single block of memory for this structure and the strings referenced by the members of this structure, rather than having the calling function allocate the structure and the string buffers separately.
-
pdwBufferSize
-
A pointer to the DWORD containing the size, in bytes, of the buffer referenced by pCounterPathElements and returns with the size of the buffer used. If the buffer size on entry is zero, then no data is returned in the pCounterPathElements buffer, however, the size of the buffer required is returned in the DWORD referenced by this pointer.
-
dwFlags
-
Reserved. Must be zero.
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 incorrect, or this function does not have the necessary access to that argument.
-
PDH_INSUFFICIENT_BUFFER
-
The buffer supplied is not large enough to accept the resulting data.
-
PDH_INVALID_PATH
-
The path is not formatted correctly and cannot be parsed.
-
PDH_MEMORY_ALLOCATION_FAILURE
-
A temporary buffer cannot be allocated.
See Also
Performance Data Helper Overview, Performance Data Functions, , PDH_COUNTER_PATH_ELEMENTS, PdhMakeCounterPath