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.

132 lines
3.1 KiB

  1. // GetWhatPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CertWiz.h"
  5. #include "GetWhatPage.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. // CGetWhatPage property page
  15. IMPLEMENT_DYNCREATE(CGetWhatPage, CIISWizardPage)
  16. CGetWhatPage::CGetWhatPage(CCertificate * pCert)
  17. : CIISWizardPage(CGetWhatPage::IDD, IDS_CERTWIZ, TRUE),
  18. m_pCert(pCert)
  19. {
  20. //{{AFX_DATA_INIT(CGetWhatPage)
  21. m_Index = -1;
  22. //}}AFX_DATA_INIT
  23. }
  24. CGetWhatPage::~CGetWhatPage()
  25. {
  26. }
  27. void CGetWhatPage::DoDataExchange(CDataExchange* pDX)
  28. {
  29. CIISWizardPage::DoDataExchange(pDX);
  30. //{{AFX_DATA_MAP(CGetWhatPage)
  31. DDX_Radio(pDX, IDC_RADIO0, m_Index);
  32. //}}AFX_DATA_MAP
  33. }
  34. BEGIN_MESSAGE_MAP(CGetWhatPage, CIISWizardPage)
  35. //{{AFX_MSG_MAP(CGetWhatPage)
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CWelcomePage message handlers
  40. BOOL
  41. CGetWhatPage::OnSetActive()
  42. {
  43. m_pCert->SetStatusCode(CCertificate::REQUEST_UNDEFINED);
  44. SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
  45. return CIISWizardPage::OnSetActive();
  46. }
  47. enum
  48. {
  49. REQUEST_NEW_CERT = 0,
  50. INSTALL_EXISTING_CERT,
  51. IMPORT_KEYRING_CERT,
  52. IMPORT_CERT,
  53. COPY_MOVE_REMOTE_CERT,
  54. };
  55. LRESULT
  56. CGetWhatPage::OnWizardPrev()
  57. {
  58. return IDD_PAGE_PREV;
  59. }
  60. LRESULT
  61. CGetWhatPage::OnWizardNext()
  62. {
  63. UpdateData();
  64. switch (m_Index)
  65. {
  66. case REQUEST_NEW_CERT:
  67. m_pCert->SetStatusCode(CCertificate::REQUEST_NEW_CERT);
  68. return IDD_PAGE_NEXT_NEW;
  69. case INSTALL_EXISTING_CERT:
  70. m_pCert->SetStatusCode(CCertificate::REQUEST_INSTALL_CERT);
  71. return IDD_PAGE_NEXT_EXISTING;
  72. case IMPORT_KEYRING_CERT:
  73. m_pCert->SetStatusCode(CCertificate::REQUEST_IMPORT_KEYRING);
  74. return IDD_PAGE_NEXT_IMPORT;
  75. case IMPORT_CERT:
  76. m_pCert->SetStatusCode(CCertificate::REQUEST_IMPORT_CERT);
  77. return IDD_PAGE_NEXT_IMPORT_PFX;
  78. case COPY_MOVE_REMOTE_CERT:
  79. m_pCert->SetStatusCode(CCertificate::REQUEST_COPY_MOVE_FROM_REMOTE);
  80. return IDD_PAGE_NEXT_COPY_MOVE_REMOTE;
  81. default:
  82. ASSERT(FALSE);
  83. }
  84. return 1;
  85. }
  86. BOOL CGetWhatPage::OnInitDialog()
  87. {
  88. ASSERT(m_pCert != NULL);
  89. m_Index = 0;
  90. CIISWizardPage::OnInitDialog();
  91. if ( (this != NULL) && (this->m_hWnd != NULL) )
  92. {
  93. if (GetDlgItem(IDC_RADIO0) != NULL)
  94. {
  95. GetDlgItem(IDC_RADIO0)->SetFocus();
  96. }
  97. // Enable or disable controls based on weather certobj is installed
  98. GetDlgItem(IDC_RADIO3)->EnableWindow(m_pCert->m_CertObjInstalled);
  99. GetDlgItem(IDC_RADIO4)->EnableWindow(m_pCert->m_CertObjInstalled);
  100. if (m_pCert->m_CertObjInstalled)
  101. {
  102. GetDlgItem(IDC_RADIO3)->ShowWindow(SW_SHOW);
  103. GetDlgItem(IDC_RADIO4)->ShowWindow(SW_SHOW);
  104. }
  105. // Turn off for workstation.
  106. if (TRUE == IsWhistlerWorkstation())
  107. {
  108. GetDlgItem(IDC_RADIO3)->ShowWindow(SW_HIDE);
  109. GetDlgItem(IDC_RADIO4)->ShowWindow(SW_HIDE);
  110. }
  111. }
  112. return FALSE;
  113. }