From eaaefe1c916b7c66134bf0a3e37878fc9e1d7c56 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Fri, 30 Aug 2019 13:43:52 -0600 Subject: [PATCH] ntdll: Implement RtlIpv6AddressToString(Ex)W Signed-off-by: Alex Henrie --- dlls/ntdll/ntdll.spec | 4 ++-- dlls/ntdll/rtl.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 233ee929591..1bc39a9ee3b 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -779,8 +779,8 @@ @ stdcall RtlIpv4StringToAddressW(wstr long ptr ptr) @ stdcall RtlIpv6AddressToStringA(ptr ptr) @ stdcall RtlIpv6AddressToStringExA(ptr long long ptr ptr) -# @ stub RtlIpv6AddressToStringExW -# @ stub RtlIpv6AddressToStringW +@ stdcall RtlIpv6AddressToStringExW(ptr long long ptr ptr) +@ stdcall RtlIpv6AddressToStringW(ptr ptr) @ stdcall RtlIpv6StringToAddressA(str ptr ptr) @ stdcall RtlIpv6StringToAddressExA(str ptr ptr ptr) @ stdcall RtlIpv6StringToAddressExW(wstr ptr ptr ptr) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index c7f9bd1e537..81deaae78d5 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1472,6 +1472,30 @@ char * WINAPI RtlIpv6AddressToStringA(const IN6_ADDR *address, char *str) return str + len - 1; } +/*********************************************************************** + * RtlIpv6AddressToStringExW [NTDLL.@] + */ +NTSTATUS WINAPI RtlIpv6AddressToStringExW(const IN6_ADDR *address, ULONG scope, USHORT port, WCHAR *str, ULONG *len) +{ + char cstr[64]; + NTSTATUS ret = RtlIpv6AddressToStringExA(address, scope, port, cstr, len); + if (SUCCEEDED(ret)) RtlMultiByteToUnicodeN(str, *len * sizeof(WCHAR), NULL, cstr, *len); + return ret; +} + +/*********************************************************************** + * RtlIpv6AddressToStringW [NTDLL.@] + */ +WCHAR * WINAPI RtlIpv6AddressToStringW(const IN6_ADDR *address, WCHAR *str) +{ + ULONG len = 46; + if (!address || !str) return str; + str[45] = 0; + if (FAILED(RtlIpv6AddressToStringExW(address, 0, 0, str, &len))) + return str; + return str + len - 1; +} + /*********************************************************************** * get_pointer_obfuscator (internal) */ -- 2.25.1