mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
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 "mainwindow.h"
|
||||||
|
#include <sstream>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS* exception)
|
LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS* exception)
|
||||||
{
|
{
|
||||||
std::wstring errorMsg(L"");
|
std::wstringstream errorMsg;
|
||||||
errorMsg += L"Error code: " + std::to_wstring(exception->ExceptionRecord->ExceptionCode);
|
errorMsg << std::uppercase << std::hex;
|
||||||
errorMsg += L"\r\nError address: " + std::to_wstring((DWORD)exception->ExceptionRecord->ExceptionAddress);
|
errorMsg << L"Error code: " << exception->ExceptionRecord->ExceptionCode << std::endl;
|
||||||
errorMsg += L"\r\nAdditional info: " + std::to_wstring(exception->ExceptionRecord->ExceptionInformation[1]);
|
errorMsg << L"Error address: " << (DWORD)exception->ExceptionRecord->ExceptionAddress << std::endl;
|
||||||
MessageBoxW(NULL, errorMsg.c_str(), L"NextHooker ERROR", MB_ICONERROR);
|
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;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user