The CounterPathCallback function is an application-defined callback function that processes the counter path strings read from the szReturnPathBuffer member of the PDH_BROWSE_DLG_CONFIG structure.
PDH_STATUS __stdcall CounterPathCallback(
IN DWORD dwArg // Pointer to a PDH_BROWSE_DLG_CONFIG structure
);
The following members in the PDH_BROWSE_DLG_CONFIG structure are used to communicate with the callback function:
If the buffer is too small to load the current selection, the browser will set this value to PDH_MORE_DATA. If the browser sets this member to ERROR_SUCCESS, then the szReturnPathBuffer member contains a valid counter path or counter path list.
If the callback function reallocates a new buffer, it should set this member to PDH_RETRY so that the browser will try to load the buffer with the selected paths and call the callback function again.
If some other error occurred, then the callback function should return the appropriate PDH error status value.
If the function succeeds (processes the buffer and does not need to be called again), it returns ERROR_SUCCESS.
If the function fails (an error occurs and the function needs to be called again to retry the processing), it returns PDH_RETRY. This is usually the result of insufficient memory.
Performance Data Helper Overview, Performance Data Functions, , PdhBrowseCounters, PDH_BROWSE_DLG_CONFIG