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.

139 lines
3.1 KiB

  1. // ChooseCAPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CertWiz.h"
  5. #include "ChooseOnlinePage.h"
  6. #include "Certificat.h"
  7. #include "CertUtil.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CChooseOnlinePage property page
  15. IMPLEMENT_DYNCREATE(CChooseOnlinePage, CIISWizardPage)
  16. CChooseOnlinePage::CChooseOnlinePage(CCertificate * pCert)
  17. : CIISWizardPage(CChooseOnlinePage::IDD, IDS_CERTWIZ, TRUE),
  18. m_pCert(pCert)
  19. {
  20. //{{AFX_DATA_INIT(CChooseOnlinePage)
  21. m_CAIndex = -1;
  22. //}}AFX_DATA_INIT
  23. }
  24. CChooseOnlinePage::~CChooseOnlinePage()
  25. {
  26. }
  27. void CChooseOnlinePage::DoDataExchange(CDataExchange* pDX)
  28. {
  29. CIISWizardPage::DoDataExchange(pDX);
  30. //{{AFX_DATA_MAP(CChooseOnlinePage)
  31. DDX_CBIndex(pDX, IDC_CA_ONLINE_LIST, m_CAIndex);
  32. //}}AFX_DATA_MAP
  33. }
  34. LRESULT
  35. CChooseOnlinePage::OnWizardBack()
  36. /*++
  37. Routine Description:
  38. Prev button handler
  39. Arguments:
  40. None
  41. Return Value:
  42. 0 to automatically advance to the prev page;
  43. 1 to prevent the page from changing.
  44. To jump to a page other than the prev one,
  45. return the identifier of the dialog to be displayed.
  46. --*/
  47. {
  48. LRESULT id = 1;
  49. switch (m_pCert->GetStatusCode())
  50. {
  51. case CCertificate::REQUEST_RENEW_CERT:
  52. id = IDD_PAGE_PREV_RENEW;
  53. break;
  54. case CCertificate::REQUEST_NEW_CERT:
  55. id = IDD_PAGE_PREV_NEW;
  56. #ifdef ENABLE_W3SVC_SSL_PAGE
  57. if (IsWebServerType(m_pCert->m_WebSiteInstanceName))
  58. {
  59. id = IDD_PAGE_PREV_INSTALL_W3SVC_ONLY;
  60. }
  61. #endif
  62. break;
  63. default:
  64. id = 1;
  65. }
  66. return id;
  67. }
  68. LRESULT
  69. CChooseOnlinePage::OnWizardNext()
  70. /*++
  71. Routine Description:
  72. Next button handler
  73. Arguments:
  74. None
  75. Return Value:
  76. 0 to automatically advance to the next page;
  77. 1 to prevent the page from changing.
  78. To jump to a page other than the next one,
  79. return the identifier of the dialog to be displayed.
  80. --*/
  81. {
  82. UpdateData();
  83. CComboBox * pCombo = (CComboBox *)CWnd::FromHandle(
  84. GetDlgItem(IDC_CA_ONLINE_LIST)->m_hWnd);
  85. pCombo->GetLBText(m_CAIndex, m_pCert->m_ConfigCA);
  86. return IDD_PAGE_NEXT;
  87. }
  88. BEGIN_MESSAGE_MAP(CChooseOnlinePage, CIISWizardPage)
  89. //{{AFX_MSG_MAP(CChooseCAPage)
  90. //}}AFX_MSG_MAP
  91. END_MESSAGE_MAP()
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CChooseCAPage message handlers
  94. BOOL CChooseOnlinePage::OnInitDialog()
  95. {
  96. m_CAIndex = 0;
  97. // We need to create controls first
  98. CIISWizardPage::OnInitDialog();
  99. ASSERT(m_pCert != NULL);
  100. GetDlgItem(IDC_CA_ONLINE_LIST)->SetFocus();
  101. CComboBox * pCombo = (CComboBox *)CWnd::FromHandle(
  102. GetDlgItem(IDC_CA_ONLINE_LIST)->m_hWnd);
  103. CString str;
  104. POSITION pos = m_pCert->m_OnlineCAList.GetHeadPosition();
  105. while (pos != NULL)
  106. {
  107. str = m_pCert->m_OnlineCAList.GetNext(pos);
  108. pCombo->AddString(str);
  109. }
  110. int idx;
  111. if ( !m_pCert->m_ConfigCA.IsEmpty()
  112. && CB_ERR != (idx = pCombo->FindString(-1, m_pCert->m_ConfigCA))
  113. )
  114. {
  115. pCombo->SetCurSel(idx);
  116. }
  117. else
  118. pCombo->SetCurSel(0);
  119. return FALSE;
  120. }