Exemplo n.º 1
0
        public static List <MIB_IFROW> GetIfTable()
        {
            int x, cb = 0;
            var ret = new LPMIB_IFTABLE();

            x = GetIfTable(IntPtr.Zero, ref cb, false);

            if (x != ERROR_INSUFFICIENT_BUFFER)
            {
                return(null);
            }

            if (cb <= 0)
            {
                return(null);
            }

            if (!ret.Alloc(cb))
            {
                return(null);
            }

            x = GetIfTable(ret, ref cb, false);

            if (x != 0)
            {
                return(null);
            }

            var l = new List <MIB_IFROW>();

            foreach (var inf in ret)
            {
                l.Add(inf);
            }

            ret.Dispose();

            return(l);
        }
Exemplo n.º 2
0
 public static extern int GetIfTable(
     LPMIB_IFTABLE pIfTable,
     ref int pdwSize,
     bool bOrder
     );