From 1eccf8df16d9216a4c09e99d4123a86cbcf610a0 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 8 Apr 2013 21:51:48 -0400 Subject: [PATCH] Windows: Runtime RDR Trace Toggle Modify the IOCTL_AFS_CONFIG_LIBRARY_TRACE DeviceIoControl message to pass an AFSDebugTraceConfigCB which is used to toggle the value of the Library's AFSDebugTraceFnc pointer. When the trace log is enabled, the AFSDbgLogMsg parameter is non-NULL and when the log is disabled, the parameter is NULL. Change-Id: I71b951f244b760487f2ece94409cefaa7a73ea31 Reviewed-on: http://gerrit.openafs.org/9748 Tested-by: BuildBot Reviewed-by: Rod Widdowson Reviewed-by: Peter Scott Reviewed-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp | 13 ++++++++++++- src/WINNT/afsrdr/kernel/lib/AFSDevControl.cpp | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp b/src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp index 6bde1b459..bdde33832 100644 --- a/src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp +++ b/src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp @@ -945,10 +945,21 @@ AFSConfigLibraryDebug() if ( pDevExt->Specific.Control.LibraryDeviceObject != NULL) { + RtlZeroMemory( &stConfigLib, sizeof( AFSDebugTraceConfigCB)); - stConfigLib.AFSDbgLogMsg = AFSDebugTraceFnc; + if ( BooleanFlagOn( AFSDebugFlags, AFS_DBG_TRACE_TO_DEBUGGER) || + AFSDbgBufferLength > 0) + { + + stConfigLib.AFSDbgLogMsg = AFSDebugTraceFnc; + } + else + { + + stConfigLib.AFSDbgLogMsg = NULL; + } ntStatus = AFSSendDeviceIoControl( pDevExt->Specific.Control.LibraryDeviceObject, IOCTL_AFS_CONFIG_LIBRARY_TRACE, diff --git a/src/WINNT/afsrdr/kernel/lib/AFSDevControl.cpp b/src/WINNT/afsrdr/kernel/lib/AFSDevControl.cpp index b66e605a6..e330296d3 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSDevControl.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSDevControl.cpp @@ -442,10 +442,21 @@ AFSDevControl( IN PDEVICE_OBJECT LibDeviceObject, case IOCTL_AFS_CONFIG_LIBRARY_TRACE: { + AFSDebugTraceConfigCB *pConfigLib; + + if ( pIrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof( AFSDebugTraceConfigCB)) + { + + ntStatus = STATUS_INVALID_PARAMETER; + + break; + } + + pConfigLib = (AFSDebugTraceConfigCB *)Irp->AssociatedIrp.SystemBuffer; InterlockedCompareExchangePointer( (PVOID *)&AFSDebugTraceFnc, - NULL, - (void *)AFSDbgLogMsg); + pConfigLib->AFSDbgLogMsg, + (void *)pConfigLib->AFSDbgLogMsg); break; } -- 2.39.5