mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 21:57:18 +00:00
iphlpapi: Implement ParseNetworkString for IPv4 addresses and services.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45560 Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8599d8e52e
commit
faf354cd45
|
@ -243,7 +243,7 @@
|
|||
@ stdcall NotifyUnicastIpAddressChange(long ptr ptr long ptr)
|
||||
#@ stub NTPTimeToNTFileTime
|
||||
#@ stub NTTimeToNTPTime
|
||||
#@ stub ParseNetworkString
|
||||
@ stdcall ParseNetworkString(wstr long ptr ptr ptr)
|
||||
@ stub _PfAddFiltersToInterface@24
|
||||
@ stub _PfAddGlobalFilterToInterface@8
|
||||
@ stdcall _PfBindInterfaceToIPAddress@12(long long ptr) PfBindInterfaceToIPAddress
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "winsock2.h"
|
||||
#include "winternl.h"
|
||||
#include "ws2ipdef.h"
|
||||
#include "windns.h"
|
||||
#include "iphlpapi.h"
|
||||
#include "ifenum.h"
|
||||
#include "ipstats.h"
|
||||
|
@ -54,6 +55,7 @@
|
|||
#include "ifdef.h"
|
||||
#include "netioapi.h"
|
||||
#include "tcpestats.h"
|
||||
#include "ip2string.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
@ -3333,3 +3335,62 @@ DWORD WINAPI GetBestRoute2(NET_LUID *luid, NET_IFINDEX index,
|
|||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* ParseNetworkString (IPHLPAPI.@)
|
||||
*/
|
||||
DWORD WINAPI ParseNetworkString(const WCHAR *str, DWORD type,
|
||||
NET_ADDRESS_INFO *info, USHORT *port, BYTE *prefix_len)
|
||||
{
|
||||
IN_ADDR temp_addr4;
|
||||
USHORT temp_port = 0;
|
||||
NTSTATUS status;
|
||||
|
||||
TRACE("(%s, %d, %p, %p, %p)\n", debugstr_w(str), type, info, port, prefix_len);
|
||||
|
||||
if (!str)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (type & NET_STRING_IPV4_ADDRESS)
|
||||
{
|
||||
status = RtlIpv4StringToAddressExW(str, TRUE, &temp_addr4, &temp_port);
|
||||
if (SUCCEEDED(status) && !temp_port)
|
||||
{
|
||||
if (info)
|
||||
{
|
||||
info->Format = NET_ADDRESS_IPV4;
|
||||
info->u.Ipv4Address.sin_addr = temp_addr4;
|
||||
info->u.Ipv4Address.sin_port = 0;
|
||||
}
|
||||
if (port) *port = 0;
|
||||
if (prefix_len) *prefix_len = 255;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
if (type & NET_STRING_IPV4_SERVICE)
|
||||
{
|
||||
status = RtlIpv4StringToAddressExW(str, TRUE, &temp_addr4, &temp_port);
|
||||
if (SUCCEEDED(status) && temp_port)
|
||||
{
|
||||
if (info)
|
||||
{
|
||||
info->Format = NET_ADDRESS_IPV4;
|
||||
info->u.Ipv4Address.sin_addr = temp_addr4;
|
||||
info->u.Ipv4Address.sin_port = temp_port;
|
||||
}
|
||||
if (port) *port = ntohs(temp_port);
|
||||
if (prefix_len) *prefix_len = 255;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (info) info->Format = NET_ADDRESS_FORMAT_UNSPECIFIED;
|
||||
|
||||
if (type & ~(NET_STRING_IPV4_ADDRESS|NET_STRING_IPV4_SERVICE))
|
||||
{
|
||||
FIXME("Unimplemented type 0x%x\n", type);
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue