ReactOS 0.4.16-dev-336-gb667d82
main.cpp File Reference
#include "precomp.h"
#include <winuser.h>
#include <algorithm>
#include <shlobj.h>
#include <shlwapi.h>
#include <tchar.h>
#include <strsafe.h>
#include <tlhelp32.h>
#include <dbghelp.h>
#include <conio.h>
#include <atlbase.h>
#include <atlstr.h>
#include "resource.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Macros

#define DPFLTR_ERROR_LEVEL   0
 

Functions

NTSYSAPI ULONG NTAPI vDbgPrintEx (_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
 
void xfprintf (FILE *stream, const char *fmt,...)
 
static bool SortModules (const ModuleData &left, const ModuleData &right)
 
static void PrintThread (FILE *output, DumpData &data, DWORD tid, ThreadData &thread)
 
void PrintBugreport (FILE *output, DumpData &data)
 
int abort (FILE *output, int err)
 
std::wstring Settings_GetOutputPath (void)
 
BOOL Settings_GetShouldWriteDump (void)
 
HRESULT WriteMinidump (LPCWSTR LogFilePath, DumpData &data)
 
int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE, LPWSTR cmdLine, INT)
 

Variables

static const char szUsage []
 

Macro Definition Documentation

◆ DPFLTR_ERROR_LEVEL

#define DPFLTR_ERROR_LEVEL   0

Definition at line 32 of file main.cpp.

Function Documentation

◆ abort()

int abort ( FILE output,
int  err 
)

Definition at line 177 of file main.cpp.

178{
179 if (output != stdout)
180 fclose(output);
181 else
182 _getch();
183
184 return err;
185}
#define stdout
Definition: stdio.h:99
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define err(...)
int _getch()
Definition: getch.c:16

◆ PrintBugreport()

void PrintBugreport ( FILE output,
DumpData data 
)

Definition at line 118 of file main.cpp.

119{
120 PrintSystemInfo(output, data);
121 xfprintf(output, NEWLINE "*----> Task List <----*" NEWLINE NEWLINE);
123 if (hSnap != INVALID_HANDLE_VALUE)
124 {
126 pe.dwSize = sizeof(pe);
127 if (Process32First(hSnap, &pe))
128 {
129 do
130 {
131 xfprintf(output, "%5d: %ls" NEWLINE, pe.th32ProcessID, pe.szExeFile);
132 } while (Process32Next(hSnap, &pe));
133 }
134 CloseHandle(hSnap);
135 }
136
137 xfprintf(output, NEWLINE "*----> Module List <----*" NEWLINE NEWLINE);
138 std::sort(data.Modules.begin(), data.Modules.end(), SortModules);
139
140 ModuleData mainModule(NULL);
141 mainModule.Update(data.ProcessHandle);
142 xfprintf(output, "(%p - %p) %ls" NEWLINE,
143 mainModule.BaseAddress,
144 (PBYTE)mainModule.BaseAddress + mainModule.Size,
145 data.ProcessPath.c_str());
146
147 for (size_t n = 0; n < data.Modules.size(); ++n)
148 {
149 ModuleData& mod = data.Modules[n];
150 if (!mod.Unloaded)
151 {
152 mod.Update(data.ProcessHandle);
153 xfprintf(output, "(%p - %p) %s" NEWLINE,
154 mod.BaseAddress,
155 (PBYTE)mod.BaseAddress + mod.Size,
156 mod.ModuleName.c_str());
157 }
158 }
159
161
162 // First print the thread that crashed
163 ThreadMap::iterator crash = data.Threads.find(data.ThreadID);
164 if (crash != data.Threads.end())
165 PrintThread(output, data, crash->first, crash->second);
166
167 // Print the other threads
168 for (ThreadMap::iterator it = data.Threads.begin(); it != data.Threads.end(); ++it)
169 {
170 if (it->first != data.ThreadID)
171 PrintThread(output, data, it->first, it->second);
172 }
174}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:66
static void PrintThread(FILE *output, DumpData &data, DWORD tid, ThreadData &thread)
Definition: main.cpp:51
void xfprintf(FILE *stream, const char *fmt,...)
Definition: main.cpp:34
static bool SortModules(const ModuleData &left, const ModuleData &right)
Definition: main.cpp:46
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
Definition: toolhelp.c:951
BOOL WINAPI Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
Definition: toolhelp.c:1040
HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID)
Definition: toolhelp.c:1255
void BeginStackBacktrace(DumpData &data)
Definition: stacktrace.cpp:14
#define NEWLINE
Definition: drwtsn32.h:53
void PrintSystemInfo(FILE *output, DumpData &data)
Definition: sysinfo.cpp:56
void EndStackBacktrace(DumpData &data)
Definition: stacktrace.cpp:22
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble n
Definition: glext.h:7729
BYTE * PBYTE
Definition: pedump.c:66
CHAR szExeFile[MAX_PATH]
Definition: tlhelp32.h:70
DWORD th32ProcessID
Definition: tlhelp32.h:63
#define TH32CS_SNAPPROCESS
Definition: tlhelp32.h:26

Referenced by wWinMain().

◆ PrintThread()

static void PrintThread ( FILE output,
DumpData data,
DWORD  tid,
ThreadData thread 
)
static

Definition at line 51 of file main.cpp.

52{
53 thread.Update();
54
55 xfprintf(output, NEWLINE "State Dump for Thread Id 0x%x%s" NEWLINE NEWLINE, tid,
56 (tid == data.ThreadID) ? " (CRASH)" : "");
57
58 const CONTEXT& ctx = thread.Context;
59 if ((ctx.ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER)
60 {
61#if defined(_M_IX86)
62 xfprintf(output, "eax:%p ebx:%p ecx:%p edx:%p esi:%p edi:%p" NEWLINE,
63 ctx.Eax, ctx.Ebx, ctx.Ecx, ctx.Edx, ctx.Esi, ctx.Edi);
64#elif defined(_M_AMD64)
65 xfprintf(output, "rax:%p rbx:%p rcx:%p rdx:%p rsi:%p rdi:%p rbp:%p rsp:%p" NEWLINE,
66 ctx.Rax, ctx.Rbx, ctx.Rcx, ctx.Rdx, ctx.Rsi, ctx.Rdi, ctx.Rbp, ctx.Rsp);
67 xfprintf(output, "r8:%p r9:%p r10:%p r11:%p r12:%p r13:%p r14:%p r15:%p" NEWLINE,
68 ctx.R8, ctx.R9, ctx.R10, ctx.R11, ctx.R12, ctx.R13, ctx.R14, ctx.R15);
69#elif defined(_M_ARM)
70 xfprintf(output, "r0:%p r1:%p r2:%p r3:%p r4:%p r5:%p r6:%p" NEWLINE,
71 ctx.R0, ctx.R1, ctx.R2, ctx.R3, ctx.R4, ctx.R5, ctx.R6);
72 xfprintf(output, "r7:%p r8:%p r9:%p r10:%p r11:%p r12:%p" NEWLINE,
73 ctx.R7, ctx.R8, ctx.R9, ctx.R10, ctx.R11, ctx.R12);
74#else
75#error Unknown architecture
76#endif
77 }
78
79 if ((ctx.ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL)
80 {
81#if defined(_M_IX86)
82 xfprintf(output, "eip:%p esp:%p ebp:%p" NEWLINE,
83 ctx.Eip, ctx.Esp, ctx.Ebp);
84#elif defined(_M_AMD64)
85 xfprintf(output, "rip:%p rsp:%p rbp:%p" NEWLINE,
86 ctx.Rip, ctx.Rsp, ctx.Rbp);
87#elif defined(_M_ARM)
88 xfprintf(output, "sp:%p lr:%p pc:%p cpsr:%p" NEWLINE,
89 ctx.Sp, ctx.Lr, ctx.Pc, ctx.Cpsr);
90#else
91#error Unknown architecture
92#endif
93 }
94
96 {
97#if defined(_M_IX86) || defined(_M_AMD64)
98 xfprintf(output, "dr0:%p dr1:%p dr2:%p dr3:%p dr6:%p dr7:%p" NEWLINE,
99 ctx.Dr0, ctx.Dr1, ctx.Dr2, ctx.Dr3, ctx.Dr6, ctx.Dr7);
100#elif defined(_M_ARM)
101 for (int n = 0; n < ARM_MAX_BREAKPOINTS; ++n)
102 xfprintf(output, "Bvr%d:%p%s", n, ctx.Bvr[n], ((n + 1) == ARM_MAX_BREAKPOINTS) ? NEWLINE : " ");
103 for (int n = 0; n < ARM_MAX_BREAKPOINTS; ++n)
104 xfprintf(output, "Bcr%d:%p%s", n, ctx.Bcr[n], ((n + 1) == ARM_MAX_BREAKPOINTS) ? NEWLINE : " ");
105
106 for (int n = 0; n < ARM_MAX_WATCHPOINTS; ++n)
107 xfprintf(output, "Wvr%d:%p%s", n, ctx.Wvr[n], ((n + 1) == ARM_MAX_WATCHPOINTS) ? NEWLINE : " ");
108 for (int n = 0; n < ARM_MAX_WATCHPOINTS; ++n)
109 xfprintf(output, "Wcr%d:%p%s", n, ctx.Wcr[n], ((n + 1) == ARM_MAX_WATCHPOINTS) ? NEWLINE : " ");
110#else
111#error Unknown architecture
112#endif
113 }
114
116}
static HANDLE thread
Definition: service.c:33
void PrintStackBacktrace(FILE *output, DumpData &data, ThreadData &thread)
Definition: stacktrace.cpp:36
static TfClientId tid
#define CONTEXT_DEBUG_REGISTERS
Definition: nt_native.h:1373
#define CONTEXT_CONTROL
Definition: nt_native.h:1369
#define CONTEXT_INTEGER
Definition: nt_native.h:1370
#define ARM_MAX_WATCHPOINTS
Definition: ke.h:232
#define ARM_MAX_BREAKPOINTS
Definition: ke.h:231

Referenced by PrintBugreport().

◆ Settings_GetOutputPath()

std::wstring Settings_GetOutputPath ( void  )

Definition at line 187 of file main.cpp.

188{
189 WCHAR Buffer[MAX_PATH] = L"";
191 BOOL UseDefaultPath = TRUE;
192
193 CRegKey key;
194 if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\ReactOS\\Crash Reporter", KEY_READ) == ERROR_SUCCESS &&
195 key.QueryStringValue(L"Dump Directory", Buffer, &BufferSize) == ERROR_SUCCESS)
196 {
197 UseDefaultPath = FALSE;
198 }
199
200 if (UseDefaultPath)
201 {
203 {
204 return std::wstring();
205 }
206 }
207
208 return std::wstring(Buffer);
209}
Definition: bufpool.h:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2589
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FAILED(hr)
Definition: intsafe.h:51
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2149
#define CSIDL_DESKTOP
Definition: shlobj.h:2173
#define _countof(array)
Definition: sndvol32.h:70
Definition: copy.c:22
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define HKEY_CURRENT_USER
Definition: winreg.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wWinMain().

◆ Settings_GetShouldWriteDump()

BOOL Settings_GetShouldWriteDump ( void  )

Definition at line 211 of file main.cpp.

212{
213 CRegKey key;
214 if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\ReactOS\\Crash Reporter", KEY_READ) != ERROR_SUCCESS)
215 {
216 return FALSE;
217 }
218
219 DWORD Value;
220 if (key.QueryDWORDValue(L"Minidump", Value) != ERROR_SUCCESS)
221 {
222 return FALSE;
223 }
224
225 return (Value != 0);
226}
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by wWinMain().

◆ SortModules()

static bool SortModules ( const ModuleData left,
const ModuleData right 
)
static

Definition at line 46 of file main.cpp.

47{
48 return left.BaseAddress < right.BaseAddress;
49}
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726

Referenced by PrintBugreport().

◆ vDbgPrintEx()

NTSYSAPI ULONG NTAPI vDbgPrintEx ( _In_ ULONG  ComponentId,
_In_ ULONG  Level,
_In_z_ PCCH  Format,
_In_ va_list  ap 
)

◆ WriteMinidump()

HRESULT WriteMinidump ( LPCWSTR  LogFilePath,
DumpData data 
)

Definition at line 228 of file main.cpp.

229{
230 HRESULT hr = S_OK;
231
232 WCHAR DumpFilePath[MAX_PATH] = L"";
233 StringCchCopyW(DumpFilePath, _countof(DumpFilePath), LogFilePath);
234 PathRemoveExtensionW(DumpFilePath);
235 PathAddExtensionW(DumpFilePath, L".dmp");
236
238 if (hDumpFile == INVALID_HANDLE_VALUE)
239 {
241 }
242
243 ThreadData& Thread = data.Threads[data.ThreadID];
244 Thread.Update();
245 PCONTEXT ContextPointer = &Thread.Context;
246
247 MINIDUMP_EXCEPTION_INFORMATION DumpExceptionInfo = {0};
248 EXCEPTION_POINTERS ExceptionPointers = {0};
249 ExceptionPointers.ExceptionRecord = &data.ExceptionInfo.ExceptionRecord;
250 ExceptionPointers.ContextRecord = ContextPointer;
251
252 DumpExceptionInfo.ThreadId = data.ThreadID;
253 DumpExceptionInfo.ExceptionPointers = &ExceptionPointers;
254 DumpExceptionInfo.ClientPointers = FALSE;
255
256 BOOL DumpSucceeded = MiniDumpWriteDump(data.ProcessHandle, data.ProcessID, hDumpFile, MiniDumpNormal, &DumpExceptionInfo, NULL, NULL);
257 if (!DumpSucceeded)
258 {
259 // According to MSDN, this value is already an HRESULT, so don't convert it again.
260 hr = GetLastError();
261 }
262
263 CloseHandle(hDumpFile);
264 return hr;
265}
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
@ MiniDumpNormal
Definition: compat.h:1266
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
__in PVOID ContextPointer
Definition: handleapi.cpp:679
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess, DWORD pid, HANDLE hFile, MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, PMINIDUMP_CALLBACK_INFORMATION CallbackParam)
Definition: minidump.c:942
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
#define PathAddExtensionW
Definition: pathcch.h:305
HRESULT hr
Definition: shlfolder.c:183
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
PCONTEXT ContextRecord
Definition: rtltypes.h:201
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
PEXCEPTION_POINTERS ExceptionPointers
Definition: dbghelp.h:774
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by wWinMain().

