BugSplat Native Windows DLL  3.6.0.0
BugSplat API reference for native Windows applications.
bugsplat.h
Go to the documentation of this file.
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 more information, see the documentation at https://www.bugsplat.com/docs/sdk/cplusplus
10 //
11 // Copyright 2003-2017, BugSplat
12 // All rights reserved.
13 //
15 
20 
21 
22 #ifndef BUGSPLAT_H
23 #define BUGSPLAT_H
24 
25 #ifdef BUGSPLAT_EXPORTS
26  #define MDS_EXPORT __declspec(dllexport)
27 #else
28  #define MDS_EXPORT __declspec(dllimport)
29 #endif
30 
31 #include <Windows.h>
32 
36 typedef bool (__cdecl *MiniDmpSenderCallback)(UINT nCode, LPVOID lVal1, LPVOID lVal2);
37 
38 // forward declare internal class
39 class MiniDumper;
40 
43 {
44 public:
50  MiniDmpSender(__wchar_t const *szDatabase,
51  __wchar_t const *szApp,
52  __wchar_t const *szVersion,
53  __wchar_t const *szAppIdentifier = NULL,
54  DWORD dwFlags = 0x04 /* MDSF_PREVENTHIJACKING */
55  );
56  virtual ~MiniDmpSender();
57 public:
60  bool enableExceptionFilter(bool enable = true);
61 
63  bool isExceptionFilterEnabled() const;
64 
65  // the following typedef is identical to MINIDUMP_TYPE; copied here for convenience
66  typedef enum _BS_MINIDUMP_TYPE {
67  MiniDumpNormal = 0x00000000,
68  MiniDumpWithDataSegs = 0x00000001,
69  MiniDumpWithFullMemory = 0x00000002,
70  MiniDumpWithHandleData = 0x00000004,
71  MiniDumpFilterMemory = 0x00000008,
72  MiniDumpScanMemory = 0x00000010,
73  MiniDumpWithUnloadedModules = 0x00000020,
74  MiniDumpWithIndirectlyReferencedMemory = 0x00000040,
75  MiniDumpFilterModulePaths = 0x00000080,
76  MiniDumpWithProcessThreadData = 0x00000100,
77  MiniDumpWithPrivateReadWriteMemory = 0x00000200,
78  MiniDumpWithoutOptionalData = 0x00000400,
79  MiniDumpWithFullMemoryInfo = 0x00000800,
80  MiniDumpWithThreadInfo = 0x00001000,
81  MiniDumpWithCodeSegs = 0x00002000,
82  MiniDumpWithoutAuxiliaryState = 0x00004000,
83  MiniDumpWithFullAuxiliaryState = 0x00008000,
84  MiniDumpWithPrivateWriteCopyMemory = 0x00010000,
85  MiniDumpIgnoreInaccessibleMemory = 0x00020000,
86  MiniDumpWithTokenInformation = 0x00040000,
87  MiniDumpWithModuleHeaders = 0x00080000,
88  MiniDumpFilterTriage = 0x00100000,
89  MiniDumpWithAvxXStateContext = 0x00200000,
90  MiniDumpValidTypeFlags = 0x003fffff,
92 
94  MiniDmpSender::BS_MINIDUMP_TYPE getMiniDumpType() const;
95 
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(EXCEPTION_POINTERS * pExcepInfo);
141  void createReport(const __wchar_t * wszStackTracePath);
143  inline void createReportAndExit() { setFlags(getFlags() | 0x02/*MDSF_FORCEEXIT*/); throw NULL; }
144 
146  LONG unhandledExceptionHandler( PEXCEPTION_POINTERS pExceptionInfo );
147 
149  void setCallback(MiniDmpSenderCallback fnCallback);
150 
152  void getMinidumpPath(__wchar_t * buffer, size_t len);
153 
155  LPVOID imp();
156 
157 private:
158  MiniDumper * m_pMiniDumper;
159 };
160 
161 
162 // ***************************
163 // Definitions for the dwFlags parameter of MiniDmpSender constructor and the getFlags/setFlags methods.
164 // The non-interactive flag is for applications that run unattended or without a user interface.
165 
167 #define MDSF_NONINTERACTIVE 0x0001
168 
171 #define MDSF_FORCEEXIT 0x0002
172 
177 #define MDSF_PREVENTHIJACKING 0x0004
178 
184 #define MDSF_DETECTHANGS 0x0008
185 
189 #define MDSF_USEGUARDMEMORY 0x0010
190 
195 #define MDSF_CUSTOMEXCEPTIONFILTER 0x0020
196 
202 #define MDSF_SUSPENDALLTHREADS 0x0800
203 
207 #define MDSF_LOGCONSOLE 0x1000
208 #define MDSF_LOGFILE 0x2000
209 #define MDSF_LOG_VERBOSE 0x4000
210 
212 
216 #define MDSCB_EXCEPTIONCODE 0x0050
217 
221 //#define MDSCB_GETADDITIONALFILECOUNT 0x0100 // obsolete: please use sendAdditionalFile() instead
222 #endif //~BUGSPLAT_H
void createReportAndExit()
Use to send a report and exit.
Definition: bugsplat.h:143
bool(__cdecl * MiniDmpSenderCallback)(UINT nCode, LPVOID lVal1, LPVOID lVal2)
Definition: bugsplat.h:36
_BS_MINIDUMP_TYPE
Definition: bugsplat.h:66
#define MDS_EXPORT
Definition: bugsplat.h:28
enum MiniDmpSender::_BS_MINIDUMP_TYPE BS_MINIDUMP_TYPE
The MiniDmpSender class is used to add BugSplat crash reporting to your app.
Definition: bugsplat.h:42