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
1.8 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. dbgmsg.c
  5. Abstract:
  6. Contains debug code for dbgcon and vprintf support.
  7. MILLEN gets vprintf support.
  8. NT gets dbg conn support.
  9. Author:
  10. Scott Holden (sholden) 20-Oct-1999
  11. --*/
  12. #include <tcpipbase.h>
  13. #ifdef DEBUG_MSG
  14. // Everything off by default.
  15. uint DbgSettingsLevel = 0x00000000;
  16. uint DbgSettingsZone = 0x00000000;
  17. PDBGMSG g_pDbgMsg = DbgPrint;
  18. #if MILLEN
  19. ULONG g_fVprintf = 0;
  20. VOID
  21. InitVprintf();
  22. ULONG
  23. DbgMsg(
  24. PCH pszFormat,
  25. ...
  26. );
  27. VOID
  28. DebugMsgInit()
  29. {
  30. InitVprintf();
  31. if (g_fVprintf) {
  32. DbgPrint("TCPIP: vprintf is installed\n");
  33. DbgSettingsLevel = 0x000000ff;
  34. DbgSettingsZone = 0x00ffffff;
  35. g_pDbgMsg = DbgMsg;
  36. }
  37. return;
  38. }
  39. VOID
  40. InitVprintf()
  41. {
  42. //
  43. // Check if Vprintf is installed
  44. //
  45. _asm {
  46. mov eax, 0x0452
  47. mov edi, 0x0
  48. _emit 0xcd
  49. _emit 0x20
  50. _emit 0x46 // VMM Get DDB (Low)
  51. _emit 0x01 // VMM Get DDB (High)
  52. _emit 0x01 // VMM VxD ID (Low)
  53. _emit 0x00 // VMM VxD ID (High)
  54. mov [g_fVprintf], ecx
  55. }
  56. }
  57. ULONG
  58. DbgMsg(
  59. PCH pszFormat,
  60. ...
  61. )
  62. {
  63. _asm {
  64. lea esi, pszFormat
  65. mov eax, esi
  66. add eax,4
  67. push eax
  68. push [esi]
  69. _emit 0xcd
  70. _emit 0x20
  71. _emit 0x02 // Vprintf function
  72. _emit 0
  73. _emit 0x52 // Vprintf VxD ID (Low)
  74. _emit 0x04 // Vprintf VxD ID (High)
  75. add esp, 8
  76. }
  77. return 0;
  78. }
  79. #else // MILLEN
  80. VOID
  81. DebugMsgInit()
  82. {
  83. return;
  84. }
  85. #endif // !MILLEN
  86. #endif // DEBUG_MSG