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.

269 lines
6.8 KiB

  1. // FinalInstalledPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CertWiz.h"
  5. #include "FinalPages.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. // CFinalInstalledPage property page
  15. IMPLEMENT_DYNCREATE(CFinalInstalledPage, CIISWizardBookEnd2)
  16. CFinalInstalledPage::CFinalInstalledPage(HRESULT * phResult, CCertificate * pCert)
  17. : CIISWizardBookEnd2(phResult,
  18. USE_DEFAULT_CAPTION,
  19. IDS_INSTALL_CERT_FAILURE_HEADER,
  20. IDS_CERTWIZ,
  21. &m_idBodyText,
  22. NULL,
  23. &pCert->m_idErrorText,
  24. &pCert->m_strErrorText,
  25. USE_DEFAULT_CAPTION,
  26. CFinalInstalledPage::IDD),
  27. m_pCert(pCert)
  28. {
  29. m_idBodyText = IDS_CERT_INSTALLED_SUCCESS;
  30. }
  31. CFinalInstalledPage::~CFinalInstalledPage()
  32. {
  33. }
  34. BEGIN_MESSAGE_MAP(CFinalInstalledPage, CIISWizardBookEnd2)
  35. //{{AFX_MSG_MAP(CFinalInstalledPage)
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CFinalInstalledPage message handlers
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CFinalReplacedPage property page
  42. IMPLEMENT_DYNCREATE(CFinalReplacedPage, CIISWizardBookEnd2)
  43. CFinalReplacedPage::CFinalReplacedPage(HRESULT * phResult, CCertificate * pCert)
  44. : CIISWizardBookEnd2(phResult,
  45. USE_DEFAULT_CAPTION,
  46. IDS_INSTALL_CERT_FAILURE_HEADER,
  47. IDS_CERTWIZ,
  48. &m_idBodyText,
  49. NULL,
  50. &pCert->m_idErrorText,
  51. &pCert->m_strErrorText,
  52. USE_DEFAULT_CAPTION,
  53. CFinalReplacedPage::IDD),
  54. m_pCert(pCert)
  55. {
  56. m_idBodyText = IDS_CERT_REPLACE_SUCCESS;
  57. }
  58. CFinalReplacedPage::~CFinalReplacedPage()
  59. {
  60. }
  61. BEGIN_MESSAGE_MAP(CFinalReplacedPage, CIISWizardBookEnd2)
  62. //{{AFX_MSG_MAP(CFinalReplacedPage)
  63. //}}AFX_MSG_MAP
  64. END_MESSAGE_MAP()
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CFinalInstalledPage message handlers
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CFinalRemovePage property page
  69. IMPLEMENT_DYNCREATE(CFinalRemovePage, CIISWizardBookEnd2)
  70. CFinalRemovePage::CFinalRemovePage(HRESULT * phResult, CCertificate * pCert)
  71. : CIISWizardBookEnd2(phResult,
  72. USE_DEFAULT_CAPTION,
  73. IDS_REMOVE_CERT_FAILURE_HEADER,
  74. IDS_CERTWIZ,
  75. &m_idBodyText,
  76. NULL,
  77. &pCert->m_idErrorText,
  78. &pCert->m_strErrorText,
  79. USE_DEFAULT_CAPTION,
  80. CFinalRemovePage::IDD),
  81. m_pCert(pCert)
  82. {
  83. m_idBodyText = IDS_CERT_REMOVE_SUCCESS;
  84. }
  85. CFinalRemovePage::~CFinalRemovePage()
  86. {
  87. }
  88. void CFinalRemovePage::DoDataExchange(CDataExchange* pDX)
  89. {
  90. CIISWizardBookEnd2::DoDataExchange(pDX);
  91. //{{AFX_DATA_MAP(CFinalRemovePage)
  92. // NOTE: the ClassWizard will add DDX and DDV calls here
  93. //}}AFX_DATA_MAP
  94. }
  95. BEGIN_MESSAGE_MAP(CFinalRemovePage, CIISWizardBookEnd2)
  96. //{{AFX_MSG_MAP(CFinalRemovePage)
  97. //}}AFX_MSG_MAP
  98. END_MESSAGE_MAP()
  99. /////////////////////////////////////////////////////////////////////////////
  100. // CFinalRemovePage message handlers
  101. BOOL CFinalRemovePage::OnInitDialog()
  102. {
  103. CIISWizardBookEnd2::OnInitDialog();
  104. ASSERT(m_pCert != NULL);
  105. if (m_pCert->m_hResult != S_OK)
  106. {
  107. // we need to replace text in template to error message
  108. CString str;
  109. str.LoadString(m_pCert->m_idErrorText);
  110. SetDlgItemText(IDC_STATIC_WZ_BODY, str);
  111. }
  112. GetParent()->GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
  113. return TRUE;
  114. }
  115. /////////////////////////////////////////////////////////////////////////////
  116. // CFinalCancelPage property page
  117. IMPLEMENT_DYNCREATE(CFinalCancelPage, CIISWizardBookEnd2)
  118. CFinalCancelPage::CFinalCancelPage(HRESULT * phResult, CCertificate * pCert)
  119. : CIISWizardBookEnd2(phResult,
  120. USE_DEFAULT_CAPTION,
  121. IDS_CANCEL_CERT_FAILURE_HEADER,
  122. IDS_CERTWIZ,
  123. &m_idBodyText,
  124. NULL,
  125. &pCert->m_idErrorText,
  126. &pCert->m_strErrorText,
  127. USE_DEFAULT_CAPTION,
  128. CFinalCancelPage::IDD),
  129. m_pCert(pCert)
  130. {
  131. m_idBodyText = IDS_CERT_CANCEL_SUCCESS;
  132. }
  133. CFinalCancelPage::~CFinalCancelPage()
  134. {
  135. }
  136. void CFinalCancelPage::DoDataExchange(CDataExchange* pDX)
  137. {
  138. CIISWizardBookEnd2::DoDataExchange(pDX);
  139. //{{AFX_DATA_MAP(CFinalRemovePage)
  140. // NOTE: the ClassWizard will add DDX and DDV calls here
  141. //}}AFX_DATA_MAP
  142. }
  143. BEGIN_MESSAGE_MAP(CFinalCancelPage, CIISWizardBookEnd2)
  144. //{{AFX_MSG_MAP(CFinalCancelPage)
  145. //}}AFX_MSG_MAP
  146. END_MESSAGE_MAP()
  147. /////////////////////////////////////////////////////////////////////////////
  148. // CFinalCancelPage message handlers
  149. BOOL CFinalCancelPage::OnInitDialog()
  150. {
  151. CIISWizardBookEnd2::OnInitDialog();
  152. ASSERT(m_pCert != NULL);
  153. if (m_pCert->m_hResult != S_OK)
  154. {
  155. // we need to replace text in template to error message
  156. CString str;
  157. str.LoadString(m_pCert->m_idErrorText);
  158. SetDlgItemText(IDC_STATIC_WZ_BODY, str);
  159. }
  160. GetParent()->GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
  161. return TRUE;
  162. }
  163. /////////////////////////////////////////////////////////////////////////////
  164. // CFinalToFilePage property page
  165. IMPLEMENT_DYNCREATE(CFinalToFilePage, CIISWizardBookEnd2)
  166. CFinalToFilePage::CFinalToFilePage(HRESULT * phResult, CCertificate * pCert)
  167. : CIISWizardBookEnd2(phResult,
  168. USE_DEFAULT_CAPTION,
  169. IDS_FINAL_TO_FILE_FAILURE_HEADER,
  170. IDS_CERTWIZ,
  171. NULL,
  172. NULL,
  173. &pCert->m_idErrorText,
  174. &pCert->m_strErrorText,
  175. USE_DEFAULT_CAPTION,
  176. CFinalToFilePage::IDD),
  177. m_pCert(pCert)
  178. {
  179. }
  180. CFinalToFilePage::~CFinalToFilePage()
  181. {
  182. }
  183. void CFinalToFilePage::DoDataExchange(CDataExchange* pDX)
  184. {
  185. CIISWizardBookEnd2::DoDataExchange(pDX);
  186. //{{AFX_DATA_MAP(CFinalToFilePage)
  187. DDX_Control(pDX, IDC_HOTLINK_CCODES, m_hotlink_codessite);
  188. //}}AFX_DATA_MAP
  189. }
  190. BEGIN_MESSAGE_MAP(CFinalToFilePage, CIISWizardBookEnd2)
  191. //{{AFX_MSG_MAP(CFinalToFilePage)
  192. //}}AFX_MSG_MAP
  193. END_MESSAGE_MAP()
  194. /////////////////////////////////////////////////////////////////////////////
  195. // CFinalToFilePage message handlers
  196. BOOL CFinalToFilePage::OnInitDialog()
  197. {
  198. ASSERT(NULL != m_pCert);
  199. CIISWizardBookEnd2::OnInitDialog();
  200. // in case of success we should prepare text and include
  201. // request file name into
  202. if (SUCCEEDED(m_pCert->m_hResult))
  203. {
  204. CString str, strPath;
  205. strPath = m_pCert->m_ReqFileName;
  206. // If filename is too long, it will look ugly, we could
  207. // limit it to our static control width.
  208. VERIFY(CompactPathToWidth(GetDlgItem(IDC_STATIC_WZ_BODY), strPath));
  209. // This MFC helper limits the format internally
  210. // to 256 characters: cannot use it here
  211. // AfxFormatString1(str, IDS_FINAL_TO_FILE_BODY_SUCCESS, m_pCert->m_ReqFileName);
  212. str.Format(IDS_CERT_REQUEST_SUCCESS, strPath);
  213. SetDlgItemText(IDC_STATIC_WZ_BODY, str);
  214. // setup the link to CA list
  215. m_hotlink_codessite.SetLink(IDS_MICROSOFT_CA_LINK);
  216. }
  217. else
  218. {
  219. // hide controls that are not for error message
  220. GetDlgItem(IDC_HOTLINK_CCODES)->ShowWindow(SW_HIDE);
  221. GetDlgItem(IDC_STATIC_WZ_BODY2)->ShowWindow(SW_HIDE);
  222. }
  223. SetWizardButtons(PSWIZB_FINISH);
  224. GetParent()->GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
  225. return TRUE;
  226. }