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.

81 lines
1.7 KiB

  1. /*****************************************************************************\
  2. * MODULE: debug.c
  3. *
  4. * Debugging routines. This is only linked in on DEBUG builds.
  5. *
  6. *
  7. * Copyright (C) 1996-1997 Microsoft Corporation
  8. * Copyright (C) 1996-1997 Hewlett Packard
  9. *
  10. * History:
  11. * 07-Oct-1996 HWP-Guys Initiated port from win95 to winNT
  12. *
  13. \*****************************************************************************/
  14. #include "precomp.h"
  15. #include "priv.h"
  16. #ifdef DEBUG
  17. DWORD gdwDbgLevel = DBG_LEV_ERROR | DBG_LEV_FATAL | DBG_CACHE_ERROR;
  18. VOID
  19. CDECL
  20. DbgMsgOut(
  21. LPCTSTR lpszMsgFormat,
  22. ...
  23. )
  24. {
  25. TCHAR szMsgText[DBG_MAX_TEXT];
  26. va_list pArgs;
  27. va_start(pArgs, lpszMsgFormat);
  28. StringCchVPrintf(szMsgText,
  29. COUNTOF(szMsgText),
  30. lpszMsgFormat,
  31. pArgs);
  32. OutputDebugString(szMsgText);
  33. OutputDebugString(TEXT("\n"));
  34. va_end(pArgs);
  35. }
  36. VOID
  37. CDECL
  38. DbgMsg (
  39. LPCTSTR pszFormat,
  40. ...
  41. )
  42. {
  43. TCHAR szBuf[DBG_MAX_TEXT];
  44. TCHAR szTime[30];
  45. SYSTEMTIME curTime;
  46. va_list pArgs;
  47. va_start(pArgs, pszFormat);
  48. GetLocalTime (&curTime);
  49. StringCchPrintf(szTime,
  50. COUNTOF(szTime),
  51. TEXT ("%02d:%02d:%02d.%03d "),
  52. curTime.wHour,
  53. curTime.wMinute,
  54. curTime.wSecond,
  55. curTime.wMilliseconds);
  56. StringCchVPrintf(szBuf, COUNTOF(szBuf), pszFormat, pArgs);
  57. OutputDebugString(szTime);
  58. OutputDebugString(szBuf);
  59. OutputDebugString(TEXT ("\n"));
  60. va_end(pArgs);
  61. }
  62. #endif