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.

114 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. vfprint.c
  5. Abstract:
  6. This module implements support for output of various data types to the
  7. debugger.
  8. Author:
  9. Adrian J. Oney (adriao) 20-Apr-1998
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. AdriaO 02/10/2000 - Seperated out from ntos\io\ioassert.c
  14. --*/
  15. #include "vfdef.h"
  16. #ifdef ALLOC_PRAGMA
  17. #pragma alloc_text(PAGEVRFY, VfPrintDumpIrpStack)
  18. #pragma alloc_text(PAGEVRFY, VfPrintDumpIrp)
  19. #endif // ALLOC_PRAGMA
  20. VOID
  21. VfPrintDumpIrpStack(
  22. IN PIO_STACK_LOCATION IrpSp
  23. )
  24. {
  25. VfMajorDumpIrpStack(IrpSp);
  26. DbgPrint("\n");
  27. DbgPrint(
  28. "[ DevObj=%p, FileObject=%p, Parameters=%p %p %p %p ]\n",
  29. IrpSp->DeviceObject,
  30. IrpSp->FileObject,
  31. IrpSp->Parameters.Others.Argument1,
  32. IrpSp->Parameters.Others.Argument2,
  33. IrpSp->Parameters.Others.Argument3,
  34. IrpSp->Parameters.Others.Argument4
  35. );
  36. }
  37. VOID
  38. VfPrintDumpIrp(
  39. IN PIRP IrpToFlag
  40. )
  41. {
  42. PIO_STACK_LOCATION irpSpCur;
  43. PIO_STACK_LOCATION irpSpNxt;
  44. //
  45. // First see if we can touch the IRP header
  46. //
  47. if(!VfUtilIsMemoryRangeReadable(IrpToFlag, sizeof(IRP), VFMP_INSTANT)) {
  48. return;
  49. }
  50. //
  51. // OK, get the next two stack locations...
  52. //
  53. irpSpNxt = IoGetNextIrpStackLocation( IrpToFlag );
  54. irpSpCur = IoGetCurrentIrpStackLocation( IrpToFlag );
  55. if (VfUtilIsMemoryRangeReadable(irpSpNxt, 2*sizeof(IO_STACK_LOCATION), VFMP_INSTANT)) {
  56. //
  57. // Both are present, print the best one!
  58. //
  59. if (irpSpNxt->MinorFunction == irpSpCur->MinorFunction) {
  60. //
  61. // Looks forwarded
  62. //
  63. VfPrintDumpIrpStack(irpSpNxt);
  64. } else if (irpSpNxt->MinorFunction == 0) {
  65. //
  66. // Next location is probably currently zero'd
  67. //
  68. VfPrintDumpIrpStack(irpSpCur);
  69. } else {
  70. DbgPrint("Next: >");
  71. VfPrintDumpIrpStack(irpSpNxt);
  72. DbgPrint("Current: ");
  73. VfPrintDumpIrpStack(irpSpCur);
  74. }
  75. } else if (VfUtilIsMemoryRangeReadable(irpSpCur, sizeof(IO_STACK_LOCATION), VFMP_INSTANT)) {
  76. VfPrintDumpIrpStack(irpSpCur);
  77. } else if (VfUtilIsMemoryRangeReadable(irpSpNxt, sizeof(IO_STACK_LOCATION), VFMP_INSTANT)) {
  78. VfPrintDumpIrpStack(irpSpNxt);
  79. }
  80. }