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.

293 lines
7.1 KiB

  1. // ChooseServerPages.cpp: implementation of the CChooseServerPages class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "certwiz.h"
  6. #include "Certificat.h"
  7. #include "ChooseServerPages.h"
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char THIS_FILE[]=__FILE__;
  11. #define new DEBUG_NEW
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CChooseServerPages property page
  15. IMPLEMENT_DYNCREATE(CChooseServerPages, CIISWizardPage)
  16. CChooseServerPages::CChooseServerPages(CCertificate * pCert)
  17. : CIISWizardPage(CChooseServerPages::IDD, IDS_CERTWIZ, TRUE),
  18. m_pCert(pCert)
  19. {
  20. //{{AFX_DATA_INIT(CChooseServerPages)
  21. m_ServerName = _T("");
  22. m_UserName = _T("");
  23. m_UserPassword = _T("");
  24. //}}AFX_DATA_INIT
  25. }
  26. CChooseServerPages::~CChooseServerPages()
  27. {
  28. }
  29. void CChooseServerPages::DoDataExchange(CDataExchange* pDX)
  30. {
  31. CIISWizardPage::DoDataExchange(pDX);
  32. //{{AFX_DATA_MAP(CChooseServerPages)
  33. DDX_Text(pDX, IDC_SERVER_NAME, m_ServerName);
  34. DDX_Text(pDX, IDC_USER_NAME, m_UserName);
  35. DDX_Text(pDX, IDC_USER_PASSWORD, m_UserPassword);
  36. DDV_MaxChars(pDX, m_ServerName, 64);
  37. //}}AFX_DATA_MAP
  38. }
  39. LRESULT
  40. CChooseServerPages::OnWizardBack()
  41. /*++
  42. Routine Description:
  43. Prev button handler
  44. Arguments:
  45. None
  46. Return Value:
  47. 0 to automatically advance to the prev page;
  48. 1 to prevent the page from changing.
  49. To jump to a page other than the prev one,
  50. return the identifier of the dialog to be displayed.
  51. --*/
  52. {
  53. return IDD_PAGE_PREV;
  54. }
  55. LRESULT
  56. CChooseServerPages::OnWizardNext()
  57. {
  58. UpdateData(TRUE);
  59. if (0 != m_ServerName.Compare(m_pCert->m_MachineName_Remote))
  60. {
  61. m_pCert->m_MachineName_Remote = m_ServerName;
  62. }
  63. m_pCert->m_UserName_Remote = m_UserName;
  64. m_pCert->m_UserPassword_Remote = m_UserPassword;
  65. return IDD_PAGE_NEXT;
  66. }
  67. BOOL
  68. CChooseServerPages::OnSetActive()
  69. {
  70. ASSERT(m_pCert != NULL);
  71. m_ServerName = m_pCert->m_MachineName_Remote;
  72. m_UserName = m_pCert->m_UserName_Remote;
  73. m_UserPassword = m_pCert->m_UserPassword_Remote;
  74. UpdateData(FALSE);
  75. SetWizardButtons(m_ServerName.IsEmpty() ?
  76. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  77. return CIISWizardPage::OnSetActive();
  78. }
  79. BOOL
  80. CChooseServerPages::OnKillActive()
  81. {
  82. UpdateData();
  83. m_pCert->m_MachineName_Remote = m_ServerName;
  84. m_pCert->m_UserName_Remote = m_UserName;
  85. m_pCert->m_UserPassword_Remote = m_UserPassword;
  86. return CIISWizardPage::OnKillActive();
  87. }
  88. BEGIN_MESSAGE_MAP(CChooseServerPages, CIISWizardPage)
  89. //{{AFX_MSG_MAP(CChooseServerPages)
  90. ON_EN_CHANGE(IDC_SERVER_NAME, OnEditchangeServerName)
  91. ON_EN_CHANGE(IDC_USER_NAME, OnEditchangeUserName)
  92. ON_EN_CHANGE(IDC_USER_PASSWORD, OnEditchangeUserPassword)
  93. ON_BN_CLICKED(IDC_BROWSE_BTN, OnBrowseForMachine)
  94. //}}AFX_MSG_MAP
  95. END_MESSAGE_MAP()
  96. /////////////////////////////////////////////////////////////////////////////
  97. // CSiteNamePage message handlers
  98. void CChooseServerPages::OnEditchangeServerName()
  99. {
  100. UpdateData(TRUE);
  101. SetWizardButtons(m_ServerName.IsEmpty() ?
  102. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  103. CString str;
  104. SetDlgItemText(IDC_ERROR_TEXT, str);
  105. }
  106. void CChooseServerPages::OnEditchangeUserName()
  107. {
  108. UpdateData(TRUE);
  109. SetWizardButtons(m_ServerName.IsEmpty() ?
  110. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  111. CString str;
  112. SetDlgItemText(IDC_ERROR_TEXT, str);
  113. }
  114. void CChooseServerPages::OnEditchangeUserPassword()
  115. {
  116. UpdateData(TRUE);
  117. SetWizardButtons(m_ServerName.IsEmpty() ?
  118. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  119. CString str;
  120. SetDlgItemText(IDC_ERROR_TEXT, str);
  121. }
  122. void CChooseServerPages::OnBrowseForMachine()
  123. {
  124. CGetComputer picker;
  125. if (picker.GetComputer(m_hWnd))
  126. {
  127. SetDlgItemText(IDC_SERVER_NAME, picker.m_strComputerName);
  128. }
  129. return;
  130. }
  131. /////////////////////////////////////////////////////////////////////////////
  132. // CChooseServerPages property page
  133. IMPLEMENT_DYNCREATE(CChooseServerPagesTo, CIISWizardPage)
  134. CChooseServerPagesTo::CChooseServerPagesTo(CCertificate * pCert)
  135. : CIISWizardPage(CChooseServerPagesTo::IDD, IDS_CERTWIZ, TRUE),
  136. m_pCert(pCert)
  137. {
  138. //{{AFX_DATA_INIT(CChooseServerPagesTo)
  139. m_ServerName = _T("");
  140. m_UserName = _T("");
  141. m_UserPassword = _T("");
  142. //}}AFX_DATA_INIT
  143. }
  144. CChooseServerPagesTo::~CChooseServerPagesTo()
  145. {
  146. }
  147. void CChooseServerPagesTo::DoDataExchange(CDataExchange* pDX)
  148. {
  149. CIISWizardPage::DoDataExchange(pDX);
  150. //{{AFX_DATA_MAP(CChooseServerPagesTo)
  151. DDX_Text(pDX, IDC_SERVER_NAME, m_ServerName);
  152. DDX_Text(pDX, IDC_USER_NAME, m_UserName);
  153. DDX_Text(pDX, IDC_USER_PASSWORD, m_UserPassword);
  154. DDV_MaxChars(pDX, m_ServerName, 64);
  155. //}}AFX_DATA_MAP
  156. }
  157. LRESULT
  158. CChooseServerPagesTo::OnWizardBack()
  159. /*++
  160. Routine Description:
  161. Prev button handler
  162. Arguments:
  163. None
  164. Return Value:
  165. 0 to automatically advance to the prev page;
  166. 1 to prevent the page from changing.
  167. To jump to a page other than the prev one,
  168. return the identifier of the dialog to be displayed.
  169. --*/
  170. {
  171. return IDD_PAGE_PREV;
  172. }
  173. LRESULT
  174. CChooseServerPagesTo::OnWizardNext()
  175. {
  176. UpdateData(TRUE);
  177. if (0 != m_ServerName.Compare(m_pCert->m_MachineName_Remote))
  178. {
  179. m_pCert->m_MachineName_Remote = m_ServerName;
  180. }
  181. m_pCert->m_UserName_Remote = m_UserName;
  182. m_pCert->m_UserPassword_Remote = m_UserPassword;
  183. return IDD_PAGE_NEXT;
  184. }
  185. BOOL
  186. CChooseServerPagesTo::OnSetActive()
  187. {
  188. ASSERT(m_pCert != NULL);
  189. m_ServerName = m_pCert->m_MachineName_Remote;
  190. m_UserName = m_pCert->m_UserName_Remote;
  191. m_UserPassword = m_pCert->m_UserPassword_Remote;
  192. UpdateData(FALSE);
  193. SetWizardButtons(m_ServerName.IsEmpty() ?
  194. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  195. return CIISWizardPage::OnSetActive();
  196. }
  197. BOOL
  198. CChooseServerPagesTo::OnKillActive()
  199. {
  200. UpdateData();
  201. m_pCert->m_MachineName_Remote = m_ServerName;
  202. m_pCert->m_UserName_Remote = m_UserName;
  203. m_pCert->m_UserPassword_Remote = m_UserPassword;
  204. return CIISWizardPage::OnKillActive();
  205. }
  206. BEGIN_MESSAGE_MAP(CChooseServerPagesTo, CIISWizardPage)
  207. //{{AFX_MSG_MAP(CChooseServerPagesTo)
  208. ON_EN_CHANGE(IDC_SERVER_NAME, OnEditchangeServerName)
  209. ON_EN_CHANGE(IDC_USER_NAME, OnEditchangeUserName)
  210. ON_EN_CHANGE(IDC_USER_PASSWORD, OnEditchangeUserPassword)
  211. ON_BN_CLICKED(IDC_BROWSE_BTN, OnBrowseForMachine)
  212. //}}AFX_MSG_MAP
  213. END_MESSAGE_MAP()
  214. /////////////////////////////////////////////////////////////////////////////
  215. // CSiteNamePage message handlers
  216. void CChooseServerPagesTo::OnEditchangeServerName()
  217. {
  218. UpdateData(TRUE);
  219. SetWizardButtons(m_ServerName.IsEmpty() ?
  220. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  221. CString str;
  222. SetDlgItemText(IDC_ERROR_TEXT, str);
  223. }
  224. void CChooseServerPagesTo::OnEditchangeUserName()
  225. {
  226. UpdateData(TRUE);
  227. SetWizardButtons(m_ServerName.IsEmpty() ?
  228. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  229. CString str;
  230. SetDlgItemText(IDC_ERROR_TEXT, str);
  231. }
  232. void CChooseServerPagesTo::OnEditchangeUserPassword()
  233. {
  234. UpdateData(TRUE);
  235. SetWizardButtons(m_ServerName.IsEmpty() ?
  236. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  237. CString str;
  238. SetDlgItemText(IDC_ERROR_TEXT, str);
  239. }
  240. void CChooseServerPagesTo::OnBrowseForMachine()
  241. {
  242. CGetComputer picker;
  243. if (picker.GetComputer(m_hWnd))
  244. {
  245. SetDlgItemText(IDC_SERVER_NAME, picker.m_strComputerName);
  246. }
  247. return;
  248. }