Leaked source code of windows server 2003
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.

153 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. vdmtrace.c
  5. Abstract:
  6. This module contains the support maintaining the VDM trace log.
  7. Author:
  8. Neil Sandlin (neilsa) 15-Sep-1996
  9. Revision History:
  10. --*/
  11. #include "vdmp.h"
  12. VOID
  13. VdmTraceEvent(
  14. USHORT Type,
  15. USHORT wData,
  16. USHORT lData,
  17. PKTRAP_FRAME TrapFrame
  18. );
  19. #ifdef ALLOC_PRAGMA
  20. #pragma alloc_text(PAGE, VdmTraceEvent)
  21. #endif
  22. VOID
  23. VdmTraceEvent(
  24. USHORT Type,
  25. USHORT wData,
  26. USHORT lData,
  27. PKTRAP_FRAME TrapFrame
  28. )
  29. /*++
  30. Routine Description:
  31. Arguments:
  32. Return Value:
  33. None
  34. --*/
  35. {
  36. #if 0
  37. // This code represents a security problem. Since it is only used
  38. // on special occasions, it won't be built into the standard build.
  39. // Individuals wishing to use it can build themselves a kernel with
  40. // it in.
  41. PVDM_TIB VdmTib;
  42. NTSTATUS Status = STATUS_SUCCESS;
  43. KIRQL OldIrql;
  44. PVDM_TRACEENTRY pEntry;
  45. PVDM_TRACEINFO pInfo;
  46. LARGE_INTEGER CurTime, DiffTime;
  47. PAGED_CODE();
  48. #if 0
  49. //
  50. // Raise Irql to APC level...
  51. //
  52. KeRaiseIrql(APC_LEVEL, &OldIrql);
  53. //
  54. // VdmTib is in user mode memory
  55. //
  56. try {
  57. #endif
  58. if ((*FIXED_NTVDMSTATE_LINEAR) & VDM_TRACE_HISTORY)) {
  59. //
  60. // Get a pointer to the VdmTib
  61. //
  62. VdmTib = NtCurrentTeb()->Vdm;
  63. if (VdmTib->TraceInfo.pTraceTable) {
  64. pEntry = &VdmTib->TraceInfo.pTraceTable[VdmTib->TraceInfo.CurrentEntry];
  65. pEntry->Type = Type;
  66. pEntry->wData = wData;
  67. pEntry->lData = lData;
  68. switch (VdmTib->TraceInfo.Flags & VDMTI_TIMER_MODE) {
  69. case VDMTI_TIMER_TICK:
  70. CurTime.LowPart = NtGetTickCount();
  71. pEntry->Time = CurTime.LowPart - VdmTib->TraceInfo.TimeStamp.LowPart;
  72. VdmTib->TraceInfo.TimeStamp.LowPart = CurTime.LowPart;
  73. break;
  74. case VDMTI_TIMER_PERFCTR:
  75. pEntry->Time = 0;
  76. break;
  77. case VDMTI_TIMER_STAT:
  78. pEntry->Time = 0;
  79. break;
  80. }
  81. pEntry->eax = TrapFrame->Eax;
  82. pEntry->ebx = TrapFrame->Ebx;
  83. pEntry->ecx = TrapFrame->Ecx;
  84. pEntry->edx = TrapFrame->Edx;
  85. pEntry->esi = TrapFrame->Esi;
  86. pEntry->edi = TrapFrame->Edi;
  87. pEntry->ebp = TrapFrame->Ebp;
  88. pEntry->esp = TrapFrame->HardwareEsp;
  89. pEntry->eip = TrapFrame->Eip;
  90. pEntry->eflags = TrapFrame->EFlags;
  91. pEntry->cs = (USHORT) TrapFrame->SegCs;
  92. pEntry->ds = (USHORT) TrapFrame->SegDs;
  93. pEntry->es = (USHORT) TrapFrame->SegEs;
  94. pEntry->fs = (USHORT) TrapFrame->SegFs;
  95. pEntry->gs = (USHORT) TrapFrame->SegGs;
  96. pEntry->ss = (USHORT) TrapFrame->HardwareSegSs;
  97. if (++VdmTib->TraceInfo.CurrentEntry >=
  98. (VdmTib->TraceInfo.NumPages*4096/sizeof(VDM_TRACEENTRY))) {
  99. VdmTib->TraceInfo.CurrentEntry = 0;
  100. }
  101. }
  102. }
  103. #if 0
  104. } except(EXCEPTION_EXECUTE_HANDLER) {
  105. Status = GetExceptionCode();
  106. }
  107. KeLowerIrql(OldIrql);
  108. #endif
  109. #else
  110. UNREFERENCED_PARAMETER (Type);
  111. UNREFERENCED_PARAMETER (wData);
  112. UNREFERENCED_PARAMETER (lData);
  113. UNREFERENCED_PARAMETER (TrapFrame);
  114. #endif
  115. }