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.

115 lines
3.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000-2001.
  5. //
  6. // File: TemplateV1SubjectNamePropertyPage.cpp
  7. //
  8. // Contents: Implementation of CTemplateV1SubjectNamePropertyPage
  9. //
  10. //----------------------------------------------------------------------------
  11. // TemplateSubjectNamePropertyPage.cpp : implementation file
  12. //
  13. #include "stdafx.h"
  14. #include "TemplateV1SubjectNamePropertyPage.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CTemplateV1SubjectNamePropertyPage property page
  22. CTemplateV1SubjectNamePropertyPage::CTemplateV1SubjectNamePropertyPage(CCertTemplate& rCertTemplate) :
  23. CHelpPropertyPage(CTemplateV1SubjectNamePropertyPage::IDD),
  24. m_rCertTemplate (rCertTemplate)
  25. {
  26. //{{AFX_DATA_INIT(CTemplateV1SubjectNamePropertyPage)
  27. // NOTE: the ClassWizard will add member initialization here
  28. //}}AFX_DATA_INIT
  29. m_rCertTemplate.AddRef ();
  30. }
  31. CTemplateV1SubjectNamePropertyPage::~CTemplateV1SubjectNamePropertyPage()
  32. {
  33. m_rCertTemplate.Release ();
  34. }
  35. void CTemplateV1SubjectNamePropertyPage::DoDataExchange(CDataExchange* pDX)
  36. {
  37. CHelpPropertyPage::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(CTemplateV1SubjectNamePropertyPage)
  39. // NOTE: the ClassWizard will add DDX and DDV calls here
  40. //}}AFX_DATA_MAP
  41. }
  42. BEGIN_MESSAGE_MAP(CTemplateV1SubjectNamePropertyPage, CHelpPropertyPage)
  43. //{{AFX_MSG_MAP(CTemplateV1SubjectNamePropertyPage)
  44. // NOTE: the ClassWizard will add message map macros here
  45. //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CTemplateV1SubjectNamePropertyPage message handlers
  49. BOOL CTemplateV1SubjectNamePropertyPage::OnInitDialog ()
  50. {
  51. CHelpPropertyPage::OnInitDialog ();
  52. if ( m_rCertTemplate.RequireSubjectInRequest () )
  53. SendDlgItemMessage (IDC_REQUIRE_SUBJECT, BM_SETCHECK, BST_CHECKED);
  54. else
  55. SendDlgItemMessage (IDC_SUBJECT_AND_BUILD_SUBJECT_BY_CA, BM_SETCHECK, BST_CHECKED);
  56. if ( m_rCertTemplate.SubjectNameIncludesEMail () )
  57. SendDlgItemMessage (IDC_EMAIL_NAME, BM_SETCHECK, BST_CHECKED);
  58. if ( m_rCertTemplate.IsMachineType () )
  59. SendDlgItemMessage (IDC_SUBJECT_MUST_BE_MACHINE, BM_SETCHECK, BST_CHECKED);
  60. else
  61. SendDlgItemMessage (IDC_SUBJECT_MUST_BE_USER, BM_SETCHECK, BST_CHECKED);
  62. EnableControls ();
  63. return TRUE;
  64. }
  65. void CTemplateV1SubjectNamePropertyPage::EnableControls()
  66. {
  67. if ( 1 == m_rCertTemplate.GetType () )
  68. {
  69. GetDlgItem (IDC_REQUIRE_SUBJECT)->EnableWindow (FALSE);
  70. GetDlgItem (IDC_SUBJECT_AND_BUILD_SUBJECT_BY_CA)->EnableWindow (FALSE);
  71. GetDlgItem (IDC_EMAIL_NAME)->EnableWindow (FALSE);
  72. GetDlgItem (IDC_SUBJECT_MUST_BE_MACHINE)->EnableWindow (FALSE);
  73. GetDlgItem (IDC_SUBJECT_MUST_BE_USER)->EnableWindow (FALSE);
  74. }
  75. }
  76. void CTemplateV1SubjectNamePropertyPage::DoContextHelp (HWND hWndControl)
  77. {
  78. _TRACE(1, L"Entering CTemplateV1SubjectNamePropertyPage::DoContextHelp\n");
  79. switch (::GetDlgCtrlID (hWndControl))
  80. {
  81. case IDC_STATIC:
  82. break;
  83. default:
  84. // Display context help for a control
  85. if ( !::WinHelp (
  86. hWndControl,
  87. GetContextHelpFile (),
  88. HELP_WM_HELP,
  89. (DWORD_PTR) g_aHelpIDs_IDD_TEMPLATE_V1_SUBJECT_NAME) )
  90. {
  91. _TRACE(0, L"WinHelp () failed: 0x%x\n", GetLastError ());
  92. }
  93. break;
  94. }
  95. _TRACE(-1, L"Leaving CTemplateV1SubjectNamePropertyPage::DoContextHelp\n");
  96. }