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.

84 lines
1.6 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: debug.c
  3. *
  4. * debug helpers routine
  5. *
  6. * Copyright (c) 1992 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #include "precomp.h"
  10. #if DBG
  11. ULONG DebugLevel = 0;
  12. #endif // DBG
  13. /*****************************************************************************
  14. *
  15. * Routine Description:
  16. *
  17. * This function is variable-argument, level-sensitive debug print
  18. * routine.
  19. * If the specified debug level for the print statement is lower or equal
  20. * to the current debug level, the message will be printed.
  21. *
  22. * Arguments:
  23. *
  24. * DebugPrintLevel - Specifies at which debugging level the string should
  25. * be printed
  26. *
  27. * DebugMessage - Variable argument ascii c string
  28. *
  29. * Return Value:
  30. *
  31. * None.
  32. *
  33. ***************************************************************************/
  34. #if DRIVER_5465
  35. #define STANDARD_DEBUG_PREFIX "CL5465:"
  36. #else // if DRIVER_5465
  37. #define STANDARD_DEBUG_PREFIX "CL546X:"
  38. #endif // if DRIVER_5465
  39. VOID
  40. DebugPrint(
  41. ULONG DebugPrintLevel,
  42. PCHAR DebugMessage,
  43. ...
  44. )
  45. {
  46. #if DBG
  47. va_list ap;
  48. va_start(ap, DebugMessage);
  49. if (DebugPrintLevel <= DebugLevel) {
  50. #ifdef WINNT_VER40
  51. EngDebugPrint(STANDARD_DEBUG_PREFIX, DebugMessage, ap);
  52. #else
  53. char buffer[128];
  54. vsprintf(buffer, DebugMessage, ap);
  55. OutputDebugStringA(buffer);
  56. #endif
  57. }
  58. va_end(ap);
  59. #endif // DBG
  60. } // DebugPrint()
  61.