From cbc86e2e9b964df11a2d7c0e9e933123ef45b69c Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Fri, 30 Aug 2019 13:43:52 -0600 Subject: [PATCH 4/4] 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 13e39e09b4..9816017c79 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -766,8 +766,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) # @ stub RtlIpv6StringToAddressA # @ stub RtlIpv6StringToAddressExA @ stdcall RtlIpv6StringToAddressExW(wstr ptr ptr ptr) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 8b6826e181..f481969549 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1273,6 +1273,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.23.0