CounterPathCallback

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
);
 

Parameters

dwArg
The user-defined DWORD value passed to the callback function by the browser dialog box. This value is the dwCallBackArg member of the PDH_BROWSE_DLG_CONFIG structure.

Remarks

The following members in the PDH_BROWSE_DLG_CONFIG structure are used to communicate with the callback function:

szReturnPathBuffer
Contains the counter path strings currently selected by the user.
cchReturnPathLength
Contains the current maximum size of the szReturnPathBuffer member. If the callback function reallocates a new buffer, it must also update this value.
CallBackStatus
On entry to the callback function, this member contains the status of the path buffer. On exit, the callback function sets the status value resulting from processing.

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.

Return Values

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.

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhBrowseCounters, PDH_BROWSE_DLG_CONFIG