In the attachment you will find a beta version (There may be some big errors in it so don't rely on it) of the include for the IP Helper API. The lib from the platform SDK (feb'01) is also included.
The IP helper API resides in iphlpapi.dll, which is available in win98+, winNT SP4 and win2k, but the real requirements vary for each function.

This lib includes some very interesting functions to get information about the network adapters and interfaces, some IP and TCP/UDP settings, and more.

I converted the most used structures mentioned in tcpip.chm (helpfile for the lib, included in the platform sdk) to their asm equivalents and wrote a little test program.

The program displays all network adapters and their settings like IP, gateway, dhcp addresses.

Please test this program on your own PC and see if it works... I get the feeling that there's something wrong with the network adapter type and the dhcp information.

The adapter type (Type member of the IP_ADAPTER_STRUCT, which I named uType in the asm version for obvious reasons) is not very well described in the documentation:

1.
The helpfile tcpip.chm from the platform sdk (feb 2001, latest one I could find on FTP) simply states:


[b]Type[/b]
Specifies the adapter type.

That's it, there's nothing said about the meaning of any value.

2.
searching msdn.microsoft.com I found this:


[b]Type[/b]
Specifies the adapter type. The type is one of the following values.
- IF_OTHER_ADAPTERTYPE
- IF_ETHERNET_ADAPTERTYPE
- IF_TOKEN_RING_ADAPTERTYPE
- IF_FDDI_ADAPTERTYPE
- IF_PPP_ADAPTERTYPE
- IF_LOOPBACK_ADAPTERTYPE
- IF_SLIP_ADAPTERTYPE
These values are defined in the header file IPIfCons.h.


"These values are defined in the header file IPIfCons.h.". Well, they're not. At least not in my version.
I found some constants that looked like these in the form 'ADAPTER_TYPE_*', but there was quite a big list of these and in the above description there aren't that many types.

3.
Searching google for IF_OTHER_ADAPTERTYPE resulted in one link to some visual basic code with Japanese comments :), but at least I could read the whole set of IF_*_ADAPTERTYPE constants. I've added these to the end of my include.
However, on my computer it tells me that I have a SLIP_ADAPTERTYPE adapter, but I'm sure it's an ethernet card so I think these constants are not correct. If anyone has better (correct) results please tell me.

Thomas
Posted on 2001-12-06 15:21:04 by Thomas
Sorry I attached the wrong file, I deleted it but could not replace it so here it is again.
Posted on 2001-12-06 15:23:33 by Thomas
here's the help file for those interested.
Posted on 2001-12-06 15:24:08 by Thomas
Cool :alright:
Posted on 2001-12-07 06:29:26 by Qweerdy
I got the following output:



___________
__/ Adapter 1 \___________________________

Adapter name:
{700A57F8-E0CC-4B60-BCF7-BD9860F94959}
Adapter description:
3Com EtherLink PCI
Type:
SLIP
DHCP Enabled:
Yes
IP address list:
192.168.123.195
Gateway list:
192.168.123.254
DHCP Server:
192.168.123.254
Uses WINS:
No


Well I don't know where to check the real values for type but I'm using ADSL connection to internet and this is my only network adapter. Other information seems to be correct. Quite funny that Adapter name :)

My OS is Windows 2000 SP2... if you need that information.

Sami
Posted on 2001-12-07 08:39:47 by SamiP
Except for the "adapter type = SLIP", the information seems correct.

Samip, nothing strange about the adapter "name", it's simple the
GUID used to describe the device entry =).
Posted on 2001-12-07 10:47:24 by f0dder
Nice! :alright:



___________
__/ Adapter 1 \________________________________________________________________

Adapter name:
{7F95E71C-8780-43DC-A3C7-707D3F54DDED}
Adapter description:
Realtek RTL8029(AS)-PCI-Ethernetadapter - Paketplaner-Miniport
Type:
SLIP
DHCP Enabled:
No
IP address list:
192.168.100.161
Gateway list:

Uses WINS:
No

___________
__/ Adapter 2 \________________________________________________________________

Adapter name:
{C005A201-FDE7-49AB-B244-13FFB56E1F11}
Adapter description:
Realtek RTL8139-Familie-PCI-Fast Ethernet-NIC - Paketplaner-Miniport
Type:
SLIP
DHCP Enabled:
No
IP address list:
192.168.100.160
Gateway list:

Uses WINS:
No

Posted on 2001-12-07 11:18:30 by bazik
Thanks for the replies, the dhcp server seems to be correct too but there's really something wrong with the adapter type..
I guess I'll have to search some more :rolleyes:.

Thomas
Posted on 2001-12-07 13:03:07 by Thomas
   ___________

__/ Adapter 1 \______________________________

Adapter name:
{55C16F62-F7DE-4B6E-B17A-32F3E740420A}
Adapter description:
SMC EZ Card 10/100 PCI (SMC1211TX)
Type:
SLIP
DHCP Enabled:
Yes
IP address list:
192.168.1.100
Gateway list:
192.168.1.1
DHCP Server:
192.168.1.1
Uses WINS:
No
Posted on 2001-12-07 23:40:23 by bitRAKE
edit: nevermind
Posted on 2002-02-15 09:40:06 by smurf
I have a strange little problem with adapterinfo.exe, it doesn?t show the adapter name.

I wonder why.
Is it a problem with the program or is my network card just going bananas?

Below is the output.

 

___________
__/ Adapter 1 \________________________________________________________________

Adapter name:

Adapter description:
PPP Adapter.
Type:
SLIP
DHCP Enabled:
Yes
IP address list:
0.0.0.0
Gateway list:

DHCP Server:
255.255.255.255
Uses WINS:
No

___________
__/ Adapter 2 \________________________________________________________________

Adapter name:

Adapter description:
PPP Adapter.
Type:
SLIP
DHCP Enabled:
Yes
IP address list:
0.0.0.0
Gateway list:

DHCP Server:
255.255.255.255
Uses WINS:
No

___________
__/ Adapter 3 \________________________________________________________________

Adapter name:

Adapter description:
NDIS 4.0 driver
Type:
SLIP
DHCP Enabled:
Yes
IP address list:
213.114.195.43
Gateway list:
213.114.195.1
DHCP Server:
255.255.255.255
Uses WINS:
No

Posted on 2002-02-15 10:58:24 by NoException
Thomas, the constants should be:



IF_OTHER_ADAPTERTYPE equ 1
IF_ETHERNET_ADAPTERTYPE equ 6
IF_TOKEN_RING_ADAPTERTYPE equ 9
IF_FDDI_ADAPTERTYPE equ 15
IF_PPP_ADAPTERTYPE equ 23
IF_LOOPBACK_ADAPTERTYPE equ 24
IF_SLIP_ADAPTERTYPE equ 28
Posted on 2002-02-15 11:52:56 by rdaneel
rdaneel: Thanks a lot!

Thomas
Posted on 2002-02-16 08:16:19 by Thomas
Thomas, look here:
Posted on 2002-02-16 19:08:27 by Eviloid
Eviloid: I know, I have the header files too. But the constants rdaneel posted actually work!

Thomas
Posted on 2002-02-17 02:42:25 by Thomas
Eviloid: some of the ip helper api's are still preliminary so the documentation may change at anytime.
Posted on 2002-02-17 10:53:46 by smurf