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.

86 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. vs_assert.hxx
  5. Abstract:
  6. Various macros for correctly defining the ASSERTS in VSS and ATL code.
  7. In order to use ASSERTs in VSS and ATL you must:
  8. * add -D_DEBUG -D_ATL_NO_DEBUG_CRT into the compiling options on Checked builds
  9. * Include this file _before_ atlbase.h and vs_inc.hxx whenever you use ATL traces or BS_ASSERT
  10. This file will "hook" the ATL asserts and BS_ASSERT and make them visible.
  11. Author:
  12. Adi Oltean [aoltean] 26/04/2000
  13. Revision History:
  14. Name Date Comments
  15. aoltean 26/04/2000 Creating this file based on BrianB's ASSERTS
  16. --*/
  17. #ifndef __VSS_ASSRT_HXX__
  18. #define __VSS_ASSRT_HXX__
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif
  22. #include <wtypes.h>
  23. ////////////////////////////////////////////////////////////////////////
  24. // Standard foo for file name aliasing. This code block must be after
  25. // all includes of VSS header files.
  26. //
  27. #ifdef VSS_FILE_ALIAS
  28. #undef VSS_FILE_ALIAS
  29. #endif
  30. #define VSS_FILE_ALIAS "INCASRTH"
  31. //
  32. ////////////////////////////////////////////////////////////////////////
  33. #ifdef _DEBUG
  34. #define _ASSERTE(x) { if (!(x)) AssertFail(__FILE__, __LINE__, #x ); }
  35. #define assert(x) _ASSERTE(x)
  36. #define ATLASSERT(x) _ASSERTE(x)
  37. #define BS_ASSERT(x) _ASSERTE(x)
  38. #define BS_VERIFY(x) _ASSERTE(x)
  39. #else
  40. #define _ASSERTE(x)
  41. #define assert(x)
  42. #define ATLASSERT(x)
  43. #define BS_ASSERT(x)
  44. #define BS_VERIFY(x) ((x)? TRUE: FALSE)
  45. #endif
  46. enum _VSS_DEBUG_REPORT_FLAGS
  47. {
  48. VSS_DBG_TO_DEBUG_CONSOLE = 0x00000002, // Assert displayed as a string at console debug
  49. VSS_DBG_MESSAGE_BOX = 0x00000004, // Assert displayed as a message box
  50. };
  51. // Used to report the asserts
  52. void AssertFail(LPCSTR FileName, UINT LineNumber, LPCSTR Condition);
  53. // Used to set the reporting mode.
  54. // By default the reporting mode uses a message box and reporting to the debug console.
  55. void VssSetDebugReport( LONG lDebugReportFlags );
  56. #endif // __VSS_ASSRT_HXX__