Source code of Windows XP (NT5)
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.

123 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation 1996-2001.
  5. //
  6. // File: caudit.cpp
  7. //
  8. // Contents: implementation of CConfigAudit
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "wsecmgr.h"
  13. #include "CAudit.h"
  14. #include "util.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CConfigAudit dialog
  22. CConfigAudit::CConfigAudit(UINT nTemplateID)
  23. : CAttribute(nTemplateID ? nTemplateID : IDD)
  24. {
  25. //{{AFX_DATA_INIT(CConfigAudit)
  26. m_fFailed = FALSE;
  27. m_fSuccessful = FALSE;
  28. //}}AFX_DATA_INIT
  29. m_pHelpIDs = (DWORD_PTR)a180HelpIDs;
  30. m_uTemplateResID = IDD;
  31. }
  32. void CConfigAudit::DoDataExchange(CDataExchange* pDX)
  33. {
  34. CAttribute::DoDataExchange(pDX);
  35. //{{AFX_DATA_MAP(CConfigAudit)
  36. DDX_Check(pDX, IDC_FAILED, m_fFailed);
  37. DDX_Check(pDX, IDC_SUCCESSFUL, m_fSuccessful);
  38. //}}AFX_DATA_MAP
  39. }
  40. BEGIN_MESSAGE_MAP(CConfigAudit, CAttribute)
  41. //{{AFX_MSG_MAP(CConfigAudit)
  42. ON_BN_CLICKED(IDC_FAILED, OnFailed)
  43. ON_BN_CLICKED(IDC_SUCCESSFUL, OnSuccessful)
  44. //}}AFX_MSG_MAP
  45. END_MESSAGE_MAP()
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CConfigAudit message handlers
  48. BOOL CConfigAudit::OnApply()
  49. {
  50. if ( !m_bReadOnly )
  51. {
  52. LONG_PTR dw = 0;
  53. UpdateData(TRUE);
  54. if (!m_bConfigure)
  55. dw = (LONG_PTR)ULongToPtr(SCE_NO_VALUE);
  56. else
  57. {
  58. if (m_fSuccessful)
  59. dw |= AUDIT_SUCCESS;
  60. if (m_fFailed)
  61. dw |= AUDIT_FAILURE;
  62. }
  63. m_pData->SetBase(dw);
  64. SetProfileInfo(m_pData->GetID(),dw,m_pData->GetBaseProfile());
  65. m_pData->Update(m_pSnapin);
  66. }
  67. return CAttribute::OnApply();
  68. }
  69. void
  70. CConfigAudit::Initialize(CResult * pResult)
  71. {
  72. CAttribute::Initialize(pResult);
  73. LONG_PTR dw = pResult->GetBase();
  74. m_bConfigure = (dw != (LONG_PTR)ULongToPtr(SCE_NO_VALUE));
  75. if (m_bConfigure)
  76. {
  77. SetInitialValue((DWORD_PTR)dw);
  78. }
  79. }
  80. void
  81. CConfigAudit::SetInitialValue(DWORD_PTR dw)
  82. {
  83. m_fSuccessful = (dw & AUDIT_SUCCESS) != 0;
  84. m_fFailed = (dw & AUDIT_FAILURE) != 0;
  85. }
  86. BOOL CConfigAudit::OnInitDialog()
  87. {
  88. CAttribute::OnInitDialog();
  89. AddUserControl(IDC_SUCCESSFUL);
  90. AddUserControl(IDC_FAILED);
  91. EnableUserControls(m_bConfigure);
  92. return TRUE; // return TRUE unless you set the focus to a control
  93. // EXCEPTION: OCX Property Pages should return FALSE
  94. }
  95. void CConfigAudit::OnFailed()
  96. {
  97. SetModified(TRUE);
  98. }
  99. void CConfigAudit::OnSuccessful()
  100. {
  101. SetModified(TRUE);
  102. }