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.

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