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.

212 lines
5.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. Servpp.h
  7. Server properties implementation file
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "mmpolpp.h"
  12. #include "spdutil.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. //
  20. // CMmPolicyProperties holder
  21. //
  22. /////////////////////////////////////////////////////////////////////////////
  23. CMmPolicyProperties::CMmPolicyProperties
  24. (
  25. ITFSNode * pNode,
  26. IComponentData * pComponentData,
  27. ITFSComponentData * pTFSCompData,
  28. CMmPolicyInfo * pPolInfo,
  29. ISpdInfo * pSpdInfo,
  30. LPCTSTR pszSheetName
  31. ) : CPropertyPageHolderBase(pNode, pComponentData, pszSheetName)
  32. {
  33. //ASSERT(pFolderNode == GetContainerNode());
  34. m_bAutoDeletePages = FALSE; // we have the pages as embedded members
  35. AddPageToList((CPropertyPageBase*) &m_pageGeneral);
  36. Assert(pTFSCompData != NULL);
  37. m_spTFSCompData.Set(pTFSCompData);
  38. m_spSpdInfo.Set(pSpdInfo);
  39. m_PolInfo = *pPolInfo;
  40. }
  41. CMmPolicyProperties::~CMmPolicyProperties()
  42. {
  43. RemovePageFromList((CPropertyPageBase*) &m_pageGeneral, FALSE);
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CMmPolGenProp property page
  47. IMPLEMENT_DYNCREATE(CMmPolGenProp, CPropertyPageBase)
  48. CMmPolGenProp::CMmPolGenProp() : CPropertyPageBase(CMmPolGenProp::IDD)
  49. {
  50. //{{AFX_DATA_INIT(CMmPolGenProp)
  51. // NOTE: the ClassWizard will add member initialization here
  52. //}}AFX_DATA_INIT
  53. }
  54. CMmPolGenProp::~CMmPolGenProp()
  55. {
  56. }
  57. void CMmPolGenProp::DoDataExchange(CDataExchange* pDX)
  58. {
  59. CPropertyPageBase::DoDataExchange(pDX);
  60. //{{AFX_DATA_MAP(CMmPolGenProp)
  61. DDX_Control(pDX, IDC_MM_POL_GEN_LIST, m_listOffers);
  62. //}}AFX_DATA_MAP
  63. }
  64. BEGIN_MESSAGE_MAP(CMmPolGenProp, CPropertyPageBase)
  65. //{{AFX_MSG_MAP(CMmPolGenProp)
  66. ON_BN_CLICKED(IDC_MM_POL_GEN_PROP, OnProperties)
  67. //}}AFX_MSG_MAP
  68. END_MESSAGE_MAP()
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CMmPolGenProp message handlers
  71. BOOL CMmPolGenProp::OnInitDialog()
  72. {
  73. CPropertyPageBase::OnInitDialog();
  74. PopulateOfferInfo();
  75. SetDirty(FALSE);
  76. return TRUE; // return TRUE unless you set the focus to a control
  77. // EXCEPTION: OCX Property Pages should return FALSE
  78. }
  79. void CMmPolGenProp::PopulateOfferInfo()
  80. {
  81. CString st;
  82. int nRows;
  83. int nWidth;
  84. CMmPolicyProperties * pPolProp;
  85. CMmPolicyInfo * pPolInfo;
  86. pPolProp = (CMmPolicyProperties *) GetHolder();
  87. Assert(pPolProp);
  88. pPolProp->GetPolicyInfo(&pPolInfo);
  89. ListView_SetExtendedListViewStyle(m_listOffers.GetSafeHwnd(),
  90. LVS_EX_FULLROWSELECT);
  91. st.LoadString(IDS_MM_POL_GEN_ENCRYPTION);
  92. nWidth = m_listOffers.GetStringWidth(st) + 20;
  93. m_listOffers.InsertColumn(0, st, LVCFMT_LEFT, nWidth);
  94. st.LoadString(IDS_MM_POL_GEN_AUTH);
  95. nWidth = m_listOffers.GetStringWidth(st) + 20;
  96. m_listOffers.InsertColumn(1, st, LVCFMT_LEFT, nWidth);
  97. st.LoadString(IDS_MM_POL_GEN_DH);
  98. nWidth = m_listOffers.GetStringWidth(st) + 20;
  99. m_listOffers.InsertColumn(2, st, LVCFMT_LEFT, nWidth);
  100. st.LoadString(IDS_MM_POL_GEN_QMLMT);
  101. nWidth = m_listOffers.GetStringWidth(st) + 20;
  102. m_listOffers.InsertColumn(3, st, LVCFMT_LEFT, nWidth);
  103. st.LoadString(IDS_MM_POL_GEN_KEY_LIFE);
  104. nWidth = m_listOffers.GetStringWidth(st) + 20;
  105. m_listOffers.InsertColumn(4, st, LVCFMT_LEFT, nWidth);
  106. nRows = 0;
  107. for (int i = 0; i < (int)pPolInfo->m_dwOfferCount; i++)
  108. {
  109. nRows = m_listOffers.InsertItem(nRows, _T(""));
  110. if (-1 != nRows)
  111. {
  112. DoiEspAlgorithmToString(pPolInfo->m_arrOffers[i]->m_EncryptionAlgorithm, &st);
  113. m_listOffers.SetItemText(nRows, 0, st);
  114. DoiAuthAlgorithmToString(pPolInfo->m_arrOffers[i]->m_HashingAlgorithm, &st);
  115. m_listOffers.SetItemText(nRows, 1, st);
  116. DhGroupToString(pPolInfo->m_arrOffers[i]->m_dwDHGroup, &st);
  117. m_listOffers.SetItemText(nRows, 2, st);
  118. st.Format(_T("%d"), pPolInfo->m_arrOffers[i]->m_dwQuickModeLimit);
  119. m_listOffers.SetItemText(nRows, 3, st);
  120. KeyLifetimeToString(pPolInfo->m_arrOffers[i]->m_Lifetime, &st);
  121. m_listOffers.SetItemText(nRows, 4, st);
  122. }
  123. nRows++;
  124. }
  125. }
  126. void CMmPolGenProp::OnProperties()
  127. {
  128. CMmPolicyInfo * pPolInfo;
  129. CMmPolicyProperties * pPolProp;
  130. pPolProp = (CMmPolicyProperties *) GetHolder();
  131. Assert(pPolProp);
  132. pPolProp->GetPolicyInfo(&pPolInfo);
  133. int nIndex = m_listOffers.GetNextItem(-1, LVNI_SELECTED);
  134. if (-1 != nIndex)
  135. {
  136. /*
  137. CMmOfferProperties dlgOfferProp(pPolInfo->m_arrOffers[nIndex], IDS_MM_OFFER_PROP);
  138. dlgOfferProp.DoModal();
  139. */
  140. }
  141. }
  142. BOOL CMmPolGenProp::OnApply()
  143. {
  144. if (!IsDirty())
  145. return TRUE;
  146. UpdateData();
  147. //Do nothing at this time
  148. //CPropertyPageBase::OnApply();
  149. return TRUE;
  150. }
  151. BOOL CMmPolGenProp::OnPropertyChange(BOOL bScope, LONG_PTR *ChangeMask)
  152. {
  153. return FALSE;
  154. }