Export (0) Print
Expand All
Expand Minimize

RtlIpv6StringToAddressEx function

The RtlIpv6StringToAddressEx function converts a string representation of an IPv6 address, scope ID, and port number to a binary IPv6 address, scope ID, and port.

Syntax


LONG NTAPI RtlIpv6StringToAddressEx(
  _In_   PCTSTR AddressString,
  _Out_  IN6_ADDR *Address,
  _Out_  PULONG ScopeId,
  _Out_  PUSHORT Port
);

Parameters

AddressString [in]

A pointer to a buffer containing the NULL-terminated string representation of the IPv6 address, scope ID, and port number.

Address [out]

A pointer where the binary representation of the IPv6 address is to be stored.

ScopeId [out]

A pointer to where scope ID of the IPv6 address is stored. If AddressString parameter does not contain the string representation of a scope ID, then zero is returned in this parameter.

Port [out]

A pointer where the port number is stored. The port number is in network byte order format. If AddressString parameter does not contain the string representation of a port number, then zero is returned in this parameter.

Return value

If the function succeeds, the return value is STATUS_SUCCESS.

If the function fails, the return value is one of the following error codes.

Return codeDescription
STATUS_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if the string pointed to by the AddressString parameter did not contain a proper string representation of an IPv6 address.

This error code is defined in the Ntstatus.h header file.

Other

Use FormatMessage to obtain the message string for the returned error.

 

Remarks

The RtlIpv6StringToAddressEx function is used to convert a string representation of the IPv6 address, scope ID, and port number to a binary IPv6 address, scope ID, and port number. The IPv6 address is returned in network order (bytes ordered from left to right). The port number and scope ID are returned in network order.

RtlIpv6StringToAddressEx is a convenience function that does not require that the Windows Sockets DLL be loaded to access a function provided in Windows Sockets to perform string to IP address conversion.

The string pointed to by the AddressString parameter must be represented in the form for an IPv6 address string followed by an optional percent character and scope ID string. The IPv6 address and scope ID string must be enclosed in square brackets. The right square bracket after the IPv6 address and scope ID string may be followed by an optional colon and a string representation of a port number. The basic string representation of an IPv6 address consists of 8 hexadecimal numbers separated by colons. A string of consecutive zero numbers may be replaced with a double-colon. There can only be one double-colon in the string representation of the IPv6 address. The last 32 bits may be represented in IPv4-style dotted-octet notation if the address is an IPv4-compatible address, an IPv4-mapped IPv6 address, or an ISATAP address. For more information, see section 5 of RFC 5942 published by the IETF.

When either UNICODE or _UNICODE is defined, RtlIpv6StringToAddressEx is defined to RtlIpv6StringToAddressExW, the Unicode version of this function. The AddressString parameter is defined to the PCWSTR data type.

When both UNICODE and _UNICODE are not defined, RtlIpv6StringToAddressEx is defined to RtlIpv6StringToAddressExA, the ANSI version of this function. The AddressString parameter is defined to the PCSTR data type.

The IN6_ADDR structure is defined in the In6addr.h header file.

An import library containing the RtlIpv6StringToAddressEx function is not included in the Microsoft Windows Software Development Kit (SDK) released for Windows Vista. The RtlIpv6StringToAddressEx function is included in the Ntdll.lib import library included in the Windows Driver Kit (WDK). An application could also use the GetModuleHandle and GetProcAddress functions to retrieve the function pointer from the Ntdll.dll and call this function.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Mstcpip.h

DLL

Ntdll.dll

Unicode and ANSI names

RtlIpv6StringToAddressExW (Unicode) and RtlIpv6StringToAddressEx (ANSI)

See also

GetModuleHandle
GetProcAddress
IN6_ADDR
inet_addr
inet_ntoa
InetNtop
InetPton
LoadLibrary
RtlIpv4AddressToString
RtlIpv4AddressToStringEx
RtlIpv4StringToAddress
RtlIpv4StringToAddressEx
RtlIpv6AddressToString
RtlIpv6AddressToStringEx
RtlIpv6StringToAddress

 

 

Community Additions

ADD
Show:
© 2014 Microsoft