From 43d53bed6f591257fee55c343699ee1d3b223ff6 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 18 Jun 2012 21:37:49 -0400 Subject: [PATCH] Windows: afslogon OutputDebugString If the NetworkProvider "Debug" value has the 1th bit set (2), generate all debug values to the debugger via OutputDebugString(). Change-Id: Ie7552fc5d154c178c38962672598a3b71321294d Reviewed-on: http://gerrit.openafs.org/7628 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/afslogon.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/WINNT/afsd/afslogon.c b/src/WINNT/afsd/afslogon.c index 571dd78ed5..68d6ba6335 100644 --- a/src/WINNT/afsd/afslogon.c +++ b/src/WINNT/afsd/afslogon.c @@ -57,6 +57,11 @@ void DebugEvent0(char *a) if (!Debug && !ISLOGONTRACE(TraceOption)) return; + if (Debug & 2) { + OutputDebugString(a); + OutputDebugString("\r\n"); + } + h = RegisterEventSource(NULL, AFS_LOGON_EVENT_NAME); if (h != INVALID_HANDLE_VALUE) { ptbuf[0] = a; @@ -68,22 +73,29 @@ void DebugEvent0(char *a) #define MAXBUF_ 512 void DebugEvent(char *b,...) { - HANDLE h; char *ptbuf[1],buf[MAXBUF_+1]; + HANDLE h; + char *ptbuf[1], buf[MAXBUF_+1]; va_list marker; if (!Debug && !ISLOGONTRACE(TraceOption)) return; + va_start(marker,b); + StringCbVPrintf(buf, MAXBUF_+1,b,marker); + buf[MAXBUF_] = '\0'; + + if (Debug & 2) { + OutputDebugString(buf); + OutputDebugString("\r\n"); + } + h = RegisterEventSource(NULL, AFS_LOGON_EVENT_NAME); if (h != INVALID_HANDLE_VALUE) { - va_start(marker,b); - StringCbVPrintf(buf, MAXBUF_+1,b,marker); - buf[MAXBUF_] = '\0'; ptbuf[0] = buf; ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 1008, NULL, 1, 0, (const char **)ptbuf, NULL); DeregisterEventSource(h); - va_end(marker); } + va_end(marker); } static HANDLE hInitMutex = NULL;