Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ip Address from GetAdaptersAddresses
Message
De
21/06/2010 04:13:37
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Ip Address from GetAdaptersAddresses
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01469839
Message ID:
01469839
Vues:
387
I'm using GetAdaptersAddresses() to get information on all network adapters on a machine, thanks to FoxPro WinAPI Online Reference.

The example shows the MAC Address, name etc being broken out from the _IP_ADAPTER_ADDRESSES Structure, but I also want to also break out the IP address for each adaptor. I must admit I find reading of structures rather complex, and although I've given it a go I'm not getting very far.
*!*    typedef struct _IP_ADAPTER_ADDRESSES {
*!*      union {
*!*        ULONGLONG Alignment; 0:8
*!*        struct {
*!*              ULONG Length;
*!*              DWORD IfIndex;
*!*         };
*!*      };
*!*      struct _IP_ADAPTER_ADDRESSES* Next;
*!*      PCHAR AdapterName;
*!*      PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
*!*      PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
*!*      PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
*!*      PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
*!*      PWCHAR DnsSuffix;
*!*      PWCHAR Description;
*!*      PWCHAR FriendlyName;
*!*      BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
*!*      DWORD PhysicalAddressLength;
*!*      DWORD Flags;
*!*      DWORD Mtu;
*!*      DWORD IfType;
*!*      IF_OPER_STATUS OperStatus;
*!*      DWORD Ipv6IfIndex;
*!*      DWORD ZoneIndices[16];
*!*      PIP_ADAPTER_PREFIX FirstPrefix;
*!*    } IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
From what I can work out bytes 8-11 ,12-15,16-19 & 20-23 point to IP Address Structures, am I right? And how to I read those structures?

I know there are other ways of getting "my IP Address", but since I am using GetAdaptersAddresses to get MAC Address, I would like to get IP Address at the same time.

Gary.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform