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.

94 lines
2.1 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995.
  5. //
  6. // FILE: DEBUG.C
  7. //
  8. // DESCRIPTION:
  9. //
  10. // Debug support for SHCOMPUI.DLL.
  11. //
  12. //
  13. // REVISIONS:
  14. //
  15. // Date Description Programmer
  16. // ---------- --------------------------------------------------- ----------
  17. // 09/15/95 Initial creation. brianau
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #if defined(DEBUG) || defined(DBG)
  21. #include "debug.h"
  22. #ifdef WIN32
  23. #define DEBUG_BREAK _try { DebugBreak(); } _except (EXCEPTION_EXECUTE_HANDLER) {;}
  24. #else
  25. #define DEBUG_BREAK _asm { int 3 }
  26. #endif
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //
  29. // FUNCTION: DbgOut
  30. //
  31. // DESCRIPTION:
  32. //
  33. // Display a message string on the debugger output terminal.
  34. // The function accepts a variable length printf-style arg list.
  35. // A terminating newline is appended to the message string.
  36. //
  37. // ARGUMENTS:
  38. //
  39. // fmt
  40. // printf-style format string.
  41. //
  42. // ...
  43. // Variable-length arg list.
  44. //
  45. // RETURNS:
  46. //
  47. // Nothing.
  48. //
  49. ///////////////////////////////////////////////////////////////////////////////
  50. void DbgOut(LPCTSTR fmt, ...)
  51. {
  52. TCHAR szBuf[512];
  53. va_list args;
  54. va_start(args, fmt);
  55. ASSERT(NULL != fmt);
  56. wvsprintf(szBuf, fmt, args);
  57. lstrcat(szBuf, __TEXT("\r\n"));
  58. va_end(args);
  59. OutputDebugString(szBuf);
  60. }
  61. void WINAPI AssertFailed(LPCTSTR pszFile, int line)
  62. {
  63. LPCTSTR psz;
  64. TCHAR ach[256];
  65. static TCHAR szAssertFailed[] = __TEXT("SHCOMPUI: assert %s, line %d\r\n");
  66. // Strip off path info from filename string, if present.
  67. //
  68. for (psz = pszFile + lstrlen(pszFile); psz != pszFile; psz=CharPrev(pszFile, psz))
  69. {
  70. if ((CharPrev(pszFile, psz)!= (psz-2)) && *(psz - 1) == TEXT('\\'))
  71. break;
  72. }
  73. DbgOut(szAssertFailed, psz, line);
  74. DEBUG_BREAK
  75. }
  76. #endif // #ifdef DBG
  77.