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.

193 lines
4.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: complete.cpp
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "Complete.h"
  13. #include "AddSheet.h"
  14. #ifdef _DEBUG
  15. #ifndef ALPHA
  16. #define new DEBUG_NEW
  17. #endif
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CAddEFSWizComplete property page
  23. CAddEFSWizComplete::CAddEFSWizComplete() : CWizard97PropertyPage(CAddEFSWizComplete::IDD)
  24. {
  25. //{{AFX_DATA_INIT(CAddEFSWizComplete)
  26. // NOTE: the ClassWizard will add member initialization here
  27. //}}AFX_DATA_INIT
  28. InitWizard97 (TRUE);
  29. }
  30. CAddEFSWizComplete::~CAddEFSWizComplete()
  31. {
  32. }
  33. void CAddEFSWizComplete::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CWizard97PropertyPage::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(CAddEFSWizComplete)
  37. DDX_Control(pDX, IDC_BIGBOLD, m_bigBoldStatic);
  38. DDX_Control(pDX, IDC_ADDLIST, m_UserAddList);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(CAddEFSWizComplete, CWizard97PropertyPage)
  42. //{{AFX_MSG_MAP(CAddEFSWizComplete)
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CAddEFSWizComplete message handlers
  47. BOOL CAddEFSWizComplete::OnSetActive()
  48. {
  49. BOOL bResult = CWizard97PropertyPage::OnSetActive ();
  50. if ( bResult )
  51. {
  52. GetParent ()->PostMessage (PSM_SETWIZBUTTONS, 0, PSWIZB_FINISH | PSWIZB_BACK);
  53. SetUserList();
  54. }
  55. return bResult;
  56. }
  57. void CAddEFSWizComplete::SetUserList()
  58. {
  59. CAddEFSWizSheet* pAddSheet = reinterpret_cast <CAddEFSWizSheet *> (m_pWiz);
  60. ASSERT (pAddSheet);
  61. if ( !pAddSheet )
  62. return;
  63. PUSERSONFILE Token = NULL;
  64. CString UserName;
  65. CString DnName;
  66. try {
  67. CString UnKnownUser;
  68. CString NoCertName;
  69. VERIFY (UnKnownUser.LoadString(IDS_UNKNOWNUSER));
  70. VERIFY (NoCertName.LoadString(IDS_NOCERTNAME));
  71. Token = pAddSheet->StartEnum();
  72. while (Token)
  73. {
  74. Token = pAddSheet->GetNextUser(Token, UserName, DnName);
  75. if ( (!UserName.IsEmpty()) || (!DnName.IsEmpty()))
  76. {
  77. LV_ITEM fillItem;
  78. fillItem.mask = LVIF_TEXT;
  79. fillItem.iItem = 0;
  80. fillItem.iSubItem = 0;
  81. if (UserName.IsEmpty())
  82. {
  83. fillItem.pszText = UnKnownUser.GetBuffer(UnKnownUser.GetLength() + 1);
  84. }
  85. else
  86. {
  87. fillItem.pszText = UserName.GetBuffer(UserName.GetLength() + 1);
  88. }
  89. fillItem.iItem = m_UserAddList.InsertItem(&fillItem);
  90. if (UserName.IsEmpty())
  91. {
  92. UnKnownUser.ReleaseBuffer();
  93. }
  94. else
  95. {
  96. UserName.ReleaseBuffer();
  97. }
  98. if (fillItem.iItem != -1 )
  99. {
  100. fillItem.iSubItem = 1;
  101. if (DnName.IsEmpty())
  102. {
  103. fillItem.pszText = NoCertName.GetBuffer(NoCertName.GetLength() + 1);
  104. }
  105. else
  106. {
  107. fillItem.pszText = DnName.GetBuffer(DnName.GetLength() + 1);
  108. }
  109. m_UserAddList.SetItem(&fillItem);
  110. if (DnName.IsEmpty())
  111. {
  112. NoCertName.ReleaseBuffer();
  113. }
  114. else
  115. {
  116. DnName.ReleaseBuffer();
  117. }
  118. }
  119. }
  120. }
  121. }
  122. catch(...){
  123. m_UserAddList.DeleteAllItems( );
  124. }
  125. }
  126. LRESULT CAddEFSWizComplete::OnWizardBack()
  127. {
  128. m_UserAddList.DeleteAllItems( );
  129. return CWizard97PropertyPage::OnWizardBack();
  130. }
  131. BOOL CAddEFSWizComplete::OnWizardFinish()
  132. {
  133. CAddEFSWizSheet* pAddSheet = reinterpret_cast <CAddEFSWizSheet *> (m_pWiz);
  134. ASSERT (pAddSheet);
  135. if ( !pAddSheet )
  136. return FALSE;
  137. pAddSheet->AddNewUsers();
  138. return CWizard97PropertyPage::OnWizardFinish();
  139. }
  140. BOOL CAddEFSWizComplete::OnInitDialog()
  141. {
  142. CWizard97PropertyPage::OnInitDialog();
  143. m_bigBoldStatic.SetFont (&GetBigBoldFont ());
  144. CString UserNameTitle;
  145. CString UserDnTitle;
  146. RECT ListRect;
  147. DWORD ColWidth = 0;
  148. try {
  149. m_UserAddList.GetClientRect(&ListRect);
  150. ColWidth = (ListRect.right - ListRect.left)/2;
  151. VERIFY (UserNameTitle.LoadString(IDS_USERCOLTITLE));
  152. VERIFY (UserDnTitle.LoadString(IDS_DNCOLTITLE));
  153. m_UserAddList.InsertColumn(0, UserNameTitle, LVCFMT_LEFT, ColWidth );
  154. m_UserAddList.InsertColumn(1, UserDnTitle, LVCFMT_LEFT, ColWidth );
  155. }
  156. catch (...){
  157. }
  158. DWORD color = GetSysColor (COLOR_WINDOW);
  159. VERIFY (m_UserAddList.SetBkColor (color));
  160. return TRUE; // return TRUE unless you set the focus to a control
  161. // EXCEPTION: OCX Property Pages should return FALSE
  162. }