Ejemplo n.º 1
0
            /// <summary>All profiles on this interface</summary>
            /// <returns>A list of profile Informations</returns>
            public WlanProfileInfo[] GetProfiles()
            {
                IntPtr profileListPtr;

                SystemInterface.WlanGetProfileList(client.clientHandle, info.interfaceGuid, IntPtr.Zero,
                                                   out profileListPtr);
                ListHeader header = (ListHeader)Marshal.PtrToStructure(profileListPtr, typeof(ListHeader));

                WlanProfileInfo[] profileInfos = new WlanProfileInfo[header.numberOfItems];

                // By the standard this is the correction start position
                long profileListIterator = profileListPtr.ToInt64() + Marshal.SizeOf(header);

                for (int i = 0; i < header.numberOfItems; ++i)
                {
                    WlanProfileInfo profileInfo
                        = (WlanProfileInfo)Marshal.PtrToStructure(new IntPtr(profileListIterator),
                                                                  typeof(WlanProfileInfo));
                    profileInfos[i]      = profileInfo;
                    profileListIterator += Marshal.SizeOf(profileInfo);
                }
                return(profileInfos);
            }