Source code of Windows XP (NT5)
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.

73 lines
1.4 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_ALL;
  18. DWORD gdwDbgLevel = DBG_LEV_ERROR | DBG_LEV_FATAL | DBG_CACHE_ERROR;
  19. VOID CDECL DbgMsgOut(
  20. LPCTSTR lpszMsgFormat,
  21. ...)
  22. {
  23. TCHAR szMsgText[DBG_MAX_TEXT];
  24. wvsprintf(szMsgText,
  25. lpszMsgFormat,
  26. (LPSTR)(((LPSTR)(&lpszMsgFormat)) + sizeof(lpszMsgFormat)));
  27. lstrcat(szMsgText, g_szNewLine);
  28. OutputDebugString(szMsgText);
  29. }
  30. LPTSTR DbgGetTime (void)
  31. {
  32. static TCHAR szTime[30];
  33. SYSTEMTIME curTime;
  34. GetLocalTime (&curTime);
  35. wsprintf (szTime, TEXT ("%02d:%02d:%02d.%03d "), curTime.wHour, curTime.wMinute,
  36. curTime.wSecond, curTime.wMilliseconds);
  37. return szTime;
  38. }
  39. VOID DbgMsg (LPCTSTR pszFormat, ...)
  40. {
  41. TCHAR szBuf[1024];
  42. LPTSTR pBuf;
  43. va_list vargs;
  44. va_start( vargs, pszFormat );
  45. wvsprintf( szBuf, pszFormat, vargs );
  46. va_end( vargs );
  47. OutputDebugString (DbgGetTime ());
  48. OutputDebugString (szBuf);
  49. OutputDebugString (TEXT ("\n"));
  50. }
  51. #endif