Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
WheatyExceptionReport.h
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#ifndef _WHEATYEXCEPTIONREPORT_
7
#define _WHEATYEXCEPTIONREPORT_
8
9
#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__)
10
11
#include <dbghelp.h>
12
13
#if _MSC_VER < 1400
14
# define countof(array) (sizeof(array) / sizeof(array[0]))
15
#else
16
# include <stdlib.h>
17
# define countof _countof
18
#endif
// _MSC_VER < 1400
19
20
enum
BasicType
// Stolen from CVCONST.H in the DIA 2.0 SDK
21
{
22
btNoType
= 0,
23
btVoid
= 1,
24
btChar
= 2,
25
btWChar
= 3,
26
btInt
= 6,
27
btUInt
= 7,
28
btFloat
= 8,
29
btBCD
= 9,
30
btBool
= 10,
31
btLong
= 13,
32
btULong
= 14,
33
btCurrency
= 25,
34
btDate
= 26,
35
btVariant
= 27,
36
btComplex
= 28,
37
btBit
= 29,
38
btBSTR
= 30,
39
btHresult
= 31
40
};
41
42
const
char
*
const
rgBaseType
[] =
43
{
44
" <user defined> "
,
// btNoType = 0,
45
" void "
,
// btVoid = 1,
46
" char* "
,
// btChar = 2,
47
" wchar_t* "
,
// btWChar = 3,
48
" signed char "
,
49
" unsigned char "
,
50
" int "
,
// btInt = 6,
51
" unsigned int "
,
// btUInt = 7,
52
" float "
,
// btFloat = 8,
53
" <BCD> "
,
// btBCD = 9,
54
" bool "
,
// btBool = 10,
55
" short "
,
56
" unsigned short "
,
57
" long "
,
// btLong = 13,
58
" unsigned long "
,
// btULong = 14,
59
" __int8 "
,
60
" __int16 "
,
61
" __int32 "
,
62
" __int64 "
,
63
" __int128 "
,
64
" unsigned __int8 "
,
65
" unsigned __int16 "
,
66
" unsigned __int32 "
,
67
" unsigned __int64 "
,
68
" unsigned __int128 "
,
69
" <currency> "
,
// btCurrency = 25,
70
" <date> "
,
// btDate = 26,
71
" VARIANT "
,
// btVariant = 27,
72
" <complex> "
,
// btComplex = 28,
73
" <bit> "
,
// btBit = 29,
74
" BSTR "
,
// btBSTR = 30,
75
" HRESULT "
// btHresult = 31
76
};
77
78
class
WheatyExceptionReport
79
{
80
public
:
81
82
WheatyExceptionReport
();
83
~WheatyExceptionReport
();
84
85
// entry point where control comes on an unhandled exception
86
static
LONG WINAPI
WheatyUnhandledExceptionFilter
(
87
PEXCEPTION_POINTERS pExceptionInfo);
88
89
static
void
printTracesForAllThreads
();
90
private
:
91
// where report info is extracted and generated
92
static
void
GenerateExceptionReport
(PEXCEPTION_POINTERS pExceptionInfo);
93
static
void
PrintSystemInfo
();
94
static
BOOL
_GetWindowsVersion
(TCHAR* szVersion, DWORD cntMax);
95
static
BOOL
_GetProcessorName
(TCHAR* sProcessorName, DWORD maxcount);
96
97
// Helper functions
98
static
LPTSTR
GetExceptionString
(DWORD dwCode);
99
static
BOOL
GetLogicalAddress
(PVOID addr, PTSTR szModule, DWORD len,
100
DWORD& section, DWORD_PTR& offset);
101
102
static
void
WriteStackDetails
(PCONTEXT pContext,
bool
bWriteVariables, HANDLE pThreadHandle);
103
104
static
BOOL CALLBACK
EnumerateSymbolsCallback
(PSYMBOL_INFO, ULONG, PVOID);
105
106
static
bool
FormatSymbolValue
(PSYMBOL_INFO, STACKFRAME*,
char
* pszBuffer,
unsigned
cbBuffer);
107
108
static
char
*
DumpTypeIndex
(
char
*, DWORD64, DWORD,
unsigned
, DWORD_PTR,
bool
&,
char
*);
109
110
static
char
*
FormatOutputValue
(
char
* pszCurrBuffer,
BasicType
basicType, DWORD64 length, PVOID pAddress);
111
112
static
BasicType
GetBasicType
(DWORD typeIndex, DWORD64 modBase);
113
114
static
int
__cdecl
_tprintf
(
const
TCHAR* format, ...);
115
116
// Variables used by the class
117
static
TCHAR
m_szLogFileName
[MAX_PATH];
118
static
TCHAR
m_szDumpFileName
[MAX_PATH];
119
static
LPTOP_LEVEL_EXCEPTION_FILTER
m_previousFilter
;
120
static
HANDLE
m_hReportFile
;
121
static
HANDLE
m_hDumpFile
;
122
static
HANDLE
m_hProcess
;
123
};
124
125
extern
WheatyExceptionReport
g_WheatyExceptionReport
;
// global instance of class
126
#endif
// _WIN32
127
#endif
// _WHEATYEXCEPTIONREPORT_
g_WheatyExceptionReport
WheatyExceptionReport g_WheatyExceptionReport
BasicType
BasicType
Definition
WheatyExceptionReport.h:21
btVoid
@ btVoid
Definition
WheatyExceptionReport.h:23
btVariant
@ btVariant
Definition
WheatyExceptionReport.h:35
btBCD
@ btBCD
Definition
WheatyExceptionReport.h:29
btBSTR
@ btBSTR
Definition
WheatyExceptionReport.h:38
btUInt
@ btUInt
Definition
WheatyExceptionReport.h:27
btULong
@ btULong
Definition
WheatyExceptionReport.h:32
btLong
@ btLong
Definition
WheatyExceptionReport.h:31
btChar
@ btChar
Definition
WheatyExceptionReport.h:24
btBit
@ btBit
Definition
WheatyExceptionReport.h:37
btNoType
@ btNoType
Definition
WheatyExceptionReport.h:22
btDate
@ btDate
Definition
WheatyExceptionReport.h:34
btComplex
@ btComplex
Definition
WheatyExceptionReport.h:36
btBool
@ btBool
Definition
WheatyExceptionReport.h:30
btInt
@ btInt
Definition
WheatyExceptionReport.h:26
btCurrency
@ btCurrency
Definition
WheatyExceptionReport.h:33
btHresult
@ btHresult
Definition
WheatyExceptionReport.h:39
btWChar
@ btWChar
Definition
WheatyExceptionReport.h:25
btFloat
@ btFloat
Definition
WheatyExceptionReport.h:28
rgBaseType
const char *const rgBaseType[]
Definition
WheatyExceptionReport.h:42
WheatyExceptionReport
Definition
WheatyExceptionReport.h:79
WheatyExceptionReport::WriteStackDetails
static void WriteStackDetails(PCONTEXT pContext, bool bWriteVariables, HANDLE pThreadHandle)
WheatyExceptionReport::m_szLogFileName
static TCHAR m_szLogFileName[MAX_PATH]
Definition
WheatyExceptionReport.h:117
WheatyExceptionReport::m_hReportFile
static HANDLE m_hReportFile
Definition
WheatyExceptionReport.h:120
WheatyExceptionReport::GetBasicType
static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase)
WheatyExceptionReport::_tprintf
static int __cdecl _tprintf(const TCHAR *format,...)
WheatyExceptionReport::GetLogicalAddress
static BOOL GetLogicalAddress(PVOID addr, PTSTR szModule, DWORD len, DWORD §ion, DWORD_PTR &offset)
WheatyExceptionReport::PrintSystemInfo
static void PrintSystemInfo()
WheatyExceptionReport::EnumerateSymbolsCallback
static BOOL CALLBACK EnumerateSymbolsCallback(PSYMBOL_INFO, ULONG, PVOID)
WheatyExceptionReport::~WheatyExceptionReport
~WheatyExceptionReport()
WheatyExceptionReport::m_szDumpFileName
static TCHAR m_szDumpFileName[MAX_PATH]
Definition
WheatyExceptionReport.h:118
WheatyExceptionReport::m_previousFilter
static LPTOP_LEVEL_EXCEPTION_FILTER m_previousFilter
Definition
WheatyExceptionReport.h:119
WheatyExceptionReport::_GetWindowsVersion
static BOOL _GetWindowsVersion(TCHAR *szVersion, DWORD cntMax)
WheatyExceptionReport::WheatyUnhandledExceptionFilter
static LONG WINAPI WheatyUnhandledExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
WheatyExceptionReport::GetExceptionString
static LPTSTR GetExceptionString(DWORD dwCode)
WheatyExceptionReport::GenerateExceptionReport
static void GenerateExceptionReport(PEXCEPTION_POINTERS pExceptionInfo)
WheatyExceptionReport::DumpTypeIndex
static char * DumpTypeIndex(char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool &, char *)
WheatyExceptionReport::m_hDumpFile
static HANDLE m_hDumpFile
Definition
WheatyExceptionReport.h:121
WheatyExceptionReport::m_hProcess
static HANDLE m_hProcess
Definition
WheatyExceptionReport.h:122
WheatyExceptionReport::WheatyExceptionReport
WheatyExceptionReport()
WheatyExceptionReport::FormatOutputValue
static char * FormatOutputValue(char *pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress)
WheatyExceptionReport::FormatSymbolValue
static bool FormatSymbolValue(PSYMBOL_INFO, STACKFRAME *, char *pszBuffer, unsigned cbBuffer)
WheatyExceptionReport::_GetProcessorName
static BOOL _GetProcessorName(TCHAR *sProcessorName, DWORD maxcount)
WheatyExceptionReport::printTracesForAllThreads
static void printTracesForAllThreads()
src
server
shared
Debugging
WheatyExceptionReport.h
Generated on
for Project SkyFire Core by
1.17.0