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.

1474 lines
36 KiB

  1. // Copyright (c) 1995, Microsoft Corporation, all rights reserved
  2. //
  3. // devcfg.c
  4. // Remote Access Common Dialog APIs
  5. // Device configuration dialogs
  6. //
  7. // 10/20/95 Steve Cobb
  8. #include "rasdlgp.h"
  9. #include "mcx.h"
  10. //----------------------------------------------------------------------------
  11. // Help maps
  12. //----------------------------------------------------------------------------
  13. static DWORD g_adwIcHelp[] =
  14. {
  15. CID_IC_ST_LineType, HID_IC_LB_LineType,
  16. CID_IC_LB_LineType, HID_IC_LB_LineType,
  17. CID_IC_CB_Fallback, HID_IC_CB_Fallback,
  18. CID_IC_GB_DownLevel, HID_IC_CB_DownLevel,
  19. CID_IC_CB_DownLevel, HID_IC_CB_DownLevel,
  20. CID_IC_CB_Compression, HID_IC_CB_Compression,
  21. CID_IC_ST_Channels, HID_IC_EB_Channels,
  22. CID_IC_EB_Channels, HID_IC_EB_Channels,
  23. 0, 0
  24. };
  25. static DWORD g_adwMcHelp[] =
  26. {
  27. CID_MC_I_Modem, HID_MC_I_Modem,
  28. CID_MC_EB_ModemValue, HID_MC_EB_ModemValue,
  29. CID_MC_ST_MaxBps, HID_MC_LB_MaxBps,
  30. CID_MC_LB_MaxBps, HID_MC_LB_MaxBps,
  31. CID_MC_GB_Features, HID_MC_GB_Features,
  32. CID_MC_CB_FlowControl, HID_MC_CB_FlowControl,
  33. CID_MC_CB_ErrorControl, HID_MC_CB_ErrorControl,
  34. CID_MC_CB_Compression, HID_MC_CB_Compression,
  35. CID_MC_CB_Terminal, HID_MC_CB_Terminal,
  36. CID_MC_CB_EnableSpeaker, HID_MC_CB_EnableSpeaker,
  37. CID_MC_ST_ModemProtocol, HID_MC_LB_ModemProtocol,
  38. CID_MC_LB_ModemProtocol, HID_MC_LB_ModemProtocol,
  39. 0, 0
  40. };
  41. static DWORD g_adwXsHelp[] =
  42. {
  43. CID_XS_ST_Explain, HID_XS_ST_Explain,
  44. CID_XS_ST_Networks, HID_XS_LB_Networks,
  45. CID_XS_LB_Networks, HID_XS_LB_Networks,
  46. CID_XS_ST_Address, HID_XS_EB_Address,
  47. CID_XS_EB_Address, HID_XS_EB_Address,
  48. CID_XS_GB_Optional, HID_XS_GB_Optional,
  49. CID_XS_ST_UserData, HID_XS_EB_UserData,
  50. CID_XS_EB_UserData, HID_XS_EB_UserData,
  51. CID_XS_ST_Facilities, HID_XS_EB_Facilities,
  52. CID_XS_EB_Facilities, HID_XS_EB_Facilities,
  53. 0, 0
  54. };
  55. //----------------------------------------------------------------------------
  56. // Local datatypes
  57. //----------------------------------------------------------------------------
  58. // ISDN Configuration dialog argument block.
  59. //
  60. typedef struct
  61. _ICARGS
  62. {
  63. BOOL fShowProprietary;
  64. PBLINK* pLink;
  65. }
  66. ICARGS;
  67. // ISDN Configuration dialog context block.
  68. //
  69. typedef struct
  70. _ICINFO
  71. {
  72. // Stub API arguments including shortcut to link associated with the
  73. // entry.
  74. //
  75. ICARGS* pArgs;
  76. // Handle of this dialog and some of it's controls.
  77. //
  78. HWND hwndDlg;
  79. HWND hwndLbLineType;
  80. HWND hwndCbFallback;
  81. HWND hwndCbProprietary;
  82. HWND hwndCbCompression;
  83. HWND hwndStChannels;
  84. HWND hwndEbChannels;
  85. HWND hwndUdChannels;
  86. }
  87. ICINFO;
  88. typedef struct
  89. _MC_INIT_INFO
  90. {
  91. PBLINK* pLink;
  92. BOOL fRouter;
  93. }
  94. MC_INIT_INFO;
  95. // Modem Configuration dialog context block.
  96. //
  97. typedef struct
  98. _MCINFO
  99. {
  100. // Stub API arguments. Shortcut to link associated with the entry.
  101. //
  102. PBLINK* pLink;
  103. // Handle of this dialog and some of it's controls.
  104. //
  105. HWND hwndDlg;
  106. HWND hwndEbModemValue;
  107. HWND hwndLbBps;
  108. HWND hwndCbHwFlow;
  109. HWND hwndCbEc;
  110. HWND hwndCbEcc;
  111. HWND hwndCbTerminal;
  112. HWND hwndCbEnableSpeaker;
  113. HWND hwndLbModemProtocols;
  114. // Script utilities context.
  115. //
  116. SUINFO suinfo;
  117. BOOL fSuInfoInitialized;
  118. BOOL fRouter;
  119. }
  120. MCINFO;
  121. // X.25 Logon Settings dialog argument block.
  122. //
  123. typedef struct
  124. _XSARGS
  125. {
  126. BOOL fLocalPad;
  127. PBENTRY* pEntry;
  128. }
  129. XSARGS;
  130. // X.25 Logon Settings dialog context block.
  131. //
  132. typedef struct
  133. _XSINFO
  134. {
  135. // Caller's arguments to the dialog.
  136. //
  137. XSARGS* pArgs;
  138. // Handle of this dialog and some of it's controls.
  139. //
  140. HWND hwndDlg;
  141. HWND hwndLbNetworks;
  142. HWND hwndEbAddress;
  143. HWND hwndEbUserData;
  144. HWND hwndEbFacilities;
  145. }
  146. XSINFO;
  147. //----------------------------------------------------------------------------
  148. // Local prototypes (alphabetically)
  149. //----------------------------------------------------------------------------
  150. BOOL
  151. IcCommand(
  152. IN HWND hwnd,
  153. IN WORD wNotification,
  154. IN WORD wId,
  155. IN HWND hwndCtrl );
  156. INT_PTR CALLBACK
  157. IcDlgProc(
  158. IN HWND hwnd,
  159. IN UINT unMsg,
  160. IN WPARAM wparam,
  161. IN LPARAM lparam );
  162. BOOL
  163. IcInit(
  164. IN HWND hwndDlg,
  165. IN ICARGS* pArgs );
  166. VOID
  167. IcTerm(
  168. IN HWND hwndDlg );
  169. BOOL
  170. IsdnConfigureDlg(
  171. IN HWND hwndOwner,
  172. IN PBLINK* pLink,
  173. IN BOOL fShowProprietary );
  174. BOOL
  175. ModemConfigureDlg(
  176. IN HWND hwndOwner,
  177. IN PBLINK* pLink,
  178. IN BOOL fRouter);
  179. INT_PTR CALLBACK
  180. McDlgProc(
  181. IN HWND hwnd,
  182. IN UINT unMsg,
  183. IN WPARAM wparam,
  184. IN LPARAM lparam );
  185. BOOL
  186. McCommand(
  187. IN HWND hwnd,
  188. IN WORD wNotification,
  189. IN WORD wId,
  190. IN HWND hwndCtrl );
  191. BOOL
  192. McInit(
  193. IN HWND hwndDlg,
  194. IN MC_INIT_INFO* pInitInfo );
  195. VOID
  196. McTerm(
  197. IN HWND hwndDlg );
  198. BOOL
  199. XsCommand(
  200. IN XSINFO* pInfo,
  201. IN WORD wNotification,
  202. IN WORD wId,
  203. IN HWND hwndCtrl );
  204. INT_PTR CALLBACK
  205. XsDlgProc(
  206. IN HWND hwnd,
  207. IN UINT unMsg,
  208. IN WPARAM wparam,
  209. IN LPARAM lparam );
  210. VOID
  211. XsFillPadsList(
  212. IN XSINFO* pInfo );
  213. BOOL
  214. XsInit(
  215. IN HWND hwndDlg,
  216. IN XSARGS* pArgs );
  217. BOOL
  218. XsSave(
  219. IN XSINFO* pInfo );
  220. VOID
  221. XsTerm(
  222. IN HWND hwndDlg );
  223. //----------------------------------------------------------------------------
  224. // Device configuration dialog
  225. //----------------------------------------------------------------------------
  226. BOOL
  227. DeviceConfigureDlg(
  228. IN HWND hwndOwner,
  229. IN PBLINK* pLink,
  230. IN PBENTRY* pEntry,
  231. IN BOOL fSingleLink,
  232. IN BOOL fRouter)
  233. // Popup a dialog to edit the device 'PLink'. 'HwndOwner' is the owner of
  234. // the dialog. 'PEntry' is the phonebook entry containing the X.25
  235. // settings or NULL if X.25 settings should not be displayed for PAD and
  236. // X.25 devices. 'FSingleLink' is true if 'pLink' is a single link
  237. // entry's link and false if multi-link.
  238. //
  239. // Returns true if user pressed OK and succeeded, false if user pressed
  240. // Cancel or encountered an error.
  241. //
  242. {
  243. DWORD dwErr;
  244. PBDEVICETYPE pbdt;
  245. pbdt = pLink->pbport.pbdevicetype;
  246. if (!pEntry && (pbdt == PBDT_Pad || pbdt == PBDT_X25))
  247. {
  248. pbdt = PBDT_None;
  249. }
  250. // pmay: 245860
  251. //
  252. // We need to allow the editing of null modems too.
  253. //
  254. if ( pLink->pbport.dwFlags & PBP_F_NullModem )
  255. {
  256. pbdt = PBDT_Modem;
  257. }
  258. switch (pbdt)
  259. {
  260. case PBDT_Isdn:
  261. {
  262. return IsdnConfigureDlg( hwndOwner, pLink, fSingleLink );
  263. }
  264. case PBDT_Modem:
  265. {
  266. return ModemConfigureDlg( hwndOwner, pLink, fRouter );
  267. }
  268. case PBDT_Pad:
  269. {
  270. return X25LogonSettingsDlg( hwndOwner, TRUE, pEntry );
  271. }
  272. case PBDT_X25:
  273. {
  274. return X25LogonSettingsDlg( hwndOwner, FALSE, pEntry );
  275. }
  276. default:
  277. {
  278. MsgDlg( hwndOwner, SID_NoConfigure, NULL );
  279. return FALSE;
  280. }
  281. }
  282. }
  283. //----------------------------------------------------------------------------
  284. // ISDN configuration dialog
  285. // Listed alphabetically following stub API and dialog proc
  286. //----------------------------------------------------------------------------
  287. BOOL
  288. IsdnConfigureDlg(
  289. IN HWND hwndOwner,
  290. IN PBLINK* pLink,
  291. IN BOOL fShowProprietary )
  292. // Popup the ISDN device configuration dialog. 'HwndOwner' is the owner
  293. // of the dialog. 'PLink' is the link to edit. 'FShowProprietary'
  294. // indicates the old proprietary Digiboard options should be shown.
  295. //
  296. // Returns true if user pressed OK and succeeded, false if user pressed
  297. // Cancel or encountered an error.
  298. //
  299. {
  300. INT_PTR nStatus;
  301. ICARGS args;
  302. TRACE( "IsdnConfigureDlg" );
  303. args.fShowProprietary = fShowProprietary;
  304. args.pLink = pLink;
  305. nStatus =
  306. (BOOL )DialogBoxParam(
  307. g_hinstDll,
  308. (fShowProprietary)
  309. ? MAKEINTRESOURCE( DID_IC_IsdnConfigure )
  310. : MAKEINTRESOURCE( DID_IC_IsdnConfigureMlink ),
  311. hwndOwner,
  312. IcDlgProc,
  313. (LPARAM )&args );
  314. if (nStatus == -1)
  315. {
  316. ErrorDlg( hwndOwner, SID_OP_LoadDlg, ERROR_UNKNOWN, NULL );
  317. nStatus = FALSE;
  318. }
  319. return (BOOL )nStatus;
  320. }
  321. INT_PTR CALLBACK
  322. IcDlgProc(
  323. IN HWND hwnd,
  324. IN UINT unMsg,
  325. IN WPARAM wparam,
  326. IN LPARAM lparam )
  327. // DialogProc callback for the ISDN Configure dialog. Parameters and
  328. // return value are as described for standard windows 'DialogProc's.
  329. //
  330. {
  331. #if 0
  332. TRACE4( "IcDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  333. (DWORD )hwnd, (DWORD )unMsg, (DWORD )wparam, (DWORD )lparam );
  334. #endif
  335. switch (unMsg)
  336. {
  337. case WM_INITDIALOG:
  338. {
  339. return IcInit( hwnd, (ICARGS* )lparam );
  340. }
  341. case WM_HELP:
  342. case WM_CONTEXTMENU:
  343. {
  344. ContextHelp( g_adwIcHelp, hwnd, unMsg, wparam, lparam );
  345. break;
  346. }
  347. case WM_COMMAND:
  348. {
  349. return IcCommand(
  350. hwnd, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  351. }
  352. case WM_DESTROY:
  353. {
  354. IcTerm( hwnd );
  355. break;
  356. }
  357. }
  358. return FALSE;
  359. }
  360. BOOL
  361. IcCommand(
  362. IN HWND hwnd,
  363. IN WORD wNotification,
  364. IN WORD wId,
  365. IN HWND hwndCtrl )
  366. // Called on WM_COMMAND. 'Hwnd' is the dialog window. 'WNotification' is
  367. // the notification code of the command. 'wId' is the control/menu
  368. // identifier of the command. 'HwndCtrl' is the control window handle of
  369. // the command.
  370. //
  371. // Returns true if processed message, false otherwise.
  372. //
  373. {
  374. DWORD dwErr;
  375. TRACE3( "IcCommand(n=%d,i=%d,c=$%x)",
  376. (DWORD )wNotification, (DWORD )wId, (ULONG_PTR )hwndCtrl );
  377. switch (wId)
  378. {
  379. case CID_IC_CB_DownLevel:
  380. {
  381. if (wNotification == BN_CLICKED)
  382. {
  383. BOOL fCheck;
  384. ICINFO* pInfo;
  385. pInfo = (ICINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  386. ASSERT( pInfo );
  387. if (pInfo->pArgs->fShowProprietary)
  388. {
  389. fCheck = Button_GetCheck( pInfo->hwndCbProprietary );
  390. EnableWindow( pInfo->hwndCbCompression, fCheck );
  391. EnableWindow( pInfo->hwndStChannels, fCheck );
  392. EnableWindow( pInfo->hwndEbChannels, fCheck );
  393. EnableWindow( pInfo->hwndUdChannels, fCheck );
  394. }
  395. }
  396. return TRUE;
  397. }
  398. case IDOK:
  399. {
  400. ICINFO* pInfo;
  401. INT iSel;
  402. TRACE( "OK pressed" );
  403. pInfo = (ICINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  404. ASSERT( pInfo );
  405. iSel = ComboBox_GetCurSel( pInfo->hwndLbLineType );
  406. if (iSel >= 0)
  407. {
  408. pInfo->pArgs->pLink->lLineType = iSel;
  409. }
  410. pInfo->pArgs->pLink->fFallback =
  411. Button_GetCheck( pInfo->hwndCbFallback );
  412. pInfo->pArgs->pLink->fProprietaryIsdn =
  413. Button_GetCheck( pInfo->hwndCbProprietary );
  414. if (pInfo->pArgs->fShowProprietary)
  415. {
  416. BOOL f;
  417. UINT unValue;
  418. pInfo->pArgs->pLink->fCompression =
  419. Button_GetCheck( pInfo->hwndCbCompression );
  420. unValue = GetDlgItemInt(
  421. pInfo->hwndDlg, CID_IC_EB_Channels, &f, FALSE );
  422. if (f && unValue >= 1 && unValue <= 999999999)
  423. {
  424. pInfo->pArgs->pLink->lChannels = unValue;
  425. }
  426. }
  427. EndDialog( pInfo->hwndDlg, TRUE );
  428. return TRUE;
  429. }
  430. case IDCANCEL:
  431. {
  432. TRACE( "Cancel pressed" );
  433. EndDialog( hwnd, FALSE );
  434. return TRUE;
  435. }
  436. }
  437. return FALSE;
  438. }
  439. BOOL
  440. IcInit(
  441. IN HWND hwndDlg,
  442. IN ICARGS* pArgs )
  443. // Called on WM_INITDIALOG. 'hwndDlg' is the handle of the owning window.
  444. // 'PArgs' is the caller's stub API arguments.
  445. //
  446. // Return false if focus was set, true otherwise, i.e. as defined for
  447. // WM_INITDIALOG.
  448. //
  449. {
  450. DWORD dwErr;
  451. ICINFO* pInfo;
  452. TRACE( "IcInit" );
  453. // Allocate the dialog context block. Initialize minimally for proper
  454. // cleanup, then attach to the dialog window.
  455. //
  456. {
  457. pInfo = Malloc( sizeof(*pInfo) );
  458. if (!pInfo)
  459. {
  460. ErrorDlg( hwndDlg, SID_OP_LoadDlg, ERROR_NOT_ENOUGH_MEMORY, NULL );
  461. EndDialog( hwndDlg, FALSE );
  462. return TRUE;
  463. }
  464. ZeroMemory( pInfo, sizeof(*pInfo) );
  465. pInfo->pArgs = pArgs;
  466. pInfo->hwndDlg = hwndDlg;
  467. SetWindowLongPtr( hwndDlg, DWLP_USER, (ULONG_PTR )pInfo );
  468. TRACE( "Context set" );
  469. }
  470. pInfo->hwndLbLineType = GetDlgItem( hwndDlg, CID_IC_LB_LineType );
  471. ASSERT( pInfo->hwndLbLineType );
  472. pInfo->hwndCbFallback = GetDlgItem( hwndDlg, CID_IC_CB_Fallback );
  473. ASSERT( pInfo->hwndCbFallback );
  474. if (pArgs->fShowProprietary)
  475. {
  476. pInfo->hwndCbProprietary = GetDlgItem( hwndDlg, CID_IC_CB_DownLevel );
  477. ASSERT( pInfo->hwndCbProprietary );
  478. pInfo->hwndCbCompression = GetDlgItem( hwndDlg, CID_IC_CB_Compression );
  479. ASSERT( pInfo->hwndCbCompression );
  480. pInfo->hwndStChannels = GetDlgItem( hwndDlg, CID_IC_ST_Channels );
  481. ASSERT( pInfo->hwndStChannels );
  482. pInfo->hwndEbChannels = GetDlgItem( hwndDlg, CID_IC_EB_Channels );
  483. ASSERT( pInfo->hwndEbChannels );
  484. }
  485. // Initialize fields.
  486. //
  487. ComboBox_AddItemFromId( g_hinstDll, pInfo->hwndLbLineType,
  488. SID_IsdnLineType0, NULL );
  489. ComboBox_AddItemFromId( g_hinstDll, pInfo->hwndLbLineType,
  490. SID_IsdnLineType1, NULL );
  491. ComboBox_AddItemFromId( g_hinstDll, pInfo->hwndLbLineType,
  492. SID_IsdnLineType2, NULL );
  493. ComboBox_SetCurSel( pInfo->hwndLbLineType, pArgs->pLink->lLineType );
  494. Button_SetCheck( pInfo->hwndCbFallback, pArgs->pLink->fFallback );
  495. if (pArgs->fShowProprietary)
  496. {
  497. // Send click to triggle window enable update.
  498. //
  499. Button_SetCheck( pInfo->hwndCbProprietary,
  500. !pArgs->pLink->fProprietaryIsdn );
  501. SendMessage( pInfo->hwndCbProprietary, BM_CLICK, 0, 0 );
  502. Button_SetCheck( pInfo->hwndCbCompression, pArgs->pLink->fCompression );
  503. pInfo->hwndUdChannels = CreateUpDownControl(
  504. WS_CHILD + WS_VISIBLE + WS_BORDER +
  505. UDS_SETBUDDYINT + UDS_ALIGNRIGHT + UDS_NOTHOUSANDS +
  506. UDS_ARROWKEYS,
  507. 0, 0, 0, 0, hwndDlg, 100, g_hinstDll, pInfo->hwndEbChannels,
  508. UD_MAXVAL, 1, 0 );
  509. ASSERT( pInfo->hwndUdChannels );
  510. Edit_LimitText( pInfo->hwndEbChannels, 9 );
  511. SetDlgItemInt( hwndDlg, CID_IC_EB_Channels,
  512. pArgs->pLink->lChannels, FALSE );
  513. }
  514. // Position the dialog centered on the owner window.
  515. //
  516. CenterWindow( hwndDlg, GetParent( hwndDlg ) );
  517. // Add context help button to title bar.
  518. //
  519. AddContextHelpButton( hwndDlg );
  520. return TRUE;
  521. }
  522. VOID
  523. IcTerm(
  524. IN HWND hwndDlg )
  525. // Dialog termination. Releases the context block. 'HwndDlg' is the
  526. // handle of a dialog.
  527. //
  528. {
  529. ICINFO* pInfo;
  530. TRACE( "IcTerm" );
  531. pInfo = (ICINFO* )GetWindowLongPtr( hwndDlg, DWLP_USER );
  532. if (pInfo)
  533. {
  534. Free( pInfo );
  535. TRACE( "Context freed" );
  536. }
  537. }
  538. //----------------------------------------------------------------------------
  539. // Modem configuration dialog
  540. // Listed alphabetically following stub API and dialog proc
  541. //----------------------------------------------------------------------------
  542. BOOL
  543. ModemConfigureDlg(
  544. IN HWND hwndOwner,
  545. IN PBLINK* pLink,
  546. IN BOOL fRouter)
  547. // Popup the modem configuration dialog. 'HwndOwner' is the owner of the
  548. // dialog. 'PLink' is the link to edit.
  549. //
  550. // Returns true if user pressed OK and succeeded, false if user pressed
  551. // Cancel or encountered an error.
  552. //
  553. {
  554. INT_PTR nStatus;
  555. MC_INIT_INFO InitInfo;
  556. TRACE( "ModemConfigureDlg" );
  557. ZeroMemory(&InitInfo, sizeof(InitInfo));
  558. InitInfo.pLink = pLink;
  559. InitInfo.fRouter = fRouter;
  560. nStatus =
  561. (BOOL )DialogBoxParam(
  562. g_hinstDll,
  563. MAKEINTRESOURCE( DID_MC_ModemConfigure ),
  564. hwndOwner,
  565. McDlgProc,
  566. (LPARAM ) &InitInfo );
  567. if (nStatus == -1)
  568. {
  569. ErrorDlg( hwndOwner, SID_OP_LoadDlg, ERROR_UNKNOWN, NULL );
  570. nStatus = FALSE;
  571. }
  572. return (BOOL )nStatus;
  573. }
  574. INT_PTR CALLBACK
  575. McDlgProc(
  576. IN HWND hwnd,
  577. IN UINT unMsg,
  578. IN WPARAM wparam,
  579. IN LPARAM lparam )
  580. // DialogProc callback for the Modem Settings dialog. Parameters and
  581. // return value are as described for standard windows 'DialogProc's.
  582. //
  583. {
  584. #if 0
  585. TRACE4( "McDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  586. (DWORD )hwnd, (DWORD )unMsg, (DWORD )wparam, (DWORD )lparam );
  587. #endif
  588. switch (unMsg)
  589. {
  590. case WM_INITDIALOG:
  591. {
  592. return McInit( hwnd, (MC_INIT_INFO* )lparam );
  593. }
  594. case WM_HELP:
  595. case WM_CONTEXTMENU:
  596. {
  597. ContextHelp( g_adwMcHelp, hwnd, unMsg, wparam, lparam );
  598. break;
  599. }
  600. case WM_COMMAND:
  601. {
  602. return McCommand(
  603. hwnd, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  604. }
  605. case WM_DESTROY:
  606. {
  607. McTerm( hwnd );
  608. break;
  609. }
  610. }
  611. return FALSE;
  612. }
  613. BOOL
  614. McCommand(
  615. IN HWND hwnd,
  616. IN WORD wNotification,
  617. IN WORD wId,
  618. IN HWND hwndCtrl )
  619. // Called on WM_COMMAND. 'Hwnd' is the dialog window. 'WNotification' is
  620. // the notification code of the command. 'wId' is the control/menu
  621. // identifier of the command. 'HwndCtrl' is the control window handle of
  622. // the command.
  623. //
  624. // Returns true if processed message, false otherwise.
  625. //
  626. {
  627. DWORD dwErr;
  628. TRACE3( "McCommand(n=%d,i=%d,c=$%x)",
  629. (DWORD )wNotification, (DWORD )wId, (ULONG_PTR )hwndCtrl );
  630. switch (wId)
  631. {
  632. case CID_MC_CB_FlowControl:
  633. {
  634. if (wNotification == BN_CLICKED)
  635. {
  636. MCINFO* pInfo = (MCINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  637. ASSERT( pInfo );
  638. if (!Button_GetCheck( pInfo->hwndCbHwFlow ))
  639. {
  640. Button_SetCheck( pInfo->hwndCbEc, FALSE );
  641. Button_SetCheck( pInfo->hwndCbEcc, FALSE );
  642. }
  643. return TRUE;
  644. }
  645. break;
  646. }
  647. case CID_MC_CB_ErrorControl:
  648. {
  649. if (wNotification == BN_CLICKED)
  650. {
  651. MCINFO* pInfo = (MCINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  652. ASSERT( pInfo );
  653. if (Button_GetCheck( pInfo->hwndCbEc ))
  654. {
  655. Button_SetCheck( pInfo->hwndCbHwFlow, TRUE );
  656. }
  657. else
  658. {
  659. Button_SetCheck( pInfo->hwndCbEcc, FALSE );
  660. }
  661. return TRUE;
  662. }
  663. break;
  664. }
  665. case CID_MC_CB_Compression:
  666. {
  667. if (wNotification == BN_CLICKED)
  668. {
  669. MCINFO* pInfo = (MCINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  670. ASSERT( pInfo );
  671. if (Button_GetCheck( pInfo->hwndCbEcc ))
  672. {
  673. Button_SetCheck( pInfo->hwndCbHwFlow, TRUE );
  674. Button_SetCheck( pInfo->hwndCbEc, TRUE );
  675. }
  676. return TRUE;
  677. }
  678. break;
  679. }
  680. case IDOK:
  681. {
  682. MCINFO* pInfo;
  683. PBLINK* pLink;
  684. BOOL fScriptBefore = FALSE;
  685. TRACE( "OK pressed" );
  686. pInfo = (MCINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  687. ASSERT( pInfo );
  688. pLink = pInfo->pLink;
  689. pLink->dwBps =
  690. (DWORD)ComboBox_GetItemData(
  691. pInfo->hwndLbBps,
  692. (INT)ComboBox_GetCurSel( pInfo->hwndLbBps ) );
  693. pLink->fHwFlow = Button_GetCheck( pInfo->hwndCbHwFlow );
  694. pLink->fEc = Button_GetCheck( pInfo->hwndCbEc );
  695. pLink->fEcc = Button_GetCheck( pInfo->hwndCbEcc );
  696. pLink->fSpeaker = Button_GetCheck( pInfo->hwndCbEnableSpeaker );
  697. // pmay: 228565
  698. // Find the selected modem protocol
  699. //
  700. if (IsWindowEnabled( pInfo->hwndLbModemProtocols ))
  701. {
  702. DTLNODE* pNode;
  703. INT iSel;
  704. iSel = ComboBox_GetCurSel( pInfo->hwndLbModemProtocols );
  705. pNode = (DTLNODE*)
  706. ComboBox_GetItemDataPtr(pInfo->hwndLbModemProtocols, iSel);
  707. if ( pNode )
  708. {
  709. pLink->dwModemProtocol = (DWORD) DtlGetNodeId( pNode );
  710. }
  711. }
  712. Free0( pLink->pbport.pszScriptBefore );
  713. // Whistler bug: 308135 Dialup Scripting: Pre-Dial scripts can be
  714. // selected but are not executed
  715. //
  716. SuGetInfo( &pInfo->suinfo,
  717. &fScriptBefore,
  718. &pLink->pbport.fScriptBeforeTerminal,
  719. NULL );
  720. EndDialog( pInfo->hwndDlg, TRUE );
  721. return TRUE;
  722. }
  723. case IDCANCEL:
  724. {
  725. TRACE( "Cancel pressed" );
  726. EndDialog( hwnd, FALSE );
  727. return TRUE;
  728. }
  729. }
  730. return FALSE;
  731. }
  732. BOOL
  733. McInit(
  734. IN HWND hwndDlg,
  735. IN MC_INIT_INFO* pInitInfo )
  736. // Called on WM_INITDIALOG. 'hwndDlg' is the handle of the owning window.
  737. // 'PLink' is the link information to be edited.
  738. //
  739. // Return false if focus was set, true otherwise, i.e. as defined for
  740. // WM_INITDIALOG.
  741. //
  742. {
  743. DWORD dwErr, dwFlags = 0;
  744. MCINFO* pInfo;
  745. PBLINK* pLink = pInitInfo->pLink;
  746. TRACE( "McInit" );
  747. // Allocate the dialog context block. Initialize minimally for proper
  748. // cleanup, then attach to the dialog window.
  749. //
  750. {
  751. pInfo = Malloc( sizeof(*pInfo) );
  752. if (!pInfo)
  753. {
  754. ErrorDlg( hwndDlg, SID_OP_LoadDlg, ERROR_NOT_ENOUGH_MEMORY, NULL );
  755. EndDialog( hwndDlg, FALSE );
  756. return TRUE;
  757. }
  758. ZeroMemory( pInfo, sizeof(*pInfo) );
  759. pInfo->pLink = pInitInfo->pLink;
  760. pInfo->fRouter = pInitInfo->fRouter;
  761. pInfo->hwndDlg = hwndDlg;
  762. SetWindowLongPtr( hwndDlg, DWLP_USER, (ULONG_PTR )pInfo );
  763. TRACE( "Context set" );
  764. }
  765. pInfo->hwndEbModemValue = GetDlgItem( hwndDlg, CID_MC_EB_ModemValue );
  766. ASSERT( pInfo->hwndEbModemValue );
  767. pInfo->hwndLbBps = GetDlgItem( hwndDlg, CID_MC_LB_MaxBps );
  768. ASSERT( pInfo->hwndLbBps );
  769. pInfo->hwndCbHwFlow = GetDlgItem( hwndDlg, CID_MC_CB_FlowControl );
  770. ASSERT( pInfo->hwndCbHwFlow );
  771. pInfo->hwndCbEc = GetDlgItem( hwndDlg, CID_MC_CB_ErrorControl );
  772. ASSERT( pInfo->hwndCbEc );
  773. pInfo->hwndCbEcc = GetDlgItem( hwndDlg, CID_MC_CB_Compression );
  774. ASSERT( pInfo->hwndCbEcc );
  775. pInfo->hwndCbTerminal = GetDlgItem( hwndDlg, CID_MC_CB_Terminal );
  776. ASSERT( pInfo->hwndCbTerminal );
  777. pInfo->hwndCbEnableSpeaker = GetDlgItem( hwndDlg, CID_MC_CB_EnableSpeaker );
  778. ASSERT( pInfo->hwndCbEnableSpeaker );
  779. pInfo->hwndLbModemProtocols = GetDlgItem( hwndDlg, CID_MC_LB_ModemProtocol );
  780. ASSERT( pInfo->hwndLbModemProtocols );
  781. Button_SetCheck( pInfo->hwndCbHwFlow, pLink->fHwFlow );
  782. Button_SetCheck( pInfo->hwndCbEc, pLink->fEc );
  783. Button_SetCheck( pInfo->hwndCbEcc, pLink->fEcc );
  784. Button_SetCheck( pInfo->hwndCbEnableSpeaker, pLink->fSpeaker );
  785. // Fill in the modem name.
  786. //
  787. {
  788. TCHAR* psz;
  789. psz = DisplayPszFromDeviceAndPort(
  790. pLink->pbport.pszDevice, pLink->pbport.pszPort );
  791. if (psz)
  792. {
  793. SetWindowText( pInfo->hwndEbModemValue, psz );
  794. Free( psz );
  795. }
  796. }
  797. // Fill in the BPS list.
  798. //
  799. {
  800. TCHAR szBps[ MAXLTOTLEN + 1 ];
  801. DWORD* pdwBps;
  802. INT i;
  803. //Add 230400 for whistler bug 307879
  804. //
  805. static DWORD adwBps[] =
  806. {
  807. 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600,
  808. 0
  809. };
  810. for (pdwBps = adwBps; *pdwBps; ++pdwBps)
  811. {
  812. LToT( *pdwBps, szBps, 10 );
  813. i = ComboBox_AddString( pInfo->hwndLbBps, szBps );
  814. ComboBox_SetItemData( pInfo->hwndLbBps, i, *pdwBps );
  815. if (*pdwBps == pLink->dwBps)
  816. {
  817. ComboBox_SetCurSel( pInfo->hwndLbBps, i );
  818. }
  819. }
  820. if (ComboBox_GetCurSel( pInfo->hwndLbBps ) < 0)
  821. {
  822. // Entry lists an unknown BPS rate. Add it to the end of the
  823. // list.
  824. //
  825. TRACE( "Irregular BPS" );
  826. LToT( pLink->dwBps, szBps, 10 );
  827. i = ComboBox_AddString( pInfo->hwndLbBps, szBps );
  828. ComboBox_SetItemData( pInfo->hwndLbBps, i, pLink->dwBps );
  829. ComboBox_SetCurSel( pInfo->hwndLbBps, i );
  830. }
  831. }
  832. // Fill in the modem protocol list
  833. //
  834. {
  835. PBPORT* pPort = &(pLink->pbport);
  836. DTLNODE* pNode;
  837. WCHAR pszBuffer[64];
  838. INT iItemSel = 0, iItem = 0;
  839. DbgPrint("pListProtocols=0x%x\n", pPort->pListProtocols);
  840. // Only fill in the modem protocol information
  841. // if it was supplied by the link
  842. //
  843. if ((pPort->pListProtocols) &&
  844. (DtlGetNodes (pPort->pListProtocols))
  845. )
  846. {
  847. for (pNode = DtlGetFirstNode( pPort->pListProtocols );
  848. pNode;
  849. pNode = DtlGetNextNode( pNode ))
  850. {
  851. iItem = ComboBox_AddItem(
  852. pInfo->hwndLbModemProtocols,
  853. (PWCHAR) DtlGetData(pNode),
  854. (VOID*) pNode);
  855. if (DtlGetNodeId(pNode) == (LONG_PTR)pLink->dwModemProtocol)
  856. {
  857. iItemSel = iItem;
  858. }
  859. }
  860. ComboBox_SetCurSelNotify(
  861. pInfo->hwndLbModemProtocols,
  862. iItemSel);
  863. }
  864. // Otherwise, disable the protocol selector
  865. //
  866. else
  867. {
  868. EnableWindow( pInfo->hwndLbModemProtocols, FALSE );
  869. }
  870. }
  871. // Set up the before-dial scripting controls.
  872. //
  873. // Whistler bug 181371 re-enabled pre-dial scripting from Win2K
  874. //
  875. // Whistler bug: 308135 Dialup Scripting: Pre-Dial scripts can be selected
  876. // but are not executed
  877. //
  878. // We QFE'd re-enabling this for SP2. According to the Unimodem guys this
  879. // has never worked and isn't supported. I had test verify that even with
  880. // the SP2 fix on 2195, although the UI is re-enabled, the scripts fail.
  881. //
  882. dwFlags |= SU_F_DisableScripting;
  883. SuInit( &pInfo->suinfo,
  884. NULL,
  885. pInfo->hwndCbTerminal,
  886. NULL,
  887. NULL,
  888. NULL,
  889. dwFlags);
  890. pInfo->fSuInfoInitialized = TRUE;
  891. SuSetInfo( &pInfo->suinfo,
  892. FALSE,
  893. pLink->pbport.fScriptBeforeTerminal,
  894. NULL );
  895. // Position the dialog centered on the owner window.
  896. //
  897. CenterWindow( hwndDlg, GetParent( hwndDlg ) );
  898. // Add context help button to title bar.
  899. //
  900. AddContextHelpButton( hwndDlg );
  901. // Set focust to Bps since the default focus in the not very useful device
  902. // name.
  903. //
  904. SetFocus( pInfo->hwndLbBps );
  905. return FALSE;
  906. }
  907. VOID
  908. McTerm(
  909. IN HWND hwndDlg )
  910. // Dialog termination. Releases the context block. 'HwndDlg' is the
  911. // handle of a dialog.
  912. //
  913. {
  914. MCINFO* pInfo;
  915. TRACE( "McTerm" );
  916. pInfo = (MCINFO* )GetWindowLongPtr( hwndDlg, DWLP_USER );
  917. if (pInfo)
  918. {
  919. if (pInfo->fSuInfoInitialized)
  920. {
  921. SuFree( &pInfo->suinfo );
  922. }
  923. Free( pInfo );
  924. TRACE( "Context freed" );
  925. }
  926. }
  927. //----------------------------------------------------------------------------
  928. // X.25 Logon Settings dialog routines
  929. // Listed alphabetically following entrypoint and dialog proc
  930. //----------------------------------------------------------------------------
  931. BOOL
  932. X25LogonSettingsDlg(
  933. IN HWND hwndOwner,
  934. IN BOOL fLocalPad,
  935. IN OUT PBENTRY* pEntry )
  936. // Popup a dialog to set X.25 logon settings for phonebook entry 'pEntry'.
  937. // 'HwndOwner' is the owning window. 'FLocalPad' is set when the selected
  938. // device is a local X.25 PAD device.
  939. //
  940. // Returns true if user pressed OK and succeeded or false on Cancel or
  941. // error.
  942. //
  943. {
  944. INT_PTR nStatus;
  945. XSARGS args;
  946. TRACE( "X25LogonSettingsDlg" );
  947. args.fLocalPad = fLocalPad;
  948. args.pEntry = pEntry;
  949. nStatus =
  950. DialogBoxParam(
  951. g_hinstDll,
  952. MAKEINTRESOURCE( DID_XS_X25Settings ),
  953. hwndOwner,
  954. XsDlgProc,
  955. (LPARAM )&args );
  956. if (nStatus == -1)
  957. {
  958. ErrorDlg( hwndOwner, SID_OP_LoadDlg, ERROR_UNKNOWN, NULL );
  959. nStatus = FALSE;
  960. }
  961. return (BOOL )nStatus;
  962. }
  963. INT_PTR CALLBACK
  964. XsDlgProc(
  965. IN HWND hwnd,
  966. IN UINT unMsg,
  967. IN WPARAM wparam,
  968. IN LPARAM lparam )
  969. // DialogProc callback for the X.25 Logon Settings dialog. Parameters and
  970. // return value are as described for standard windows 'DialogProc's.
  971. //
  972. {
  973. #if 0
  974. TRACE4( "XsDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  975. (DWORD )hwnd, (DWORD )unMsg, (DWORD )wparam, (DWORD )lparam );
  976. #endif
  977. switch (unMsg)
  978. {
  979. case WM_INITDIALOG:
  980. {
  981. return XsInit( hwnd, (XSARGS* )lparam );
  982. }
  983. case WM_HELP:
  984. case WM_CONTEXTMENU:
  985. {
  986. ContextHelp( g_adwXsHelp, hwnd, unMsg, wparam, lparam );
  987. break;
  988. }
  989. case WM_COMMAND:
  990. {
  991. XSINFO* pInfo = (XSINFO* )GetWindowLongPtr( hwnd, DWLP_USER );
  992. ASSERT( pInfo );
  993. return XsCommand(
  994. pInfo, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  995. }
  996. case WM_DESTROY:
  997. {
  998. XsTerm( hwnd );
  999. break;
  1000. }
  1001. }
  1002. return FALSE;
  1003. }
  1004. BOOL
  1005. XsCommand(
  1006. IN XSINFO* pInfo,
  1007. IN WORD wNotification,
  1008. IN WORD wId,
  1009. IN HWND hwndCtrl )
  1010. // Called on WM_COMMAND. 'PInfo' is the dialog context. 'WNotification'
  1011. // is the notification code of the command. 'wId' is the control/menu
  1012. // identifier of the command. 'HwndCtrl' is the control window handle of
  1013. // the command.
  1014. //
  1015. // Returns true if processed message, false otherwise.
  1016. //
  1017. {
  1018. TRACE3( "XsCommand(n=%d,i=%d,c=$%x)",
  1019. (DWORD )wNotification, (DWORD )wId, (ULONG_PTR )hwndCtrl );
  1020. switch (wId)
  1021. {
  1022. case IDOK:
  1023. {
  1024. EndDialog( pInfo->hwndDlg, XsSave( pInfo ) );
  1025. return TRUE;
  1026. }
  1027. case IDCANCEL:
  1028. {
  1029. TRACE( "Cancel pressed" );
  1030. EndDialog( pInfo->hwndDlg, FALSE );
  1031. return TRUE;
  1032. }
  1033. }
  1034. return FALSE;
  1035. }
  1036. VOID
  1037. XsFillPadsList(
  1038. IN XSINFO* pInfo )
  1039. // Fill PADs list and selects the PAD from user's entry. 'PInfo' is the
  1040. // dialog context.
  1041. //
  1042. {
  1043. DWORD dwErr;
  1044. DTLNODE* pNode;
  1045. PBENTRY* pEntry;
  1046. INT nIndex;
  1047. TRACE( "XsFillPadsList" );
  1048. // Add the "(none)" item.
  1049. //
  1050. ComboBox_AddItemFromId(
  1051. g_hinstDll, pInfo->hwndLbNetworks, SID_NoneSelected, NULL );
  1052. ComboBox_SetCurSel( pInfo->hwndLbNetworks, 0 );
  1053. if (!pInfo->pArgs->fLocalPad)
  1054. {
  1055. DTLLIST* pListPads;
  1056. dwErr = LoadPadsList( &pListPads );
  1057. if (dwErr != 0)
  1058. {
  1059. ErrorDlg( pInfo->hwndDlg, SID_OP_LoadX25Info, dwErr, NULL );
  1060. return;
  1061. }
  1062. pEntry = pInfo->pArgs->pEntry;
  1063. for (pNode = DtlGetFirstNode( pListPads );
  1064. pNode;
  1065. pNode = DtlGetNextNode( pNode ))
  1066. {
  1067. TCHAR* psz;
  1068. psz = (TCHAR* )DtlGetData( pNode );
  1069. nIndex = ComboBox_AddString( pInfo->hwndLbNetworks, psz );
  1070. if (pEntry->pszX25Network
  1071. && lstrcmp( psz, pEntry->pszX25Network ) == 0)
  1072. {
  1073. ComboBox_SetCurSel( pInfo->hwndLbNetworks, nIndex );
  1074. }
  1075. }
  1076. DtlDestroyList( pListPads, DestroyPszNode );
  1077. if (pEntry->pszX25Network
  1078. && ComboBox_GetCurSel( pInfo->hwndLbNetworks ) == 0)
  1079. {
  1080. // The PAD from the phonebook entry is not in the PAD list. Add
  1081. // it and select it.
  1082. //
  1083. nIndex = ComboBox_AddString(
  1084. pInfo->hwndLbNetworks, pEntry->pszX25Network );
  1085. ComboBox_SetCurSel( pInfo->hwndLbNetworks, nIndex );
  1086. }
  1087. }
  1088. ComboBox_AutoSizeDroppedWidth( pInfo->hwndLbNetworks );
  1089. }
  1090. BOOL
  1091. XsInit(
  1092. IN HWND hwndDlg,
  1093. IN XSARGS* pArgs )
  1094. // Called on WM_INITDIALOG. 'HwndDlg' is the handle of the phonebook
  1095. // dialog window. 'PArgs' is caller's arguments as passed to the stub
  1096. // API.
  1097. //
  1098. // Return false if focus was set, true otherwise, i.e. as defined for
  1099. // WM_INITDIALOG.
  1100. //
  1101. {
  1102. DWORD dwErr;
  1103. XSINFO* pInfo;
  1104. PBENTRY* pEntry;
  1105. TRACE( "XsInit" );
  1106. // Allocate the dialog context block. Initialize minimally for proper
  1107. // cleanup, then attach to the dialog window.
  1108. //
  1109. {
  1110. pInfo = Malloc( sizeof(*pInfo) );
  1111. if (!pInfo)
  1112. {
  1113. ErrorDlg( hwndDlg, SID_OP_LoadDlg, ERROR_NOT_ENOUGH_MEMORY, NULL );
  1114. EndDialog( hwndDlg, FALSE );
  1115. return TRUE;
  1116. }
  1117. ZeroMemory( pInfo, sizeof(*pInfo) );
  1118. pInfo->pArgs = pArgs;
  1119. pInfo->hwndDlg = hwndDlg;
  1120. SetWindowLongPtr( hwndDlg, DWLP_USER, (ULONG_PTR )pInfo );
  1121. TRACE( "Context set" );
  1122. }
  1123. pInfo->hwndLbNetworks = GetDlgItem( hwndDlg, CID_XS_LB_Networks );
  1124. ASSERT( pInfo->hwndLbNetworks );
  1125. pInfo->hwndEbAddress = GetDlgItem( hwndDlg, CID_XS_EB_Address );
  1126. ASSERT( pInfo->hwndEbAddress );
  1127. pInfo->hwndEbUserData = GetDlgItem( hwndDlg, CID_XS_EB_UserData );
  1128. ASSERT( pInfo->hwndEbUserData );
  1129. pInfo->hwndEbFacilities = GetDlgItem( hwndDlg, CID_XS_EB_Facilities );
  1130. ASSERT( pInfo->hwndEbFacilities );
  1131. XsFillPadsList( pInfo );
  1132. pEntry = pArgs->pEntry;
  1133. Edit_LimitText( pInfo->hwndEbAddress, RAS_MaxX25Address );
  1134. if (pEntry->pszX25Address)
  1135. {
  1136. SetWindowText( pInfo->hwndEbAddress, pEntry->pszX25Address );
  1137. }
  1138. Edit_LimitText( pInfo->hwndEbUserData, RAS_MaxUserData );
  1139. if (pEntry->pszX25UserData)
  1140. {
  1141. SetWindowText( pInfo->hwndEbUserData, pEntry->pszX25UserData );
  1142. }
  1143. Edit_LimitText( pInfo->hwndEbFacilities, RAS_MaxFacilities );
  1144. if (pEntry->pszX25Facilities)
  1145. {
  1146. SetWindowText( pInfo->hwndEbFacilities, pEntry->pszX25Facilities );
  1147. }
  1148. // Center dialog on the owner window.
  1149. //
  1150. CenterWindow( hwndDlg, GetParent( hwndDlg ) );
  1151. // Add context help button to title bar.
  1152. //
  1153. AddContextHelpButton( hwndDlg );
  1154. if (pArgs->fLocalPad)
  1155. {
  1156. // No point in setting focus to "X.25 Network" on local PAD, so set to
  1157. // X.25 Address field instead.
  1158. //
  1159. SetFocus( pInfo->hwndEbAddress );
  1160. Edit_SetSel( pInfo->hwndEbAddress, 0, -1 );
  1161. return FALSE;
  1162. }
  1163. return TRUE;
  1164. }
  1165. BOOL
  1166. XsSave(
  1167. IN XSINFO* pInfo )
  1168. // Load the contents of the dialog into caller's stub API output argument.
  1169. // 'PInfo' is the dialog context.
  1170. //
  1171. // Returns true if succesful, false otherwise.
  1172. //
  1173. {
  1174. INT iPadSelection;
  1175. PBENTRY* pEntry;
  1176. TRACE( "XsSave" );
  1177. pEntry = pInfo->pArgs->pEntry;
  1178. iPadSelection = ComboBox_GetCurSel( pInfo->hwndLbNetworks );
  1179. Free0( pEntry->pszX25Network );
  1180. if (iPadSelection > 0)
  1181. {
  1182. pEntry->pszX25Network = GetText( pInfo->hwndLbNetworks );
  1183. }
  1184. else
  1185. {
  1186. pEntry->pszX25Network = NULL;
  1187. }
  1188. Free0( pEntry->pszX25Address );
  1189. pEntry->pszX25Address = GetText( pInfo->hwndEbAddress );
  1190. Free0( pEntry->pszX25UserData );
  1191. pEntry->pszX25UserData = GetText( pInfo->hwndEbUserData );
  1192. Free0( pEntry->pszX25Facilities );
  1193. pEntry->pszX25Facilities = GetText( pInfo->hwndEbFacilities );
  1194. pEntry->fDirty = TRUE;
  1195. if (!pEntry->pszX25Address
  1196. || !pEntry->pszX25UserData
  1197. || !pEntry->pszX25Facilities)
  1198. {
  1199. Free0( pEntry->pszX25Address );
  1200. Free0( pEntry->pszX25UserData );
  1201. ErrorDlg( pInfo->hwndDlg, SID_OP_RetrievingData,
  1202. ERROR_NOT_ENOUGH_MEMORY, NULL );
  1203. return FALSE;
  1204. }
  1205. return TRUE;
  1206. }
  1207. VOID
  1208. XsTerm(
  1209. IN HWND hwndDlg )
  1210. // Dialog termination. Releases the context block. 'HwndDlg' is the
  1211. // handle of a dialog.
  1212. //
  1213. {
  1214. XSINFO* pInfo;
  1215. TRACE( "XsTerm" );
  1216. pInfo = (XSINFO* )GetWindowLongPtr( hwndDlg, DWLP_USER );
  1217. if (pInfo)
  1218. {
  1219. Free( pInfo );
  1220. TRACE( "Context freed" );
  1221. }
  1222. }