ReactOS  0.4.12-dev-57-g7050ac4
drwtsn32.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ModuleData
 
struct  ThreadData
 
class  DumpData
 

Macros

#define NEWLINE   "\r\n"
 

Typedefs

typedef std::vector< ModuleDataModuleList
 
typedef std::map< DWORD, ThreadDataThreadMap
 

Functions

void xfprintf (FILE *stream, const char *fmt,...)
 
bool UpdateFromEvent (DEBUG_EVENT &evt, DumpData &data)
 
void PrintSystemInfo (FILE *output, DumpData &data)
 
void BeginStackBacktrace (DumpData &data)
 
void PrintStackBacktrace (FILE *output, DumpData &data, ThreadData &thread)
 
void EndStackBacktrace (DumpData &data)
 

Macro Definition Documentation

◆ NEWLINE

#define NEWLINE   "\r\n"

Definition at line 53 of file drwtsn32.h.

Referenced by PrintBugreport(), PrintStackBacktrace(), PrintSystemInfo(), and PrintThread().

Typedef Documentation

◆ ModuleList

typedef std::vector<ModuleData> ModuleList

Definition at line 33 of file drwtsn32.h.

◆ ThreadMap

Definition at line 34 of file drwtsn32.h.

Function Documentation

◆ BeginStackBacktrace()

void BeginStackBacktrace ( DumpData data)

Definition at line 14 of file stacktrace.cpp.

Referenced by PrintBugreport().

15 {
16  DWORD symOptions = SymGetOptions();
18  SymSetOptions(symOptions);
20 }
#define TRUE
Definition: types.h:120
DWORD WINAPI SymSetOptions(DWORD opts)
Definition: dbghelp.c:443
#define SYMOPT_AUTO_PUBLICS
Definition: compat.h:643
#define SYMOPT_DEFERRED_LOADS
Definition: compat.h:638
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SymInitialize(HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess)
Definition: dbghelp.c:393
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SYMOPT_UNDNAME
Definition: compat.h:637
DWORD WINAPI SymGetOptions(void)
Definition: dbghelp.c:458
HANDLE ProcessHandle
Definition: drwtsn32.h:43

◆ EndStackBacktrace()

void EndStackBacktrace ( DumpData data)

Definition at line 22 of file stacktrace.cpp.

Referenced by PrintBugreport().

23 {
25 }
BOOL WINAPI SymCleanup(HANDLE hProcess)
Definition: dbghelp.c:416
HANDLE ProcessHandle
Definition: drwtsn32.h:43

◆ PrintStackBacktrace()

void PrintStackBacktrace ( FILE output,
DumpData data,
ThreadData thread 
)

Definition at line 36 of file stacktrace.cpp.

Referenced by PrintThread().

