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.

118 lines
3.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation 1996-2001.
  5. //
  6. // File: lret.cpp
  7. //
  8. // Contents: implementation of CLocalPolRight
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "wsecmgr.h"
  13. #include "resource.h"
  14. #include "snapmgr.h"
  15. #include "attr.h"
  16. #include "lret.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. // CLocalPolRet dialog
  25. CLocalPolRet::CLocalPolRet()
  26. : CConfigRet(IDD)
  27. {
  28. //{{AFX_DATA_INIT(CLocalPolRet)
  29. //}}AFX_DATA_INIT
  30. m_pHelpIDs = (DWORD_PTR)a229HelpIDs;
  31. m_uTemplateResID = IDD;
  32. }
  33. BOOL CLocalPolRet::OnApply()
  34. {
  35. if ( !m_bReadOnly )
  36. {
  37. LONG_PTR dw = 0;
  38. int status = 0;
  39. UpdateData(TRUE);
  40. if (!m_bConfigure)
  41. dw = (LONG_PTR)ULongToPtr(SCE_NO_VALUE);
  42. else
  43. {
  44. switch(m_rabRetention)
  45. {
  46. case RADIO_RETAIN_BY_DAYS:
  47. dw = SCE_RETAIN_BY_DAYS;
  48. break;
  49. case RADIO_RETAIN_AS_NEEDED:
  50. dw = SCE_RETAIN_AS_NEEDED;
  51. break;
  52. case RADIO_RETAIN_MANUALLY:
  53. dw = SCE_RETAIN_MANUALLY;
  54. break;
  55. default:
  56. break;
  57. }
  58. }
  59. PEDITTEMPLATE pLocalDeltaTemplate = m_pSnapin->GetTemplate(GT_LOCAL_POLICY_DELTA,AREA_SECURITY_POLICY);
  60. if (pLocalDeltaTemplate)
  61. pLocalDeltaTemplate->LockWriteThrough();
  62. //
  63. // Check dependecies for this item.
  64. //
  65. if(DDWarn.CheckDependencies(
  66. (DWORD)dw) == ERROR_MORE_DATA )
  67. {
  68. //
  69. // If it fails and the user presses cancel then we will exit and do nothing.
  70. //
  71. CThemeContextActivator activator;
  72. if( DDWarn.DoModal() != IDOK)
  73. return FALSE;
  74. //
  75. // If the user presses autoset then we set the item and update the result panes.
  76. //
  77. for(int i = 0; i < DDWarn.GetFailedCount(); i++)
  78. {
  79. PDEPENDENCYFAILED pItem = DDWarn.GetFailedInfo(i);
  80. if(pItem && pItem->pResult )
  81. {
  82. pItem->pResult->SetBase( pItem->dwSuggested );
  83. status = m_pSnapin->SetLocalPolInfo(pItem->pResult->GetID(),
  84. pItem->dwSuggested);
  85. pItem->pResult->Update(m_pSnapin, FALSE);
  86. }
  87. }
  88. }
  89. m_pData->SetBase(dw);
  90. status = m_pSnapin->SetLocalPolInfo(m_pData->GetID(),dw);
  91. if (SCE_ERROR_VALUE != status)
  92. {
  93. m_pData->SetStatus(status);
  94. m_pData->Update(m_pSnapin, TRUE);
  95. }
  96. if (pLocalDeltaTemplate)
  97. pLocalDeltaTemplate->UnLockWriteThrough();
  98. }
  99. // Class hieirarchy is bad - call CAttribute base method directly
  100. return CAttribute::OnApply();
  101. }