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.

123 lines
2.8 KiB

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