Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46149 Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ntdll/ntdll.spec | 4 ++-- dlls/ntdll/rtl.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 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 a7a239d5a7..ebeb45d5e9 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1039,6 +1039,43 @@ 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]; + ULONG wsize; + + TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, address, port); + + if (!str || !address || !port) + return STATUS_INVALID_PARAMETER; + + RtlMultiByteToUnicodeN(wstr, sizeof(wstr) - 1, &wsize, str, strlen(str)); + wstr[wsize / sizeof(WCHAR)] = 0; + 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]; + ULONG wsize; + const WCHAR *wterminator; + NTSTATUS ret; + + TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, terminator, address); + + RtlMultiByteToUnicodeN(wstr, sizeof(wstr) - 1, &wsize, str, strlen(str)); + wstr[wsize / sizeof(WCHAR)] = 0; + ret = ipv4_string_to_address(wstr, strict, &wterminator, address, NULL); + if (terminator) *terminator = str + (wterminator - wstr); + return ret; +} + /*********************************************************************** * RtlIpv6StringToAddressExW [NTDLL.@] */