BugSplat Native Windows DLL  3.6.0.0
BugSplat API reference for native Windows applications.
BugSplat.h
1 
3 //
4 // BugSplat.h
5 //
6 // This header file contains the code used to add BugSplat crash reporting to
7 // native Windows applications.
8 //
9 // For the simplest implementation read the documentation at
10 // https://www.bugsplat.com
11 //
12 //
13 // Copyright 2003-2017, BugSplat
14 // All rights reserved.
15 //
17 
22 
23 
24 #ifndef BUGSPLAT_H
25 #define BUGSPLAT_H
26 
27 #ifdef BUGSPLAT_EXPORTS
28  #define MDS_EXPORT __declspec(dllexport)
29 #else
30  #define MDS_EXPORT __declspec(dllimport)
31 #endif
32 
33 #include <Windows.h>
34 
38 typedef bool (__cdecl *MiniDmpSenderCallback)(UINT nCode, LPVOID lVal1, LPVOID lVal2);
39 
40 // forward declare internal class
41 class MiniDumper;
42 
44 class MDS_EXPORT MiniDmpSender
45 {
46 public:
52  MiniDmpSender(__wchar_t const *szDatabase,
53  __wchar_t const *szApp,
54  __wchar_t const *szVersion,
55  __wchar_t const *szAppIdentifier = NULL,
56  DWORD dwFlags = 0x04 /* MDSF_PREVENTHIJACKING */
57  );
58  virtual ~MiniDmpSender();
59 public:
62  bool enableExceptionFilter(bool enable = true);
63 
65  bool isExceptionFilterEnabled() const;
66 
67  // the following typedef is identical to MINIDUMP_TYPE; copied here for convenience
68  typedef enum _BS_MINIDUMP_TYPE {
69  MiniDumpNormal = 0x00000000,
70  MiniDumpWithDataSegs = 0x00000001,
71  MiniDumpWithFullMemory = 0x00000002,
72  MiniDumpWithHandleData = 0x00000004,
73  MiniDumpFilterMemory = 0x00000008,
74  MiniDumpScanMemory = 0x00000010,
75  MiniDumpWithUnloadedModules = 0x00000020,
76  MiniDumpWithIndirectlyReferencedMemory = 0x00000040,
77  MiniDumpFilterModulePaths = 0x00000080,
78  MiniDumpWithProcessThreadData = 0x00000100,
79  MiniDumpWithPrivateReadWriteMemory = 0x00000200,
80  MiniDumpWithoutOptionalData = 0x00000400,
81  MiniDumpWithFullMemoryInfo = 0x00000800,
82  MiniDumpWithThreadInfo = 0x00001000,
83  MiniDumpWithCodeSegs = 0x00002000,
84  MiniDumpWithoutAuxiliaryState = 0x00004000,
85  MiniDumpWithFullAuxiliaryState = 0x00008000,
86  MiniDumpWithPrivateWriteCopyMemory = 0x00010000,
87  MiniDumpIgnoreInaccessibleMemory = 0x00020000,
88  MiniDumpWithTokenInformation = 0x00040000,
89  MiniDumpWithModuleHeaders = 0x00080000,
90  MiniDumpFilterTriage = 0x00100000,
91  MiniDumpWithAvxXStateContext = 0x00200000,
92  MiniDumpValidTypeFlags = 0x003fffff,
93  } BS_MINIDUMP_TYPE;
94 
95  // Get/set the minidump type. Use with care. Changing the minidump type can result in large crash file
96  // uploads that may be rejected by BugSplat.
97  MiniDmpSender::BS_MINIDUMP_TYPE getMiniDumpType() const;
98  void setMiniDumpType(MiniDmpSender::BS_MINIDUMP_TYPE eType);
99 
101  bool enableFullMemoryDumpAndExit(bool enable = true);
103  bool isFullMemoryDumpAndExitEnabled() const;
104 
106  bool setFlags( DWORD dwFlags );
108  DWORD getFlags() const;
109 
111  void resetVersionString(const __wchar_t * wszVersion);
112 
114  void resetAppIdentifier(const __wchar_t * wszDescription);
115 
117  void sendAdditionalFile(const __wchar_t * wszPath);
118 
120  bool removeAdditionalFile(const __wchar_t * wszPath);
121 
123  void setUserZipPath(const __wchar_t * wszPath);
124 
126  void setResourceDllPath(const __wchar_t * wszPath);
127 
129  void setDefaultUserName(const __wchar_t * wszName);
130 
132  void setDefaultUserEmail(const __wchar_t * wszEmail);
133 
135  void setDefaultUserDescription(const __wchar_t * wszDescription);
136 
139  void createReport();
140  void createReport(EXCEPTION_POINTERS * pExcepInfo);
142  void createReport(const __wchar_t * wszStackTracePath);
144  inline void createReportAndExit() { setFlags(getFlags() | 0x02/*MDSF_FORCEEXIT*/); throw NULL; }
145 
147  LONG unhandledExceptionHandler( PEXCEPTION_POINTERS pExceptionInfo );
148 
150  void setCallback(MiniDmpSenderCallback fnCallback);
151 
153  void getMinidumpPath(__wchar_t * buffer, size_t len);
154 
156  LPVOID imp();
157 
158 private:
159  MiniDumper * m_pMiniDumper;
160 };
161 
162 
163 // ***************************
164 // Definitions for the dwFlags parameter of MiniDmpSender constructor and the getFlags/setFlags methods.
165 // The non-interactive flag is for applications that run unattended or without a user interface.
166 
168 #define MDSF_NONINTERACTIVE 0x0001
169 
172 #define MDSF_FORCEEXIT 0x0002
173 
178 #define MDSF_PREVENTHIJACKING 0x0004
179 
185 #define MDSF_DETECTHANGS 0x0008
186 
190 #define MDSF_USEGUARDMEMORY 0x0010
191 
196 #define MDSF_CUSTOMEXCEPTIONFILTER 0x0020
197 
203 #define MDSF_SUSPENDALLTHREADS 0x0800
204 
208 #define MDSF_LOGCONSOLE 0x1000
209 #define MDSF_LOGFILE 0x2000
210 #define MDSF_LOG_VERBOSE 0x4000
211 
213 
218 #define MDSCB_EXCEPTIONCODE 0x0050
219 
223 //#define MDSCB_GETADDITIONALFILECOUNT 0x0100 // obsolete: please use sendAdditionalFile() instead
224 #endif //~BUGSPLAT_H
void createReportAndExit()
Use to send a report and exit.
Definition: BugSplat.h:144
Definition: mdump - Copy.h:260
The MiniDmpSender class is used to add BugSplat crash reporting to your app.
Definition: BugSplat.h:44