Share via


RtlIpv6StringToAddress (Compact 7)

3/12/2014

This function converts a string representation of an IPv6 address to a binary IPv6 address.

Syntax

LONG NTAPI RtlIpv6StringToAddress(
  __in   PCTSTR S,
  __out  PCTSTR* Terminator,
  __out  IN6_ADDR* Addr
);

Parameters

  • S
    A pointer to a buffer that contains the NULL-terminated string representation of the IPv6 address.
  • Terminator
    A parameter that receives a pointer to the character that terminated the converted string. This can be used by the caller to extract more information from the string.
  • Addr
    A pointer where the binary representation of the IPv6 address is to be stored.

Return Value

Return code Description

NO_ERROR

The function succeeds.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if the string that was passed in the S parameter did not contain a correct string representation of an IPv6 address.

Other

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

Remarks

The RtlIpv6StringToAddress function is used to convert a string representation of the IPv6 address to an IPv6 address returned in network order (bytes ordered from left to right).

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

The string pointed to by the S parameter must be represented in the form for an IPv6 address string. 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 a IPv4-compatible address.

On success, the Terminator parameter points to the character that terminated the string that was converted. This enables an application to pass a string that contains and IP address plus additional information to the RtlIpv6StringToAddress function and then parse the remaining information.

When UNICODE or _UNICODE is defined, RtlIpv6StringToAddress is defined to RtlIpv6StringToAddressW, the Unicode version of this function. The string parameters are defined to the PCWSTR data type.

When UNICODE or _UNICODE is not defined, RtlIpv6StringToAddress is defined to RtlIpv6StringToAddressA, the ANSI version of this function. The string parameters are defined to the PCSTR data type.

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

See Also

Reference

IP Helper Functions
RtlIpv4AddressToString
RtlIpv4AddressToStringEx
RtlIpv4StringToAddress
RtlIpv4StringToAddressEx
RtlIpv6AddressToString
RtlIpv6AddressToStringEx
RtlIpv6StringToAddressEx

Other Resources

GetProcAddress
LoadLibrary