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.

919 lines
21 KiB

  1. /*
  2. File nettab.c
  3. Implementation of the ui behind the networking tab in the dialup server
  4. ui.
  5. Paul Mayfield 10/8/97.
  6. */
  7. #include <rassrv.h>
  8. // Help maps
  9. static const DWORD phmNetTab[] =
  10. {
  11. CID_NetTab_LV_Components, IDH_NetTab_LV_Components,
  12. CID_NetTab_PB_Add, IDH_NetTab_PB_Add,
  13. CID_NetTab_PB_Remove, IDH_NetTab_PB_Remove,
  14. CID_NetTab_PB_Properties, IDH_NetTab_PB_Properties,
  15. 0, 0
  16. };
  17. //
  18. // Fills in the property sheet structure with the information
  19. // required to display the networking tab.
  20. //
  21. DWORD
  22. NetTabGetPropertyPage(
  23. IN LPPROPSHEETPAGE ppage,
  24. IN LPARAM lpUserData)
  25. {
  26. // Initialize
  27. ZeroMemory(ppage, sizeof(PROPSHEETPAGE));
  28. // Fill in the values
  29. ppage->dwSize = sizeof(PROPSHEETPAGE);
  30. ppage->hInstance = Globals.hInstDll;
  31. ppage->pszTemplate = MAKEINTRESOURCE(PID_NetTab);
  32. ppage->pfnDlgProc = NetTabDialogProc;
  33. ppage->pfnCallback = RasSrvInitDestroyPropSheetCb;
  34. ppage->dwFlags = PSP_USECALLBACK;
  35. ppage->lParam = lpUserData;
  36. return NO_ERROR;
  37. }
  38. // Error reporting
  39. VOID
  40. NetTabDisplayError(
  41. IN HWND hwnd,
  42. IN DWORD dwErr)
  43. {
  44. ErrDisplayError(
  45. hwnd,
  46. dwErr,
  47. ERR_ADVANCEDTAB_CATAGORY,
  48. 0,
  49. Globals.dwErrorData);
  50. }
  51. //
  52. // Returns the index of an to display icon based on the
  53. // type of incoming connection.
  54. //
  55. INT
  56. NetTabGetIconIndex(
  57. IN DWORD dwType)
  58. {
  59. switch (dwType)
  60. {
  61. case NETCFGDB_SERVICE:
  62. return NI_Service;
  63. case NETCFGDB_CLIENT:
  64. return NI_Client;
  65. case NETCFGDB_PROTOCOL:
  66. return NI_Protocol;
  67. }
  68. return 0;
  69. }
  70. //
  71. // Sets up the UI so that the user is forced to complete the
  72. // config they've started. Triggered when a non-reversable option
  73. // is taken such as adding/removing a networking component.
  74. //
  75. DWORD
  76. NetTabDisableRollback(
  77. IN HWND hwndDlg)
  78. {
  79. DWORD dwErr, dwId = 0;
  80. do
  81. {
  82. dwErr = RasSrvGetPageId (hwndDlg, &dwId);
  83. if (dwErr != NO_ERROR)
  84. {
  85. break;
  86. }
  87. if (dwId == RASSRVUI_ADVANCED_TAB)
  88. {
  89. PropSheet_CancelToClose(GetParent(hwndDlg));
  90. }
  91. } while (FALSE);
  92. // Cleanup
  93. {
  94. }
  95. return dwErr;
  96. }
  97. //
  98. // Fills in the given list view with the names of the components
  99. // stored in the database provided.
  100. //
  101. DWORD
  102. NetTabFillComponentList(
  103. IN HWND hwndLV,
  104. IN HANDLE hNetCompDatabase)
  105. {
  106. LV_ITEM lvi;
  107. DWORD dwCount, i, dwErr, dwProtCount, dwType;
  108. PWCHAR pszName;
  109. BOOL bManip, bEnabled;
  110. // Get the count of all the components
  111. //
  112. dwErr = netDbGetCompCount (hNetCompDatabase, &dwCount);
  113. if (dwErr != NO_ERROR)
  114. {
  115. return dwErr;
  116. }
  117. // Initialize the list item
  118. ZeroMemory(&lvi, sizeof(LV_ITEM));
  119. lvi.mask = LVIF_TEXT | LVIF_IMAGE;
  120. // Looop through all of the network components
  121. // adding their names as we go
  122. for (i = 0; i < dwCount; i++)
  123. {
  124. netDbGetType (hNetCompDatabase, i, &dwType);
  125. netDbIsRasManipulatable (hNetCompDatabase, i, &bManip);
  126. netDbGetEnable (hNetCompDatabase, i, &bEnabled);
  127. // Fill in the data
  128. //
  129. netDbGetName (hNetCompDatabase, i, &pszName);
  130. lvi.iImage = NetTabGetIconIndex(dwType);
  131. lvi.iItem = i;
  132. lvi.pszText = pszName;
  133. lvi.cchTextMax = wcslen(pszName)+1;
  134. ListView_InsertItem(hwndLV,&lvi);
  135. ListView_SetCheck(hwndLV, i, bEnabled);
  136. // If this is not a ras manipulateable component,
  137. // disable the check since it can't be set anyway.
  138. if (!bManip)
  139. {
  140. ListView_DisableCheck(hwndLV, i);
  141. }
  142. }
  143. return NO_ERROR;
  144. }
  145. //
  146. // Updates the description of the currently selected protocol
  147. //
  148. DWORD
  149. NetTabUpdateDescription(
  150. IN HWND hwndDlg,
  151. IN DWORD i)
  152. {
  153. HANDLE hNetCompDatabase = NULL, hProt = NULL;
  154. PWCHAR pszDesc;
  155. DWORD dwErr = NO_ERROR;
  156. // Get handles to the databases we're interested in
  157. RasSrvGetDatabaseHandle(
  158. hwndDlg,
  159. ID_NETCOMP_DATABASE,
  160. &hNetCompDatabase);
  161. do
  162. {
  163. dwErr = netDbGetDesc(hNetCompDatabase, i, &pszDesc);
  164. if (dwErr != NO_ERROR)
  165. {
  166. break;
  167. }
  168. // Set the description
  169. SetDlgItemTextW(
  170. hwndDlg,
  171. CID_NetTab_ST_Description,
  172. pszDesc);
  173. } while (FALSE);
  174. // Cleanup
  175. {
  176. if (dwErr != NO_ERROR)
  177. {
  178. SetDlgItemTextW(
  179. hwndDlg,
  180. CID_NetTab_ST_Description,
  181. L"");
  182. }
  183. }
  184. return dwErr;
  185. }
  186. //
  187. //When an Item in the listview is selected, check if the user can Uninstall it
  188. //for whistler bug 347355 gangz
  189. //
  190. DWORD
  191. NetTabEnableDisableRemoveButton (
  192. IN HWND hwndDlg,
  193. IN DWORD iItem)
  194. {
  195. HANDLE hNetCompDatabase = NULL;
  196. DWORD dwErr;
  197. HWND hwndRemove = NULL;
  198. BOOL bHasPermit = FALSE;
  199. if ( !hwndDlg )
  200. {
  201. return ERROR_INVALID_PARAMETER;
  202. }
  203. hwndRemove = GetDlgItem(hwndDlg, CID_NetTab_PB_Remove);
  204. dwErr = RasSrvGetDatabaseHandle(
  205. hwndDlg,
  206. ID_NETCOMP_DATABASE,
  207. &hNetCompDatabase);
  208. if ( NO_ERROR != dwErr ||
  209. NULL == hwndRemove )
  210. {
  211. return ERROR_CAN_NOT_COMPLETE;
  212. }
  213. dwErr = netDbHasRemovePermission(
  214. hNetCompDatabase,
  215. iItem,
  216. &bHasPermit);
  217. if( NO_ERROR == dwErr )
  218. {
  219. EnableWindow( hwndRemove, bHasPermit);
  220. }
  221. return dwErr;
  222. }
  223. //
  224. // Enables or disables the properties button based on whether
  225. // the index of the given item in the list view can have properties
  226. // invoked on it. Currently, only non-ras-manaipulatable protocols
  227. // can not have their properties invoked.
  228. //
  229. DWORD
  230. NetTabEnableDisablePropButton(
  231. IN HWND hwndDlg,
  232. IN INT iItem)
  233. {
  234. HANDLE hNetCompDatabase = NULL;
  235. DWORD dwErr;
  236. BOOL bHasUi;
  237. // Get a reference to the network component database
  238. //
  239. RasSrvGetDatabaseHandle(
  240. hwndDlg,
  241. ID_NETCOMP_DATABASE,
  242. &hNetCompDatabase);
  243. // Get the type and whether it is manipulatable
  244. //
  245. dwErr = netDbHasPropertiesUI (hNetCompDatabase, iItem, &bHasUi);
  246. if (dwErr != NO_ERROR)
  247. {
  248. return dwErr;
  249. }
  250. // Enable or disable properties
  251. EnableWindow(
  252. GetDlgItem(hwndDlg, CID_NetTab_PB_Properties),
  253. bHasUi);
  254. return NO_ERROR;
  255. }
  256. //
  257. // Refreshes the list view
  258. //
  259. DWORD
  260. NetTabRefreshListView(
  261. IN HWND hwndLV,
  262. IN HANDLE hNetCompDatabase)
  263. {
  264. DWORD dwCount, dwErr;
  265. HWND hwndDlg = GetParent(hwndLV);
  266. // Get rid of all of the old elements in the list view
  267. //
  268. ListView_DeleteAllItems(hwndLV);
  269. // Re-stock the list views
  270. //
  271. dwErr = NetTabFillComponentList(hwndLV, hNetCompDatabase);
  272. if (dwErr != NO_ERROR)
  273. {
  274. return dwErr;
  275. }
  276. // Select the first protocol in the list view if any items exist.
  277. // Also in this case, make sure that "remove" is enabled/disabled
  278. // according to the the first item in the list view
  279. //
  280. netDbGetCompCount(hNetCompDatabase, &dwCount);
  281. if (dwCount)
  282. {
  283. ListView_SetItemState(
  284. hwndLV,
  285. 0,
  286. LVIS_SELECTED | LVIS_FOCUSED,
  287. LVIS_SELECTED | LVIS_FOCUSED);
  288. //for whistler bug 406698 gangz
  289. //
  290. NetTabEnableDisableRemoveButton (
  291. hwndDlg,
  292. 0);
  293. }
  294. // If there are no components, disable the properties
  295. // and remove buttons
  296. else
  297. {
  298. EnableWindow(
  299. GetDlgItem(hwndDlg, CID_NetTab_PB_Properties),
  300. FALSE);
  301. EnableWindow(
  302. GetDlgItem(hwndDlg, CID_NetTab_PB_Remove),
  303. FALSE);
  304. }
  305. return NO_ERROR;
  306. }
  307. //
  308. // Initializes the networking tab. By now a handle to the advanced
  309. // database has been placed in the user data of the dialog
  310. //
  311. DWORD
  312. NetTabInitializeDialog(
  313. HWND hwndDlg,
  314. WPARAM wParam)
  315. {
  316. DWORD dwErr, dwCount, i;
  317. BOOL bFlag;
  318. HANDLE hNetCompDatabase = NULL, hMiscDatabase = NULL;
  319. HWND hwndLV;
  320. LV_COLUMN lvc;
  321. BOOL bExpose = FALSE, bIsServer;
  322. // Get handles to the databases we're interested in
  323. //
  324. RasSrvGetDatabaseHandle(
  325. hwndDlg,
  326. ID_MISC_DATABASE,
  327. &hMiscDatabase);
  328. RasSrvGetDatabaseHandle(
  329. hwndDlg,
  330. ID_NETCOMP_DATABASE,
  331. &hNetCompDatabase);
  332. // Fill in the list view will all available protocols followed
  333. // by all of the installed network components.
  334. //
  335. hwndLV = GetDlgItem(hwndDlg, CID_NetTab_LV_Components);
  336. ListView_InstallChecks(hwndLV, Globals.hInstDll);
  337. ListView_SetNetworkComponentImageList(hwndLV, Globals.hInstDll);
  338. // Fill the list view
  339. NetTabRefreshListView(hwndLV, hNetCompDatabase);
  340. //for whistler bug 347355 gangz
  341. //
  342. NetTabEnableDisablePropButton(
  343. hwndDlg,
  344. 0);
  345. NetTabEnableDisableRemoveButton (
  346. hwndDlg,
  347. 0);
  348. // Add a colum so that we'll display in report view
  349. lvc.mask = LVCF_FMT;
  350. lvc.fmt = LVCFMT_LEFT;
  351. ListView_InsertColumn(hwndLV,0,&lvc);
  352. ListView_SetColumnWidth(hwndLV, 0, LVSCW_AUTOSIZE_USEHEADER);
  353. return NO_ERROR;
  354. }
  355. // Handles a check being made
  356. DWORD
  357. NetTabHandleProtCheck(
  358. IN HWND hwndDlg,
  359. IN DWORD dwIndex)
  360. {
  361. BOOL bEnable = FALSE, bEnabled = FALSE;
  362. DWORD dwErr = NO_ERROR, dwId = 0;
  363. HANDLE hNetCompDatabase = NULL;
  364. HWND hwndLV =
  365. GetDlgItem(hwndDlg, CID_NetTab_LV_Components);
  366. MSGARGS MsgArgs;
  367. INT iRet;
  368. PWCHAR pszName = NULL;
  369. // Initailize the message arguments
  370. //
  371. ZeroMemory(&MsgArgs, sizeof(MsgArgs));
  372. // Find out whether the component is being enabled or
  373. // disabled
  374. bEnable = !!ListView_GetCheck(hwndLV, dwIndex);
  375. // Get the handle for the Prot database
  376. //
  377. RasSrvGetDatabaseHandle(
  378. hwndDlg,
  379. ID_NETCOMP_DATABASE,
  380. &hNetCompDatabase);
  381. // Get component id
  382. //
  383. dwErr = netDbGetId(
  384. hNetCompDatabase,
  385. dwIndex,
  386. &dwId);
  387. if (dwErr != NO_ERROR)
  388. {
  389. return dwErr;
  390. }
  391. // Get component name
  392. //
  393. dwErr = netDbGetName(
  394. hNetCompDatabase,
  395. dwIndex,
  396. &pszName);
  397. if (dwErr != NO_ERROR)
  398. {
  399. return dwErr;
  400. }
  401. // Get component enabling
  402. //
  403. dwErr = netDbGetEnable(
  404. hNetCompDatabase,
  405. dwIndex,
  406. &bEnabled);
  407. if (dwErr != NO_ERROR)
  408. {
  409. return dwErr;
  410. }
  411. // If F&P is being unchecked, then popup the mmc warning
  412. //
  413. if ((dwId == NETCFGDB_ID_FILEPRINT) &&
  414. (bEnable == FALSE) &&
  415. (bEnabled == TRUE))
  416. {
  417. // Ask the user whether we should bring up the
  418. // mmc console to allow him/her to stop FPS.
  419. //
  420. MsgArgs.apszArgs[0] = pszName;
  421. MsgArgs.dwFlags = MB_YESNO;
  422. iRet = MsgDlgUtil(
  423. GetActiveWindow(),
  424. SID_STOP_FP_SERVICE,
  425. &MsgArgs,
  426. Globals.hInstDll,
  427. WRN_TITLE);
  428. // If the user agrees, bring up the console
  429. //
  430. if (iRet == IDYES)
  431. {
  432. dwErr = RassrvLaunchMMC(RASSRVUI_SERVICESCONSOLE);
  433. if (dwErr != NO_ERROR)
  434. {
  435. return dwErr;
  436. }
  437. }
  438. }
  439. // If F&P is not being unchecked, treat the component
  440. // normally.
  441. //
  442. else
  443. {
  444. // Update the check
  445. dwErr = netDbSetEnable(hNetCompDatabase, dwIndex, bEnable);
  446. if (dwErr != NO_ERROR)
  447. {
  448. return dwErr;
  449. }
  450. }
  451. return NO_ERROR;
  452. }
  453. //
  454. // Adds networking components
  455. //
  456. DWORD
  457. NetTabAddComponent(
  458. IN HWND hwndDlg)
  459. {
  460. HANDLE hNetCompDatabase = NULL;
  461. DWORD dwErr;
  462. RasSrvGetDatabaseHandle(
  463. hwndDlg,
  464. ID_NETCOMP_DATABASE,
  465. &hNetCompDatabase);
  466. dwErr = netDbRaiseInstallDialog(hNetCompDatabase, hwndDlg);
  467. if (dwErr == NO_ERROR || dwErr == NETCFG_S_REBOOT)
  468. {
  469. NetTabRefreshListView(
  470. GetDlgItem(hwndDlg, CID_NetTab_LV_Components),
  471. hNetCompDatabase);
  472. NetTabDisableRollback(hwndDlg);
  473. }
  474. if (dwErr == NETCFG_S_REBOOT)
  475. {
  476. RasSrvReboot(hwndDlg);
  477. }
  478. return dwErr;
  479. }
  480. //
  481. // Removes networking components
  482. //
  483. DWORD
  484. NetTabRemoveComponent(
  485. IN HWND hwndDlg,
  486. IN DWORD dwIndex)
  487. {
  488. HANDLE hNetCompDatabase = NULL;
  489. DWORD dwCount, dwErr;
  490. RasSrvGetDatabaseHandle(
  491. hwndDlg,
  492. ID_NETCOMP_DATABASE,
  493. &hNetCompDatabase);
  494. // or else, remove the requested component
  495. //
  496. dwErr = netDbRaiseRemoveDialog(
  497. hNetCompDatabase,
  498. dwIndex,
  499. hwndDlg);
  500. if (dwErr == NO_ERROR || dwErr == NETCFG_S_REBOOT)
  501. {
  502. NetTabRefreshListView(
  503. GetDlgItem(hwndDlg, CID_NetTab_LV_Components),
  504. hNetCompDatabase);
  505. NetTabDisableRollback(hwndDlg);
  506. }
  507. if (dwErr == NETCFG_S_REBOOT)
  508. {
  509. RasSrvReboot(hwndDlg);
  510. }
  511. return dwErr;
  512. }
  513. // Edits network component properties
  514. //
  515. DWORD
  516. NetTabEditProperties(
  517. IN HWND hwndDlg,
  518. IN DWORD dwIndex)
  519. {
  520. HANDLE hNetCompDatabase = NULL;
  521. DWORD dwCount, dwErr;
  522. RasSrvGetDatabaseHandle(
  523. hwndDlg,
  524. ID_NETCOMP_DATABASE,
  525. &hNetCompDatabase);
  526. dwErr = netDbRaisePropertiesDialog (
  527. hNetCompDatabase,
  528. dwIndex,
  529. hwndDlg);
  530. if (dwErr == NETCFG_S_REBOOT)
  531. {
  532. RasSrvReboot(hwndDlg);
  533. }
  534. return dwErr;
  535. }
  536. //
  537. // Switch to mmc
  538. //
  539. DWORD
  540. NetTabSwitchToMMC(
  541. IN HWND hwndDlg)
  542. {
  543. if (RassrvWarnMMCSwitch(hwndDlg))
  544. {
  545. // Commit the changes to this property sheet
  546. // and close it
  547. PropSheet_PressButton(GetParent(hwndDlg), PSBTN_OK);
  548. return RassrvLaunchMMC(RASSRVUI_NETWORKCONSOLE);
  549. }
  550. return ERROR_CANCELLED;
  551. }
  552. //
  553. // Handles the activation call
  554. //
  555. BOOL
  556. NetTabSetActive(
  557. IN HWND hwndDlg,
  558. IN WPARAM wParam)
  559. {
  560. HANDLE hNetCompDatabase = NULL;
  561. DWORD dwErr;
  562. BOOL bRet = FALSE;
  563. PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
  564. RasSrvGetDatabaseHandle(
  565. hwndDlg,
  566. ID_NETCOMP_DATABASE,
  567. &hNetCompDatabase);
  568. if (! netDbIsLoaded(hNetCompDatabase))
  569. {
  570. dwErr = netDbLoad(hNetCompDatabase);
  571. if (dwErr == NO_ERROR)
  572. {
  573. NetTabInitializeDialog(
  574. hwndDlg,
  575. wParam);
  576. }
  577. else
  578. {
  579. NetTabDisplayError(
  580. hwndDlg,
  581. ERR_CANT_SHOW_NETTAB_INETCFG);
  582. // reject activation
  583. SetWindowLongPtr(
  584. hwndDlg,
  585. DWLP_MSGRESULT,
  586. -1);
  587. bRet = TRUE;
  588. }
  589. }
  590. PropSheet_SetWizButtons(
  591. GetParent(hwndDlg),
  592. PSWIZB_NEXT | PSWIZB_BACK);
  593. return bRet;
  594. }
  595. //
  596. // When the net tab receives WM_ACTIVATE, it means that
  597. // the user left the IC property sheet/wizard and is now coming back
  598. // to it. Since this occurs when switching to MMC update the UI as
  599. // here appropriate.
  600. //
  601. DWORD
  602. NetTabActivate(
  603. IN HWND hwndDlg,
  604. IN WPARAM wParam)
  605. {
  606. HANDLE hNetCompDatabase = NULL;
  607. DWORD dwErr = NO_ERROR;
  608. if (LOWORD(wParam) == WA_INACTIVE)
  609. {
  610. return NO_ERROR;
  611. }
  612. DbgOutputTrace("NetTabActivate: updating components.");
  613. // Get the database handle
  614. //
  615. dwErr = RasSrvGetDatabaseHandle(
  616. hwndDlg,
  617. ID_NETCOMP_DATABASE,
  618. &hNetCompDatabase);
  619. if (dwErr != NO_ERROR)
  620. {
  621. return dwErr;
  622. }
  623. // Update the appropriate components
  624. //
  625. dwErr = netDbReloadComponent(hNetCompDatabase, NETCFGDB_ID_FILEPRINT);
  626. if (dwErr != NO_ERROR)
  627. {
  628. return dwErr;
  629. }
  630. // Refresh the net component list view
  631. //
  632. NetTabRefreshListView(
  633. GetDlgItem(hwndDlg, CID_NetTab_LV_Components),
  634. hNetCompDatabase);
  635. return NO_ERROR;
  636. }
  637. //
  638. // Handles commands
  639. //
  640. DWORD
  641. NetTabCommand(
  642. IN HWND hwndDlg,
  643. IN WPARAM wParam)
  644. {
  645. switch (wParam)
  646. {
  647. case CID_NetTab_PB_Properties:
  648. NetTabEditProperties(
  649. hwndDlg,
  650. ListView_GetSelectionMark(
  651. GetDlgItem(hwndDlg, CID_NetTab_LV_Components)));
  652. break;
  653. case CID_NetTab_PB_Add:
  654. NetTabAddComponent(hwndDlg);
  655. break;
  656. case CID_NetTab_PB_Remove:
  657. NetTabRemoveComponent(
  658. hwndDlg,
  659. ListView_GetSelectionMark(
  660. GetDlgItem(hwndDlg, CID_NetTab_LV_Components)));
  661. break;
  662. case CID_NetTab_PB_SwitchToMMC:
  663. NetTabSwitchToMMC(hwndDlg);
  664. break;
  665. }
  666. return NO_ERROR;
  667. }
  668. //
  669. // This is the dialog procedure that responds to messages sent
  670. // to the networking tab.
  671. //
  672. INT_PTR
  673. CALLBACK
  674. NetTabDialogProc(
  675. HWND hwndDlg,
  676. UINT uMsg,
  677. WPARAM wParam,
  678. LPARAM lParam)
  679. {
  680. // Filter the customized list view messages
  681. if (ListView_OwnerHandler(
  682. hwndDlg,
  683. uMsg,
  684. wParam,
  685. lParam,
  686. LvDrawInfoCallback )
  687. )
  688. {
  689. return TRUE;
  690. }
  691. // Filter the customized ras server ui page messages.
  692. // By filtering messages through here, we are able to
  693. // call RasSrvGetDatabaseHandle below
  694. //
  695. if (RasSrvMessageFilter(hwndDlg, uMsg, wParam, lParam))
  696. {
  697. return TRUE;
  698. }
  699. switch (uMsg)
  700. {
  701. case WM_INITDIALOG:
  702. return 0;
  703. case WM_HELP:
  704. case WM_CONTEXTMENU:
  705. {
  706. RasSrvHelp (hwndDlg, uMsg, wParam, lParam, phmNetTab);
  707. break;
  708. }
  709. case WM_NOTIFY:
  710. {
  711. NMHDR* pNotifyData;
  712. NM_LISTVIEW* pLvNotifyData;
  713. pNotifyData = (NMHDR*)lParam;
  714. switch (pNotifyData->code)
  715. {
  716. //
  717. // Note: PSN_APPLY and PSN_CANCEL are handled
  718. // by RasSrvMessageFilter
  719. //
  720. // The item focus is changing -- update the
  721. // protocol description
  722. case LVN_ITEMCHANGING:
  723. pLvNotifyData = (NM_LISTVIEW*)lParam;
  724. if (pLvNotifyData->uNewState & LVIS_SELECTED)
  725. {
  726. NetTabUpdateDescription(
  727. hwndDlg,
  728. pLvNotifyData->iItem);
  729. NetTabEnableDisablePropButton(
  730. hwndDlg,
  731. pLvNotifyData->iItem);
  732. //for whistler bug 347355 gangz
  733. //
  734. NetTabEnableDisableRemoveButton (
  735. hwndDlg,
  736. (DWORD)pLvNotifyData->iItem);
  737. }
  738. break;
  739. // The check of an item is changing
  740. case LVXN_SETCHECK:
  741. pLvNotifyData = (NM_LISTVIEW*)lParam;
  742. NetTabHandleProtCheck(
  743. hwndDlg,
  744. (DWORD)pLvNotifyData->iItem);
  745. break;
  746. case LVXN_DBLCLK:
  747. pLvNotifyData = (NM_LISTVIEW*)lParam;
  748. NetTabEditProperties(
  749. hwndDlg,
  750. pLvNotifyData->iItem);
  751. break;
  752. // The networking tab is becoming active.
  753. // Attempt to load the netcfg database at
  754. // this time. If unsuccessful, pop up a
  755. // message and don't allow the activation.
  756. case PSN_SETACTIVE:
  757. return NetTabSetActive(hwndDlg, wParam);
  758. break;
  759. }
  760. }
  761. break;
  762. case WM_ACTIVATE:
  763. NetTabActivate(hwndDlg, wParam);
  764. break;
  765. case WM_COMMAND:
  766. NetTabCommand(hwndDlg, wParam);
  767. break;
  768. }
  769. return FALSE;
  770. }