Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

IP_ADAPTER_INFO (Structures)
 
.
Summary
This structure contains information about a particular network adapter on the local computer.

C# Definition:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct IP_ADAPTER_INFO
{
    public IntPtr Next;
    public Int32 ComboIndex;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAX_ADAPTER_NAME_LENGTH + 4)]
      public string AdapterName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAX_ADAPTER_DESCRIPTION_LENGTH + 4)]
      public string AdapterDescription;
    public UInt32 AddressLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst=MAX_ADAPTER_ADDRESS_LENGTH)]
      public byte [] Address;
    public Int32 Index;
    public UInt32 Type;
    public UInt32 DhcpEnabled;
    public IntPtr CurrentIpAddress;
    public IP_ADDR_STRING IpAddressList;
    public IP_ADDR_STRING GatewayList;
    public IP_ADDR_STRING DhcpServer;
    public bool HaveWins;
    public IP_ADDR_STRING PrimaryWinsServer;
    public IP_ADDR_STRING SecondaryWinsServer;
    public Int32 LeaseObtained;
    public Int32 LeaseExpires;
}

VB Definition:

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Public Class IP_ADAPTER_INFO
    Public [Next] As IntPtr
    Public ComboIndex As Int32
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
    Private Structure IP_ADAPTER_INFO
    Dim [Next] As IntPtr
    Dim ComboIndex As Int32
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=(MAX_ADAPTER_NAME_LENGTH + 4))> _
    Public AdapterName As String
        Dim AdapterName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=(MAX_ADAPTER_DESCRIPTION_LENGTH + 4))> _
    Public AdapterDescription As String
    Public AddressLength As Int32
        Dim Description As String
    Dim AddressLength As UInt32
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=(MAX_ADAPTER_ADDRESS_LENGTH))> _
    Public Address() As Byte
    Public Index As Int32
    Public Type As Int32
    Public DhcpEnabled As Int32
    Public CurrentIpAddress As Int32
    Public IpAddressList As IP_ADDR_STRING
    Public GatewayList As IP_ADDR_STRING
    Public DhcpServer As IP_ADDR_STRING
    Public HaveWins As Int32
    Public PrimaryWinsServer As IP_ADDR_STRING
    Public SecondaryWinsServer As IP_ADDR_STRING
    Public LeaseObtained As Int32
    Public LeaseExpires As Int32
End Class
        Dim Address() As Byte
    Dim Index As Int32
    Dim Type As UInt32
    Dim DhcpEnabled As UInt32
    Dim CurrentIpAddress As IP_ADDR_STRING
    Dim IpAddressList As IP_ADDR_STRING
    Dim GatewayList As IP_ADDR_STRING
    Dim DhcpServer As IP_ADDR_STRING
    Dim HaveWins As Boolean
    Dim PrimaryWinsServer As IP_ADDR_STRING
    Dim SecondaryWinsServer As IP_ADDR_STRING
    Dim LeaseObtained As Int32
    Dim LeaseExpires As Int32
    End Structure

User-Defined Field Types:

IP_ADDR_STRING (in IP Helper API constants IPHlpApi.h)

MAX_ADAPTER_ADDRESS_LENGTH, MAX_ADAPTER_DESCRIPTION_LENGTH, MAX_ADAPTER_NAME_LENGTH (in IPTypes.h)

IP_ADDR_STRING, MAX_ADAPTER_ADDRESS_LENGTH, MAX_ADAPTER_DESCRIPTION_LENGTH, MAX_ADAPTER_NAME_LENGTH (in IP Helper API constants)

Notes:

Failed on CharSet:=CharSet.Auto on WinXP: -> CharSet:=CharSet.ANSI worked

MAX_ADAPTER_ADDRESS_LENGTH = 8

MAX_ADAPTER_DESCRIPTION_LENGTH = 128

MAX_ADAPTER_NAME_LENGTH = 256

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions