ASM Community    The Assembly Language Resource

2010-08-01 09:47:05 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   
   Home   Help Search Calendar Login Register  
Pages: [1] 2
  Print  
Author Topic: IPHlpAPI (IP helper functions)  (Read 8241 times)
0 Members and 1 Guest are viewing this topic.
Thomas
ASM Fanatic
****
Offline Offline

Posts: 1350


Mad as a hatter


WWW
« on: 2001-12-06 21:21:04 »

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:
Code:

[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:
Code:

[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 Smile, 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
Logged

"Experience is often what you get when you were expecting something else."
Thomas
ASM Fanatic
****
Offline Offline

Posts: 1350


Mad as a hatter


WWW
« Reply #1 on: 2001-12-06 21:23:33 »

Sorry I attached the wrong file, I deleted it but could not replace it so here it is again.
Logged

"Experience is often what you get when you were expecting something else."
Thomas
ASM Fanatic
****
Offline Offline

Posts: 1350


Mad as a hatter


WWW
« Reply #2 on: 2001-12-06 21:24:08 »

here's the help file for those interested.
Logged

"Experience is often what you get when you were expecting something else."
Qweerdy
Code Warrior
**
Offline Offline

Posts: 488


WWW
« Reply #3 on: 2001-12-07 12:29:26 »

Cool :alright:
Logged

My hands are tied / For all I've seen has changed my mind
But still the wars go on as the years go by / with no love of God or human rights
'Cause all these dreams are swept aside / by bloody hands of the hypnotized
Who carry the cross of homicide / and history bears the scars of our civil wars
SamiP
Code Warrior
**
Offline Offline

Posts: 145


WWW
« Reply #4 on: 2001-12-07 14:39:47 »

I got the following output:

Code:

   ___________
__/ 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 Smile

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

Sami
Logged
f0dder
Community Staff
ASM Fanatic
*****
Offline Offline

Posts: 7719


Front Line Assembly


WWW
« Reply #5 on: 2001-12-07 16:47:24 »

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 =).
Logged

- carpe noctem
bazik
ASM Fanatic
****
Offline Offline

Posts: 1602



WWW
« Reply #6 on: 2001-12-07 17:18:30 »

Nice! :alright:

Code:

   ___________
__/ 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

Logged

One by one, the penguins steal my sanity...
Thomas
ASM Fanatic
****
Offline Offline

Posts: 1350


Mad as a hatter


WWW
« Reply #7 on: 2001-12-07 19:03:07 »

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
Logged

"Experience is often what you get when you were expecting something else."
bitRAKE
Community Guru
ASM Fanatic
****
Offline Offline

Posts: 3928


Reductio Ad Absurdum


WWW
« Reply #8 on: 2001-12-08 05:40:23 »

Code:
  ___________
__/ 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
Logged

Growth becomes exponential when your focus shifts away from perceiving the world through division. The differences hold things together as much as their similarities. Hatred stems from intimate knowledge of something. We rise out of defeat. Understand the game and it becomes an endless source of enjoyment.
smurf
Code Warrior
**
Offline Offline

Posts: 472


« Reply #9 on: 2002-02-15 15:40:06 »

edit: nevermind
Logged
NoException
ASM Supporter
*
Offline Offline

Posts: 12


« Reply #10 on: 2002-02-15 16:58:24 »

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.

Code:

   ___________
__/ 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

Logged
rdaneel
Code Warrior
**
Offline Offline

Posts: 174



WWW
« Reply #11 on: 2002-02-15 17:52:56 »

Thomas, the constants should be:

Code:

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
Logged

Thanks,
R.Daneel

"She's built like a steakhouse, but she handles like a bistro." --Zapp Brannigan
Thomas
ASM Fanatic
****
Offline Offline

Posts: 1350


Mad as a hatter


WWW
« Reply #12 on: 2002-02-16 14:16:19 »

rdaneel: Thanks a lot!

Thomas
Logged

"Experience is often what you get when you were expecting something else."
Eviloid
ASM Supporter
*
Offline Offline

Posts: 34


« Reply #13 on: 2002-02-17 01:08:27 »

Thomas, look here:
Logged

}8)
Thomas
ASM Fanatic
****
Offline Offline

Posts: 1350


Mad as a hatter


WWW
« Reply #14 on: 2002-02-17 08:42:25 »

Eviloid: I know, I have the header files too. But the constants rdaneel posted actually work!

Thomas
Logged

"Experience is often what you get when you were expecting something else."
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!