Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46149 Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v3: Simplify null termination --- dlls/ntdll/ntdll.spec | 4 ++-- dlls/ntdll/rtl.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 522c8bfa0b..67fcd83d4f 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -760,8 +760,8 @@ @ stdcall RtlIpv4AddressToStringExA(ptr long ptr ptr) @ stdcall RtlIpv4AddressToStringExW(ptr long ptr ptr) @ stdcall RtlIpv4AddressToStringW(ptr ptr) -# @ stub RtlIpv4StringToAddressA -# @ stub RtlIpv4StringToAddressExA +@ stdcall RtlIpv4StringToAddressA(str long ptr ptr) +@ stdcall RtlIpv4StringToAddressExA(str long ptr ptr) @ stdcall RtlIpv4StringToAddressExW(wstr long ptr ptr) @ stdcall RtlIpv4StringToAddressW(wstr long ptr ptr) # @ stub RtlIpv6AddressToStringA diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 72ecfd937a..1604513e7e 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1039,6 +1039,39 @@ NTSTATUS WINAPI RtlIpv4StringToAddressW(const WCHAR *str, BOOLEAN strict, const return ipv4_string_to_address(str, strict, terminator, address, NULL); }
+/*********************************************************************** + * RtlIpv4StringToAddressExA [NTDLL.@] + */ +NTSTATUS WINAPI RtlIpv4StringToAddressExA(const char *str, BOOLEAN strict, IN_ADDR *address, USHORT *port) +{ + WCHAR wstr[32]; + + TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, address, port); + + if (!str || !address || !port) + return STATUS_INVALID_PARAMETER; + + RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1); + return ipv4_string_to_address(wstr, strict, NULL, address, port); +} + +/*********************************************************************** + * RtlIpv4StringToAddressA [NTDLL.@] + */ +NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const char **terminator, IN_ADDR *address) +{ + WCHAR wstr[32]; + const WCHAR *wterminator; + NTSTATUS ret; + + TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, terminator, address); + + RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1); + ret = ipv4_string_to_address(wstr, strict, &wterminator, address, NULL); + if (terminator) *terminator = str + (wterminator - wstr); + return ret; +} + /*********************************************************************** * RtlIpv6StringToAddressExW [NTDLL.@] */