Re: How to change the IP address under the wince?

From: Paul G. Tobey [eMVP] (ptobey_no_spam_at_instrument_no_spam.com)
Date: 04/12/04


Date: Mon, 12 Apr 2004 09:50:53 -0700

OK, you should be able to change the registry and then tell NDIS to rebind
the adapter (which causes the old IP address(es) to be disconnected, and any
current registry settings to be used). Here's the C code to do the rebind
(you can find this easily in the newsgroup archives):

-----

 // Open the NDIS driver.
 HANDLE hNdis = CreateFile( _T( "NDS0:" ),
    GENERIC_READ | GENERIC_WRITE, 0, NULL,
    OPEN_EXISTING, 0, NULL );

 // Send the device command.
 TCHAR errs[ 512 ];
 DWORD xcount;
 if ( DeviceIoControl( hNdis, IOCTL_NDIS_REBIND_ADAPTER,
  buf, _tcslen( buf ) + sizeof( TCHAR ), // buf contains the name of the
adapter
  NULL, 0, &xcount, NULL ) )
 {
  OutputDebugString( _T( "Adapter rebound\r\n" ) );
 }
 else
 {
  _stprintf( errs, _T( "DeviceIoControl failed. error = %d\r\n" ),
   GetLastError() );
  OutputDebugString( errs );
 }

 CloseHandle( hNdis );

-----

Paul T.

"Oliver Münchow" <omuenchow@NOSPAMgesytecDOT.de> wrote in message
news:%23jdMkL7GEHA.2516@TK2MSFTNGP12.phx.gbl...
> Hi Paul and Hou,
>
> with DeleteIpAddress() you can only delete a 'second' ip address of a
driver
> which you previously add with AddIpAddress(). If you want to change the
> 'originial' ip address of a network device you have to change the entry in
> the registry (e.g. [HKEY_LOCAL_MACHINE\COMM\PCI\NE20001\Parms\TCPIP] and
> restart the network driver.
>
> For restart you have two options. First you can just restart the whole
> device with KernelIoControl() or you can restart the network adapter by
> calling the NDIS Control, but i don't know actually the correct statement
> for this call.
>
> Best regards,
> Oliver Münchow
> --
> ---------------------------------------
> Gesytec GmbH eMail:
> 52076 Aachen omuenchowATgesytecDOTde
> http://www.gesytec.de
>
>
> "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> schrieb im
> Newsbeitrag news:uo79g7nEEHA.3864@TK2MSFTNGP12.phx.gbl...
> > Did you try DeleteIpAddress()? If so, what happened?
> >
> > Paul T.
> >
> > "Dongfeng.Huo" <huo.dongfeng@zte.com.cn> wrote in message
> > news:12f7c01c4121e$84031590$a301280a@phx.gbl...
> > > I have encountered a problem when using
> > > wince,use "AddIPAddress" to add new IP address,but the
> > > old IP address can not delete,why?
> >
> >
>
>



Relevant Pages

  • Re: Restart ethernet driver
    ... The utility can add/delete an adapter using NDIS IOCTL's. ... I'd like to detect this situation in my application and restart the ...
    (microsoft.public.windowsce.platbuilder)
  • Re: selectively bind a NDIS IM
    ... If is is a specific adapter identified by hardware ID, the you can write a NDIS "Notify Object" that is run at install time. ... A Notify Object can restrict bindings to a specific VID/PID. ...
    (microsoft.public.development.device.drivers)
  • Re: NDIS-cable status
    ... for the adapter shows a "red X" and Network Connections shows "Network Cable ... my driver will redirect any traffic to the other adapter transparent to the ... > the NIC directly using a mechanism that bypasses the NDIS IM filter. ... >> but still the status of network connection becomes cable unpulgeed. ...
    (microsoft.public.development.device.drivers)
  • Re: wpa_supplicant with NDIS-wrapped wireless card and WPA-PSK reboots 6.1-pre
    ... I set up a D-Link AirPlus DWL-520+ wireless PCI adapter in an old ... 6 - start of a new network block ... EAPOL: SUPP_PAE entering state DISCONNECTED ... NDIS: 1 adapter descriptions found ...
    (freebsd-stable)
  • Re: put nic into promisquous mode
    ... Be aware that even if your adapter support promiscuous mode and set only if ... you have hub connected lan you'll receive all other host packets, ... >> Can anyone tell me how to configure a NIC or its NDIS ... > adapters are an example of an adapter that does not support promiscuous ...
    (microsoft.public.development.device.drivers)

Loading