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.

847 lines
24 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // tcpipip.c
  8. //
  9. // Description:
  10. //
  11. //----------------------------------------------------------------------------
  12. #include "pch.h"
  13. #include "resource.h"
  14. #include "tcpip.h"
  15. //----------------------------------------------------------------------------
  16. //
  17. // Function: ChangeIPDlgProc
  18. //
  19. // Purpose: Dialog procedure for allowing the user to add or edit an IP and Subnet Mask
  20. //
  21. // Arguments: standard Win32 dialog proc arguments
  22. //
  23. // Returns:
  24. //
  25. //----------------------------------------------------------------------------
  26. INT_PTR CALLBACK
  27. ChangeIPDlgProc( IN HWND hwnd,
  28. IN UINT uMsg,
  29. IN WPARAM wParam,
  30. IN LPARAM lParam) {
  31. BOOL bStatus = TRUE;
  32. HWND hIPEditBox = GetDlgItem( hwnd, IDC_IPADDR_ADV_CHANGEIP_IP );
  33. HWND hSubnetEditBox = GetDlgItem( hwnd, IDC_IPADDR_ADV_CHANGEIP_SUB );
  34. switch( uMsg ) {
  35. case WM_INITDIALOG: {
  36. SetWindowText( hIPEditBox, szIPString );
  37. SetWindowText( hSubnetEditBox, szSubnetMask );
  38. SetFocus( hIPEditBox );
  39. bStatus = FALSE; // return FALSE, we set the keyboard focus
  40. break;
  41. }
  42. case WM_COMMAND: {
  43. int nButtonId = LOWORD( wParam );
  44. switch ( nButtonId ) {
  45. case IDOK: {
  46. // return a 1 to show an IP was added
  47. GetWindowText( hIPEditBox, szIPString, IPSTRINGLENGTH+1 );
  48. GetWindowText( hSubnetEditBox, szSubnetMask, IPSTRINGLENGTH+1 );
  49. EndDialog( hwnd, 1 );
  50. break;
  51. }
  52. case IDCANCEL: {
  53. // return a 0 to show no IP was added
  54. EndDialog( hwnd, 0 );
  55. break;
  56. }
  57. }
  58. }
  59. default:
  60. bStatus = FALSE;
  61. break;
  62. }
  63. return bStatus;
  64. }
  65. //----------------------------------------------------------------------------
  66. //
  67. // Function: SetGatewayInitialValues
  68. //
  69. // Purpose: To set the initial contents of the Gateway list box
  70. //
  71. // Arguments: IN HWND hwnd - handle to the dialog
  72. //
  73. // Returns: VOID
  74. //
  75. //----------------------------------------------------------------------------
  76. VOID
  77. SetGatewayInitialValues( IN HWND hwnd ) {
  78. INT i;
  79. INT nEntries;
  80. TCHAR *pString;
  81. nEntries = GetNameListSize( &NetSettings.pCurrentAdapter->Tcpip_GatewayAddresses );
  82. //
  83. // Iterate over the Gateway namelist adding each one to the Gateway List box
  84. //
  85. for( i = 0; i < nEntries; i++ ) {
  86. pString = GetNameListName( &NetSettings.pCurrentAdapter->Tcpip_GatewayAddresses, i );
  87. SendDlgItemMessage( hwnd,
  88. IDC_IPADDR_GATE,
  89. LB_ADDSTRING,
  90. 0,
  91. (LPARAM) pString );
  92. }
  93. //
  94. // select the first entry
  95. //
  96. SendDlgItemMessage( hwnd,
  97. IDC_IPADDR_GATE,
  98. LB_SETCURSEL,
  99. 0,
  100. 0 );
  101. }
  102. //----------------------------------------------------------------------------
  103. //
  104. // Function: InsertItemIntoTcpipListView
  105. //
  106. // Purpose: hListView is the handle to the list view the IPStruct is to be
  107. // added to
  108. // position designates the position in the list view the item is to
  109. // be inserted in
  110. //
  111. // Arguments:
  112. //
  113. // Returns: TRUE if the insert succeeded,
  114. // FALSE if it failed
  115. //
  116. //----------------------------------------------------------------------------
  117. // ISSUE-2002/02/28-stelo- move this to tcpipcom.c because optional uses it too. Should also be
  118. // renamed??
  119. BOOL
  120. InsertItemIntoTcpipListView( HWND hListView,
  121. LPARAM lParam,
  122. UINT position ) {
  123. LVITEM lvI;
  124. lvI.mask = LVIF_TEXT | LVIF_PARAM;
  125. lvI.iItem = position;
  126. lvI.iSubItem = 0;
  127. lvI.pszText = LPSTR_TEXTCALLBACK;
  128. lvI.cchTextMax = MAX_ITEMLEN;
  129. lvI.lParam = lParam;
  130. //
  131. // if ListView_InsertItem returns a non-negative value then it succeeded
  132. //
  133. if( ListView_InsertItem( hListView, &lvI ) >= 0 )
  134. return( TRUE ) ;
  135. // insertion failed
  136. return( FALSE ) ;
  137. }
  138. //----------------------------------------------------------------------------
  139. //
  140. // Function: SetIPandSubnetMaskInitialValues
  141. //
  142. // Purpose:
  143. //
  144. // Arguments:
  145. //
  146. // Returns:
  147. //
  148. //----------------------------------------------------------------------------
  149. VOID
  150. SetIPandSubnetMaskInitialValues( IN HWND hwnd ) {
  151. INT i;
  152. INT nEntries;
  153. LPTSTR pszIPAddress;
  154. LPTSTR pszSubnetMask;
  155. HWND hTcpipListView;
  156. hTcpipListView = GetDlgItem( hwnd, IDC_IPADDR_ADVIP );
  157. if( NetSettings.pCurrentAdapter->bObtainIPAddressAutomatically == TRUE ) {
  158. //
  159. // allocate space for the IP struct
  160. //
  161. IPStruct = malloc( sizeof(IP_STRUCT) );
  162. if (IPStruct == NULL)
  163. {
  164. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  165. }
  166. lstrcpyn( IPStruct->szIPString, StrDhcpEnabled, AS(IPStruct->szIPString) );
  167. // force the subnet mask field to be blank
  168. lstrcpyn( IPStruct->szSubnetMask, _T(""), AS(IPStruct->szSubnetMask) );
  169. //
  170. // use an IP_STRUCT to pass the data, the name is somewhat misleading
  171. // because we are not passing in an IP address in this case
  172. //
  173. InsertItemIntoTcpipListView( hTcpipListView,
  174. (LPARAM) IPStruct, 0 );
  175. //
  176. // Grey-out the Add, Edit and Remove buttons since none of these are
  177. // available to the user when DHCP is enabled
  178. //
  179. EnableWindow( GetDlgItem( hwnd, IDC_IPADDR_ADDIP ), FALSE );
  180. EnableWindow( GetDlgItem( hwnd, IDC_IPADDR_EDITIP ), FALSE );
  181. EnableWindow( GetDlgItem( hwnd, IDC_IPADDR_REMOVEIP ), FALSE );
  182. }
  183. else {
  184. nEntries = GetNameListSize( &NetSettings.pCurrentAdapter->Tcpip_IpAddresses );
  185. if( nEntries == 0 ) {
  186. //
  187. // Grey-out the Edit and Remove buttons since these are not
  188. // available when there are no items in the ListView
  189. //
  190. EnableWindow( GetDlgItem( hwnd, IDC_IPADDR_EDITIP ), FALSE );
  191. EnableWindow( GetDlgItem( hwnd, IDC_IPADDR_REMOVEIP ), FALSE );
  192. }
  193. for( i = 0; i < nEntries; i = i++ ) {
  194. // allocate space for the IP struct
  195. IPStruct = malloc( sizeof(IP_STRUCT) );
  196. if ( IPStruct == NULL ) {
  197. TerminateTheWizard( IDS_ERROR_OUTOFMEMORY );
  198. }
  199. pszIPAddress = GetNameListName(
  200. &NetSettings.pCurrentAdapter->Tcpip_IpAddresses, i );
  201. lstrcpyn( IPStruct->szIPString, pszIPAddress, AS(IPStruct->szIPString) );
  202. pszSubnetMask = GetNameListName(
  203. &NetSettings.pCurrentAdapter->Tcpip_SubnetMaskAddresses, i );
  204. lstrcpyn( IPStruct->szSubnetMask, pszSubnetMask, AS(IPStruct->szSubnetMask) );
  205. InsertItemIntoTcpipListView( hTcpipListView, (LPARAM) IPStruct, i );
  206. }
  207. }
  208. }
  209. //----------------------------------------------------------------------------
  210. //
  211. // Function: OnTcpipIpInitDialog
  212. //
  213. // Purpose: loads button bitmaps from resources and initializes the list view
  214. //
  215. // Arguments: IN HWND hwnd - handle to the dialog
  216. //
  217. // Returns: VOID
  218. //
  219. //----------------------------------------------------------------------------
  220. VOID
  221. OnTcpipIpInitDialog( IN HWND hwnd ) {
  222. LV_COLUMN lvCol; // list view column structure
  223. INT iIndex;
  224. INT iNewItem;
  225. INT nEntries;
  226. INT colWidth;
  227. RECT rect;
  228. HWND hGatewayEditButton;
  229. HWND hGatewayRemoveButton;
  230. HWND hTcpipListView;
  231. //
  232. // Load strings from resources
  233. //
  234. StrDhcpEnabled = MyLoadString( IDS_DHCP_ENABLED );
  235. StrIpAddress = MyLoadString( IDS_IP_ADDRESS );
  236. StrSubnetMask = MyLoadString( IDS_SUBNET_MASK );
  237. hTcpipListView = GetDlgItem( hwnd, IDC_IPADDR_ADVIP );
  238. //
  239. // This will always be the first page of the property sheet
  240. // displayed so load the up and down icons and store the handles
  241. // in global variables
  242. //
  243. if ( ! g_hIconUpArrow && ! g_hIconDownArrow ) {
  244. g_hIconUpArrow = (HICON)LoadImage(FixedGlobals.hInstance,
  245. MAKEINTRESOURCE(IDI_UP_ARROW),
  246. IMAGE_ICON, 16, 16, 0);
  247. g_hIconDownArrow = (HICON)LoadImage(FixedGlobals.hInstance,
  248. MAKEINTRESOURCE(IDI_DOWN_ARROW),
  249. IMAGE_ICON, 16, 16, 0);
  250. }
  251. // Place up/down arrow icons on buttons
  252. SendDlgItemMessage( hwnd,
  253. IDC_IPADDR_UP,
  254. BM_SETIMAGE,
  255. (WPARAM)IMAGE_ICON,
  256. (LPARAM)g_hIconUpArrow );
  257. SendDlgItemMessage( hwnd,
  258. IDC_IPADDR_DOWN,
  259. BM_SETIMAGE,
  260. (WPARAM)IMAGE_ICON,
  261. (LPARAM)g_hIconDownArrow );
  262. // Calculate column width
  263. GetClientRect( hTcpipListView, &rect );
  264. colWidth = ( rect.right / cIPSettingsColumns );
  265. for( iIndex = 0; iIndex < cIPSettingsColumns; iIndex++ ) {
  266. ListView_SetColumnWidth( hTcpipListView, iIndex, colWidth );
  267. }
  268. // The mask specifies that the fmt, width and pszText members
  269. // of the structure are valid
  270. lvCol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT ;
  271. lvCol.fmt = LVCFMT_LEFT; // left-align column
  272. lvCol.cx = colWidth; // width of column in pixels
  273. // Add the two columns and header text
  274. for( iIndex = 0; iIndex < cIPSettingsColumns; iIndex++ ) {
  275. // column header text
  276. if ( iIndex == 0 ) // first column
  277. lvCol.pszText = (LPTSTR) StrIpAddress;
  278. else
  279. lvCol.pszText = (LPTSTR) StrSubnetMask;
  280. iNewItem = ListView_InsertColumn( hTcpipListView, iIndex, &lvCol );
  281. }
  282. // fill the IP and Subnet mask list box with the appropriate
  283. // initial value(s)
  284. SetIPandSubnetMaskInitialValues( hwnd );
  285. // fill the gateway list box with the appropriate initial value(s)
  286. SetGatewayInitialValues( hwnd );
  287. hGatewayEditButton = GetDlgItem( hwnd, IDC_IPADDR_EDITGATE );
  288. hGatewayRemoveButton = GetDlgItem( hwnd, IDC_IPADDR_REMOVEGATE );
  289. SetButtons( GetDlgItem( hwnd, IDC_IPADDR_GATE ),
  290. hGatewayEditButton,
  291. hGatewayRemoveButton );
  292. SetArrows( hwnd,
  293. IDC_IPADDR_GATE,
  294. IDC_IPADDR_UP,
  295. IDC_IPADDR_DOWN );
  296. }
  297. //----------------------------------------------------------------------------
  298. //
  299. // Function: OnTcpipIpApply
  300. //
  301. // Purpose: stores the contents on the TCP/IP advanced IP address page into
  302. // the global variables
  303. //
  304. // Arguments: IN HWND hwnd - handle to the dialog
  305. //
  306. // Returns: VOID
  307. //
  308. //----------------------------------------------------------------------------
  309. VOID
  310. OnTcpipIpApply( IN HWND hwnd ) {
  311. INT_PTR i;
  312. INT_PTR iCount;
  313. LV_ITEM lvI;
  314. TCHAR szIP[IPSTRINGLENGTH + 1];
  315. //
  316. // delete any old settings in the Namelists
  317. //
  318. ResetNameList( &NetSettings.pCurrentAdapter->Tcpip_IpAddresses );
  319. ResetNameList( &NetSettings.pCurrentAdapter->Tcpip_SubnetMaskAddresses );
  320. iCount = ListView_GetItemCount( GetDlgItem( hwnd, IDC_IPADDR_ADVIP ) );
  321. for( i = 0; i < iCount; i++ ) {
  322. memset( &lvI, 0, sizeof(LV_ITEM) );
  323. lvI.iItem = (int)i;
  324. lvI.mask = LVIF_PARAM;
  325. ListView_GetItem( GetDlgItem( hwnd, IDC_IPADDR_ADVIP ), &lvI );
  326. IPStruct = (IP_STRUCT*) lvI.lParam;
  327. // store the IP string into the Namelist
  328. TcpipAddNameToNameList( &NetSettings.pCurrentAdapter->Tcpip_IpAddresses,
  329. IPStruct->szIPString);
  330. // store the Subnet Mask string into the Namelist
  331. TcpipAddNameToNameList( &NetSettings.pCurrentAdapter->Tcpip_SubnetMaskAddresses,
  332. IPStruct->szSubnetMask );
  333. }
  334. ResetNameList( &NetSettings.pCurrentAdapter->Tcpip_GatewayAddresses );
  335. //
  336. // pull the IP address out of the Gateway list box and put them in the
  337. // Gateway Namelist
  338. //
  339. iCount = SendDlgItemMessage( hwnd,
  340. IDC_IPADDR_GATE,
  341. LB_GETCOUNT,
  342. 0,
  343. 0 );
  344. for( i = 0; i < iCount; i++ ) {
  345. //
  346. // get the IP string from the list box
  347. //
  348. SendDlgItemMessage( hwnd,
  349. IDC_IPADDR_GATE,
  350. LB_GETTEXT,
  351. i,
  352. (LPARAM) szIP );
  353. //
  354. // store the IP string in to the Namelist
  355. //
  356. TcpipAddNameToNameList( &NetSettings.pCurrentAdapter->Tcpip_GatewayAddresses, szIP );
  357. }
  358. }
  359. //----------------------------------------------------------------------------
  360. //
  361. // Function: TCPIP_IPSettingsPageProc
  362. //
  363. // Purpose: Required function for the property sheet page to function properly.
  364. // The important thing is to give the return value of 1 to the
  365. // message PSPCB_CREATE and 0 for PSPCB_RELEASE
  366. //
  367. // Arguments:
  368. //
  369. // Returns:
  370. //
  371. //----------------------------------------------------------------------------
  372. UINT CALLBACK
  373. TCPIP_IPSettingsPageProc( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp ) {
  374. switch ( uMsg ) {
  375. case PSPCB_CREATE :
  376. return 1 ; // needed for property sheet page to initialize correctly
  377. case PSPCB_RELEASE :
  378. return 0;
  379. default:
  380. return -1;
  381. }
  382. }
  383. //----------------------------------------------------------------------------
  384. //
  385. // Function: TCPIP_IPSettingsDlgProc
  386. //
  387. // Purpose: Dialog procedure for the IP Settings page of the property sheet
  388. // handles all the messages sent to this window
  389. //
  390. // Arguments:
  391. //
  392. // Returns:
  393. //
  394. //----------------------------------------------------------------------------
  395. INT_PTR CALLBACK
  396. TCPIP_IPSettingsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
  397. switch( uMsg ) {
  398. case WM_INITDIALOG: {
  399. OnTcpipIpInitDialog( hwndDlg );
  400. return TRUE ;
  401. }
  402. case WM_DESTROY: {
  403. // deallocate space for all items still in the List View
  404. INT i;
  405. INT iCount;
  406. LV_ITEM lvI;
  407. //
  408. // iterate through the ListView getting each item and
  409. // deallocating the space for it
  410. //
  411. iCount = ListView_GetItemCount( GetDlgItem( hwndDlg, IDC_IPADDR_ADVIP ) );
  412. for( i = 0; i < iCount; i++ ) {
  413. memset( &lvI, 0, sizeof(LV_ITEM) );
  414. lvI.iItem = i;
  415. lvI.mask = LVIF_PARAM;
  416. ListView_GetItem( GetDlgItem( hwndDlg, IDC_IPADDR_ADVIP ),
  417. &lvI );
  418. free( (IP_STRUCT*) lvI.lParam );
  419. }
  420. return TRUE ;
  421. }
  422. case WM_COMMAND: {
  423. WORD wNotifyCode = HIWORD( wParam ) ;
  424. WORD wButtonId = LOWORD( wParam ) ;
  425. if( wNotifyCode == LBN_SELCHANGE ) {
  426. SetArrows( hwndDlg,
  427. IDC_IPADDR_GATE,
  428. IDC_IPADDR_UP,
  429. IDC_IPADDR_DOWN );
  430. }
  431. switch ( wButtonId ) {
  432. //
  433. // IP Address Buttons
  434. //
  435. case IDC_IPADDR_ADDIP: {
  436. // make the string blank since we will be adding a
  437. // new IP address
  438. szIPString[0] = _T('\0');
  439. // and a new subnet mask
  440. szSubnetMask[0] = _T('\0');
  441. if( DialogBox( FixedGlobals.hInstance,
  442. (LPCTSTR) IDD_IPADDR_ADV_CHANGEIP,
  443. hwndDlg,
  444. ChangeIPDlgProc ) ) {
  445. HWND hEditButton = GetDlgItem( hwndDlg,
  446. IDC_IPADDR_EDITIP );
  447. HWND hRemoveButton = GetDlgItem( hwndDlg,
  448. IDC_IPADDR_REMOVEIP );
  449. // allocate space for the IP struct
  450. IPStruct = malloc( sizeof(IP_STRUCT) );
  451. if (IPStruct == NULL)
  452. {
  453. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  454. }
  455. // copy the strings that the user entered from the Dialog
  456. // Box into the IP struct so it can be added to
  457. // the list view
  458. lstrcpyn( IPStruct->szIPString, szIPString, AS(IPStruct->szIPString) );
  459. lstrcpyn( IPStruct->szSubnetMask, szSubnetMask, AS(IPStruct->szSubnetMask) );
  460. InsertItemIntoTcpipListView( GetDlgItem( hwndDlg, IDC_IPADDR_ADVIP ),
  461. (LPARAM) IPStruct,
  462. 0 );
  463. // an entry was just added so make sure the edit and remove buttons are enabled
  464. EnableWindow( hEditButton, TRUE );
  465. EnableWindow( hRemoveButton, TRUE );
  466. }
  467. return TRUE ;
  468. }
  469. case IDC_IPADDR_EDITIP: {
  470. LV_ITEM lvI;
  471. BOOL bIsItemSelected = FALSE;
  472. bIsItemSelected = GetSelectedItemFromListView( hwndDlg,
  473. IDC_IPADDR_ADVIP,
  474. &lvI );
  475. if( bIsItemSelected ) {
  476. IPStruct = (IP_STRUCT*) lvI.lParam;
  477. lstrcpyn( szIPString, IPStruct->szIPString, AS(szIPString) );
  478. lstrcpyn( szSubnetMask, IPStruct->szSubnetMask, AS(szSubnetMask) );
  479. if( DialogBox( FixedGlobals.hInstance,
  480. (LPCTSTR) IDD_IPADDR_ADV_CHANGEIP,
  481. hwndDlg,
  482. ChangeIPDlgProc ) ) {
  483. lstrcpyn( IPStruct->szIPString, szIPString, AS(IPStruct->szIPString) );
  484. lstrcpyn( IPStruct->szSubnetMask, szSubnetMask, AS(IPStruct->szSubnetMask) );
  485. // delete the old item and insert the new one
  486. ListView_DeleteItem( GetDlgItem( hwndDlg, IDC_IPADDR_ADVIP ),
  487. lvI.iItem );
  488. InsertItemIntoTcpipListView( GetDlgItem( hwndDlg, IDC_IPADDR_ADVIP ),
  489. (LPARAM) IPStruct, lvI.iItem );
  490. }
  491. }
  492. return TRUE ;
  493. }
  494. case IDC_IPADDR_REMOVEIP: {
  495. LV_ITEM lvI;
  496. BOOL bIsItemSelected = FALSE;
  497. bIsItemSelected = GetSelectedItemFromListView( hwndDlg,
  498. IDC_IPADDR_ADVIP,
  499. &lvI );
  500. //
  501. // if there is an item selected, then free its memory and
  502. // delete the item from the ListView
  503. //
  504. if( bIsItemSelected ) {
  505. free( (IP_STRUCT*) lvI.lParam );
  506. ListView_DeleteItem( GetDlgItem( hwndDlg, IDC_IPADDR_ADVIP ),
  507. lvI.iItem );
  508. }
  509. return TRUE ;
  510. }
  511. //
  512. // Gateway Buttons
  513. //
  514. case IDC_IPADDR_ADDGATE:
  515. g_CurrentEditBox = GATEWAY_EDITBOX;
  516. OnAddButtonPressed( hwndDlg,
  517. IDC_IPADDR_GATE,
  518. IDC_IPADDR_EDITGATE,
  519. IDC_IPADDR_REMOVEGATE,
  520. (LPCTSTR) IDD_IPADDR_ADV_CHANGEGATE,
  521. GenericIPDlgProc );
  522. SetArrows( hwndDlg,
  523. IDC_IPADDR_GATE,
  524. IDC_IPADDR_UP,
  525. IDC_IPADDR_DOWN );
  526. return TRUE ;
  527. case IDC_IPADDR_EDITGATE:
  528. g_CurrentEditBox = GATEWAY_EDITBOX;
  529. OnEditButtonPressed( hwndDlg,
  530. IDC_IPADDR_GATE,
  531. (LPCTSTR) IDD_IPADDR_ADV_CHANGEGATE,
  532. GenericIPDlgProc );
  533. SetArrows( hwndDlg,
  534. IDC_IPADDR_GATE,
  535. IDC_IPADDR_UP,
  536. IDC_IPADDR_DOWN );
  537. return TRUE ;
  538. case IDC_IPADDR_REMOVEGATE:
  539. OnRemoveButtonPressed( hwndDlg,
  540. IDC_IPADDR_GATE,
  541. IDC_IPADDR_EDITGATE,
  542. IDC_IPADDR_REMOVEGATE );
  543. SetArrows( hwndDlg,
  544. IDC_IPADDR_GATE,
  545. IDC_IPADDR_UP,
  546. IDC_IPADDR_DOWN );
  547. return TRUE ;
  548. case IDC_IPADDR_UP:
  549. OnUpButtonPressed( hwndDlg, IDC_IPADDR_GATE );
  550. SetArrows( hwndDlg,
  551. IDC_IPADDR_GATE,
  552. IDC_IPADDR_UP,
  553. IDC_IPADDR_DOWN );
  554. return TRUE ;
  555. case IDC_IPADDR_DOWN:
  556. OnDownButtonPressed( hwndDlg, IDC_IPADDR_GATE );
  557. SetArrows( hwndDlg,
  558. IDC_IPADDR_GATE,
  559. IDC_IPADDR_UP,
  560. IDC_IPADDR_DOWN );
  561. return TRUE ;
  562. } // end switch
  563. return FALSE ;
  564. }
  565. case WM_NOTIFY: {
  566. LPNMHDR pnmh = (LPNMHDR) lParam;
  567. LV_DISPINFO *pLvdi = (LV_DISPINFO *) lParam;
  568. IP_STRUCT *pListViewEntry = (IP_STRUCT *) (pLvdi->item.lParam);
  569. if( wParam == IDC_IPADDR_ADVIP ) {
  570. if( pLvdi->hdr.code == LVN_GETDISPINFO ) {
  571. switch( pLvdi->item.iSubItem ) {
  572. case 0:
  573. pLvdi->item.pszText = pListViewEntry->szIPString;
  574. break;
  575. case 1:
  576. pLvdi->item.pszText = pListViewEntry->szSubnetMask;
  577. break;
  578. }
  579. }
  580. }
  581. switch( pnmh->code ) {
  582. case PSN_APPLY: {
  583. //
  584. // user clicked the OK button on the property sheet
  585. //
  586. OnTcpipIpApply( hwndDlg );
  587. return TRUE ;
  588. }
  589. }
  590. default :
  591. return FALSE ;
  592. }
  593. }
  594. }
  595. //
  596. // ISSUE-2002/02/28-stelo- this function is for debugging purposes only, remove for final product
  597. // it is meant to be called from the debugger to show what the contents of a
  598. // namelist is
  599. //
  600. VOID DumpNameList( NAMELIST *pNameList ) {
  601. #if DBG
  602. INT i;
  603. INT nEntries;
  604. TCHAR *szNameListEntry;
  605. nEntries = GetNameListSize( pNameList );
  606. for(i = 0; i < nEntries; i++ ) {
  607. szNameListEntry = GetNameListName( pNameList, i );
  608. OutputDebugString( szNameListEntry );
  609. }
  610. #endif
  611. }