-
November 3rd, 2012, 02:16 PM
#1
IPHelper API query
As per msdn we should use GetAdaptersAddresses() instead of GetAdaptersInfor() for Windows XP and later. I need to get all information for NIC ie: IP, Subnet, Gateway, DNS, WINS.
GetAdaptersInfo() does it all, but couldn't find any sample how to retrieve Gateway, Subnet using GetAdaptersAddresses(), Geteway address can be retrieved by GAA_FLAG_INCLUDE_GATEWAYS from Windows Vista, I need to code to support OS from XP, Can anyone suggest anything ?
Last edited by hypheni; November 3rd, 2012 at 02:22 PM.
-
November 5th, 2012, 12:30 PM
#2
Re: IPHelper API query
I believe nothing prevents you from using GetAdaptersInfo except that MS note. So forget about the note, but remember the limitation, IPv4 only.
Best regards,
Igor
-
November 5th, 2012, 12:34 PM
#3
Re: IPHelper API query
Hmm, currently in my case no reason to use GetAdaptersAddess over GetAdaptersInfo except msdn, cause I'm not gonna support IPv6.
◄◄ hypheni ►►
-
November 5th, 2012, 12:43 PM
#4
Re: IPHelper API query
So give it a try, and let us know about your results.
Best regards,
Igor
-
November 5th, 2012, 12:45 PM
#5
Re: IPHelper API query
Will get back to this thread once I completed with GetAdaptersInfo and its testing on Xp, Vista, 7 including x64 version.
◄◄ hypheni ►►
-
November 7th, 2012, 05:13 AM
#6
Re: IPHelper API query
So far I have completed other work except a few, what should be better approach to get the Connection name.
GetAdaptersInfo returns GUID for the NIC, if using this way to get Connection Name I have to read registry key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}'
GetAdaptersAddress returns FriendlyName of the NIC, ie: the Connection name
Which one will be better ?
Read registry
or
Use GetAdaptersAddress only for FriendlyName, along with GetAdaptersInfo for others.
Last edited by hypheni; November 7th, 2012 at 11:58 AM.
◄◄ hypheni ►►
-
November 7th, 2012, 09:58 AM
#7
Re: IPHelper API query
Just a small update. I tried both API in my sample application and application reaches using 6MB of memory where as using GetAdaptersInfo takes only 1.5MB memory.
Wasting 4.5MB memory only for retrieving one single information which can be queried from registry. Is it worthy using both APIs in single application.
Don't mention as its a desktop application I shouldn't care about memory. I like keep my application use only required memory.
◄◄ hypheni ►►
-
November 14th, 2012, 03:51 AM
#8
Re: IPHelper API query
These days CodeGuru is inactive or Gurus didn't work with IPHelper much ? No such replies.
◄◄ hypheni ►►
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|