From f7a865319691429c5c6d9f370cc8862f4d4b6111 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 21 Jul 2006 22:28:54 +0000 Subject: [PATCH] - Here's something MinGW users will probably like: i_crash.cpp no longer needs dbghelp.h if you compile with GCC. SVN r269 (trunk) --- docs/rh-log.txt | 4 ++++ src/win32/i_crash.cpp | 55 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0df4971c6..f9a9c0530 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +July 21, 2006 +- Here's something MinGW users will probably like: i_crash.cpp no longer needs + dbghelp.h if you compile with GCC. + July 19, 2006 - Added some simple translucency map analysis for BOOM maps to more intelligently pick the value to use for TranslucentLine's second argument. diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index c7e8ddc23..986526117 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -41,7 +41,9 @@ #include #include #include +#ifndef __GNUC__ #include +#endif #include #include #include @@ -61,6 +63,51 @@ #include #include +// DBGHELP.H --------------------------------------------------------------- + +// w32api does not include dbghelp.h, so if I don't include these here, +// a person using GCC will need to download the Platform SDK, grab dbghelp.h +// from it, and edit it so it works with GCC. +#ifdef __GNUC__ +typedef enum _MINIDUMP_TYPE +{ + MiniDumpNormal + // Other types omitted. +} MINIDUMP_TYPE; + +typedef struct _MINIDUMP_EXCEPTION_INFORMATION { + DWORD ThreadId; + PEXCEPTION_POINTERS ExceptionPointers; + BOOL ClientPointers; +} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION; + +typedef struct _MINIDUMP_USER_STREAM_INFORMATION { + ULONG UserStreamCount; + void *UserStreamArray; // Not really void * +} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION; + +typedef BOOL (WINAPI * MINIDUMP_CALLBACK_ROUTINE) ( + IN PVOID CallbackParam, + IN CONST void *CallbackInput, // Not really void * + IN OUT void *CallbackOutput // Not really void * + ); + +typedef struct _MINIDUMP_CALLBACK_INFORMATION { + MINIDUMP_CALLBACK_ROUTINE CallbackRoutine; + PVOID CallbackParam; +} MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION; +#endif + +// Dbghelp.dll is loaded at runtime so we don't create any needless +// dependencies on it. +typedef BOOL (WINAPI *THREADWALK) (HANDLE, LPTHREADENTRY32); +typedef BOOL (WINAPI *MODULEWALK) (HANDLE, LPMODULEENTRY32); +typedef HANDLE (WINAPI *CREATESNAPSHOT) (DWORD, DWORD); +typedef BOOL (WINAPI *WRITEDUMP) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, + PMINIDUMP_EXCEPTION_INFORMATION, + PMINIDUMP_USER_STREAM_INFORMATION, + PMINIDUMP_CALLBACK_INFORMATION); + // MACROS ------------------------------------------------------------------ #define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" @@ -167,14 +214,6 @@ struct TarFile bool Deflated; }; -typedef BOOL (WINAPI *THREADWALK) (HANDLE, LPTHREADENTRY32); -typedef BOOL (WINAPI *MODULEWALK) (HANDLE, LPMODULEENTRY32); -typedef HANDLE (WINAPI *CREATESNAPSHOT) (DWORD, DWORD); -typedef BOOL (WINAPI *WRITEDUMP) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, - PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, - PMINIDUMP_CALLBACK_INFORMATION); - struct MiniDumpThreadData { HANDLE File;