23 static const char szUsage[] =
"Usage: DrWtsn32 [-i] [-g] [-p dddd] [-e dddd] [-?]\n" 24 " -i: Install DrWtsn32 as the postmortem debugger\n" 25 " -g: Ignored, Provided for compatibility with WinDbg and CDB.\n" 26 " -p dddd: Attach to process dddd.\n" 27 " -e dddd: Signal the event dddd.\n" 32 #define DPFLTR_ERROR_LEVEL 0 48 return left.BaseAddress <
right.BaseAddress;
56 (
tid ==
data.ThreadID) ?
" (CRASH)" :
"");
64 #elif defined(_M_AMD64) 75 #error Unknown architecture 84 #elif defined(_M_AMD64) 91 #error Unknown architecture 97 #if defined(_M_IX86) || defined(_M_AMD64) 100 #elif defined(_M_ARM) 111 #error Unknown architecture 141 mainModule.Update(
data.ProcessHandle);
143 mainModule.BaseAddress,
144 (
PBYTE)mainModule.BaseAddress + mainModule.Size,
145 data.ProcessPath.c_str());
147 for (
size_t n = 0;
n <
data.Modules.size(); ++
n)
152 mod.Update(
data.ProcessHandle);
156 mod.ModuleName.c_str());
164 if (crash !=
data.Threads.end())
170 if (it->first !=
data.ThreadID)
197 UseDefaultPath =
FALSE;
204 return std::wstring();
208 return std::wstring(
Buffer);
327 BOOL HasPath = (OutputPath.size() != 0);
334 xfprintf(
stdout,
"Could not create output directory, not writing dump\n");
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
int abort(FILE *output, int err)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
static UCHAR ULONG UCHAR ULONG UCHAR * output
#define HRESULT_FROM_WIN32(x)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR cmdLine, INT)
BOOL Settings_GetShouldWriteDump(void)
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
__in PVOID ContextPointer
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
#define HKEY_CURRENT_USER
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)
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
__MINGW_EXTENSION _Check_return_ _CRTIMP unsigned __int64 __cdecl _wcstoui64(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
void __cdecl Format(UINT nFormatID,...)
#define ARM_MAX_BREAKPOINTS
void EndStackBacktrace(DumpData &data)
static bool SortModules(const ModuleData &left, const ModuleData &right)
void xfprintf(FILE *stream, const char *fmt,...)
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
std::wstring Settings_GetOutputPath(void)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
static const char szUsage[]
BOOL WINAPI DebugSetProcessKillOnExit(IN BOOL KillOnExit)
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
BOOL WINAPI PathAddExtensionW(LPWSTR lpszPath, LPCWSTR lpszExtension)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
LPWSTR WINAPI GetCommandLineW(VOID)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
#define ARM_MAX_WATCHPOINTS
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
static void PrintThread(FILE *output, DumpData &data, DWORD tid, ThreadData &thread)
HRESULT WriteMinidump(LPCWSTR LogFilePath, DumpData &data)
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
#define FILE_ATTRIBUTE_NORMAL
#define CONTEXT_DEBUG_REGISTERS
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
void PrintBugreport(FILE *output, DumpData &data)
void PrintSystemInfo(FILE *output, DumpData &data)
WDF_CHILD_LIST_ITERATOR iterator
struct _EXCEPTION_RECORD * ExceptionRecord
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define IDS_USER_ALERT_MESSAGE
#define DPFLTR_ERROR_LEVEL
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
void BeginStackBacktrace(DumpData &data)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
#define TH32CS_SNAPPROCESS
bool UpdateFromEvent(DEBUG_EVENT &evt, DumpData &data)
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
void int int ULONGLONG int va_list * ap
void PrintStackBacktrace(FILE *output, DumpData &data, ThreadData &thread)
BOOL LoadString(_In_ UINT nID)
#define CREATE_PROCESS_DEBUG_EVENT
PEXCEPTION_RECORD ExceptionRecord
#define ERROR_ALREADY_EXISTS
BOOL WINAPI DebugActiveProcess(IN DWORD dwProcessId)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize