wine-staging/patches/ntdll-RtlIpv4StringToAddress/0002-ntdll-Implement-RtlIpv4StringToAddress-Ex-A.patch

75 lines
2.7 KiB
Diff
Raw Normal View History

From 2f39a185e26072c7c776a1475236d798ebf267f0 Mon Sep 17 00:00:00 2001
From: Alex Henrie <alexhenrie24@gmail.com>
Date: Sun, 25 Aug 2019 17:18:06 -0600
Subject: [PATCH 2/4] ntdll: Implement RtlIpv4StringToAddress(Ex)A
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 | 33 +++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 82c78f6e78..8cacc97ec4 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.@]
*/
--
2.23.0