◆ wWinMain()

int WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  ,
LPWSTR  cmdLine,
INT   
)

Definition at line 267 of file main.cpp.

268{
269 int argc;
271
272 DWORD pid = 0;
273 WCHAR Filename[50];
274 FILE* output = NULL;
275 SYSTEMTIME st;
277
278
279 for (int n = 0; n < argc; ++n)
280 {
281 WCHAR* arg = argv[n];
282
283 if (!wcscmp(arg, L"-i"))
284 {
285 /* FIXME: Installs as the postmortem debugger. */
286 }
287 else if (!wcscmp(arg, L"-g"))
288 {
289 }
290 else if (!wcscmp(arg, L"-p"))
291 {
292 if (n + 1 < argc)
293 {
294 pid = wcstoul(argv[n+1], NULL, 10);
295 n++;
296 }
297 }
298 else if (!wcscmp(arg, L"-e"))
299 {
300 if (n + 1 < argc)
301 {
302 data.Event = (HANDLE)(ULONG_PTR)_wcstoui64(argv[n+1], NULL, 10);
303 n++;
304 }
305 }
306 else if (!wcscmp(arg, L"-?"))
307 {
308 MessageBoxA(NULL, szUsage, "ReactOS Crash Reporter", MB_OK);
309 return abort(output, 0);
310 }
311 else if (!wcscmp(arg, L"/?"))
312 {
313 xfprintf(stdout, "%s\n", szUsage);
314 return abort(stdout, 0);
315 }
316 }
317
318 if (!pid)
319 {
320 MessageBoxA(NULL, szUsage, "ReactOS Crash Reporter", MB_OK);
321 return abort(stdout, 0);
322 }
323
324 GetLocalTime(&st);
325
326 std::wstring OutputPath = Settings_GetOutputPath();
327 BOOL HasPath = (OutputPath.size() != 0);
328
329 if (!PathIsDirectoryW(OutputPath.c_str()))
330 {
331 int res = SHCreateDirectoryExW(NULL, OutputPath.c_str(), NULL);
333 {
334 xfprintf(stdout, "Could not create output directory, not writing dump\n");
335 MessageBoxA(NULL, "Could not create directory to write crash report.", "ReactOS Crash Reporter", MB_ICONERROR | MB_OK);
336 return abort(stdout, 0);
337 }
338 }
339
340 if (HasPath &&
341 SUCCEEDED(StringCchPrintfW(Filename, _countof(Filename), L"Appcrash_%d-%02d-%02d_%02d-%02d-%02d.txt",
342 st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond)))
343 {
344 OutputPath += L"\\";
345 OutputPath += Filename;
346 output = _wfopen(OutputPath.c_str(), L"wb");
347 }
348 if (!output)
349 output = stdout;
350
351
353 return abort(output, -2);
354
355 /* We should not kill it? */
357
358 DEBUG_EVENT evt;
359 if (!WaitForDebugEvent(&evt, 30000))
360 return abort(output, -3);
361
363
364 while (UpdateFromEvent(evt, data))
365 {
367
368 if (!WaitForDebugEvent(&evt, 30000))
369 return abort(output, -4);
370 }
371
372 PrintBugreport(output, data);
373 if (Settings_GetShouldWriteDump() && HasPath)
374 {
375 WriteMinidump(OutputPath.c_str(), data);
376 }
377
378 TerminateProcess(data.ProcessHandle, data.ExceptionInfo.ExceptionRecord.ExceptionCode);
379
380 CStringW FormattedMessage;
381 FormattedMessage.Format(IDS_USER_ALERT_MESSAGE, data.ProcessName.c_str(), OutputPath.c_str());
382 CStringW DialogTitle;
383 DialogTitle.LoadString(hInstance, IDS_APP_TITLE);
384
385 MessageBoxW(NULL, FormattedMessage.GetString(), DialogTitle.GetString(), MB_OK);
386
387 return abort(output, 0);
388}
static int argc
Definition: ServiceArgs.c:12
static const char szUsage[]
Definition: main.cpp:23
std::wstring Settings_GetOutputPath(void)
Definition: main.cpp:187
BOOL Settings_GetShouldWriteDump(void)
Definition: main.cpp:211
HRESULT WriteMinidump(LPCWSTR LogFilePath, DumpData &data)
Definition: main.cpp:228
void PrintBugreport(FILE *output, DumpData &data)
Definition: main.cpp:118
#define IDS_USER_ALERT_MESSAGE
Definition: resource.h:11
#define IDS_APP_TITLE
Definition: resource.h:10
HINSTANCE hInstance
Definition: charmap.c:19
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:639
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
BOOL WINAPI DebugSetProcessKillOnExit(IN BOOL KillOnExit)
Definition: debugger.c:542
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
Definition: debugger.c:413
BOOL WINAPI DebugActiveProcess(IN DWORD dwProcessId)
Definition: debugger.c:445
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
Definition: debugger.c:590
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2019
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723
#define assert(x)
Definition: debug.h:53
bool UpdateFromEvent(DEBUG_EVENT &evt, DumpData &data)
Definition: drwtsn32.cpp:56
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:940
GLuint res
Definition: glext.h:9613
#define abort()
Definition: i386-dis.c:34
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define argv
Definition: mplay32.c:18
#define DBG_CONTINUE
Definition: ntstatus.h:47
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:906
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
DWORD dwDebugEventCode
Definition: winbase.h:813
DWORD dwThreadId
Definition: winbase.h:815
DWORD dwProcessId
Definition: winbase.h:814
WORD wYear
Definition: winbase.h:930
WORD wMonth
Definition: winbase.h:931
WORD wHour
Definition: winbase.h:934
WORD wSecond
Definition: winbase.h:936
WORD wMinute
Definition: winbase.h:935
WORD wDay
Definition: winbase.h:933
PVOID HANDLE
Definition: typedefs.h:73
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CREATE_PROCESS_DEBUG_EVENT
Definition: winbase.h:105
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:790
#define MB_OK
Definition: winuser.h:793
unsigned __int64 CDECL _wcstoui64(const wchar_t *nptr, wchar_t **endptr, int base)
Definition: wtoi64.c:200

◆ xfprintf()

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

Definition at line 34 of file main.cpp.

35{
36 va_list ap;
37
38 va_start(ap, fmt);
41 va_end(ap);
42}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
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
_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
Definition: parse.h:23
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

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

Variable Documentation

◆ szUsage

const char szUsage[]
static
Initial value:
= "Usage: DrWtsn32 [-i] [-g] [-p dddd] [-e dddd] [-?]\n"
" -i: Install DrWtsn32 as the postmortem debugger\n"
" -g: Ignored, Provided for compatibility with WinDbg and CDB.\n"
" -p dddd: Attach to process dddd.\n"
" -e dddd: Signal the event dddd.\n"
" -?: This help.\n"

Definition at line 23 of file main.cpp.

Referenced by wWinMain().