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.

78 lines
1.8 KiB

  1. /* Copyright (c) 1992 Microsoft Corporation */
  2. /*
  3. debug.c
  4. Support code for the dprintf routines.
  5. Note that all of this is conditional on the DBG flag
  6. */
  7. #include <windows.h>
  8. #include <mmsystem.h>
  9. #include "mmsys.h"
  10. #include "list.h"
  11. #include "stdio.h"
  12. #include "mciseq.h" // private include file
  13. #include <stdarg.h>
  14. #if DBG
  15. #ifdef MEDIA_DEBUG
  16. int mciseqDebugLevel = 0;
  17. #else
  18. int mciseqDebugLevel = 0;
  19. #endif
  20. /***************************************************************************
  21. @doc INTERNAL
  22. @api void | mciseqDbgOut | This function sends output to the current
  23. debug output device.
  24. @parm LPSTR | lpszFormat | Pointer to a printf style format string.
  25. @parm ??? | ... | Args.
  26. @rdesc There is no return value.
  27. ****************************************************************************/
  28. void mciseqDbgOut(LPSTR lpszFormat, ...)
  29. {
  30. UINT n;
  31. char buf[256];
  32. va_list va;
  33. n = wsprintf(buf, "MCISEQ: (tid %x) ", GetCurrentThreadId());
  34. va_start(va, lpszFormat);
  35. n += vsprintf(buf+n, lpszFormat, va);
  36. va_end(va);
  37. buf[n++] = '\n';
  38. buf[n] = 0;
  39. OutputDebugStringA(buf);
  40. Sleep(10); // let terminal catch up
  41. }
  42. #endif // DBG
  43. /**************************************************************************
  44. @doc INTERNAL
  45. @api void | mciseqSetDebugLevel | Set the current debug level
  46. @parm int | iLevel | The new level to set
  47. @rdesc There is no return value
  48. **************************************************************************/
  49. void mciseqSetDebugLevel(int level)
  50. {
  51. #if DBG
  52. mciseqDebugLevel = level;
  53. dprintf(("debug level set to %d", mciseqDebugLevel));
  54. #endif
  55. }