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.

719 lines
18 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. dlgdial.cpp
  7. This files contains the implementation of class CDlgRasDialin
  8. which is the class to represent the property page appears on
  9. user object property sheet as tab "RAS dial-in"
  10. FILE HISTORY:
  11. */
  12. #include "stdafx.h"
  13. #include <sspi.h>
  14. #include <secext.h>
  15. #include <raserror.h>
  16. #include "helper.h"
  17. #include "resource.h"
  18. #include "DlgDial.h"
  19. #include "DlgRoute.h"
  20. #include "DlgProf.h"
  21. #include "profsht.h"
  22. #include "hlptable.h"
  23. #include "rasprof.h"
  24. #include "commctrl.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CDlgRASDialinMerge dialog
  32. IMPLEMENT_DYNAMIC(CDlgRASDialinMerge, CPropertyPage)
  33. CDlgRASDialinMerge::~CDlgRASDialinMerge()
  34. {
  35. Reset();
  36. }
  37. CDlgRASDialinMerge::CDlgRASDialinMerge()
  38. : CPropertyPage(CDlgRASDialinMerge::IDD),
  39. CRASUserMerge(RASUSER_ENV_LOCAL, NULL, NULL)
  40. {
  41. // initialize the memebers
  42. Reset();
  43. }
  44. CDlgRASDialinMerge::CDlgRASDialinMerge(RasEnvType type, LPCWSTR location, LPCWSTR userPath)
  45. : CPropertyPage(CDlgRASDialinMerge::IDD),
  46. CRASUserMerge(type, location, userPath)
  47. {
  48. // initialize the memebers
  49. Reset();
  50. }
  51. void CDlgRASDialinMerge::Reset()
  52. {
  53. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  54. //{{AFX_DATA_INIT(CDlgRASDialinMerge)
  55. m_bApplyStaticRoutes = FALSE;
  56. m_nCurrentProfileIndex = 0;
  57. m_bCallingStationId = FALSE;
  58. m_bOverride = FALSE;
  59. m_nDialinPermit = -1;
  60. //}}AFX_DATA_INIT
  61. // Need to save the original callback pointer because we are replacing
  62. // it with our own
  63. m_pfnOriginalCallback = m_psp.pfnCallback;
  64. m_pEditIPAddress = NULL;
  65. // init for using IPAddress common control
  66. INITCOMMONCONTROLSEX INITEX;
  67. INITEX.dwSize = sizeof(INITCOMMONCONTROLSEX);
  68. INITEX.dwICC = ICC_INTERNET_CLASSES;
  69. ::InitCommonControlsEx(&INITEX);
  70. m_bInitFailed = FALSE;
  71. m_bModified = FALSE;
  72. }
  73. void CDlgRASDialinMerge::DoDataExchange(CDataExchange* pDX)
  74. {
  75. if(m_bInitFailed)
  76. return;
  77. /*
  78. USHORT
  79. WINAPI
  80. CompressPhoneNumber(
  81. IN LPWSTR Uncompressed,
  82. OUT LPWSTR Compressed
  83. );
  84. */
  85. CPropertyPage::DoDataExchange(pDX);
  86. //{{AFX_DATA_MAP(CDlgRASDialinMerge)
  87. DDX_Control(pDX, IDC_CHECKSTATICIPADDRESS, m_CheckStaticIPAddress);
  88. DDX_Control(pDX, IDC_CHECKCALLERID, m_CheckCallerId);
  89. DDX_Control(pDX, IDC_CHECKAPPLYSTATICROUTES, m_CheckApplyStaticRoutes);
  90. DDX_Control(pDX, IDC_RADIONOCALLBACK, m_RadioNoCallback);
  91. DDX_Control(pDX, IDC_RADIOSETBYCALLER, m_RadioSetByCaller);
  92. DDX_Control(pDX, IDC_RADIOSECURECALLBACKTO, m_RadioSecureCallbackTo);
  93. DDX_Control(pDX, IDC_EDITCALLERID, m_EditCallerId);
  94. DDX_Control(pDX, IDC_EDITCALLBACK, m_EditCallback);
  95. DDX_Control(pDX, IDC_BUTTONSTATICROUTES, m_ButtonStaticRoutes);
  96. DDX_Check(pDX, IDC_CHECKAPPLYSTATICROUTES, m_bApplyStaticRoutes);
  97. DDX_Radio(pDX, IDC_RADIONOCALLBACK, m_nCallbackPolicy);
  98. DDX_Check(pDX, IDC_CHECKCALLERID, m_bCallingStationId);
  99. DDX_Check(pDX, IDC_CHECKSTATICIPADDRESS, m_bOverride);
  100. DDX_Radio(pDX, IDC_PERMIT_ALLOW, m_nDialinPermit);
  101. //}}AFX_DATA_MAP
  102. DDX_Text(pDX, IDC_EDITCALLERID, m_strCallingStationId);
  103. DDX_Text(pDX, IDC_EDITCALLBACK, m_strCallbackNumber);
  104. if(S_OK == HrIsInMixedDomain() || m_type == RASUSER_ENV_LOCAL) // user in mixed domain
  105. {
  106. DWORD dwErr = 0;
  107. typedef USHORT (WINAPI *COMPRESSCALLBACKFUNC)(
  108. IN LPWSTR Uncompressed,
  109. OUT LPWSTR Compressed);
  110. WCHAR tempBuf[RAS_CALLBACK_NUMBER_LEN_NT4 + 2];
  111. DDV_MaxChars(pDX, m_strCallbackNumber, RAS_CALLBACK_NUMBER_LEN_NT4);
  112. COMPRESSCALLBACKFUNC pfnCompressCallback = NULL;
  113. HMODULE hMprApiDLL = NULL;
  114. hMprApiDLL = LoadLibrary(_T("mprapi.dll"));
  115. if ( NULL != hMprApiDLL )
  116. {
  117. // load the API pointer
  118. pfnCompressCallback = (COMPRESSCALLBACKFUNC) GetProcAddress(hMprApiDLL, "CompressPhoneNumber");
  119. if(NULL != pfnCompressCallback)
  120. {
  121. dwErr = pfnCompressCallback((LPTSTR)(LPCTSTR)m_strCallbackNumber, tempBuf);
  122. switch(dwErr)
  123. {
  124. case ERROR_BAD_LENGTH:
  125. AfxMessageBox(IDS_ERR_CALLBACK_TOO_LONG);
  126. pDX->Fail();
  127. break;
  128. case ERROR_BAD_CALLBACK_NUMBER:
  129. AfxMessageBox(IDS_ERR_CALLBACK_INVALID);
  130. pDX->Fail();
  131. break;
  132. }
  133. }
  134. }
  135. }
  136. else
  137. {
  138. DDV_MaxChars(pDX, m_strCallbackNumber, RAS_CALLBACK_NUMBER_LEN);
  139. }
  140. if(pDX->m_bSaveAndValidate) // save data to this class
  141. {
  142. // ip adress control
  143. if(m_pEditIPAddress->SendMessage(IPM_GETADDRESS, 0, (LPARAM)&m_dwFramedIPAddress))
  144. m_bStaticIPAddress = TRUE;
  145. else
  146. m_bStaticIPAddress = FALSE;
  147. }
  148. else // put to dialog
  149. {
  150. // ip adress control
  151. if(m_bStaticIPAddress)
  152. m_pEditIPAddress->SendMessage(IPM_SETADDRESS, 0, m_dwFramedIPAddress);
  153. else
  154. m_pEditIPAddress->SendMessage(IPM_CLEARADDRESS, 0, m_dwFramedIPAddress);
  155. }
  156. }
  157. BEGIN_MESSAGE_MAP(CDlgRASDialinMerge, CPropertyPage)
  158. //{{AFX_MSG_MAP(CDlgRASDialinMerge)
  159. ON_BN_CLICKED(IDC_BUTTONSTATICROUTES, OnButtonStaticRoutes)
  160. ON_BN_CLICKED(IDC_CHECKAPPLYSTATICROUTES, OnCheckApplyStaticRoutes)
  161. ON_BN_CLICKED(IDC_CHECKCALLERID, OnCheckCallerId)
  162. ON_BN_CLICKED(IDC_RADIOSECURECALLBACKTO, OnRadioSecureCallbackTo)
  163. ON_BN_CLICKED(IDC_RADIONOCALLBACK, OnRadioNoCallback)
  164. ON_BN_CLICKED(IDC_RADIOSETBYCALLER, OnRadioSetByCaller)
  165. ON_BN_CLICKED(IDC_CHECKSTATICIPADDRESS, OnCheckStaticIPAddress)
  166. ON_WM_HELPINFO()
  167. ON_WM_CONTEXTMENU()
  168. ON_EN_CHANGE(IDC_EDITCALLBACK, OnChangeEditcallback)
  169. ON_EN_CHANGE(IDC_EDITCALLERID, OnChangeEditcallerid)
  170. ON_WM_CREATE()
  171. ON_BN_CLICKED(IDC_PERMIT_ALLOW, OnPermitAllow)
  172. ON_BN_CLICKED(IDC_PERMIT_DENY, OnPermitDeny)
  173. ON_BN_CLICKED(IDC_PERMIT_POLICY, OnPermitPolicy)
  174. ON_WM_DESTROY()
  175. ON_NOTIFY(IPN_FIELDCHANGED, IDC_EDITIPADDRESS, OnFieldchangedEditipaddress)
  176. //}}AFX_MSG_MAP
  177. END_MESSAGE_MAP()
  178. /////////////////////////////////////////////////////////////////////////////
  179. // CDlgRASDialinMerge message handlers
  180. // called when static routes button is pressed
  181. void CDlgRASDialinMerge::OnButtonStaticRoutes()
  182. {
  183. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  184. CDlgStaticRoutes DlgRoutes(m_strArrayFramedRoute, this);
  185. try{
  186. if(DlgRoutes.DoModal() == IDOK)
  187. {
  188. SetModified();
  189. };
  190. }
  191. catch(CMemoryException&)
  192. {
  193. ;
  194. }
  195. // uncheck the checkbox if it's empty
  196. if(m_strArrayFramedRoute.GetSize() == 0)
  197. {
  198. m_CheckApplyStaticRoutes.SetCheck(FALSE);
  199. OnCheckApplyStaticRoutes();
  200. }
  201. }
  202. // when checkbox -- apply static routes is clicked
  203. void CDlgRASDialinMerge::OnCheckApplyStaticRoutes()
  204. {
  205. SetModified();
  206. // if checkbox "Apply static routes" is checked
  207. m_bApplyStaticRoutes = m_CheckApplyStaticRoutes.GetCheck();
  208. // Enable / Disable the push button for editing static routes
  209. m_ButtonStaticRoutes.EnableWindow(m_bApplyStaticRoutes);
  210. if(m_bApplyStaticRoutes && m_strArrayFramedRoute.GetSize() == 0)
  211. OnButtonStaticRoutes();
  212. }
  213. // when checkbox -- callerId is clicked
  214. void CDlgRASDialinMerge::OnCheckCallerId()
  215. {
  216. SetModified();
  217. // Disable or enable the edit box for caller id
  218. m_EditCallerId.EnableWindow(m_CheckCallerId.GetCheck());
  219. }
  220. // enable / disable the each items accroding to current state
  221. void CDlgRASDialinMerge::EnableDialinSettings()
  222. {
  223. BOOL bEnable = TRUE;
  224. // related to profile
  225. EnableProfile(bEnable);
  226. // related to caller Id
  227. EnableCallerId(bEnable);
  228. // related to callback
  229. EnableCallback(bEnable);
  230. // related to Ip address
  231. EnableIPAddress(bEnable);
  232. // related to static routes
  233. EnableStaticRoutes(bEnable);
  234. // if user in mixed domain, only allow to set dialin bit and callback options
  235. if(S_OK == HrIsInMixedDomain()) // user in mixed domain
  236. {
  237. GetDlgItem(IDC_PERMIT_POLICY)->EnableWindow(FALSE);
  238. // calling station id
  239. GetDlgItem(IDC_CHECKCALLERID)->EnableWindow(FALSE);
  240. GetDlgItem(IDC_EDITCALLERID)->EnableWindow(FALSE);
  241. // framed IP address
  242. GetDlgItem(IDC_CHECKSTATICIPADDRESS)->EnableWindow(FALSE);
  243. GetDlgItem(IDC_EDITIPADDRESS)->EnableWindow(FALSE);
  244. // framed route
  245. GetDlgItem(IDC_CHECKAPPLYSTATICROUTES)->EnableWindow(FALSE);
  246. GetDlgItem(IDC_BUTTONSTATICROUTES)->EnableWindow(FALSE);
  247. }
  248. }
  249. // called when clicked on NoCallback radio button
  250. void CDlgRASDialinMerge::OnRadioNoCallback()
  251. {
  252. SetModified();
  253. // disable the edit box for callback
  254. m_EditCallback.EnableWindow(false);
  255. }
  256. void CDlgRASDialinMerge::OnRadioSetByCaller()
  257. {
  258. SetModified();
  259. // disable the edit box for callback
  260. m_EditCallback.EnableWindow(false);
  261. }
  262. void CDlgRASDialinMerge::OnRadioSecureCallbackTo()
  263. {
  264. SetModified();
  265. // enable the edit box for callback
  266. m_EditCallback.EnableWindow(true);
  267. }
  268. void CDlgRASDialinMerge::EnableProfile(BOOL bEnable)
  269. {
  270. // checkbox -- caller id
  271. /*
  272. m_ButtonEditProfile.EnableWindow(bEnable);
  273. // no profile selection for No DS version
  274. if(IfNoDSMachine())
  275. bEnable = FALSE;
  276. m_ComboProfile.EnableWindow(bEnable);
  277. m_ButtonNewProfile.EnableWindow(bEnable);
  278. */
  279. }
  280. void CDlgRASDialinMerge::EnableCallerId(BOOL bEnable)
  281. {
  282. // checkbox -- caller id
  283. m_CheckCallerId.EnableWindow(bEnable);
  284. // edit box -- caller id
  285. m_EditCallerId.EnableWindow(bEnable && m_CheckCallerId.GetCheck());
  286. }
  287. void CDlgRASDialinMerge::EnableCallback(BOOL bEnable)
  288. {
  289. // radio button -- no call back
  290. m_RadioNoCallback.EnableWindow(bEnable);
  291. // radio button -- set by caller
  292. m_RadioSetByCaller.EnableWindow(bEnable);
  293. // radio button -- secure callback to
  294. m_RadioSecureCallbackTo.EnableWindow(bEnable);
  295. // edit box -- callback
  296. m_EditCallback.EnableWindow(m_RadioSecureCallbackTo.GetCheck());
  297. }
  298. void CDlgRASDialinMerge::EnableIPAddress(BOOL bEnable)
  299. {
  300. m_CheckStaticIPAddress.SetCheck(m_bOverride);
  301. m_pEditIPAddress->EnableWindow(bEnable && m_bOverride);
  302. }
  303. void CDlgRASDialinMerge::EnableStaticRoutes(BOOL bEnable)
  304. {
  305. // check box -- apply static routes
  306. m_CheckApplyStaticRoutes.EnableWindow(bEnable);
  307. if(!m_bApplyStaticRoutes) bEnable = false;
  308. // push button -- static routes
  309. m_ButtonStaticRoutes.EnableWindow(bEnable);
  310. }
  311. int CDlgRASDialinMerge::OnCreate(LPCREATESTRUCT lpCreateStruct)
  312. {
  313. return CPropertyPage::OnCreate(lpCreateStruct);
  314. }
  315. // called when dialog is created
  316. BOOL CDlgRASDialinMerge::OnInitDialog()
  317. {
  318. HRESULT hr = S_OK;
  319. hr = Load();
  320. if FAILED(hr)
  321. {
  322. ReportError(hr, IDS_ERR_LOADUSER, NULL);
  323. }
  324. else if (hr == S_FALSE) // Not the right OS to run
  325. {
  326. AfxMessageBox(IDS_ERR_NOTNT5SRV);
  327. }
  328. if(hr != S_OK)
  329. {
  330. EnableChildControls(GetSafeHwnd(), PROPPAGE_CHILD_HIDE | PROPPAGE_CHILD_DISABLE);
  331. GetDlgItem(IDC_FAILED_TO_INIT)->ShowWindow(SW_SHOW);
  332. GetDlgItem(IDC_FAILED_TO_INIT)->EnableWindow(TRUE);
  333. m_bInitFailed = TRUE;
  334. return TRUE;
  335. }
  336. if(m_strArrayCallingStationId.GetSize())
  337. m_strCallingStationId = *m_strArrayCallingStationId[(INT_PTR)0];
  338. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  339. TRACE(_T("CDlgRASDialinMerge::OnInitDialog\r\n"));
  340. m_pEditIPAddress = GetDlgItem(IDC_EDITIPADDRESS);
  341. CPropertyPage::OnInitDialog();
  342. SetModified(FALSE);
  343. EnableDialinSettings();
  344. return TRUE; // return TRUE unless you set the focus to a control
  345. // EXCEPTION: OCX Property Pages should return FALSE
  346. }
  347. // called when click on OK or Apply button, if modify flag is set
  348. BOOL CDlgRASDialinMerge::OnApply()
  349. {
  350. HRESULT hr = S_OK;
  351. if(m_bInitFailed)
  352. goto L_Exit;
  353. if (!GetModified())
  354. return CPropertyPage::OnApply();
  355. m_dwDefinedAttribMask = 0;
  356. // dialin bit
  357. switch(m_nDialinPermit)
  358. {
  359. case 0: // allow
  360. m_dwDialinPermit = 1;
  361. break;
  362. case 1: // deny
  363. m_dwDialinPermit = 0;
  364. break;
  365. case 2: // policy decide -- remove the attribute from user object
  366. m_dwDialinPermit = -1;
  367. break;
  368. }
  369. // caller id
  370. if(m_bCallingStationId && !m_strCallingStationId.IsEmpty())
  371. m_dwDefinedAttribMask |= RAS_USE_CALLERID;
  372. m_strArrayCallingStationId.DeleteAll();
  373. if(!m_strCallingStationId.IsEmpty())
  374. {
  375. CString* pStr = new CString(m_strCallingStationId);
  376. if(pStr)
  377. m_strArrayCallingStationId.Add(pStr);
  378. }
  379. // callback option
  380. switch(m_nCallbackPolicy)
  381. {
  382. case 0: // no callback
  383. m_dwDefinedAttribMask |= RAS_CALLBACK_NOCALLBACK;
  384. break;
  385. case 1: // set by caller
  386. m_dwDefinedAttribMask |= RAS_CALLBACK_CALLERSET;
  387. break;
  388. case 2: // secure callback
  389. m_dwDefinedAttribMask |= RAS_CALLBACK_SECURE;
  390. break;
  391. }
  392. // Ip Address
  393. if(m_bOverride && m_dwFramedIPAddress)
  394. m_dwDefinedAttribMask |= RAS_USE_STATICIP;
  395. // Static Routes
  396. if(m_bApplyStaticRoutes && m_strArrayFramedRoute.GetSize())
  397. m_dwDefinedAttribMask |= RAS_USE_STATICROUTES;
  398. // save the user object
  399. hr = Save();
  400. L_Exit:
  401. if(FAILED(hr))
  402. {
  403. ReportError(hr, IDS_ERR_SAVEUSER, NULL);
  404. }
  405. return CPropertyPage::OnApply();
  406. }
  407. void CDlgRASDialinMerge::OnCheckStaticIPAddress()
  408. {
  409. SetModified();
  410. m_bStaticIPAddress = m_CheckStaticIPAddress.GetCheck();
  411. m_pEditIPAddress->EnableWindow(m_bStaticIPAddress);
  412. }
  413. HRESULT CDlgRASDialinMerge::Load()
  414. {
  415. TRACE(_T("CDlgRASDialinMerge::Load\r\n"));
  416. HRESULT hr = S_OK;
  417. // Load the data from DS
  418. CHECK_HR(hr = CRASUserMerge::Load());
  419. if(hr != S_OK)
  420. return hr;
  421. // dialin bit
  422. if(m_dwDialinPermit == 1) //allow dialin
  423. m_nDialinPermit = 0;
  424. else if(m_dwDialinPermit == -1) // Policy defines dialin bit -- not defined per user
  425. m_nDialinPermit = 2;
  426. else
  427. m_nDialinPermit = 1; //deny dialin
  428. // in the case of Local User Manager, the Policy defined by profile is disableed
  429. if(S_OK == HrIsInMixedDomain() && m_nDialinPermit == 2) // Local case
  430. {
  431. m_nDialinPermit = 1; // deny
  432. }
  433. // callback policy
  434. if(!(m_dwDefinedAttribMask & RAS_CALLBACK_MASK))
  435. m_nCallbackPolicy = 0;
  436. else if(m_dwDefinedAttribMask & RAS_CALLBACK_CALLERSET)
  437. m_nCallbackPolicy = 1;
  438. else if(m_dwDefinedAttribMask & RAS_CALLBACK_SECURE)
  439. m_nCallbackPolicy = 2;
  440. else if(m_dwDefinedAttribMask & RAS_CALLBACK_NOCALLBACK)
  441. m_nCallbackPolicy = 0;
  442. //=============================================================================
  443. // change to use dwAllowDialin to hold if static Route, calling station id
  444. // if ras user object required there is a staic ip
  445. if(m_dwDefinedAttribMask & RAS_USE_STATICIP)
  446. m_bOverride = TRUE;
  447. m_bStaticIPAddress = (m_dwFramedIPAddress != 0);
  448. // static routes
  449. m_bApplyStaticRoutes = (m_dwDefinedAttribMask & RAS_USE_STATICROUTES) && (m_strArrayFramedRoute.GetSize() != 0);
  450. // calling station
  451. m_bCallingStationId = (m_dwDefinedAttribMask & RAS_USE_CALLERID) && m_strArrayCallingStationId.GetSize() && (m_strArrayCallingStationId[(INT_PTR)0]->GetLength() != 0);
  452. L_ERR:
  453. return hr;
  454. }
  455. BOOL CDlgRASDialinMerge::OnHelpInfo(HELPINFO* pHelpInfo)
  456. {
  457. ::WinHelp ((HWND)pHelpInfo->hItemHandle,
  458. AfxGetApp()->m_pszHelpFilePath,
  459. HELP_WM_HELP,
  460. (DWORD_PTR)(LPVOID)g_aHelpIDs_IDD_RASDIALIN_MERGE);
  461. return CPropertyPage::OnHelpInfo(pHelpInfo);
  462. }
  463. void CDlgRASDialinMerge::OnContextMenu(CWnd* pWnd, CPoint point)
  464. {
  465. ::WinHelp (pWnd->m_hWnd, AfxGetApp()->m_pszHelpFilePath,
  466. HELP_CONTEXTMENU, (DWORD_PTR)(LPVOID)g_aHelpIDs_IDD_RASDIALIN_MERGE);
  467. }
  468. BOOL CDlgRASDialinMerge::OnKillActive()
  469. {
  470. UINT ids = 0;
  471. if(m_bInitFailed)
  472. return CPropertyPage::OnKillActive();
  473. if(FALSE == CPropertyPage::OnKillActive()) return FALSE;
  474. if(m_bCallingStationId && m_strCallingStationId.IsEmpty())
  475. {
  476. GotoDlgCtrl( &m_EditCallerId );
  477. ids = IDS_NEED_CALLER_ID;
  478. goto L_ERR;
  479. }
  480. // callback option
  481. // always callback to
  482. if(m_nCallbackPolicy == 2 && m_strCallbackNumber.IsEmpty())
  483. {
  484. GotoDlgCtrl( &m_EditCallback );
  485. ids = IDS_NEED_CALLBACK_NUMBER;
  486. goto L_ERR;
  487. }
  488. // Ip Address
  489. if(m_bOverride && !m_bStaticIPAddress )
  490. {
  491. GotoDlgCtrl( m_pEditIPAddress );
  492. ids = IDS_NEED_IPADDRESS;
  493. goto L_ERR;
  494. }
  495. // Static Routes
  496. if(m_bApplyStaticRoutes && m_strArrayFramedRoute.GetSize() == 0)
  497. {
  498. GotoDlgCtrl( &m_CheckApplyStaticRoutes );
  499. goto L_ERR;
  500. }
  501. return TRUE;
  502. L_ERR:
  503. if (ids != 0)
  504. AfxMessageBox(ids);
  505. return FALSE;
  506. }
  507. //---------------------------------------------------------------------------
  508. // This is our self deleting callback function. If you have more than a
  509. // a few property sheets, it might be a good idea to implement this in a
  510. // base class and derive your MFC property sheets from the base class
  511. //
  512. UINT CALLBACK CDlgRASDialinMerge::PropSheetPageProc
  513. (
  514. HWND hWnd, // [in] Window handle - always null
  515. UINT uMsg, // [in,out] Either the create or delete message
  516. LPPROPSHEETPAGE pPsp // [in,out] Pointer to the property sheet struct
  517. )
  518. {
  519. ASSERT( NULL != pPsp );
  520. // We need to recover a pointer to the current instance. We can't just use
  521. // "this" because we are in a static function
  522. CDlgRASDialinMerge* pMe = reinterpret_cast<CDlgRASDialinMerge*>(pPsp->lParam);
  523. ASSERT( NULL != pMe );
  524. switch( uMsg )
  525. {
  526. case PSPCB_CREATE:
  527. break;
  528. case PSPCB_RELEASE:
  529. // Since we are deleting ourselves, save a callback on the stack
  530. // so we can callback the base class
  531. LPFNPSPCALLBACK pfnOrig = pMe->m_pfnOriginalCallback;
  532. delete pMe;
  533. return 1; //(pfnOrig)(hWnd, uMsg, pPsp);
  534. }
  535. // Must call the base class callback function or none of the MFC
  536. // message map stuff will work
  537. return (pMe->m_pfnOriginalCallback)(hWnd, uMsg, pPsp);
  538. } // end PropSheetPageProc()
  539. void CDlgRASDialinMerge::OnChangeEditcallback()
  540. {
  541. // TODO: If this is a RICHEDIT control, the control will not
  542. // send this notification unless you override the CPropertyPage::OnInitDialog()
  543. // function to send the EM_SETEVENTMASK message to the control
  544. // with the ENM_CHANGE flag ORed into the lParam mask.
  545. // TODO: Add your control notification handler code here
  546. SetModified();
  547. }
  548. void CDlgRASDialinMerge::OnChangeEditcallerid()
  549. {
  550. SetModified();
  551. // TODO: If this is a RICHEDIT control, the control will not
  552. // send this notification unless you override the CPropertyPage::OnInitDialog()
  553. // function to send the EM_SETEVENTMASK message to the control
  554. // with the ENM_CHANGE flag ORed into the lParam mask.
  555. // TODO: Add your control notification handler code here
  556. }
  557. void CDlgRASDialinMerge::OnPermitAllow()
  558. {
  559. SetModified();
  560. }
  561. void CDlgRASDialinMerge::OnPermitDeny()
  562. {
  563. SetModified();
  564. }
  565. void CDlgRASDialinMerge::OnPermitPolicy()
  566. {
  567. SetModified();
  568. }
  569. void CDlgRASDialinMerge::OnFieldchangedEditipaddress(NMHDR* pNMHDR, LRESULT* pResult)
  570. {
  571. SetModified();
  572. *pResult = 0;
  573. }