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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Jeffrey Altman 2012-06-18 21:37:49 -04:00
parent e513799232
commit 43d53bed6f

View 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;