BugSplat Native Windows DLL  3.6.0.0
BugSplat API reference for native Windows applications.
BugSplatImp.h
1 
3 //
4 // BugSplatImp.h
5 //
6 // This header file contains interal BugSplat helpers
7 //
8 // Copyright 2003-2007, BugSplat LLC.
9 // All rights reserved.
10 //
12 
13 
14 #ifndef BUGSPLATIMP_H
15 #define BUGSPLATIMP_H
16 
17 #ifdef BUGSPLAT_EXPORTS
18  #define MDS_EXPORT __declspec(dllexport)
19 #else
20  #define MDS_EXPORT __declspec(dllimport)
21 #endif
22 
23 #include "dbghelp.h"
24 
25 #include "BugSplat.h"
26 
27 // based on dbghelp.h
28 typedef LONG (WINAPI *PVEH)(PEXCEPTION_POINTERS exceptionInfo);
29 typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
30  CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
31  CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
32  CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
33  );
34 typedef PVOID (WINAPI *ADDVECTOREDEXCPTIONHANDLER)(ULONG firstHandler, PVEH vectoredHandler);
35 typedef ULONG (WINAPI *REMOVEVECTOREDEXCEPTIONHANDLER)(PVOID VectoredHandlerHandle);
36 
37 
38 class MDS_EXPORT BugSplatImp
39 {
40 public:
41  BugSplatImp();
42 
43 public:
44  BOOL CreateMiniDump(HMODULE hDbgHelpDll,
45  DWORD dwThreadId,
46  HANDLE hProcess,
47  DWORD dwProcId,
48  struct _EXCEPTION_POINTERS * pExceptionInfo,
49  LPCTSTR szApp,
50  LPTSTR szFile, DWORD dwFileSize);
51 
52  void GetReducedGuid(TCHAR *szGuid, DWORD dwGuidSize);
53  void ReduceGuidString(TCHAR *szGuid, DWORD dwGuidSize);
54 
55  void SuspendAllThreadsInProcess(HANDLE hProcess);
56  void SuspendThreadsInCurrentProcess();
57  void ResumeSuspendedThreads();
58  static bool DoFullMemoryDumpThenExit;
59  static MiniDmpSender::BS_MINIDUMP_TYPE MiniDumpType;
60 
61 
62 private:
63  // note that Windows has a limit of 2000 threads per process
64  // http://blogs.msdn.com/oldnewthing/archive/2005/07/29/444912.aspx
65  DWORD mdwThreads[2048];
66  int mThreadCount;
67 };
68 
69 
70 #endif //~BUGSPLATIMP_H
Definition: BugSplatImp.h:38