[PATCH resend 3/3] ntdll: Implement RtlIpv4StringToAddress(Ex)W
Alexandre Julliard
julliard at winehq.org
Fri Aug 23 12:37:52 CDT 2019
Alex Henrie <alexhenrie24 at gmail.com> writes:
> @@ -1044,8 +1044,17 @@ NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const c
> */
> NTSTATUS WINAPI RtlIpv4StringToAddressExW(const WCHAR *str, BOOLEAN strict, IN_ADDR *address, USHORT *port)
> {
> - FIXME("(%s, %u, %p, %p): stub\n", debugstr_w(str), strict, address, port);
> - return STATUS_NOT_IMPLEMENTED;
> + char cstr[32];
> + ULONG clen;
> +
> + TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, address, port);
> +
> + if (!str || !address || !port)
> + return STATUS_INVALID_PARAMETER;
> +
> + RtlUnicodeToMultiByteN(cstr, sizeof(cstr) - 1, &clen, str, strlenW(str));
> + cstr[clen] = 0;
> + return ipv4_string_to_address(cstr, strict, NULL, address, port);
> }
>
> /***********************************************************************
> @@ -1053,8 +1062,18 @@ NTSTATUS WINAPI RtlIpv4StringToAddressExW(const WCHAR *str, BOOLEAN strict, IN_A
> */
> NTSTATUS WINAPI RtlIpv4StringToAddressW(const WCHAR *str, BOOLEAN strict, const WCHAR **terminator, IN_ADDR *address)
> {
> - FIXME("(%s, %u, %p, %p): stub\n", debugstr_w(str), strict, terminator, address);
> - return STATUS_NOT_IMPLEMENTED;
> + char cstr[32];
> + ULONG clen;
> + const char *cterminator;
> + NTSTATUS ret;
> +
> + TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, terminator, address);
> +
> + RtlUnicodeToMultiByteN(cstr, sizeof(cstr) - 1, &clen, str, strlenW(str));
> + cstr[clen] = 0;
> + ret = ipv4_string_to_address(cstr, strict, &cterminator, address, NULL);
> + if (terminator) *terminator = str + (cterminator - cstr);
> + return ret;
It doesn't seem right to have the W function call the A implementation,
it should be the other way around.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list