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.

112 lines
3.0 KiB

  1. // pgtrace.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "regtrace.h"
  5. #ifdef _DEBUG
  6. #undef THIS_FILE
  7. static char BASED_CODE THIS_FILE[] = __FILE__;
  8. #endif
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CRegTracePage property page
  11. IMPLEMENT_DYNCREATE(CRegTracePage, CRegPropertyPage)
  12. CRegTracePage::CRegTracePage() : CRegPropertyPage(CRegTracePage::IDD)
  13. {
  14. //{{AFX_DATA_INIT(CRegTracePage)
  15. m_fErrorTrace = FALSE;
  16. m_fDebugTrace = FALSE;
  17. m_fFatalTrace = FALSE;
  18. m_fMsgTrace = FALSE;
  19. m_fStateTrace = FALSE;
  20. m_fFunctTrace = FALSE;
  21. //}}AFX_DATA_INIT
  22. }
  23. CRegTracePage::~CRegTracePage()
  24. {
  25. }
  26. void CRegTracePage::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CPropertyPage::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(CRegTracePage)
  30. DDX_Check(pDX, IDC_ERROR, m_fErrorTrace);
  31. DDX_Check(pDX, IDC_DEBUG, m_fDebugTrace);
  32. DDX_Check(pDX, IDC_FATAL, m_fFatalTrace);
  33. DDX_Check(pDX, IDC_MESSAGE, m_fMsgTrace);
  34. DDX_Check(pDX, IDC_STATE, m_fStateTrace);
  35. DDX_Check(pDX, IDC_FUNCTION, m_fFunctTrace);
  36. //}}AFX_DATA_MAP
  37. }
  38. BEGIN_MESSAGE_MAP(CRegTracePage, CPropertyPage)
  39. //{{AFX_MSG_MAP(CRegTracePage)
  40. ON_BN_CLICKED(IDC_DEBUG, OnClick)
  41. ON_BN_CLICKED(IDC_ERROR, OnClick)
  42. ON_BN_CLICKED(IDC_FATAL, OnClick)
  43. ON_BN_CLICKED(IDC_FUNCTION, OnClick)
  44. ON_BN_CLICKED(IDC_MESSAGE, OnClick)
  45. ON_BN_CLICKED(IDC_STATE, OnClick)
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. BOOL CRegTracePage::InitializePage()
  49. {
  50. DWORD dwEnabledTraces;
  51. if ( !App.GetTraceRegDword( "EnabledTraces", &dwEnabledTraces ) )
  52. {
  53. dwEnabledTraces = 0;
  54. App.SetTraceRegDword( "AsyncThreadPriority", dwEnabledTraces );
  55. }
  56. m_fDebugTrace = dwEnabledTraces & DEBUG_TRACE_MASK ? TRUE : FALSE ;
  57. m_fFatalTrace = dwEnabledTraces & FATAL_TRACE_MASK ? TRUE : FALSE ;
  58. m_fErrorTrace = dwEnabledTraces & ERROR_TRACE_MASK ? TRUE : FALSE ;
  59. m_fStateTrace = dwEnabledTraces & STATE_TRACE_MASK ? TRUE : FALSE ;
  60. m_fFunctTrace = dwEnabledTraces & FUNCT_TRACE_MASK ? TRUE : FALSE ;
  61. m_fMsgTrace = dwEnabledTraces & MESSAGE_TRACE_MASK ? TRUE : FALSE ;
  62. return TRUE;
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CRegTracePage message handlers
  66. BOOL CRegTracePage::OnInitDialog()
  67. {
  68. CPropertyPage::OnInitDialog();
  69. SetModified( FALSE );
  70. return TRUE; // return TRUE unless you set the focus to a control
  71. // EXCEPTION: OCX Property Pages should return FALSE
  72. }
  73. void CRegTracePage::OnClick()
  74. {
  75. SetModified( TRUE );
  76. }
  77. void CRegTracePage::OnOK()
  78. {
  79. DWORD dwEnabledTraces = 0;
  80. dwEnabledTraces |= m_fDebugTrace ? DEBUG_TRACE_MASK : 0;
  81. dwEnabledTraces |= m_fFatalTrace ? FATAL_TRACE_MASK : 0;
  82. dwEnabledTraces |= m_fErrorTrace ? ERROR_TRACE_MASK : 0;
  83. dwEnabledTraces |= m_fStateTrace ? STATE_TRACE_MASK : 0;
  84. dwEnabledTraces |= m_fFunctTrace ? FUNCT_TRACE_MASK : 0;
  85. dwEnabledTraces |= m_fMsgTrace ? MESSAGE_TRACE_MASK : 0;
  86. App.SetTraceRegDword( "EnabledTraces", dwEnabledTraces );
  87. SetModified( FALSE );
  88. }