]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: afslogon OutputDebugString
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 19 Jun 2012 01:37:49 +0000 (21:37 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 3 Jul 2012 15:06:03 +0000 (08:06 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
src/WINNT/afsd/afslogon.c

index 571dd78ed5492613e9f13cd5f2c0e5c0bf03178b..68d6ba63350965a76bd89fce82bd2722fd93c372 100644 (file)
@@ -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;