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.

104 lines
4.1 KiB

  1. /***************************************************************************
  2. Name : DebugBinary
  3. Purpose : Debug dump an array of bytes
  4. Parameters: cb = number of bytes to dump
  5. lpb -> bytes to dump
  6. Returns : none
  7. Comment :
  8. ***************************************************************************/
  9. #define DEBUG_NUM_BINARY_LINES 2
  10. VOID DebugBinary(UINT cb, LPBYTE lpb) {
  11. UINT cbLines = 0;
  12. #if (DEBUG_NUM_BINARY_LINES != 0)
  13. UINT cbi;
  14. while (cb && cbLines < DEBUG_NUM_BINARY_LINES) {
  15. cbi = min(cb, 16);
  16. cb -= cbi;
  17. switch (cbi) {
  18. case 16:
  19. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  20. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  21. lpb[8], lpb[9], lpb[10], lpb[11], lpb[12], lpb[13], lpb[14],
  22. lpb[15]);
  23. break;
  24. case 1:
  25. DebugTrace("%02x\n", lpb[0]);
  26. break;
  27. case 2:
  28. DebugTrace("%02x %02x\n", lpb[0], lpb[1]);
  29. break;
  30. case 3:
  31. DebugTrace("%02x %02x %02x\n", lpb[0], lpb[1], lpb[2]);
  32. break;
  33. case 4:
  34. DebugTrace("%02x %02x %02x %02x\n", lpb[0], lpb[1], lpb[2], lpb[3]);
  35. break;
  36. case 5:
  37. DebugTrace("%02x %02x %02x %02x %02x\n", lpb[0], lpb[1], lpb[2], lpb[3],
  38. lpb[4]);
  39. break;
  40. case 6:
  41. DebugTrace("%02x %02x %02x %02x %02x %02x\n",
  42. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5]);
  43. break;
  44. case 7:
  45. DebugTrace("%02x %02x %02x %02x %02x %02x %02x\n",
  46. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6]);
  47. break;
  48. case 8:
  49. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x\n",
  50. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7]);
  51. break;
  52. case 9:
  53. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  54. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  55. lpb[8]);
  56. break;
  57. case 10:
  58. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  59. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  60. lpb[8], lpb[9]);
  61. break;
  62. case 11:
  63. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  64. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  65. lpb[8], lpb[9], lpb[10]);
  66. break;
  67. case 12:
  68. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  69. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  70. lpb[8], lpb[9], lpb[10], lpb[11]);
  71. break;
  72. case 13:
  73. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  74. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  75. lpb[8], lpb[9], lpb[10], lpb[11], lpb[12]);
  76. break;
  77. case 14:
  78. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  79. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  80. lpb[8], lpb[9], lpb[10], lpb[11], lpb[12], lpb[13]);
  81. break;
  82. case 15:
  83. DebugTrace("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
  84. lpb[0], lpb[1], lpb[2], lpb[3], lpb[4], lpb[5], lpb[6], lpb[7],
  85. lpb[8], lpb[9], lpb[10], lpb[11], lpb[12], lpb[13], lpb[14]);
  86. break;
  87. }
  88. lpb += cbi;
  89. cbLines++;
  90. }
  91. if (cb) {
  92. DebugTrace("<etc.>"); //
  93. }
  94. #endif
  95. }