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
- Next message: Paul G. Tobey [eMVP]: "Re: How to send file through TCP/IP connection?"
- Previous message: Chris V: "Problem playing a specific MP3 file in Win Ce"
- In reply to: Oliver Münchow: "Re: How to change the IP address under the wince?"
- Messages sorted by: [ date ] [ thread ]
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?
> >
> >
>
>
- Next message: Paul G. Tobey [eMVP]: "Re: How to send file through TCP/IP connection?"
- Previous message: Chris V: "Problem playing a specific MP3 file in Win Ce"
- In reply to: Oliver Münchow: "Re: How to change the IP address under the wince?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|