forked from Public-Mirror/Textractor
improve error msg
This commit is contained in:
parent
072840e307
commit
7c2bddcc98
17
GUI/main.cpp
17
GUI/main.cpp
@ -1,13 +1,20 @@
|
||||
#include "mainwindow.h"
|
||||
#include <sstream>
|
||||
#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);
|
||||
std::wstringstream errorMsg;
|
||||
errorMsg << std::uppercase << std::hex;
|
||||
errorMsg << L"Error code: " << exception->ExceptionRecord->ExceptionCode << std::endl;
|
||||
errorMsg << L"Error address: " << (DWORD)exception->ExceptionRecord->ExceptionAddress << std::endl;
|
||||
MEMORY_BASIC_INFORMATION info = {};
|
||||
VirtualQuery(exception->ExceptionRecord->ExceptionAddress, &info, sizeof(info));
|
||||
wchar_t name[MAX_PATH] = {};
|
||||
GetModuleFileNameW((HMODULE)info.AllocationBase, name, MAX_PATH);
|
||||
errorMsg << L"Error in module: " << name << std::endl;
|
||||
errorMsg << L"Additional info: " << exception->ExceptionRecord->ExceptionInformation[1];
|
||||
MessageBoxW(NULL, errorMsg.str().c_str(), L"NextHooker ERROR", MB_ICONERROR);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user