add exception handler

This commit is contained in:
Akash Mozumdar 2018-09-01 14:57:25 -04:00
parent 88d67c5378
commit 072840e307

View File

@ -1,8 +1,19 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication> #include <QApplication>
LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS* exception)
{
std::wstring errorMsg(L"");
errorMsg += L"Error code: " + std::to_wstring(exception->ExceptionRecord->ExceptionCode);
errorMsg += L"\r\nError address: " + std::to_wstring((DWORD)exception->ExceptionRecord->ExceptionAddress);
errorMsg += L"\r\nAdditional info: " + std::to_wstring(exception->ExceptionRecord->ExceptionInformation[1]);
MessageBoxW(NULL, errorMsg.c_str(), L"NextHooker ERROR", MB_ICONERROR);
return EXCEPTION_CONTINUE_SEARCH;
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
AddVectoredExceptionHandler(1, ExceptionHandler);
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
w.show(); w.show();