Answered by:
Change IP Address without reboot

Question
-
Hi ,
For my project purpose I need to change my IP Address . I was sucessfull in that by editing the registry (DHCPEnabled and IPAddress) of WINCE device programatically . But one issue remains that for taking new ip address , the device needs to be rebooted and restarted . Though when changing DHCPEnabled in registry , the change take effect immediately but whatever the new IPAddress that we are setting for the device , it does not take effect immediately . Though when we see the registry keys in the device by Remote registry editor , we can see the proper entries in the
Registry ( for DHCPEnabled and IPAddress) but in the device it takes place only after reboot .
Is there any method which can help me change ip address without rebooting the device/system .Is there any WinAPI call which I can use so that I will not have to reboot the system . As rebooting the system may interrupt the flow of application
Ethernet driver is already a system on device in which we can set new static Ip address without reboot . I need same mechanism for my application .
Any help willl be appreciated .
Thanks ,
Kaushik vatsa
Friday, July 6, 2007 9:11 AM
Answers
-
Hi
I'd play with the NDIS APIs NdisRegisterAdapter and NdisDeRegisterAdapter. The details how to use these APIs can be found here: http://msdn2.microsoft.com/en-us/library/ms892892.aspx
Hope this helps
Michael
Tuesday, July 10, 2007 3:00 PM -
Hi Kaushik
Most likely the string you pass in as MiniportDriverName is wrong. I'd expect the DriverName to be "SMSC9115".
The rest should be fine.
Michael
Tuesday, July 17, 2007 10:42 PM
All replies
-
Any help on this from experts ???
Tuesday, July 10, 2007 6:54 AM -
Hi
I'd play with the NDIS APIs NdisRegisterAdapter and NdisDeRegisterAdapter. The details how to use these APIs can be found here: http://msdn2.microsoft.com/en-us/library/ms892892.aspx
Hope this helps
Michael
Tuesday, July 10, 2007 3:00 PM -
Can you give me any sample code for using NDIS APIS NDISRegisterAdapter .. I think I was not able to play it in C# .
What are the dlls used for it .. I mean I think we need to P/INVOKE the particular dll ..
Will appreciate if some sample code is provided :-) .. It will make my work somewwhat easier ....
Thursday, July 12, 2007 1:29 PM -
Hi Michael ;
I have used this declaration for PINVOKE
[
DllImport("ndis.dll", SetLastError = true)] internal static extern void NdisRegisterAdapter( out uint Status, string MiniportDriverName, string AdapterInstanceName);NdisRegisterAdapter(
out status, "SMSC115 Ethernet Driver", "SMSC91151");"SMSC115 Ethernet Driver", "SMSC91151" re miniport driver name and adapterinstance names in the registry key .
but the status is coming as Failure( status code : hex c0000001 .
Can you help me where I am going wrong ..
--Kaushik Vatsa
Friday, July 13, 2007 7:24 AM -
Hi Kaushik
Most likely the string you pass in the MiniportDriverName argument is wrong. The string you pass in seams to be the display name (shown in the UI).
Usually when the AdapterInstanceName is for instance NE20001 the matching DriverName is NE2000.
Michael
Tuesday, July 17, 2007 8:21 PM -
Hi Kaushik
Most likely the string you pass in as MiniportDriverName is wrong. I'd expect the DriverName to be "SMSC9115".
The rest should be fine.
Michael
Tuesday, July 17, 2007 10:42 PM