Add handler for error message event

This commit is contained in:
Odd Stranne
2021-02-18 19:06:24 +01:00
parent bc2da3fb88
commit 7c0e0278e4

View File

@@ -5,6 +5,8 @@
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <windows.h>
#include <conio.h>
#include <ip2string.h>
@@ -600,6 +602,19 @@ void DisplaySplittingErrorEvent(const ST_SPLITTING_ERROR_EVENT *evt, size_t /*ev
std::wcout << L"Imagename: " << imageName << std::endl;
}
void DisplayErrorMessageEvent(const ST_ERROR_MESSAGE_EVENT *evt, size_t /*eventSize*/)
{
std::wstringstream ss;
ss << L"Status: 0x" << std::setw(8) << std::setfill(L'0') << std::hex << evt->Status;
std::wcout << ss.str() << std::endl;
std::wstring message(&evt->ErrorMessage[0], &evt->ErrorMessage[0] + (evt->ErrorMessageLength / sizeof(wchar_t)));
std::wcout << L"Error message: " << message << std::endl;
}
void ParseDisplayEvent(const uint8_t *evt, size_t eventSize)
{
if (!g_DisplayEvents)
@@ -647,6 +662,14 @@ void ParseDisplayEvent(const uint8_t *evt, size_t eventSize)
break;
}
case ST_EVENT_ID_ERROR_MESSAGE:
{
std::wcout << L"Type: ST_EVENT_ID_ERROR_MESSAGE" << std::endl;
DisplayErrorMessageEvent((ST_ERROR_MESSAGE_EVENT*)&header->EventData[0], header->EventSize);
break;
}
default:
{
std::wcout << L"Unsupported event" << std::endl;