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.

95 lines
3.3 KiB

  1. /*******************************************************************************
  2. * DXTDbg.h *
  3. *----------*
  4. * Description:
  5. * This header file contains the custom error codes specific to DX Transforms
  6. *-------------------------------------------------------------------------------
  7. * Created By: EDC Date: 03/31/98
  8. * Copyright (C) 1998 Microsoft Corporation
  9. * All Rights Reserved
  10. *
  11. *-------------------------------------------------------------------------------
  12. * Revisions:
  13. *
  14. *******************************************************************************/
  15. #ifndef DXTDbg_h
  16. #define DXTDbg_h
  17. #ifndef _INC_CRTDBG
  18. #include <crtdbg.h>
  19. #endif
  20. #define DXTDBG_FUNC_TRACE 1
  21. #define DXTDBG_INFO 2
  22. class CDXTDbgFlags
  23. {
  24. public:
  25. DWORD m_F;
  26. CDXTDbgFlags()
  27. {
  28. m_F = 0;
  29. HKEY hkResult;
  30. DWORD dwDisposition;
  31. if( RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("DXTDbgFlags"), 0, NULL, 0,
  32. KEY_ALL_ACCESS, NULL, &hkResult, &dwDisposition )
  33. == ERROR_SUCCESS )
  34. {
  35. if( dwDisposition == REG_CREATED_NEW_KEY )
  36. {
  37. RegSetValueEx( hkResult, _T("Flags"), NULL, REG_DWORD, (PBYTE)&m_F, sizeof( m_F ) );
  38. }
  39. else
  40. {
  41. DWORD BuffSize = sizeof( m_F );
  42. RegQueryValueEx( hkResult, _T("Flags"), NULL, NULL, (PBYTE)&m_F, &BuffSize );
  43. }
  44. RegCloseKey( hkResult );
  45. }
  46. }
  47. };
  48. class CDXTDbgScope
  49. {
  50. public:
  51. static CDXTDbgFlags m_DebugFlags;
  52. PCHAR m_pFuncName;
  53. CDXTDbgScope( PCHAR pFuncName )
  54. {
  55. m_pFuncName = pFuncName;
  56. if( m_DebugFlags.m_F & DXTDBG_FUNC_TRACE )
  57. {
  58. _RPT1( _CRT_WARN, "\nEntering Function: %s\n", m_pFuncName );
  59. }
  60. }
  61. ~CDXTDbgScope()
  62. {
  63. if( m_DebugFlags.m_F & DXTDBG_FUNC_TRACE )
  64. {
  65. _RPT1( _CRT_WARN, "Leaving Function: %s\n", m_pFuncName );
  66. }
  67. }
  68. };
  69. //=== User macros ==============================================================
  70. #ifdef _DEBUG
  71. #define DXTDBG_FUNC( name ) CDXTDbgScope DXTDbgScope( name );
  72. #define DXTDBG_MSG0( reportType, format ) \
  73. if( DXTDbgScope.m_DebugFlags.m_F & DXTDBG_INFO ) _RPTF0( reportType, format );
  74. #define DXTDBG_MSG1( reportType, format, arg1 ) \
  75. if( DXTDbgScope.m_DebugFlags.m_F & DXTDBG_INFO ) _RPTF1( reportType, format, arg1 )
  76. #define DXTDBG_MSG2( reportType, format, arg1, arg2 ) \
  77. if( DXTDbgScope.m_DebugFlags.m_F & DXTDBG_INFO ) _RPTF2( reportType, format, arg1, arg2 )
  78. #define DXTDBG_MSG3( reportType, format, arg1, arg2, arg3 ) \
  79. if( DXTDbgScope.m_DebugFlags.m_F & DXTDBG_INFO ) _RPTF3( reportType, format, arg1, arg2, arg3 )
  80. #define DXTDBG_MSG4( reportType, format, arg1, arg2, arg3, arg4 ) \
  81. if( DXTDbgScope.m_DebugFlags.m_F & DXTDBG_INFO ) _RPTF4( reportType, format, arg1, arg2, arg3, arg4 )
  82. #else
  83. #define DXTDBG_FUNC( name )
  84. #define DXTDBG_MSG0( reportType, format )
  85. #define DXTDBG_MSG1( reportType, format, arg1 )
  86. #define DXTDBG_MSG2( reportType, format, arg1, arg2 )
  87. #define DXTDBG_MSG3( reportType, format, arg1, arg2, arg3 )
  88. #define DXTDBG_MSG4( reportType, format, arg1, arg2, arg3, arg4 )
  89. #endif
  90. #endif //--- This must be the last line in the file