Use an updated exchndl.dll that supports setting the log file path manually and next.minor

Sun, 01 Nov 2009 04:56:45 +0000

author
Daniel Atallah <datallah@pidgin.im>
date
Sun, 01 Nov 2009 04:56:45 +0000
branch
next.minor
changeset 29635
e30bf262a1f2
parent 29634
80dbf6f777c4
child 29636
cfd62d35ff49

Use an updated exchndl.dll that supports setting the log file path manually and
external debug symbols (looks in the specified debug symbols dir and also for a
<modulename>.dbgsym alongside <modulename>).

ChangeLog.win32 file | annotate | diff | comparison | revisions
pidgin/win32/gtkwin32dep.c file | annotate | diff | comparison | revisions
pidgin/win32/nsis/pidgin-installer.nsi file | annotate | diff | comparison | revisions
pidgin/win32/winpidgin.c file | annotate | diff | comparison | revisions
--- a/ChangeLog.win32	Sun Nov 01 03:34:32 2009 +0000
+++ b/ChangeLog.win32	Sun Nov 01 04:56:45 2009 +0000
@@ -2,6 +2,8 @@
 	* Minimum required GTK+ version increased to 2.14.0
 	* Private GTK+ Runtime now used (GTK+ Installer no longer supported)
 	* Win9x no longer supported.
+	* Crash Report files (pidgin.RPT) are now generated in the ~/.purple
+	  directory instead of the installation directory.
 
 version 2.6.3 (10/16/2009):
 	* No changes
--- a/pidgin/win32/gtkwin32dep.c	Sun Nov 01 03:34:32 2009 +0000
+++ b/pidgin/win32/gtkwin32dep.c	Sun Nov 01 04:56:45 2009 +0000
@@ -383,6 +383,7 @@
 }
 
 void winpidgin_init(HINSTANCE hint) {
+	FARPROC exchndl_SetLogFile;
 
 	purple_debug_info("winpidgin", "winpidgin_init start\n");
 
@@ -400,6 +401,16 @@
 
 	MyFlashWindowEx = (LPFNFLASHWINDOWEX) wpurple_find_and_loadproc("user32.dll", "FlashWindowEx");
 
+	exchndl_SetLogFile = wpurple_find_and_loadproc("exchndl.dll", "SetLogFile");
+	if (exchndl_SetLogFile) {
+		gchar *filename = g_build_filename(purple_user_dir(),
+			"pidgin.RPT", NULL);
+		purple_debug_info("winpidgin", "Setting exchndl.dll LogFile to %s\n",
+			filename);
+		(exchndl_SetLogFile)(filename);
+		g_free(filename);
+	}
+
 	purple_debug_info("winpidgin", "winpidgin_init end\n");
 }
 
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Sun Nov 01 03:34:32 2009 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Sun Nov 01 04:56:45 2009 +0000
@@ -52,7 +52,7 @@
 ;Defines
 
 !define PIDGIN_NSIS_INCLUDE_PATH		"."
-!define PIDGIN_INSTALLER_DEPS			"..\..\..\..\win32-dev\pidgin-inst-deps"
+!define PIDGIN_INSTALLER_DEPS			"..\..\..\..\win32-dev\pidgin-inst-deps-0.2"
 
 ; Remove these and the stuff that uses them at some point
 !define OLD_GAIM_REG_KEY			"SOFTWARE\gaim"
--- a/pidgin/win32/winpidgin.c	Sun Nov 01 03:34:32 2009 +0000
+++ b/pidgin/win32/winpidgin.c	Sun Nov 01 04:56:45 2009 +0000
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include "config.h"
 
 /* These will hopefully be in the win32api next time it is updated - at which point, we'll remove them */
 #ifndef LANG_PERSIAN
@@ -672,28 +673,49 @@
 
 	/* Load exception handler if we have it */
 	if (GetModuleFileName(NULL, pidgin_dir, MAX_PATH) != 0) {
-		char *prev = NULL;
-		tmp = pidgin_dir;
 
 		/* primitive dirname() */
-		while ((tmp = strchr(tmp, '\\'))) {
-			prev = tmp;
-			tmp++;
-		}
+		tmp = strrchr(pidgin_dir, '\\');
 
-		if (prev) {
+		if (tmp) {
 			HMODULE hmod;
-			prev[0] = '\0';
+			tmp[0] = '\0';
 
-			/* prev++ will now point to the executable file name */
-			strcpy(exe_name, prev + 1);
+			/* tmp++ will now point to the executable file name */
+			strcpy(exe_name, tmp + 1);
 
 			strcat(pidgin_dir, "\\exchndl.dll");
 			if ((hmod = LoadLibrary(pidgin_dir))) {
+				FARPROC proc;
+				char debug_dir[MAX_PATH];
 				printf("Loaded exchndl.dll\n");
+				/* Temporarily override exchndl.dll's logfile
+				 * to something sane (Pidgin will override it
+				 * again when it initializes) */
+				proc = GetProcAddress(hmod, "SetLogFile");
+				if (proc) {
+					if (GetTempPath(sizeof(debug_dir), debug_dir) != 0) {
+						strcat(debug_dir, "pidgin.RPT");
+						printf(" Setting exchndl.dll LogFile to %s\n",
+							debug_dir);
+						(proc)(debug_dir);
+					}
+				}
+				proc = GetProcAddress(hmod, "SetDebugInfoDir");
+				if (proc) {
+					tmp[0] = '\0';
+					_snprintf(debug_dir, sizeof(debug_dir),
+						"%s\\pidgin-%s-dbgsym",
+						pidgin_dir,  VERSION);
+					debug_dir[sizeof(debug_dir) - 1] = '\0';
+					printf(" Setting exchndl.dll DebugInfoDir to %s\n",
+						debug_dir);
+					(proc)(debug_dir);
+				}
+
 			}
 
-			prev[0] = '\0';
+			tmp[0] = '\0';
 		}
 	} else {
 		DWORD dw = GetLastError();

mercurial