public Wlan.WlanProfileInfo[] GetProfiles()
            {
                IntPtr profileList;

                Wlan.ThrowIfError(Wlan.WlanGetProfileList(this.client.clientHandle, this.info.interfaceGuid, IntPtr.Zero, out profileList));
                try
                {
                    Wlan.WlanProfileInfoListHeader structure1           = (Wlan.WlanProfileInfoListHeader)Marshal.PtrToStructure(profileList, typeof(Wlan.WlanProfileInfoListHeader));
                    Wlan.WlanProfileInfo[]         wlanProfileInfoArray = new Wlan.WlanProfileInfo[(int)structure1.numberOfItems];
                    long num = profileList.ToInt64() + (long)Marshal.SizeOf((object)structure1);
                    for (int index = 0; (long)index < (long)structure1.numberOfItems; ++index)
                    {
                        Wlan.WlanProfileInfo structure2 = (Wlan.WlanProfileInfo)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanProfileInfo));
                        wlanProfileInfoArray[index] = structure2;
                        num += (long)Marshal.SizeOf((object)structure2);
                    }
                    return(wlanProfileInfoArray);
                }
                finally
                {
                    Wlan.WlanFreeMemory(profileList);
                }
            }
Esempio n. 2
0
            /// <summary>
            /// Gets the information of all profiles on this interface.
            /// </summary>
            /// <returns>The profiles information.</returns>
            public Wlan.WlanProfileInfo[] GetProfiles()
            {
                IntPtr profileListPtr;

                Wlan.ThrowIfError(
                    Wlan.WlanGetProfileList(client.clientHandle, info.interfaceGuid, IntPtr.Zero, out profileListPtr));
                try
                {
                    Wlan.WlanProfileInfoListHeader header       = (Wlan.WlanProfileInfoListHeader)Marshal.PtrToStructure(profileListPtr, typeof(Wlan.WlanProfileInfoListHeader));
                    Wlan.WlanProfileInfo[]         profileInfos = new Wlan.WlanProfileInfo[header.numberOfItems];
                    long profileListIterator = profileListPtr.ToInt64() + Marshal.SizeOf(header);
                    for (int i = 0; i < header.numberOfItems; ++i)
                    {
                        Wlan.WlanProfileInfo profileInfo = (Wlan.WlanProfileInfo)Marshal.PtrToStructure(new IntPtr(profileListIterator), typeof(Wlan.WlanProfileInfo));
                        profileInfos[i]      = profileInfo;
                        profileListIterator += Marshal.SizeOf(profileInfo);
                    }
                    return(profileInfos);
                }
                finally
                {
                    Wlan.WlanFreeMemory(profileListPtr);
                }
            }