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.

996 lines
21 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. wservic.cpp
  5. Abstract:
  6. WWW Service Property Page
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include "common.h"
  17. #include "inetmgrapp.h"
  18. #include "inetprop.h"
  19. #include "shts.h"
  20. #include "w3sht.h"
  21. #include "wservic.h"
  22. #include "mmmdlg.h"
  23. #include "iisobj.h"
  24. #ifdef _DEBUG
  25. #undef THIS_FILE
  26. static char BASED_CODE THIS_FILE[] = __FILE__;
  27. #endif
  28. //
  29. // Values for PWS
  30. //
  31. #define LIMITED_CONNECTIONS_MIN (10)
  32. #define LIMITED_CONNECTIONS_MAX (40)
  33. //
  34. // Default SSL port
  35. //
  36. #define DEFAULT_SSL_PORT (441)
  37. //#define ZERO_IS_A_VALID_SSL_PORT
  38. IMPLEMENT_DYNCREATE(CW3ServicePage, CInetPropertyPage)
  39. CW3ServicePage::CW3ServicePage(CInetPropertySheet * pSheet)
  40. : CInetPropertyPage(CW3ServicePage::IDD, pSheet),
  41. m_nSSLPort(DEFAULT_SSL_PORT),
  42. m_nTCPPort(80),
  43. m_iSSL(-1),
  44. m_iaIpAddress(NULL_IP_ADDRESS),
  45. m_iaIpAddressSSL(NULL_IP_ADDRESS),
  46. m_strDomainName()
  47. {
  48. #ifdef _DEBUG
  49. afxMemDF |= checkAlwaysMemDF;
  50. #endif // _DEBUG
  51. #if 0 // Keep Class Wizard Happy
  52. //{{AFX_DATA_INIT(CW3ServicePage)
  53. m_nUnlimited = RADIO_LIMITED;
  54. m_nIpAddressSel = -1;
  55. m_nTCPPort = 80;
  56. m_fEnableLogging = FALSE;
  57. m_fUseKeepAlives = FALSE;
  58. m_strComment = _T("");
  59. m_strDomainName = _T("");
  60. m_nSSLPort = DEFAULT_SSL_PORT;
  61. //}}AFX_DATA_INIT
  62. m_iaIpAddress = (LONG)0L;
  63. m_iaIpAddressSSL = (LONG)0L;
  64. m_nMaxConnections = 50;
  65. m_nVisibleMaxConnections = 50;
  66. m_nConnectionTimeOut = 600;
  67. m_nSSLPort = DEFAULT_SSL_PORT;
  68. m_fUnlimitedConnections = FALSE;
  69. #endif // 0
  70. }
  71. CW3ServicePage::~CW3ServicePage()
  72. {
  73. }
  74. void
  75. CW3ServicePage::GetTopBinding()
  76. /*++
  77. Routine Description:
  78. Get the first binding information in the list
  79. --*/
  80. {
  81. //
  82. // Show primary values;
  83. //
  84. ASSERT(m_strlBindings.GetCount() > 0 || IS_MASTER_INSTANCE(QueryInstance()));
  85. if (m_strlBindings.GetCount() > 0)
  86. {
  87. CString & strBinding = m_strlBindings.GetHead();
  88. CInstanceProps::CrackBinding(strBinding, m_iaIpAddress, m_nTCPPort, m_strDomainName);
  89. }
  90. m_iSSL = -1;
  91. m_nSSLPort = -1;
  92. if (m_strlSecureBindings.GetCount() > 0)
  93. {
  94. CString strDomainName;
  95. CString & strBindingSSL = m_strlSecureBindings.GetHead();
  96. CInstanceProps::CrackBinding(strBindingSSL, m_iaIpAddressSSL, m_nSSLPort, strDomainName);
  97. //
  98. // Find SSL port that is bound to this IP address
  99. //
  100. m_iSSL = CInstanceProps::FindMatchingSecurePort(
  101. m_strlSecureBindings, m_iaIpAddressSSL, m_nSSLPort);
  102. if (-1 == m_iSSL)
  103. {
  104. m_nSSLPort = -1;
  105. }
  106. }
  107. }
  108. BOOL
  109. CW3ServicePage::StoreTopBinding()
  110. /*++
  111. Routine Description:
  112. Take values from the dialog, and put them into the top level
  113. binding string.
  114. Arguments:
  115. None
  116. Return Value:
  117. TRUE if the values are correct, FALSE otherwise.
  118. --*/
  119. {
  120. if (!FetchIpAddressFromCombo(m_combo_IpAddresses, m_oblIpAddresses, m_iaIpAddress))
  121. {
  122. //
  123. // Because UpdateData() is called before this, this should NEVER fail
  124. //
  125. ASSERT(FALSE);
  126. return FALSE;
  127. }
  128. CString strBinding;
  129. ASSERT(m_nTCPPort > 0);
  130. if (m_nTCPPort == m_nSSLPort)
  131. {
  132. //
  133. // TCP port and SSL port cannot be the same
  134. //
  135. EditShowBalloon(GetDlgItem(IDC_EDIT_SSL_PORT)->m_hWnd, IDS_TCP_SSL_PART);
  136. return FALSE;
  137. }
  138. CInstanceProps::BuildBinding(strBinding, m_iaIpAddress, m_nTCPPort, m_strDomainName);
  139. //
  140. // Check binding ok
  141. //
  142. if (m_strlBindings.GetCount() > 0)
  143. {
  144. if (!IsBindingUnique(strBinding, m_strlBindings, 0))
  145. {
  146. EditShowBalloon(GetDlgItem(IDC_EDIT_TCP_PORT)->m_hWnd, IDS_ERR_BINDING);
  147. return FALSE;
  148. }
  149. m_strlBindings.SetAt(m_strlBindings.GetHeadPosition(), strBinding);
  150. }
  151. else
  152. {
  153. m_strlBindings.AddTail(strBinding);
  154. }
  155. //
  156. // Now do the same for the SSL binding
  157. //
  158. // if (m_fCertInstalled)
  159. // {
  160. #ifdef ZERO_IS_A_VALID_SSL_PORT
  161. if (m_nSSLPort != -1)
  162. #else
  163. if (m_nSSLPort > 0 && m_nSSLPort != -1)
  164. #endif
  165. {
  166. CInstanceProps::BuildSecureBinding(strBinding, m_iaIpAddressSSL, m_nSSLPort);
  167. if (m_strlSecureBindings.GetCount() > 0)
  168. {
  169. if (IsBindingUnique(strBinding, m_strlSecureBindings, m_iSSL))
  170. {
  171. //
  172. // Find its place
  173. //
  174. if (m_iSSL != -1)
  175. {
  176. //
  177. // Replace selected entry
  178. //
  179. m_strlSecureBindings.SetAt(
  180. m_strlSecureBindings.FindIndex(m_iSSL), strBinding);
  181. }
  182. else
  183. {
  184. //
  185. // Add to end of list
  186. //
  187. ASSERT(!m_strlSecureBindings.IsEmpty());
  188. m_strlSecureBindings.AddTail(strBinding);
  189. m_iSSL = (int)m_strlSecureBindings.GetCount() - 1;
  190. }
  191. }
  192. else
  193. {
  194. //
  195. // Entry already existed in the list. This is OK, just
  196. // delete the current entry rather than bothering
  197. // to change it.
  198. //
  199. ASSERT(m_iSSL != -1);
  200. if (m_iSSL != -1)
  201. {
  202. m_strlSecureBindings.RemoveAt(
  203. m_strlSecureBindings.FindIndex(m_iSSL)
  204. );
  205. m_iSSL = CInstanceProps::FindMatchingSecurePort(
  206. m_strlSecureBindings, m_iaIpAddress, m_nSSLPort);
  207. ASSERT(m_iSSL != -1);
  208. if (-1 == m_iSSL)
  209. {
  210. m_nSSLPort = -1;
  211. }
  212. }
  213. }
  214. }
  215. else
  216. {
  217. //
  218. // List of secure bindings was empty, add new entry
  219. //
  220. m_strlSecureBindings.AddTail(strBinding);
  221. m_iSSL = 0;
  222. }
  223. }
  224. else
  225. {
  226. //
  227. // Delete the secure binding if it did exist
  228. //
  229. if (m_iSSL != -1)
  230. {
  231. m_strlSecureBindings.RemoveAt(
  232. m_strlSecureBindings.FindIndex(m_iSSL)
  233. );
  234. m_iSSL = -1;
  235. }
  236. }
  237. // }
  238. return TRUE;
  239. }
  240. void
  241. CW3ServicePage::DoDataExchange(
  242. IN CDataExchange * pDX
  243. )
  244. /*++
  245. Routine Description:
  246. Initialise/Store Control Data
  247. Arguments:
  248. CDataExchange * pDX : Data exchange object
  249. Return Value:
  250. None
  251. --*/
  252. {
  253. CInetPropertyPage::DoDataExchange(pDX);
  254. if (!pDX->m_bSaveAndValidate)
  255. {
  256. m_fEnableLogging = LoggingEnabled(m_dwLogType);
  257. }
  258. //{{AFX_DATA_MAP(CW3ServicePage)
  259. DDX_Control(pDX, IDC_BUTTON_PROPERTIES, m_button_LogProperties);
  260. DDX_Control(pDX, IDC_STATIC_LOG_PROMPT, m_static_LogPrompt);
  261. DDX_Control(pDX, IDC_EDIT_SSL_PORT, m_edit_SSLPort);
  262. DDX_Control(pDX, IDC_EDIT_TCP_PORT, m_edit_TCPPort);
  263. DDX_Control(pDX, IDC_COMBO_LOG_FORMATS, m_combo_LogFormats);
  264. DDX_Control(pDX, IDC_COMBO_IP_ADDRESS, m_combo_IpAddresses);
  265. DDX_Check(pDX, IDC_CHECK_USE_KEEPALIVE, m_fUseKeepAlives);
  266. DDX_Check(pDX, IDC_CHECK_ENABLE_LOGGING, m_fEnableLogging);
  267. DDX_Text(pDX, IDC_EDIT_COMMENT, m_strComment);
  268. DDV_MinMaxChars(pDX, m_strComment, 0, MAX_PATH);
  269. //}}AFX_DATA_MAP
  270. if ( pDX->m_bSaveAndValidate
  271. && !FetchIpAddressFromCombo(m_combo_IpAddresses, m_oblIpAddresses, m_iaIpAddress)
  272. )
  273. {
  274. pDX->Fail();
  275. }
  276. // This Needs to come before DDX_Text which will try to put text big number into small number
  277. DDV_MinMaxBalloon(pDX, IDC_EDIT_CONNECTION_TIMEOUT, 0, MAX_TIMEOUT);
  278. DDX_Text(pDX, IDC_EDIT_CONNECTION_TIMEOUT, m_nConnectionTimeOut);
  279. //
  280. // Port DDXV must be done just prior to storetopbinding,
  281. // so as to activate the right control in case of
  282. // failure
  283. //
  284. if (!IS_MASTER_INSTANCE(QueryInstance()))
  285. {
  286. DDXV_UINT(pDX, IDC_EDIT_TCP_PORT, m_nTCPPort, 1, 65535, IDS_NO_PORT);
  287. // If user will clear SSL port or set it to 0, we will remove this property
  288. if (pDX->m_bSaveAndValidate)
  289. {
  290. // user is not forced to put a number in when saving port
  291. if (GetDlgItem(IDC_EDIT_SSL_PORT)->GetWindowTextLength())
  292. {
  293. DDXV_UINT(pDX, IDC_EDIT_SSL_PORT, m_nSSLPort, 1, 65535, IDS_NO_PORT);
  294. DDX_TextBalloon(pDX, IDC_EDIT_SSL_PORT, m_nSSLPort);
  295. }
  296. else
  297. {
  298. m_nSSLPort = -1;
  299. }
  300. }
  301. else
  302. {
  303. DDXV_UINT(pDX, IDC_EDIT_SSL_PORT, m_nSSLPort, 1, 65535, IDS_NO_PORT);
  304. if (m_nSSLPort == -1)
  305. {
  306. CString strTemp = _T("");
  307. DDX_Text(pDX, IDC_EDIT_SSL_PORT, strTemp);
  308. }
  309. else
  310. {
  311. DDX_Text(pDX, IDC_EDIT_SSL_PORT, m_nSSLPort);
  312. }
  313. }
  314. }
  315. if (pDX->m_bSaveAndValidate)
  316. {
  317. if (!IS_MASTER_INSTANCE(QueryInstance()))
  318. {
  319. if (!StoreTopBinding())
  320. {
  321. pDX->Fail();
  322. }
  323. }
  324. EnableLogging(m_dwLogType, m_fEnableLogging);
  325. }
  326. }
  327. //
  328. // Message Map
  329. //
  330. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  331. BEGIN_MESSAGE_MAP(CW3ServicePage, CInetPropertyPage)
  332. //{{AFX_MSG_MAP(CW3ServicePage)
  333. // ON_BN_CLICKED(IDC_RADIO_LIMITED, OnRadioLimited)
  334. // ON_BN_CLICKED(IDC_RADIO_UNLIMITED, OnRadioUnlimited)
  335. ON_BN_CLICKED(IDC_CHECK_ENABLE_LOGGING, OnCheckEnableLogging)
  336. ON_BN_CLICKED(IDC_BUTTON_ADVANCED, OnButtonAdvanced)
  337. ON_BN_CLICKED(IDC_BUTTON_PROPERTIES, OnButtonProperties)
  338. ON_WM_DESTROY()
  339. //}}AFX_MSG_MAP
  340. ON_BN_CLICKED(IDC_CHECK_USE_KEEPALIVE, OnItemChanged)
  341. ON_EN_CHANGE(IDC_EDIT_TCP_PORT, OnItemChanged)
  342. ON_EN_CHANGE(IDC_EDIT_COMMENT, OnItemChanged)
  343. ON_EN_CHANGE(IDC_EDIT_CONNECTION_TIMEOUT, OnItemChanged)
  344. // ON_EN_CHANGE(IDC_EDIT_MAX_CONNECTIONS, OnItemChanged)
  345. ON_EN_CHANGE(IDC_EDIT_IP_ADDRESS, OnItemChanged)
  346. ON_EN_CHANGE(IDC_EDIT_SSL_PORT, OnItemChanged)
  347. ON_EN_CHANGE(IDC_EDIT_DOMAIN_NAME, OnItemChanged)
  348. ON_CBN_EDITCHANGE(IDC_COMBO_IP_ADDRESS, OnItemChanged)
  349. ON_CBN_SELCHANGE(IDC_COMBO_IP_ADDRESS, OnItemChanged)
  350. ON_CBN_SELCHANGE(IDC_COMBO_LOG_FORMATS, OnItemChanged)
  351. END_MESSAGE_MAP()
  352. void
  353. CW3ServicePage::SetControlStates()
  354. /*++
  355. Routine Description:
  356. Set control states depending on the currently selected items
  357. Arguments:
  358. None
  359. Return Value:
  360. None.
  361. --*/
  362. {
  363. // if (m_edit_MaxConnections.m_hWnd)
  364. // {
  365. // m_edit_MaxConnections.EnableWindow(!m_fUnlimitedConnections);
  366. // m_static_Connections.EnableWindow(!m_fUnlimitedConnections);
  367. // }
  368. }
  369. void
  370. CW3ServicePage::SetLogState()
  371. /*++
  372. Routine Description:
  373. Enable/disable logging controls depending on whether logging
  374. is enabled or not.
  375. Arguments:
  376. None
  377. Return Value:
  378. None
  379. --*/
  380. {
  381. m_static_LogPrompt.EnableWindow(m_fEnableLogging);
  382. m_combo_LogFormats.EnableWindow(m_fEnableLogging);
  383. m_button_LogProperties.EnableWindow(m_fEnableLogging);
  384. }
  385. //
  386. // Message Handlers
  387. //
  388. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  389. BOOL
  390. CW3ServicePage::OnSetActive()
  391. /*++
  392. Routine Description:
  393. Property page is getting activation notification
  394. Arguments:
  395. None
  396. Return Value:
  397. TRUE to activate the page, FALSE otherwise.
  398. --*/
  399. {
  400. //
  401. // No certificates, no SSL
  402. //
  403. BeginWaitCursor();
  404. m_fCertInstalled = IsCertInstalledOnServer(QueryAuthInfo(), QueryMetaPath());
  405. EndWaitCursor();
  406. GetDlgItem(IDC_STATIC_SSL_PORT)->EnableWindow(
  407. !IS_MASTER_INSTANCE(QueryInstance())
  408. && HasAdminAccess()
  409. );
  410. GetDlgItem(IDC_EDIT_SSL_PORT)->EnableWindow(
  411. !IS_MASTER_INSTANCE(QueryInstance())
  412. && HasAdminAccess()
  413. );
  414. return CInetPropertyPage::OnSetActive();
  415. }
  416. BOOL
  417. CW3ServicePage::OnInitDialog()
  418. /*++
  419. Routine Description:
  420. WM_INITDIALOG handler. Initialize the dialog.
  421. Arguments:
  422. None.
  423. Return Value:
  424. TRUE if focus is to be set automatically, FALSE if the focus
  425. is already set.
  426. --*/
  427. {
  428. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  429. CInetPropertyPage::OnInitDialog();
  430. //
  431. // Take our direction from a phony button
  432. //
  433. CRect rc(0, 0, 0, 0);
  434. VERIFY(m_ocx_LogProperties.Create(_T("LogUI"), WS_BORDER,
  435. rc, this, IDC_LOGUICTRL));
  436. //
  437. // Initialize the logging ocx
  438. //
  439. m_ocx_LogProperties.SetAdminTarget(QueryServerName(), QueryMetaPath());
  440. m_ocx_LogProperties.SetUserData(QueryAuthInfo()->QueryUserName(), QueryAuthInfo()->QueryPassword());
  441. m_ocx_LogProperties.SetComboBox(m_combo_LogFormats.m_hWnd);
  442. //
  443. // Disable non heritable properties for master instance
  444. // or operator
  445. //
  446. if (IS_MASTER_INSTANCE(QueryInstance()) || !HasAdminAccess())
  447. {
  448. GetDlgItem(IDC_STATIC_IP_ADDRESS)->EnableWindow(FALSE);
  449. GetDlgItem(IDC_COMBO_IP_ADDRESS)->EnableWindow(FALSE);
  450. GetDlgItem(IDC_STATIC_TCP_PORT)->EnableWindow(FALSE);
  451. GetDlgItem(IDC_EDIT_TCP_PORT)->EnableWindow(FALSE);
  452. GetDlgItem(IDC_STATIC_SSL_PORT)->EnableWindow(FALSE);
  453. GetDlgItem(IDC_EDIT_SSL_PORT)->EnableWindow(FALSE);
  454. GetDlgItem(IDC_BUTTON_ADVANCED)->EnableWindow(FALSE);
  455. GetDlgItem(IDC_STATIC_DESCRIPTION)->EnableWindow(FALSE);
  456. GetDlgItem(IDC_EDIT_COMMENT)->EnableWindow(FALSE);
  457. }
  458. {
  459. CWaitCursor wait;
  460. PopulateComboWithKnownIpAddresses(
  461. QueryServerName(),
  462. m_combo_IpAddresses,
  463. m_iaIpAddress,
  464. m_oblIpAddresses,
  465. m_nIpAddressSel
  466. );
  467. }
  468. SetControlStates();
  469. SetLogState();
  470. return TRUE;
  471. }
  472. /* virtual */
  473. HRESULT
  474. CW3ServicePage::FetchLoadedValues()
  475. /*++
  476. Routine Description:
  477. Move configuration data from sheet to dialog controls
  478. Arguments:
  479. None
  480. Return Value:
  481. HRESULT
  482. --*/
  483. {
  484. CError err;
  485. m_fCertInstalled = ::IsCertInstalledOnServer(QueryAuthInfo(), QueryMetaPath());
  486. BEGIN_META_INST_READ(CW3Sheet)
  487. FETCH_INST_DATA_FROM_SHEET(m_fUseKeepAlives);
  488. // FETCH_INST_DATA_FROM_SHEET(m_nMaxConnections);
  489. FETCH_INST_DATA_FROM_SHEET(m_nConnectionTimeOut);
  490. FETCH_INST_DATA_FROM_SHEET(m_strComment);
  491. FETCH_INST_DATA_FROM_SHEET(m_dwLogType);
  492. FETCH_INST_DATA_FROM_SHEET(m_strlBindings);
  493. FETCH_INST_DATA_FROM_SHEET(m_strlSecureBindings);
  494. GetTopBinding();
  495. #if 0
  496. m_fUnlimitedConnections =
  497. ((ULONG)(LONG)m_nMaxConnections >= UNLIMITED_CONNECTIONS);
  498. if (Has10ConnectionLimit())
  499. {
  500. m_fUnlimitedConnections = FALSE;
  501. if ((LONG)m_nMaxConnections > LIMITED_CONNECTIONS_MAX)
  502. {
  503. m_nMaxConnections = LIMITED_CONNECTIONS_MAX;
  504. }
  505. }
  506. //
  507. // Set the visible max connections edit field, which
  508. // may start out with a default value
  509. //
  510. m_nVisibleMaxConnections = m_fUnlimitedConnections
  511. ? INITIAL_MAX_CONNECTIONS
  512. : m_nMaxConnections;
  513. //
  514. // Set radio value
  515. //
  516. m_nUnlimited = m_fUnlimitedConnections ? RADIO_UNLIMITED : RADIO_LIMITED;
  517. #endif
  518. m_nOldTCPPort = m_nTCPPort;
  519. END_META_INST_READ(err)
  520. return err;
  521. }
  522. /* virtual */
  523. HRESULT
  524. CW3ServicePage::SaveInfo()
  525. /*++
  526. Routine Description:
  527. Save the information on this property page
  528. Arguments:
  529. BOOL fUpdateData : If TRUE, control data has not yet been stored. This
  530. is the case when "apply" is pressed.
  531. Return Value:
  532. Error return code
  533. --*/
  534. {
  535. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  536. ASSERT(IsDirty());
  537. TRACEEOLID("Saving W3 service page now...");
  538. CError err;
  539. #if 0
  540. m_nMaxConnections = m_fUnlimitedConnections
  541. ? UNLIMITED_CONNECTIONS
  542. : m_nVisibleMaxConnections;
  543. //
  544. // Check to make sure we're not violating the license
  545. // agreement
  546. //
  547. if (Has10ConnectionLimit())
  548. {
  549. if (m_nMaxConnections > LIMITED_CONNECTIONS_MAX)
  550. {
  551. DoHelpMessageBox(m_hWnd,IDS_CONNECTION_LIMIT, MB_APPLMODAL | MB_OK | MB_ICONINFORMATION, 0);
  552. m_nMaxConnections = LIMITED_CONNECTIONS_MIN;
  553. }
  554. else if (m_nMaxConnections > LIMITED_CONNECTIONS_MIN
  555. && m_nMaxConnections <= LIMITED_CONNECTIONS_MAX)
  556. {
  557. DoHelpMessageBox(m_hWnd,IDS_WRN_CONNECTION_LIMIT, MB_APPLMODAL | MB_OK | MB_ICONINFORMATION, 0);
  558. }
  559. }
  560. #endif
  561. m_ocx_LogProperties.ApplyLogSelection();
  562. // BOOL fUpdateNode = FALSE;
  563. BeginWaitCursor();
  564. BEGIN_META_INST_WRITE(CW3Sheet)
  565. STORE_INST_DATA_ON_SHEET(m_fUseKeepAlives);
  566. STORE_INST_DATA_ON_SHEET(m_nConnectionTimeOut);
  567. STORE_INST_DATA_ON_SHEET(m_strComment);
  568. // fUpdateNode = MP_D(((CW3Sheet *)GetSheet())->GetInstanceProperties().m_strComment);
  569. STORE_INST_DATA_ON_SHEET(m_dwLogType);
  570. STORE_INST_DATA_ON_SHEET(m_strlBindings);
  571. STORE_INST_DATA_ON_SHEET(m_strlSecureBindings);
  572. END_META_INST_WRITE(err)
  573. if (err.Succeeded()/* && fUpdateNode*/)
  574. {
  575. NotifyMMC(PROP_CHANGE_DISPLAY_ONLY);
  576. }
  577. EndWaitCursor();
  578. return err;
  579. }
  580. void
  581. CW3ServicePage::OnItemChanged()
  582. /*++
  583. Routine Description
  584. All EN_CHANGE and BN_CLICKED messages map to this function
  585. Arguments:
  586. None
  587. Return Value:
  588. None
  589. --*/
  590. {
  591. SetControlStates();
  592. SetModified(TRUE);
  593. }
  594. #if 0
  595. void
  596. CW3ServicePage::OnRadioLimited()
  597. /*++
  598. Routine Description:
  599. 'limited' radio button handler
  600. Arguments:
  601. None
  602. Return Value:
  603. None
  604. --*/
  605. {
  606. m_fUnlimitedConnections = FALSE;
  607. SetControlStates();
  608. m_edit_MaxConnections.SetSel(0,-1);
  609. m_edit_MaxConnections.SetFocus();
  610. OnItemChanged();
  611. }
  612. void
  613. CW3ServicePage::OnRadioUnlimited()
  614. /*++
  615. Routine Description:
  616. 'unlimited' radio button handler
  617. Arguments:
  618. None
  619. Return Value:
  620. None
  621. --*/
  622. {
  623. m_fUnlimitedConnections = TRUE;
  624. OnItemChanged();
  625. }
  626. #endif
  627. void
  628. CW3ServicePage::ShowTopBinding()
  629. /*++
  630. Routine Description:
  631. Put information about the top level binding in the dialog controls
  632. Arguments:
  633. None
  634. Return Value:
  635. None
  636. --*/
  637. {
  638. BeginWaitCursor();
  639. GetTopBinding();
  640. PopulateComboWithKnownIpAddresses(
  641. QueryServerName(),
  642. m_combo_IpAddresses,
  643. m_iaIpAddress,
  644. m_oblIpAddresses,
  645. m_nIpAddressSel
  646. );
  647. EndWaitCursor();
  648. CString strTCPPort, strSSLPort;
  649. if (m_nTCPPort)
  650. {
  651. strTCPPort.Format(_T("%ld"), m_nTCPPort);
  652. }
  653. #ifdef ZERO_IS_A_VALID_SSL_PORT
  654. if (-1 == m_nSSLPort)
  655. #else
  656. if (0 == m_nSSLPort || -1 == m_nSSLPort)
  657. #endif
  658. {
  659. strSSLPort = _T("");
  660. }
  661. else
  662. {
  663. strSSLPort.Format(_T("%ld"), m_nSSLPort);
  664. }
  665. m_edit_TCPPort.SetWindowText(strTCPPort);
  666. m_edit_SSLPort.SetWindowText(strSSLPort);
  667. }
  668. void
  669. CW3ServicePage::OnButtonAdvanced()
  670. /*++
  671. Routine Description:
  672. 'advanced' button handler -- bring up the bindings dialog
  673. Arguments:
  674. None
  675. Return Value:
  676. None
  677. --*/
  678. {
  679. if (!UpdateData(TRUE))
  680. {
  681. return;
  682. }
  683. CMMMDlg dlg(
  684. QueryServerName(),
  685. QueryInstance(),
  686. QueryAuthInfo(),
  687. QueryMetaPath(),
  688. m_strlBindings,
  689. m_strlSecureBindings,
  690. this
  691. );
  692. if (dlg.DoModal() == IDOK)
  693. {
  694. //
  695. // Get information about the top level binding
  696. //
  697. m_strlBindings.RemoveAll();
  698. m_strlSecureBindings.RemoveAll();
  699. m_strlBindings.AddTail(&(dlg.GetBindings()));
  700. m_strlSecureBindings.AddTail(&(dlg.GetSecureBindings()));
  701. ShowTopBinding();
  702. OnItemChanged();
  703. }
  704. }
  705. void
  706. CW3ServicePage::OnCheckEnableLogging()
  707. /*++
  708. Routine Description:
  709. 'enable logging' checkbox handler
  710. Arguments:
  711. None
  712. Return Value:
  713. None
  714. --*/
  715. {
  716. m_fEnableLogging = !m_fEnableLogging;
  717. SetLogState();
  718. OnItemChanged();
  719. }
  720. void
  721. CW3ServicePage::OnButtonProperties()
  722. /*++
  723. Routine Description:
  724. Pass on "log properties" button click to the ocx.
  725. Arguments:
  726. None
  727. Return Value:
  728. None
  729. --*/
  730. {
  731. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  732. m_ocx_LogProperties.DoClick();
  733. }
  734. void
  735. CW3ServicePage::OnDestroy()
  736. /*++
  737. Routine Description:
  738. WM_DESTROY handler. Clean up internal data
  739. Arguments:
  740. None
  741. Return Value:
  742. None
  743. --*/
  744. {
  745. CInetPropertyPage::OnDestroy();
  746. if (m_ocx_LogProperties.m_hWnd)
  747. {
  748. m_ocx_LogProperties.Terminate();
  749. }
  750. }