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.

57 lines
1.4 KiB

  1. #include "pch.h"
  2. #include "extra.h"
  3. // Debugging variables
  4. UINT g_uBreakFlags = 0; // Controls when to int 3
  5. UINT g_uTraceFlags = 0; // Controls what trace messages are spewed
  6. UINT g_uDumpFlags = 0; // Controls what structs get dumped
  7. char const FAR c_szAssertFailed[] = "BRIEFCASE Assertion failed in %s on line %d\r\n";
  8. /*----------------------------------------------------------
  9. Purpose: Returns a string safe enough to print...and I don't
  10. mean swear words.
  11. Returns: String ptr
  12. Cond: --
  13. */
  14. LPCSTR PUBLIC Dbg_SafeStr(LPCSTR psz)
  15. {
  16. if (psz)
  17. return psz;
  18. else
  19. return "NULL";
  20. }
  21. void PUBLIC BrfAssertFailed(
  22. LPCSTR pszFile,
  23. int line)
  24. {
  25. LPCSTR psz;
  26. char ach[256];
  27. UINT uBreakFlags;
  28. // tHACK ENTEREXCLUSIVE()
  29. {
  30. uBreakFlags = g_uBreakFlags;
  31. }
  32. // LEAVEEXCLUSIVE()
  33. // Strip off path info from filename string, if present.
  34. //
  35. for (psz = pszFile + lstrlen(pszFile); psz != pszFile; psz=AnsiPrev(pszFile, psz))
  36. {
  37. #ifdef DBCS
  38. if ((AnsiPrev(pszFile, psz) != (psz-2)) && *(psz - 1) == '\\')
  39. #else
  40. if (*(psz - 1) == '\\')
  41. #endif
  42. break;
  43. }
  44. wsprintf(ach, c_szAssertFailed, psz, line);
  45. OutputDebugString(ach);
  46. if (IsFlagSet(uBreakFlags, BF_ONVALIDATE))
  47. DebugBreak();
  48. }