Kill BUGTRAP

This probably never worked
This commit is contained in:
NepDisk 2025-10-17 09:55:24 -04:00
parent 0ffe70f313
commit 166648f008
3 changed files with 0 additions and 95 deletions

View file

@ -223,9 +223,6 @@ int main(int argc, char **argv)
#if 0 // just load the DLL
p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent");
if ((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent())
#ifdef BUGTRAP
&& !InitBugTrap()
#endif
)
#endif
{
@ -250,11 +247,6 @@ int main(int argc, char **argv)
// never return
D_SRB2Loop();
#ifdef BUGTRAP
// This is safe even if BT didn't start.
ShutdownBugTrap();
#endif
// return to OS
return 0;
}

View file

@ -29,85 +29,6 @@
LPTOP_LEVEL_EXCEPTION_FILTER prevExceptionFilter = NULL;
#ifdef BUGTRAP
typedef void (APIENTRY *BT_SETSUPPORTURL)(LPCTSTR pszSupportURL);
typedef void (APIENTRY *BT_SETFLAGS)(DWORD dwFlags);
typedef void (APIENTRY *BT_SETAPPNAME)(LPCTSTR pszAppName);
typedef void (APIENTRY *BT_SETAPPVERSION)(LPCTSTR pszAppVersion);
typedef void (APIENTRY *BT_SETSUPPORTSERVER)(LPCTSTR pszSupportHost, SHORT nSupportPort);
// BT constant definitions that we use, as given in the docs.
#define BTF_DETAILEDMODE 0x01
#define BTF_ATTACHREPORT 0x04
static HMODULE g_hmodBugTrap;
// --------------------------------------------------------------------------
// Initialises the Bug Trap exception-handling library. Returns true iff
// successful.
// --------------------------------------------------------------------------
BOOL InitBugTrap(void)
{
BT_SETFLAGS lpfnBT_SetFlags;
BT_SETSUPPORTURL lpfnBT_SetSupportURL;
BT_SETAPPNAME lpfnBT_SetAppName;
BT_SETAPPVERSION lpfnBT_SetAppVersion;
BT_SETSUPPORTSERVER lpfnBT_SetSupportServer;
// Loading the library installs the exception handler.
#ifdef UNICODE
g_hmodBugTrap = LoadLibrary(L"BugTrapU.dll");
#else
g_hmodBugTrap = LoadLibrary("BugTrap.dll");
#endif
// Get the functions.
lpfnBT_SetFlags = (BT_SETFLAGS)GetProcAddress(g_hmodBugTrap, "BT_SetFlags");
lpfnBT_SetSupportURL = (BT_SETSUPPORTURL)GetProcAddress(g_hmodBugTrap, "BT_SetSupportURL");
lpfnBT_SetAppName = (BT_SETAPPNAME)GetProcAddress(g_hmodBugTrap, "BT_SetAppName");
lpfnBT_SetAppVersion = (BT_SETAPPVERSION)GetProcAddress(g_hmodBugTrap, "BT_SetAppVersion");
lpfnBT_SetSupportServer = (BT_SETSUPPORTSERVER)GetProcAddress(g_hmodBugTrap, "BT_SetSupportServer");
if (g_hmodBugTrap)
{
lpfnBT_SetAppName(TEXT("SRB2Kart"));
lpfnBT_SetAppVersion(TEXT(VERSIONSTRING));
lpfnBT_SetFlags(BTF_DETAILEDMODE | BTF_ATTACHREPORT);
lpfnBT_SetSupportURL(TEXT("http://www.srb2.org/"));
lpfnBT_SetSupportServer(TEXT("srb2.org"), 9999);
return TRUE;
}
return FALSE;
}
// --------------------------------------------------------------------------
// Removes the BugTrap exception handler. Safe to call even if BT was never
// initialized.
// --------------------------------------------------------------------------
void ShutdownBugTrap(void)
{
if (g_hmodBugTrap) FreeLibrary(g_hmodBugTrap);
}
// --------------------------------------------------------------------------
// Simple test to check whether BugTrap is loaded without exposing its
// handle.
// --------------------------------------------------------------------------
BOOL IsBugTrapLoaded(void)
{
return !!g_hmodBugTrap;
}
#endif // (defined BUGTRAP)
#define NumCodeBytes 16 // Number of code bytes to record.
#define MaxStackDump 2048 // Maximum number of DWORDS in stack dumps.
#define StackColumns 8 // Number of columns in stack dump.

View file

@ -27,14 +27,6 @@
extern "C" {
#endif
#ifdef BUGTRAP
BOOL InitBugTrap(void);
void ShutdownBugTrap(void);
BOOL IsBugTrapLoaded(void);
#endif
// called in the exception filter of the __try block, writes all useful debugging information
// to a file, using only win32 functions in case the C runtime is in a bad state.
LONG WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data/*, LPCSTR Message, LPSTR lpCmdLine*/);