Diablo 2 with Battle.net - another step closer again
gerard patel
g.patel at wanadoo.fr.invalid
Sat Aug 11 16:56:55 CDT 2001
On Sat, 11 Aug 2001 20:12:09 -0400, Robert Laverick
<csujo at scabserver.com> wrote:
<snip>
>looking, is there anyway to start and stop debug messages while the app is
>running?
Try this patch (beware of folding lines). Traces you select from
the command line are started by using Alt F12
Gerard
Index: dlls/ntdll/debugtools.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/debugtools.c,v
retrieving revision 1.7
diff -u -r1.7 debugtools.c
--- dlls/ntdll/debugtools.c 2001/05/08 00:13:38 1.7
+++ dlls/ntdll/debugtools.c 2001/06/06 08:10:51
@@ -29,6 +29,8 @@
static struct debug_info tmp;
+static BOOL deferredTrace = FALSE, debugEnabled = TRUE;
+
/* get the debug info pointer for the current thread */
static inline struct debug_info *get_info(void)
{
@@ -204,8 +206,12 @@
{
struct debug_info *info = get_info();
char *p;
+ int ret;
+
+ if (!debugEnabled)
+ return 0;
- int ret = vsnprintf( info->out_pos, sizeof(info->output) -
(info->out_pos - info->output),
+ ret = vsnprintf( info->out_pos, sizeof(info->output) -
(info->out_pos - info->output),
format, args );
/* make sure we didn't exceed the buffer length
@@ -235,12 +241,30 @@
int ret;
va_list valist;
+ if (!debugEnabled)
+ return 0;
va_start(valist, format);
ret = wine_dbg_vprintf( format, valist );
va_end(valist);
return ret;
}
+
/***********************************************************************
+ * wine_dbg_switch_log
+ */
+BOOL wine_dbg_switch_log(BOOL switchON)
+{
+ if (switchON)
+ {
+ deferredTrace = TRUE; debugEnabled = FALSE;
+ return FALSE;
+ }
+ if (!deferredTrace)
+ return FALSE;
+ debugEnabled = !debugEnabled;
+ return debugEnabled;
+}
+
/***********************************************************************
* wine_dbg_log (NTDLL.@)
*/
@@ -250,6 +274,9 @@
static const char *classes[__DBCL_COUNT] = { "fixme", "err",
"warn", "trace" };
va_list valist;
int ret = 0;
+
+ if (!debugEnabled)
+ return 0;
va_start(valist, format);
if (TRACE_ON(tid))
Index: misc/options.c
===================================================================
RCS file: /home/wine/wine/misc/options.c,v
retrieving revision 1.26
diff -u -r1.26 options.c
--- misc/options.c 2001/03/23 23:45:46 1.26
+++ misc/options.c 2001/06/06 08:10:56
@@ -17,6 +17,8 @@
#include "version.h"
#include "debugtools.h"
+extern BOOL wine_dbg_switch_log( BOOL );
+
struct option_descr
{
const char *longname;
@@ -53,6 +55,7 @@
static void do_help( const char *arg );
static void do_managed( const char *arg );
static void do_version( const char *arg );
+static void do_deferred( const char *arg );
static const struct option_descr option_table[] =
{
@@ -71,6 +74,8 @@
"--version,-v Display the Wine version" },
{ "winver", 0, 1, 1, VERSION_ParseWinVersion,
"--winver Version to imitate
(win95,nt40,win31,nt2k,win98,nt351,win30,win20)" },
+ { "dt", 0, 0, 1, do_deferred,
+ "--dt Defer trace until Alt+F12" },
{ NULL, 0, 0, 0, NULL, NULL } /* terminator */
};
@@ -89,6 +94,11 @@
static void do_managed( const char *arg )
{
Options.managed = TRUE;
+}
+
+static void do_deferred( const char *arg )
+{
+ wine_dbg_switch_log(TRUE);
}
static void do_debugmsg( const char *arg )
Index: windows/defwnd.c
===================================================================
RCS file: /home/wine/wine/windows/defwnd.c,v
retrieving revision 1.56
diff -u -r1.56 defwnd.c
--- windows/defwnd.c 2001/06/04 21:55:17 1.56
+++ windows/defwnd.c 2001/06/06 08:11:02
@@ -21,6 +21,8 @@
#include "wine/winuser16.h"
#include "imm.h"
+extern BOOL wine_dbg_switch_log( BOOL );
+
DEFAULT_DEBUG_CHANNEL(win);
/* bits in the dwKeyData */
@@ -550,6 +552,11 @@
pSendMessage( WIN_GetTopParent(wndPtr->hwndSelf),
WM_SYSCOMMAND, SC_KEYMENU, 0L );
iMenuSysKey = iF10Key = 0;
+ if ((wParam == VK_F12) && (GetKeyState(VK_MENU) & 0x8000))
+ { /* switch trace on and off on Alt F12 */
+ if (wine_dbg_switch_log(FALSE))
+ WIN_WalkWindows((HWND)NULL, 0);
+ }
break;
case WM_SYSCHAR:
More information about the wine-users
mailing list