Platform SDK: Performance Monitoring

Performance Monitoring Types

All PDH string structures are shown as type TCHAR, meaning that both Unicode and ANSI string structures are supported. Internally, the native or preferred code path inside the PDH is the Unicode string format, because it is built only for Windows NT/Windows 2000. An ANSI version of each function is provided for those functions that have string arguments. They are, however, slightly less efficient because they must convert the ANSI string arguments to Unicode arguments before calling the Unicode version of the function.

The string data types expected are determined by the Unicode symbol when the application is compiled. If Unicode is defined, then the Unicode or wide character strings are expected. If the symbol is undefined, then the 8-bit or ANSI character strings are expected.

Data type Description
HQUERY Handle to a query (HANDLE).
HCOUNTER Handle to a counter. PDH maintains the linkage between counters and queries.
PDH_STATUS LONG status value.

Unless otherwise specified, all functions return a Win32 status value of ERROR_SUCCESS if the function completes successfully or a PDH error status value defined in the PDHMsg.h header file.

For data collection and formatting functions it is important to remember that the return value of the function indicates the success or error of the function call and not necessarily that of the counter data. Always check the CStatus member of the counter value returned to ensure that the data returned is valid before you use it. If the value of the CStatus member does not indicate success, do not use the data.