GetNetworkParams

C# Signature:

[DllImport("iphlpapi.dll", CharSet=CharSet.Ansi)]
public static extern int GetNetworkParams(IntPtr pFixedInfo, ref UInt32 pBufOutLen);

VB.NET Signature:

<DllImport("iphlpapi.dll", CharSet:=CharSet.Ansi)>
    Public Shared Function GetNetworkParams(pFixedInfo As IntPtr, ByRef pBufOutLen As Integer) As Integer
    End Function

Sample Code:

infoPtr = Marshal.AllocHGlobal(Convert.ToInt32(infoLen));
    ret = GetNetworkParams(infoPtr, ref infoLen);

    if (ret == ERROR_BUFFER_OVERFLOW)
    {
        //try again w/ bigger buffer:
        Marshal.FreeHGlobal(infoPtr);
        continue;
    }

    if (ret == ERROR_SUCCESS)
        break;

    throw new ApplicationException("An error occurred while fetching adapter information.", new Win32Exception(Convert.ToInt32(ret)));

Sample Code:

Sample Code:

Última actualización