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.

135 lines
3.0 KiB

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