There is more data to return than would fit in the supplied buffer. Unable to connect to the specified computer, or the computer is offline. The return data value is valid and different from the last sample. These values are defined in the pdhmsg.h header file. The following table provides a list of error codes that are specific to PDH. If the value of the CStatus member does not indicate success, do not use the data. Always check the CStatus member of the counter value returned to ensure that the data returned is valid before you use it. Wprintf(L'Formatted message: %ls\n', pMessage) įor 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. Wprintf(L'Format message failed with 0x%x\n', GetLastError()) If (!FormatMessage(FORMAT_MESSAGE_FROM_HMODULE | Wprintf(L'LoadLibrary failed with %lu\n', GetLastError()) #include ĭWORD dwErrorCode = PDH_PLA_ERROR_ALREADY_EXISTS To retrieve the description text for the error in your application, use the FormatMessage function as shown in the following example. Otherwise, the function returns a system error code or a PDH error code. If the function succeeds, the return value is ERROR_SUCCESS.
All Performance Data Helper (PDH) functions return a value of type PDH_STATUS.