From e32483cc37bc466fdf009acbf8c1c9fb404ec972 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Fri, 30 Aug 2019 13:43:52 -0600 Subject: [PATCH 5/5] 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 ac918bfa33..5a69721270 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -776,8 +776,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) @ stdcall RtlIpv6StringToAddressExW(wstr ptr ptr ptr) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index d2a7a6aac9..eb23639edc 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1468,6 +1468,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.24.1