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.

118 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. mdl.c
  5. Abstract:
  6. Dumps MDLs.
  7. Author:
  8. Keith Moore (keithmo) 20-Oct-1999
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. //
  15. // Public functions.
  16. //
  17. DECLARE_API( mdl )
  18. /*++
  19. Routine Description:
  20. Dumps MDLs.
  21. Arguments:
  22. None.
  23. Return Value:
  24. None.
  25. --*/
  26. {
  27. ULONG_PTR address = 0;
  28. ULONG result;
  29. MDL localMdl;
  30. PSTR command;
  31. ULONG_PTR maxBytesToDump = 0;
  32. ULONG64 address64 = 0, maxBytesToDump64 = 0;
  33. SNAPSHOT_EXTENSION_DATA();
  34. //
  35. // Snag the address from the command line.
  36. //
  37. if (! GetExpressionEx(args, &address64, &args))
  38. {
  39. PrintUsage( "mdl" );
  40. return;
  41. }
  42. GetExpressionEx(args, &maxBytesToDump64, &args);
  43. address = (ULONG_PTR) address64;
  44. maxBytesToDump = (ULONG_PTR) maxBytesToDump64;
  45. command = "mdl: ";
  46. for (;;)
  47. {
  48. //
  49. // Read the mdl.
  50. //
  51. if (!ReadMemory(
  52. address,
  53. &localMdl,
  54. sizeof(localMdl),
  55. &result
  56. ))
  57. {
  58. dprintf(
  59. "mdl: cannot read MDL @ %p\n",
  60. address
  61. );
  62. return;
  63. }
  64. DumpMdl(
  65. "",
  66. command,
  67. address,
  68. &localMdl,
  69. (ULONG)maxBytesToDump
  70. );
  71. address = (ULONG_PTR)localMdl.Next;
  72. if (address == 0)
  73. {
  74. break;
  75. }
  76. dprintf( "\n" );
  77. command = " ";
  78. }
  79. } // mdl