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.

139 lines
2.9 KiB

  1. // SiteNamePage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CertWiz.h"
  5. #include "SiteNamePage.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. // CSiteNamePage property page
  14. IMPLEMENT_DYNCREATE(CSiteNamePage, CIISWizardPage)
  15. CSiteNamePage::CSiteNamePage(CCertificate * pCert)
  16. : CIISWizardPage(CSiteNamePage::IDD, IDS_CERTWIZ, TRUE),
  17. m_pCert(pCert)
  18. {
  19. //{{AFX_DATA_INIT(CSiteNamePage)
  20. m_CommonName = _T("");
  21. //}}AFX_DATA_INIT
  22. }
  23. CSiteNamePage::~CSiteNamePage()
  24. {
  25. }
  26. void CSiteNamePage::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CIISWizardPage::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(CSiteNamePage)
  30. DDX_Text(pDX, IDC_NEWKEY_COMMONNAME, m_CommonName);
  31. DDV_MaxChars(pDX, m_CommonName, 64);
  32. //}}AFX_DATA_MAP
  33. }
  34. LRESULT
  35. CSiteNamePage::OnWizardPrev()
  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. return IDD_PAGE_PREV;
  49. }
  50. LRESULT
  51. CSiteNamePage::OnWizardNext()
  52. /*++
  53. Routine Description:
  54. Next button handler
  55. Arguments:
  56. None
  57. Return Value:
  58. 0 to automatically advance to the next page;
  59. 1 to prevent the page from changing.
  60. To jump to a page other than the next one,
  61. return the identifier of the dialog to be displayed.
  62. --*/
  63. {
  64. UpdateData(TRUE);
  65. m_pCert->m_CommonName = m_CommonName;
  66. return IDD_PAGE_NEXT;
  67. }
  68. BOOL
  69. CSiteNamePage::OnSetActive()
  70. /*++
  71. Routine Description:
  72. Activation handler
  73. We could have empty name field on entrance, so we should
  74. disable Back button
  75. Arguments:
  76. None
  77. Return Value:
  78. TRUE for success, FALSE for failure
  79. --*/
  80. {
  81. ASSERT(m_pCert != NULL);
  82. m_CommonName = m_pCert->m_CommonName;
  83. UpdateData(FALSE);
  84. SetWizardButtons(m_CommonName.IsEmpty() ?
  85. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  86. return CIISWizardPage::OnSetActive();
  87. }
  88. BOOL
  89. CSiteNamePage::OnKillActive()
  90. /*++
  91. Routine Description:
  92. Activation handler
  93. We could leave this page only if we have good names
  94. entered or when Back button is clicked. In both cases
  95. we should enable both buttons
  96. Arguments:
  97. None
  98. Return Value:
  99. TRUE for success, FALSE for failure
  100. --*/
  101. {
  102. SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
  103. return CIISWizardPage::OnSetActive();
  104. }
  105. BEGIN_MESSAGE_MAP(CSiteNamePage, CIISWizardPage)
  106. //{{AFX_MSG_MAP(CSiteNamePage)
  107. ON_EN_CHANGE(IDC_NEWKEY_COMMONNAME, OnEditchangeNewkeyCommonname)
  108. //}}AFX_MSG_MAP
  109. END_MESSAGE_MAP()
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CSiteNamePage message handlers
  112. void CSiteNamePage::OnEditchangeNewkeyCommonname()
  113. {
  114. UpdateData(TRUE);
  115. SetWizardButtons(m_CommonName.IsEmpty() ?
  116. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  117. }