Author: tfaber
Date: Sat Feb 14 19:14:32 2015
New Revision: 66270
URL:
http://svn.reactos.org/svn/reactos?rev=66270&view=rev
Log:
[RTL]
- Implement RtlIpv4StringToAddressExW. Patch by Mark Jansen.
CORE-6490
Modified:
trunk/reactos/lib/rtl/network.c
Modified: trunk/reactos/lib/rtl/network.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/network.c?rev=6627…
==============================================================================
--- trunk/reactos/lib/rtl/network.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/network.c [iso-8859-1] Sat Feb 14 19:14:32 2015
@@ -337,17 +337,52 @@
}
/*
-* @unimplemented
-*/
-NTSTATUS
-NTAPI
-RtlIpv4StringToAddressExW(IN PCWSTR AddressString,
- IN BOOLEAN Strict,
- OUT struct in_addr *Address,
- OUT PUSHORT Port)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+* @implemented
+*/
+NTSTATUS
+NTAPI
+RtlIpv4StringToAddressExW(
+ _In_ PCWSTR AddressString,
+ _In_ BOOLEAN Strict,
+ _Out_ struct in_addr *Address,
+ _Out_ PUSHORT Port)
+{
+ PCWSTR CurrentChar;
+ ULONG ConvertedPort;
+ NTSTATUS Status;
+
+ if (!AddressString || !Address || !Port)
+ return STATUS_INVALID_PARAMETER;
+
+ Status = RtlIpv4StringToAddressW(AddressString,
+ Strict,
+ &CurrentChar,
+ Address);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ if (!*CurrentChar)
+ {
+ *Port = 0;
+ return STATUS_SUCCESS;
+ }
+
+ if (*CurrentChar != L':')
+ return STATUS_INVALID_PARAMETER;
+ ++CurrentChar;
+
+ Status = RtlpStringToUlong(CurrentChar,
+ FALSE,
+ &CurrentChar,
+ &ConvertedPort);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ if (*CurrentChar || !ConvertedPort || ConvertedPort > 0xffff)
+ return STATUS_INVALID_PARAMETER;
+
+ *Port = WN2H(ConvertedPort);
+ return STATUS_SUCCESS;
}
/*