IPHelper API query
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: IPHelper API query

  1. #1
    Join Date
    Jul 2009
    Location
    India
    Posts
    832

    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.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,877

    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

  3. #3
    Join Date
    Jul 2009
    Location
    India
    Posts
    832

    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 ►►

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,877

    Re: IPHelper API query

    So give it a try, and let us know about your results.
    Best regards,
    Igor

  5. #5
    Join Date
    Jul 2009
    Location
    India
    Posts
    832

    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 ►►

  6. #6
    Join Date
    Jul 2009
    Location
    India
    Posts
    832

    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 10:58 AM.
    ◄◄ hypheni ►►

  7. #7
    Join Date
    Jul 2009
    Location
    India
    Posts
    832

    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 ►►

  8. #8
    Join Date
    Jul 2009
    Location
    India
    Posts
    832

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center