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.

221 lines
5.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 2002 **/
  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. m_bTheme = TRUE;
  41. }
  42. CMmPolicyProperties::~CMmPolicyProperties()
  43. {
  44. RemovePageFromList((CPropertyPageBase*) &m_pageGeneral, FALSE);
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CMmPolGenProp property page
  48. IMPLEMENT_DYNCREATE(CMmPolGenProp, CPropertyPageBase)
  49. CMmPolGenProp::CMmPolGenProp() : CPropertyPageBase(CMmPolGenProp::IDD)
  50. {
  51. //{{AFX_DATA_INIT(CMmPolGenProp)
  52. // NOTE: the ClassWizard will add member initialization here
  53. //}}AFX_DATA_INIT
  54. }
  55. CMmPolGenProp::~CMmPolGenProp()
  56. {
  57. }
  58. void CMmPolGenProp::DoDataExchange(CDataExchange* pDX)
  59. {
  60. CPropertyPageBase::DoDataExchange(pDX);
  61. //{{AFX_DATA_MAP(CMmPolGenProp)
  62. DDX_Control(pDX, IDC_MM_POL_GEN_LIST, m_listOffers);
  63. //}}AFX_DATA_MAP
  64. }
  65. BEGIN_MESSAGE_MAP(CMmPolGenProp, CPropertyPageBase)
  66. //{{AFX_MSG_MAP(CMmPolGenProp)
  67. ON_BN_CLICKED(IDC_MM_POL_GEN_PROP, OnProperties)
  68. //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CMmPolGenProp message handlers
  72. BOOL CMmPolGenProp::OnInitDialog()
  73. {
  74. CPropertyPageBase::OnInitDialog();
  75. PopulateOfferInfo();
  76. SetDirty(FALSE);
  77. return TRUE; // return TRUE unless you set the focus to a control
  78. // EXCEPTION: OCX Property Pages should return FALSE
  79. }
  80. void CMmPolGenProp::PopulateOfferInfo()
  81. {
  82. CString st;
  83. int nRows;
  84. int nWidth;
  85. CMmPolicyProperties * pPolProp;
  86. CMmPolicyInfo * pPolInfo;
  87. pPolProp = (CMmPolicyProperties *) GetHolder();
  88. Assert(pPolProp);
  89. pPolProp->GetPolicyInfo(&pPolInfo);
  90. ListView_SetExtendedListViewStyle(m_listOffers.GetSafeHwnd(),
  91. LVS_EX_FULLROWSELECT);
  92. st.LoadString(IDS_MM_POL_GEN_ENCRYPTION);
  93. nWidth = m_listOffers.GetStringWidth(st) + 20;
  94. m_listOffers.InsertColumn(0, st, LVCFMT_LEFT, nWidth);
  95. st.LoadString(IDS_MM_POL_GEN_AUTH);
  96. nWidth = m_listOffers.GetStringWidth(st) + 20;
  97. m_listOffers.InsertColumn(1, st, LVCFMT_LEFT, nWidth);
  98. st.LoadString(IDS_MM_POL_GEN_DH);
  99. nWidth = m_listOffers.GetStringWidth(st) + 20;
  100. m_listOffers.InsertColumn(2, st, LVCFMT_LEFT, nWidth);
  101. st.LoadString(IDS_MM_POL_GEN_QMLMT);
  102. nWidth = m_listOffers.GetStringWidth(st) + 20;
  103. m_listOffers.InsertColumn(3, st, LVCFMT_LEFT, nWidth);
  104. st.LoadString(IDS_MM_POL_GEN_KEY_LIFE);
  105. nWidth = m_listOffers.GetStringWidth(st) + 20;
  106. m_listOffers.InsertColumn(4, st, LVCFMT_LEFT, nWidth);
  107. nRows = 0;
  108. for (int i = 0; i < (int)pPolInfo->m_dwOfferCount; i++)
  109. {
  110. nRows = m_listOffers.InsertItem(nRows, _T(""));
  111. if (-1 != nRows)
  112. {
  113. DoiEspAlgorithmToString(pPolInfo->m_arrOffers[i]->m_EncryptionAlgorithm, &st);
  114. m_listOffers.SetItemText(nRows, 0, st);
  115. DoiAuthAlgorithmToString(pPolInfo->m_arrOffers[i]->m_HashingAlgorithm, &st);
  116. m_listOffers.SetItemText(nRows, 1, st);
  117. DhGroupToString(pPolInfo->m_arrOffers[i]->m_dwDHGroup, &st);
  118. m_listOffers.SetItemText(nRows, 2, st);
  119. st.Format(_T("%d"), pPolInfo->m_arrOffers[i]->m_dwQuickModeLimit);
  120. m_listOffers.SetItemText(nRows, 3, st);
  121. KeyLifetimeToString(pPolInfo->m_arrOffers[i]->m_Lifetime, &st);
  122. m_listOffers.SetItemText(nRows, 4, st);
  123. }
  124. nRows++;
  125. }
  126. if ( nRows > 0 )
  127. {
  128. //select the first item
  129. m_listOffers.SetFocus();
  130. m_listOffers.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
  131. }
  132. }
  133. void CMmPolGenProp::OnProperties()
  134. {
  135. CMmPolicyInfo * pPolInfo;
  136. CMmPolicyProperties * pPolProp;
  137. pPolProp = (CMmPolicyProperties *) GetHolder();
  138. Assert(pPolProp);
  139. pPolProp->GetPolicyInfo(&pPolInfo);
  140. int nIndex = m_listOffers.GetNextItem(-1, LVNI_SELECTED);
  141. if (-1 != nIndex)
  142. {
  143. /*
  144. CMmOfferProperties dlgOfferProp(pPolInfo->m_arrOffers[nIndex], IDS_MM_OFFER_PROP);
  145. dlgOfferProp.DoModal();
  146. */
  147. }
  148. }
  149. BOOL CMmPolGenProp::OnApply()
  150. {
  151. if (!IsDirty())
  152. return TRUE;
  153. UpdateData();
  154. //Do nothing at this time
  155. //CPropertyPageBase::OnApply();
  156. return TRUE;
  157. }
  158. BOOL CMmPolGenProp::OnPropertyChange(BOOL bScope, LONG_PTR *ChangeMask)
  159. {
  160. return FALSE;
  161. }