Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@ -49,9 +49,12 @@ namespace System.Net.NetworkInformation {
{
IntPtr ptr = IntPtr.Zero;
int len = 0;
GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len);
uint flags = Win32_IP_ADAPTER_ADDRESSES.GAA_FLAG_INCLUDE_WINS_INFO | Win32_IP_ADAPTER_ADDRESSES.GAA_FLAG_INCLUDE_GATEWAYS;
GetAdaptersAddresses (0, flags, IntPtr.Zero, ptr, ref len);
if (Marshal.SizeOf (typeof (Win32_IP_ADAPTER_ADDRESSES)) > len)
throw new NetworkInformationException ();
ptr = Marshal.AllocHGlobal(len);
int ret = GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len);
int ret = GetAdaptersAddresses (0, flags, IntPtr.Zero, ptr, ref len);
if (ret != 0)
throw new NetworkInformationException (ret);
@ -105,14 +108,6 @@ namespace System.Net.NetworkInformation {
[DllImport ("iphlpapi.dll", SetLastError = true)]
static extern int GetIfEntry (ref Win32_MIB_IFROW row);
public static Win32_IP_ADAPTER_INFO GetAdapterInfoByIndex (int index)
{
foreach (Win32_IP_ADAPTER_INFO info in GetAdaptersInfo ())
if (info.Index == index)
return info;
throw new IndexOutOfRangeException ("No adapter found for index " + index);
}
static Win32_IP_ADAPTER_INFO [] GetAdaptersInfo ()
{
int len = 0;