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.

4685 lines
112 KiB

  1. /* Copyright (c) 1995, Microsoft Corporation, all rights reserved
  2. **
  3. ** ifw.c
  4. ** Remote Access Common Dialog APIs
  5. ** Add Interface wizard
  6. **
  7. ** 02/11/97 Abolade Gbadegesin (based on entryw.c, by Steve Cobb).
  8. */
  9. #include "rasdlgp.h"
  10. #include "entry.h"
  11. //
  12. // Definitions for flags tracked by the interface wizard.
  13. // See the dwFlags member of AIINFO.
  14. //
  15. #define AI_F_HasPhysDevs 0x1 // router has phys ports available
  16. #define AI_F_HasTunlDevs 0x2 // router has tunnel ports available
  17. #define AI_F_HasPptpDevs 0x4 // router has Pptp ports available
  18. #define AI_F_HasL2tpDevs 0x8 // router has L2tp ports available
  19. #define AI_F_HasPPPoEDevs 0x10 // router has PPPoE ports available //for whistler bug 345068 349087
  20. /*----------------------------------------------------------------------------
  21. ** Local datatypes (alphabetically)
  22. **----------------------------------------------------------------------------
  23. */
  24. /* Add Interface wizard context block. All property pages refer to the single
  25. ** context block associated with the sheet.
  26. */
  27. #define AIINFO struct tagAIINFO
  28. AIINFO
  29. {
  30. /* Common input arguments.
  31. */
  32. EINFO* pArgs;
  33. /* Wizard and page handles. 'hwndFirstPage' is the handle of the first
  34. ** property page initialized. This is the page that allocates and frees
  35. ** the context block.
  36. */
  37. HWND hwndDlg;
  38. HWND hwndFirstPage;
  39. HWND hwndRb; //Add for DOD wizard 345068 349087
  40. HWND hwndRw;
  41. HWND hwndIn;
  42. HWND hwndSs;
  43. HWND hwndRn;
  44. HWND hwndRp;
  45. HWND hwndRc;
  46. HWND hwndRa;
  47. HWND hwndNs;
  48. HWND hwndDo;
  49. HWND hwndDi;
  50. HWND hwndRf;
  51. HWND hwndVd;
  52. /* Interface Name page.
  53. */
  54. HWND hwndEbInterfaceName;
  55. /* Modem/Adapter page.
  56. */
  57. HWND hwndLv;
  58. /* Connection type page
  59. */
  60. HWND hwndRbTypePhys;
  61. HWND hwndRbTypeTunl;
  62. HWND hwndRbBroadband; //Add for DOD wizard
  63. /* Phone number page.
  64. */
  65. HWND hwndStNumber;
  66. HWND hwndEbNumber; //Share by VpnDestination, PhoneNumber, PPPoE
  67. HWND hwndPbAlternates;
  68. /* Login script page.
  69. */
  70. HWND hwndCbRunScript;
  71. HWND hwndLbScripts;
  72. HWND hwndCbTerminal;
  73. HWND hwndPbEdit;
  74. HWND hwndPbBrowse;
  75. /* IP address page.
  76. */
  77. HWND hwndCcIp;
  78. /* Name server page.
  79. */
  80. HWND hwndCcDns;
  81. HWND hwndCcWins;
  82. /* Vpn type page
  83. */
  84. HWND hwndVtRbAutomatic;
  85. HWND hwndVtRbPptp;
  86. HWND hwndVtRbL2tp;
  87. /* Dial-out credentials page.
  88. */
  89. HWND hwndDoEbUserName;
  90. HWND hwndDoEbDomain;
  91. HWND hwndDoEbPassword;
  92. HWND hwndDoEbConfirm;
  93. /* Dial-in credentials page.
  94. */
  95. HWND hwndDiEbUserName;
  96. HWND hwndDiEbDomain;
  97. HWND hwndDiEbPassword;
  98. HWND hwndDiEbConfirm;
  99. /* Router welcome page
  100. */
  101. HWND hwndRwStWelcome;
  102. /* Router finish page
  103. */
  104. HWND hwndRfStFinish;
  105. /* The phone number stash. This allows user to change the port to another
  106. ** link without losing the phone number he typed. Initialized to empty in
  107. ** AiInit and saved to entry in AiFinish.
  108. */
  109. DTLLIST* pListPhoneNumbers;
  110. BOOL fPromoteHuntNumbers;
  111. /* Checkbox options chosen by user.
  112. */
  113. BOOL fIp;
  114. BOOL fIpx;
  115. BOOL fClearPwOk;
  116. BOOL fNotNt;
  117. /*For connection type page, For whistler bug 349807
  118. */
  119. DWORD dwCtDeviceNum;
  120. /* Set true when there is only one meaningful choice of device.
  121. */
  122. BOOL fSkipMa;
  123. /* Set true if the selected device is a modem or null modem.
  124. */
  125. BOOL fModem;
  126. /* The NP_* mask of protocols configured for RAS.
  127. */
  128. DWORD dwfConfiguredProtocols;
  129. /* Set true if IP is configured for RAS.
  130. */
  131. BOOL fIpConfigured;
  132. //IPX is not supported on IA64
  133. //
  134. BOOL fIpxConfigured;
  135. /* Set to true of Add Interface wizard is skipped.
  136. */
  137. BOOL fSkipWizard;
  138. // After dial scripting helper context block, and a flag indicating if the
  139. // block has been initialized.
  140. //
  141. SUINFO suinfo;
  142. BOOL fSuInfoInitialized;
  143. // Handle to a bold font for use with start and finish wizard pages
  144. HFONT hBoldFont;
  145. // Flags that track the configuration of the machine that the
  146. // wizard is currently focused on. See AI_F_*
  147. DWORD dwFlags;
  148. // Set to the vpn type when one is configured.
  149. DWORD dwVpnStrategy;
  150. // Index of the selected device on the RN page
  151. //
  152. DWORD dwSelectedDeviceIndex;
  153. };
  154. /*----------------------------------------------------------------------------
  155. ** Local prototypes (alphabetically)
  156. **----------------------------------------------------------------------------
  157. */
  158. int CALLBACK
  159. AiCallbackFunc(
  160. IN HWND hwndDlg,
  161. IN UINT unMsg,
  162. IN LPARAM lparam );
  163. VOID
  164. AiCancel(
  165. IN HWND hwndPage );
  166. AIINFO*
  167. AiContext(
  168. IN HWND hwndPage );
  169. VOID
  170. AiExit(
  171. IN AIINFO* pInfo,
  172. IN DWORD dwError );
  173. VOID
  174. AiExitInit(
  175. IN HWND hwndDlg );
  176. BOOL
  177. AiFinish(
  178. IN HWND hwndPage );
  179. AIINFO*
  180. AiInit(
  181. IN HWND hwndFirstPage,
  182. IN EINFO* pArgs );
  183. VOID
  184. AiTerm(
  185. IN HWND hwndPage );
  186. INT_PTR CALLBACK
  187. RbDlgProc(
  188. IN HWND hwnd,
  189. IN UINT unMsg,
  190. IN WPARAM wparam,
  191. IN LPARAM lparam );
  192. BOOL
  193. RbInit(
  194. IN HWND hwndPage );
  195. BOOL
  196. RbKillActive(
  197. IN AIINFO* pInfo );
  198. BOOL
  199. RbSetActive(
  200. IN AIINFO* pInfo );
  201. INT_PTR CALLBACK
  202. CtDlgProc(
  203. IN HWND hwnd,
  204. IN UINT unMsg,
  205. IN WPARAM wparam,
  206. IN LPARAM lparam );
  207. BOOL
  208. CtInit(
  209. IN HWND hwndPage );
  210. BOOL
  211. CtKillActive(
  212. IN AIINFO* pInfo );
  213. BOOL
  214. CtSetActive(
  215. IN AIINFO* pInfo );
  216. INT_PTR CALLBACK
  217. DiDlgProc(
  218. IN HWND hwnd,
  219. IN UINT unMsg,
  220. IN WPARAM wparam,
  221. IN LPARAM lparam );
  222. BOOL
  223. DiInit(
  224. IN HWND hwndPage );
  225. BOOL
  226. DiKillActive(
  227. IN AIINFO* pInfo );
  228. BOOL
  229. DiNext(
  230. IN AIINFO* pInfo );
  231. BOOL
  232. DiSetActive(
  233. IN AIINFO* pInfo );
  234. INT_PTR CALLBACK
  235. DoDlgProc(
  236. IN HWND hwnd,
  237. IN UINT unMsg,
  238. IN WPARAM wparam,
  239. IN LPARAM lparam );
  240. BOOL
  241. DoInit(
  242. IN HWND hwndPage );
  243. BOOL
  244. DoKillActive(
  245. IN AIINFO* pInfo );
  246. BOOL
  247. DoNext(
  248. IN AIINFO* pInfo );
  249. BOOL
  250. DoSetActive(
  251. IN AIINFO* pInfo );
  252. BOOL
  253. InCommand(
  254. IN AIINFO* pInfo,
  255. IN WORD wNotification,
  256. IN WORD wId,
  257. IN HWND hwndCtrl );
  258. INT_PTR CALLBACK
  259. InDlgProc(
  260. IN HWND hwnd,
  261. IN UINT unMsg,
  262. IN WPARAM wparam,
  263. IN LPARAM lparam );
  264. BOOL
  265. InInit(
  266. IN HWND hwndPage);
  267. BOOL
  268. InKillActive(
  269. IN AIINFO* pInfo );
  270. BOOL
  271. InSetActive(
  272. IN AIINFO* pInfo );
  273. INT_PTR CALLBACK
  274. NsDlgProc(
  275. IN HWND hwnd,
  276. IN UINT unMsg,
  277. IN WPARAM wparam,
  278. IN LPARAM lparam );
  279. BOOL
  280. NsInit(
  281. IN HWND hwndPage );
  282. BOOL
  283. NsKillActive(
  284. IN AIINFO* pInfo );
  285. BOOL
  286. NsSetActive(
  287. IN AIINFO* pInfo );
  288. INT_PTR CALLBACK
  289. RaDlgProc(
  290. IN HWND hwnd,
  291. IN UINT unMsg,
  292. IN WPARAM wparam,
  293. IN LPARAM lparam );
  294. BOOL
  295. RaInit(
  296. IN HWND hwndPage );
  297. BOOL
  298. RaKillActive(
  299. IN AIINFO* pInfo );
  300. BOOL
  301. RaSetActive(
  302. IN AIINFO* pInfo );
  303. BOOL
  304. RcCommand(
  305. IN AIINFO* pInfo,
  306. IN WORD wNotification,
  307. IN WORD wId,
  308. IN HWND hwndCtrl );
  309. INT_PTR CALLBACK
  310. RcDlgProc(
  311. IN HWND hwnd,
  312. IN UINT unMsg,
  313. IN WPARAM wparam,
  314. IN LPARAM lparam );
  315. BOOL
  316. RcInit(
  317. IN HWND hwndPage );
  318. BOOL
  319. RcKillActive(
  320. IN AIINFO* pInfo );
  321. BOOL
  322. RcSetActive(
  323. IN AIINFO* pInfo );
  324. BOOL
  325. RfCommand(
  326. IN AIINFO* pInfo,
  327. IN WORD wNotification,
  328. IN WORD wId,
  329. IN HWND hwndCtrl );
  330. INT_PTR CALLBACK
  331. RfDlgProc(
  332. IN HWND hwnd,
  333. IN UINT unMsg,
  334. IN WPARAM wparam,
  335. IN LPARAM lparam );
  336. BOOL
  337. RfInit(
  338. IN HWND hwndPage );
  339. BOOL
  340. RfKillActive(
  341. IN AIINFO* pInfo );
  342. BOOL
  343. RfSetActive(
  344. IN AIINFO* pInfo );
  345. INT_PTR CALLBACK
  346. RnDlgProc(
  347. IN HWND hwnd,
  348. IN UINT unMsg,
  349. IN WPARAM wparam,
  350. IN LPARAM lparam );
  351. BOOL
  352. RnInit(
  353. IN HWND hwndPage );
  354. LVXDRAWINFO*
  355. RnLvCallback(
  356. IN HWND hwndLv,
  357. IN DWORD dwItem );
  358. VOID
  359. RnLvItemChanged(
  360. IN AIINFO* pInfo );
  361. BOOL
  362. RnLvRefresh(
  363. IN AIINFO* pInfo);
  364. BOOL
  365. RnSetActive(
  366. IN AIINFO* pInfo );
  367. VOID
  368. RpAlternates(
  369. IN AIINFO* pInfo );
  370. BOOL
  371. RpCommand(
  372. IN AIINFO* pInfo,
  373. IN WORD wNotification,
  374. IN WORD wId,
  375. IN HWND hwndCtrl );
  376. INT_PTR CALLBACK
  377. RpDlgProc(
  378. IN HWND hwnd,
  379. IN UINT unMsg,
  380. IN WPARAM wparam,
  381. IN LPARAM lparam );
  382. BOOL
  383. RpInit(
  384. IN HWND hwndPage );
  385. BOOL
  386. RpKillActive(
  387. IN AIINFO* pInfo );
  388. VOID
  389. RpPhoneNumberToStash(
  390. IN AIINFO* pInfo );
  391. BOOL
  392. RpSetActive(
  393. IN AIINFO* pInfo );
  394. INT_PTR CALLBACK
  395. RwDlgProc(
  396. IN HWND hwnd,
  397. IN UINT unMsg,
  398. IN WPARAM wparam,
  399. IN LPARAM lparam );
  400. BOOL
  401. RwInit(
  402. IN HWND hwndPage,
  403. IN OUT EINFO* pArgs );
  404. BOOL
  405. RwKillActive(
  406. IN AIINFO* pInfo );
  407. BOOL
  408. RwSetActive(
  409. IN AIINFO* pInfo );
  410. BOOL
  411. SsCommand(
  412. IN AIINFO* pInfo,
  413. IN WORD wNotification,
  414. IN WORD wId,
  415. IN HWND hwndCtrl );
  416. INT_PTR CALLBACK
  417. SsDlgProc(
  418. IN HWND hwnd,
  419. IN UINT unMsg,
  420. IN WPARAM wparam,
  421. IN LPARAM lparam );
  422. BOOL
  423. SsInit(
  424. IN HWND hwndPage );
  425. BOOL
  426. SsKillActive(
  427. IN AIINFO* pInfo );
  428. BOOL
  429. SsSetActive(
  430. IN AIINFO* pInfo );
  431. INT_PTR CALLBACK
  432. VdDlgProc(
  433. IN HWND hwnd,
  434. IN UINT unMsg,
  435. IN WPARAM wparam,
  436. IN LPARAM lparam );
  437. BOOL
  438. VdInit(
  439. IN HWND hwndPage );
  440. BOOL
  441. VdKillActive(
  442. IN AIINFO* pInfo );
  443. BOOL
  444. VdSetActive(
  445. IN AIINFO* pInfo );
  446. INT_PTR CALLBACK
  447. VtDlgProc(
  448. IN HWND hwnd,
  449. IN UINT unMsg,
  450. IN WPARAM wparam,
  451. IN LPARAM lparam );
  452. BOOL
  453. VtInit(
  454. IN HWND hwndPage );
  455. BOOL
  456. VtKillActive(
  457. IN AIINFO* pInfo );
  458. BOOL
  459. VtSetActive(
  460. IN AIINFO* pInfo );
  461. /* Demand dial wizard page definitions.
  462. */
  463. struct DD_WIZ_PAGE_INFO
  464. {
  465. DLGPROC pfnDlgProc;
  466. INT nPageId;
  467. INT nSidTitle;
  468. INT nSidSubtitle;
  469. DWORD dwFlags;
  470. };
  471. static const struct DD_WIZ_PAGE_INFO c_aDdWizInfo [] =
  472. {
  473. { RwDlgProc, PID_RW_RouterWelcome, 0, 0, PSP_HIDEHEADER},
  474. { InDlgProc, PID_IN_InterfaceName, SID_IN_Title, SID_IN_Subtitle, 0},
  475. { CtDlgProc, PID_CT_RouterConnectionType, SID_CT_Title, SID_CT_Subtitle, 0},
  476. { VtDlgProc, PID_VT_RouterVpnType, SID_VT_Title, SID_VT_Subtitle, 0},
  477. { RnDlgProc, PID_RN_RouterModemAdapter, SID_RN_Title, SID_RN_Subtitle, 0},
  478. { RbDlgProc, PID_BS_BroadbandService, SID_BS_Title, SID_BS_Subtitle, 0},
  479. { RpDlgProc, PID_RP_RouterPhoneNumber, SID_RP_Title, SID_RP_Subtitle, 0},
  480. { VdDlgProc, PID_VD_RouterVpnDestination, SID_VD_Title, SID_VD_Subtitle, 0},
  481. { SsDlgProc, PID_SS_ServerSettings, SID_SS_Title, SID_SS_Subtitle, 0},
  482. { RaDlgProc, PID_RA_RouterIpAddress, SID_RA_Title, SID_RA_Subtitle, 0},
  483. { NsDlgProc, PID_NS_RouterNameServers, SID_NS_Title, SID_NS_Subtitle, 0},
  484. { RcDlgProc, PID_RC_RouterScripting, SID_RC_Title, SID_RC_Subtitle, 0},
  485. { DiDlgProc, PID_DI_RouterDialIn, SID_DI_Title, SID_DI_Subtitle, 0},
  486. { DoDlgProc, PID_DO_RouterDialOut, SID_DO_Title, SID_DO_Subtitle, 0},
  487. { RfDlgProc, PID_RF_RouterFinish, 0, 0, PSP_HIDEHEADER},
  488. };
  489. #define c_cDdWizPages (sizeof (c_aDdWizInfo) / sizeof(c_aDdWizInfo[0]))
  490. /*----------------------------------------------------------------------------
  491. ** Add Interface wizard entry point
  492. **----------------------------------------------------------------------------
  493. */
  494. VOID
  495. AiWizard(
  496. IN OUT EINFO* pEinfo )
  497. /* Runs the Phonebook entry property sheet. 'PEinfo' is an input block
  498. ** with only caller's API arguments filled in.
  499. */
  500. {
  501. DWORD dwErr, i;
  502. PROPSHEETHEADER header;
  503. PROPSHEETPAGE apage[ c_cDdWizPages ];
  504. PROPSHEETPAGE* ppage;
  505. TRACE("AiWizard");
  506. ZeroMemory( &header, sizeof(header) );
  507. // Prepare the header
  508. //
  509. header.dwSize = sizeof(PROPSHEETHEADER);
  510. header.hwndParent = pEinfo->pApiArgs->hwndOwner;
  511. header.hInstance = g_hinstDll;
  512. header.nPages = c_cDdWizPages;
  513. header.pszbmHeader = MAKEINTRESOURCE( BID_WizardHeader );
  514. header.ppsp = apage;
  515. header.pfnCallback = AiCallbackFunc;
  516. header.dwFlags =
  517. (
  518. PSH_WIZARD | PSH_WIZARD97 |
  519. PSH_WATERMARK | PSH_HEADER |
  520. PSH_STRETCHWATERMARK | PSH_USECALLBACK |
  521. PSH_PROPSHEETPAGE
  522. );
  523. // Prepare the array of pages
  524. //
  525. ZeroMemory( apage, sizeof(apage) );
  526. for (i = 0; i < c_cDdWizPages; i++)
  527. {
  528. // Initialize page data
  529. //
  530. ppage = &apage[i];
  531. ppage->dwSize = sizeof(PROPSHEETPAGE);
  532. ppage->hInstance = g_hinstDll;
  533. ppage->pszTemplate = MAKEINTRESOURCE(c_aDdWizInfo[i].nPageId);
  534. ppage->pfnDlgProc = c_aDdWizInfo[i].pfnDlgProc;
  535. ppage->lParam = (LPARAM )pEinfo;
  536. ppage->dwFlags = c_aDdWizInfo[i].dwFlags;
  537. // Initialize title and subtitle information.
  538. //
  539. if (c_aDdWizInfo[i].nSidTitle)
  540. {
  541. ppage->dwFlags |= PSP_USEHEADERTITLE;
  542. ppage->pszHeaderTitle = PszLoadString( g_hinstDll,
  543. c_aDdWizInfo[i].nSidTitle );
  544. }
  545. if (c_aDdWizInfo[i].nSidSubtitle)
  546. {
  547. ppage->dwFlags |= PSP_USEHEADERSUBTITLE;
  548. ppage->pszHeaderSubTitle = PszLoadString( g_hinstDll,
  549. c_aDdWizInfo[i].nSidSubtitle );
  550. }
  551. }
  552. if (PropertySheet( &header ) == -1)
  553. {
  554. TRACE("PropertySheet failed");
  555. ErrorDlg( pEinfo->pApiArgs->hwndOwner, SID_OP_LoadDlg, ERROR_UNKNOWN,
  556. NULL );
  557. }
  558. }
  559. /*----------------------------------------------------------------------------
  560. ** Add Interface wizard
  561. ** Listed alphabetically
  562. **----------------------------------------------------------------------------
  563. */
  564. int CALLBACK
  565. AiCallbackFunc(
  566. IN HWND hwndDlg,
  567. IN UINT unMsg,
  568. IN LPARAM lparam )
  569. /* A standard Win32 commctrl PropSheetProc. See MSDN documentation.
  570. **
  571. ** Returns 0 always.
  572. */
  573. {
  574. TRACE2("AiCallbackFunc(m=%d,l=%08x)",unMsg,lparam);
  575. if (unMsg == PSCB_PRECREATE)
  576. {
  577. DLGTEMPLATE* pDlg = (DLGTEMPLATE* )lparam;
  578. pDlg->style &= ~(DS_CONTEXTHELP);
  579. }
  580. return 0;
  581. }
  582. VOID
  583. AiCancel(
  584. IN HWND hwndPage )
  585. /* Cancel was pressed. 'HwndPage' is the handle of a wizard page.
  586. */
  587. {
  588. TRACE("AiCancel");
  589. }
  590. AIINFO*
  591. AiContext(
  592. IN HWND hwndPage )
  593. /* Retrieve the property sheet context from a wizard page handle.
  594. */
  595. {
  596. return (AIINFO* )GetProp( GetParent( hwndPage ), g_contextId );
  597. }
  598. VOID
  599. AiExit(
  600. IN AIINFO* pInfo,
  601. IN DWORD dwError )
  602. /* Forces an exit from the dialog, reporting 'dwError' to the caller.
  603. ** 'PInfo' is the dialog context.
  604. **
  605. ** Note: This cannot be called during initialization of the first page.
  606. ** See AiExitInit.
  607. */
  608. {
  609. TRACE("AiExit");
  610. pInfo->pArgs->pApiArgs->dwError = dwError;
  611. PropSheet_PressButton( pInfo->hwndDlg, PSBTN_CANCEL );
  612. }
  613. VOID
  614. AiExitInit(
  615. IN HWND hwndDlg )
  616. /* Utility to report errors within AiInit and other first page
  617. ** initialization. 'HwndDlg' is the dialog window.
  618. */
  619. {
  620. SetOffDesktop( hwndDlg, SOD_MoveOff, NULL );
  621. SetOffDesktop( hwndDlg, SOD_Free, NULL );
  622. PostMessage( hwndDlg, WM_COMMAND,
  623. MAKEWPARAM( IDCANCEL , BN_CLICKED ),
  624. (LPARAM )GetDlgItem( hwndDlg, IDCANCEL ) );
  625. }
  626. BOOL
  627. AiFinish(
  628. IN HWND hwndPage )
  629. /* Saves the contents of the wizard. 'HwndPage is the handle of a
  630. ** property page. Pops up any errors that occur. 'FPropertySheet'
  631. ** indicates the user chose to edit the property sheet directly.
  632. **
  633. ** Returns true is page can be dismissed, false otherwise.
  634. */
  635. {
  636. const TCHAR* pszIp0 = TEXT("0.0.0.0");
  637. AIINFO* pInfo;
  638. PBENTRY* pEntry;
  639. TRACE("AiFinish");
  640. pInfo = AiContext( hwndPage );
  641. ASSERT(pInfo);
  642. if (pInfo == NULL)
  643. {
  644. return ERROR_CAN_NOT_COMPLETE;
  645. }
  646. pEntry = pInfo->pArgs->pEntry;
  647. ASSERT(pEntry);
  648. // Update the entry type to match the selected port(s), which are assumed
  649. // to have been moved to the head of the list. This does not happen
  650. // automatically because "all types" is used initially.
  651. //
  652. {
  653. DTLNODE* pNode;
  654. PBLINK* pLink;
  655. pNode = DtlGetFirstNode( pEntry->pdtllistLinks );
  656. ASSERT( pNode );
  657. pLink = (PBLINK* )DtlGetData( pNode );
  658. ChangeEntryType( pEntry, pLink->pbport.dwType );
  659. }
  660. // Replace phone number settings of all enabled links (or the shared link,
  661. // if applicable) from the stashed phone number list.
  662. //
  663. {
  664. DTLLIST* pList;
  665. DTLNODE* pNodeL;
  666. PBLINK* pLink;
  667. ASSERT( pInfo->pListPhoneNumbers );
  668. if (pEntry->fSharedPhoneNumbers)
  669. {
  670. pLink = (PBLINK* )DtlGetData( pInfo->pArgs->pSharedNode );
  671. ASSERT( pLink );
  672. CopyPszListToPhoneList( pLink, pInfo->pListPhoneNumbers );
  673. }
  674. else
  675. {
  676. for (pNodeL = DtlGetFirstNode( pEntry->pdtllistLinks );
  677. pNodeL;
  678. pNodeL = DtlGetNextNode( pNodeL ))
  679. {
  680. pLink = (PBLINK* )DtlGetData( pNodeL );
  681. ASSERT( pLink );
  682. if (pLink->fEnabled)
  683. {
  684. CopyPszListToPhoneList( pLink, pInfo->pListPhoneNumbers );
  685. }
  686. }
  687. }
  688. }
  689. /* Update some settings based on user selections.
  690. */
  691. if (pInfo->fClearPwOk)
  692. {
  693. pEntry->dwTypicalAuth = TA_Unsecure;
  694. }
  695. else
  696. {
  697. pEntry->dwTypicalAuth = TA_Secure;
  698. }
  699. pEntry->dwAuthRestrictions =
  700. AuthRestrictionsFromTypicalAuth(pEntry->dwTypicalAuth);
  701. if ( !pInfo->fSkipWizard
  702. && !pInfo->fIp)
  703. pEntry->dwfExcludedProtocols |= NP_Ip;
  704. if ( !pInfo->fSkipWizard
  705. && !pInfo->fIpx)
  706. pEntry->dwfExcludedProtocols |= NP_Ipx;
  707. if (pEntry->pszIpAddress
  708. && lstrcmp( pEntry->pszIpAddress, pszIp0 ) != 0)
  709. {
  710. pEntry->dwIpAddressSource = ASRC_RequireSpecific;
  711. }
  712. if ((pEntry->pszIpDnsAddress
  713. && lstrcmp( pEntry->pszIpDnsAddress, pszIp0 ) != 0)
  714. || (pEntry->pszIpWinsAddress
  715. && lstrcmp( pEntry->pszIpWinsAddress, pszIp0 ) != 0))
  716. {
  717. pEntry->dwIpNameSource = ASRC_RequireSpecific;
  718. }
  719. if ( pEntry->dwType == RASET_Vpn )
  720. {
  721. pEntry->dwVpnStrategy = pInfo->dwVpnStrategy;
  722. }
  723. // pmay: 234964
  724. // Default the idle disconnect to five minutes
  725. //
  726. pEntry->lIdleDisconnectSeconds = 5 * 60;
  727. // pmay: 389632
  728. //
  729. // Default DD connections to not register their names (CreateEntryNode
  730. // defaults this value to primary+inform)
  731. //
  732. pEntry->dwIpDnsFlags = 0;
  733. // Whistler bug:
  734. //
  735. // By default, DD connections should share file+print, nor be msclient,
  736. // nor permit NBT over tcp.
  737. //
  738. pEntry->fShareMsFilePrint = FALSE;
  739. pEntry->fBindMsNetClient = FALSE;
  740. EnableOrDisableNetComponent( pEntry, TEXT("ms_server"), FALSE);
  741. EnableOrDisableNetComponent( pEntry, TEXT("ms_msclient"), FALSE);
  742. pEntry->dwIpNbtFlags = 0;
  743. /* It's a valid new entry and caller has not chosen to edit properties
  744. ** directly, so mark the entry for commitment.
  745. */
  746. if (!pInfo->pArgs->fChainPropertySheet)
  747. pInfo->pArgs->fCommit = TRUE;
  748. return TRUE;
  749. }
  750. AIINFO*
  751. AiInit(
  752. IN HWND hwndFirstPage,
  753. IN EINFO* pArgs )
  754. /* Wizard level initialization. 'HwndPage' is the handle of the first
  755. ** page. 'PArgs' is the common entry input argument block.
  756. **
  757. ** Returns address of the context block if successful, NULL otherwise. If
  758. ** NULL is returned, an appropriate message has been displayed, and the
  759. ** wizard has been cancelled.
  760. */
  761. {
  762. DWORD dwErr;
  763. DWORD dwOp;
  764. AIINFO* pInfo;
  765. HWND hwndDlg;
  766. BOOL bNt4;
  767. TRACE("AiInit");
  768. hwndDlg = GetParent( hwndFirstPage );
  769. /* Allocate the context information block. Initialize it enough so that
  770. ** it can be destroyed properly, and associate the context with the
  771. ** window.
  772. */
  773. {
  774. pInfo = Malloc( sizeof(*pInfo) );
  775. if (!pInfo)
  776. {
  777. TRACE("Context NOT allocated");
  778. ErrorDlg( hwndDlg, SID_OP_LoadDlg, ERROR_NOT_ENOUGH_MEMORY, NULL );
  779. pArgs->pApiArgs->dwError = ERROR_NOT_ENOUGH_MEMORY;
  780. AiExitInit( hwndDlg );
  781. return NULL;
  782. }
  783. ZeroMemory( pInfo, sizeof(AIINFO) );
  784. pInfo->pArgs = pArgs;
  785. pInfo->hwndDlg = hwndDlg;
  786. pInfo->hwndFirstPage = hwndFirstPage;
  787. if (!SetProp( hwndDlg, g_contextId, pInfo ))
  788. {
  789. TRACE("Context NOT set");
  790. ErrorDlg( hwndDlg, SID_OP_LoadDlg, ERROR_UNKNOWN, NULL );
  791. pArgs->pApiArgs->dwError = ERROR_UNKNOWN;
  792. Free( pInfo );
  793. AiExitInit( hwndDlg );
  794. return NULL;
  795. }
  796. TRACE("Context set");
  797. }
  798. /* Position the dialog per caller's instructions.
  799. */
  800. PositionDlg( hwndDlg,
  801. pArgs->pApiArgs->dwFlags & RASDDFLAG_PositionDlg,
  802. pArgs->pApiArgs->xDlg, pArgs->pApiArgs->yDlg );
  803. // Do here instead of LibMain because otherwise it leaks resources into
  804. // WinLogon according to ShaunCo.
  805. //
  806. {
  807. InitCommonControls();
  808. IpAddrInit( g_hinstDll, SID_PopupTitle, SID_BadIpAddrRange );
  809. }
  810. /* Initialize these meta-flags that are not actually stored.
  811. */
  812. pInfo->fNotNt = FALSE;
  813. pInfo->fSkipMa = FALSE;
  814. pInfo->fModem = FALSE;
  815. pInfo->pArgs->fPadSelected = FALSE;
  816. {
  817. INTERNALARGS *pIArgs = (INTERNALARGS *) pArgs->pApiArgs->reserved;
  818. pInfo->dwfConfiguredProtocols =
  819. g_pGetInstalledProtocolsEx(
  820. (pIArgs) ? pIArgs->hConnection : NULL,
  821. TRUE, FALSE, TRUE);
  822. }
  823. pInfo->fIpConfigured = (pInfo->dwfConfiguredProtocols & NP_Ip);
  824. //for whistler bug 213901
  825. //
  826. #ifndef _WIN64
  827. pInfo->fIpxConfigured = (pInfo->dwfConfiguredProtocols & NP_Ipx);
  828. #else
  829. pInfo->fIpxConfigured = FALSE;
  830. #endif
  831. // Set up common phone number list storage.
  832. //
  833. {
  834. pInfo->pListPhoneNumbers = DtlCreateList( 0 );
  835. if (!pInfo->pListPhoneNumbers)
  836. {
  837. ErrorDlg( hwndDlg, SID_OP_LoadDlg, ERROR_NOT_ENOUGH_MEMORY, NULL );
  838. pArgs->pApiArgs->dwError = ERROR_NOT_ENOUGH_MEMORY;
  839. AiExitInit( hwndDlg );
  840. return NULL;
  841. }
  842. }
  843. // Load links for all port types.
  844. //
  845. EuChangeEntryType( pArgs, (DWORD )-1 );
  846. // Convert the PBPHONE phone list for the first link to a TAPI-disabled
  847. // PSZ stash list of phone numbers. The stash list is edited rather than
  848. // the list in the entry so user can change active links without losing
  849. // the phone number he entered.
  850. //
  851. {
  852. DTLNODE* pNode;
  853. PBLINK* pLink;
  854. ASSERT( pInfo->pListPhoneNumbers );
  855. pNode = DtlGetFirstNode( pArgs->pEntry->pdtllistLinks );
  856. ASSERT( pNode );
  857. pLink = (PBLINK* )DtlGetData( pNode );
  858. ASSERT( pLink );
  859. for (pNode = DtlGetFirstNode( pLink->pdtllistPhones );
  860. pNode;
  861. pNode = DtlGetNextNode( pNode ))
  862. {
  863. PBPHONE* pPhone;
  864. DTLNODE* pNodeP;
  865. pPhone = (PBPHONE* )DtlGetData( pNode );
  866. ASSERT( pPhone );
  867. pNodeP = CreatePszNode( pPhone->pszPhoneNumber );
  868. if (pNodeP)
  869. {
  870. DtlAddNodeLast( pInfo->pListPhoneNumbers, pNodeP );
  871. }
  872. }
  873. }
  874. // Get the bold font for the start and finish pages
  875. //
  876. GetBoldWindowFont(hwndFirstPage, TRUE, &(pInfo->hBoldFont));
  877. // Initlialize the flags for this wizard based on the
  878. // ports loaded in.
  879. //
  880. {
  881. DTLNODE* pNode;
  882. PBLINK* pLink;
  883. for (pNode = DtlGetFirstNode( pArgs->pEntry->pdtllistLinks );
  884. pNode;
  885. pNode = DtlGetNextNode( pNode ))
  886. {
  887. pLink = (PBLINK* )DtlGetData( pNode );
  888. ASSERT( pLink );
  889. if ( pLink->pbport.dwType == RASET_Vpn )
  890. {
  891. pInfo->dwFlags |= AI_F_HasTunlDevs;
  892. }
  893. // pmay: 233287
  894. // Do not count bogus devices as physical devices.
  895. //
  896. else if (! (pLink->pbport.dwFlags & PBP_F_BogusDevice))
  897. {
  898. pInfo->dwFlags |= AI_F_HasPhysDevs;
  899. }
  900. if ( pLink->pbport.dwFlags & PBP_F_PptpDevice )
  901. {
  902. pInfo->dwFlags |= AI_F_HasPptpDevs;
  903. }
  904. else if ( pLink->pbport.dwFlags & PBP_F_L2tpDevice )
  905. {
  906. pInfo->dwFlags |= AI_F_HasL2tpDevs;
  907. }
  908. //For whistler bug 345068 349087
  909. //
  910. if ( pLink->pbport.dwFlags & PBP_F_PPPoEDevice )
  911. {
  912. pInfo->dwFlags |= AI_F_HasPPPoEDevs;
  913. }
  914. }
  915. }
  916. return pInfo;
  917. }
  918. VOID
  919. AiTerm(
  920. IN HWND hwndPage )
  921. /* Wizard level termination. Releases the context block. 'HwndPage' is
  922. ** the handle of a property page.
  923. */
  924. {
  925. AIINFO* pInfo;
  926. TRACE("AiTerm");
  927. pInfo = AiContext( hwndPage );
  928. if (pInfo)
  929. {
  930. if (pInfo->hBoldFont)
  931. {
  932. DeleteObject(pInfo->hBoldFont);
  933. }
  934. if (pInfo->pListPhoneNumbers)
  935. {
  936. DtlDestroyList( pInfo->pListPhoneNumbers, DestroyPszNode );
  937. }
  938. if (pInfo->fSuInfoInitialized)
  939. {
  940. SuFree( &pInfo->suinfo );
  941. }
  942. Free( pInfo );
  943. TRACE("Context freed");
  944. }
  945. RemoveProp( GetParent( hwndPage ), g_contextId );
  946. }
  947. // Add Broadband service name page for router wizard
  948. // For whistler 345068 349087 gangz
  949. // This broadband serice page is shared by AiWizard(ifw.c) and AeWizard(in entryw.c)
  950. //
  951. /*----------------------------------------------------------------------------
  952. ** Broadband service dialog procedure
  953. ** Listed alphabetically following dialog proc
  954. **----------------------------------------------------------------------------
  955. */
  956. INT_PTR CALLBACK
  957. RbDlgProc(
  958. IN HWND hwnd,
  959. IN UINT unMsg,
  960. IN WPARAM wparam,
  961. IN LPARAM lparam )
  962. // DialogProc callback for the broadband service page of the wizard.
  963. // Parameters and return value are as described for
  964. // standard windows 'DialogProc's.
  965. //
  966. {
  967. switch (unMsg)
  968. {
  969. case WM_INITDIALOG:
  970. return RbInit( hwnd );
  971. case WM_NOTIFY:
  972. {
  973. switch (((NMHDR* )lparam)->code)
  974. {
  975. case PSN_SETACTIVE:
  976. {
  977. AIINFO* pInfo;
  978. BOOL fDisplay;
  979. TRACE("RbSetActive");
  980. pInfo = AiContext( hwnd );
  981. ASSERT(pInfo);
  982. if ( NULL == pInfo )
  983. {
  984. break;
  985. }
  986. fDisplay = RbSetActive( pInfo );
  987. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  988. return TRUE;
  989. }
  990. case PSN_KILLACTIVE:
  991. {
  992. AIINFO* pInfo;
  993. BOOL fInvalid;
  994. TRACE("RbKillActive");
  995. pInfo = AiContext( hwnd );
  996. ASSERT(pInfo);
  997. if ( NULL == pInfo )
  998. {
  999. break;
  1000. }
  1001. fInvalid = RbKillActive( pInfo );
  1002. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  1003. return TRUE;
  1004. }
  1005. }
  1006. break;
  1007. }
  1008. }
  1009. return FALSE;
  1010. }
  1011. BOOL
  1012. RbInit(
  1013. IN HWND hwndPage )
  1014. // Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  1015. // page.
  1016. //
  1017. // Return false if focus was set, true otherwise.
  1018. //
  1019. {
  1020. AIINFO* pInfo;
  1021. TRACE("RbInit");
  1022. pInfo = AiContext( hwndPage );
  1023. if (!pInfo)
  1024. {
  1025. return TRUE;
  1026. }
  1027. // Initialize page-specific context information.
  1028. //
  1029. pInfo->hwndRb = hwndPage;
  1030. pInfo->hwndEbNumber =
  1031. GetDlgItem( hwndPage, CID_BS_EB_ServiceName );
  1032. ASSERT(pInfo->hwndEbNumber);
  1033. Edit_LimitText( pInfo->hwndEbNumber, RAS_MaxPhoneNumber );
  1034. SetWindowText( pInfo->hwndEbNumber,
  1035. FirstPszFromList( pInfo->pListPhoneNumbers ) );
  1036. return FALSE;
  1037. }
  1038. //For whistler bug 349807
  1039. //The RbXXX, VdXXX, RpXXX three sets of functions share the same pInfo->hwndEbNumber
  1040. //to store phone number/Vpn destionation/PPPPoE service name
  1041. //
  1042. BOOL
  1043. RbKillActive(
  1044. IN AIINFO* pInfo )
  1045. // Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  1046. //
  1047. // Returns true if the page is invalid, false is it can be dismissed.
  1048. //
  1049. {
  1050. // If we're focused on an nt4 box, then this page is
  1051. // invalid (pptp was the only type)
  1052. if ( pInfo->pArgs->fNt4Router )
  1053. {
  1054. return FALSE;
  1055. }
  1056. // If we have no PPPoE devices, then this page is invalid
  1057. else if ( ! (pInfo->dwFlags & AI_F_HasPPPoEDevs) )
  1058. {
  1059. return FALSE;
  1060. }
  1061. // If the connection type is not broadband, skip this page since the
  1062. // destination will be gotten from the phone number/VPN page.
  1063. if ( pInfo->pArgs->pEntry->dwType != RASET_Broadband )
  1064. {
  1065. return FALSE;
  1066. }
  1067. RpPhoneNumberToStash(pInfo);
  1068. return FALSE;
  1069. }
  1070. BOOL
  1071. RbSetActive(
  1072. IN AIINFO* pInfo )
  1073. // Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  1074. //
  1075. // Returns true to display the page, false to skip it.
  1076. //
  1077. {
  1078. BOOL fDisplayPage;
  1079. PBENTRY* pEntry;
  1080. TRACE("RbSetActive");
  1081. ASSERT(pInfo);
  1082. pEntry = pInfo->pArgs->pEntry;
  1083. if ( pInfo->pArgs->fNt4Router )
  1084. {
  1085. return FALSE;
  1086. }
  1087. // If we have no PPPoE devices, then this page is invalid
  1088. //
  1089. if ( ! (pInfo->dwFlags & AI_F_HasPPPoEDevs) )
  1090. {
  1091. return FALSE;
  1092. }
  1093. if (RASET_Broadband != pEntry->dwType)
  1094. {
  1095. return FALSE;
  1096. }
  1097. else
  1098. {
  1099. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  1100. fDisplayPage = TRUE;
  1101. }
  1102. pInfo->hwndEbNumber =
  1103. GetDlgItem( pInfo->hwndRb, CID_BS_EB_ServiceName );
  1104. ASSERT(pInfo->hwndEbNumber);
  1105. Edit_LimitText( pInfo->hwndEbNumber, RAS_MaxPhoneNumber );
  1106. SetWindowText( pInfo->hwndEbNumber,
  1107. FirstPszFromList( pInfo->pListPhoneNumbers ) );
  1108. return fDisplayPage;
  1109. }
  1110. /*----------------------------------------------------------------------------
  1111. ** Connection type property page
  1112. ** Listed alphabetically following dialog proc
  1113. **----------------------------------------------------------------------------
  1114. */
  1115. INT_PTR CALLBACK
  1116. CtDlgProc(
  1117. IN HWND hwnd,
  1118. IN UINT unMsg,
  1119. IN WPARAM wparam,
  1120. IN LPARAM lparam )
  1121. /* DialogProc callback for the vpn type page of the wizard.
  1122. ** Parameters and return value are as described for standard windows
  1123. ** 'DialogProc's.
  1124. */
  1125. {
  1126. switch (unMsg)
  1127. {
  1128. case WM_INITDIALOG:
  1129. return CtInit( hwnd );
  1130. case WM_NOTIFY:
  1131. {
  1132. switch (((NMHDR* )lparam)->code)
  1133. {
  1134. case PSN_SETACTIVE:
  1135. {
  1136. AIINFO* pInfo;
  1137. BOOL fDisplay;
  1138. TRACE("CtSETACTIVE");
  1139. pInfo = AiContext( hwnd );
  1140. ASSERT(pInfo);
  1141. if (pInfo == NULL)
  1142. {
  1143. break;
  1144. }
  1145. fDisplay = CtSetActive( pInfo );
  1146. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  1147. return TRUE;
  1148. }
  1149. case PSN_KILLACTIVE:
  1150. {
  1151. AIINFO* pInfo;
  1152. BOOL fInvalid;
  1153. TRACE("CtKILLACTIVE");
  1154. pInfo = AiContext( hwnd );
  1155. ASSERT(pInfo);
  1156. if (pInfo == NULL)
  1157. {
  1158. break;
  1159. }
  1160. fInvalid = CtKillActive( pInfo );
  1161. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  1162. return TRUE;
  1163. }
  1164. }
  1165. break;
  1166. }
  1167. }
  1168. return FALSE;
  1169. }
  1170. BOOL
  1171. CtInit(
  1172. IN HWND hwndPage )
  1173. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  1174. ** page.
  1175. **
  1176. ** Return false if focus was set, true otherwise.
  1177. */
  1178. {
  1179. AIINFO * pInfo;
  1180. // Get the context
  1181. pInfo = AiContext( hwndPage );
  1182. ASSERT ( pInfo );
  1183. if (pInfo == NULL)
  1184. {
  1185. return FALSE;
  1186. }
  1187. // Initialize the checks
  1188. pInfo->hwndRbTypePhys = GetDlgItem( hwndPage, CID_CT_RB_Physical );
  1189. ASSERT(pInfo->hwndRbTypePhys);
  1190. pInfo->hwndRbTypeTunl = GetDlgItem( hwndPage, CID_CT_RB_Virtual );
  1191. ASSERT(pInfo->hwndRbTypeTunl);
  1192. //for whistler 345068 349087 gangz
  1193. //
  1194. pInfo->hwndRbBroadband = GetDlgItem( hwndPage, CID_CT_RB_Broadband );
  1195. ASSERT(pInfo->hwndRbBroadband);
  1196. // pmay: 233287
  1197. //for whistler 345068 349087 gangz
  1198. // Likewise, if there are only one devices available among
  1199. // phys devices, tunel devices and broadband devices , then force the
  1200. // user to configure dd interface with that device.
  1201. //
  1202. //If no valid device availabe, stop the wizard
  1203. //
  1204. pInfo->dwCtDeviceNum = 0;
  1205. if (pInfo->dwFlags & AI_F_HasTunlDevs)
  1206. {
  1207. pInfo->dwCtDeviceNum++;
  1208. }
  1209. if (pInfo->dwFlags & AI_F_HasPhysDevs)
  1210. {
  1211. pInfo->dwCtDeviceNum++;
  1212. }
  1213. if (pInfo->dwFlags & AI_F_HasPPPoEDevs)
  1214. {
  1215. pInfo->dwCtDeviceNum++;
  1216. }
  1217. if ( 0 == pInfo->dwCtDeviceNum )
  1218. {
  1219. ErrorDlg( pInfo->hwndDlg, SID_NoDevices, ERROR_UNKNOWN, NULL);
  1220. AiExit ( pInfo, ERROR_DEVICE_NOT_AVAILABLE );
  1221. return TRUE;
  1222. }
  1223. if ( 1 == pInfo->dwCtDeviceNum )
  1224. {
  1225. if (pInfo->dwFlags & AI_F_HasPhysDevs)
  1226. {
  1227. EuChangeEntryType(
  1228. pInfo->pArgs,
  1229. RASET_P_NonVpnTypes);
  1230. }
  1231. else if (pInfo->dwFlags & AI_F_HasTunlDevs)
  1232. {
  1233. EuChangeEntryType(
  1234. pInfo->pArgs,
  1235. RASET_Vpn);
  1236. }
  1237. else if (pInfo->dwFlags & AI_F_HasPPPoEDevs)
  1238. {
  1239. EuChangeEntryType(
  1240. pInfo->pArgs,
  1241. RASET_Broadband);
  1242. }
  1243. else
  1244. {
  1245. ErrorDlg( pInfo->hwndDlg, SID_NoDevices, ERROR_UNKNOWN, NULL);
  1246. AiExit ( pInfo, ERROR_DEVICE_NOT_AVAILABLE );
  1247. return TRUE;
  1248. }
  1249. }
  1250. //Set radio buttons
  1251. //
  1252. Button_SetCheck(pInfo->hwndRbTypePhys, FALSE);
  1253. Button_SetCheck(pInfo->hwndRbTypeTunl, FALSE);
  1254. Button_SetCheck(pInfo->hwndRbBroadband, FALSE);
  1255. if (pInfo->dwFlags & AI_F_HasPhysDevs)
  1256. {
  1257. Button_SetCheck(pInfo->hwndRbTypePhys, TRUE);
  1258. }
  1259. else if(pInfo->dwFlags & AI_F_HasTunlDevs)
  1260. {
  1261. Button_SetCheck(pInfo->hwndRbTypeTunl, TRUE);
  1262. }
  1263. else
  1264. {
  1265. Button_SetCheck(pInfo->hwndRbBroadband, TRUE);
  1266. }
  1267. //Enable/Disable buttons
  1268. //
  1269. if ( !(pInfo->dwFlags & AI_F_HasPhysDevs) )
  1270. {
  1271. EnableWindow(pInfo->hwndRbTypePhys, FALSE);
  1272. }
  1273. if ( !(pInfo->dwFlags & AI_F_HasTunlDevs) )
  1274. {
  1275. EnableWindow(pInfo->hwndRbTypeTunl, FALSE);
  1276. }
  1277. if ( !(pInfo->dwFlags & AI_F_HasPPPoEDevs) )
  1278. {
  1279. EnableWindow(pInfo->hwndRbBroadband, FALSE);
  1280. }
  1281. return FALSE;
  1282. }
  1283. BOOL
  1284. CtKillActive(
  1285. IN AIINFO* pInfo )
  1286. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  1287. **
  1288. ** Returns true if the page is invalid, false is it can be dismissed.
  1289. */
  1290. {
  1291. BOOL bPhys, bTunnel;
  1292. // Change the entry type based on the type
  1293. // selected from this page
  1294. //For whistler 345068 349087 gangz
  1295. //
  1296. bPhys = Button_GetCheck( pInfo->hwndRbTypePhys );
  1297. bTunnel = Button_GetCheck( pInfo->hwndRbTypeTunl );
  1298. if(bPhys)
  1299. {
  1300. EuChangeEntryType(
  1301. pInfo->pArgs,
  1302. RASET_P_NonVpnTypes);
  1303. }
  1304. else if(bTunnel)
  1305. {
  1306. EuChangeEntryType(
  1307. pInfo->pArgs,
  1308. RASET_Vpn);
  1309. }
  1310. else
  1311. {
  1312. EuChangeEntryType(
  1313. pInfo->pArgs,
  1314. RASET_Broadband);
  1315. }
  1316. return FALSE;
  1317. }
  1318. BOOL
  1319. CtSetActive(
  1320. IN AIINFO* pInfo )
  1321. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  1322. **
  1323. ** Returns true to display the page, false to skip it.
  1324. */
  1325. {
  1326. // If we're focused on an nt4 box, then this page is
  1327. // invalid (type of connection is inferred from the
  1328. // device that gets selected.)
  1329. if ( pInfo->pArgs->fNt4Router )
  1330. {
  1331. return FALSE;
  1332. }
  1333. // Only allow this page to display if there are at least two of
  1334. // physical, tunnel and broadband devices configured. Otherwise,
  1335. // it makes no sense to allow the user to choose which
  1336. // type he/she wants.
  1337. if ( 2 <= pInfo->dwCtDeviceNum )
  1338. {
  1339. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  1340. return TRUE;
  1341. }
  1342. return FALSE;
  1343. }
  1344. /*----------------------------------------------------------------------------
  1345. ** Dial-In Credentials property page
  1346. ** Listed alphabetically following dialog proc
  1347. **----------------------------------------------------------------------------
  1348. */
  1349. INT_PTR CALLBACK
  1350. DiDlgProc(
  1351. IN HWND hwnd,
  1352. IN UINT unMsg,
  1353. IN WPARAM wparam,
  1354. IN LPARAM lparam )
  1355. /* DialogProc callback for the Dial-in Credentials page of the wizard.
  1356. ** Parameters and return values are as described for standard windows
  1357. ** 'DialogProc's.
  1358. */
  1359. {
  1360. switch (unMsg)
  1361. {
  1362. case WM_INITDIALOG:
  1363. {
  1364. return
  1365. DiInit( hwnd );
  1366. }
  1367. case WM_NOTIFY:
  1368. {
  1369. switch (((NMHDR* )lparam)->code)
  1370. {
  1371. case PSN_SETACTIVE:
  1372. {
  1373. AIINFO* pInfo;
  1374. BOOL fDisplay;
  1375. TRACE("DiSETACTIVE");
  1376. pInfo = AiContext( hwnd );
  1377. ASSERT(pInfo);
  1378. if (pInfo == NULL)
  1379. {
  1380. break;
  1381. }
  1382. fDisplay = DiSetActive( pInfo );
  1383. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  1384. return TRUE;
  1385. }
  1386. case PSN_KILLACTIVE:
  1387. {
  1388. AIINFO* pInfo;
  1389. BOOL fInvalid;
  1390. TRACE("DiKILLACTIVE");
  1391. pInfo = AiContext( hwnd );
  1392. ASSERT(pInfo);
  1393. if (pInfo == NULL)
  1394. {
  1395. break;
  1396. }
  1397. fInvalid = DiKillActive( pInfo );
  1398. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  1399. return TRUE;
  1400. }
  1401. case PSN_WIZNEXT:
  1402. {
  1403. AIINFO* pInfo;
  1404. BOOL fInvalid;
  1405. TRACE("DoNEXT");
  1406. pInfo = AiContext( hwnd );
  1407. ASSERT(pInfo);
  1408. if (pInfo == NULL)
  1409. {
  1410. break;
  1411. }
  1412. fInvalid = DiNext( pInfo );
  1413. SetWindowLong( hwnd, DWLP_MSGRESULT, (fInvalid) ? -1 : 0 );
  1414. return TRUE;
  1415. }
  1416. }
  1417. break;
  1418. }
  1419. }
  1420. return FALSE;
  1421. }
  1422. BOOL
  1423. DiInit(
  1424. IN HWND hwndPage )
  1425. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  1426. ** page. 'PArgs' is the arguments from the PropertySheet caller.
  1427. **
  1428. ** Return false if focus was set, true otherwise.
  1429. */
  1430. {
  1431. AIINFO* pInfo;
  1432. TRACE("DiInit");
  1433. pInfo = AiContext( hwndPage );
  1434. if (!pInfo)
  1435. return TRUE;
  1436. /* Initialize page-specific context information.
  1437. */
  1438. pInfo->hwndDi = hwndPage;
  1439. pInfo->hwndDiEbUserName = GetDlgItem( hwndPage, CID_DI_EB_UserName );
  1440. Edit_LimitText( pInfo->hwndDiEbUserName, UNLEN );
  1441. pInfo->hwndDiEbPassword = GetDlgItem( hwndPage, CID_DI_EB_Password );
  1442. Edit_LimitText( pInfo->hwndDiEbPassword, PWLEN );
  1443. pInfo->hwndDiEbConfirm = GetDlgItem( hwndPage, CID_DI_EB_Confirm );
  1444. Edit_LimitText( pInfo->hwndDiEbConfirm, PWLEN );
  1445. // pmay: 222622: Since we only configure local users, we removed
  1446. // the domain field from the dial in credentials page.
  1447. return FALSE;
  1448. }
  1449. BOOL
  1450. DiKillActive(
  1451. IN AIINFO* pInfo )
  1452. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  1453. **
  1454. ** Returns true if the page is invalid, false is it can be dismissed.
  1455. */
  1456. {
  1457. return FALSE;
  1458. }
  1459. BOOL
  1460. DiNext(
  1461. IN AIINFO* pInfo )
  1462. /* Called when PSN_WIZNEXT is received. 'PInfo' is the wizard context.
  1463. **
  1464. ** Returns true if the page is invalid, false is it can be dismissed.
  1465. */
  1466. {
  1467. TCHAR* psz;
  1468. /* Whistler bug 254385 encode password when not being used
  1469. */
  1470. psz = GetText(pInfo->hwndDiEbPassword);
  1471. EncodePassword(psz);
  1472. if (psz)
  1473. {
  1474. TCHAR* psz2;
  1475. psz2 = GetText(pInfo->hwndDiEbConfirm);
  1476. if(NULL != psz2)
  1477. {
  1478. /* Whistler bug 254385 encode password when not being used
  1479. */
  1480. DecodePassword(psz);
  1481. if (lstrcmp(psz, psz2))
  1482. {
  1483. ZeroMemory(psz, (lstrlen(psz) + 1) * sizeof(TCHAR));
  1484. ZeroMemory(psz2, (lstrlen(psz2) + 1) * sizeof(TCHAR));
  1485. Free(psz);
  1486. Free(psz2);
  1487. MsgDlg(pInfo->hwndDlg, SID_PasswordMismatch, NULL);
  1488. SetFocus(pInfo->hwndDiEbPassword);
  1489. return TRUE;
  1490. }
  1491. EncodePassword(psz);
  1492. ZeroMemory(psz2, (lstrlen(psz2) + 1) * sizeof(TCHAR));
  1493. Free(psz2);
  1494. }
  1495. /* Whistler bug 254385 encode password when not being used
  1496. ** Whistler bug 275526 NetVBL BVT Break: Routing BVT broken
  1497. */
  1498. if (pInfo->pArgs->pszRouterDialInPassword)
  1499. {
  1500. ZeroMemory(
  1501. pInfo->pArgs->pszRouterDialInPassword,
  1502. (lstrlen(pInfo->pArgs->pszRouterDialInPassword) + 1) *
  1503. sizeof(TCHAR));
  1504. }
  1505. Free0(pInfo->pArgs->pszRouterDialInPassword);
  1506. pInfo->pArgs->pszRouterDialInPassword = psz;
  1507. }
  1508. return FALSE;
  1509. }
  1510. BOOL
  1511. DiSetActive(
  1512. IN AIINFO* pInfo )
  1513. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  1514. **
  1515. ** Returns true to display the page, false to skip it.
  1516. */
  1517. {
  1518. /* The dialog is only displayed if the user is adding a dial-in account.
  1519. */
  1520. if (!pInfo->pArgs->fAddUser)
  1521. return FALSE;
  1522. /* Display the interface name in the disabled edit-box
  1523. */
  1524. SetWindowText(
  1525. pInfo->hwndDiEbUserName, pInfo->pArgs->pEntry->pszEntryName );
  1526. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  1527. return TRUE;
  1528. }
  1529. /*----------------------------------------------------------------------------
  1530. ** Dial-Out Credentials property page
  1531. ** Listed alphabetically following dialog proc
  1532. **----------------------------------------------------------------------------
  1533. */
  1534. INT_PTR CALLBACK
  1535. DoDlgProc(
  1536. IN HWND hwnd,
  1537. IN UINT unMsg,
  1538. IN WPARAM wparam,
  1539. IN LPARAM lparam )
  1540. /* DialogProc callback for the Dial-Out Credentials page of the wizard.
  1541. ** Parameters and return values are as described for standard windows
  1542. ** 'DialogProc's.
  1543. */
  1544. {
  1545. switch (unMsg)
  1546. {
  1547. case WM_INITDIALOG:
  1548. {
  1549. return
  1550. DoInit( hwnd );
  1551. }
  1552. case WM_NOTIFY:
  1553. {
  1554. switch (((NMHDR* )lparam)->code)
  1555. {
  1556. case PSN_SETACTIVE:
  1557. {
  1558. AIINFO* pInfo;
  1559. BOOL fDisplay;
  1560. TRACE("DoSETACTIVE");
  1561. pInfo = AiContext( hwnd );
  1562. ASSERT(pInfo);
  1563. if (pInfo == NULL)
  1564. {
  1565. break;
  1566. }
  1567. fDisplay = DoSetActive( pInfo );
  1568. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  1569. return TRUE;
  1570. }
  1571. case PSN_KILLACTIVE:
  1572. {
  1573. AIINFO* pInfo;
  1574. BOOL fInvalid;
  1575. TRACE("DoKILLACTIVE");
  1576. pInfo = AiContext( hwnd );
  1577. ASSERT(pInfo);
  1578. if (pInfo == NULL)
  1579. {
  1580. break;
  1581. }
  1582. fInvalid = DoKillActive( pInfo );
  1583. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  1584. return TRUE;
  1585. }
  1586. case PSN_WIZNEXT:
  1587. {
  1588. AIINFO* pInfo;
  1589. BOOL fInvalid;
  1590. TRACE("DoNEXT");
  1591. pInfo = AiContext( hwnd );
  1592. ASSERT(pInfo);
  1593. if (pInfo == NULL)
  1594. {
  1595. break;
  1596. }
  1597. fInvalid = DoNext( pInfo );
  1598. SetWindowLong( hwnd, DWLP_MSGRESULT, (fInvalid) ? -1 : 0 );
  1599. return TRUE;
  1600. }
  1601. }
  1602. break;
  1603. }
  1604. }
  1605. return FALSE;
  1606. }
  1607. BOOL
  1608. DoInit(
  1609. IN HWND hwndPage )
  1610. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  1611. ** page. 'PArgs' is the arguments from the PropertySheet caller.
  1612. **
  1613. ** Return false if focus was set, true otherwise.
  1614. */
  1615. {
  1616. AIINFO* pInfo;
  1617. TRACE("DoInit");
  1618. pInfo = AiContext( hwndPage );
  1619. if (!pInfo)
  1620. return TRUE;
  1621. /* Initialize page-specific context information.
  1622. */
  1623. pInfo->hwndDo = hwndPage;
  1624. pInfo->hwndDoEbUserName = GetDlgItem( hwndPage, CID_DO_EB_UserName );
  1625. Edit_LimitText( pInfo->hwndDoEbUserName, UNLEN );
  1626. pInfo->hwndDoEbDomain = GetDlgItem( hwndPage, CID_DO_EB_Domain );
  1627. Edit_LimitText( pInfo->hwndDoEbDomain, DNLEN );
  1628. pInfo->hwndDoEbPassword = GetDlgItem( hwndPage, CID_DO_EB_Password );
  1629. Edit_LimitText( pInfo->hwndDoEbPassword, PWLEN );
  1630. pInfo->hwndDoEbConfirm = GetDlgItem( hwndPage, CID_DO_EB_Confirm );
  1631. Edit_LimitText( pInfo->hwndDoEbConfirm, PWLEN );
  1632. /* Use the target router name as the default "User name",
  1633. */
  1634. if (pInfo->pArgs->pszRouter)
  1635. {
  1636. if (pInfo->pArgs->pszRouter[0] == TEXT('\\') &&
  1637. pInfo->pArgs->pszRouter[1] == TEXT('\\'))
  1638. SetWindowText(pInfo->hwndDoEbUserName, pInfo->pArgs->pszRouter+2);
  1639. else
  1640. SetWindowText(pInfo->hwndDoEbUserName, pInfo->pArgs->pszRouter);
  1641. }
  1642. return FALSE;
  1643. }
  1644. BOOL
  1645. DoKillActive(
  1646. IN AIINFO* pInfo )
  1647. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  1648. **
  1649. ** Returns true if the page is invalid, false is it can be dismissed.
  1650. */
  1651. {
  1652. return FALSE;
  1653. }
  1654. BOOL
  1655. DoNext(
  1656. IN AIINFO* pInfo )
  1657. /* Called when PSN_WIZNEXT is received. 'PInfo' is the wizard context.
  1658. **
  1659. ** Returns true if the page is invalid, false is it can be dismissed.
  1660. */
  1661. {
  1662. TCHAR* psz;
  1663. psz = GetText(pInfo->hwndDoEbUserName);
  1664. if (psz)
  1665. {
  1666. if (!lstrlen(psz))
  1667. {
  1668. Free(psz);
  1669. MsgDlg(pInfo->hwndDlg, SID_DialOutUserName, NULL);
  1670. SetFocus(pInfo->hwndDoEbUserName);
  1671. return TRUE;
  1672. }
  1673. Free0(pInfo->pArgs->pszRouterUserName);
  1674. pInfo->pArgs->pszRouterUserName = psz;
  1675. }
  1676. psz = GetText(pInfo->hwndDoEbDomain);
  1677. if (psz)
  1678. {
  1679. Free0(pInfo->pArgs->pszRouterDomain);
  1680. pInfo->pArgs->pszRouterDomain = psz;
  1681. }
  1682. /* Whistler bug 254385 encode password when not being used
  1683. */
  1684. psz = GetText(pInfo->hwndDoEbPassword);
  1685. EncodePassword(psz);
  1686. if (psz)
  1687. {
  1688. TCHAR* psz2;
  1689. psz2 = GetText(pInfo->hwndDoEbConfirm);
  1690. if(NULL != psz2)
  1691. {
  1692. /* Whistler bug 254385 encode password when not being used
  1693. */
  1694. DecodePassword(psz);
  1695. if (lstrcmp(psz, psz2))
  1696. {
  1697. ZeroMemory(psz, (lstrlen(psz) + 1) * sizeof(TCHAR));
  1698. ZeroMemory(psz2, (lstrlen(psz2) + 1) * sizeof(TCHAR));
  1699. Free(psz);
  1700. Free(psz2);
  1701. MsgDlg(pInfo->hwndDlg, SID_PasswordMismatch, NULL);
  1702. SetFocus(pInfo->hwndDoEbPassword);
  1703. return TRUE;
  1704. }
  1705. EncodePassword(psz);
  1706. ZeroMemory(psz2, (lstrlen(psz2) + 1) * sizeof(TCHAR));
  1707. Free(psz2);
  1708. }
  1709. /* Whistler bug 254385 encode password when not being used
  1710. ** Whistler bug 275526 NetVBL BVT Break: Routing BVT broken
  1711. */
  1712. if (pInfo->pArgs->pszRouterPassword)
  1713. {
  1714. ZeroMemory(
  1715. pInfo->pArgs->pszRouterPassword,
  1716. (lstrlen(pInfo->pArgs->pszRouterPassword) + 1) * sizeof(TCHAR));
  1717. }
  1718. Free0(pInfo->pArgs->pszRouterPassword);
  1719. pInfo->pArgs->pszRouterPassword = psz;
  1720. }
  1721. return FALSE;
  1722. }
  1723. BOOL
  1724. DoSetActive(
  1725. IN AIINFO* pInfo )
  1726. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  1727. **
  1728. ** Returns true to display the page, false to skip it.
  1729. */
  1730. {
  1731. #if 0
  1732. TCHAR* psz;
  1733. /* Fill in the interface name in the explanatory text.
  1734. */
  1735. psz = PszFromId( g_hinstDll, SID_RouterDialOut );
  1736. if (psz)
  1737. {
  1738. MSGARGS msgargs;
  1739. ZeroMemory( &msgargs, sizeof(msgargs) );
  1740. msgargs.apszArgs[ 0 ] = pInfo->pArgs->pEntry->pszEntryName;
  1741. msgargs.fStringOutput = TRUE;
  1742. msgargs.pszString = psz;
  1743. MsgDlgUtil( NULL, 0, &msgargs, g_hinstDll, 0 );
  1744. if (msgargs.pszOutput)
  1745. {
  1746. SetDlgItemText( pInfo->hwndDo, CID_DO_ST_Explain,
  1747. msgargs.pszOutput );
  1748. Free( msgargs.pszOutput );
  1749. }
  1750. Free( psz );
  1751. }
  1752. #endif
  1753. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  1754. return TRUE;
  1755. }
  1756. /*----------------------------------------------------------------------------
  1757. ** Interface Name property page
  1758. ** Listed alphabetically following dialog proc
  1759. **----------------------------------------------------------------------------
  1760. */
  1761. INT_PTR CALLBACK
  1762. InDlgProc(
  1763. IN HWND hwnd,
  1764. IN UINT unMsg,
  1765. IN WPARAM wparam,
  1766. IN LPARAM lparam )
  1767. /* DialogProc callback for the Interface Name page of the wizard.
  1768. ** Parameters and return values are as described for standard windows
  1769. ** 'DialogProc's.
  1770. */
  1771. {
  1772. switch (unMsg)
  1773. {
  1774. case WM_INITDIALOG:
  1775. {
  1776. return
  1777. InInit( hwnd );
  1778. }
  1779. case WM_NOTIFY:
  1780. {
  1781. switch (((NMHDR* )lparam)->code)
  1782. {
  1783. case PSN_RESET:
  1784. {
  1785. TRACE("InRESET");
  1786. AiCancel( hwnd );
  1787. SetWindowLong( hwnd, DWLP_MSGRESULT, FALSE );
  1788. return TRUE;
  1789. }
  1790. case PSN_SETACTIVE:
  1791. {
  1792. AIINFO* pInfo;
  1793. BOOL fDisplay;
  1794. TRACE("InSETACTIVE");
  1795. pInfo = AiContext( hwnd );
  1796. ASSERT(pInfo);
  1797. if (pInfo == NULL)
  1798. {
  1799. break;
  1800. }
  1801. fDisplay = InSetActive( pInfo );
  1802. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  1803. return TRUE;
  1804. }
  1805. case PSN_KILLACTIVE:
  1806. {
  1807. AIINFO* pInfo;
  1808. BOOL fInvalid;
  1809. TRACE("InKILLACTIVE");
  1810. pInfo = AiContext( hwnd );
  1811. ASSERT(pInfo);
  1812. if (pInfo == NULL)
  1813. {
  1814. break;
  1815. }
  1816. fInvalid = InKillActive( pInfo );
  1817. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  1818. return TRUE;
  1819. }
  1820. case PSN_WIZFINISH:
  1821. {
  1822. AIINFO* pInfo;
  1823. TRACE("InWIZFINISH");
  1824. pInfo = AiContext( hwnd );
  1825. ASSERT(pInfo);
  1826. if (pInfo == NULL)
  1827. {
  1828. break;
  1829. }
  1830. /* You'd think pressing Finish would trigger a KILLACTIVE
  1831. ** event, but it doesn't, so we do it ourselves.
  1832. */
  1833. InKillActive( pInfo );
  1834. /* Set "no wizard" user preference, per user's check.
  1835. */
  1836. pInfo->pArgs->pUser->fNewEntryWizard = FALSE;
  1837. pInfo->pArgs->pUser->fDirty = TRUE;
  1838. g_pSetUserPreferences(
  1839. NULL,
  1840. pInfo->pArgs->pUser,
  1841. pInfo->pArgs->fNoUser ? UPM_Logon : UPM_Normal );
  1842. pInfo->pArgs->fPadSelected = FALSE;
  1843. pInfo->pArgs->fChainPropertySheet = TRUE;
  1844. AiFinish( hwnd );
  1845. SetWindowLong( hwnd, DWLP_MSGRESULT, 0 );
  1846. return TRUE;
  1847. }
  1848. }
  1849. break;
  1850. }
  1851. case WM_COMMAND:
  1852. {
  1853. AIINFO* pInfo = AiContext( hwnd );
  1854. ASSERT(pInfo);
  1855. if (pInfo == NULL)
  1856. {
  1857. break;
  1858. }
  1859. return InCommand(
  1860. pInfo, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  1861. }
  1862. case WM_DESTROY:
  1863. {
  1864. AiTerm( hwnd );
  1865. break;
  1866. }
  1867. }
  1868. return FALSE;
  1869. }
  1870. BOOL
  1871. InCommand(
  1872. IN AIINFO* pInfo,
  1873. IN WORD wNotification,
  1874. IN WORD wId,
  1875. IN HWND hwndCtrl )
  1876. /* Called on WM_COMMAND. 'PInfo' is the dialog context. 'WNotification'
  1877. ** is the notification code of the command. 'wId' is the control/menu
  1878. ** identifier of the command. 'HwndCtrl' is the control window handle of
  1879. ** the command.
  1880. **
  1881. ** Returns true if processed message, false otherwise.
  1882. */
  1883. {
  1884. //TRACE3("InCommand(n=%d,i=%d,c=$%x)",
  1885. // (DWORD)wNotification,(DWORD)wId,(ULONG_PTR )hwndCtrl);
  1886. return FALSE;
  1887. }
  1888. BOOL
  1889. InInit(
  1890. IN HWND hwndPage)
  1891. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  1892. ** page. 'PArgs' is the arguments from the PropertySheet caller.
  1893. **
  1894. ** Return false if focus was set, true otherwise.
  1895. */
  1896. {
  1897. DWORD dwErr;
  1898. AIINFO* pInfo;
  1899. PBENTRY* pEntry;
  1900. TRACE("InInit");
  1901. // Get the context of this page
  1902. pInfo = AiContext( hwndPage );
  1903. ASSERT ( pInfo );
  1904. if (pInfo == NULL)
  1905. {
  1906. return FALSE;
  1907. }
  1908. // Set up the interface name stuff
  1909. //
  1910. pInfo->hwndEbInterfaceName =
  1911. GetDlgItem( hwndPage, CID_IN_EB_InterfaceName );
  1912. ASSERT(pInfo->hwndEbInterfaceName);
  1913. pEntry = pInfo->pArgs->pEntry;
  1914. if (!pEntry->pszEntryName)
  1915. {
  1916. /* No entry name, so think up a default.
  1917. */
  1918. dwErr = GetDefaultEntryName(
  1919. pInfo->pArgs->pFile,
  1920. pEntry->dwType,
  1921. pInfo->pArgs->fRouter,
  1922. &pEntry->pszEntryName );
  1923. if (dwErr != 0)
  1924. {
  1925. ErrorDlg( pInfo->hwndDlg, SID_OP_LoadPage, dwErr, NULL );
  1926. AiExit( pInfo, dwErr );
  1927. return TRUE;
  1928. }
  1929. }
  1930. Edit_LimitText( pInfo->hwndEbInterfaceName, RAS_MaxEntryName );
  1931. SetWindowText( pInfo->hwndEbInterfaceName, pEntry->pszEntryName );
  1932. /* Initialize page-specific context information.
  1933. */
  1934. pInfo->hwndIn = hwndPage;
  1935. return TRUE;
  1936. }
  1937. BOOL
  1938. InKillActive(
  1939. IN AIINFO* pInfo )
  1940. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  1941. **
  1942. ** Returns true if the page is invalid, false is it can be dismissed.
  1943. */
  1944. {
  1945. TCHAR* psz;
  1946. psz = GetText( pInfo->hwndEbInterfaceName );
  1947. if (psz)
  1948. {
  1949. /* Update the entry name from the editbox.
  1950. */
  1951. Free0( pInfo->pArgs->pEntry->pszEntryName );
  1952. pInfo->pArgs->pEntry->pszEntryName = psz;
  1953. /* Validate the entry name.
  1954. */
  1955. if (!EuValidateName( pInfo->hwndDlg, pInfo->pArgs ))
  1956. {
  1957. SetFocus( pInfo->hwndEbInterfaceName );
  1958. Edit_SetSel( pInfo->hwndEbInterfaceName, 0, -1 );
  1959. return TRUE;
  1960. }
  1961. }
  1962. return FALSE;
  1963. }
  1964. BOOL
  1965. InSetActive(
  1966. IN AIINFO* pInfo )
  1967. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  1968. **
  1969. ** Returns true to display the page, false to skip it.
  1970. */
  1971. {
  1972. TCHAR* psz;
  1973. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_NEXT );
  1974. return TRUE;
  1975. }
  1976. /*----------------------------------------------------------------------------
  1977. ** Name Servers property page
  1978. ** Listed alphabetically following dialog proc
  1979. **----------------------------------------------------------------------------
  1980. */
  1981. INT_PTR CALLBACK
  1982. NsDlgProc(
  1983. IN HWND hwnd,
  1984. IN UINT unMsg,
  1985. IN WPARAM wparam,
  1986. IN LPARAM lparam )
  1987. /* DialogProc callback for the Name Servers page of the wizard.
  1988. ** Parameters and return values are as described for standard windows
  1989. ** 'DialogProc's.
  1990. */
  1991. {
  1992. switch (unMsg)
  1993. {
  1994. case WM_INITDIALOG:
  1995. {
  1996. return
  1997. NsInit( hwnd );
  1998. }
  1999. case WM_NOTIFY:
  2000. {
  2001. switch (((NMHDR* )lparam)->code)
  2002. {
  2003. case PSN_SETACTIVE:
  2004. {
  2005. AIINFO* pInfo;
  2006. BOOL fDisplay;
  2007. TRACE("NsSETACTIVE");
  2008. pInfo = AiContext( hwnd );
  2009. ASSERT(pInfo);
  2010. if (pInfo == NULL)
  2011. {
  2012. break;
  2013. }
  2014. fDisplay = NsSetActive( pInfo );
  2015. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  2016. return TRUE;
  2017. }
  2018. case PSN_KILLACTIVE:
  2019. {
  2020. AIINFO* pInfo;
  2021. BOOL fInvalid;
  2022. TRACE("NsKILLACTIVE");
  2023. pInfo = AiContext( hwnd );
  2024. ASSERT(pInfo);
  2025. if (pInfo == NULL)
  2026. {
  2027. break;
  2028. }
  2029. fInvalid = NsKillActive( pInfo );
  2030. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  2031. return TRUE;
  2032. }
  2033. }
  2034. break;
  2035. }
  2036. }
  2037. return FALSE;
  2038. }
  2039. BOOL
  2040. NsInit(
  2041. IN HWND hwndPage )
  2042. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  2043. ** page. 'PArgs' is the arguments from the PropertySheet caller.
  2044. **
  2045. ** Return false if focus was set, true otherwise.
  2046. */
  2047. {
  2048. AIINFO* pInfo;
  2049. TRACE("NsInit");
  2050. pInfo = AiContext( hwndPage );
  2051. if (!pInfo)
  2052. return TRUE;
  2053. /* Initialize page-specific context information.
  2054. */
  2055. pInfo->hwndNs = hwndPage;
  2056. pInfo->hwndCcDns = GetDlgItem( hwndPage, CID_NS_CC_Dns );
  2057. ASSERT(pInfo->hwndCcDns);
  2058. pInfo->hwndCcWins = GetDlgItem( hwndPage, CID_NS_CC_Wins );
  2059. ASSERT(pInfo->hwndCcWins);
  2060. /* Set the IP address fields.
  2061. */
  2062. SetWindowText( pInfo->hwndCcDns, pInfo->pArgs->pEntry->pszIpDnsAddress );
  2063. SetWindowText( pInfo->hwndCcWins, pInfo->pArgs->pEntry->pszIpWinsAddress );
  2064. return FALSE;
  2065. }
  2066. BOOL
  2067. NsKillActive(
  2068. IN AIINFO* pInfo )
  2069. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  2070. **
  2071. ** Returns true if the page is invalid, false is it can be dismissed.
  2072. */
  2073. {
  2074. TCHAR* psz;
  2075. PBENTRY* pEntry = pInfo->pArgs->pEntry;
  2076. psz = GetText( pInfo->hwndCcDns );
  2077. if (psz)
  2078. {
  2079. Free0( pEntry->pszIpDnsAddress );
  2080. pEntry->pszIpDnsAddress = psz;
  2081. }
  2082. psz = GetText( pInfo->hwndCcWins );
  2083. if (psz)
  2084. {
  2085. Free0( pEntry->pszIpWinsAddress );
  2086. pEntry->pszIpWinsAddress = psz;
  2087. }
  2088. return FALSE;
  2089. }
  2090. BOOL
  2091. NsSetActive(
  2092. IN AIINFO* pInfo )
  2093. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  2094. **
  2095. ** Returns true to display the page, false to skip it.
  2096. */
  2097. {
  2098. PBENTRY* pEntry;
  2099. pEntry = pInfo->pArgs->pEntry;
  2100. // In NT5, we always skip this page
  2101. return FALSE;
  2102. if (!pInfo->fNotNt || !pInfo->fIpConfigured)
  2103. {
  2104. return FALSE;
  2105. }
  2106. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  2107. return TRUE;
  2108. }
  2109. /*----------------------------------------------------------------------------
  2110. ** IP Address property page
  2111. ** Listed alphabetically following dialog proc
  2112. **----------------------------------------------------------------------------
  2113. */
  2114. INT_PTR CALLBACK
  2115. RaDlgProc(
  2116. IN HWND hwnd,
  2117. IN UINT unMsg,
  2118. IN WPARAM wparam,
  2119. IN LPARAM lparam )
  2120. /* DialogProc callback for the IP Address page of the wizard. Parameters
  2121. ** and return value are as described for standard windows 'DialogProc's.
  2122. */
  2123. {
  2124. #if 0
  2125. TRACE4("RaDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  2126. (DWORD)hwnd,(DWORD)unMsg,(DWORD)wparam,(DWORD)lparam);
  2127. #endif
  2128. switch (unMsg)
  2129. {
  2130. case WM_INITDIALOG:
  2131. return RaInit( hwnd );
  2132. case WM_NOTIFY:
  2133. {
  2134. switch (((NMHDR* )lparam)->code)
  2135. {
  2136. case PSN_SETACTIVE:
  2137. {
  2138. AIINFO* pInfo;
  2139. BOOL fDisplay;
  2140. TRACE("RaSETACTIVE");
  2141. pInfo = AiContext( hwnd );
  2142. ASSERT(pInfo);
  2143. if (pInfo == NULL)
  2144. {
  2145. break;
  2146. }
  2147. fDisplay = RaSetActive( pInfo );
  2148. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  2149. return TRUE;
  2150. }
  2151. case PSN_KILLACTIVE:
  2152. {
  2153. AIINFO* pInfo;
  2154. BOOL fInvalid;
  2155. TRACE("RaKILLACTIVE");
  2156. pInfo = AiContext( hwnd );
  2157. ASSERT(pInfo);
  2158. if (pInfo == NULL)
  2159. {
  2160. break;
  2161. }
  2162. fInvalid = RaKillActive( pInfo );
  2163. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  2164. return TRUE;
  2165. }
  2166. }
  2167. break;
  2168. }
  2169. }
  2170. return FALSE;
  2171. }
  2172. BOOL
  2173. RaInit(
  2174. IN HWND hwndPage )
  2175. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  2176. ** page.
  2177. **
  2178. ** Return false if focus was set, true otherwise.
  2179. */
  2180. {
  2181. AIINFO* pInfo;
  2182. TRACE("RaInit");
  2183. pInfo = AiContext( hwndPage );
  2184. if (!pInfo)
  2185. return TRUE;
  2186. /* Initialize page-specific context information.
  2187. */
  2188. pInfo->hwndRa = hwndPage;
  2189. pInfo->hwndCcIp = GetDlgItem( hwndPage, CID_RA_CC_Ip );
  2190. ASSERT(pInfo->hwndCcIp);
  2191. /* Set the IP address field to '0.0.0.0'.
  2192. */
  2193. SetWindowText( pInfo->hwndCcIp, pInfo->pArgs->pEntry->pszIpAddress );
  2194. return FALSE;
  2195. }
  2196. BOOL
  2197. RaKillActive(
  2198. IN AIINFO* pInfo )
  2199. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  2200. **
  2201. ** Returns true if the page is invalid, false is it can be dismissed.
  2202. */
  2203. {
  2204. TCHAR* psz;
  2205. psz = GetText( pInfo->hwndCcIp );
  2206. if (psz)
  2207. {
  2208. PBENTRY* pEntry = pInfo->pArgs->pEntry;
  2209. Free0( pEntry->pszIpAddress );
  2210. pEntry->pszIpAddress = psz;
  2211. }
  2212. return FALSE;
  2213. }
  2214. BOOL
  2215. RaSetActive(
  2216. IN AIINFO* pInfo )
  2217. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  2218. **
  2219. ** Returns true to display the page, false to skip it.
  2220. */
  2221. {
  2222. PBENTRY* pEntry;
  2223. pEntry = pInfo->pArgs->pEntry;
  2224. // In NT5, we always skip this page
  2225. return FALSE;
  2226. if (!pInfo->fNotNt || !pInfo->fIpConfigured)
  2227. {
  2228. return FALSE;
  2229. }
  2230. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  2231. return TRUE;
  2232. }
  2233. /*----------------------------------------------------------------------------
  2234. ** Logon Script property page
  2235. ** Listed alphabetically following dialog proc
  2236. **----------------------------------------------------------------------------
  2237. */
  2238. INT_PTR CALLBACK
  2239. RcDlgProc(
  2240. IN HWND hwnd,
  2241. IN UINT unMsg,
  2242. IN WPARAM wparam,
  2243. IN LPARAM lparam )
  2244. /* DialogProc callback for the Logon Script page of the wizard.
  2245. ** Parameters and return value are as described for standard windows
  2246. ** 'DialogProc's.
  2247. */
  2248. {
  2249. #if 0
  2250. TRACE4("RcDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  2251. (DWORD)hwnd,(DWORD)unMsg,(DWORD)wparam,(DWORD)lparam);
  2252. #endif
  2253. switch (unMsg)
  2254. {
  2255. case WM_INITDIALOG:
  2256. return RcInit( hwnd );
  2257. case WM_NOTIFY:
  2258. {
  2259. switch (((NMHDR* )lparam)->code)
  2260. {
  2261. case PSN_SETACTIVE:
  2262. {
  2263. AIINFO* pInfo;
  2264. BOOL fDisplay;
  2265. TRACE("RcSETACTIVE");
  2266. pInfo = AiContext( hwnd );
  2267. ASSERT(pInfo);
  2268. if (pInfo == NULL)
  2269. {
  2270. break;
  2271. }
  2272. fDisplay = RcSetActive( pInfo );
  2273. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  2274. return TRUE;
  2275. }
  2276. case PSN_KILLACTIVE:
  2277. {
  2278. AIINFO* pInfo;
  2279. BOOL fInvalid;
  2280. TRACE("RcKILLACTIVE");
  2281. pInfo = AiContext( hwnd );
  2282. ASSERT(pInfo);
  2283. if (pInfo == NULL)
  2284. {
  2285. break;
  2286. }
  2287. fInvalid = RcKillActive( pInfo );
  2288. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  2289. return TRUE;
  2290. }
  2291. }
  2292. break;
  2293. }
  2294. case WM_COMMAND:
  2295. {
  2296. AIINFO* pInfo = AiContext( hwnd );
  2297. ASSERT(pInfo);
  2298. if (pInfo == NULL)
  2299. {
  2300. break;
  2301. }
  2302. return RcCommand(
  2303. pInfo, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  2304. }
  2305. }
  2306. return FALSE;
  2307. }
  2308. BOOL
  2309. RcCommand(
  2310. IN AIINFO* pInfo,
  2311. IN WORD wNotification,
  2312. IN WORD wId,
  2313. IN HWND hwndCtrl )
  2314. /* Called on WM_COMMAND. 'PInfo' is the dialog context. 'WNotification'
  2315. ** is the notification code of the command. 'wId' is the control/menu
  2316. ** identifier of the command. 'HwndCtrl' is the control window handle of
  2317. ** the command.
  2318. **
  2319. ** Returns true if processed message, false otherwise.
  2320. */
  2321. {
  2322. TRACE3("RcCommand(n=%d,i=%d,c=$%x)",
  2323. (DWORD)wNotification,(DWORD)wId,(ULONG_PTR )hwndCtrl);
  2324. switch (wId)
  2325. {
  2326. case CID_RC_CB_RunScript:
  2327. {
  2328. if (SuScriptsCbHandler( &pInfo->suinfo, wNotification ))
  2329. {
  2330. return TRUE;
  2331. }
  2332. break;
  2333. }
  2334. case CID_RC_PB_Edit:
  2335. {
  2336. if (SuEditPbHandler( &pInfo->suinfo, wNotification ))
  2337. {
  2338. return TRUE;
  2339. }
  2340. break;
  2341. }
  2342. case CID_RC_PB_Browse:
  2343. {
  2344. if (SuBrowsePbHandler( &pInfo->suinfo, wNotification ))
  2345. {
  2346. return TRUE;
  2347. }
  2348. break;
  2349. }
  2350. }
  2351. return FALSE;
  2352. }
  2353. BOOL
  2354. RcInit(
  2355. IN HWND hwndPage )
  2356. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  2357. ** page.
  2358. **
  2359. ** Return false if focus was set, true otherwise.
  2360. */
  2361. {
  2362. AIINFO* pInfo;
  2363. PBENTRY* pEntry;
  2364. TRACE("RcInit");
  2365. pInfo = AiContext( hwndPage );
  2366. if (!pInfo)
  2367. return TRUE;
  2368. /* Initialize page-specific context information.
  2369. */
  2370. pInfo->hwndRc = hwndPage;
  2371. pInfo->hwndCbTerminal = GetDlgItem( hwndPage, CID_RC_CB_Terminal );
  2372. ASSERT( pInfo->hwndCbTerminal );
  2373. pInfo->hwndCbRunScript = GetDlgItem( hwndPage, CID_RC_CB_RunScript );
  2374. ASSERT( pInfo->hwndCbRunScript );
  2375. pInfo->hwndLbScripts = GetDlgItem( hwndPage, CID_RC_LB_Scripts );
  2376. ASSERT( pInfo->hwndLbScripts );
  2377. pInfo->hwndPbEdit = GetDlgItem( hwndPage, CID_RC_PB_Edit );
  2378. ASSERT( pInfo->hwndPbEdit );
  2379. pInfo->hwndPbBrowse = GetDlgItem( hwndPage, CID_RC_PB_Browse );
  2380. ASSERT( pInfo->hwndPbBrowse );
  2381. pEntry = pInfo->pArgs->pEntry;
  2382. pInfo->suinfo.hConnection =
  2383. ((INTERNALARGS *) pInfo->pArgs->pApiArgs->reserved)->hConnection;
  2384. // We don't allow the script window for dd interfaces
  2385. //
  2386. ShowWindow(pInfo->hwndCbTerminal, SW_HIDE);
  2387. // Set up the after-dial scripting controls.
  2388. //
  2389. SuInit( &pInfo->suinfo,
  2390. pInfo->hwndCbRunScript,
  2391. pInfo->hwndCbTerminal,
  2392. pInfo->hwndLbScripts,
  2393. pInfo->hwndPbEdit,
  2394. pInfo->hwndPbBrowse,
  2395. SU_F_DisableTerminal);
  2396. pInfo->fSuInfoInitialized = TRUE;
  2397. SuSetInfo( &pInfo->suinfo,
  2398. pEntry->fScriptAfter,
  2399. pEntry->fScriptAfterTerminal,
  2400. pEntry->pszScriptAfter );
  2401. return FALSE;
  2402. }
  2403. BOOL
  2404. RcKillActive(
  2405. IN AIINFO* pInfo )
  2406. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  2407. **
  2408. ** Returns true if the page is invalid, false is it can be dismissed.
  2409. */
  2410. {
  2411. PBENTRY* pEntry;
  2412. pEntry = pInfo->pArgs->pEntry;
  2413. Free0( pEntry->pszScriptAfter );
  2414. SuGetInfo( &pInfo->suinfo,
  2415. &pEntry->fScriptAfter,
  2416. &pEntry->fScriptAfterTerminal,
  2417. &pEntry->pszScriptAfter );
  2418. return FALSE;
  2419. }
  2420. BOOL
  2421. RcSetActive(
  2422. IN AIINFO* pInfo )
  2423. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  2424. **
  2425. ** Returns true to display the page, false to skip it.
  2426. */
  2427. {
  2428. HWND hwndRb;
  2429. if (!pInfo->fNotNt || !pInfo->fModem)
  2430. return FALSE;
  2431. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  2432. return TRUE;
  2433. }
  2434. /*----------------------------------------------------------------------------
  2435. ** Finish property page
  2436. ** Listed alphabetically following dialog proc
  2437. **----------------------------------------------------------------------------
  2438. */
  2439. INT_PTR CALLBACK
  2440. RfDlgProc(
  2441. IN HWND hwnd,
  2442. IN UINT unMsg,
  2443. IN WPARAM wparam,
  2444. IN LPARAM lparam )
  2445. /* DialogProc callback for the Finish page of the wizard.
  2446. ** Parameters and return value are as described for standard windows
  2447. ** 'DialogProc's.
  2448. */
  2449. {
  2450. #if 0
  2451. TRACE4("RfDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  2452. (DWORD)hwnd,(DWORD)unMsg,(DWORD)wparam,(DWORD)lparam);
  2453. #endif
  2454. switch (unMsg)
  2455. {
  2456. case WM_INITDIALOG:
  2457. return RfInit( hwnd );
  2458. case WM_NOTIFY:
  2459. {
  2460. switch (((NMHDR* )lparam)->code)
  2461. {
  2462. case PSN_SETACTIVE:
  2463. {
  2464. AIINFO* pInfo;
  2465. BOOL fDisplay;
  2466. TRACE("RfSETACTIVE");
  2467. pInfo = AiContext( hwnd );
  2468. ASSERT(pInfo);
  2469. if (pInfo == NULL)
  2470. {
  2471. break;
  2472. }
  2473. fDisplay = RfSetActive( pInfo );
  2474. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  2475. return TRUE;
  2476. }
  2477. case PSN_KILLACTIVE:
  2478. {
  2479. AIINFO* pInfo;
  2480. BOOL fInvalid;
  2481. TRACE("RfKILLACTIVE");
  2482. pInfo = AiContext( hwnd );
  2483. ASSERT(pInfo);
  2484. if (pInfo == NULL)
  2485. {
  2486. break;
  2487. }
  2488. fInvalid = RfKillActive( pInfo );
  2489. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  2490. return TRUE;
  2491. }
  2492. case PSN_WIZFINISH:
  2493. {
  2494. TRACE("RfWIZFINISH");
  2495. AiFinish( hwnd );
  2496. SetWindowLong( hwnd, DWLP_MSGRESULT, 0 );
  2497. return TRUE;
  2498. }
  2499. }
  2500. break;
  2501. }
  2502. case WM_COMMAND:
  2503. {
  2504. AIINFO* pInfo = AiContext( hwnd );
  2505. ASSERT(pInfo);
  2506. if (pInfo == NULL)
  2507. {
  2508. break;
  2509. }
  2510. return RfCommand(
  2511. pInfo, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  2512. }
  2513. }
  2514. return FALSE;
  2515. }
  2516. BOOL
  2517. RfCommand(
  2518. IN AIINFO* pInfo,
  2519. IN WORD wNotification,
  2520. IN WORD wId,
  2521. IN HWND hwndCtrl )
  2522. /* Called on WM_COMMAND. 'PInfo' is the dialog context. 'WNotification'
  2523. ** is the notification code of the command. 'wId' is the control/menu
  2524. ** identifier of the command. 'HwndCtrl' is the control window handle of
  2525. ** the command.
  2526. **
  2527. ** Returns true if processed message, false otherwise.
  2528. */
  2529. {
  2530. TRACE3("RfCommand(n=%d,i=%d,c=$%x)",
  2531. (DWORD)wNotification,(DWORD)wId,(ULONG_PTR )hwndCtrl);
  2532. #if 0
  2533. switch (wId)
  2534. {
  2535. case CID_RF_PB_Properties:
  2536. {
  2537. pInfo->pArgs->fChainPropertySheet = TRUE;
  2538. PropSheet_PressButton( pInfo->hwndDlg, PSBTN_FINISH );
  2539. return TRUE;
  2540. }
  2541. }
  2542. #endif
  2543. return FALSE;
  2544. }
  2545. BOOL
  2546. RfInit(
  2547. IN HWND hwndPage )
  2548. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  2549. ** page.
  2550. **
  2551. ** Return false if focus was set, true otherwise.
  2552. */
  2553. {
  2554. AIINFO* pInfo;
  2555. PBENTRY* pEntry;
  2556. DWORD dwErr;
  2557. TRACE("RfInit");
  2558. pInfo = AiContext( hwndPage );
  2559. if (!pInfo)
  2560. return TRUE;
  2561. /* Initialize page-specific context information.
  2562. */
  2563. pInfo->hwndRf = hwndPage;
  2564. // Set up a bold font if we can.
  2565. //
  2566. pInfo->hwndRfStFinish = GetDlgItem( hwndPage, CID_RF_ST_Explain );
  2567. if (pInfo->hBoldFont && pInfo->hwndRfStFinish)
  2568. {
  2569. SendMessage(
  2570. pInfo->hwndRfStFinish,
  2571. WM_SETFONT,
  2572. (WPARAM)pInfo->hBoldFont,
  2573. MAKELPARAM(TRUE, 0));
  2574. }
  2575. /* Create and display the wizard bitmap.
  2576. */
  2577. CreateWizardBitmap( hwndPage, TRUE );
  2578. return FALSE;
  2579. }
  2580. BOOL
  2581. RfSetActive(
  2582. IN AIINFO* pInfo )
  2583. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  2584. **
  2585. ** Returns true to display the page, false to skip it.
  2586. */
  2587. {
  2588. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_FINISH );
  2589. return TRUE;
  2590. }
  2591. BOOL
  2592. RfKillActive(
  2593. IN AIINFO* pInfo )
  2594. {
  2595. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  2596. **
  2597. ** Returns true if the page is invalid, false is it can be dismissed.
  2598. */
  2599. return FALSE;
  2600. }
  2601. /*----------------------------------------------------------------------------
  2602. ** Modem/Adapter property page
  2603. ** Listed alphabetically following dialog proc
  2604. **----------------------------------------------------------------------------
  2605. */
  2606. INT_PTR CALLBACK
  2607. RnDlgProc(
  2608. IN HWND hwnd,
  2609. IN UINT unMsg,
  2610. IN WPARAM wparam,
  2611. IN LPARAM lparam )
  2612. /* DialogProc callback for the Modem/Adapter page of the wizard.
  2613. ** Parameters and return value are as described for standard windows
  2614. ** 'DialogProc's.
  2615. */
  2616. {
  2617. #if 0
  2618. TRACE4("RnDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  2619. (DWORD)hwnd,(DWORD)unMsg,(DWORD)wparam,(DWORD)lparam);
  2620. #endif
  2621. if (ListView_OwnerHandler(
  2622. hwnd, unMsg, wparam, lparam, RnLvCallback ))
  2623. {
  2624. return TRUE;
  2625. }
  2626. switch (unMsg)
  2627. {
  2628. case WM_INITDIALOG:
  2629. return RnInit( hwnd );
  2630. case WM_NOTIFY:
  2631. {
  2632. switch (((NMHDR* )lparam)->code)
  2633. {
  2634. case PSN_SETACTIVE:
  2635. {
  2636. AIINFO* pInfo;
  2637. BOOL fDisplay;
  2638. TRACE("RnSETACTIVE");
  2639. pInfo = AiContext( hwnd );
  2640. ASSERT(pInfo);
  2641. fDisplay = RnSetActive( pInfo );
  2642. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  2643. return TRUE;
  2644. }
  2645. case LVN_ITEMCHANGED:
  2646. {
  2647. AIINFO* pInfo;
  2648. pInfo = AiContext( hwnd );
  2649. ASSERT(pInfo);
  2650. RnLvItemChanged( pInfo );
  2651. return TRUE;
  2652. }
  2653. }
  2654. break;
  2655. }
  2656. }
  2657. return FALSE;
  2658. }
  2659. BOOL
  2660. RnInit(
  2661. IN HWND hwndPage )
  2662. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  2663. ** page.
  2664. **
  2665. ** Return false if focus was set, true otherwise.
  2666. */
  2667. {
  2668. DWORD dwErr;
  2669. AIINFO* pInfo;
  2670. TRACE("RnInit");
  2671. pInfo = AiContext( hwndPage );
  2672. if (!pInfo)
  2673. return TRUE;
  2674. /* Initialize page-specific context information.
  2675. */
  2676. pInfo->hwndRn = hwndPage;
  2677. pInfo->hwndLv = GetDlgItem( hwndPage, CID_RN_LV_Devices );
  2678. ASSERT(pInfo->hwndLv);
  2679. /* Add the modem and adapter images.
  2680. */
  2681. ListView_SetDeviceImageList( pInfo->hwndLv, g_hinstDll );
  2682. /* Add a single column exactly wide enough to fully display the
  2683. ** widest member of the list.
  2684. */
  2685. {
  2686. LV_COLUMN col;
  2687. ZeroMemory( &col, sizeof(col) );
  2688. col.mask = LVCF_FMT;
  2689. col.fmt = LVCFMT_LEFT;
  2690. ListView_InsertColumn( pInfo->hwndLv, 0, &col );
  2691. ListView_SetColumnWidth(
  2692. pInfo->hwndLv, 0, LVSCW_AUTOSIZE_USEHEADER );
  2693. }
  2694. /* Don't bother with this page if there's only one device, not counting
  2695. ** the bogus "uninstalled" standard modem that's added by EuInit so
  2696. ** entries can be edited when there are no ports.
  2697. */
  2698. if (!pInfo->pArgs->fNoPortsConfigured
  2699. && ListView_GetItemCount( pInfo->hwndLv ) == 1)
  2700. {
  2701. pInfo->fSkipMa = TRUE;
  2702. }
  2703. return FALSE;
  2704. }
  2705. LVXDRAWINFO*
  2706. RnLvCallback(
  2707. IN HWND hwndLv,
  2708. IN DWORD dwItem )
  2709. /* Enhanced list view callback to report drawing information. 'HwndLv' is
  2710. ** the handle of the list view control. 'DwItem' is the index of the item
  2711. ** being drawn.
  2712. **
  2713. ** Returns the address of the column information.
  2714. */
  2715. {
  2716. /* Use "wide selection bar" feature and the other recommended options.
  2717. **
  2718. ** Fields are 'nCols', 'dxIndent', 'dwFlags', 'adwFlags[]'.
  2719. */
  2720. static LVXDRAWINFO info =
  2721. { 1, 0, LVXDI_DxFill, { 0, 0 } };
  2722. return &info;
  2723. }
  2724. VOID
  2725. RnLvItemChanged(
  2726. IN AIINFO* pInfo )
  2727. /* Called when the combobox selection changes. 'PInfo' is the wizard
  2728. ** context.
  2729. */
  2730. {
  2731. INT iSel;
  2732. DTLNODE* pNode;
  2733. DTLLIST* pList;
  2734. TRACE("RnLvItemChanged");
  2735. pList = pInfo->pArgs->pEntry->pdtllistLinks;
  2736. ASSERT(pList);
  2737. pNode = (DTLNODE* )ListView_GetSelectedParamPtr( pInfo->hwndLv );
  2738. pInfo->dwSelectedDeviceIndex =
  2739. (DWORD) ListView_GetNextItem( pInfo->hwndLv, -1, LVNI_SELECTED );
  2740. if (pNode)
  2741. {
  2742. PBLINK* pLink;
  2743. /* Single device selected. Enable it, move it to the head of the list
  2744. ** of links, and disable all the other links.
  2745. */
  2746. pLink = (PBLINK* )DtlGetData( pNode );
  2747. pLink->fEnabled = TRUE;
  2748. pInfo->fModem =
  2749. (pLink->pbport.pbdevicetype == PBDT_Modem
  2750. || pLink->pbport.pbdevicetype == PBDT_Null);
  2751. /* If the device selected is an X25 PAD, we will drop the user into
  2752. ** the phonebook entry-dialog after this wizard, so that the X25
  2753. ** address can be entered there.
  2754. */
  2755. pInfo->pArgs->fPadSelected = (pLink->pbport.pbdevicetype == PBDT_Pad);
  2756. DtlRemoveNode( pList, pNode );
  2757. DtlAddNodeFirst( pList, pNode );
  2758. for (pNode = DtlGetNextNode( pNode );
  2759. pNode;
  2760. pNode = DtlGetNextNode( pNode ))
  2761. {
  2762. PBLINK* pLink = (PBLINK* )DtlGetData( pNode );
  2763. ASSERT(pLink);
  2764. pLink->fEnabled = FALSE;
  2765. }
  2766. }
  2767. else
  2768. {
  2769. DTLNODE* pNextNode;
  2770. DTLNODE* pAfterNode;
  2771. pInfo->fModem = FALSE;
  2772. /* ISDN multi-link selected. Enable the ISDN multi-link nodes, move
  2773. ** them to the head of the list, and disable all the other links.
  2774. */
  2775. pAfterNode = NULL;
  2776. for (pNode = DtlGetFirstNode( pList );
  2777. pNode;
  2778. pNode = pNextNode)
  2779. {
  2780. PBLINK* pLink = (PBLINK* )DtlGetData( pNode );
  2781. ASSERT(pLink);
  2782. pNextNode = DtlGetNextNode( pNode );
  2783. if (pLink->pbport.pbdevicetype == PBDT_Isdn
  2784. && !pLink->fProprietaryIsdn)
  2785. {
  2786. pLink->fEnabled = TRUE;
  2787. DtlRemoveNode( pList, pNode );
  2788. if (pAfterNode)
  2789. DtlAddNodeAfter( pList, pAfterNode, pNode );
  2790. else
  2791. DtlAddNodeFirst( pList, pNode );
  2792. pAfterNode = pNode;
  2793. }
  2794. else
  2795. {
  2796. pLink->fEnabled = FALSE;
  2797. }
  2798. }
  2799. }
  2800. }
  2801. BOOL
  2802. RnLvRefresh(
  2803. IN AIINFO* pInfo)
  2804. {
  2805. DWORD dwErr = NO_ERROR;
  2806. TCHAR* psz;
  2807. DTLNODE* pNode;
  2808. DWORD cMultilinkableIsdn;
  2809. INT iItem;
  2810. ListView_DeleteAllItems( pInfo->hwndLv );
  2811. iItem = 1;
  2812. cMultilinkableIsdn = 0;
  2813. for (pNode = DtlGetFirstNode( pInfo->pArgs->pEntry->pdtllistLinks );
  2814. pNode;
  2815. pNode = DtlGetNextNode( pNode ))
  2816. {
  2817. PBLINK* pLink;
  2818. pLink = (PBLINK* )DtlGetData( pNode );
  2819. ASSERT(pLink);
  2820. if (pLink->pbport.pbdevicetype == PBDT_Isdn
  2821. && !pLink->fProprietaryIsdn)
  2822. {
  2823. ++cMultilinkableIsdn;
  2824. }
  2825. psz = DisplayPszFromDeviceAndPort(
  2826. pLink->pbport.pszDevice, pLink->pbport.pszPort );
  2827. if (psz)
  2828. {
  2829. PBLINK* pLink;
  2830. LV_ITEM item;
  2831. pLink = (PBLINK* )DtlGetData( pNode );
  2832. ZeroMemory( &item, sizeof(item) );
  2833. item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
  2834. item.iItem = iItem++;
  2835. item.pszText = psz;
  2836. // I noticed that the device bitmaps were
  2837. // inconsistent with connections, so I'm
  2838. // matching them up here.
  2839. //
  2840. if (pLink->pbport.dwType == RASET_Direct)
  2841. {
  2842. item.iImage = DI_Direct;
  2843. }
  2844. else if (pLink->pbport.pbdevicetype == PBDT_Modem)
  2845. {
  2846. item.iImage = DI_Modem;
  2847. }
  2848. else
  2849. {
  2850. item.iImage = DI_Adapter;
  2851. }
  2852. item.lParam = (LPARAM )pNode;
  2853. ListView_InsertItem( pInfo->hwndLv, &item );
  2854. Free( psz );
  2855. }
  2856. }
  2857. if (cMultilinkableIsdn > 1)
  2858. {
  2859. psz = PszFromId( g_hinstDll, SID_IsdnAdapter );
  2860. if (psz)
  2861. {
  2862. LONG lStyle;
  2863. LV_ITEM item;
  2864. /* Turn off sorting so the special ISDN-multilink item appears
  2865. ** at the top of the list.
  2866. */
  2867. lStyle = GetWindowLong( pInfo->hwndLv, GWL_STYLE );
  2868. SetWindowLong( pInfo->hwndLv, GWL_STYLE,
  2869. (lStyle & ~(LVS_SORTASCENDING)) );
  2870. ZeroMemory( &item, sizeof(item) );
  2871. item.mask = LVIF_TEXT + LVIF_IMAGE + LVIF_PARAM;
  2872. item.iItem = 0;
  2873. item.pszText = psz;
  2874. item.iImage = DI_Adapter;
  2875. item.lParam = (LPARAM )NULL;
  2876. ListView_InsertItem( pInfo->hwndLv, &item );
  2877. Free( psz );
  2878. }
  2879. }
  2880. return NO_ERROR;
  2881. }
  2882. BOOL
  2883. RnSetActive(
  2884. IN AIINFO* pInfo )
  2885. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  2886. **
  2887. ** Returns true to display the page, false to skip it.
  2888. */
  2889. {
  2890. INT cDevices;
  2891. // pmay: 233295.
  2892. // This page does not apply to VPN connections
  2893. //
  2894. if (
  2895. ((pInfo->pArgs->pEntry->dwType == RASET_Vpn
  2896. && !pInfo->pArgs->fNt4Router)
  2897. || (pInfo->fSkipMa)
  2898. || (pInfo->pArgs->pEntry->dwType == RASET_Broadband)) //For whistler 349807
  2899. )
  2900. {
  2901. return FALSE;
  2902. }
  2903. // If we have no physical devices, then this page is invalid
  2904. // unless we're focused on an nt4 machine in which case the
  2905. // tunneling adapters are selected from here.
  2906. if ( ! (pInfo->dwFlags & AI_F_HasPhysDevs) )
  2907. {
  2908. if ( ! pInfo->pArgs->fNt4Router )
  2909. return FALSE;
  2910. }
  2911. // Refresh the list view and make the correct selection
  2912. //
  2913. RnLvRefresh(pInfo);
  2914. ListView_SetItemState(
  2915. pInfo->hwndLv,
  2916. pInfo->dwSelectedDeviceIndex,
  2917. LVIS_SELECTED, LVIS_SELECTED );
  2918. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  2919. return TRUE;
  2920. }
  2921. /*----------------------------------------------------------------------------
  2922. ** Phone Number property page
  2923. ** Listed alphabetically following dialog proc
  2924. **----------------------------------------------------------------------------
  2925. */
  2926. INT_PTR CALLBACK
  2927. RpDlgProc(
  2928. IN HWND hwnd,
  2929. IN UINT unMsg,
  2930. IN WPARAM wparam,
  2931. IN LPARAM lparam )
  2932. /* DialogProc callback for the Phone Number page of the wizard.
  2933. ** Parameters and return value are as described for standard windows
  2934. ** 'DialogProc's.
  2935. */
  2936. {
  2937. #if 0
  2938. TRACE4("RpDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  2939. (DWORD)hwnd,(DWORD)unMsg,(DWORD)wparam,(DWORD)lparam);
  2940. #endif
  2941. switch (unMsg)
  2942. {
  2943. case WM_INITDIALOG:
  2944. return RpInit( hwnd );
  2945. case WM_NOTIFY:
  2946. {
  2947. switch (((NMHDR* )lparam)->code)
  2948. {
  2949. case PSN_SETACTIVE:
  2950. {
  2951. AIINFO* pInfo;
  2952. BOOL fDisplay;
  2953. TRACE("RpSETACTIVE");
  2954. pInfo = AiContext( hwnd );
  2955. ASSERT(pInfo);
  2956. if (pInfo == NULL)
  2957. {
  2958. break;
  2959. }
  2960. fDisplay = RpSetActive( pInfo );
  2961. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  2962. return TRUE;
  2963. }
  2964. case PSN_KILLACTIVE:
  2965. {
  2966. AIINFO* pInfo;
  2967. BOOL fInvalid;
  2968. TRACE("RpKILLACTIVE");
  2969. pInfo = AiContext( hwnd );
  2970. ASSERT(pInfo);
  2971. if (pInfo == NULL)
  2972. {
  2973. break;
  2974. }
  2975. fInvalid = RpKillActive( pInfo );
  2976. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  2977. return TRUE;
  2978. }
  2979. }
  2980. break;
  2981. }
  2982. case WM_COMMAND:
  2983. {
  2984. AIINFO* pInfo = AiContext( hwnd );
  2985. ASSERT(pInfo);
  2986. if (pInfo == NULL)
  2987. {
  2988. break;
  2989. }
  2990. return RpCommand(
  2991. pInfo, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  2992. }
  2993. }
  2994. return FALSE;
  2995. }
  2996. VOID
  2997. RpAlternates(
  2998. IN AIINFO* pInfo )
  2999. /* Popup the Alternate Phone Numbers dialog. 'PInfo' is the property
  3000. ** sheet context.
  3001. */
  3002. {
  3003. RpPhoneNumberToStash( pInfo );
  3004. if (PhoneNumberDlg(
  3005. pInfo->hwndRp,
  3006. pInfo->pArgs->fRouter,
  3007. pInfo->pListPhoneNumbers,
  3008. &pInfo->fPromoteHuntNumbers ))
  3009. {
  3010. TCHAR* pszPhoneNumber;
  3011. pszPhoneNumber = FirstPszFromList( pInfo->pListPhoneNumbers );
  3012. SetWindowText( pInfo->hwndEbNumber, pszPhoneNumber );
  3013. }
  3014. }
  3015. BOOL
  3016. RpCommand(
  3017. IN AIINFO* pInfo,
  3018. IN WORD wNotification,
  3019. IN WORD wId,
  3020. IN HWND hwndCtrl )
  3021. /* Called on WM_COMMAND. 'PInfo' is the dialog context. 'WNotification'
  3022. ** is the notification code of the command. 'wId' is the control/menu
  3023. ** identifier of the command. 'HwndCtrl' is the control window handle of
  3024. ** the command.
  3025. **
  3026. ** Returns true if processed message, false otherwise.
  3027. */
  3028. {
  3029. TRACE3("RpCommand(n=%d,i=%d,c=$%x)",
  3030. (DWORD)wNotification,(DWORD)wId,(ULONG_PTR )hwndCtrl);
  3031. switch (wId)
  3032. {
  3033. case CID_RP_PB_Alternates:
  3034. RpAlternates( pInfo );
  3035. return TRUE;
  3036. }
  3037. return FALSE;
  3038. }
  3039. BOOL
  3040. RpInit(
  3041. IN HWND hwndPage )
  3042. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  3043. ** page.
  3044. **
  3045. ** Return false if focus was set, true otherwise.
  3046. */
  3047. {
  3048. AIINFO* pInfo;
  3049. TRACE("RpInit");
  3050. pInfo = AiContext( hwndPage );
  3051. if (!pInfo)
  3052. return TRUE;
  3053. /* Initialize page-specific context information.
  3054. */
  3055. pInfo->hwndRp = hwndPage;
  3056. pInfo->hwndStNumber = GetDlgItem( hwndPage, CID_RP_ST_Number );
  3057. ASSERT(pInfo->hwndStNumber);
  3058. pInfo->hwndEbNumber = GetDlgItem( hwndPage, CID_RP_EB_Number );
  3059. ASSERT(pInfo->hwndEbNumber);
  3060. pInfo->hwndPbAlternates = GetDlgItem( hwndPage, CID_RP_PB_Alternates );
  3061. ASSERT(pInfo->hwndPbAlternates);
  3062. /* Fill the phone number field from the stash created earlier.
  3063. */
  3064. Edit_LimitText( pInfo->hwndEbNumber, RAS_MaxPhoneNumber );
  3065. SetWindowText( pInfo->hwndEbNumber,
  3066. FirstPszFromList( pInfo->pListPhoneNumbers ) );
  3067. return FALSE;
  3068. }
  3069. BOOL
  3070. RpKillActive(
  3071. IN AIINFO* pInfo )
  3072. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  3073. **
  3074. ** Returns true if the page is invalid, false is it can be dismissed.
  3075. */
  3076. {
  3077. // pmay: 226610. Call RpPhoneNumberToStash if we were successfully
  3078. // activated.
  3079. /* Update the stashed phone number from the editbox.
  3080. */
  3081. if ( (! pInfo->pArgs->fNt4Router) &&
  3082. ( (pInfo->pArgs->pEntry->dwType == RASET_Vpn) ||
  3083. (pInfo->pArgs->pEntry->dwType == RASET_Broadband) ) //For whistler 349807
  3084. )
  3085. {
  3086. return FALSE;
  3087. }
  3088. RpPhoneNumberToStash( pInfo );
  3089. return FALSE;
  3090. }
  3091. VOID
  3092. RpPhoneNumberToStash(
  3093. IN AIINFO* pInfo )
  3094. /* Replace the first phone number in the stashed list with the contents of
  3095. ** the phone number field. 'pInfo' is the property sheet context.
  3096. */
  3097. {
  3098. DWORD dwErr;
  3099. TCHAR* pszPhoneNumber;
  3100. TRACE("RpPhoneNumberToStash");
  3101. pszPhoneNumber = GetText( pInfo->hwndEbNumber );
  3102. if (pszPhoneNumber)
  3103. {
  3104. dwErr = FirstPszToList( pInfo->pListPhoneNumbers, pszPhoneNumber );
  3105. Free( pszPhoneNumber );
  3106. }
  3107. else
  3108. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  3109. if (dwErr != 0)
  3110. {
  3111. ErrorDlg( pInfo->hwndDlg, SID_OP_RetrievingData, dwErr, NULL );
  3112. AiExit( pInfo, dwErr );
  3113. }
  3114. }
  3115. BOOL
  3116. RpSetActive(
  3117. IN AIINFO* pInfo )
  3118. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  3119. **
  3120. ** Returns true to display the page, false to skip it.
  3121. */
  3122. {
  3123. INT iSel;
  3124. DTLNODE* pNode;
  3125. DTLLIST* pList;
  3126. PBLINK* pLink;
  3127. if (! pInfo->pArgs->fNt4Router)
  3128. {
  3129. // If we're focused on an nt5 machine, then skip this page
  3130. // if the connection type is virtual because the phone number will
  3131. // be gotten from the vpn destination page.
  3132. if (pInfo->pArgs->pEntry->dwType == RASET_Vpn ||
  3133. pInfo->pArgs->pEntry->dwType == RASET_Broadband) //Add this for whistler 349087
  3134. {
  3135. return FALSE;
  3136. }
  3137. // pmay: 233287
  3138. //
  3139. // No phone number is requred if the device is dcc. Skip
  3140. // this page if that is the case.
  3141. //
  3142. pList = pInfo->pArgs->pEntry->pdtllistLinks;
  3143. ASSERT(pList);
  3144. pNode = (DTLNODE* )ListView_GetSelectedParamPtr( pInfo->hwndLv );
  3145. if (pNode)
  3146. {
  3147. // Single device selected. See if its dcc
  3148. pLink = (PBLINK* )DtlGetData( pNode );
  3149. if (pLink->pbport.dwType == RASET_Direct)
  3150. {
  3151. return FALSE;
  3152. }
  3153. }
  3154. }
  3155. // Instruct the wizard to use the destination editbox for the
  3156. // phone number of this connection
  3157. pInfo->hwndEbNumber = GetDlgItem(pInfo->hwndRp, CID_RP_EB_Number);
  3158. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  3159. return TRUE;
  3160. }
  3161. /*----------------------------------------------------------------------------
  3162. ** Router welcome property page
  3163. ** Listed alphabetically following dialog proc
  3164. **----------------------------------------------------------------------------
  3165. */
  3166. INT_PTR CALLBACK
  3167. RwDlgProc(
  3168. IN HWND hwnd,
  3169. IN UINT unMsg,
  3170. IN WPARAM wparam,
  3171. IN LPARAM lparam )
  3172. /* DialogProc callback for the Router Welcome page of the wizard.
  3173. ** Parameters and return values are as described for standard windows
  3174. ** 'DialogProc's.
  3175. */
  3176. {
  3177. switch (unMsg)
  3178. {
  3179. case WM_INITDIALOG:
  3180. {
  3181. return
  3182. RwInit( hwnd, (EINFO* )(((PROPSHEETPAGE* )lparam)->lParam) );
  3183. }
  3184. case WM_NOTIFY:
  3185. {
  3186. switch (((NMHDR* )lparam)->code)
  3187. {
  3188. case PSN_RESET:
  3189. {
  3190. TRACE("RwRESET");
  3191. AiCancel( hwnd );
  3192. SetWindowLong( hwnd, DWLP_MSGRESULT, FALSE );
  3193. return TRUE;
  3194. }
  3195. case PSN_SETACTIVE:
  3196. {
  3197. AIINFO* pInfo;
  3198. BOOL fDisplay;
  3199. TRACE("RwSETACTIVE");
  3200. pInfo = AiContext( hwnd );
  3201. ASSERT(pInfo);
  3202. if (pInfo == NULL)
  3203. {
  3204. break;
  3205. }
  3206. fDisplay = RwSetActive( pInfo );
  3207. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  3208. return TRUE;
  3209. }
  3210. case PSN_KILLACTIVE:
  3211. {
  3212. AIINFO* pInfo;
  3213. BOOL fInvalid;
  3214. TRACE("InKILLACTIVE");
  3215. pInfo = AiContext( hwnd );
  3216. ASSERT(pInfo);
  3217. if (pInfo == NULL)
  3218. {
  3219. break;
  3220. }
  3221. fInvalid = RwKillActive( pInfo );
  3222. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  3223. return TRUE;
  3224. }
  3225. case PSN_WIZFINISH:
  3226. {
  3227. AIINFO* pInfo;
  3228. TRACE("InWIZFINISH");
  3229. pInfo = AiContext( hwnd );
  3230. ASSERT(pInfo);
  3231. if (pInfo == NULL)
  3232. {
  3233. break;
  3234. }
  3235. /* You'd think pressing Finish would trigger a KILLACTIVE
  3236. ** event, but it doesn't, so we do it ourselves.
  3237. */
  3238. RwKillActive( pInfo );
  3239. /* Set "no wizard" user preference, per user's check.
  3240. */
  3241. pInfo->pArgs->pUser->fNewEntryWizard = FALSE;
  3242. pInfo->pArgs->pUser->fDirty = TRUE;
  3243. g_pSetUserPreferences(
  3244. NULL,
  3245. pInfo->pArgs->pUser,
  3246. pInfo->pArgs->fNoUser ? UPM_Logon : UPM_Normal );
  3247. pInfo->pArgs->fPadSelected = FALSE;
  3248. pInfo->pArgs->fChainPropertySheet = TRUE;
  3249. AiFinish( hwnd );
  3250. SetWindowLong( hwnd, DWLP_MSGRESULT, 0 );
  3251. return TRUE;
  3252. }
  3253. }
  3254. break;
  3255. }
  3256. case WM_DESTROY:
  3257. {
  3258. AiTerm( hwnd );
  3259. break;
  3260. }
  3261. }
  3262. return FALSE;
  3263. }
  3264. BOOL
  3265. RwInit(
  3266. IN HWND hwndPage,
  3267. IN OUT EINFO* pArgs )
  3268. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  3269. ** page. 'PArgs' is the arguments from the PropertySheet caller.
  3270. **
  3271. ** Return false if focus was set, true otherwise.
  3272. */
  3273. {
  3274. DWORD dwErr;
  3275. AIINFO* pInfo;
  3276. TRACE("RwInit");
  3277. /* We're first page, so initialize the wizard.
  3278. */
  3279. pInfo = AiInit( hwndPage, pArgs );
  3280. if (!pInfo)
  3281. return TRUE;
  3282. /* Initialize page-specific context information.
  3283. */
  3284. pInfo->hwndRw = hwndPage;
  3285. pInfo->hwndRwStWelcome = GetDlgItem( hwndPage, CID_RW_ST_Welcome);
  3286. // Set up a bold font if we can.
  3287. //
  3288. if (pInfo->hBoldFont)
  3289. {
  3290. SendMessage(
  3291. pInfo->hwndRwStWelcome,
  3292. WM_SETFONT,
  3293. (WPARAM)pInfo->hBoldFont,
  3294. MAKELPARAM(TRUE, 0));
  3295. }
  3296. /* Create and display the wizard bitmap.
  3297. */
  3298. CreateWizardBitmap( hwndPage, TRUE );
  3299. return TRUE;
  3300. }
  3301. BOOL
  3302. RwKillActive(
  3303. IN AIINFO* pInfo )
  3304. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  3305. **
  3306. ** Returns true if the page is invalid, false is it can be dismissed.
  3307. */
  3308. {
  3309. return FALSE;
  3310. }
  3311. BOOL
  3312. RwSetActive(
  3313. IN AIINFO* pInfo )
  3314. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  3315. **
  3316. ** Returns true to display the page, false to skip it.
  3317. */
  3318. {
  3319. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_NEXT );
  3320. return TRUE;
  3321. }
  3322. /*----------------------------------------------------------------------------
  3323. ** Server settings property page
  3324. ** Listed alphabetically following dialog proc
  3325. **----------------------------------------------------------------------------
  3326. */
  3327. INT_PTR CALLBACK
  3328. SsDlgProc(
  3329. IN HWND hwnd,
  3330. IN UINT unMsg,
  3331. IN WPARAM wparam,
  3332. IN LPARAM lparam )
  3333. /* DialogProc callback for the 5 checkboxes page of the wizard.
  3334. ** Parameters and return value are as described for standard windows
  3335. ** 'DialogProc's.
  3336. */
  3337. {
  3338. #if 0
  3339. TRACE4("SsDlgProc(h=$%x,m=$%x,w=$%x,l=$%x)",
  3340. (DWORD)hwnd,(DWORD)unMsg,(DWORD)wparam,(DWORD)lparam);
  3341. #endif
  3342. switch (unMsg)
  3343. {
  3344. case WM_INITDIALOG:
  3345. return SsInit( hwnd );
  3346. case WM_NOTIFY:
  3347. {
  3348. switch (((NMHDR* )lparam)->code)
  3349. {
  3350. case PSN_SETACTIVE:
  3351. {
  3352. AIINFO* pInfo;
  3353. BOOL fDisplay;
  3354. TRACE("SsSETACTIVE");
  3355. pInfo = AiContext( hwnd );
  3356. ASSERT(pInfo);
  3357. if (pInfo == NULL)
  3358. {
  3359. break;
  3360. }
  3361. fDisplay = SsSetActive( pInfo );
  3362. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  3363. return TRUE;
  3364. }
  3365. case PSN_KILLACTIVE:
  3366. {
  3367. AIINFO* pInfo;
  3368. BOOL fInvalid;
  3369. TRACE("SsKILLACTIVE");
  3370. pInfo = AiContext( hwnd );
  3371. ASSERT(pInfo);
  3372. if (pInfo == NULL)
  3373. {
  3374. break;
  3375. }
  3376. fInvalid = SsKillActive( pInfo );
  3377. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  3378. return TRUE;
  3379. }
  3380. }
  3381. break;
  3382. }
  3383. case WM_COMMAND:
  3384. {
  3385. AIINFO* pInfo = AiContext( hwnd );
  3386. ASSERT(pInfo);
  3387. if (pInfo == NULL)
  3388. {
  3389. break;
  3390. }
  3391. return SsCommand(
  3392. pInfo, HIWORD( wparam ), LOWORD( wparam ), (HWND )lparam );
  3393. }
  3394. }
  3395. return FALSE;
  3396. }
  3397. BOOL
  3398. SsCommand(
  3399. IN AIINFO* pInfo,
  3400. IN WORD wNotification,
  3401. IN WORD wId,
  3402. IN HWND hwndCtrl )
  3403. /* Called on WM_COMMAND. 'PInfo' is the dialog context. 'WNotification'
  3404. ** is the notification code of the command. 'wId' is the control/menu
  3405. ** identifier of the command. 'HwndCtrl' is the control window handle of
  3406. ** the command.
  3407. **
  3408. ** Returns true if processed message, false otherwise.
  3409. */
  3410. {
  3411. TRACE3("SsCommand(n=%d,i=%d,c=$%x)",
  3412. (DWORD)wNotification,(DWORD)wId,(ULONG_PTR )hwndCtrl);
  3413. switch (wId)
  3414. {
  3415. case CID_SS_CB_AddUser:
  3416. return TRUE;
  3417. }
  3418. return FALSE;
  3419. }
  3420. BOOL
  3421. SsInit(
  3422. IN HWND hwndPage )
  3423. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  3424. ** page.
  3425. **
  3426. ** Return false if focus was set, true otherwise.
  3427. */
  3428. {
  3429. AIINFO* pInfo;
  3430. TRACE("SsInit");
  3431. pInfo = AiContext( hwndPage );
  3432. if (!pInfo)
  3433. return TRUE;
  3434. /* Initialize page-specific context information.
  3435. */
  3436. pInfo->hwndSs = hwndPage;
  3437. if (pInfo->fIpConfigured)
  3438. CheckDlgButton( hwndPage, CID_SS_CB_RouteIp, BST_CHECKED );
  3439. //for whistler bug 213901
  3440. //Hide the IPX checkbox
  3441. //move other check boxes to cover the hole made by hiding
  3442. //
  3443. #ifdef _WIN64
  3444. {
  3445. HWND hwndCBox[4];
  3446. RECT rcPos[4];
  3447. POINT ptTemp;
  3448. int i;
  3449. hwndCBox[0] = GetDlgItem( hwndPage, CID_SS_CB_RouteIpx );
  3450. hwndCBox[1] = GetDlgItem( hwndPage, CID_SS_CB_AddUser );
  3451. hwndCBox[2] = GetDlgItem( hwndPage, CID_SS_CB_PlainPw );
  3452. hwndCBox[3] = GetDlgItem( hwndPage, CID_SS_CB_NotNt );
  3453. for ( i = 0; i < 4; i++ )
  3454. {
  3455. GetWindowRect( hwndCBox[i], &rcPos[i] );
  3456. ptTemp.x = rcPos[i].left;
  3457. ptTemp.y = rcPos[i].top;
  3458. ScreenToClient( hwndPage, &ptTemp );
  3459. rcPos[i].left = ptTemp.x;
  3460. rcPos[i].top = ptTemp.y;
  3461. //Add this for whistler bug# 256658 gangz
  3462. //
  3463. ptTemp.x = rcPos[i].right;
  3464. ptTemp.y = rcPos[i].bottom;
  3465. ScreenToClient( hwndPage, &ptTemp );
  3466. rcPos[i].right = ptTemp.x;
  3467. rcPos[i].bottom = ptTemp.y;
  3468. }
  3469. ShowWindow ( hwndCBox[0], SW_HIDE );
  3470. EnableWindow( hwndCBox[0], FALSE );
  3471. for ( i = 1; i< 4; i++ )
  3472. {
  3473. MoveWindow ( hwndCBox[i],
  3474. rcPos[i-1].left,
  3475. rcPos[i-1].top,
  3476. rcPos[i].right - rcPos[i].left + 1,
  3477. rcPos[i].bottom - rcPos[i].top +1,
  3478. TRUE );
  3479. }
  3480. }
  3481. #else
  3482. if (pInfo->fIpxConfigured)
  3483. {
  3484. CheckDlgButton( hwndPage, CID_SS_CB_RouteIpx, BST_CHECKED );
  3485. }
  3486. #endif
  3487. return FALSE;
  3488. }
  3489. BOOL
  3490. SsKillActive(
  3491. IN AIINFO* pInfo )
  3492. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  3493. **
  3494. ** Returns true if the page is invalid, false is it can be dismissed.
  3495. */
  3496. {
  3497. pInfo->fIp =
  3498. IsDlgButtonChecked( pInfo->hwndSs, CID_SS_CB_RouteIp );
  3499. //for whistler bug 213901
  3500. //
  3501. #ifndef _WIN64
  3502. pInfo->fIpx =
  3503. IsDlgButtonChecked( pInfo->hwndSs, CID_SS_CB_RouteIpx );
  3504. #else
  3505. pInfo->fIpx = FALSE;
  3506. #endif
  3507. pInfo->pArgs->fAddUser =
  3508. IsDlgButtonChecked( pInfo->hwndSs, CID_SS_CB_AddUser );
  3509. pInfo->pArgs->pEntry->fAuthenticateServer = FALSE;
  3510. pInfo->fClearPwOk =
  3511. IsDlgButtonChecked( pInfo->hwndSs, CID_SS_CB_PlainPw );
  3512. pInfo->fNotNt =
  3513. IsDlgButtonChecked( pInfo->hwndSs, CID_SS_CB_NotNt );
  3514. if (pInfo->fIp && !pInfo->fIpConfigured)
  3515. {
  3516. MsgDlg( pInfo->hwndDlg, SID_ConfigureIp, NULL );
  3517. SetFocus( GetDlgItem( pInfo->hwndSs, CID_SS_CB_RouteIp) );
  3518. return TRUE;
  3519. }
  3520. #ifndef _WIN64
  3521. if (pInfo->fIpx && !pInfo->fIpxConfigured)
  3522. {
  3523. MsgDlg( pInfo->hwndDlg, SID_ConfigureIpx, NULL );
  3524. SetFocus( GetDlgItem( pInfo->hwndSs, CID_SS_CB_RouteIpx) );
  3525. return TRUE;
  3526. }
  3527. #endif
  3528. return FALSE;
  3529. }
  3530. BOOL
  3531. SsSetActive(
  3532. IN AIINFO* pInfo )
  3533. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  3534. **
  3535. ** Returns true to display the page, false to skip it.
  3536. */
  3537. {
  3538. HWND hwndScript = GetDlgItem( pInfo->hwndSs, CID_SS_CB_NotNt );
  3539. HWND hwndPw = GetDlgItem( pInfo->hwndSs, CID_SS_CB_PlainPw );
  3540. //
  3541. // We only allow interactive scripting on modem devices
  3542. //
  3543. // (pmay: 378432. Same for PAP/SPAP)
  3544. //
  3545. if ( pInfo->pArgs->pEntry->dwType == RASET_Vpn )
  3546. {
  3547. Button_SetCheck( hwndScript, FALSE );
  3548. Button_SetCheck( hwndPw, FALSE );
  3549. EnableWindow( hwndScript, FALSE );
  3550. EnableWindow( hwndPw, FALSE );
  3551. }
  3552. else
  3553. {
  3554. EnableWindow( hwndScript, TRUE );
  3555. EnableWindow( hwndPw, TRUE );
  3556. }
  3557. //For PPPoE dont add a dial-in user account whistler 345068 349087 gangz
  3558. //
  3559. if ( RASET_Broadband == pInfo->pArgs->pEntry->dwType )
  3560. {
  3561. HWND hwndTmp = GetDlgItem( pInfo->hwndSs, CID_SS_CB_AddUser );
  3562. if (hwndTmp)
  3563. {
  3564. Button_SetCheck( hwndTmp, FALSE );
  3565. EnableWindow( hwndTmp, FALSE);
  3566. }
  3567. }
  3568. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  3569. return TRUE;
  3570. }
  3571. /*----------------------------------------------------------------------------
  3572. ** Vpn destination property page
  3573. ** Listed alphabetically following dialog proc
  3574. **----------------------------------------------------------------------------
  3575. */
  3576. INT_PTR CALLBACK
  3577. VdDlgProc(
  3578. IN HWND hwnd,
  3579. IN UINT unMsg,
  3580. IN WPARAM wparam,
  3581. IN LPARAM lparam )
  3582. /* DialogProc callback for the vpn destination page of the wizard.
  3583. ** Parameters and return value are as described for standard windows
  3584. ** 'DialogProc's.
  3585. */
  3586. {
  3587. switch (unMsg)
  3588. {
  3589. case WM_INITDIALOG:
  3590. return VdInit( hwnd );
  3591. case WM_NOTIFY:
  3592. {
  3593. switch (((NMHDR* )lparam)->code)
  3594. {
  3595. case PSN_SETACTIVE:
  3596. {
  3597. AIINFO* pInfo;
  3598. BOOL fDisplay;
  3599. TRACE("VdSETACTIVE");
  3600. pInfo = AiContext( hwnd );
  3601. ASSERT(pInfo);
  3602. if (pInfo == NULL)
  3603. {
  3604. break;
  3605. }
  3606. fDisplay = VdSetActive( pInfo );
  3607. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  3608. return TRUE;
  3609. }
  3610. case PSN_KILLACTIVE:
  3611. {
  3612. AIINFO* pInfo;
  3613. BOOL fInvalid;
  3614. TRACE("VdKILLACTIVE");
  3615. pInfo = AiContext( hwnd );
  3616. ASSERT(pInfo);
  3617. if (pInfo == NULL)
  3618. {
  3619. break;
  3620. }
  3621. fInvalid = VdKillActive( pInfo );
  3622. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  3623. return TRUE;
  3624. }
  3625. }
  3626. break;
  3627. }
  3628. }
  3629. return FALSE;
  3630. }
  3631. BOOL
  3632. VdInit(
  3633. IN HWND hwndPage )
  3634. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  3635. ** page.
  3636. **
  3637. ** Return false if focus was set, true otherwise.
  3638. */
  3639. {
  3640. DWORD dwErr;
  3641. AIINFO* pInfo = NULL;
  3642. PBENTRY* pEntry;
  3643. TRACE("InInit");
  3644. // Get the context of this page
  3645. pInfo = AiContext( hwndPage );
  3646. ASSERT ( pInfo );
  3647. // Set up the interface name stuff
  3648. //
  3649. //For prefix bug 226336 to validate the pInfo gangz
  3650. //
  3651. if(pInfo)
  3652. {
  3653. pInfo->hwndEbNumber =
  3654. GetDlgItem( hwndPage, CID_VD_EB_NameOrAddress );
  3655. // ASSERT(pInfo->hwndEbInterfaceName);
  3656. ASSERT(pInfo->hwndEbNumber);
  3657. Edit_LimitText( pInfo->hwndEbNumber, RAS_MaxPhoneNumber );
  3658. SetWindowText( pInfo->hwndEbNumber,
  3659. FirstPszFromList( pInfo->pListPhoneNumbers ) );
  3660. /* Initialize page-specific context information.
  3661. */
  3662. pInfo->hwndVd = hwndPage;
  3663. return TRUE;
  3664. }
  3665. else
  3666. {
  3667. return FALSE;
  3668. }
  3669. }
  3670. BOOL
  3671. VdKillActive(
  3672. IN AIINFO* pInfo )
  3673. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  3674. **
  3675. ** Returns true if the page is invalid, false is it can be dismissed.
  3676. */
  3677. {
  3678. // pmay: 226610. Call RpPhoneNumberToStash if we were successfully
  3679. // activated.
  3680. // If we're focused on an nt4 box, then this page is
  3681. // invalid (pptp was the only type)
  3682. if ( pInfo->pArgs->fNt4Router )
  3683. {
  3684. return FALSE;
  3685. }
  3686. // If we have no tunnel devices, then this page is invalid
  3687. else if ( ! (pInfo->dwFlags & AI_F_HasTunlDevs) )
  3688. {
  3689. return FALSE;
  3690. }
  3691. // If the connection type is not virtual, skip this page since the
  3692. // destination will be gotten from the phone number/PPPoE page.
  3693. if ( pInfo->pArgs->pEntry->dwType != RASET_Vpn )
  3694. {
  3695. return FALSE;
  3696. }
  3697. RpPhoneNumberToStash(pInfo);
  3698. return FALSE;
  3699. }
  3700. BOOL
  3701. VdSetActive(
  3702. IN AIINFO* pInfo )
  3703. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  3704. **
  3705. ** Returns true to display the page, false to skip it.
  3706. */
  3707. {
  3708. // If we're focused on an nt4 box, then this page is
  3709. // invalid (pptp was the only type)
  3710. if ( pInfo->pArgs->fNt4Router )
  3711. {
  3712. return FALSE;
  3713. }
  3714. // If we have no tunnel devices, then this page is invalid
  3715. else if ( ! (pInfo->dwFlags & AI_F_HasTunlDevs) )
  3716. {
  3717. return FALSE;
  3718. }
  3719. // If the connection type is not virtual, skip this page since the
  3720. // destination will be gotten from the phone number page.
  3721. if ( pInfo->pArgs->pEntry->dwType != RASET_Vpn )
  3722. {
  3723. return FALSE;
  3724. }
  3725. // Instruct the wizard to use the destination editbox for the
  3726. // phone number of this connection
  3727. pInfo->hwndEbNumber = GetDlgItem(pInfo->hwndVd, CID_VD_EB_NameOrAddress);
  3728. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  3729. return TRUE;
  3730. }
  3731. /*----------------------------------------------------------------------------
  3732. ** Vpn type property page
  3733. ** Listed alphabetically following dialog proc
  3734. **----------------------------------------------------------------------------
  3735. */
  3736. INT_PTR CALLBACK
  3737. VtDlgProc(
  3738. IN HWND hwnd,
  3739. IN UINT unMsg,
  3740. IN WPARAM wparam,
  3741. IN LPARAM lparam )
  3742. /* DialogProc callback for the vpn type page of the wizard.
  3743. ** Parameters and return value are as described for standard windows
  3744. ** 'DialogProc's.
  3745. */
  3746. {
  3747. switch (unMsg)
  3748. {
  3749. case WM_INITDIALOG:
  3750. return VtInit( hwnd );
  3751. case WM_NOTIFY:
  3752. {
  3753. switch (((NMHDR* )lparam)->code)
  3754. {
  3755. case PSN_SETACTIVE:
  3756. {
  3757. AIINFO* pInfo;
  3758. BOOL fDisplay;
  3759. TRACE("VtSETACTIVE");
  3760. pInfo = AiContext( hwnd );
  3761. ASSERT(pInfo);
  3762. if (pInfo == NULL)
  3763. {
  3764. break;
  3765. }
  3766. fDisplay = VtSetActive( pInfo );
  3767. SetWindowLong( hwnd, DWLP_MSGRESULT, (fDisplay) ? 0 : -1 );
  3768. return TRUE;
  3769. }
  3770. case PSN_KILLACTIVE:
  3771. {
  3772. AIINFO* pInfo;
  3773. BOOL fInvalid;
  3774. TRACE("VtKILLACTIVE");
  3775. pInfo = AiContext( hwnd );
  3776. ASSERT(pInfo);
  3777. if (pInfo == NULL)
  3778. {
  3779. break;
  3780. }
  3781. fInvalid = VtKillActive( pInfo );
  3782. SetWindowLong( hwnd, DWLP_MSGRESULT, fInvalid );
  3783. return TRUE;
  3784. }
  3785. }
  3786. break;
  3787. }
  3788. }
  3789. return FALSE;
  3790. }
  3791. BOOL
  3792. VtInit(
  3793. IN HWND hwndPage )
  3794. /* Called on WM_INITDIALOG. 'hwndPage' is the handle of the property
  3795. ** page.
  3796. **
  3797. ** Return false if focus was set, true otherwise.
  3798. */
  3799. {
  3800. AIINFO * pInfo;
  3801. // Get the context
  3802. pInfo = AiContext( hwndPage );
  3803. ASSERT ( pInfo );
  3804. if (pInfo == NULL)
  3805. {
  3806. return FALSE;
  3807. }
  3808. // Initialize the checks
  3809. pInfo->hwndVtRbAutomatic = GetDlgItem( hwndPage, CID_VT_RB_Automatic );
  3810. pInfo->hwndVtRbPptp = GetDlgItem( hwndPage, CID_VT_RB_Pptp );
  3811. pInfo->hwndVtRbL2tp = GetDlgItem( hwndPage, CID_VT_RB_L2tp );
  3812. ASSERT( pInfo->hwndVtRbAutomatic );
  3813. ASSERT( pInfo->hwndVtRbPptp );
  3814. ASSERT( pInfo->hwndVtRbL2tp );
  3815. // Default to automatic
  3816. Button_SetCheck( pInfo->hwndVtRbAutomatic, TRUE );
  3817. return FALSE;
  3818. }
  3819. BOOL
  3820. VtKillActive(
  3821. IN AIINFO* pInfo )
  3822. /* Called when PSN_KILLACTIVE is received. 'PInfo' is the wizard context.
  3823. **
  3824. ** Returns true if the page is invalid, false is it can be dismissed.
  3825. */
  3826. {
  3827. if ( Button_GetCheck( pInfo->hwndVtRbAutomatic ) )
  3828. {
  3829. pInfo->dwVpnStrategy = VS_Default;
  3830. }
  3831. else if ( Button_GetCheck( pInfo->hwndVtRbPptp ) )
  3832. {
  3833. pInfo->dwVpnStrategy = VS_PptpOnly;
  3834. }
  3835. else if ( Button_GetCheck( pInfo->hwndVtRbL2tp ) )
  3836. {
  3837. pInfo->dwVpnStrategy = VS_L2tpOnly;
  3838. }
  3839. return FALSE;
  3840. }
  3841. BOOL
  3842. VtSetActive(
  3843. IN AIINFO* pInfo )
  3844. /* Called when PSN_SETACTIVE is received. 'PInfo' is the wizard context.
  3845. **
  3846. ** Returns true to display the page, false to skip it.
  3847. */
  3848. {
  3849. // If we're focused on an nt4 box, then this page is
  3850. // invalid (pptp was the only type)
  3851. if ( pInfo->pArgs->fNt4Router )
  3852. {
  3853. return FALSE;
  3854. }
  3855. // If we have no tunnel devices, then this page is invalid
  3856. else if ( ! (pInfo->dwFlags & AI_F_HasTunlDevs) )
  3857. {
  3858. return FALSE;
  3859. }
  3860. // If the connection type is not virtual, skip this page since the
  3861. // destination will be gotten from the phone number page.
  3862. if ( pInfo->pArgs->pEntry->dwType != RASET_Vpn )
  3863. {
  3864. return FALSE;
  3865. }
  3866. PropSheet_SetWizButtons( pInfo->hwndDlg, PSWIZB_BACK | PSWIZB_NEXT );
  3867. return TRUE;
  3868. }