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.

136 lines
3.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: ACRGenPg.cpp
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "ACRGenPg.h"
  13. #ifdef _DEBUG
  14. #ifndef ALPHA
  15. #define new DEBUG_NEW
  16. #endif
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CACRGeneralPage property page
  22. CACRGeneralPage::CACRGeneralPage(CAutoCertRequest& rACR) :
  23. CHelpPropertyPage(CACRGeneralPage::IDD),
  24. m_rACR (rACR)
  25. {
  26. m_rACR.AddRef ();
  27. //{{AFX_DATA_INIT(CACRGeneralPage)
  28. //}}AFX_DATA_INIT
  29. }
  30. CACRGeneralPage::~CACRGeneralPage()
  31. {
  32. m_rACR.Release ();
  33. }
  34. void CACRGeneralPage::DoDataExchange(CDataExchange* pDX)
  35. {
  36. CHelpPropertyPage::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(CACRGeneralPage)
  38. DDX_Control(pDX, IDC_CERT_TYPE, m_certTypeEdit);
  39. DDX_Control(pDX, IDC_CERT_PURPOSES, m_purposesEditControl);
  40. DDX_Control(pDX, IDC_CA_LIST, m_caListbox);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CACRGeneralPage, CHelpPropertyPage)
  44. //{{AFX_MSG_MAP(CACRGeneralPage)
  45. //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CACRGeneralPage message handlers
  49. BOOL CACRGeneralPage::OnInitDialog()
  50. {
  51. CHelpPropertyPage::OnInitDialog();
  52. CString purposes;
  53. HRESULT hResult = m_rACR.GetUsages (purposes);
  54. if ( SUCCEEDED (hResult) )
  55. {
  56. if ( purposes.IsEmpty () )
  57. VERIFY (purposes.LoadString (IDS_ANY));
  58. m_purposesEditControl.SetWindowText (purposes);
  59. }
  60. else
  61. {
  62. CString error;
  63. VERIFY (error.LoadString (IDS_ERROR_READING_ACR_PURPOSES));
  64. m_purposesEditControl.SetWindowText (error);
  65. }
  66. CString certTypeName;
  67. hResult = m_rACR.GetCertTypeName (certTypeName);
  68. if ( !SUCCEEDED (hResult) )
  69. {
  70. VERIFY (certTypeName.LoadString (IDS_ERROR_READING_ACR_CERTTYPE));
  71. }
  72. m_certTypeEdit.SetWindowText (certTypeName);
  73. // We want the display names
  74. CStringList& CANameList = m_rACR.GetCANameList (TRUE);
  75. CString CAName;
  76. POSITION pos = CANameList.GetHeadPosition ();
  77. for (; pos; )
  78. {
  79. CAName = CANameList.GetNext (pos);
  80. m_caListbox.AddString (CAName);
  81. }
  82. return TRUE; // return TRUE unless you set the focus to a control
  83. // EXCEPTION: OCX Property Pages should return FALSE
  84. }
  85. void CACRGeneralPage::DoContextHelp (HWND hWndControl)
  86. {
  87. _TRACE (1, L"Entering CACRGeneralPage::DoContextHelp\n");
  88. static const DWORD help_map[] =
  89. {
  90. IDC_CERT_TYPE, IDH_ACRPAGE_CERT_TYPE,
  91. IDC_CERT_PURPOSES, IDH_ACRPAGE_CERT_PURPOSES,
  92. IDC_CA_LIST, IDH_ACRPAGE_CA_LIST,
  93. 0, 0
  94. };
  95. // Display context help for a control
  96. switch (::GetDlgCtrlID (hWndControl))
  97. {
  98. case IDC_CERT_TYPE:
  99. case IDC_CERT_PURPOSES:
  100. case IDC_CA_LIST:
  101. if ( !::WinHelp (
  102. hWndControl,
  103. GetF1HelpFilename(),
  104. HELP_WM_HELP,
  105. (DWORD_PTR) help_map) )
  106. {
  107. _TRACE (0, L"WinHelp () failed: 0x%x\n", GetLastError ());
  108. }
  109. break;
  110. default:
  111. break;
  112. }
  113. _TRACE (-1, L"Leaving CACRGeneralPage::DoContextHelp\n");
  114. }