Esempio n. 1
0
            /// <summary>
            /// Converts a pointer to a BSS list (header + entries) to an array of BSS entries.
            /// </summary>
            /// <param name="bssListPtr">A pointer to a BSS list's header.</param>
            /// <returns>An array of BSS entries.</returns>
            private static Wlan.WlanBssEntry[] ConvertBssListPtr(IntPtr bssListPtr)
            {
                Wlan.WlanBssListHeader bssListHeader = (Wlan.WlanBssListHeader)Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader));
                long bssListIt = bssListPtr.ToInt64() + Marshal.SizeOf(typeof(Wlan.WlanBssListHeader));

                Wlan.WlanBssEntry[] bssEntries = new Wlan.WlanBssEntry[bssListHeader.numberOfItems];
                for (int i = 0; i < bssListHeader.numberOfItems; ++i)
                {
                    bssEntries[i] = (Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(bssListIt), typeof(Wlan.WlanBssEntry));
                    bssListIt    += Marshal.SizeOf(typeof(Wlan.WlanBssEntry));
                }
                return(bssEntries);
            }
            private static Wlan.WlanBssEntry[] ConvertBssListPtr(IntPtr bssListPtr)
            {
                Wlan.WlanBssListHeader structure = (Wlan.WlanBssListHeader)Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader));
                long num = bssListPtr.ToInt64() + (long)Marshal.SizeOf(typeof(Wlan.WlanBssListHeader));

                Wlan.WlanBssEntry[] wlanBssEntryArray = new Wlan.WlanBssEntry[(int)structure.numberOfItems];
                for (int index = 0; (long)index < (long)structure.numberOfItems; ++index)
                {
                    wlanBssEntryArray[index] = (Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanBssEntry));
                    num += (long)Marshal.SizeOf(typeof(Wlan.WlanBssEntry));
                }
                return(wlanBssEntryArray);
            }
Esempio n. 3
0
File: WlanApi.cs Progetto: t00/seb
 /// <summary>
 /// Converts a pointer to a BSS list (header + entries) to an array of BSS entries.
 /// </summary>
 /// <param name="bssListPtr">A pointer to a BSS list's header.</param>
 /// <returns>An array of BSS entries.</returns>
 private static Wlan.WlanBssEntry[] ConvertBssListPtr(IntPtr bssListPtr)
 {
     Wlan.WlanBssListHeader bssListHeader = (Wlan.WlanBssListHeader)Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader));
     long bssListIt = bssListPtr.ToInt64() + Marshal.SizeOf(typeof(Wlan.WlanBssListHeader));
     Wlan.WlanBssEntry[] bssEntries = new Wlan.WlanBssEntry[bssListHeader.numberOfItems];
     for (int i = 0; i < bssListHeader.numberOfItems; ++i)
     {
         bssEntries[i] = (Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(bssListIt), typeof(Wlan.WlanBssEntry));
         bssListIt += Marshal.SizeOf(typeof(Wlan.WlanBssEntry));
     }
     return bssEntries;
 }