--- a/ChangeLog.win32 Mon Jul 04 22:03:17 2005 -0400
+++ b/ChangeLog.win32 Mon Jul 04 23:52:50 2005 -0400
@@ -1,5 +1,6 @@
+ * On Windows XP or newer, the non-debug version of gaim will attempt to + use the existing console, if one is present, for debug output. version 1.3.1 (6/9/2005):
* Installer allows you to choose whether or not to put shortcuts on the
--- a/src/win_gaim.c Mon Jul 04 22:03:17 2005 -0400
+++ b/src/win_gaim.c Mon Jul 04 23:52:50 2005 -0400
@@ -24,14 +24,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# define _WIN32_WINNT 0x0501 +/** Currently missing from win32-api */ +#ifndef ATTACH_PARENT_PROCESS +# define ATTACH_PARENT_PROCESS -1 typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**);
typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR);
+typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD); @@ -278,11 +288,18 @@
- /* If debug flag used, create console for output */
- if(strstr(lpszCmdLine, "-d")) {
- freopen ("CONOUT$", "w", stdout);
+ /* If debug or help flag used, create console for output */ + if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h")) { + LPFNATTACHCONSOLE MyAttachConsole = NULL; + if ((hmod = GetModuleHandle("kernel32.dll"))) { + GetProcAddress(hmod, "AttachConsole"); + if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) + freopen("CONOUT$", "w", stdout); /* Load exception handler if we have it */
if(GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) {