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.

1641 lines
36 KiB

  1. /*++
  2. Copyright (c) 1994-95 Microsoft Corporation
  3. Module Name:
  4. srvppgr.cpp
  5. Abstract:
  6. Server property page (repl) implementation.
  7. Author:
  8. Don Ryan (donryan) 02-Feb-1995
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. Chandana Surlu 05-Apr-1995 Redid the replication dialog (mostly modeled after liccpa.cpl)
  13. JeffParh (jeffparh) 16-Dec-1996
  14. o Disallowed server as own enterprise server.
  15. o Changed "Start At" to use locale info for time format rather than
  16. private registry settings. Merged OnClose() functionality into
  17. OnKillActive().
  18. o Added warning of possible license loss when changing replication
  19. target server.
  20. o No longer automatically saves when page is flipped.
  21. --*/
  22. #include "stdafx.h"
  23. #include "llsmgr.h"
  24. #include "srvppgr.h"
  25. extern "C"
  26. {
  27. #include <lmcons.h>
  28. #include <icanon.h>
  29. }
  30. #ifndef WS_EX_CLIENTEDGE
  31. #define WS_EX_CLIENTEDGE 0x00000200L
  32. #endif // WS_EX_CLIENTEDGE
  33. #ifdef _DEBUG
  34. #undef THIS_FILE
  35. static char BASED_CODE THIS_FILE[] = __FILE__;
  36. #endif
  37. IMPLEMENT_DYNCREATE(CServerPropertyPageReplication, CPropertyPage)
  38. BEGIN_MESSAGE_MAP(CServerPropertyPageReplication, CPropertyPage)
  39. //{{AFX_MSG_MAP(CServerPropertyPageReplication)
  40. ON_BN_CLICKED(IDC_PP_SERVER_REPLICATION_AT, OnAt)
  41. ON_BN_CLICKED(IDC_PP_SERVER_REPLICATION_DC, OnDc)
  42. ON_BN_CLICKED(IDC_PP_SERVER_REPLICATION_ESRV, OnEsrv)
  43. ON_BN_CLICKED(IDC_PP_SERVER_REPLICATION_EVERY, OnEvery)
  44. ON_WM_CTLCOLOR()
  45. ON_LBN_SETFOCUS(IDC_PP_SERVER_REPLICATION_AT_AMPM, OnSetfocusAmpm)
  46. ON_LBN_KILLFOCUS(IDC_PP_SERVER_REPLICATION_AT_AMPM, OnKillfocusAmpm)
  47. ON_EN_KILLFOCUS(IDC_PP_SERVER_REPLICATION_AT_HOUR, OnKillFocusHour)
  48. ON_EN_SETFOCUS(IDC_PP_SERVER_REPLICATION_AT_HOUR, OnSetFocusHour)
  49. ON_EN_KILLFOCUS(IDC_PP_SERVER_REPLICATION_AT_MINUTE, OnKillFocusMinute)
  50. ON_EN_SETFOCUS(IDC_PP_SERVER_REPLICATION_AT_MINUTE, OnSetFocusMinute)
  51. ON_EN_SETFOCUS(IDC_PP_SERVER_REPLICATION_AT_SECOND, OnSetFocusSecond)
  52. ON_EN_KILLFOCUS(IDC_PP_SERVER_REPLICATION_AT_SECOND, OnKillFocusSecond)
  53. ON_EN_SETFOCUS(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, OnSetfocusEvery)
  54. ON_EN_KILLFOCUS(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, OnKillfocusEvery)
  55. ON_EN_UPDATE(IDC_PP_SERVER_REPLICATION_ESRV_NAME, OnUpdateEsrvName)
  56. ON_EN_UPDATE(IDC_PP_SERVER_REPLICATION_AT_HOUR, OnUpdateAtHour)
  57. ON_EN_UPDATE(IDC_PP_SERVER_REPLICATION_AT_MINUTE, OnUpdateAtMinute)
  58. ON_EN_UPDATE(IDC_PP_SERVER_REPLICATION_AT_SECOND, OnUpdateAtSecond)
  59. ON_EN_UPDATE(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, OnUpdateEveryValue)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. CServerPropertyPageReplication::CServerPropertyPageReplication()
  63. : CPropertyPage(CServerPropertyPageReplication::IDD)
  64. /*++
  65. Routine Description:
  66. Constructor for server properties (replication).
  67. Arguments:
  68. None.
  69. Return Values:
  70. None.
  71. --*/
  72. {
  73. //{{AFX_DATA_INIT(CServerPropertyPageReplication)
  74. //}}AFX_DATA_INIT
  75. m_pServer = NULL;
  76. m_bReplAt = FALSE;
  77. m_bUseEsrv = FALSE;
  78. m_bOnInit = TRUE;
  79. m_nHourMax = HOUR_MAX_24;
  80. m_nHourMin = HOUR_MIN_24;
  81. }
  82. CServerPropertyPageReplication::~CServerPropertyPageReplication()
  83. /*++
  84. Routine Description:
  85. Destructor for server properties (replication).
  86. Arguments:
  87. None.
  88. Return Values:
  89. None.
  90. --*/
  91. {
  92. //
  93. // Nothing to do here.
  94. //
  95. }
  96. void CServerPropertyPageReplication::DoDataExchange(CDataExchange* pDX)
  97. /*++
  98. Routine Description:
  99. Called by framework to exchange dialog data.
  100. Arguments:
  101. pDX - data exchange object.
  102. Return Values:
  103. None.
  104. --*/
  105. {
  106. CPropertyPage::DoDataExchange(pDX);
  107. //{{AFX_DATA_MAP(CServerPropertyPageReplication)
  108. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_EVERY_VALUE, m_everyEdit);
  109. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_ESRV_NAME, m_esrvEdit);
  110. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT, m_atBtn);
  111. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_EVERY, m_everyBtn);
  112. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_DC, m_dcBtn);
  113. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_ESRV, m_esrvBtn);
  114. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_SPIN_AT, m_spinAt);
  115. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_SPIN_EVERY, m_spinEvery);
  116. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_BORDER, m_atBorderEdit);
  117. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_SEP1, m_atSep1Edit);
  118. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_SEP2, m_atSep2Edit);
  119. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_HOUR, m_atHourEdit);
  120. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_MINUTE, m_atMinEdit);
  121. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_SECOND, m_atSecEdit);
  122. DDX_Control(pDX, IDC_PP_SERVER_REPLICATION_AT_AMPM, m_atAmPmEdit);
  123. //}}AFX_DATA_MAP
  124. }
  125. void CServerPropertyPageReplication::InitPage(CServer* pServer)
  126. /*++
  127. Routine Description:
  128. Initializes server property page (replication).
  129. Arguments:
  130. pServer - server object.
  131. Return Values:
  132. None.
  133. --*/
  134. {
  135. ASSERT_VALID(pServer);
  136. m_pServer = pServer;
  137. }
  138. BOOL CServerPropertyPageReplication::OnInitDialog()
  139. /*++
  140. Routine Description:
  141. Message handler for WM_INITDIALOG.
  142. Arguments:
  143. None.
  144. Return Values:
  145. VT_BOOL.
  146. --*/
  147. {
  148. BeginWaitCursor();
  149. GetProfile();
  150. CPropertyPage::OnInitDialog();
  151. if (!m_bIsMode24)
  152. {
  153. m_atAmPmEdit.InsertString(0, m_str1159);
  154. m_atAmPmEdit.InsertString(1, m_str2359);
  155. m_atAmPmEdit.InsertString(2, TEXT("")); // fake it for the 24 hour mode
  156. }
  157. // Do the edit text limits
  158. m_everyEdit.LimitText(2);
  159. m_esrvEdit.LimitText(MAX_PATH); // we'll eat up the \\ chars
  160. m_atHourEdit.LimitText(2);
  161. m_atMinEdit.LimitText(2);
  162. m_atSecEdit.LimitText(2);
  163. m_spinEvery.SetRange(INTERVAL_MIN, INTERVAL_MAX);
  164. if (Refresh())
  165. {
  166. // UpdateData(FALSE);
  167. }
  168. else
  169. {
  170. theApp.DisplayLastStatus();
  171. }
  172. m_atBorderEdit.ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_DRAWFRAME);
  173. if (m_bReplAt)
  174. m_atHourEdit.SetFocus();
  175. else
  176. m_everyEdit.SetFocus();
  177. if ( m_pServer->IsWin2000() )
  178. {
  179. m_esrvEdit.EnableWindow(FALSE);
  180. m_dcBtn.EnableWindow(FALSE);
  181. m_esrvBtn.EnableWindow(FALSE);
  182. CWnd * pWndMasterGB = GetDlgItem( IDC_PP_SERVER_REPLICATION_MASTER_GB );
  183. ASSERT( pWndMasterGB != NULL );
  184. if (pWndMasterGB != NULL)
  185. {
  186. pWndMasterGB->EnableWindow(FALSE);
  187. }
  188. }
  189. else
  190. {
  191. if (m_bUseEsrv)
  192. m_esrvEdit.SetFocus();
  193. }
  194. m_bOnInit = FALSE;
  195. EndWaitCursor();
  196. return FALSE; // return TRUE unless you set the focus to a control
  197. // EXCEPTION: OCX Property Pages should return FALSE
  198. }
  199. BOOL CServerPropertyPageReplication::Refresh()
  200. /*++
  201. Routine Description:
  202. Refreshs property page.
  203. Arguments:
  204. None.
  205. Return Values:
  206. VT_BOOL.
  207. --*/
  208. {
  209. if (m_bReplAt = m_pServer->IsReplicatingDaily())
  210. {
  211. DWORD dwTemp = m_pServer->GetReplicationTime();
  212. m_nHour = dwTemp / (60 * 60);
  213. m_nMinute = (dwTemp - (m_nHour * 60 * 60)) / 60;
  214. m_nSecond = dwTemp - (m_nHour * 60 * 60) - (m_nMinute * 60);
  215. m_nStartingHour = DEFAULT_EVERY; // When the every button is selected, we always show the default.
  216. if (!m_bIsMode24)
  217. { // it's in 12 hour format
  218. if (m_nHour > 12)
  219. {
  220. m_bPM = TRUE;
  221. m_nHour -= 12;
  222. }
  223. else if (m_nHour == 12)
  224. {
  225. m_bPM = TRUE;
  226. }
  227. else
  228. {
  229. if (m_nHour == 0)
  230. m_nHour = m_nHourMax;
  231. m_bPM = FALSE;
  232. }
  233. }
  234. }
  235. else
  236. {
  237. m_nStartingHour = m_pServer->GetReplicationTime() / 3600;
  238. if (!m_bIsMode24)
  239. // it's in 12 hour format
  240. m_nHour = m_nHourMax;
  241. else
  242. m_nHour = m_nHourMin;
  243. m_nMinute = MINUTE_MIN;
  244. m_nSecond = SECOND_MIN;
  245. m_bPM = FALSE;
  246. }
  247. m_bUseEsrv = !m_pServer->IsReplicatingToDC();
  248. if (m_bReplAt)
  249. {
  250. OnAt();
  251. }
  252. else
  253. {
  254. OnEvery();
  255. }
  256. if (m_bUseEsrv)
  257. {
  258. BSTR bstrEnterpriseServer = m_pServer->GetController();
  259. m_strEnterpriseServer = bstrEnterpriseServer;
  260. SysFreeString(bstrEnterpriseServer);
  261. OnEsrv();
  262. }
  263. else
  264. {
  265. OnDc();
  266. }
  267. return TRUE;
  268. }
  269. void CServerPropertyPageReplication::OnAt()
  270. /*++
  271. Routine Description:
  272. Enables LLS_REPLICATION_TYPE_TIME controls.
  273. Arguments:
  274. None.
  275. Return Values:
  276. None.
  277. --*/
  278. {
  279. // change time edit control bg color
  280. m_atBorderEdit.Invalidate();
  281. m_atBorderEdit.UpdateWindow();
  282. m_atSep1Edit.Invalidate();
  283. m_atSep1Edit.UpdateWindow();
  284. m_atSep2Edit.Invalidate();
  285. m_atSep2Edit.UpdateWindow();
  286. if (!m_bOnInit) SetModified(TRUE);
  287. m_bReplAt = TRUE;
  288. m_atBtn.SetCheck(TRUE);
  289. m_everyBtn.SetCheck(FALSE);
  290. TCHAR szTemp[3];
  291. if (m_bIsHourLZ)
  292. {
  293. wsprintf(szTemp, TEXT("%02u"), m_nHour);
  294. szTemp[2] = NULL;
  295. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_HOUR, szTemp);
  296. }
  297. else
  298. SetDlgItemInt(IDC_PP_SERVER_REPLICATION_AT_HOUR, m_nHour);
  299. wsprintf(szTemp, TEXT("%02u"), m_nMinute);
  300. szTemp[2] = NULL;
  301. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_MINUTE, szTemp);
  302. wsprintf(szTemp, TEXT("%02u"), m_nSecond);
  303. szTemp[2] = NULL;
  304. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SECOND, szTemp);
  305. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SEP1, m_strSep1);
  306. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SEP2, m_strSep1);
  307. if (m_bPM)
  308. m_atAmPmEdit.SetTopIndex(1);
  309. else
  310. m_atAmPmEdit.SetTopIndex(0);
  311. SetDlgItemText(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, TEXT(""));
  312. m_everyEdit.EnableWindow(FALSE);
  313. m_spinEvery.EnableWindow(FALSE);
  314. m_atHourEdit.EnableWindow(TRUE);
  315. m_atMinEdit.EnableWindow(TRUE);
  316. m_atSecEdit.EnableWindow(TRUE);
  317. m_spinAt.EnableWindow(TRUE);
  318. if ( m_bIsMode24 )
  319. {
  320. m_atAmPmEdit.ShowWindow( SW_HIDE );
  321. }
  322. else
  323. {
  324. m_atAmPmEdit.ShowWindow( SW_SHOWNOACTIVATE );
  325. m_atAmPmEdit.EnableWindow( TRUE );
  326. }
  327. m_atBtn.SetFocus();
  328. }
  329. void CServerPropertyPageReplication::OnEvery()
  330. /*++
  331. Routine Description:
  332. Enables LLS_REPLICATION_TYPE_DELTA controls.
  333. Arguments:
  334. None.
  335. Return Values:
  336. None.
  337. --*/
  338. {
  339. // change time edit control bg color
  340. m_atBorderEdit.Invalidate();
  341. m_atBorderEdit.UpdateWindow();
  342. m_atSep1Edit.Invalidate();
  343. m_atSep1Edit.UpdateWindow();
  344. m_atSep2Edit.Invalidate();
  345. m_atSep2Edit.UpdateWindow();
  346. if (!m_bOnInit) SetModified(TRUE);
  347. m_bReplAt = FALSE;
  348. m_atBtn.SetCheck(FALSE);
  349. m_everyBtn.SetCheck(TRUE);
  350. SetDlgItemInt(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, m_nStartingHour);
  351. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_HOUR, TEXT(""));
  352. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_MINUTE, TEXT(""));
  353. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SECOND, TEXT(""));
  354. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SEP1, TEXT(""));
  355. SetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SEP2, TEXT(""));
  356. m_atAmPmEdit.SetTopIndex(2); // Have to fake this
  357. m_atHourEdit.EnableWindow(FALSE);
  358. m_atMinEdit.EnableWindow(FALSE);
  359. m_atSecEdit.EnableWindow(FALSE);
  360. m_spinAt.EnableWindow(FALSE);
  361. m_atAmPmEdit.EnableWindow(FALSE);
  362. m_atAmPmEdit.ShowWindow( SW_HIDE );
  363. m_everyEdit.EnableWindow(TRUE);
  364. m_spinEvery.EnableWindow(TRUE);
  365. m_everyBtn.SetFocus();
  366. }
  367. void CServerPropertyPageReplication::OnDc()
  368. /*++
  369. Routine Description:
  370. Enables LLS_REPLICATION_TYPE_DELTA controls.
  371. Arguments:
  372. None.
  373. Return Values:
  374. None.
  375. --*/
  376. {
  377. if (!m_bOnInit) SetModified(TRUE);
  378. m_bUseEsrv = FALSE;
  379. m_dcBtn.SetCheck(TRUE);
  380. m_esrvBtn.SetCheck(FALSE);
  381. SetDlgItemText(IDC_PP_SERVER_REPLICATION_ESRV_NAME, TEXT(""));
  382. m_esrvEdit.EnableWindow(FALSE);
  383. m_dcBtn.SetFocus();
  384. }
  385. void CServerPropertyPageReplication::OnEsrv()
  386. /*++
  387. Routine Description:
  388. Enables LLS_REPLICATION_TYPE_DELTA controls.
  389. Arguments:
  390. None.
  391. Return Values:
  392. None.
  393. --*/
  394. {
  395. if (!m_bOnInit) SetModified(TRUE);
  396. m_bUseEsrv = TRUE;
  397. m_dcBtn.SetCheck(FALSE);
  398. m_esrvBtn.SetCheck(TRUE);
  399. m_esrvEdit.EnableWindow(TRUE);
  400. SetDlgItemText(IDC_PP_SERVER_REPLICATION_ESRV_NAME, m_strEnterpriseServer);
  401. m_esrvBtn.SetFocus();
  402. }
  403. BOOL CServerPropertyPageReplication::OnKillActive()
  404. /*++
  405. Routine Description:
  406. Process property page (replication).
  407. Arguments:
  408. None.
  409. Return Values:
  410. Returns true if successful.
  411. --*/
  412. {
  413. short nID;
  414. BOOL fBeep = TRUE;
  415. if ( EditValidate(&nID, &fBeep))
  416. {
  417. return TRUE;
  418. }
  419. else
  420. {
  421. EditInvalidDlg(fBeep);
  422. return FALSE;
  423. }
  424. }
  425. HBRUSH CServerPropertyPageReplication::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  426. /*++
  427. Routine Description:
  428. Message handler for WM_CTLCOLOR.
  429. Arguments:
  430. pDC - device context.
  431. pWnd - control window.
  432. nCtlColor - color selected.
  433. Return Values:
  434. Brush of background color.
  435. --*/
  436. {
  437. if ( ( m_atBtn.GetCheck() )
  438. && ( ( pWnd == &m_atSep1Edit )
  439. || ( pWnd == &m_atSep2Edit )
  440. || ( pWnd == &m_atBorderEdit ) ) )
  441. {
  442. return (HBRUSH)DefWindowProc(WM_CTLCOLOREDIT, (WPARAM)pDC->GetSafeHdc(), (LPARAM)pWnd->GetSafeHwnd());
  443. }
  444. else
  445. {
  446. return CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
  447. }
  448. }
  449. void CServerPropertyPageReplication::GetProfile()
  450. /*++
  451. Routine Description:
  452. Loads international config info.
  453. Arguments:
  454. None.
  455. Return Values:
  456. None..
  457. --*/
  458. {
  459. int cch;
  460. int cchBuffer;
  461. LPTSTR pszBuffer;
  462. TCHAR szValue[ 2 ];
  463. // defaults in case of memory allocation failure
  464. m_strSep1 = TEXT( ":" );
  465. m_strSep2 = TEXT( ":" );
  466. m_str1159 = TEXT( "AM" );
  467. m_str2359 = TEXT( "PM" );
  468. m_bIsMode24 = FALSE;
  469. m_bIsHourLZ = FALSE;
  470. // time seperator
  471. cchBuffer = 16;
  472. pszBuffer = m_strSep1.GetBuffer( cchBuffer );
  473. ASSERT( NULL != pszBuffer );
  474. if ( NULL != pszBuffer )
  475. {
  476. cch = GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_STIME, pszBuffer, cchBuffer );
  477. m_strSep1.ReleaseBuffer();
  478. ASSERT( cch > 0 );
  479. m_strSep2 = m_strSep1;
  480. }
  481. // AM string
  482. cchBuffer = 16;
  483. pszBuffer = m_str1159.GetBuffer( cchBuffer );
  484. ASSERT( NULL != pszBuffer );
  485. if ( NULL != pszBuffer )
  486. {
  487. cch = GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_S1159, pszBuffer, cchBuffer );
  488. m_str1159.ReleaseBuffer();
  489. ASSERT( cch > 0 );
  490. }
  491. // PM string
  492. cchBuffer = 16;
  493. pszBuffer = m_str2359.GetBuffer( cchBuffer );
  494. ASSERT( NULL != pszBuffer );
  495. if ( NULL != pszBuffer )
  496. {
  497. cch = GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_S2359, pszBuffer, cchBuffer );
  498. m_str2359.ReleaseBuffer();
  499. ASSERT( cch > 0 );
  500. }
  501. // Leading zero for hours?
  502. cch = GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_ITLZERO, szValue, sizeof( szValue ) / sizeof( TCHAR ) );
  503. ASSERT( cch > 0 );
  504. if ( cch > 0 )
  505. {
  506. m_bIsHourLZ = _wtoi( szValue );
  507. }
  508. // time format; 0 = AM/PM, 1 = 24hr
  509. cch = GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_ITIME, szValue, sizeof( szValue ) / sizeof( TCHAR ) );
  510. ASSERT( cch > 0 );
  511. if ( cch > 0 )
  512. {
  513. m_bIsMode24 = _wtoi( szValue );
  514. }
  515. if (!m_bIsMode24)
  516. {
  517. m_nHourMax = HOUR_MAX_12;
  518. m_nHourMin = HOUR_MIN_12;
  519. }
  520. if ( NULL == pszBuffer )
  521. {
  522. theApp.DisplayStatus( STATUS_NO_MEMORY );
  523. }
  524. }
  525. void CServerPropertyPageReplication::OnSetfocusAmpm()
  526. /*++
  527. Routine Description:
  528. Message handler for Listbox control IDC_PP_SERVER_REPLICATION_AT_AMPM on message LBN_SETFOCUS.
  529. Arguments:
  530. None.
  531. Return Values:
  532. None..
  533. --*/
  534. {
  535. if (!m_bOnInit) SetModified(TRUE);
  536. m_spinAt.SetRange(0, 1);
  537. m_spinAt.SetBuddy(&m_atAmPmEdit);
  538. }
  539. void CServerPropertyPageReplication::OnKillfocusAmpm()
  540. /*++
  541. Routine Description:
  542. Message handler for Listbox control IDC_PP_SERVER_REPLICATION_AT_AMPM on message LBN_KILLFOCUS.
  543. Arguments:
  544. None.
  545. Return Values:
  546. None..
  547. --*/
  548. {
  549. m_atAmPmEdit.SetCurSel(-1);
  550. //if (m_spinAt.GetBuddy() == &m_atAmPmEdit)
  551. // m_spinAt.SendMessage(UDM_SETBUDDY, 0, 0);
  552. }
  553. void CServerPropertyPageReplication::OnSetFocusHour()
  554. /*++
  555. Routine Description:
  556. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_HOUR on message EN_SETFOCUS.
  557. Arguments:
  558. None.
  559. Return Values:
  560. None..
  561. --*/
  562. {
  563. if (!m_bOnInit) SetModified(TRUE);
  564. m_spinAt.SetRange(m_bIsMode24 ? 0 :1, m_bIsMode24 ? 23 : 12);
  565. m_spinAt.SetBuddy(&m_atHourEdit);
  566. }
  567. void CServerPropertyPageReplication::OnKillFocusHour()
  568. /*++
  569. Routine Description:
  570. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_HOUR on message EN_KILLFOCUS.
  571. Arguments:
  572. None.
  573. Return Values:
  574. None..
  575. --*/
  576. {
  577. // if (m_spinAt.GetBuddy() == &m_atHourEdit)
  578. // m_spinAt.SendMessage(UDM_SETBUDDY, 0, 0);
  579. }
  580. void CServerPropertyPageReplication::OnSetFocusMinute()
  581. /*++
  582. Routine Description:
  583. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_MINUTE on message EN_SETFOCUS.
  584. Arguments:
  585. None.
  586. Return Values:
  587. None..
  588. --*/
  589. {
  590. if (!m_bOnInit) SetModified(TRUE);
  591. m_spinAt.SetRange(0, 59);
  592. m_spinAt.SetBuddy(&m_atMinEdit);
  593. }
  594. void CServerPropertyPageReplication::OnKillFocusMinute()
  595. /*++
  596. Routine Description:
  597. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_MINUTE on message EN_KILLFOCUS.
  598. Arguments:
  599. None.
  600. Return Values:
  601. None..
  602. --*/
  603. {
  604. // if (m_spinAt.GetBuddy() == &m_atMinEdit)
  605. // m_spinAt.SendMessage(UDM_SETBUDDY, 0, 0);
  606. }
  607. void CServerPropertyPageReplication::OnSetFocusSecond()
  608. /*++
  609. Routine Description:
  610. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_SECOND on message EN_SETFOCUS.
  611. Arguments:
  612. None.
  613. Return Values:
  614. None..
  615. --*/
  616. {
  617. if (!m_bOnInit) SetModified(TRUE);
  618. m_spinAt.SetRange(0, 59);
  619. m_spinAt.SetBuddy(&m_atSecEdit);
  620. }
  621. void CServerPropertyPageReplication::OnKillFocusSecond()
  622. /*++
  623. Routine Description:
  624. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_SECOND on message EN_KILLFOCUS.
  625. Arguments:
  626. None.
  627. Return Values:
  628. None..
  629. --*/
  630. {
  631. // if (m_spinAt.GetBuddy() == &m_atSecEdit)
  632. // m_spinAt.SendMessage(UDM_SETBUDDY, 0, 0);
  633. }
  634. void CServerPropertyPageReplication::OnSetfocusEvery()
  635. /*++
  636. Routine Description:
  637. Message handler for Edit control IDC_PP_SERVER_REPLICATION_EVERY_VALUE on message EN_SETFOCUS.
  638. Arguments:
  639. None.
  640. Return Values:
  641. None..
  642. --*/
  643. {
  644. if (!m_bOnInit) SetModified(TRUE);
  645. }
  646. void CServerPropertyPageReplication::OnKillfocusEvery()
  647. /*++
  648. Routine Description:
  649. Message handler for Edit control IDC_PP_SERVER_REPLICATION_EVERY_VALUE on message EN_KILLFOCUS.
  650. Arguments:
  651. None.
  652. Return Values:
  653. None..
  654. --*/
  655. {
  656. // if (m_spinEvery.GetBuddy() == &m_everyEdit)
  657. // m_spinEvery.SendMessage(UDM_SETBUDDY, 0, 0);
  658. }
  659. void CServerPropertyPageReplication::OnUpdateEsrvName()
  660. /*++
  661. Routine Description:
  662. Message handler for Edit control IDC_PP_SERVER_REPLICATION_ESRV_NAME on message EN_UPDATE
  663. Arguments:
  664. None.
  665. Return Values:
  666. None..
  667. --*/
  668. {
  669. TCHAR szName[MAX_PATH + 3]; // MAX_PATH + 2 \ char's + null
  670. UINT nValue;
  671. if (!m_bOnInit) SetModified(TRUE);
  672. nValue = GetDlgItemText(IDC_PP_SERVER_REPLICATION_ESRV_NAME, szName, MAX_PATH +3);
  673. szName[nValue] = NULL;
  674. if (!(wcsncmp(szName, TEXT("\\\\"), 2)))
  675. SetDlgItemText(IDC_PP_SERVER_REPLICATION_ESRV_NAME, szName + 2);
  676. }
  677. void CServerPropertyPageReplication::OnUpdateAtHour()
  678. /*++
  679. Routine Description:
  680. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_HOUR on message EN_UPDATE
  681. Arguments:
  682. None.
  683. Return Values:
  684. None..
  685. --*/
  686. {
  687. TCHAR szNum[3];
  688. UINT nValue;
  689. short i;
  690. int iVal;
  691. BOOL fOk = TRUE;
  692. if (!m_bOnInit) SetModified(TRUE);
  693. nValue = GetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_HOUR, szNum, sizeof(szNum) / sizeof( TCHAR ));
  694. for (i=0;szNum[i];i++)
  695. if(!_istdigit(szNum[i]))
  696. fOk = FALSE;
  697. if (fOk)
  698. {
  699. iVal = _wtoi(szNum);
  700. if (!nValue)
  701. {
  702. if (m_bIsMode24)
  703. {
  704. m_nHour = 0;
  705. m_bPM = FALSE;
  706. }
  707. else
  708. {
  709. m_nHour = m_nHourMax;
  710. m_bPM = FALSE;
  711. }
  712. }
  713. else if ((iVal < (int)m_nHourMin) || (iVal > (int)m_nHourMax))
  714. fOk = FALSE;
  715. }
  716. if (!fOk)
  717. m_atHourEdit.Undo();
  718. }
  719. void CServerPropertyPageReplication::OnUpdateAtMinute()
  720. /*++
  721. Routine Description:
  722. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_MINUTE on message EN_UPDATE
  723. Arguments:
  724. None.
  725. Return Values:
  726. None..
  727. --*/
  728. {
  729. TCHAR szNum[3];
  730. UINT nValue;
  731. short i;
  732. int iVal;
  733. BOOL fOk = TRUE;
  734. if (!m_bOnInit) SetModified(TRUE);
  735. nValue = GetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_MINUTE, szNum, sizeof(szNum) / sizeof( TCHAR ));
  736. for (i=0;szNum[i];i++)
  737. if(!_istdigit(szNum[i]))
  738. fOk = FALSE;
  739. if (fOk)
  740. {
  741. iVal = _wtoi(szNum);
  742. if (!nValue)
  743. {
  744. m_nSecond = MINUTE_MIN;
  745. }
  746. else if ((iVal < MINUTE_MIN) || (iVal > MINUTE_MAX))
  747. fOk = FALSE;
  748. }
  749. if (!fOk)
  750. m_atMinEdit.Undo();
  751. }
  752. void CServerPropertyPageReplication::OnUpdateAtSecond()
  753. /*++
  754. Routine Description:
  755. Message handler for Edit control IDC_PP_SERVER_REPLICATION_AT_SECOND on message EN_UPDATE
  756. Arguments:
  757. None.
  758. Return Values:
  759. None..
  760. --*/
  761. {
  762. TCHAR szNum[3];
  763. UINT nValue;
  764. short i;
  765. int iVal;
  766. BOOL fOk = TRUE;
  767. if (!m_bOnInit) SetModified(TRUE);
  768. nValue = GetDlgItemText(IDC_PP_SERVER_REPLICATION_AT_SECOND, szNum, sizeof(szNum) / sizeof( TCHAR ));
  769. for (i=0;szNum[i];i++)
  770. if(!_istdigit(szNum[i]))
  771. fOk = FALSE;
  772. if (fOk)
  773. {
  774. iVal = _wtoi(szNum);
  775. if (!nValue)
  776. {
  777. m_nSecond = SECOND_MIN;
  778. }
  779. else if ((iVal < SECOND_MIN) || (iVal > SECOND_MAX))
  780. fOk = FALSE;
  781. }
  782. if (!fOk)
  783. m_atSecEdit.Undo();
  784. }
  785. void CServerPropertyPageReplication::OnUpdateEveryValue()
  786. /*++
  787. Routine Description:
  788. Message handler for Edit control IDC_PP_SERVER_REPLICATION_EVERY_VALUE on message EN_UPDATE
  789. Arguments:
  790. None.
  791. Return Values:
  792. None..
  793. --*/
  794. {
  795. TCHAR szNum[3];
  796. UINT nValue;
  797. short i;
  798. int iVal;
  799. BOOL fOk = TRUE;
  800. if (!m_bOnInit) SetModified(TRUE);
  801. nValue = GetDlgItemText(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, szNum, sizeof(szNum) / sizeof( TCHAR ));
  802. for (i=0;szNum[i];i++)
  803. if(!_istdigit(szNum[i]))
  804. fOk = FALSE;
  805. if (fOk)
  806. {
  807. iVal = _wtoi(szNum);
  808. if (!nValue)
  809. {
  810. m_nStartingHour = DEFAULT_EVERY;
  811. }
  812. else if (iVal < 9)
  813. {
  814. m_nStartingHour = (DWORD) iVal;
  815. }
  816. else if ((iVal < INTERVAL_MIN) || (iVal > INTERVAL_MAX))
  817. fOk = FALSE;
  818. else
  819. m_nStartingHour = (DWORD) iVal;
  820. }
  821. if (!fOk)
  822. m_everyEdit.Undo();
  823. }
  824. BOOL CServerPropertyPageReplication::EditValidate(short *pnID, BOOL *pfBeep)
  825. /*++
  826. Routine Description:
  827. Validate all edit & other fields.
  828. Arguments:
  829. None.
  830. Return Values:
  831. short *pnID Pass back the bad ID
  832. BOOL *pfBeep Whether to Beep
  833. --*/
  834. {
  835. UINT nValue;
  836. BOOL fValid = FALSE;
  837. TCHAR szTemp[MAX_PATH + 1];
  838. DWORD NumberOfHours, SecondsinHours;
  839. *pfBeep = TRUE;
  840. // only do this if license info is replicated to an ES
  841. do {
  842. if (m_esrvBtn.GetCheck())
  843. {
  844. if ( m_pServer->IsReplicatingToDC() )
  845. {
  846. // the user has changed the "UseEnterprise" value from "no" to "yes";
  847. // warn of possible license loss
  848. int nButton;
  849. CString strMessage;
  850. AfxFormatString1( strMessage, IDP_CONFIRM_USE_ENTERPRISE, m_pServer->m_strName );
  851. nButton = AfxMessageBox( strMessage, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2, IDP_CONFIRM_USE_ENTERPRISE );
  852. if ( IDYES != nButton )
  853. {
  854. *pnID = IDC_PP_SERVER_REPLICATION_ESRV;
  855. *pfBeep = FALSE;
  856. fValid = FALSE;
  857. m_esrvBtn.SetFocus();
  858. break;
  859. }
  860. }
  861. nValue = GetDlgItemText( IDC_PP_SERVER_REPLICATION_ESRV_NAME, szTemp, MAX_PATH + 1);
  862. if (nValue == 0)
  863. {
  864. if ( m_pServer->IsWin2000() )
  865. {
  866. // It is ok for Enterprise Server to be blank
  867. fValid = TRUE;
  868. szTemp[nValue] = UNICODE_NULL;
  869. // 375761 JonN 8/9/99 do not break here, this is not an error
  870. }
  871. else
  872. {
  873. *pnID = IDC_PP_SERVER_REPLICATION_ESRV_NAME;
  874. m_esrvEdit.SetFocus();
  875. m_esrvEdit.SetSel(MAKELONG(0, -1), FALSE);
  876. break;
  877. }
  878. }
  879. else
  880. {
  881. fValid = TRUE; // we got a name, assume valid
  882. // 375761 JonN 8/9/99 moved this stuff into this "else"
  883. if (nValue > MAX_PATH)
  884. nValue = MAX_PATH;
  885. // Validate server name
  886. if (I_NetNameValidate(NULL, szTemp, NAMETYPE_COMPUTER, LM2X_COMPATIBLE) != ERROR_SUCCESS)
  887. {
  888. AfxMessageBox(IDP_ERROR_INVALID_COMPUTERNAME, MB_OK|MB_ICONSTOP);
  889. *pnID = IDC_PP_SERVER_REPLICATION_ESRV_NAME;
  890. *pfBeep = FALSE;
  891. fValid = FALSE;
  892. m_esrvEdit.SetFocus();
  893. m_esrvEdit.SetSel(MAKELONG(0, -1), FALSE);
  894. break;
  895. }
  896. ASSERT_VALID( m_pServer );
  897. if ( !m_pServer->m_strName.CompareNoCase( szTemp ) )
  898. {
  899. // can't replicate to yourself
  900. AfxMessageBox(IDP_ERROR_NO_SELF_REPLICATION, MB_OK|MB_ICONSTOP);
  901. *pnID = IDC_PP_SERVER_REPLICATION_ESRV_NAME;
  902. *pfBeep = FALSE;
  903. fValid = FALSE;
  904. m_esrvEdit.SetFocus();
  905. m_esrvEdit.SetSel(MAKELONG(0, -1), FALSE);
  906. break;
  907. }
  908. if ( m_strEnterpriseServer.CompareNoCase( szTemp ) && !m_pServer->IsReplicatingToDC() )
  909. {
  910. // this server was already set to replicate to an enterprise server,
  911. // but the user has changed the name of the enterprise server;
  912. // warn of possible license loss
  913. int nButton;
  914. CString strMessage;
  915. AfxFormatString1( strMessage, IDP_CONFIRM_ENTERPRISE_CHANGE, m_pServer->m_strName );
  916. nButton = AfxMessageBox( strMessage, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2, IDP_CONFIRM_ENTERPRISE_CHANGE );
  917. if ( IDYES != nButton )
  918. {
  919. *pnID = IDC_PP_SERVER_REPLICATION_ESRV_NAME;
  920. *pfBeep = FALSE;
  921. fValid = FALSE;
  922. m_esrvEdit.SetFocus();
  923. m_esrvEdit.SetSel(MAKELONG(0, -1), FALSE);
  924. break;
  925. }
  926. }
  927. }
  928. m_strEnterpriseServer = szTemp;
  929. m_bUseEsrv = TRUE;
  930. }
  931. else
  932. {
  933. if ( !m_pServer->IsReplicatingToDC() )
  934. {
  935. // the user has changed the "UseEnterprise" value from "yes" to "no";
  936. // warn of possible license loss
  937. int nButton;
  938. CString strMessage;
  939. AfxFormatString1( strMessage, IDP_CONFIRM_NOT_USE_ENTERPRISE, m_pServer->m_strName );
  940. nButton = AfxMessageBox( strMessage, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2, IDP_CONFIRM_NOT_USE_ENTERPRISE );
  941. if ( IDYES != nButton )
  942. {
  943. *pnID = IDC_PP_SERVER_REPLICATION_ESRV;
  944. *pfBeep = FALSE;
  945. fValid = FALSE;
  946. m_esrvBtn.SetFocus();
  947. break;
  948. }
  949. }
  950. // Get rid of the Server Name.
  951. m_strEnterpriseServer = TEXT("");
  952. m_bUseEsrv = FALSE;
  953. }
  954. if (m_everyBtn.GetCheck())
  955. {
  956. nValue = GetDlgItemInt(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, &fValid, FALSE);
  957. *pnID = IDC_PP_SERVER_REPLICATION_EVERY_VALUE;
  958. if (fValid)
  959. {
  960. if (nValue < INTERVAL_MIN)
  961. {
  962. fValid = FALSE;
  963. m_nStartingHour = INTERVAL_MIN;
  964. SetDlgItemInt(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, INTERVAL_MIN, FALSE);
  965. m_everyEdit.SetFocus();
  966. m_everyEdit.SetSel(MAKELONG(0, -1), FALSE);
  967. break;
  968. }
  969. else if (nValue > INTERVAL_MAX)
  970. {
  971. fValid = FALSE;
  972. m_nStartingHour = INTERVAL_MAX;
  973. SetDlgItemInt(IDC_PP_SERVER_REPLICATION_EVERY_VALUE, INTERVAL_MAX, FALSE);
  974. m_everyEdit.SetFocus();
  975. m_everyEdit.SetSel(MAKELONG(0, -1), FALSE);
  976. break;
  977. }
  978. else
  979. m_nStartingHour = nValue;
  980. m_nReplicationTime = m_nStartingHour;
  981. }
  982. else
  983. {
  984. fValid = FALSE;
  985. m_everyEdit.SetFocus();
  986. m_everyEdit.SetSel(MAKELONG(0, -1), FALSE);
  987. break;
  988. }
  989. m_bReplAt = FALSE;
  990. }
  991. else
  992. {
  993. nValue = GetDlgItemInt(IDC_PP_SERVER_REPLICATION_AT_HOUR, &fValid, FALSE);
  994. if (fValid)
  995. m_nHour = nValue;
  996. else
  997. {
  998. *pnID = IDC_PP_SERVER_REPLICATION_AT_HOUR;
  999. m_atHourEdit.SetFocus();
  1000. m_atHourEdit.SetSel(MAKELONG(0, -1), FALSE);
  1001. break;
  1002. }
  1003. nValue = GetDlgItemInt(IDC_PP_SERVER_REPLICATION_AT_MINUTE, &fValid, FALSE);
  1004. if (fValid)
  1005. m_nMinute = nValue;
  1006. else
  1007. {
  1008. *pnID = IDC_PP_SERVER_REPLICATION_AT_MINUTE;
  1009. m_atMinEdit.SetFocus();
  1010. m_atMinEdit.SetSel(MAKELONG(0, -1), FALSE);
  1011. break;
  1012. }
  1013. nValue = GetDlgItemInt(IDC_PP_SERVER_REPLICATION_AT_SECOND, &fValid, FALSE);
  1014. if (fValid)
  1015. m_nSecond = nValue;
  1016. else
  1017. {
  1018. *pnID = IDC_PP_SERVER_REPLICATION_AT_SECOND;
  1019. m_atSecEdit.SetFocus();
  1020. m_atSecEdit.SetSel(MAKELONG(0, -1), FALSE);
  1021. break;
  1022. }
  1023. if (!m_bIsMode24)
  1024. {
  1025. *pnID = IDC_PP_SERVER_REPLICATION_AT_AMPM;
  1026. nValue = m_atAmPmEdit.GetTopIndex();
  1027. if (nValue == 0)
  1028. {
  1029. m_bPM = FALSE;
  1030. }
  1031. else if (nValue == 1)
  1032. {
  1033. m_bPM = TRUE;
  1034. }
  1035. else
  1036. {
  1037. fValid = FALSE;
  1038. m_atAmPmEdit.SetFocus();
  1039. break;
  1040. }
  1041. }
  1042. if (!m_bIsMode24)
  1043. { // It's in 12 hour format
  1044. if (m_bPM)
  1045. {
  1046. NumberOfHours = 12 + m_nHour - ((m_nHour / 12) * 12);
  1047. }
  1048. else
  1049. {
  1050. NumberOfHours = m_nHour - ((m_nHour / 12) * 12);
  1051. }
  1052. }
  1053. else
  1054. { // It's in 24 hour format
  1055. NumberOfHours = m_nHour;
  1056. }
  1057. SecondsinHours = NumberOfHours * 60 * 60;
  1058. m_nReplicationTime = SecondsinHours + (m_nMinute * 60) + m_nSecond; // Cheating. Use the same member
  1059. m_bReplAt = TRUE;
  1060. }
  1061. } while(FALSE);
  1062. return( fValid );
  1063. }
  1064. void CServerPropertyPageReplication::EditInvalidDlg(BOOL fBeep)
  1065. /*++
  1066. Routine Description:
  1067. If any edit/listbox field has an invalid data item.
  1068. Arguments:
  1069. BOOL fBeep Beep only if we haven't yet put up a MessageBox.
  1070. Return Values:
  1071. None..
  1072. --*/
  1073. {
  1074. if (fBeep)
  1075. ::MessageBeep(MB_OK);
  1076. }
  1077. void CServerPropertyPageReplication::SaveReplicationParams()
  1078. /*++
  1079. Routine Description:
  1080. Write to the remote registry.
  1081. REG_VALUE_ENTERPRISE_SERVER m_strEnterpriseServer
  1082. REG_VALUE_USE_ENTERPRISE m_bUseEsrv
  1083. REG_VALUE_REPLICATION_TYPE m_bReplAt
  1084. REG_VALUE_REPLICATION_TIME m_nReplicationTime
  1085. Arguments:
  1086. None.
  1087. Return Values:
  1088. None..
  1089. --*/
  1090. {
  1091. long Status;
  1092. DWORD dwValue;
  1093. ASSERT(m_bUseEsrv == m_esrvBtn.GetCheck());
  1094. ASSERT(m_bReplAt == m_atBtn.GetCheck());
  1095. #ifdef CONFIG_THROUGH_REGISTRY
  1096. do {
  1097. dwValue = m_esrvBtn.GetCheck();
  1098. Status = RegSetValueEx(m_pServer->GetReplRegHandle(),REG_VALUE_USE_ENTERPRISE,0,REG_DWORD,
  1099. (PBYTE)&dwValue, sizeof(DWORD));
  1100. ASSERT(Status == ERROR_SUCCESS);
  1101. if (Status != ERROR_SUCCESS) break;
  1102. Status = RegSetValueEx(m_pServer->GetReplRegHandle(), REG_VALUE_ENTERPRISE_SERVER, 0, REG_SZ,
  1103. (LPBYTE)MKSTR(m_strEnterpriseServer), (lstrlen(m_strEnterpriseServer) + 1) * sizeof(TCHAR));
  1104. ASSERT(Status == ERROR_SUCCESS);
  1105. if (Status != ERROR_SUCCESS) break;
  1106. dwValue = m_atBtn.GetCheck();
  1107. Status = RegSetValueEx(m_pServer->GetReplRegHandle(), REG_VALUE_REPLICATION_TYPE,0,REG_DWORD,
  1108. (PBYTE)&dwValue, sizeof(DWORD));
  1109. ASSERT(Status == ERROR_SUCCESS);
  1110. if (Status != ERROR_SUCCESS) break;
  1111. dwValue = (m_bReplAt? m_nReplicationTime : (m_nStartingHour * 3600));
  1112. Status = RegSetValueEx(m_pServer->GetReplRegHandle(), REG_VALUE_REPLICATION_TIME,0,REG_DWORD,
  1113. (PBYTE)&dwValue, sizeof(DWORD));
  1114. ASSERT(Status == ERROR_SUCCESS);
  1115. if (Status != ERROR_SUCCESS) break;
  1116. } while (FALSE);
  1117. #else
  1118. if ( m_pServer->ConnectLls() )
  1119. {
  1120. LLS_SERVICE_INFO_0 ServiceInfo;
  1121. ZeroMemory( &ServiceInfo, sizeof( ServiceInfo ) );
  1122. ServiceInfo.UseEnterprise = m_esrvBtn.GetCheck();
  1123. ServiceInfo.EnterpriseServer = MKSTR(m_strEnterpriseServer);
  1124. ServiceInfo.ReplicationType = m_atBtn.GetCheck();
  1125. ServiceInfo.ReplicationTime = ( LLS_REPLICATION_TYPE_TIME == ServiceInfo.ReplicationType )
  1126. ? m_nReplicationTime
  1127. : (m_nStartingHour * 3600);
  1128. Status = ::LlsServiceInfoSet( m_pServer->GetLlsHandle(), 0, (LPBYTE) &ServiceInfo );
  1129. LlsSetLastStatus( Status );
  1130. if ( IsConnectionDropped( Status ) )
  1131. {
  1132. m_pServer->DisconnectLls();
  1133. }
  1134. }
  1135. else
  1136. {
  1137. Status = LlsGetLastStatus();
  1138. }
  1139. #endif
  1140. if (Status != ERROR_SUCCESS)
  1141. {
  1142. theApp.DisplayStatus(Status);
  1143. }
  1144. else
  1145. {
  1146. SetModified(FALSE);
  1147. }
  1148. }
  1149. void CServerPropertyPageReplication::OnOK()
  1150. /*++
  1151. Routine Description:
  1152. Handler for Apply button.
  1153. Arguments:
  1154. None.
  1155. Return Values:
  1156. None.
  1157. --*/
  1158. {
  1159. SaveReplicationParams();
  1160. }