Partager via


Managing Network Adapters

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

IP Helper provides capabilities for managing network adapters. The functions described following are used to retrieve information about the network adapters in the local computer.

Interfaces are related to adapters in that there is a one-to-one correspondence between the interfaces and adapters on a given computer. An interface is an IP-level abstraction, whereas an adapter is a datalink-level abstraction.

The GetAdaptersInfo function returns an array of IP_ADAPTER_INFO structures, one for each adapter in the local computer. The GetPerAdapterInfo function returns additional information about a specific adapter. The GetPerAdapterInfo function requires the caller to specify the index of the adapter. To obtain the adapter index from the adapter name, use the GetAdapterIndex function.

The following table describes each GetAdaptersInfo variable and IP_ADAPTER_INFO member.

Value Description

pAdapterInfo

(Read-only) Pointer to a buffer that, on successful return, receives a linked list of IP_ADAPTER_INFO structures.

pOutBufLen

(Read-only) Pointer to a ULONG variable that contains the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.

IP_ADAPTER_INFO

(All fields are read-only, they cannot be changed by the API user.)

Next

Pointer to the next adapter in the linked list of adapters.

ComboIndex

This member is unused.

AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]

Specifies the name of the adapter.

Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]

Specifies a description for the adapter.

AddressLength

Specifies the length of hardware address for the adapter.

Address[MAX_ADAPTER_ADDRESS_LENGTH]

Specifies the hardware address for the adapter.

Index

Specifies the adapter index.

Type

Specifies the adapter type.

DhcpEnabled

Specifies whether dynamic host configuration protocol (DHCP) is enabled for this adapter.

CurrentIpAddress

Specifies the current IP address for this adapter. In Windows Embedded CE, the CurrentIpAddress value is defined as the first address assigned to the specified adapter.

IpAddressList

Specifies the list of IP addresses associated with this adapter.

GatewayList

Specifies the IP address of the default gateway for this adapter.

DhcpServer

Specifies the IP address of the DHCP server for this adapter.

HaveWins

Specifies whether this adapter uses Windows Internet Name Service (WINS).

PrimaryWinsServer

Specifies the IP address of the primary WINS server.

SecondaryWinsServer

Specifies the IP address of the secondary WINS server.

LeaseObtained

Specifies the time when the current DHCP lease was obtained.

LeaseExpires

Specifies the time when the current DHCP lease will expire.

The following table describes each GetPerAdapterInfo variable and IP_PER_ADAPTER_INFO member.

Value Description

IfIndex

Specifies the index of an interface. GetPerAdapterInfo will retrieve information for the adapter corresponding to this interface.

pPerAdapterInfo

Pointer to an IP_PER_ADAPTER_INFO structure that, on successful return, contains information about the adapter.

pOutBufLen

Pointer to a ULONG variable that specifies the size of the IP_PER_ADAPTER_INFO structure. If this size is insufficient to hold the information, GetPerAdapterInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.

IP_PER_ADAPTER_INFO (All fields are read-only, they cannot be changed by the API user.)

AutoconfigEnabled

Specifies whether auto-configuration is enabled on this adapter.

AutoconfigActive

Specifies whether auto-configuration is active on this adapter.

CurrentDnsServer

Not used.

DnsServerList

Specifies the list of possible DNS servers for this adapter.

The following table describes each GetAdapterIndex variable.

Value Description

AdapterName

Pointer to a Unicode string that contains the name of the adapter.

IfIndex

Pointer to a ULONG variable that, on successful return, points to the index of the adapter.

See Also

Concepts

Internet Protocol Helper APIs