c++ - Why does DeleteIPAddress fails when deleting the adapter's default IP? -


I am trying to write a program that will replace the IP of the selected adapter at the command.

That is, I am using the GetAdaptersInfo () function to get the index of the adapter and it is the IP reference, and then to delete the existing IP (DeleteIPAddress (through reference)) I am using.

After that, the new IP will be inserted through AddIPAddress ().

The problem is, when trying to delete the "default" IP, the call to the DeleteIPAddress function fails to be set by ADPRESS ()) and addIPAddress to the old IP Calling the adapter together with two different simultaneous IPS.

Removed Dependency Function fails with error 31 (the device connected to the system is not working).

Is there another way to successfully change the IP address on the adapter? Can DeleteIPAddress be actually used without getting references from AddIPAddress? They say, DeleteIPAddress deletes the address added in advance by the addIPAddress: -) I have something to interest with. Researched and ...

There are undocumented SetAdapterIPAddress functions.

  DWORD SetAdapterIpAddress (char * pszAdapGUID, DeDDH DHHCP, DeDevD Dipip, DeDard Dwymesk, DeDworld's DGEV);  

This may work or not :-) Also see the WMI interface for the Win32_NetworkAdapterConfiguration class. And there is a record in the Windows Registry for the NIC IP address ...

I think complexity exists in many "internal" configuration agents (DHCP, other ..) in Windows and all these OS Internal parts and then when they manipulate an IP address, other manipulation of control can break their work, apart from this there is a possibility of allocating a static IP address in the registry and it is not broken Should go. And then you actually have DeleteIPAddress which you added earlier ... I think, this is for your own Dynamic Config Agents ...

If you are not satisfied with the work of other agents You should stop them (instead of teasing the IP address outside the control) ... or control them by a specific API ... or set the static IP ...


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -