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.

46 lines
1.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: myassert.hxx
  7. //
  8. // Contents: Simple assert code
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // Coupling:
  15. //
  16. // Notes:
  17. //
  18. // History: 9-18-1997 benl Created
  19. //
  20. //----------------------------------------------------------------------------
  21. #ifndef _CMYASSERT
  22. #define _CMYASSERT
  23. #endif
  24. #include <winbase.h>
  25. #ifdef MY_ASSERTS
  26. #define MYASSERT(cond) \
  27. if (!(cond)) \
  28. { \
  29. CHAR buffer[1024]; \
  30. _snprintf(buffer, 1024, "Assert in %s at line %d: %s\n", \
  31. __FILE__, __LINE__, #cond); \
  32. if (IsDebuggerPresent()) \
  33. { \
  34. OutputDebugStringA(buffer); \
  35. DebugBreak(); \
  36. } \
  37. fprintf(stderr, buffer); \
  38. ::ExitProcess(2); \
  39. }
  40. #else
  41. #define MYASSERT(cond)
  42. #endif