CounterPathCallBack callback function

Applications implement the CounterPathCallBack function to process the counter path strings returned by the Browse dialog box.


PDH_STATUS __stdcall CounterPathCallBack(
  _In_ DWORD_PTR dwArg


dwArg [in]

User-defined value passed to the callback function by the Browse dialog box. You set this value in the dwCallBackArg member of the PDH_BROWSE_DLG_CONFIG structure.

Return value

Return ERROR_SUCCESS if the function succeeds.

If the function fails due to a transient error, you can return PDH_RETRY and PDH will call your callback immediately.

Otherwise, return an appropriate error code. The error code is passed back to the caller of PdhBrowseCounters.


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


Contains the counter path strings that the user selected.


Contains the maximum size of the szReturnPathBuffer member. If the callback function reallocates a new buffer, it must also update this value.


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 browser sets this member to ERROR_SUCCESS, then the szReturnPathBuffer member contains a valid counter path or counter path list.

If the buffer is too small to load the current selection, the browser will set this value to PDH_MORE_DATA. Allocate a larger szReturnPathBuffer buffer and return PDH_RETRY.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]



See also