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.

1087 lines
22 KiB

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