37 {
38  DWORD MachineType;
39  STACKFRAME64 StackFrame = { { 0 } };
40 
41 #ifdef _M_X64
42  MachineType = IMAGE_FILE_MACHINE_AMD64;
43  StackFrame.AddrPC.Offset = thread.Context.Rip;
44  StackFrame.AddrPC.Mode = AddrModeFlat;
45  StackFrame.AddrStack.Offset = thread.Context.Rsp;
46  StackFrame.AddrStack.Mode = AddrModeFlat;
47  StackFrame.AddrFrame.Offset = thread.Context.Rbp;
48  StackFrame.AddrFrame.Mode = AddrModeFlat;
49 #else
50  MachineType = IMAGE_FILE_MACHINE_I386;
51  StackFrame.AddrPC.Offset = thread.Context.Eip;
52  StackFrame.AddrPC.Mode = AddrModeFlat;
53  StackFrame.AddrStack.Offset = thread.Context.Esp;
54  StackFrame.AddrStack.Mode = AddrModeFlat;
55  StackFrame.AddrFrame.Offset = thread.Context.Ebp;
56  StackFrame.AddrFrame.Mode = AddrModeFlat;
57 #endif
58 
59 
60 #define STACKWALK_MAX_NAMELEN 512
61  char buf[sizeof(SYMBOL_INFO) + STACKWALK_MAX_NAMELEN] = {0};
62  SYMBOL_INFO* sym = (SYMBOL_INFO *)buf;
63  IMAGEHLP_MODULE64 Module = { 0 };
64  LONG RecursionDepth = 0;
65  sym->SizeOfStruct = sizeof(sym);
66 
67  /* FIXME: dump x bytes at EIP here + disasm it! */
68 
69  xfprintf(output, NEWLINE "*----> Stack Back Trace <----*" NEWLINE NEWLINE);
70  bool first = true;
71  while (StackWalk64(MachineType, data.ProcessHandle, thread.Handle, &StackFrame, &thread.Context,
73  {
74  if (StackFrame.AddrPC.Offset == StackFrame.AddrReturn.Offset)
75  {
76  if (RecursionDepth++ > STACK_MAX_RECURSION_DEPTH)
77  {
78  xfprintf(output, "- Aborting stackwalk -" NEWLINE);
79  break;
80  }
81  }
82  else
83  {
84  RecursionDepth = 0;
85  }
86 
87  if (first)
88  {
89  xfprintf(output, "FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name" NEWLINE);
90  first = false;
91  }
92 
93  Module.SizeOfStruct = sizeof(Module);
94  DWORD64 ModBase = SymGetModuleBase64(data.ProcessHandle, StackFrame.AddrPC.Offset);
95  if (!ModBase || !SymGetModuleInfo64(data.ProcessHandle, ModBase, &Module))
96  strcpy(Module.ModuleName, "<nomod>");
97 
98  memset(sym, '\0', sizeof(*sym) + STACKWALK_MAX_NAMELEN);
99  sym->SizeOfStruct = sizeof(*sym);
101  DWORD64 displacement = 0;
102 
103  if (!StackFrame.AddrPC.Offset || !SymFromAddr(data.ProcessHandle, StackFrame.AddrPC.Offset, &displacement, sym))
104  strcpy(sym->Name, "<nosymbols>");
105 
106  xfprintf(output, "%p %p %p %p %p %p %s!%s +0x%I64x" NEWLINE,
107  (ULONG_PTR)StackFrame.AddrFrame.Offset, (ULONG_PTR)StackFrame.AddrPC.Offset,
108  (ULONG_PTR)StackFrame.Params[0], (ULONG_PTR)StackFrame.Params[1],
109  (ULONG_PTR)StackFrame.Params[2], (ULONG_PTR)StackFrame.Params[3],
110  Module.ModuleName, sym->Name, displacement);
111  }
112 
113  UCHAR stackData[0x10 * 10];
114  SIZE_T sizeRead;
115 #if defined(_M_IX86)
116  ULONG_PTR stackPointer = thread.Context.Esp;
117 #elif defined(_M_AMD64)
118  ULONG_PTR stackPointer = thread.Context.Rsp;
119 #else
120 #error Unknown architecture
121 #endif
122  if (!ReadProcessMemory(data.ProcessHandle, (PVOID)stackPointer, stackData, sizeof(stackData), &sizeRead))
123  return;
124 
125  xfprintf(output, NEWLINE "*----> Raw Stack Dump <----*" NEWLINE NEWLINE);
126  for (size_t n = 0; n < sizeof(stackData); n += 0x10)
127  {
128  char HexData1[] = "?? ?? ?? ?? ?? ?? ?? ??";
129  char HexData2[] = "?? ?? ?? ?? ?? ?? ?? ??";
130  char AsciiData1[] = "????????";
131  char AsciiData2[] = "????????";
132 
133  for (size_t j = 0; j < 8; ++j)
134  {
135  size_t idx = j + n;
136  if (idx < sizeRead)
137  {
138  HexData1[j * 3] = ToChar(stackData[idx] >> 4);
139  HexData1[j * 3 + 1] = ToChar(stackData[idx] & 0xf);
140  AsciiData1[j] = isprint(stackData[idx]) ? stackData[idx] : '.';
141  }
142  idx += 8;
143  if (idx < sizeRead)
144  {
145  HexData2[j * 3] = ToChar(stackData[idx] >> 4);
146  HexData2[j * 3 + 1] = ToChar(stackData[idx] & 0xf);
147  AsciiData2[j] = isprint(stackData[idx]) ? stackData[idx] : '.';
148  }
149  }
150 
151  xfprintf(output, "%p %s - %s %s%s" NEWLINE, stackPointer+n, HexData1, HexData2, AsciiData1, AsciiData2);
152  }
153 }
CHAR Name[1]
Definition: compat.h:694
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
ULONG Esp
Definition: nt_native.h:1479
void xfprintf(FILE *stream, const char *fmt,...)
Definition: main.cpp:34
ULONG MaxNameLen
Definition: compat.h:693
ULONG Eip
Definition: nt_native.h:1476
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const GLint * first
Definition: glext.h:5794
CHAR ModuleName[32]
Definition: compat.h:879
PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64)
Definition: module.c:1169
BOOL WINAPI StackWalk64(DWORD MachineType, HANDLE hProcess, HANDLE hThread, LPSTACKFRAME64 frame, PVOID ctx, PREAD_PROCESS_MEMORY_ROUTINE64 f_read_mem, PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, PTRANSLATE_ADDRESS_ROUTINE64 f_xlat_adr)
Definition: stack.c:210
DWORD64 Params[4]
Definition: compat.h:1041
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:415
#define IMAGE_FILE_MACHINE_AMD64
Definition: ntimage.h:17
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLuint n
Definition: s_context.h:57
long LONG
Definition: pedump.c:60
unsigned int idx
Definition: utils.c:41
CONTEXT Context
Definition: drwtsn32.h:26
smooth NULL
Definition: ftsmooth.c:416
DWORD SizeOfStruct
Definition: compat.h:872
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
HANDLE Handle
Definition: drwtsn32.h:25
DWORD64 Offset
Definition: compat.h:808
struct _SYMBOL_INFO SYMBOL_INFO
ADDRESS64 AddrReturn
Definition: compat.h:1036
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STACK_MAX_RECURSION_DEPTH
Definition: stacktrace.cpp:11
unsigned char UCHAR
Definition: xmlstorage.h:181
ADDRESS64 AddrStack
Definition: compat.h:1038
DWORD64 WINAPI SymGetModuleBase64(HANDLE, DWORD64)
Definition: module.c:1107
ULONG SizeOfStruct
Definition: compat.h:680
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1242
ULONG_PTR SIZE_T
Definition: typedefs.h:78
uint64_t DWORD64
Definition: typedefs.h:65
#define STACKWALK_MAX_NAMELEN
ADDRESS64 AddrPC
Definition: compat.h:1035
#define isprint(c)
Definition: acclib.h:73
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define NEWLINE
Definition: drwtsn32.h:53
#define memset(x, y, z)
Definition: compat.h:39
ADDRESS_MODE Mode
Definition: compat.h:810
HANDLE ProcessHandle
Definition: drwtsn32.h:43
ULONG Ebp
Definition: nt_native.h:1475
BOOL WINAPI SymGetModuleInfo64(HANDLE hProcess, DWORD64 dwAddr, PIMAGEHLP_MODULE64 ModuleInfo)
Definition: module.c:1013
ADDRESS64 AddrFrame
Definition: compat.h:1037
static char ToChar(UCHAR data)
Definition: stacktrace.cpp:27

◆ PrintSystemInfo()

void PrintSystemInfo ( FILE output,
DumpData data 
)

Definition at line 52 of file sysinfo.cpp.

Referenced by PrintBugreport().

53 {
54  SYSTEMTIME LocalTime;
55  GetLocalTime(&LocalTime);
56  xfprintf(output, NEWLINE "ReactOS " KERNEL_VERSION_STR " DrWtsn32" NEWLINE NEWLINE);
57  xfprintf(output, "Application exception occurred:" NEWLINE);
58  xfprintf(output, " App: %ls (pid=%d, tid=0x%x)" NEWLINE, data.ProcessName.c_str(), data.ProcessID, data.ThreadID);
59  xfprintf(output, " When: %d/%d/%d @ %02d:%02d:%02d.%d" NEWLINE,
60  LocalTime.wDay, LocalTime.wMonth, LocalTime.wYear,
61  LocalTime.wHour, LocalTime.wMinute, LocalTime.wSecond, LocalTime.wMilliseconds);
63  xfprintf(output, " Exception number: 0x%8x (%s)" NEWLINE, ExceptionCode, Exception2Str(ExceptionCode));
64 
65  char Buffer[MAX_PATH];
66  DWORD count = sizeof(Buffer);
67  xfprintf(output, NEWLINE "*----> System Information <----*" NEWLINE NEWLINE);
68  if (GetComputerNameA(Buffer, &count))
69  xfprintf(output, " Computer Name: %s" NEWLINE, Buffer);
70  count = sizeof(Buffer);
71  if (GetUserNameA(Buffer, &count))
72  xfprintf(output, " User Name: %s" NEWLINE, Buffer);
73 
74 
75  PVOID SMBiosBuf;
76  PCHAR DmiStrings[ID_STRINGS_MAX] = { 0 };
77  SMBiosBuf = LoadSMBiosData(DmiStrings);
78  if (SMBiosBuf)
79  {
80  if (DmiStrings[BIOS_VENDOR])
81  xfprintf(output, " BIOS Vendor: %s" NEWLINE, DmiStrings[BIOS_VENDOR]);
82  if (DmiStrings[BIOS_VERSION])
83  xfprintf(output, " BIOS Version: %s" NEWLINE, DmiStrings[BIOS_VERSION]);
84  if (DmiStrings[BIOS_DATE])
85  xfprintf(output, " BIOS Date: %s" NEWLINE, DmiStrings[BIOS_DATE]);
86  if (DmiStrings[SYS_VENDOR])
87  xfprintf(output, " System Manufacturer: %s" NEWLINE, DmiStrings[SYS_VENDOR]);
88  if (DmiStrings[SYS_FAMILY])
89  xfprintf(output, " System Family: %s" NEWLINE, DmiStrings[SYS_FAMILY]);
90  if (DmiStrings[SYS_PRODUCT])
91  xfprintf(output, " System Model: %s" NEWLINE, DmiStrings[SYS_PRODUCT]);
92  if (DmiStrings[SYS_VERSION])
93  xfprintf(output, " System Version: %s" NEWLINE, DmiStrings[SYS_VERSION]);
94  if (DmiStrings[SYS_SKU])
95  xfprintf(output, " System SKU: %s" NEWLINE, DmiStrings[SYS_SKU]);
96  if (DmiStrings[BOARD_VENDOR])
97  xfprintf(output, " Baseboard Manufacturer: %s" NEWLINE, DmiStrings[BOARD_VENDOR]);
98  if (DmiStrings[BOARD_NAME])
99  xfprintf(output, " Baseboard Model: %s" NEWLINE, DmiStrings[BOARD_NAME]);
100  if (DmiStrings[BOARD_VERSION])
101  xfprintf(output, " Baseboard Version: %s" NEWLINE, DmiStrings[BOARD_VERSION]);
102  FreeSMBiosData(SMBiosBuf);
103  }
104 
106  GetSystemInfo(&info);
107  xfprintf(output, " Number of Processors: %d" NEWLINE, info.dwNumberOfProcessors);
108 
109  HKEY hKey;
110  LONG ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
111  0, KEY_READ, &hKey);
112  if (ret == ERROR_SUCCESS)
113  {
114  DWORD dwType;
115  count = sizeof(Buffer);
116  ret = RegQueryValueExA(hKey, "Identifier", NULL, &dwType, (LPBYTE)Buffer, &count);
117  if (ret == ERROR_SUCCESS && dwType == REG_SZ)
118  {
119  Buffer[count] = '\0';
120  xfprintf(output, " Processor Type: %s" NEWLINE, Buffer);
121  }
122  RegCloseKey(hKey);
123  }
124 
125  ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hKey);
126  if (ret == ERROR_SUCCESS)
127  {
128  char Version[50];
129  ReadKey(hKey, "ProductName", Buffer, sizeof(Buffer));
130  ReadKey(hKey, "CurrentVersion", Version, sizeof(Version));
131  xfprintf(output, " %s Version: %s" NEWLINE, Buffer, Version);
132  ReadKey(hKey, "BuildLab", Buffer, sizeof(Buffer));
133  xfprintf(output, " BuildLab: %s" NEWLINE, Buffer);
134  ReadKey(hKey, "CSDVersion", Buffer, sizeof(Buffer));
135  if (Buffer[0])
136  xfprintf(output, " Service Pack: %s" NEWLINE, Buffer);
137  ReadKey(hKey, "CurrentType", Buffer, sizeof(Buffer));
138  xfprintf(output, " Current Type: %s" NEWLINE, Buffer);
139  ReadKey(hKey, "RegisteredOrganization", Buffer, sizeof(Buffer));
140  xfprintf(output, " Registered Organization: %s" NEWLINE, Buffer);
141  ReadKey(hKey, "RegisteredOwner", Buffer, sizeof(Buffer));
142  xfprintf(output, " Registered Owner: %s" NEWLINE, Buffer);
143 
144  RegCloseKey(hKey);
145  }
146 }
signed char * PCHAR
Definition: retypes.h:7
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1782
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4041
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
Definition: dmilib.h:22
void xfprintf(FILE *stream, const char *fmt,...)
Definition: main.cpp:34
#define ERROR_SUCCESS
Definition: deptool.c:10
std::wstring ProcessName
Definition: drwtsn32.h:40
WORD wMonth
Definition: winbase.h:871
#define KEY_READ
Definition: nt_native.h:1023
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3346
BOOL WINAPI GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:322
struct _test_info info[]
Definition: SetCursorPos.c:19
DWORD ExceptionCode
Definition: compat.h:196
WORD wYear
Definition: winbase.h:870
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static void ReadKey(HKEY hKey, const char *ValueName, char *Buffer, DWORD size)
Definition: sysinfo.cpp:44
long LONG
Definition: pedump.c:60
WORD wMinute
Definition: winbase.h:875
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
DWORD ThreadID
Definition: drwtsn32.h:42
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD ProcessID
Definition: drwtsn32.h:41
WORD wSecond
Definition: winbase.h:876
WORD wMilliseconds
Definition: winbase.h:877
static const char * Exception2Str(DWORD code)
Definition: sysinfo.cpp:13
int ret
EXCEPTION_RECORD ExceptionRecord
Definition: winbase.h:729
BOOL WINAPI GetUserNameA(LPSTR lpszName, LPDWORD lpSize)
Definition: misc.c:246
WORD wDay
Definition: winbase.h:873
VOID FreeSMBiosData(_In_ PVOID Buffer)
Definition: udmihelp.c:177
WORD wHour
Definition: winbase.h:874
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
DWORD dwNumberOfProcessors
Definition: winbase.h:1130
PVOID LoadSMBiosData(_Inout_updates_(ID_STRINGS_MAX) PCHAR *Strings)
Definition: udmihelp.c:30
#define NEWLINE
Definition: drwtsn32.h:53
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
EXCEPTION_DEBUG_INFO ExceptionInfo
Definition: drwtsn32.h:46

