CaCertReportPage.cpp
上传用户:dengkfang
上传日期:2008-12-30
资源大小:5233k
文件大小:5k
源码类别:

CA认证

开发平台:

Visual C++

  1. // CaCertReportPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "minica.h"
  5. #include "CaCertReportPage.h"
  6. #include "MiniMainDlg.h"
  7. #include ".GenericClassLanguage.h"
  8. #include "minict.h"
  9. //#include "CryptuiAPI.h"
  10. //#include "e:SDKincludeWinCrypt.h"
  11. //#include "D:SDKincludeCryptuiAPI.h"
  12. //d:sdklibCryptUI.lib 
  13. //D:SDKINCLUDE
  14. //D:SDKLIB
  15. /*
  16. CryptUIDlgViewContext on XP and Windows Server 2003
  17. CertViewProperties on Windows 2000 Pro and Server.
  18. CryptUIDlgViewCertificate on Win98+*/
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CCaCertReportPage property page
  26. IMPLEMENT_DYNCREATE(CCaCertReportPage, CPropertyPage)
  27. CCaCertReportPage::CCaCertReportPage() : CPropertyPage(CCaCertReportPage::IDD)
  28. {
  29. //{{AFX_DATA_INIT(CCaCertReportPage)
  30. // NOTE: the ClassWizard will add member initialization here
  31. //}}AFX_DATA_INIT
  32. m_pPageCaType = NULL;
  33. m_pPageCaInfo = NULL;
  34. m_pPageCaExt = NULL;
  35. m_hCertRoot = NULL;
  36. }
  37. CCaCertReportPage::~CCaCertReportPage()
  38. {
  39. // Free the DLL module.
  40. }
  41. void CCaCertReportPage::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CPropertyPage::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CCaCertReportPage)
  45. DDX_Control(pDX, IDC_STATIC_WIZARD, m_WizardTree);
  46. //}}AFX_DATA_MAP
  47. }
  48. BEGIN_MESSAGE_MAP(CCaCertReportPage, CPropertyPage)
  49. //{{AFX_MSG_MAP(CCaCertReportPage)
  50. //}}AFX_MSG_MAP
  51. END_MESSAGE_MAP()
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CCaCertReportPage message handlers
  54. BOOL CCaCertReportPage::OnInitDialog() 
  55. {
  56. CPropertyPage::OnInitDialog();
  57. m_WizardTree
  58. .SetTextFont( 10, FALSE, FALSE, "Arial Unicode MS" )
  59. .SetDefaultTextColor( RGB(0,64,255));
  60. m_toolTip.Create(this);
  61. m_toolTip.AddTool(GetDlgItem(IDC_STATIC_WIZARD), "待制作证书内容报告表");
  62. return TRUE;  // return TRUE unless you set the focus to a control
  63.               // EXCEPTION: OCX Property Pages should return FALSE
  64. }
  65. BOOL CCaCertReportPage::GetWizard(CCaCertTypePage * pPageCaType, 
  66.  CCaCertInfoPage * pPageCaInfo,
  67.  CCaCertExtPage * pPageCaExt)
  68. {
  69. if(pPageCaType && pPageCaInfo && pPageCaExt)
  70. {
  71. m_pPageCaType = pPageCaType;
  72. m_pPageCaInfo = pPageCaInfo;
  73. m_pPageCaExt = pPageCaExt;
  74. return TRUE;
  75. }
  76. else
  77. return FALSE;
  78. }
  79. void CCaCertReportPage::ViewWizardInfo()
  80. {
  81. // Tree data
  82. if(m_hCertRoot)
  83. m_WizardTree.DeleteNode(m_hCertRoot);
  84. m_hCertRoot = m_WizardTree.InsertChild( HTOPNODE, _T(""));
  85. m_WizardTree.SetNodeColor(m_hCertRoot,RGB(0,64,255));
  86. HTREENODE hCertExt = m_WizardTree.InsertChild( m_hCertRoot, _T(MiniCT_0500)); //MiniCT_0500 "数证扩展"
  87. HTREENODE hCertInfo = m_WizardTree.InsertChild( m_hCertRoot, _T(MiniCT_0501));  //MiniCT_0501 "数证信息"
  88. HTREENODE hInfoSave = m_WizardTree.InsertChild( hCertInfo, _T(MiniCT_0502)); //MiniCT_0502 "存储信息"
  89. HTREENODE hInfoHold = m_WizardTree.InsertChild( hCertInfo, _T(MiniCT_0503)); //MiniCT_0503 "约束信息"
  90. HTREENODE hInfoBase = m_WizardTree.InsertChild( hCertInfo, _T(MiniCT_0504)); //MiniCT_0504 "基本信息"
  91. HTREENODE hCertType = m_WizardTree.InsertChild( m_hCertRoot, _T(MiniCT_0505)); //MiniCT_0505 "数证类型"
  92. HTREENODE hTypeEkusage = m_WizardTree.InsertChild( hCertType, _T(MiniCT_0506)); //MiniCT_0506 "增强密钥类型"
  93. HTREENODE hTypeKusage = m_WizardTree.InsertChild( hCertType, _T(MiniCT_0507)); //MiniCT_0507 "密钥类型"
  94. HTREENODE hTypeType = m_WizardTree.InsertChild( hCertType, _T(MiniCT_0508)); //MiniCT_0508 "证书类型"
  95. m_pPageCaType->GetCertTypeInfo(&m_WizardTree, hTypeType, hTypeKusage, hTypeEkusage);
  96. BOOL bFull = m_pPageCaInfo->GetCertInfo(&m_WizardTree, hInfoBase, hInfoHold, hInfoSave);
  97. m_pPageCaExt->GetCertInfo(&m_WizardTree, hCertExt);
  98. CMiniMainDlg * pMain = (CMiniMainDlg *)AfxGetMainWnd();
  99. CCaCertWizardSheet * pWizard = (CCaCertWizardSheet *)pMain->GetPage("CCaCertWizardSheet");
  100. CCaCertManPage * pMan = (CCaCertManPage *)pWizard->GetPage("CCaCertManPage");
  101. if(!pMan->IsDbReady())//数据库连接失败
  102. {
  103. pWizard->GetDlgItem(IDC_B_MADE)->EnableWindow(FALSE);
  104. }
  105. if(!bFull ) //信息不完整
  106. {
  107. //关闭按钮
  108. if(::IsWindow(pWizard->m_hWnd))
  109. {
  110. pWizard->GetDlgItem(IDC_B_V)->EnableWindow(FALSE);
  111. pWizard->GetDlgItem(IDC_B_MADE)->EnableWindow(FALSE);
  112. }
  113. m_WizardTree.SetNodeText(m_hCertRoot , MiniCT_0509); ////MiniCT_0509 "数证向导报告:异常"
  114. m_WizardTree.SetNodeColor(m_hCertRoot, RGB(255,0,0));
  115. }
  116. else
  117. {
  118. //开放按钮
  119. if(::IsWindow(pWizard->m_hWnd))
  120. {
  121. pWizard->GetDlgItem(IDC_B_V)->EnableWindow(true);
  122. }
  123. m_WizardTree.SetNodeText(m_hCertRoot , MiniCT_0510); ////MiniCT_0510 "数证向导报告:正常"
  124. if(pMan->IsDbReady())
  125. pWizard->GetDlgItem(IDC_B_MADE)->EnableWindow(true);
  126. // m_WizardTree.SetNodeColor(m_hCertRoot, RGB(0,128,0));
  127. }
  128. }
  129. BOOL CCaCertReportPage::PreTranslateMessage(MSG* pMsg) 
  130. {
  131. // TODO: Add your specialized code here and/or call the base class
  132. {
  133. // Let the ToolTip process this message.
  134. m_toolTip.RelayEvent(pMsg);
  135. }
  136. return CPropertyPage::PreTranslateMessage(pMsg);
  137. }