// #include "StdAfx.h" #include "pdhtest.h" SErrorMessage sErrMsg[] = { { ((DWORD)0x00000000L), L"PDH_CSTATUS_VALID_DATA" }, { ((DWORD)0x00000001L), L"PDH_CSTATUS_NEW_DATA" }, { ((DWORD)0x800007D0L), L"PDH_CSTATUS_NO_MACHINE" }, { ((DWORD)0x800007D1L), L"PDH_CSTATUS_NO_INSTANCE" }, { ((DWORD)0x800007D2L), L"PDH_MORE_DATA" }, { ((DWORD)0x800007D3L), L"PDH_CSTATUS_ITEM_NOT_VALIDATED" }, { ((DWORD)0x800007D4L), L"PDH_RETRY" }, { ((DWORD)0x800007D5L), L"PDH_NO_DATA" }, { ((DWORD)0x800007D6L), L"PDH_CALC_NEGATIVE_DENOMINATOR" }, { ((DWORD)0x800007D7L), L"PDH_CALC_NEGATIVE_TIMEBASE" }, { ((DWORD)0x800007D8L), L"PDH_CALC_NEGATIVE_VALUE" }, { ((DWORD)0x800007D9L), L"PDH_DIALOG_CANCELLED" }, { ((DWORD)0x800007DAL), L"PDH_END_OF_LOG_FILE" }, { ((DWORD)0xC0000BB8L), L"PDH_CSTATUS_NO_OBJECT" }, { ((DWORD)0xC0000BB9L), L"PDH_CSTATUS_NO_COUNTER" }, { ((DWORD)0xC0000BBAL), L"PDH_CSTATUS_INVALID_DATA" }, { ((DWORD)0xC0000BBBL), L"PDH_MEMORY_ALLOCATION_FAILURE" }, { ((DWORD)0xC0000BBCL), L"PDH_INVALID_HANDLE" }, { ((DWORD)0xC0000BBDL), L"PDH_INVALID_ARGUMENT" }, { ((DWORD)0xC0000BBEL), L"PDH_FUNCTION_NOT_FOUND" }, { ((DWORD)0xC0000BBFL), L"PDH_CSTATUS_NO_COUNTERNAME" }, { ((DWORD)0xC0000BC0L), L"PDH_CSTATUS_BAD_COUNTERNAME" }, { ((DWORD)0xC0000BC1L), L"PDH_INVALID_BUFFER" }, { ((DWORD)0xC0000BC2L), L"PDH_INSUFFICIENT_BUFFER" }, { ((DWORD)0xC0000BC3L), L"PDH_CANNOT_CONNECT_MACHINE" }, { ((DWORD)0xC0000BC4L), L"PDH_INVALID_PATH" }, { ((DWORD)0xC0000BC5L), L"PDH_INVALID_INSTANCE" }, { ((DWORD)0xC0000BC6L), L"PDH_INVALID_DATA" }, { ((DWORD)0xC0000BC7L), L"PDH_NO_DIALOG_DATA" }, { ((DWORD)0xC0000BC8L), L"PDH_CANNOT_READ_NAME_STRINGS" }, { ((DWORD)0xC0000BC9L), L"PDH_LOG_FILE_CREATE_ERROR" }, { ((DWORD)0xC0000BCAL), L"PDH_LOG_FILE_OPEN_ERROR" }, { ((DWORD)0xC0000BCBL), L"PDH_LOG_TYPE_NOT_FOUND" }, { ((DWORD)0xC0000BCCL), L"PDH_NO_MORE_DATA" }, { ((DWORD)0xC0000BCDL), L"PDH_ENTRY_NOT_IN_LOG_FILE" }, { ((DWORD)0xC0000BCEL), L"PDH_DATA_SOURCE_IS_LOG_FILE" }, { ((DWORD)0xC0000BCFL), L"PDH_DATA_SOURCE_IS_REAL_TIME" }, { ((DWORD)0xC0000BD0L), L"PDH_UNABLE_READ_LOG_HEADER" }, { ((DWORD)0xC0000BD1L), L"PDH_FILE_NOT_FOUND" }, { ((DWORD)0xC0000BD2L), L"PDH_FILE_ALREADY_EXISTS" }, { ((DWORD)0xC0000BD3L), L"PDH_NOT_IMPLEMENTED" }, { ((DWORD)0xC0000BD4L), L"PDH_STRING_NOT_FOUND" }, { ((DWORD)0x80000BD5L), L"PDH_UNABLE_MAP_NAME_FILES" }, { ((DWORD)0xC0000BD6L), L"PDH_UNKNOWN_LOG_FORMAT" }, { ((DWORD)0xC0000BD7L), L"PDH_UNKNOWN_LOGSVC_COMMAND" }, { ((DWORD)0xC0000BD8L), L"PDH_LOGSVC_QUERY_NOT_FOUND" }, { ((DWORD)0xC0000BD9L), L"PDH_LOGSVC_NOT_OPENED" }, { ((DWORD)0xC0000BDAL), L"PDH_WBEM_ERROR" }, { ((DWORD)0xC0000BDBL), L"PDH_ACCESS_DENIED" }, { ((DWORD)0xC0000BDCL), L"PDH_LOG_FILE_TOO_SMALL" } }; WCHAR * GetPdhErrMsg (DWORD dwCode) { int i; WCHAR * pwcsRet = L"????"; for (i = 0;i < sizeof(sErrMsg)/sizeof(SErrorMessage); i++) { if (dwCode == sErrMsg[i].dwCode) { pwcsRet = sErrMsg[i].wcsDescr; break; } } return pwcsRet; };