◆ UpdateFromEvent()

bool UpdateFromEvent ( DEBUG_EVENT evt,
DumpData data 
)

Definition at line 56 of file drwtsn32.cpp.

Referenced by wWinMain().

57 {
58  switch(evt.dwDebugEventCode)
59  {
61  {
62  data.ProcessPath.resize(MAX_PATH*2);
64  if (len)
65  {
66  data.ProcessPath.resize(len);
67  std::string::size_type pos = data.ProcessPath.find_last_of(L"\\/");
68  if (pos != std::string::npos)
69  data.ProcessName = data.ProcessPath.substr(pos+1);
70  }
71  else
72  {
73  data.ProcessPath = L"??";
74  }
75  if (data.ProcessName.empty())
76  data.ProcessName = data.ProcessPath;
77 
79  data.ProcessID = evt.dwProcessId;
82  }
83  break;
86  break;
88  {
89  ThreadMap::iterator it = data.Threads.find(evt.dwThreadId);
90  if (it != data.Threads.end())
91  {
92  data.Threads.erase(it);
93  }
94  }
95  break;
98  for (size_t n = 0; n < data.Modules.size(); ++n)
99  {
100  if (data.Modules[n].BaseAddress == evt.u.LoadDll.lpBaseOfDll)
101  {
102  data.Modules[n].Unloaded = false;
103  return true;
104  }
105  }
106  data.Modules.push_back(ModuleData(evt.u.LoadDll.lpBaseOfDll));
107  break;
109  for (size_t n = 0; n < data.Modules.size(); ++n)
110  {
111  if (data.Modules[n].BaseAddress == evt.u.UnloadDll.lpBaseOfDll)
112  data.Modules[n].Unloaded = true;
113  }
114  break;
115  case OUTPUT_DEBUG_STRING_EVENT: // ignore
116  break;
118  if (evt.u.Exception.dwFirstChance)
119  {
121  {
123  if (!data.FirstBPHit)
124  {
125  data.FirstBPHit = true;
126 
127  if (data.Event)
128  {
129  SetEvent(data.Event);
130  CloseHandle(data.Event);
131  data.Event = NULL;
132  }
133  return true;
134  }
135  break;
137  /* Thread name */
138  return true;
139  case DBG_CONTROL_C:
140  case DBG_CONTROL_BREAK:
141  return true;
142  }
143  }
144  data.ExceptionInfo = evt.u.Exception;
145  data.ThreadID = evt.dwThreadId;
146  return false;
148  //assert(FALSE);
149  return false;
150  case RIP_EVENT:
151  //assert(FALSE);
152  return false;
153  default:
154  assert(false);
155  }
156  return true;
157 }
#define CloseHandle
Definition: compat.h:398
std::wstring ProcessName
Definition: drwtsn32.h:40
DWORD dwThreadId
Definition: winbase.h:768
union _DEBUG_EVENT::@3133 u
DWORD dwProcessId
Definition: winbase.h:767
static const size_t npos
Definition: _string_npos.h:26
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
#define LOAD_DLL_DEBUG_EVENT
Definition: winbase.h:107
UNLOAD_DLL_DEBUG_INFO UnloadDll
Definition: winbase.h:776
DWORD ExceptionCode
Definition: compat.h:196
GLuint n
Definition: s_context.h:57
CREATE_THREAD_DEBUG_INFO CreateThread
Definition: winbase.h:771
EXCEPTION_DEBUG_INFO Exception
Definition: winbase.h:770
bool FirstBPHit
Definition: drwtsn32.h:48
DWORD dwDebugEventCode
Definition: winbase.h:766
#define GetModuleFileNameExW(w, x, y, z)
Definition: compat.h:571
smooth NULL
Definition: ftsmooth.c:416
#define UNLOAD_DLL_DEBUG_EVENT
Definition: winbase.h:108
#define DBG_CONTROL_BREAK
Definition: ntstatus.h:55
CREATE_PROCESS_DEBUG_INFO CreateProcessInfo
Definition: winbase.h:772
DWORD ThreadID
Definition: drwtsn32.h:42
#define MS_VC_EXCEPTION_THREAD_NAME
Definition: drwtsn32.cpp:11
#define EXIT_PROCESS_DEBUG_EVENT
Definition: winbase.h:106
#define CREATE_THREAD_DEBUG_EVENT
Definition: winbase.h:103
std::wstring ProcessPath
Definition: drwtsn32.h:39
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EXCEPTION_BREAKPOINT
Definition: winbase.h:310
DWORD ProcessID
Definition: drwtsn32.h:41
#define DBG_CONTROL_C
Definition: ntstatus.h:52
ThreadMap Threads
Definition: drwtsn32.h:45
static const WCHAR L[]
Definition: oid.c:1087
EXCEPTION_RECORD ExceptionRecord
Definition: winbase.h:729
GLenum GLsizei len
Definition: glext.h:6722
#define EXCEPTION_DEBUG_EVENT
Definition: winbase.h:102
#define EXIT_THREAD_DEBUG_EVENT
Definition: winbase.h:105
ModuleList Modules
Definition: drwtsn32.h:44
#define OUTPUT_DEBUG_STRING_EVENT
Definition: winbase.h:109
#define CREATE_PROCESS_DEBUG_EVENT
Definition: winbase.h:104
HANDLE ProcessHandle
Definition: drwtsn32.h:43
#define RIP_EVENT
Definition: winbase.h:110
LOAD_DLL_DEBUG_INFO LoadDll
Definition: winbase.h:775
HANDLE Event
Definition: drwtsn32.h:47
EXCEPTION_DEBUG_INFO ExceptionInfo
Definition: drwtsn32.h:46

◆ xfprintf()

void xfprintf ( FILE stream,
const char fmt,
  ... 
)

Definition at line 34 of file main.cpp.

Referenced by PrintBugreport(), PrintStackBacktrace(), PrintSystemInfo(), PrintThread(), and wWinMain().

35 {
36  va_list ap;
37 
38  va_start(ap, fmt);
39  vfprintf(stream, fmt, ap);
41  va_end(ap);
42 }
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#define DPFLTR_ERROR_LEVEL
Definition: main.cpp:32
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
Definition: dsound.c:943