-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdump_helper.h
54 lines (44 loc) · 2.01 KB
/
mdump_helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
///////////////////////////////////////////////////////////////////////////////////////////////////
// Filename: mdump_helper.h
// Author: Joseph Malmsten
// Purpose: plugs into most programs easily to provide post mortem crash debugging information.
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef DBGHELP391
#define DBGHELP391
//windows includes
#include <windows.h>
//debug include and library, if you do not have it you can download it from this link
//http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx
#include <dbghelp.h>
#pragma comment(lib, "dbghelp.lib")
//needed for creating the filename of the minidumps
#include <string>
//a class containing the information needed to create the minidumps from inside a thread
class debug_info{
public:
debug_info();
//a handle to the process being tested and a corresponding ID
HANDLE hProcess;
DWORD ProcessId;
//a handle to the file being written in
HANDLE hFile;
//the type of dump to be used in the program, easy to switch
MINIDUMP_TYPE DumpType;
//the parameters of the exception
MINIDUMP_EXCEPTION_INFORMATION ExceptionParam;
//a handle to the thread writing the dump
DWORD threadHandle;
///////////////////////////////////////////////////////////////////////////////////////////////
// Function: minidump_setup
// Purpose: sets up and creates the minidump thread
// Params: pException - the pointer to the exception
///////////////////////////////////////////////////////////////////////////////////////////////
LONG WINAPI minidump_setup(EXCEPTION_POINTERS* pException);
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// Function: Thread_It
// Purpose: Thread function that creates the minidump
// Params: lpParam - the void pointer to the information needed to write the minidump
///////////////////////////////////////////////////////////////////////////////////////////////////
DWORD WINAPI Thread_It(LPVOID lpParam);
#endif