Esempio n. 1
0
        public static MIB_IPNET_ROW2[] GetTable(IntPtr pMIB_IPNET_TABLE2)
        {
            MIB_IPNET_ROW2[] table = null;
            try
            {
                MIB_IPNET_TABLE2 mib_ipnet_table2 = (MIB_IPNET_TABLE2)Marshal.PtrToStructure(
                    pMIB_IPNET_TABLE2,
                    typeof(MIB_IPNET_TABLE2));

                table = new MIB_IPNET_ROW2[mib_ipnet_table2.NumEntries];

                IntPtr currentPointer = pMIB_IPNET_TABLE2 + 8;

                for (int i = 0; i < mib_ipnet_table2.NumEntries; i++)
                {
                    table[i] = (MIB_IPNET_ROW2)Marshal.PtrToStructure(
                        currentPointer,
                        typeof(MIB_IPNET_ROW2));

                    currentPointer += Marshal.SizeOf(table[i]);
                }

                return(table);
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 2
0
 public static extern int ResolveIpNetEntry2(
     [In, Out] ref MIB_IPNET_ROW2 Row,
     [In, Out] ref SOCKADDR_INET SourceAddress);