Partager via


AddIPAddress

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function adds the specified IP address to the specified adapter.

Syntax

DWORD AddIPAddress(
  IPAddr Address,
  IPMask IpMask,
  DWORD IfIndex,
  PULONG NTEContext,
  PULONG NTEInstance 
);

Parameters

  • Address
    [in] The IP address to add to the adapter.
  • IpMask
    [in] The subnet mask for the IP address.
  • IfIndex
    [in] The adapter to which to add the address.
  • NTEContext
    [out] Pointer to the Net Table Entry (NTE) context for this IP address. The caller can later use this context in a call to DeleteIPAddress.
  • NTEInstance
    [out] Pointer to the NTE instance for this IP address.

Return Value

Returns NO_ERROR if successful. If the function fails, it returns an error code. For a complete list of error codes, see Error Values or the SDK header file Winerror.h.

Remarks

To convert the IPAddr value to the a.b.c.d string form of an IP address, map the high-order byte to a, the low-order byte to d, and so on. IPMask uses the same format as IPAddr.

The IP address and the subnet mask values are in big endian format.

Requirements

Header iphlpapi.h
Library Iphlpapi.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IP Helper Functions
DeleteIPAddress
GetAdapterIndex