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

Function WriteFullDump

src/crashHandler/crashHandler.cpp:46–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46bool WriteFullDump(HANDLE hProc, EXCEPTION_POINTERS *ep, const char* filePath)
47{
48 HANDLE hFile = CreateFile(filePath, GENERIC_ALL, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
49 if (!hFile)
50 {
51 return false;
52 }
53 else
54 {
55 MINIDUMP_EXCEPTION_INFORMATION mdei{};
56
57 mdei.ThreadId = GetCurrentThreadId();
58 mdei.ExceptionPointers = ep;
59 mdei.ClientPointers = FALSE;
60
61 BOOL Result = MiniDumpWriteDump( hProc,
62 GetProcessId(hProc),
63 hFile,
64#ifdef _DEBUG
65 /*
66 Do a full memory dump if we are in debug build mode (this will create massive dump files 1GB+, but is useful for debugging because it
67 populates variable data).
68 */
69 (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithFullMemoryInfo | MiniDumpWithHandleData | MiniDumpWithUnloadedModules | MiniDumpWithThreadInfo),
70#else
71 // Otherwise do a normal memory dump containing a stack trace for all threads.
72 (MINIDUMP_TYPE)MiniDumpNormal,
73#endif
74 &mdei,
75 nullptr,
76 nullptr );
77
78 CloseHandle(hFile);
79
80 if (!Result)
81 {
82 return false;
83 }
84 }
85
86 return true;
87}
88
89// if you use C++ exception handling: install a translator function
90// with set_se_translator(). In the context of that function (but *not*

Callers 1

FilterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected