1 /*
2  * PROJECT:     Dr. Watson crash reporter
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Project header
5  * COPYRIGHT:   Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #pragma once
9 
10 
11 struct ModuleData
12 {
13     std::string ModuleName;
14     void *BaseAddress;
15     DWORD Size;
16     bool Unloaded;
17 
18 
19     ModuleData(void* addr);
20     void Update(HANDLE hProcess);
21 };
22 
23 struct ThreadData
24 {
25     HANDLE Handle;
26     CONTEXT Context;
27 
28     ThreadData(HANDLE handle = NULL);
29 
30     void Update();
31 };
32 
33 typedef std::vector<ModuleData> ModuleList;
34 typedef std::map<DWORD, ThreadData> ThreadMap;
35 
36 class DumpData
37 {
38 public:
39     std::wstring ProcessPath;
40     std::wstring ProcessName;
41     DWORD ProcessID;
42     DWORD ThreadID;
43     HANDLE ProcessHandle;
44     ModuleList Modules;
45     ThreadMap Threads;
46     EXCEPTION_DEBUG_INFO ExceptionInfo;
47     HANDLE Event;
48     bool FirstBPHit;
49 
50     DumpData();
51 };
52 
53 #define NEWLINE "\r\n"
54 
55 /* main.cpp */
56 void xfprintf(FILE* stream, const char *fmt, ...);
57 
58 /* drwtsn32.cpp */
59 bool UpdateFromEvent(DEBUG_EVENT& evt, DumpData& data);
60 
61 /* sysinfo.cpp */
62 void PrintSystemInfo(FILE* output, DumpData& data);
63 
64 /* stacktrace.cpp */
65 void BeginStackBacktrace(DumpData& data);
66 void PrintStackBacktrace(FILE* output, DumpData& data, ThreadData& thread);
67 void EndStackBacktrace(DumpData& data);
68 
69