MCPcopy Create free account
hub / github.com/aliasIsolation/aliasIsolation / Filter

Function Filter

src/crashHandler/crashHandler.cpp:95–124  ·  view source on GitHub ↗

if you use C++ exception handling: install a translator function with set_se_translator(). In the context of that function (but *not afterwards), you can either do your stack dump, or save the CONTEXT record as a local copy. Note that you must do the stack dump at the earliest opportunity, to avoid the interesting stack-frames being gone by the time you do the dump.

Source from the content-addressed store, hash-verified

93// earliest opportunity, to avoid the interesting stack-frames being gone
94// by the time you do the dump.
95LONG WINAPI Filter(EXCEPTION_POINTERS *ep) {
96 HANDLE thread;
97
98 std::string dumpFilePath;
99 {
100 char tempPath[MAX_PATH];
101 GetTempPathA(MAX_PATH, tempPath);
102 dumpFilePath = std::string(tempPath) + "aliasIsolationCrashDump.dmp";
103 }
104
105 const bool dumpWritten = WriteFullDump(GetCurrentProcess(), ep, dumpFilePath.c_str());
106
107 DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
108 GetCurrentProcess(), &thread, 0, false, DUPLICATE_SAME_ACCESS);
109
110 std::stringstream stackTrace;
111
112 stackTrace << "A fatal error was caught by Alias Isolation, and the current process will terminate.\n";
113 if (dumpWritten) {
114 stackTrace << "A crash dump has been written to " << dumpFilePath << ".\n";
115 }
116 stackTrace << "Press Ctrl+C to copy the contents of this message to the clipboard.\n\n";
117
118 show_stack(stackTrace, thread, *(ep->ContextRecord));
119 CloseHandle(thread);
120
121 MessageBoxA(NULL, stackTrace.str().c_str(), "Fatal error", MB_ICONEXCLAMATION);
122
123 return EXCEPTION_EXECUTE_HANDLER;
124}
125
126class SymHandler {
127 HANDLE p;

Callers

nothing calls this directly

Calls 2

WriteFullDumpFunction · 0.85
show_stackFunction · 0.85

Tested by

no test coverage detected