Пример #1
0
        public Wlan.WlanProfileInfo[] GetProfiles()
        {
            IntPtr ptr;

            Wlan.WlanProfileInfo[] infoArray2;
            Wlan.ThrowIfError(Wlan.WlanGetProfileList(_client.ItsClientHandle, _info.interfaceGuid, IntPtr.Zero, out ptr));
            try
            {
                Wlan.WlanProfileInfoListHeader structure = (Wlan.WlanProfileInfoListHeader)Marshal.PtrToStructure(ptr, typeof(Wlan.WlanProfileInfoListHeader));
                Wlan.WlanProfileInfo[]         infoArray = new Wlan.WlanProfileInfo[structure.numberOfItems];
                long num = ptr.ToInt64() + Marshal.SizeOf(structure);
                for (int i = 0; i < structure.numberOfItems; i++)
                {
                    Wlan.WlanProfileInfo info = (Wlan.WlanProfileInfo)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanProfileInfo));
                    infoArray[i] = info;
                    num         += Marshal.SizeOf(info);
                }
                infoArray2 = infoArray;
            }
            finally
            {
                Wlan.WlanFreeMemory(ptr);
            }
            return(infoArray2);
        }
Пример #2
0
 public Wlan.WlanProfileInfo[] GetProfiles()
 {
     IntPtr ptr;
     Wlan.WlanProfileInfo[] infoArray2;
     Wlan.ThrowIfError(Wlan.WlanGetProfileList(_client._clientHandle, _info.interfaceGuid, IntPtr.Zero, out ptr));
     try
     {
         Wlan.WlanProfileInfoListHeader structure = (Wlan.WlanProfileInfoListHeader) Marshal.PtrToStructure(ptr, typeof(Wlan.WlanProfileInfoListHeader));
         Wlan.WlanProfileInfo[] infoArray = new Wlan.WlanProfileInfo[structure.numberOfItems];
         long num = ptr.ToInt64() + Marshal.SizeOf(structure);
         for (int i = 0; i < structure.numberOfItems; i++)
         {
             Wlan.WlanProfileInfo info = (Wlan.WlanProfileInfo) Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanProfileInfo));
             infoArray[i] = info;
             num += Marshal.SizeOf(info);
         }
         infoArray2 = infoArray;
     }
     finally
     {
         Wlan.WlanFreeMemory(ptr);
     }
     return infoArray2;
 }