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.

153 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. procirps.c
  5. Abstract:
  6. Dumps all IRPs issued by the specified process.
  7. Author:
  8. Keith Moore (keithmo) 12-Nov-1999
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. //
  15. // Private prototypes.
  16. //
  17. BOOLEAN
  18. DumpThreadCallback(
  19. IN PLIST_ENTRY RemoteListEntry,
  20. IN PVOID Context
  21. );
  22. BOOLEAN
  23. DumpIrpCallback(
  24. IN PLIST_ENTRY RemoteListEntry,
  25. IN PVOID Context
  26. );
  27. //
  28. // Public functions.
  29. //
  30. DECLARE_API( procirps )
  31. /*++
  32. Routine Description:
  33. Dumps all IRPs issued by the specified process.
  34. Arguments:
  35. None.
  36. Return Value:
  37. None.
  38. --*/
  39. {
  40. ULONG_PTR address = 0;
  41. SNAPSHOT_EXTENSION_DATA();
  42. //
  43. // Snag the address from the command line.
  44. //
  45. address = GetExpression( args );
  46. if (address == 0)
  47. {
  48. PrintUsage( "procirps" );
  49. return;
  50. }
  51. //
  52. // Enumerate the threads.
  53. //
  54. EnumLinkedList(
  55. (PLIST_ENTRY)REMOTE_OFFSET( address, EPROCESS, Pcb.ThreadListHead ),
  56. &DumpThreadCallback,
  57. NULL
  58. );
  59. } // procirps
  60. //
  61. // Private functions.
  62. //
  63. BOOLEAN
  64. DumpThreadCallback(
  65. IN PLIST_ENTRY RemoteListEntry,
  66. IN PVOID Context
  67. )
  68. {
  69. ULONG_PTR threadAddress;
  70. threadAddress = (ULONG_PTR)CONTAINING_RECORD(
  71. RemoteListEntry,
  72. KTHREAD,
  73. ThreadListEntry
  74. );
  75. //
  76. // Enumerate the IRPs.
  77. //
  78. EnumLinkedList(
  79. (PLIST_ENTRY)REMOTE_OFFSET( threadAddress, ETHREAD, IrpList ),
  80. &DumpIrpCallback,
  81. NULL
  82. );
  83. return TRUE;
  84. } // DumpThreadCallback
  85. BOOLEAN
  86. DumpIrpCallback(
  87. IN PLIST_ENTRY RemoteListEntry,
  88. IN PVOID Context
  89. )
  90. {
  91. ULONG_PTR address;
  92. CHAR temp[sizeof("1234567812345678 f")];
  93. address = (ULONG_PTR)CONTAINING_RECORD(
  94. RemoteListEntry,
  95. IRP,
  96. ThreadListEntry
  97. );
  98. sprintf( temp, "%p f", address );
  99. CallExtensionRoutine( "irp", temp );
  100. return TRUE;
  101. } // DumpIrpCallback