Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. filtqtrace.cxx
  5. Abstract:
  6. This module implements a filter queue tracing facility.
  7. Author:
  8. Michael Courage (mcourage) 11-Nov-2000
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #if ENABLE_FILTQ_TRACE
  13. /***************************************************************************++
  14. Routine Description:
  15. Creates a new (empty) filter queue trace log buffer.
  16. Arguments:
  17. LogSize - Supplies the number of entries in the log.
  18. ExtraBytesInHeader - Supplies the number of extra bytes to include
  19. in the log header. This is useful for adding application-
  20. specific data to the log.
  21. Return Value:
  22. PTRACE_LOG - Pointer to the newly created log if successful,
  23. NULL otherwise.
  24. --***************************************************************************/
  25. PTRACE_LOG
  26. CreateFiltqTraceLog(
  27. IN LONG LogSize,
  28. IN LONG ExtraBytesInHeader
  29. )
  30. {
  31. return CreateTraceLog(
  32. FILTQ_TRACE_LOG_SIGNATURE,
  33. LogSize,
  34. ExtraBytesInHeader,
  35. sizeof(FILTQ_TRACE_LOG_ENTRY)
  36. );
  37. } // CreateFiltqTraceLog
  38. /***************************************************************************++
  39. Routine Description:
  40. Destroys a filter queue trace log buffer created with
  41. CreateFiltqTraceLog().
  42. Arguments:
  43. pLog - Supplies the filter queue trace log buffer to destroy.
  44. --***************************************************************************/
  45. VOID
  46. DestroyFiltqTraceLog(
  47. IN PTRACE_LOG pLog
  48. )
  49. {
  50. DestroyTraceLog( pLog );
  51. } // DestroyFiltqTraceLog
  52. /***************************************************************************++
  53. Routine Description:
  54. Writes a new entry to the specified filter queue trace log.
  55. Arguments:
  56. pLog - Supplies the log to write to.
  57. ConnectionId - the id of the connection we're tracing
  58. RequestId - the id of the request we're tracing
  59. Action - Supplies an action code for the new log entry.
  60. --***************************************************************************/
  61. VOID
  62. WriteFiltqTraceLog(
  63. IN PTRACE_LOG pLog,
  64. IN USHORT Action,
  65. IN PUX_FILTER_CONNECTION pConnection,
  66. IN PIRP pIrp,
  67. IN PVOID pFileName,
  68. IN USHORT LineNumber
  69. )
  70. {
  71. FILTQ_TRACE_LOG_ENTRY entry;
  72. //
  73. // Initialize the entry.
  74. //
  75. entry.Action = Action;
  76. entry.Processor = (USHORT)KeGetCurrentProcessorNumber();
  77. entry.pProcess = PsGetCurrentProcess();
  78. entry.pThread = PsGetCurrentThread();
  79. entry.pConnection = pConnection;
  80. entry.pIrp = pIrp;
  81. entry.ReadIrps = pConnection->AppToFiltQueue.ReadIrps;
  82. entry.Writers = pConnection->AppToFiltQueue.Writers;
  83. entry.pFileName = pFileName;
  84. entry.LineNumber = LineNumber;
  85. //
  86. // Write it to the logs.
  87. //
  88. WriteTraceLog( pLog, &entry );
  89. } // WriteFiltqTraceLog
  90. #endif // ENABLE_FILTQ_TRACE