public static extern void IntPtr_To_IPAddrString(ref IPAddrString dst, IntPtr src, int size);
        private static void GetHostInfo()
        {
            int size=0;
             int r = Iphlpapi.GetNetworkParams(null, ref size);
             if ((r != IPConfigConst.ERROR_SUCCESS) && (r != IPConfigConst.ERROR_BUFFER_OVERFLOW))
             {
            throw new Exception("Error invoking GetNetworkParams() " + r);
             }

             Byte[] buffer= new Byte[size];
             r = Iphlpapi.GetNetworkParams(buffer, ref size);
             if (r != IPConfigConst.ERROR_SUCCESS)
             {
            throw new Exception("Error invoking GetNetworkParams() " + r);
             }

             FixedInfo PFixedInfo= new FixedInfo();
             MemoryCopier.ByteArray_To_FixedInfo(ref PFixedInfo, buffer, Marshal.SizeOf(PFixedInfo));

             _hostname = PFixedInfo.HostName;
             _domain = PFixedInfo.DomainName;

             IPAddrString ListItem = new IPAddrString();
             IntPtr ListNext = new IntPtr();

             System.Collections.ArrayList servers = new System.Collections.ArrayList();
             servers.Add(PFixedInfo.DnsServerList.IPAddressString);

             ListNext = PFixedInfo.DnsServerList.NextPointer;
             while (ListNext.ToInt32() != 0)
             {
            MemoryCopier.IntPtr_To_IPAddrString(ref ListItem, ListNext, Marshal.SizeOf(ListItem));
            servers.Add(ListItem.IPAddressString);
            ListNext = ListItem.NextPointer;
             }
             if (servers.Count > 0)
             {
            _dnsServers = (string[])servers.ToArray(typeof(string));
             }
        }