2222#include < imagehlp.h>
2323#include " Common/MiniDumper_compat.h"
2424
25+ enum DumpType CPP_11 (: Int)
26+ {
27+ // Smallest dump type with call stacks and some supporting variables
28+ DUMP_TYPE_MINIMAL,
29+ // Large dump including all memory regions allocated by the GameMemory implementaion
30+ DUMP_TYPE_GAMEMEMORY,
31+ // Largest dump size including complete memory contents of the process
32+ DUMP_TYPE_FULL,
33+ };
34+
35+ enum MiniDumperExitCode CPP_11 (: Int)
36+ {
37+ DUMPER_EXIT_SUCCESS = 0x0 ,
38+ DUMPER_EXIT_FAILURE_WAIT = 0x37DA1040 ,
39+ DUMPER_EXIT_FAILURE_PARAM = 0x4EA527BB ,
40+ DUMPER_EXIT_FORCED_TERMINATE = 0x158B1154 ,
41+ };
42+
2543class MiniDumper
2644{
2745public:
28- MiniDumper ()
29- {
30- m_miniDumpInitialized = false ;
31- m_extendedInfoRequested = false ;
32- m_dbgHlp = NULL ;
33- m_pMiniDumpWriteDump = NULL ;
34- m_dumpRequested = NULL ;
35- m_dumpComplete = NULL ;
36- m_quitting = NULL ;
37- m_dumpThread = NULL ;
38- m_dumpThreadId = 0 ;
39- m_dumpObjectsState = 0 ;
40- m_dumpObjectsSubState = 0 ;
41- m_dmaRawBlockIndex = 0 ;
42- memset (m_dumpDir, 0 , ARRAY_SIZE (m_dumpDir));
43- memset (m_dumpFile, 0 , ARRAY_SIZE (m_dumpFile));
44- memset (m_sysDbgHelpPath, 0 , ARRAY_SIZE (m_sysDbgHelpPath));
45- };
46-
47- void Initialize (const AsciiString& userDirPath);
46+ MiniDumper ();
4847 Bool IsInitialized () const ;
49- void TriggerMiniDump (Bool extendedInfo = false );
50- void TriggerMiniDumpForException (struct _EXCEPTION_POINTERS * e_info, Bool extendedInfo = false );
51- void ShutDown ();
48+ void TriggerMiniDump (DumpType dumpType);
49+ void TriggerMiniDumpForException (struct _EXCEPTION_POINTERS * e_info, DumpType dumpType);
50+ static void initMiniDumper (const AsciiString& userDirPath);
51+ static void shutdownMiniDumper ();
5252 static LONG WINAPI DumpingExceptionFilter (struct _EXCEPTION_POINTERS * e_info);
53+
5354private:
54- void CreateMiniDump (Bool extendedInfo);
55+ void Initialize (const AsciiString& userDirPath);
56+ void ShutDown ();
57+ void CreateMiniDump (DumpType dumpType);
5558 BOOL DumpMemoryObjects (ULONG64& memoryBase, ULONG& memorySize);
5659 void CleanupResources ();
60+ Bool IsDumpThreadStillRunning () const ;
5761
5862 // Callbacks from dbghelp
5963 static BOOL CALLBACK MiniDumpCallback (PVOID CallbackParam, PMINIDUMP_CALLBACK_INPUT CallbackInput, PMINIDUMP_CALLBACK_OUTPUT CallbackOutput);
@@ -68,7 +72,8 @@ class MiniDumper
6872 static void KeepNewestFiles (const std::string& directory, const std::string& fileWildcard, const Int keepCount);
6973
7074 // Struct to hold file information
71- struct FileInfo {
75+ struct FileInfo
76+ {
7277 std::string name;
7378 FILETIME lastWriteTime;
7479 };
@@ -77,12 +82,13 @@ class MiniDumper
7782
7883private:
7984 Bool m_miniDumpInitialized;
80- Bool m_extendedInfoRequested ;
85+ DumpType m_requestedDumpType ;
8186
8287 // Path buffers
8388 Char m_dumpDir[MAX_PATH];
8489 Char m_dumpFile[MAX_PATH];
8590 Char m_sysDbgHelpPath[MAX_PATH];
91+ WideChar m_executablePath[MAX_PATH];
8692
8793 // Module handles
8894 HMODULE m_dbgHlp;
@@ -101,8 +107,7 @@ class MiniDumper
101107 int m_dumpObjectsSubState;
102108 int m_dmaRawBlockIndex;
103109
104- AllocationRangeIterator m_RangeIter;
105- AllocationRangeIterator m_endRangeIter;
110+ AllocationRangeIterator m_rangeIter;
106111
107112 // Function pointer to MiniDumpWriteDump in dbghelp.dll
108113 typedef BOOL (WINAPI* MiniDumpWriteDump_t)(
@@ -117,4 +122,6 @@ class MiniDumper
117122
118123 MiniDumpWriteDump_t m_pMiniDumpWriteDump;
119124};
125+
126+ extern MiniDumper* TheMiniDumper;
120127#endif
0 commit comments