RtlIpv4AddressToString - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

NTSYSAPI
PSTR
NTAPI
RtlIpv4AddressToStringA(
    _In_ PCIN_ADDR Address,
    _Out_writes_(16) PSTR AddressString
    );

#endif

View code on GitHub
#ifndef _NTRTL_H

NTSYSAPI
PWSTR
NTAPI
RtlIpv4AddressToStringW(
    _In_ PCIN_ADDR Address,
    _Out_writes_(16) PWSTR AddressString
    );

#endif

View code on GitHub
#ifndef _NTRTL_H

#define RtlIpv4AddressToString RtlIpv4AddressToStringW

#endif

View code on GitHub
// ip2string.h

NTSYSAPI PSTR RtlIpv4AddressToStringA(
  [in]  const in_addr *Addr,
  [out] PSTR          S
);
View the official Win32 API reference
// ip2string.h

NTSYSAPI PWSTR RtlIpv4AddressToStringW(
  [in]  const in_addr *Addr,
  [out] PWSTR         S
);
View the official Win32 API reference

NtDoc

This function is documented in Windows SDK here and here.

Win32 API reference (nf-ip2string-rtlipv4addresstostringa)

RtlIpv4AddressToStringA function

Description

The RtlIpv4AddressToString function converts an IPv4 address to a string in Internet standard dotted-decimal format.

Parameters

Addr [in]

The IPv4 address in network byte order.

S [out]

A pointer to a buffer in which to store the NULL-terminated string representation of the IPv4 address. This buffer should be large enough to hold at least 16 characters.

Return value

A pointer to the NULL character inserted at the end of the string representation of the IPv4 address. This can be used by the caller to easily append more information to the string.

Remarks

The RtlIpv4AddressToString function is used to convert an IPv4 address to the string representation of the IPv4 address in Internet dotted-decimal format.

RtlIpv4AddressToString 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 IP address to string conversion.

When either UNICODE or _UNICODE is defined, RtlIpv4AddressToString is defined to RtlIpv4AddressToStringW, the Unicode version of this function. The string parameter S and the function return value are defined to the PWSTR data type.

When both UNICODE and _UNICODE are not defined, RtlIpv4AddressToString is defined to RtlIpv4AddressToStringA, the ANSI version of this function. The string parameter S and the function return value are defined to the PSTR data type.

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

[!NOTE] The ip2string.h header defines RtlIpv4AddressToString as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

See also

GetModuleHandle

GetProcAddress

InetNtop

InetPton

LoadLibrary

RtlIpv4AddressToStringEx

RtlIpv4StringToAddress

RtlIpv4StringToAddressEx

RtlIpv6AddressToString

RtlIpv6AddressToStringEx

RtlIpv6StringToAddress

RtlIpv6StringToAddressEx

inet_addr

inet_ntoa


Win32 API reference (nf-ip2string-rtlipv4addresstostringw)

RtlIpv4AddressToStringW function

Description

The RtlIpv4AddressToString function converts an IPv4 address to a string in Internet standard dotted-decimal format.

Parameters

Addr [in]

The IPv4 address in network byte order.

S [out]

A pointer to a buffer in which to store the NULL-terminated string representation of the IPv4 address. This buffer should be large enough to hold at least 16 characters.

Return value

A pointer to the NULL character inserted at the end of the string representation of the IPv4 address. This can be used by the caller to easily append more information to the string.

Remarks

The RtlIpv4AddressToString function is used to convert an IPv4 address to the string representation of the IPv4 address in Internet dotted-decimal format.

RtlIpv4AddressToString 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 IP address to string conversion.

When either UNICODE or _UNICODE is defined, RtlIpv4AddressToString is defined to RtlIpv4AddressToStringW, the Unicode version of this function. The string parameter S and the function return value are defined to the PWSTR data type.

When both UNICODE and _UNICODE are not defined, RtlIpv4AddressToString is defined to RtlIpv4AddressToStringA, the ANSI version of this function. The string parameter S and the function return value are defined to the PSTR data type.

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

[!NOTE] The ip2string.h header defines RtlIpv4AddressToString as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

See also

GetModuleHandle

GetProcAddress

InetNtop

InetPton

LoadLibrary

RtlIpv4AddressToStringEx

RtlIpv4StringToAddress

RtlIpv4StringToAddressEx

RtlIpv6AddressToString

RtlIpv6AddressToStringEx

RtlIpv6StringToAddress

RtlIpv6StringToAddressEx

inet_addr

inet_ntoa